@next-bricks/diagram 0.50.2 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +3 -3
- package/dist/chunks/3233.fd1ca80f.js +3 -0
- package/dist/chunks/3233.fd1ca80f.js.map +1 -0
- package/dist/chunks/4411.1ae59113.js +3 -0
- package/dist/chunks/4411.1ae59113.js.map +1 -0
- package/dist/chunks/{4837.70d6aed1.js → 4837.695bdc4f.js} +2 -2
- package/dist/chunks/{4837.70d6aed1.js.map → 4837.695bdc4f.js.map} +1 -1
- package/dist/chunks/5336.0f20fd08.js +2 -0
- package/dist/chunks/5336.0f20fd08.js.map +1 -0
- package/dist/chunks/5443.6617ae99.js +3 -0
- package/dist/chunks/5443.6617ae99.js.map +1 -0
- package/dist/chunks/{1124.b5167ef0.js → 5580.818fe55b.js} +2 -2
- package/dist/chunks/{1124.b5167ef0.js.map → 5580.818fe55b.js.map} +1 -1
- package/dist/chunks/{7218.46d7a966.js → 7218.acbb92c1.js} +2 -2
- package/dist/chunks/{7218.46d7a966.js.map → 7218.acbb92c1.js.map} +1 -1
- package/dist/chunks/9711.39f95654.js +2 -0
- package/dist/chunks/9711.39f95654.js.map +1 -0
- package/dist/chunks/editable-label.6b33860e.js +3 -0
- package/dist/chunks/editable-label.6b33860e.js.map +1 -0
- package/dist/chunks/eo-diagram.5f3935a9.js +2 -0
- package/dist/chunks/{eo-diagram.93f17e33.js.map → eo-diagram.5f3935a9.js.map} +1 -1
- package/dist/chunks/{eo-display-canvas.d9801bac.js → eo-display-canvas.d3cb3888.js} +2 -2
- package/dist/chunks/eo-display-canvas.d3cb3888.js.map +1 -0
- package/dist/chunks/eo-draw-canvas.0c5d7dfb.js +2 -0
- package/dist/chunks/eo-draw-canvas.0c5d7dfb.js.map +1 -0
- package/dist/chunks/main.e126923f.js +2 -0
- package/dist/chunks/{main.18a3db6f.js.map → main.e126923f.js.map} +1 -1
- package/dist/examples.json +4 -4
- package/dist/index.189ba5c8.js +2 -0
- package/dist/{index.c124d22e.js.map → index.189ba5c8.js.map} +1 -1
- package/dist/manifest.json +59 -55
- package/dist/types.json +172 -71
- package/dist-types/draw-canvas/EdgeComponent.d.ts +4 -2
- package/dist-types/draw-canvas/LineLabelComponent.d.ts +11 -0
- package/dist-types/draw-canvas/interfaces.d.ts +6 -3
- package/dist-types/editable-label/index.d.ts +3 -1
- package/docs/eo-draw-canvas.md +150 -0
- package/package.json +2 -2
- package/dist/chunks/3233.19da547d.js +0 -3
- package/dist/chunks/3233.19da547d.js.map +0 -1
- package/dist/chunks/4766.f59e3f71.js +0 -3
- package/dist/chunks/4766.f59e3f71.js.map +0 -1
- package/dist/chunks/788.5a8dd377.js +0 -3
- package/dist/chunks/788.5a8dd377.js.map +0 -1
- package/dist/chunks/9711.97cc0d7a.js +0 -2
- package/dist/chunks/9711.97cc0d7a.js.map +0 -1
- package/dist/chunks/9961.b9465f07.js +0 -2
- package/dist/chunks/9961.b9465f07.js.map +0 -1
- package/dist/chunks/editable-label.224a6514.js +0 -3
- package/dist/chunks/editable-label.224a6514.js.map +0 -1
- package/dist/chunks/eo-diagram.93f17e33.js +0 -2
- package/dist/chunks/eo-display-canvas.d9801bac.js.map +0 -1
- package/dist/chunks/eo-draw-canvas.368890a9.js +0 -2
- package/dist/chunks/eo-draw-canvas.368890a9.js.map +0 -1
- package/dist/chunks/main.18a3db6f.js +0 -2
- package/dist/index.c124d22e.js +0 -2
- /package/dist/chunks/{3233.19da547d.js.LICENSE.txt → 3233.fd1ca80f.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{4766.f59e3f71.js.LICENSE.txt → 4411.1ae59113.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{788.5a8dd377.js.LICENSE.txt → 5443.6617ae99.js.LICENSE.txt} +0 -0
- /package/dist/chunks/{editable-label.224a6514.js.LICENSE.txt → editable-label.6b33860e.js.LICENSE.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
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AAEU,SAAYT,EAAyBS,OACvCV,EAAE3U,KAAK8H,SAAY8M,EAAyB5U,KAAK8H,QACjD6M,EAAE3U,KAAK+H,SAAY6M,EAAyB5U,KAAK+H,SACtD6M,CACP,kCCVO,SAASqE,EACdhP,EAA6B7L,GAEX,IADlB,YAAE8a,EAAW,aAAEC,EAAY,WAAEC,GAAsChb,EAE/DgH,EAAOiU,IACP/T,EAAM+T,IACNC,GAAQ,IACRC,GAAS,IACb,IAAK,MAAM3T,KAAQqE,EAAe,CAChC,MAAMuP,EAAK5T,EAAKnH,MAAQ,EAClBgb,EAAK7T,EAAKlH,OAAS,EACnB+M,EAAI7F,EAAKL,EAAIiU,EACbE,EAAI9T,EAAKL,EAAIiU,EACbG,EAAI/T,EAAKJ,EAAIiU,EACb7E,EAAIhP,EAAKJ,EAAIiU,EACfhO,EAAIrG,IACNA,EAAOqG,GAELiO,EAAIJ,IACNA,EAAQI,GAENC,EAAIrU,IACNA,EAAMqU,GAEJ/E,EAAI2E,IACNA,EAAS3E,EAEb,CAEA,MAAMnW,EAAQ6a,EAAQlU,EAChB1G,EAAS6a,EAASjU,EAElB+Q,EACJ+C,IAAe3a,EAAQya,GAAexa,EAASya,GAC3CxS,KAAKC,IACHD,KAAKiL,IAAIsH,EAAcza,EAAO0a,EAAeza,EAAQ0a,EAAW,IAChEA,EAAW,IAEb,EAKN,MAAO,CAAE7T,GAHE2T,EAAcza,EAAQ4X,GAAS,EAAIjR,EAAOiR,EAGzC7Q,GAFD2T,EAAeza,EAAS2X,GAAS,EAAI/Q,EAAM+Q,EAEvCuD,EAAGvD,EACpB,kFCjDIwD,QAA0B,GAA4B,KAE1DA,EAAwB3P,KAAK,CAAC4P,EAAO7a,GAAI,s0BAImX,KAE5Z,QAAe4a,EAAwBE","sources":["webpack:///./src/diagram/ConnectLineComponent.tsx","webpack:///./src/diagram/LineComponent.tsx","webpack:///./src/diagram/LineLabelComponent.tsx","webpack:///./src/diagram/LineMaskComponent.tsx","webpack:///./src/diagram/NodeComponent.tsx","webpack:///./src/diagram/processors/findNodeBrick.ts","webpack:///./src/diagram/constants.ts","webpack:///./src/diagram/processors/adjustNodesSize.ts","webpack:///./src/diagram/processors/adjustNodesPosition.ts","webpack:///./src/diagram/processors/getRenderedEdges.ts","webpack:///./src/diagram/processors/getForceGraph.ts","webpack:///./src/diagram/hooks/useRenderedDiagram.ts","webpack:///./src/diagram/processors/getDagreGraph.ts","webpack:///./src/diagram/processors/getManualGraph.ts","webpack:///../../node_modules/@next-api-sdk/cmdb-sdk/dist/esm/api/cmdb/instance/postSearchV3.js","webpack:///../../node_modules/@next-api-sdk/cmdb-sdk/dist/esm/api/cmdb/instance/updateInstanceV2.js","webpack:///../../node_modules/@next-api-sdk/cmdb-sdk/dist/esm/api/cmdb/instance/createInstance.js","webpack:///./src/diagram/hooks/useUserView.ts","webpack:///./src/diagram/processors/createAsyncQueue.ts","webpack:///./src/diagram/processors/adjustLineLabels.ts","webpack:///./src/diagram/processors/getLineMaskRects.ts","webpack:///./src/diagram/processors/getRenderedLineLabels.ts","webpack:///./src/diagram/processors/getRenderedLines.ts","webpack:///./src/diagram/processors/handleKeyboard.ts","webpack:///./src/diagram/processors/handleNodesMouseDown.ts","webpack:///./src/diagram/processors/matchEdgeByFilter.ts","webpack:///./src/diagram/processors/normalizeLinesAndMarkers.ts","webpack:///./src/diagram/processors/sameTarget.ts","webpack:///./src/diagram/processors/transformToCenter.ts","webpack:///./src/diagram/styles.shadow.css"],"sourcesContent":["import React from \"react\";\nimport classNames from \"classnames\";\nimport type { ConnectLineState, PositionTuple } from \"./interfaces\";\nimport { MarkerComponent } from \"./MarkerComponent\";\n\nexport interface ConnectLineComponentProps {\n connectLineState: ConnectLineState | null;\n connectLineTo: PositionTuple;\n markerPrefix: string;\n}\n\nexport function ConnectLineComponent({\n connectLineState,\n connectLineTo,\n markerPrefix,\n}: ConnectLineComponentProps): JSX.Element {\n return (\n <svg\n width=\"100%\"\n height=\"100%\"\n className={classNames(\"connect-line\", {\n connecting:\n !!connectLineState &&\n // Do not show when the distance of mouse move is less than 5px\n (connectLineTo[0] - connectLineState.from[0]) ** 2 +\n (connectLineTo[1] - connectLineState.from[1]) ** 2 >\n 25,\n })}\n >\n <defs>\n <MarkerComponent\n type=\"arrow\"\n id={`${markerPrefix}connect-line`}\n strokeColor={connectLineState?.options.strokeColor}\n />\n </defs>\n <path\n d={\n connectLineState\n ? `M${connectLineState.from.join(\" \")}L${connectLineTo.join(\" \")}`\n : \"\"\n }\n fill=\"none\"\n stroke={connectLineState?.options.strokeColor}\n strokeWidth={connectLineState?.options.strokeWidth}\n markerEnd={\n connectLineState?.options.arrow\n ? `url(#${markerPrefix}connect-line)`\n : undefined\n }\n />\n </svg>\n );\n}\n","import React from \"react\";\nimport classNames from \"classnames\";\nimport type { LineTarget, RenderedLine, LineMaskRects } from \"./interfaces\";\n\nexport interface LineComponentProps {\n line: RenderedLine;\n linePaths: Map<string, SVGPathElement | null>;\n lineMaskRects: LineMaskRects;\n maskPrefix: string;\n markerPrefix: string;\n activeLineMarkerPrefix: string;\n active?: boolean;\n activeRelated?: boolean;\n onLineClick?(line: LineTarget): void;\n onLineDoubleClick?(line: LineTarget): void;\n}\n\nexport function LineComponent({\n line: { line, edge, d, markers },\n linePaths,\n lineMaskRects,\n maskPrefix,\n markerPrefix,\n activeLineMarkerPrefix,\n active,\n activeRelated,\n onLineClick,\n onLineDoubleClick,\n}: LineComponentProps): JSX.Element {\n const mask = lineMaskRects.has(line.$id)\n ? `url(#${maskPrefix}${line.$id})`\n : undefined;\n\n const { strokeColor, strokeWidth, interactStrokeWidth } = {\n ...line,\n ...(active\n ? line.overrides?.active\n : activeRelated\n ? line.overrides?.activeRelated\n : null),\n };\n\n const expectVariant = active\n ? \"active\"\n : activeRelated\n ? \"active-related\"\n : \"default\";\n\n let markerStart: string | undefined;\n let markerEnd: string | undefined;\n\n for (const marker of markers) {\n if (marker.variant === expectVariant) {\n if (marker.placement === \"start\") {\n markerStart = `url(#${markerPrefix}${marker.index})`;\n } else {\n markerEnd = `url(#${markerPrefix}${marker.index})`;\n }\n }\n }\n\n return (\n <g\n className={classNames(\"line\", {\n interactable: line.interactable,\n active,\n \"active-related\": activeRelated,\n })}\n onClick={\n line.interactable\n ? () => {\n onLineClick?.({ id: line.$id, edge });\n }\n : undefined\n }\n onDoubleClick={\n line.interactable\n ? (e) => {\n e.preventDefault();\n e.stopPropagation();\n onLineDoubleClick?.({ id: line.$id, edge });\n }\n : undefined\n }\n style={{ cursor: line.cursor }}\n >\n {line.interactable && (\n <path\n // This `path` is made for expanding interaction area of graph lines.\n d={d}\n fill=\"none\"\n stroke=\"transparent\"\n strokeWidth={interactStrokeWidth}\n />\n )}\n <path\n ref={(element) => linePaths.set(line.$id, element)}\n stroke={strokeColor}\n strokeWidth={strokeWidth}\n d={d}\n fill=\"none\"\n markerStart={markerStart}\n markerEnd={markerEnd}\n mask={mask}\n />\n <path\n stroke=\"var(--palette-blue-3)\"\n strokeWidth={strokeWidth}\n d={d}\n fill=\"none\"\n className=\"active-bg\"\n markerStart={`url(#${activeLineMarkerPrefix}start)`}\n markerEnd={`url(#${activeLineMarkerPrefix}end)`}\n mask={mask}\n />\n </g>\n );\n}\n","import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport { checkIfByTransform } from \"@next-core/runtime\";\nimport type {\n DiagramEdge,\n LineLabelConf,\n // PositionTuple,\n RefRepository,\n LineLabel,\n TextOptions,\n} from \"./interfaces\";\n\nexport interface LineLabelComponentGroupProps {\n labels?: LineLabel[];\n onRendered?: (refRepository: RefRepository | null) => void;\n}\n\nexport function LineLabelComponentGroup({\n labels,\n onRendered,\n}: LineLabelComponentGroupProps): JSX.Element {\n const [rendered, setRendered] = useState(false);\n const [renderedIds, setRenderedIds] = useState<string[]>([]);\n const refRepository = useMemo<RefRepository>(() => new Map(), []);\n\n const handleRenderer = useCallback(\n (id: string, element: HTMLElement | null) => {\n if (element) {\n refRepository.set(id, element);\n }\n setRenderedIds((previous) =>\n previous.includes(id) ? previous : previous.concat(id)\n );\n },\n [refRepository]\n );\n\n const handleUnmount = useCallback(\n (id: string) => {\n setRenderedIds((previous) => {\n const index = previous.indexOf(id);\n return index === -1\n ? previous\n : previous.slice(0, index).concat(previous.slice(index + 1));\n });\n refRepository.delete(id);\n },\n [refRepository]\n );\n\n useEffect(() => {\n // All nodes have been rendered.\n setRendered(!labels?.some((label) => !renderedIds.includes(label.id)));\n }, [labels, renderedIds]);\n\n useEffect(\n () => {\n onRendered?.(rendered ? refRepository : null);\n },\n // Dot not re-run effect when `onRendered` changed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [/* onRendered, */ refRepository, rendered]\n );\n\n return (\n <React.Fragment>\n {labels?.map(({ text, label, /* position, */ id, edge }) =>\n label ? (\n <div\n key={id}\n className=\"line-label\"\n // style={{\n // left: position[0],\n // top: position[1],\n // }}\n >\n <LineLabelComponent\n id={id}\n edge={edge}\n label={label}\n onRendered={handleRenderer}\n onUnmount={handleUnmount}\n />\n </div>\n ) : (\n <LineTextComponent\n key={id}\n id={id}\n text={text!}\n // position={position}\n onRendered={handleRenderer}\n />\n )\n )}\n </React.Fragment>\n );\n}\n\nexport interface LineTextComponentProps {\n id: string;\n text: TextOptions;\n // position: PositionTuple;\n onRendered?: (id: string, element: HTMLElement | null) => void;\n // onUnmount?: (id: string) => void;\n}\n\nexport function LineTextComponent({\n id,\n text,\n // position,\n onRendered /* , onUnmount */,\n}: LineTextComponentProps): JSX.Element {\n const refCallback = useCallback(\n (element: HTMLDivElement) => {\n onRendered?.(id, element);\n },\n [id, onRendered]\n );\n\n return (\n <div\n className=\"line-label\"\n ref={refCallback}\n // style={{\n // left: position[0],\n // top: position[1],\n // ...text!.style,\n // }}\n style={text.style}\n >\n {text!.content}\n </div>\n );\n}\n\n// export const LineLabelComponentGroup = React.memo(LegacyLineLabelComponentGroup);\n\nexport interface LineLabelComponentProps {\n id: string;\n edge: DiagramEdge;\n label: LineLabelConf;\n onRendered?: (id: string, element: HTMLElement | null) => void;\n onUnmount?: (id: string) => void;\n}\n\nexport function LineLabelComponent({\n id,\n edge,\n label,\n onRendered,\n onUnmount,\n}: LineLabelComponentProps): JSX.Element | null {\n const useBrick = useMemo(\n () => (checkIfByTransform(label, { edge }) ? label.useBrick : null),\n [edge, label]\n );\n\n const memoizedData = useMemo(() => ({ edge }), [edge]);\n\n useEffect(() => {\n if (!useBrick) {\n // Keep the same time delay for reporting rendered.\n setTimeout(() => {\n onRendered?.(id, null);\n });\n }\n }, [id, onRendered, useBrick]);\n\n useEffect(\n () => {\n return () => {\n onUnmount?.(id);\n };\n },\n // Only unmount once\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n if (element) {\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n onRendered?.(id, element.parentElement);\n });\n }\n },\n [id, onRendered]\n );\n\n const ignoredCallback = useCallback(() => {\n setTimeout(() => {\n onRendered?.(id, null);\n });\n }, [id, onRendered]);\n\n if (!useBrick) {\n return null;\n }\n\n return (\n <ReactUseBrick\n refCallback={refCallback}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore For v3 only\n ignoredCallback={ignoredCallback}\n useBrick={useBrick}\n data={memoizedData}\n />\n );\n}\n","import React from \"react\";\nimport type { RenderedLineLabel, SimpleRect } from \"./interfaces\";\n\nexport interface LineMaskComponentProps {\n maskPrefix: string;\n lineId: string;\n rects: SimpleRect[];\n renderedLineLabels: RenderedLineLabel[];\n}\n\nexport function LineMaskComponent({\n lineId,\n rects,\n maskPrefix,\n renderedLineLabels,\n}: LineMaskComponentProps): JSX.Element | null {\n const lineText = renderedLineLabels.find(\n (item) => item.lineId === lineId && item.placement === \"center\"\n );\n // istanbul ignore next\n if (!lineText) {\n return null;\n }\n const { lineRect } = lineText;\n const bgRect = getRectWithPadding(lineRect, 1000);\n return (\n <mask\n id={`${maskPrefix}${lineId}`}\n x={bgRect.left}\n y={bgRect.top}\n width={bgRect.width}\n height={bgRect.height}\n >\n <rect\n x={bgRect.left}\n y={bgRect.top}\n width={bgRect.width}\n height={bgRect.height}\n // Everything under a white pixel will be visible\n fill=\"white\"\n />\n {rects.map((rect, index) => (\n <rect\n key={index}\n x={rect.left}\n y={rect.top}\n width={rect.width}\n height={rect.height}\n // Everything under a black pixel will be invisible\n fill=\"black\"\n />\n ))}\n </mask>\n );\n}\n\nfunction getRectWithPadding(rect: SimpleRect, padding: number): SimpleRect {\n return {\n left: rect.left - padding,\n top: rect.top - padding,\n width: rect.width + padding * 2,\n height: rect.height + padding * 2,\n };\n}\n","import React, { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { ReactUseBrick } from \"@next-core/react-runtime\";\nimport type {\n DiagramNode,\n DiagramNodeId,\n NodeBrickConf,\n RefRepository,\n} from \"./interfaces\";\nimport { findNodeBrick } from \"./processors/findNodeBrick\";\n\nexport interface NodeComponentGroupProps {\n nodes?: DiagramNode[];\n nodeBricks?: NodeBrickConf[];\n onRendered?: (refRepository: RefRepository | null) => void;\n}\n\nexport function NodeComponentGroup({\n nodes,\n nodeBricks,\n onRendered,\n}: NodeComponentGroupProps): JSX.Element {\n const [rendered, setRendered] = useState(false);\n const [renderedIds, setRenderedIds] = useState<DiagramNodeId[]>([]);\n const refRepository = useMemo<RefRepository>(() => new Map(), []);\n\n const handleRenderer = useCallback(\n (id: DiagramNodeId, element: HTMLElement | null) => {\n if (element) {\n refRepository.set(id, element);\n }\n setRenderedIds((previous) =>\n previous.includes(id) ? previous : previous.concat(id)\n );\n },\n [refRepository]\n );\n\n const handleUnmount = useCallback(\n (id: DiagramNodeId) => {\n setRenderedIds((previous) => {\n const index = previous.indexOf(id);\n return index === -1\n ? previous\n : previous.slice(0, index).concat(previous.slice(index + 1));\n });\n refRepository.delete(id);\n },\n [refRepository]\n );\n\n useEffect(() => {\n // All nodes have been rendered.\n setRendered(!nodes?.some((node) => !renderedIds.includes(node.id)));\n }, [nodes, renderedIds]);\n\n useEffect(\n () => {\n onRendered?.(rendered ? refRepository : null);\n },\n // Dot not re-run effect when `onRendered` changed.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [/* onRendered, */ refRepository, rendered]\n );\n\n return (\n <React.Fragment>\n {nodes?.map((node) => (\n <div key={node.id} className=\"node\">\n <NodeComponent\n nodeBricks={nodeBricks}\n node={node}\n onRendered={handleRenderer}\n onUnmount={handleUnmount}\n />\n </div>\n ))}\n </React.Fragment>\n );\n}\n\nexport interface NodeComponentProps {\n node: DiagramNode;\n nodeBricks?: NodeBrickConf[];\n onRendered?: (id: DiagramNodeId, element: HTMLElement | null) => void;\n onUnmount?: (id: DiagramNodeId) => void;\n}\n\nexport function NodeComponent({\n node,\n nodeBricks,\n onRendered,\n onUnmount,\n}: NodeComponentProps): JSX.Element | null {\n const useBrick = useMemo(\n () => findNodeBrick(node, nodeBricks)?.useBrick,\n [node, nodeBricks]\n );\n const memoizedData = useMemo(() => ({ node }), [node]);\n\n useEffect(() => {\n if (!useBrick) {\n // Keep the same time delay for reporting rendered.\n setTimeout(() => {\n onRendered?.(node.id, null);\n });\n }\n }, [node.id, onRendered, useBrick]);\n\n useEffect(\n () => {\n return () => {\n onUnmount?.(node.id);\n };\n },\n // Only unmount once\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n const refCallback = useCallback(\n (element: HTMLElement | null) => {\n if (element) {\n // Todo: correctly wait for `useBrick` in v3 to be rendered (after layout)\n // Wait a macro task to let `useBrick` to be rendered.\n setTimeout(() => {\n onRendered?.(node.id, element);\n });\n }\n },\n [node.id, onRendered]\n );\n\n const ignoredCallback = useCallback(() => {\n setTimeout(() => {\n onRendered?.(node.id, null);\n });\n }, [node.id, onRendered]);\n\n if (!useBrick) {\n return null;\n }\n\n return (\n <ReactUseBrick\n refCallback={refCallback}\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore For v3 only\n ignoredCallback={ignoredCallback}\n useBrick={useBrick}\n data={memoizedData}\n />\n );\n}\n","import { checkIfByTransform } from \"@next-core/runtime\";\nimport { NodeBrickConf, DiagramNode } from \"../interfaces\";\n\nexport function findNodeBrick(\n node: DiagramNode,\n nodeBricks: NodeBrickConf[] | undefined\n): NodeBrickConf | undefined {\n return nodeBricks?.find((item) => {\n if (item.nodeType) {\n return ([] as unknown[]).concat(item.nodeType).includes(node.type);\n }\n return checkIfByTransform(item, { node });\n });\n}\n","export const DEFAULT_LINE_STROKE_COLOR = \"var(--palette-gray-5)\";\nexport const DEFAULT_LINE_STROKE_WIDTH = 1;\nexport const DEFAULT_LINE_CURVE_TYPE = \"curveBasis\";\nexport const DEFAULT_LINE_INTERACT_STROKE_WIDTH = 20;\nexport const DEFAULT_SCALE_RANGE_MIN = 0.5;\nexport const DEFAULT_SCALE_RANGE_MAX = 2;\n","import type { FullRectTuple, RefRepository, RenderedNode } from \"../interfaces\";\n\nexport function adjustNodesSize(\n nodes: RenderedNode[],\n nodesRefRepository: RefRepository,\n nodePaddings: FullRectTuple\n) {\n for (const node of nodes) {\n const element = nodesRefRepository.get(node.id);\n node.width =\n Math.max(element?.offsetWidth ?? 0, 10) +\n nodePaddings[1] +\n nodePaddings[3];\n node.height =\n Math.max(element?.offsetHeight ?? 0, 10) +\n nodePaddings[0] +\n nodePaddings[2];\n }\n}\n","import type { FullRectTuple, RefRepository, RenderedNode } from \"../interfaces\";\n\nexport function adjustNodesPosition(\n nodes: RenderedNode[],\n nodesRefRepository: RefRepository,\n nodePaddings: FullRectTuple\n) {\n for (const node of nodes) {\n const x = node.x - node.width / 2 + nodePaddings[3];\n const y = node.y - node.height / 2 + nodePaddings[0];\n\n const nodeContainer = nodesRefRepository.get(node.id)?.parentElement;\n if (nodeContainer) {\n nodeContainer.style.left = `${x}px`;\n nodeContainer.style.top = `${y}px`;\n nodeContainer.style.visibility = \"visible\";\n }\n }\n}\n","// istanbul ignore file: experimental\nimport type {\n DiagramEdge,\n LabelSize,\n RefRepository,\n RenderedEdge,\n} from \"../interfaces\";\n\nexport function getRenderedEdges(\n edges: DiagramEdge[] | undefined,\n {\n normalizedLinesMap,\n lineLabelsRefRepository,\n }: {\n normalizedLinesMap: WeakMap<DiagramEdge, string>;\n lineLabelsRefRepository: RefRepository;\n }\n) {\n return (\n edges?.map<RenderedEdge>((edge) => {\n const lineId = normalizedLinesMap.get(edge);\n const labelSize: LabelSize = {};\n if (lineId) {\n for (const placement of [/* \"center\", */ \"start\", \"end\"] as const) {\n const element = lineLabelsRefRepository.get(`${lineId}-${placement}`);\n if (element) {\n labelSize[placement] = [element.offsetWidth, element.offsetHeight];\n }\n }\n }\n\n return {\n data: edge,\n labelSize,\n };\n }) ?? []\n );\n}\n","// istanbul ignore file: experimental\nimport {\n forceSimulation,\n forceLink,\n forceCollide,\n forceManyBody,\n forceX,\n forceY,\n type Simulation,\n type SimulationNodeDatum,\n type SimulationLinkDatum,\n} from \"d3-force\";\nimport { pick } from \"lodash\";\nimport type {\n DiagramEdge,\n DiagramNode,\n ForceCollideOptions,\n LayoutOptionsForce,\n RenderedNode,\n UnifiedGraph,\n UserViewNodesMap,\n} from \"../interfaces\";\nimport { adjustNodesSize } from \"./adjustNodesSize\";\nimport { adjustNodesPosition } from \"./adjustNodesPosition\";\nimport { extractPartialRectTuple } from \"./extractPartialRectTuple\";\nimport { getRenderedEdges } from \"./getRenderedEdges\";\n\ninterface NormalNode extends SimulationNodeDatum {\n dummy?: false;\n id: string;\n data: DiagramNode;\n width: number;\n height: number;\n}\n\ninterface DummyNode extends SimulationNodeDatum {\n dummy: true;\n id: string;\n}\n\ntype ForceNode = NormalNode | DummyNode;\n\ntype ForceLink = SimulationLinkDatum<ForceNode> & {\n dummy?: boolean;\n};\n\nexport function getForceGraph(\n previousGraph: UnifiedGraph | null,\n nodes: DiagramNode[] | undefined,\n edges: DiagramEdge[] | undefined,\n userViewNodesMap: UserViewNodesMap | null,\n forceLayoutOptions: LayoutOptionsForce | undefined\n): UnifiedGraph {\n const { nodePadding, dummyNodesOnEdges, collide } = {\n nodePadding: 0,\n dummyNodesOnEdges: 0,\n ...pick(forceLayoutOptions, [\"nodePadding\", \"dummyNodesOnEdges\"]),\n collide:\n forceLayoutOptions?.collide !== false\n ? ({\n dummyRadius: 1,\n radiusDiff: 5,\n strength: 1,\n iterations: 1,\n ...(forceLayoutOptions?.collide === true\n ? null\n : (forceLayoutOptions?.collide as ForceCollideOptions)),\n } as Required<ForceCollideOptions>)\n : (false as const),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n const renderedNodes: RenderedNode[] = [];\n for (const node of nodes ?? []) {\n const previousNode = previousGraph?.getNode(node.id);\n if (previousNode?.data === node) {\n renderedNodes.push(previousNode);\n } else {\n const renderedNode = {\n id: node.id,\n data: node,\n } as RenderedNode & { fx?: number; fy?: number };\n const userViewNode = userViewNodesMap?.get(node.id);\n if (userViewNode) {\n renderedNode.fx = userViewNode.x;\n renderedNode.fy = userViewNode.y;\n }\n renderedNodes.push(renderedNode);\n }\n }\n\n function getNode(id: string) {\n return renderedNodes.find((node) => node.data.id === id);\n }\n\n return {\n layout: \"force\",\n getNode,\n applyLayout({\n nodesRefRepository,\n lineLabelsRefRepository,\n normalizedLinesMap,\n }) {\n if (renderedNodes.length === 0) {\n return null;\n }\n\n adjustNodesSize(renderedNodes, nodesRefRepository, nodePaddings);\n\n const forceNodes = renderedNodes.slice();\n const forceLinks: ForceLink[] = [];\n\n for (const edge of edges ?? []) {\n forceLinks.push({ ...edge });\n if (dummyNodesOnEdges > 0) {\n forceNodes.push(\n ...(getDummyNodes(\n edge,\n dummyNodesOnEdges\n ) as Partial<RenderedNode>[] as RenderedNode[])\n );\n forceLinks.push(...getDummyEdges(edge, dummyNodesOnEdges));\n }\n }\n\n const linkSimulation = forceLink<ForceNode, ForceLink>(forceLinks).id(\n (d) => d.id\n );\n\n if (dummyNodesOnEdges > 0) {\n linkSimulation\n .distance((l) => (l.dummy ? 30 / (dummyNodesOnEdges + 1) : 30))\n .strength((l) => (l.dummy ? 0.5 : 1));\n }\n\n const simulation = forceSimulation<ForceNode>(forceNodes)\n .force(\"link\", linkSimulation)\n .force(\"x\", forceX())\n .force(\"y\", forceY())\n .force(\"charge\", forceManyBody());\n\n if (collide) {\n simulation.force(\n \"collide\",\n forceCollide<ForceNode>()\n .radius((d) =>\n d.dummy\n ? collide.dummyRadius\n : Math.sqrt(d.width ** 2 + d.height ** 2) / 2 +\n collide.radiusDiff\n )\n .strength(collide.strength)\n .iterations(collide.iterations)\n );\n }\n\n simulation.stop();\n manuallyTickToTheEnd(simulation);\n\n adjustNodesPosition(renderedNodes, nodesRefRepository, nodePaddings);\n\n const renderedEdges = getRenderedEdges(edges, {\n normalizedLinesMap,\n lineLabelsRefRepository,\n });\n\n return { nodes: renderedNodes, edges: renderedEdges };\n },\n };\n}\n\nfunction manuallyTickToTheEnd(\n simulation: Simulation<ForceNode, ForceLink>\n): void {\n // Manually tick to the end.\n simulation.tick(\n Math.ceil(\n Math.log(simulation.alphaMin()) / Math.log(1 - simulation.alphaDecay())\n )\n );\n}\n\nfunction getDummyNodes(edge: DiagramEdge, count: number): DummyNode[] {\n return new Array(count).fill(null).map<DummyNode>((v, i) => ({\n dummy: true,\n id: `$dummy-${edge.source}-${edge.target}-${i}`,\n }));\n}\n\nfunction getDummyEdges(edge: DiagramEdge, count: number): ForceLink[] {\n return new Array(count + 1).fill(null).map<ForceLink>((v, i) => ({\n dummy: true,\n source:\n i === 0 ? edge.source : `$dummy-${edge.source}-${edge.target}-${i - 1}`,\n target:\n i === count ? edge.target : `$dummy-${edge.source}-${edge.target}-${i}`,\n }));\n}\n","import { useEffect, useState } from \"react\";\nimport type {\n DiagramEdge,\n DiagramNode,\n LayoutOptions,\n LayoutOptionsDagre,\n LayoutOptionsForce,\n ManualLayoutStatus,\n NodeMovement,\n RefRepository,\n RenderedDiagram,\n UnifiedGraph,\n UserViewNodesMap,\n} from \"../interfaces\";\nimport { getDagreGraph } from \"../processors/getDagreGraph\";\nimport { getForceGraph } from \"../processors/getForceGraph\";\nimport { getManualGraph } from \"../processors/getManualGraph\";\n\nexport function useRenderedDiagram({\n layout: originalLayout,\n nodes,\n edges,\n manualLayoutStatus,\n userViewReady,\n userViewNodesMap,\n nodeMovement,\n nodesRefRepository,\n lineLabelsRefRepository,\n normalizedLinesMap,\n nodesRenderId,\n lineLabelsRenderId,\n layoutOptions,\n}: {\n layout: \"dagre\" | \"force\" | undefined;\n nodes: DiagramNode[] | undefined;\n edges: DiagramEdge[] | undefined;\n manualLayoutStatus: ManualLayoutStatus;\n userViewReady: boolean;\n userViewNodesMap: UserViewNodesMap | null;\n nodeMovement: NodeMovement | null;\n nodesRefRepository: RefRepository | null;\n lineLabelsRefRepository: RefRepository | null;\n normalizedLinesMap: WeakMap<DiagramEdge, string>;\n nodesRenderId: number;\n lineLabelsRenderId: number;\n layoutOptions?: LayoutOptions;\n}) {\n const layout = manualLayoutStatus === \"initial\" ? originalLayout : \"manual\";\n const [graph, setGraph] = useState<UnifiedGraph | null>(null);\n\n const [renderedDiagram, setRenderedDiagram] = useState<RenderedDiagram>({\n nodes: [],\n edges: [],\n });\n\n useEffect(() => {\n if (!userViewReady) {\n return;\n }\n setGraph((previousGraph) =>\n layout === \"dagre\"\n ? getDagreGraph(\n previousGraph,\n nodes,\n edges,\n layoutOptions as LayoutOptionsDagre\n )\n : layout === \"force\"\n ? getForceGraph(\n previousGraph,\n nodes,\n edges,\n userViewNodesMap,\n layoutOptions as LayoutOptionsForce\n )\n : layout === \"manual\"\n ? getManualGraph(previousGraph, nodes, edges, layoutOptions)\n : null\n );\n }, [edges, nodes, layout, layoutOptions, userViewReady, userViewNodesMap]);\n\n useEffect(() => {\n if (\n !nodesRefRepository ||\n !lineLabelsRefRepository ||\n layout !== graph?.layout\n ) {\n return;\n }\n const renderedDiagram = graph?.applyLayout({\n manualLayoutStatus,\n nodesRefRepository,\n lineLabelsRefRepository,\n normalizedLinesMap,\n nodeMovement,\n });\n if (renderedDiagram) {\n setRenderedDiagram(renderedDiagram);\n }\n }, [\n layout,\n manualLayoutStatus,\n graph,\n nodeMovement,\n nodesRefRepository,\n lineLabelsRefRepository,\n nodesRenderId,\n lineLabelsRenderId,\n normalizedLinesMap,\n ]);\n\n return renderedDiagram;\n}\n","import dagre from \"@dagrejs/dagre\";\nimport { pick } from \"lodash\";\nimport type {\n DiagramEdge,\n DiagramNode,\n LayoutOptionsDagre,\n RenderedEdge,\n RenderedNode,\n UnifiedGraph,\n} from \"../interfaces\";\nimport { adjustNodesSize } from \"./adjustNodesSize\";\nimport { adjustNodesPosition } from \"./adjustNodesPosition\";\nimport { extractPartialRectTuple } from \"./extractPartialRectTuple\";\n\nexport function getDagreGraph(\n previousGraph: UnifiedGraph | null,\n nodes: DiagramNode[] | undefined,\n edges: DiagramEdge[] | undefined,\n dagreLayoutOptions: LayoutOptionsDagre | undefined\n): UnifiedGraph {\n const { nodePadding, ...dagreGraphOptions } = {\n nodePadding: 0,\n rankdir: \"TB\",\n ranksep: 50,\n edgesep: 10,\n nodesep: 50,\n // align: undefined,\n ...pick(dagreLayoutOptions, [\n \"nodePadding\",\n \"rankdir\",\n \"ranksep\",\n \"edgesep\",\n \"nodesep\",\n \"align\",\n ]),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n // Create a new directed graph\n const graph = new dagre.graphlib.Graph<RenderedNode>();\n\n // Set an object for the graph label\n graph.setGraph(dagreGraphOptions);\n\n // Default to assigning a new object as a label for each new edge.\n graph.setDefaultEdgeLabel(function () {\n return {};\n });\n\n for (const node of nodes ?? []) {\n const previousNode = previousGraph?.getNode(node.id);\n graph.setNode(\n node.id,\n previousNode?.data === node\n ? previousNode\n : {\n id: node.id,\n data: node,\n }\n );\n }\n\n for (const edge of edges ?? []) {\n graph.setEdge(edge.source, edge.target, { data: edge });\n }\n\n return {\n layout: \"dagre\",\n getNode(id) {\n return graph.node(id);\n },\n applyLayout({\n nodesRefRepository,\n lineLabelsRefRepository,\n normalizedLinesMap,\n }) {\n const renderedNodes: RenderedNode[] = [];\n for (const id of graph.nodes()) {\n const node = graph.node(id);\n if (node) {\n renderedNodes.push(node);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Diagram node not found: %s\", id);\n }\n }\n\n if (renderedNodes.length === 0) {\n return null;\n }\n\n adjustNodesSize(renderedNodes, nodesRefRepository, nodePaddings);\n\n const renderedEdges = graph\n .edges()\n .map((e) => graph.edge(e) as RenderedEdge);\n for (const edge of renderedEdges) {\n const lineId = normalizedLinesMap.get(edge.data);\n if (lineId) {\n for (const placement of [\"center\", \"start\", \"end\"] as const) {\n const element = lineLabelsRefRepository.get(\n `${lineId}-${placement}`\n );\n if (element) {\n const { offsetWidth, offsetHeight } = element;\n if (placement === \"center\") {\n edge.labelpos = \"c\";\n edge.width = offsetWidth;\n edge.height = offsetHeight;\n }\n edge.labelSize ??= {};\n edge.labelSize[placement] = [offsetWidth, offsetHeight];\n }\n }\n }\n }\n dagre.layout(graph);\n\n adjustNodesPosition(renderedNodes, nodesRefRepository, nodePaddings);\n\n return {\n nodes: renderedNodes,\n edges: renderedEdges,\n };\n },\n };\n}\n","// istanbul ignore file: experimental\nimport { pick } from \"lodash\";\nimport type {\n DiagramEdge,\n DiagramNode,\n BaseLayoutOptions,\n RenderedNode,\n UnifiedGraph,\n} from \"../interfaces\";\nimport { extractPartialRectTuple } from \"./extractPartialRectTuple\";\nimport { adjustNodesSize } from \"./adjustNodesSize\";\nimport { adjustNodesPosition } from \"./adjustNodesPosition\";\nimport { getRenderedEdges } from \"./getRenderedEdges\";\n\nexport function getManualGraph(\n previousGraph: UnifiedGraph | null,\n nodes: DiagramNode[] | undefined,\n edges: DiagramEdge[] | undefined,\n layoutOptions: BaseLayoutOptions | undefined\n): UnifiedGraph {\n const { nodePadding } = {\n nodePadding: 0,\n ...pick(layoutOptions, [\"nodePadding\"]),\n };\n const nodePaddings = extractPartialRectTuple(nodePadding);\n\n const renderedNodes: RenderedNode[] = [];\n for (const node of nodes ?? []) {\n const previousNode = previousGraph?.getNode(node.id);\n if (previousNode?.data === node) {\n renderedNodes.push(previousNode);\n previousNode.x0 = previousNode.x;\n previousNode.y0 = previousNode.y;\n } else {\n renderedNodes.push({\n id: node.id,\n data: node,\n } as RenderedNode);\n }\n }\n\n function getNode(id: string) {\n return renderedNodes.find((node) => node.data.id === id);\n }\n\n let movedNode: RenderedNode | undefined;\n\n return {\n layout: \"manual\",\n getNode,\n applyLayout({\n manualLayoutStatus,\n nodesRefRepository,\n lineLabelsRefRepository,\n normalizedLinesMap,\n nodeMovement,\n }) {\n if (renderedNodes.length === 0) {\n return null;\n }\n\n adjustNodesSize(renderedNodes, nodesRefRepository, nodePaddings);\n\n if (nodeMovement) {\n movedNode = renderedNodes.find((node) => node.id === nodeMovement.id);\n if (movedNode) {\n movedNode.x = (movedNode.x0 ?? 0) + nodeMovement.move[0];\n movedNode.y = (movedNode.y0 ?? 0) + nodeMovement.move[1];\n }\n }\n\n if (manualLayoutStatus === \"finished\" && movedNode) {\n // Set x0/y0 after finished manual layout\n movedNode.x0 = movedNode.x;\n movedNode.y0 = movedNode.y;\n }\n\n adjustNodesPosition(renderedNodes, nodesRefRepository, nodePaddings);\n\n const renderedEdges = getRenderedEdges(edges, {\n normalizedLinesMap,\n lineLabelsRefRepository,\n });\n\n return { nodes: renderedNodes, edges: renderedEdges };\n },\n };\n}\n","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { http } from \"@next-core/http\";\n/**\n * @description 搜索实例V3 (支持多属性排序)\n * @endpoint POST /v3/object/:objectId/instance/_search\n */\nexport var InstanceApi_postSearchV3 = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (objectId, data, options) {\n return (/**! @contract easyops.api.cmdb.instance.PostSearchV3@1.1.0 */(yield http.post(\"api/gateway/cmdb.instance.PostSearchV3/v3/object/\".concat(objectId, \"/instance/_search\"), data, options)).data\n );\n });\n return function InstanceApi_postSearchV3(_x, _x2, _x3) {\n return _ref.apply(this, arguments);\n };\n}();\n//# sourceMappingURL=postSearchV3.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { http } from \"@next-core/http\";\n\n/** 要更新的实例 */\n\n/**\n * @description 更新实例V2 (支持关系更新)\n * @endpoint PUT /v2/object/:objectId/instance/:instanceId\n */\nexport var InstanceApi_updateInstanceV2 = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (objectId, instanceId, data, options) {\n return (/**! @contract easyops.api.cmdb.instance.UpdateInstanceV2@1.0.0 */(yield http.put(\"api/gateway/cmdb.instance.UpdateInstanceV2/v2/object/\".concat(objectId, \"/instance/\").concat(instanceId), data, options)).data\n );\n });\n return function InstanceApi_updateInstanceV2(_x, _x2, _x3, _x4) {\n return _ref.apply(this, arguments);\n };\n}();\n//# sourceMappingURL=updateInstanceV2.js.map","import _asyncToGenerator from \"@babel/runtime/helpers/asyncToGenerator\";\nimport { http } from \"@next-core/http\";\n\n/** 创建实例 */\n\n/**\n * @description 创建实例 (body为实例信息,字段限制参考模型定义,支持关系创建)\n * @endpoint POST /v2/object/:objectId/instance\n */\nexport var InstanceApi_createInstance = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator(function* (objectId, data, options) {\n return (/**! @contract easyops.api.cmdb.instance.CreateInstance@1.1.0 */(yield http.post(\"api/gateway/cmdb.instance.CreateInstance/v2/object/\".concat(objectId, \"/instance\"), data, options)).data\n );\n });\n return function InstanceApi_createInstance(_x, _x2, _x3) {\n return _ref.apply(this, arguments);\n };\n}();\n//# sourceMappingURL=createInstance.js.map","import { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { handleHttpError } from \"@next-core/runtime\";\nimport {\n InstanceApi_postSearchV3,\n InstanceApi_updateInstanceV2,\n InstanceApi_createInstance,\n} from \"@next-api-sdk/cmdb-sdk\";\nimport { createAsyncQueue } from \"../processors/createAsyncQueue\";\nimport {\n NodeUserView,\n UserView,\n UserViewNodesMap,\n UserViewQuery,\n} from \"../interfaces\";\n\nconst USER_VIEW_MODEL_ID = \"GRAPH_USER_VIEW@EASYOPS\";\n\nexport interface UserViewHook {\n userViewReady: boolean;\n userViewNodesMap: UserViewNodesMap | null;\n saveUserView: (nodes: NodeUserView[]) => void;\n}\n\nexport function useUserView(query: UserViewQuery | undefined): UserViewHook {\n const [userViewReady, setUserViewReady] = useState(!query);\n const userViewIdRef = useRef<string>();\n const [userViewNodesMap, setUserViewNodesMap] =\n useState<UserViewNodesMap | null>(null);\n const queue = useMemo(() => createAsyncQueue(), []);\n\n useEffect(() => {\n async function getUserView(): Promise<void> {\n if (!query) {\n setUserViewReady(true);\n return;\n }\n const { namespace, key } = query;\n if (!(namespace && key)) {\n // eslint-disable-next-line no-console\n console.error(\"Namespace and key are required to save graph user view\");\n setUserViewReady(true);\n return;\n }\n try {\n const list = (\n await InstanceApi_postSearchV3(USER_VIEW_MODEL_ID, {\n fields: [\"nodes\"],\n query: {\n namespace: {\n $eq: namespace,\n },\n key: {\n $eq: key,\n },\n },\n page: 1,\n page_size: 30,\n })\n ).list as UserView[];\n if (list.length > 0) {\n const userView = list[0];\n const userViewNodesMap = new Map(\n userView.nodes?.map((node) => [node.id, node])\n );\n userViewIdRef.current = userView.instanceId;\n setUserViewNodesMap(userViewNodesMap);\n } else {\n setUserViewNodesMap(null);\n }\n } catch (error) {\n handleHttpError(error as Error);\n } finally {\n setUserViewReady(true);\n }\n }\n getUserView();\n }, [query]);\n\n const saveUserView = useCallback(\n (nodes: NodeUserView[]) => {\n const { namespace, key } = query ?? {};\n if (!(namespace && key)) {\n return;\n }\n queue(async () => {\n const userViewData = {\n namespace,\n key,\n nodes,\n };\n try {\n if (userViewIdRef.current) {\n await InstanceApi_updateInstanceV2(\n USER_VIEW_MODEL_ID,\n userViewIdRef.current,\n userViewData,\n {\n interceptorParams: {\n ignoreLoadingBar: true,\n },\n }\n );\n } else {\n const userView = await InstanceApi_createInstance(\n USER_VIEW_MODEL_ID,\n userViewData,\n {\n interceptorParams: {\n ignoreLoadingBar: true,\n },\n }\n );\n userViewIdRef.current = userView.instanceId;\n }\n } catch (error) {\n handleHttpError(error);\n }\n });\n },\n [query, queue]\n );\n\n return {\n userViewReady,\n userViewNodesMap,\n saveUserView,\n };\n}\n","type Task = (...args: unknown[]) => unknown;\ntype Queue = (task: Task) => Promise<void>;\n\nexport function createAsyncQueue(): Queue {\n let working = false;\n const waitingTasks: Task[] = [];\n return async function queue(task: Task) {\n waitingTasks.push(task);\n if (!working) {\n working = true;\n let nextTask: Task | undefined;\n while ((nextTask = waitingTasks.shift())) {\n try {\n await nextTask();\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(error);\n }\n }\n working = false;\n }\n };\n}\n","import type { RefRepository, RenderedLineLabel } from \"../interfaces\";\n\nexport function adjustLineLabels(\n renderedLineLabels: RenderedLineLabel[],\n lineLabelsRefRepository: RefRepository\n) {\n for (const {\n id,\n position,\n placement,\n angle,\n size: _size,\n } of renderedLineLabels) {\n const label = lineLabelsRefRepository.get(id);\n if (label) {\n label.style.left = `${position[0]}px`;\n label.style.top = `${position[1]}px`;\n label.style.visibility = \"visible\";\n // label.classList.add(placement);\n if (placement !== \"center\" && angle !== undefined) {\n const [width, height] = _size ?? [0, 0];\n // Get the numbered direction of the line\n //\n // \\ | /\n // \\ 5 | 6 /\n // 4 \\ | / 7\n // -----x-----\n // 3 / | \\ 0\n // / 2 | 1 \\\n // / | \\\n const tempDirection = Math.floor(\n ((angle < 0 ? Math.PI * 2 + angle : angle) / Math.PI) * 4\n );\n // Swap direction for end labels.\n const direction =\n placement === \"start\" ? tempDirection : (tempDirection + 4) % 8;\n const tangent = Math.tan(angle);\n const offsetAngle =\n angle + ((placement === \"start\" ? 1 : -1) * Math.PI) / 2;\n const offset = 2;\n const offsetSin = Math.sin(offsetAngle) * offset;\n const offsetCos = Math.cos(offsetAngle) * offset;\n let transform: string;\n switch (direction) {\n case 0:\n transform = `translate(0,${width * tangent + offsetSin}px)`;\n break;\n case 1:\n transform = `translate(${height / tangent - offsetCos}px,0)`;\n break;\n case 2:\n transform = `translate(calc(${\n height / tangent + offsetCos\n }px - 100%),0)`;\n break;\n case 3:\n transform = `translate(-100%,${-width * tangent - offsetSin}px)`;\n break;\n case 4:\n transform = `translate(-100%,calc(${\n -width * tangent + offsetSin\n }px - 100%))`;\n break;\n case 5:\n transform = `translate(calc(${\n -height / tangent - offsetCos\n }px - 100%),-100%)`;\n break;\n case 6:\n transform = `translate(${-height / tangent + offsetCos}px,-100%)`;\n break;\n default:\n transform = `translate(0,calc(${\n width * tangent - offsetSin\n }px - 100%))`;\n }\n label.style.transform = transform;\n }\n }\n }\n}\n","import type {\n LineMaskRects,\n RefRepository,\n RenderedLineLabel,\n} from \"../interfaces\";\n\nexport function getLineMaskRects(\n renderedLineLabels: RenderedLineLabel[],\n lineLabelsRefRepository: RefRepository\n) {\n const map: LineMaskRects = new Map();\n\n for (const { id, lineId, placement } of renderedLineLabels) {\n if (!lineLabelsRefRepository || placement !== \"center\") {\n continue;\n }\n const element = lineLabelsRefRepository.get(id);\n if (!element) {\n continue;\n }\n const { offsetWidth, offsetHeight } = element;\n // Do not mask out when the label takes no space.\n // istanbul ignore next\n if (\n process.env.NODE_ENV !== \"test\" &&\n (offsetWidth === 0 || offsetHeight === 0)\n ) {\n continue;\n }\n const padding = 3;\n // Currently no other rects\n map.set(lineId, [\n {\n left: element.offsetLeft - offsetWidth / 2 - padding,\n top: element.offsetTop - offsetHeight / 2 - padding,\n width: offsetWidth + padding * 2,\n height: offsetHeight + padding * 2,\n },\n ]);\n }\n\n return map;\n}\n","import type {\n LineLabelConf,\n RenderedLine,\n RenderedLineLabel,\n TextOptions,\n} from \"../interfaces\";\n\nexport function getRenderedLineLabels(\n previous: RenderedLineLabel[],\n renderedLines: RenderedLine[],\n linePaths: Map<string, SVGPathElement | null>\n) {\n if (previous.length === 0 && renderedLines.length === 0) {\n return previous;\n }\n return renderedLines.flatMap(\n ({ line: { text, label, $id }, edge, labelSize, angle }) => {\n const path = linePaths.get($id);\n if ((!text && !label) || !path || !path.getAttribute(\"d\")) {\n return [] as RenderedLineLabel[];\n }\n\n let key: \"label\" | \"text\";\n let list: LineLabelConf[] | TextOptions[];\n if (label) {\n key = \"label\";\n list = ([] as LineLabelConf[]).concat(label);\n } else {\n key = \"text\";\n list = ([] as TextOptions[]).concat(text!);\n }\n\n // istanbul ignore next\n const {\n x: left,\n y: top,\n width,\n height,\n } = process.env.NODE_ENV === \"test\"\n ? { x: 10, y: 20, width: 300, height: 400 }\n : path.getBBox();\n\n // istanbul ignore next\n const pathLength =\n process.env.NODE_ENV === \"test\" ? 50 : path.getTotalLength();\n\n return list.map<RenderedLineLabel>((item) => {\n const placement = item.placement ?? \"center\";\n const offset = 0;\n // istanbul ignore next\n const point =\n process.env.NODE_ENV === \"test\"\n ? { x: 50, y: 50 }\n : path.getPointAtLength(\n placement === \"start\"\n ? Math.min(offset, pathLength / 2)\n : placement === \"end\"\n ? Math.max(pathLength - offset, pathLength / 2)\n : pathLength / 2\n );\n\n return {\n [key as \"label\"]: item as LineLabelConf,\n edge,\n position: [point.x, point.y],\n lineRect: { left, top, width, height },\n id: `${$id}-${placement}`,\n lineId: $id,\n placement,\n angle,\n size: labelSize?.[placement],\n };\n });\n }\n );\n}\n","// istanbul ignore file: experimental\nimport type {\n DiagramEdge,\n Direction,\n NormalizedLine,\n RenderedEdge,\n RenderedLine,\n RenderedNode,\n} from \"../interfaces\";\nimport { curveLine } from \"../lines/curveLine\";\nimport { getDirectLinePoints } from \"../lines/getDirectLinePoints\";\nimport { getPolyLinePoints } from \"../lines/getPolyLinePoints\";\nimport { doTwoNodesOverlap } from \"./doTwoNodesOverlap\";\n\nexport function getRenderedLines(\n renderedEdges: RenderedEdge[],\n renderedNodes: RenderedNode[],\n normalizedLines: NormalizedLine[]\n): RenderedLine[] {\n const renderedEdgeMap = new WeakMap<DiagramEdge, RenderedEdge>();\n const renderedNodeMap = new Map<string, RenderedNode>();\n const relatedNodes = new Map<string, Set<RenderedNode>>();\n\n for (const renderedNode of renderedNodes) {\n renderedNodeMap.set(renderedNode.id, renderedNode);\n }\n\n for (const renderedEdge of renderedEdges) {\n const { data: edge } = renderedEdge;\n renderedEdgeMap.set(edge, renderedEdge);\n }\n\n let prepared = false;\n const prepareRelatedNodes = () => {\n if (prepared) {\n return;\n }\n prepared = true;\n\n const addRelatedNodes = (from: string, to: string) => {\n let relates = relatedNodes.get(from);\n if (!relates) {\n relatedNodes.set(from, (relates = new Set()));\n }\n const toNode = renderedNodeMap.get(to);\n if (toNode) {\n relates.add(toNode);\n }\n };\n\n for (const {\n data: { source, target },\n } of renderedEdges) {\n if (source !== target) {\n addRelatedNodes(source, target);\n addRelatedNodes(target, source);\n }\n }\n };\n\n return normalizedLines\n .map<RenderedLine | undefined>(({ line, edge, markers, ...rest }) => {\n const renderedEdge = renderedEdgeMap.get(edge);\n if (!renderedEdge) {\n return;\n }\n const startMarkerOffset =\n markers.find(\n (marker) =>\n marker.variant === \"default\" && marker.placement === \"start\"\n )?.offset ?? 0;\n const endMarkerOffset =\n markers.find(\n (marker) => marker.variant === \"default\" && marker.placement === \"end\"\n )?.offset ?? 0;\n let angle: number | undefined;\n\n let { points } = renderedEdge;\n // Only dagre graph will have pre-calculated line points\n if (!points) {\n const source = renderedNodeMap.get(edge.source);\n const target = renderedNodeMap.get(edge.target);\n\n if (source && target && source !== target) {\n if (line.type === \"polyline\") {\n if (\n !doTwoNodesOverlap(\n source,\n target,\n startMarkerOffset,\n endMarkerOffset\n )\n ) {\n prepareRelatedNodes();\n const sourceDirection = getDirection(\n source,\n target,\n startMarkerOffset\n );\n const targetDirection = getDirection(\n target,\n source,\n endMarkerOffset\n );\n const sourceRelates = getOrderedRelates(\n relatedNodes.get(edge.source) ?? [],\n source,\n sourceDirection,\n startMarkerOffset\n );\n const targetRelates = getOrderedRelates(\n relatedNodes.get(edge.target) ?? [],\n target,\n targetDirection,\n endMarkerOffset\n );\n\n const sourcePosition =\n (sourceRelates.indexOf(target) + 1) /\n (sourceRelates.length + 1);\n const targetPosition =\n (targetRelates.indexOf(source) + 1) /\n (targetRelates.length + 1);\n\n points = getPolyLinePoints(\n source,\n target,\n sourceDirection,\n targetDirection,\n sourcePosition,\n targetPosition\n );\n }\n } else {\n points = getDirectLinePoints(source, target);\n }\n\n if (points) {\n const start = points[0];\n const end = points[points.length - 1];\n angle = Math.atan2(end.y - start.y, end.x - start.x);\n }\n }\n }\n\n const d = curveLine(\n points,\n line.curveType,\n startMarkerOffset,\n endMarkerOffset\n );\n return {\n ...rest,\n markers,\n line,\n edge,\n d,\n angle,\n labelSize: renderedEdge.labelSize,\n };\n })\n .filter(Boolean) as RenderedLine[];\n}\n\nfunction getDirection(\n source: RenderedNode,\n target: RenderedNode,\n padding: number\n): Direction {\n // Add a padding to the source node to avoid the markers being warped.\n const sourceAngle = Math.atan2(\n source.height + padding * 2,\n source.width + padding * 2\n );\n const { x: sx, y: sy } = source;\n const { x: tx, y: ty } = target;\n const angle = Math.atan2(ty - sy, tx - sx);\n const fixedAngle = angle < 0 ? Math.PI * 2 + angle : angle;\n const direction = Math.floor((fixedAngle / Math.PI) * 2);\n switch (direction) {\n case 0:\n return fixedAngle < sourceAngle ? \"right\" : \"bottom\";\n case 1:\n return fixedAngle < Math.PI - sourceAngle ? \"bottom\" : \"left\";\n case 2:\n return fixedAngle < Math.PI + sourceAngle ? \"left\" : \"top\";\n default:\n return fixedAngle < Math.PI * 2 - sourceAngle ? \"top\" : \"right\";\n }\n}\n\nfunction getOrderedRelates(\n relates: Iterable<RenderedNode>,\n from: RenderedNode,\n direction: Direction,\n padding: number\n): RenderedNode[] {\n return [...relates]\n .filter((node) => getDirection(from, node, padding) === direction)\n .sort((a, b) => {\n const { x: ax, y: ay } = a;\n const { x: bx, y: by } = b;\n return direction === \"top\" || direction === \"bottom\" ? ax - bx : ay - by;\n });\n}\n","import { minBy } from \"lodash\";\nimport type {\n ActiveTarget,\n DiagramEdge,\n DiagramNode,\n RenderedNode,\n} from \"../interfaces\";\n\nexport type KeyboardAction =\n | KeyboardActionSwitchActiveNode\n | KeyboardActionDeleteNode\n | KeyboardActionDeleteEdge;\n\nexport interface KeyboardActionSwitchActiveNode {\n action: \"switch-active-node\";\n node?: DiagramNode;\n}\n\nexport interface KeyboardActionDeleteNode {\n action: \"delete-node\";\n node: DiagramNode;\n}\n\nexport interface KeyboardActionDeleteEdge {\n action: \"delete-edge\";\n edge: DiagramEdge;\n}\n\nexport function handleKeyboard(\n event: KeyboardEvent,\n {\n renderedNodes,\n activeTarget,\n }: {\n renderedNodes: RenderedNode[];\n activeTarget: ActiveTarget | null | undefined;\n }\n): KeyboardAction | undefined {\n const activeNode =\n activeTarget?.type === \"node\"\n ? renderedNodes.find((node) => node.id === activeTarget.nodeId)\n : undefined;\n const activeEdge =\n activeTarget?.type === \"edge\" ? activeTarget.edge : undefined;\n\n if (!activeNode && !activeEdge) {\n return;\n }\n\n const key =\n event.key ||\n /* istanbul ignore next: compatibility */ event.keyCode ||\n /* istanbul ignore next: compatibility */ event.which;\n let action: KeyboardAction[\"action\"] | undefined;\n let node: RenderedNode | undefined;\n let edge: DiagramEdge | undefined;\n\n switch (key) {\n case \"Backspace\":\n case 8:\n case \"Delete\":\n case 46: {\n if (activeNode) {\n action = \"delete-node\";\n node = activeNode;\n } else {\n action = \"delete-edge\";\n edge = activeEdge;\n }\n break;\n }\n default:\n if (!activeNode) {\n return;\n }\n switch (key) {\n case \"ArrowLeft\":\n case 37: {\n node = moveOnAxis(\"x\", renderedNodes, activeNode, -1);\n action = \"switch-active-node\";\n break;\n }\n case \"ArrowUp\":\n case 38: {\n node = moveOnAxis(\"y\", renderedNodes, activeNode, -1);\n action = \"switch-active-node\";\n break;\n }\n case \"ArrowRight\":\n case 39: {\n node = moveOnAxis(\"x\", renderedNodes, activeNode, 1);\n action = \"switch-active-node\";\n break;\n }\n case \"ArrowDown\":\n case 40: {\n node = moveOnAxis(\"y\", renderedNodes, activeNode, 1);\n action = \"switch-active-node\";\n break;\n }\n }\n }\n if (action) {\n event.preventDefault();\n event.stopPropagation();\n return { action, node: node?.data, edge } as KeyboardAction;\n }\n}\n\nfunction moveOnAxis(\n axis: \"x\" | \"y\",\n renderedNodes: RenderedNode[],\n activeNode: RenderedNode,\n direction: 1 | -1\n) {\n const oppositeAxis = axis === \"x\" ? \"y\" : \"x\";\n let diff: number;\n const candidates = renderedNodes.filter(\n (node) =>\n node !== activeNode &&\n ((diff = (node[axis] - activeNode[axis]) * direction), diff > 0) &&\n diff > Math.abs(activeNode[oppositeAxis] - node[oppositeAxis])\n );\n return minBy(\n candidates,\n (node) =>\n (activeNode[oppositeAxis] - node[oppositeAxis]) ** 2 +\n (activeNode[axis] - node[axis]) ** 2\n );\n}\n","import { checkIfByTransform, __secret_internals } from \"@next-core/runtime\";\nimport type React from \"react\";\nimport {\n DEFAULT_LINE_STROKE_COLOR,\n DEFAULT_LINE_STROKE_WIDTH,\n} from \"../constants\";\nimport type {\n ConnectLineState,\n DiagramNode,\n ConnectLineDetail,\n ConnectNodesOptions,\n PositionTuple,\n RefRepository,\n ActiveTarget,\n DragNodesOptions,\n NodesFilterOptions,\n NodeMovement,\n ManualLayoutStatus,\n} from \"../interfaces\";\n\nexport function handleNodesMouseDown(\n event: MouseEvent,\n {\n nodes,\n nodesRefRepository,\n connectNodes,\n dragNodes,\n scale,\n setConnectLineState,\n setConnectLineTo,\n setManualLayoutStatus,\n setNodeMovement,\n onSwitchActiveTarget,\n onNodesConnect,\n }: {\n nodes: DiagramNode[] | undefined;\n connectNodes: ConnectNodesOptions | undefined;\n dragNodes: DragNodesOptions | undefined;\n nodesRefRepository: RefRepository | null;\n scale: number;\n setConnectLineState: (\n value: React.SetStateAction<ConnectLineState | null>\n ) => void;\n setConnectLineTo: (value: React.SetStateAction<PositionTuple>) => void;\n setManualLayoutStatus: (\n value: React.SetStateAction<ManualLayoutStatus>\n ) => void;\n setNodeMovement: (value: React.SetStateAction<NodeMovement | null>) => void;\n onSwitchActiveTarget?(target: ActiveTarget | null): void;\n onNodesConnect?(detail: ConnectLineDetail): void;\n }\n) {\n function findNode(match: (element: HTMLElement) => boolean) {\n if (nodesRefRepository) {\n for (const [id, element] of nodesRefRepository) {\n if (match(element)) {\n return nodes?.find((node) => node.id === id);\n }\n }\n }\n }\n\n if (!connectNodes && !dragNodes) {\n return;\n }\n\n const source = findNode((element) =>\n element.contains(event.target as Node | null)\n );\n\n if (!source) {\n return;\n }\n\n if (!nodeMatched(connectNodes || dragNodes!, source)) {\n return;\n }\n\n event.stopPropagation();\n const from: PositionTuple = [event.clientX, event.clientY];\n\n if (connectNodes) {\n setConnectLineState({\n from,\n options: {\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n ...(__secret_internals.legacyDoTransform(\n { source },\n connectNodes\n ) as ConnectNodesOptions),\n },\n });\n setConnectLineTo(from);\n\n onSwitchActiveTarget?.({ type: \"node\", nodeId: source.id });\n\n const onMouseMove = (e: MouseEvent) => {\n setConnectLineTo([e.clientX, e.clientY]);\n };\n const onMouseUp = (e: MouseEvent) => {\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setConnectLineState(null);\n const eventTargets = e.composedPath();\n const target = findNode((element) => eventTargets.includes(element));\n if (target && source !== target) {\n onNodesConnect?.({ source, target });\n }\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n return;\n }\n\n // Drag node\n onSwitchActiveTarget?.({ type: \"node\", nodeId: source.id });\n\n let moved = false;\n const onMouseMove = (e: MouseEvent) => {\n // Respect the scale\n const movement: PositionTuple = [\n (e.clientX - from[0]) / scale,\n (e.clientY - from[1]) / scale,\n ];\n if (!moved) {\n moved = movement[0] ** 2 + movement[1] ** 2 >= 9;\n if (moved) {\n setManualLayoutStatus(\"started\");\n }\n }\n if (moved) {\n setNodeMovement({ id: source.id, move: movement });\n }\n };\n const onMouseUp = () => {\n moved = false;\n document.removeEventListener(\"mousemove\", onMouseMove);\n document.removeEventListener(\"mouseup\", onMouseUp);\n setNodeMovement(null);\n setManualLayoutStatus(\"finished\");\n };\n document.addEventListener(\"mousemove\", onMouseMove);\n document.addEventListener(\"mouseup\", onMouseUp);\n}\n\nfunction nodeMatched(\n options: NodesFilterOptions,\n source: DiagramNode\n): boolean {\n return options.sourceType\n ? ([] as unknown[]).concat(options.sourceType).includes(source.type)\n : checkIfByTransform(options, { source });\n}\n","import { checkIfByTransform } from \"@next-core/runtime\";\nimport type { DiagramEdge, LineConf } from \"../interfaces\";\n\nexport function matchEdgeByFilter(\n edge: DiagramEdge,\n filter: LineConf\n): boolean {\n if (!filter) {\n return false;\n }\n if (filter.edgeType) {\n return ([] as string[]).concat(filter.edgeType).includes(edge.type!);\n }\n return checkIfByTransform(filter, { edge });\n}\n","import { findIndex, uniqueId } from \"lodash\";\nimport { __secret_internals } from \"@next-core/runtime\";\nimport type {\n DiagramEdge,\n LineConf,\n LineMarker,\n LineMarkerConf,\n LineMarkerType,\n NormalizedLine,\n NormalizedLineMarker,\n} from \"../interfaces\";\nimport { matchEdgeByFilter } from \"./matchEdgeByFilter\";\nimport {\n DEFAULT_LINE_CURVE_TYPE,\n DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n DEFAULT_LINE_STROKE_COLOR,\n DEFAULT_LINE_STROKE_WIDTH,\n} from \"../constants\";\n\nexport function normalizeLinesAndMarkers(\n edges: DiagramEdge[] | undefined,\n lines: LineConf[] | undefined\n) {\n const normalizedLines: NormalizedLine[] = [];\n const normalizedLinesMap = new WeakMap<DiagramEdge, string>();\n const markers: LineMarker[] = [];\n for (const edge of edges ?? []) {\n const { label, ...restLineConf } =\n lines?.find((line) => matchEdgeByFilter(edge, line)) ?? {};\n\n const computedLineConf = __secret_internals.legacyDoTransform(\n { edge },\n restLineConf\n ) as LineConf | undefined;\n if (computedLineConf?.draw === false) {\n continue;\n }\n const id = uniqueId(\"line-\");\n const line: NormalizedLine[\"line\"] = {\n strokeColor: DEFAULT_LINE_STROKE_COLOR,\n strokeWidth: DEFAULT_LINE_STROKE_WIDTH,\n curveType:\n computedLineConf?.type === \"polyline\"\n ? \"curveLinear\"\n : DEFAULT_LINE_CURVE_TYPE,\n interactStrokeWidth: DEFAULT_LINE_INTERACT_STROKE_WIDTH,\n type: \"auto\",\n ...computedLineConf,\n label,\n $id: id,\n };\n normalizedLinesMap.set(edge, id);\n\n const normalizedMarkers: NormalizedLineMarker[] = [];\n\n const lineMarkers: LineMarkerConf[] =\n line.markers ?? (line.arrow ? [{ placement: \"end\", type: \"arrow\" }] : []);\n for (const marker of lineMarkers) {\n const { placement: _placement, type: _type } = marker;\n const placement = _placement ?? \"end\";\n\n let type: LineMarkerType;\n let offsetUnit: number;\n\n switch (_type) {\n case \"0..1\":\n case \"0..N\":\n offsetUnit = 21;\n type = _type;\n break;\n default:\n offsetUnit = 1;\n type = \"arrow\";\n }\n const offset = offsetUnit * line.strokeWidth;\n\n const index = addMarker({ type, strokeColor: line.strokeColor }, markers);\n normalizedMarkers.push({\n index,\n placement,\n type,\n variant: \"default\",\n offset,\n });\n\n const activeStrokeColor =\n line.overrides?.active?.strokeColor ?? line.strokeColor;\n const activeMarkerIndex = addMarker(\n { type, strokeColor: activeStrokeColor },\n markers\n );\n normalizedMarkers.push({\n index: activeMarkerIndex,\n placement,\n type,\n variant: \"active\",\n offset,\n });\n const activeRelatedStrokeColor =\n line.overrides?.activeRelated?.strokeColor ?? line.strokeColor;\n const activeRelatedMarkerIndex = addMarker(\n { type, strokeColor: activeRelatedStrokeColor },\n markers\n );\n normalizedMarkers.push({\n index: activeRelatedMarkerIndex,\n placement,\n type,\n variant: \"active-related\",\n offset,\n });\n }\n\n normalizedLines.push({\n line,\n markers: normalizedMarkers,\n edge,\n });\n }\n return {\n normalizedLines,\n normalizedLinesMap,\n markers,\n };\n}\n\nfunction addMarker(marker: LineMarker, markers: LineMarker[]): number {\n let markerIndex = findIndex(markers, marker);\n if (markerIndex === -1) {\n markerIndex = markers.push(marker) - 1;\n }\n return markerIndex;\n}\n","import type {\n ActiveTarget,\n ActiveTargetOfEdge,\n ActiveTargetOfNode,\n} from \"../interfaces\";\n\nexport function sameTarget(\n a: ActiveTarget | null | undefined,\n b: ActiveTarget | null | undefined\n): boolean {\n return a\n ? !!b &&\n a.type === b.type &&\n (a.type === \"node\"\n ? a.nodeId === (b as ActiveTargetOfNode).nodeId\n : a.edge.source === (b as ActiveTargetOfEdge).edge.source &&\n a.edge.target === (b as ActiveTargetOfEdge).edge.target)\n : !b;\n}\n","import type { RenderedNode, TransformLiteral } from \"../interfaces\";\n\nexport interface TransformToCenterOptions {\n canvasWidth: number;\n canvasHeight: number;\n scaleRange?: [min: number, max: number];\n}\n\nexport function transformToCenter(\n renderedNodes: RenderedNode[],\n { canvasWidth, canvasHeight, scaleRange }: TransformToCenterOptions\n): TransformLiteral {\n let left = Infinity;\n let top = Infinity;\n let right = -Infinity;\n let bottom = -Infinity;\n for (const node of renderedNodes) {\n const hw = node.width / 2;\n const hh = node.height / 2;\n const l = node.x - hw;\n const r = node.x + hw;\n const t = node.y - hh;\n const b = node.y + hh;\n if (l < left) {\n left = l;\n }\n if (r > right) {\n right = r;\n }\n if (t < top) {\n top = t;\n }\n if (b > bottom) {\n bottom = b;\n }\n }\n\n const width = right - left;\n const height = bottom - top;\n\n const scale =\n scaleRange && (width > canvasWidth || height > canvasHeight)\n ? Math.max(\n Math.min(canvasWidth / width, canvasHeight / height, scaleRange[1]),\n scaleRange[0]\n )\n : 1;\n\n const x = (canvasWidth - width * scale) / 2 - left * scale;\n const y = (canvasHeight - height * scale) / 2 - top * scale;\n\n return { x, y, k: scale };\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block;width:100%;height:100%;overflow:hidden}:host([hidden]){display:none}*{box-sizing:border-box}.diagram{width:100%;height:100%;position:relative;opacity:0}.diagram:focus{outline:none}.lines,\n.line-labels,\n.nodes{position:absolute;top:0;left:0}.line-labels{opacity:0}.ready{opacity:1}.diagram.ready.pannable{cursor:grab}.diagram.pannable.grabbing{cursor:grabbing}.nodes,\n.lines{transform-origin:0 0}.node,\n.line-label{position:absolute;visibility:hidden}.line-label{transform:translate(-50%,-50%);white-space:pre-line;width:max-content;text-align:center;line-height:1}.lines{pointer-events:none}.line.interactable{pointer-events:auto;cursor:default}.connect-line{position:fixed;top:0;left:0;right:0;bottom:0;pointer-events:none}.connect-line:not(.connecting){display:none}.line:not(.active) .active-bg{display:none}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n"],"names":["ConnectLineComponent","_ref","connectLineState","connectLineTo","markerPrefix","React","width","height","className","classNames","connecting","from","MarkerComponent","type","id","strokeColor","options","d","join","fill","stroke","strokeWidth","markerEnd","arrow","undefined","LineComponent","_line$overrides","_line$overrides2","line","edge","markers","linePaths","lineMaskRects","maskPrefix","activeLineMarkerPrefix","active","activeRelated","onLineClick","onLineDoubleClick","mask","has","$id","interactStrokeWidth","overrides","expectVariant","markerStart","marker","variant","placement","index","interactable","onClick","onDoubleClick","e","preventDefault","stopPropagation","style","cursor","ref","element","set","LineLabelComponentGroup","labels","onRendered","rendered","setRendered","useState","renderedIds","setRenderedIds","refRepository","useMemo","Map","handleRenderer","useCallback","previous","includes","concat","handleUnmount","indexOf","slice","delete","useEffect","some","label","map","_ref2","text","key","LineLabelComponent","onUnmount","LineTextComponent","_ref3","refCallback","content","_ref4","useBrick","checkIfByTransform","memoizedData","setTimeout","parentElement","ignoredCallback","ReactUseBrick","data","LineMaskComponent","lineId","rects","renderedLineLabels","lineText","find","item","lineRect","bgRect","padding","left","rect","top","x","y","NodeComponentGroup","nodes","nodeBricks","node","NodeComponent","_findNodeBrick","nodeType","findNodeBrick","DEFAULT_LINE_STROKE_COLOR","DEFAULT_LINE_STROKE_WIDTH","DEFAULT_LINE_CURVE_TYPE","DEFAULT_LINE_INTERACT_STROKE_WIDTH","DEFAULT_SCALE_RANGE_MIN","DEFAULT_SCALE_RANGE_MAX","adjustNodesSize","nodesRefRepository","nodePaddings","get","Math","max","offsetWidth","offsetHeight","adjustNodesPosition","_nodesRefRepository$g","nodeContainer","visibility","getRenderedEdges","edges","normalizedLinesMap","lineLabelsRefRepository","labelSize","getDummyNodes","count","Array","v","i","dummy","source","target","getDummyEdges","useRenderedDiagram","layout","originalLayout","manualLayoutStatus","userViewReady","userViewNodesMap","nodeMovement","nodesRenderId","lineLabelsRenderId","layoutOptions","graph","setGraph","renderedDiagram","setRenderedDiagram","previousGraph","dagreLayoutOptions","nodePadding","dagreGraphOptions","rankdir","ranksep","edgesep","nodesep","pick","extractPartialRectTuple","dagre","Graph","setDefaultEdgeLabel","previousNode","getNode","setNode","setEdge","applyLayout","renderedNodes","push","console","error","length","renderedEdges","labelpos","getDagreGraph","forceLayoutOptions","dummyNodesOnEdges","collide","dummyRadius","radiusDiff","strength","iterations","renderedNode","userViewNode","fx","fy","forceNodes","forceLinks","linkSimulation","forceLink","distance","l","simulation","forceSimulation","force","forceX","forceY","forceManyBody","forceCollide","radius","sqrt","stop","tick","ceil","log","alphaMin","alphaDecay","manuallyTickToTheEnd","getForceGraph","x0","y0","movedNode","move","getManualGraph","InstanceApi_postSearchV3","objectId","http","post","_x","_x2","_x3","apply","this","arguments","InstanceApi_updateInstanceV2","instanceId","put","_x4","InstanceApi_createInstance","USER_VIEW_MODEL_ID","useUserView","query","setUserViewReady","userViewIdRef","useRef","setUserViewNodesMap","queue","working","waitingTasks","async","task","nextTask","shift","createAsyncQueue","namespace","list","fields","$eq","page","page_size","_userView$nodes","userView","current","handleHttpError","getUserView","saveUserView","userViewData","interceptorParams","ignoreLoadingBar","adjustLineLabels","position","angle","size","_size","tempDirection","floor","PI","direction","tangent","tan","offsetAngle","offset","offsetSin","sin","offsetCos","cos","transform","getLineMaskRects","offsetLeft","offsetTop","getRenderedLineLabels","renderedLines","flatMap","path","getAttribute","getBBox","pathLength","getTotalLength","point","getPointAtLength","min","getRenderedLines","normalizedLines","renderedEdgeMap","WeakMap","renderedNodeMap","relatedNodes","renderedEdge","prepared","_markers$find","_markers$find2","rest","startMarkerOffset","endMarkerOffset","points","doTwoNodesOverlap","prepareRelatedNodes","addRelatedNodes","to","relates","Set","toNode","add","sourceDirection","getDirection","targetDirection","sourceRelates","getOrderedRelates","targetRelates","sourcePosition","targetPosition","getPolyLinePoints","getDirectLinePoints","start","end","atan2","curveLine","curveType","filter","Boolean","sourceAngle","sx","sy","tx","ty","fixedAngle","sort","a","b","ax","ay","bx","by","handleKeyboard","event","activeTarget","activeNode","nodeId","activeEdge","keyCode","which","action","moveOnAxis","_node","axis","oppositeAxis","diff","candidates","abs","minBy","handleNodesMouseDown","connectNodes","dragNodes","scale","setConnectLineState","setConnectLineTo","setManualLayoutStatus","setNodeMovement","onSwitchActiveTarget","onNodesConnect","findNode","match","contains","sourceType","nodeMatched","clientX","clientY","__secret_internals","legacyDoTransform","onMouseMove","onMouseUp","document","removeEventListener","eventTargets","composedPath","addEventListener","moved","movement","matchEdgeByFilter","edgeType","normalizeLinesAndMarkers","lines","restLineConf","computedLineConf","draw","uniqueId","normalizedMarkers","lineMarkers","_placement","_type","offsetUnit","addMarker","activeMarkerIndex","activeRelatedMarkerIndex","markerIndex","findIndex","sameTarget","transformToCenter","canvasWidth","canvasHeight","scaleRange","Infinity","right","bottom","hw","hh","r","t","k","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 4766.f59e3f71.js.LICENSE.txt */
|
|
2
|
-
"use strict";(globalThis.webpackChunk_next_bricks_diagram=globalThis.webpackChunk_next_bricks_diagram||[]).push([[4766],{4766:(e,t,n)=>{n.r(t),n.d(t,{Dialog:()=>Xt,Notification:()=>on,StoryboardFunctionRegistryFactory:()=>fe,__secret_internals:()=>r,__test_only:()=>{},applyTheme:()=>te,authenticate:()=>bi,batchSetAppsLocalTheme:()=>ne,checkIfByTransform:()=>St,checkIfOfComputed:()=>bt,createHistory:()=>A,createRuntime:()=>ui,customEditors:()=>Ci,customProcessors:()=>x,customTemplates:()=>Pe,fetchByProvider:()=>Ri,getAuth:()=>Si,getBasePath:()=>f,getCssPropertyValue:()=>ce,getCurrentMode:()=>se,getCurrentTheme:()=>ee,getHistory:()=>k,getPageInfo:()=>po,getRealValue:()=>Ti,getRuntime:()=>di,getV2RuntimeFromDll:()=>S,handleHttpError:()=>rn,httpErrorToString:()=>Qt,instantiateModalStack:()=>Pi,isLoggedIn:()=>ki,isUnauthenticatedError:()=>Zt,logout:()=>Ai,matchPath:()=>Bt,registerWidgetFunctions:()=>Be,registerWidgetI18n:()=>N,setUIVersion:()=>ho,unstable_createRoot:()=>Oi});var r={};n.r(r),n.d(r,{addRealTimeDataInspectHook:()=>Pr,debugDataValue:()=>Cr,getAddedContracts:()=>Ir,getAllContextValues:()=>Er,getBrickPackagesById:()=>br,getContextValue:()=>yr,getLegalRuntimeValue:()=>Rr,getRenderId:()=>kr,legacyDoTransform:()=>ur,loadBricks:()=>Sr,loadEditors:()=>Ar,mountUseBrick:()=>cr,renderUseBrick:()=>ar,setRealTimeDataInspectRoot:()=>_r,symbolForRootRuntimeContext:()=>sr,unmountUseBrick:()=>lr,updateSnippetPreviewSettings:()=>vr,updateStoryboard:()=>dr,updateStoryboardByRoute:()=>pr,updateStoryboardBySnippet:()=>gr,updateStoryboardByTemplate:()=>fr,updateTemplatePreviewSettings:()=>hr});var o=n(4586),i=n(918),s=n(6121),a=n(829),c=n(6181),l=n(49),u=n(3078),d=n(1302),p=(n(6036),n(2890));function f(){const e=document.querySelector("base");return e?e.getAttribute("href"):"/"}var h=n(1030);function m(e,t){const n=(0,h.orderBy)(e,(e=>{var t;return(null===(t=e.app.homepage)||void 0===t?void 0:t.length)??0}),"desc");for(const e of n){const n=e.app.homepage;if("string"==typeof n&&"/"===n[0]&&g(n,t))return e}}function g(e,t){return"/"===e?t===e:`${t.replace(/\/+$/,"")}/`.startsWith(`${e.replace(/\/+$/,"")}/`)}function v(e){var t;return!e||(null===(t=di().getCurrentApp())||void 0===t?void 0:t.id)!==e.app.id&&!window.STANDALONE_MICRO_APPS&&e.app.standaloneMode}let w,y=!1;function E(e,t){y=!confirm(e),t(!y)}function b(e){const{push:t,replace:n}=e;function r(r){return function(o,i,s){let a;const c="string"==typeof o;return a=c?(0,p.parsePath)(o).pathname:o.pathname,"string"==typeof a&&a.startsWith("/")&&v(function(e){var t;return m((null===(t=si)||void 0===t?void 0:t.storyboards)??[],e)}(a))?location["push"===r?"assign":"replace"](c?f()+o.substring(1):e.createHref(o)):("push"===r?t:n)(o,i,s)}}return{push:r("push"),replace:r("replace")}}function S(){var e;const{dll:t}=window;if(t&&null!==(e=window.BRICK_NEXT_VERSIONS)&&void 0!==e&&null!==(e=e["brick-container"])&&void 0!==e&&e.startsWith("2."))return t("tYg3")}function A(){if(!w){const e=(0,p.createBrowserHistory)({basename:f().replace(/\/$/,""),getUserConfirmation:E});Object.assign(e,function(e){const{push:t,replace:n}=e;function r(e,n,r){y=!1,t(e,n),null==r||r(y)}function o(e,t,r){y=!1,n(e,t),null==r||r(y)}function i(t){return function(n){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;const{extraQuery:a,clear:c,keepHash:l,...u}=i,d=new URLSearchParams(c?"":e.location.search),p={};Object.assign(p,n,a);for(const[e,t]of Object.entries(p))if(Array.isArray(t)){d.delete(e);for(const n of t)d.append(e,n)}else null==t||""===t?d.delete(e):d.set(e,t);("push"===t?r:o)(`?${d.toString()}${l?e.location.hash:""}`,u,s)}}let s;return{pushQuery:i("push"),replaceQuery:i("replace"),pushAnchor:function(t,n,o){r({...e.location,key:void 0,hash:t,state:{notify:!1,...n}},void 0,o)},reload:function(t){o({...e.location,state:{...e.location.state,notify:!0,noIncremental:!0}},void 0,t)},setBlockMessage:function(e){s=e},getBlockMessage:function(){return s},unblock:function(){s=void 0},...b({...e,push:r,replace:o})}}(e)),w=e}return w}const k=function(){const e=S();if(e)return e.getHistory}()||function(){return w};var I=n(4635),C=n(2559),R=n(108),O=n(522),T=n(4958),_=n(1491),P=n(9613),M=new WeakMap;const x=function(){const e=S();if(e)return Object.freeze({define:(t,n)=>e.getRuntime().registerCustomProcessor(t,n)})}()||new class{constructor(){(0,i.A)(this,M,new Map)}define(e,t){const[n,r]=e.split(".");let o=(0,a.A)(M,this).get(n);if(o||(o=new Map,(0,a.A)(M,this).set(n,o)),o.has(r))throw new Error(`Custom processor of "${e}" already registered`);o.set(r,t)}get(e){return(0,a.A)(M,this).get(e)}};function L(e){let{app:t,meta:n}=e;if(null!=n&&n.i18n){const e=$("app",t.id),r=[];return Object.entries(n.i18n).forEach((t=>{let[n,o]=t;c.i18n.addResourceBundle(n,e,o),r.push(n)})),()=>{for(const t of r)c.i18n.removeResourceBundle(t,e)}}}function $(e,t){return`${e}/${t}`}function B(e){return c.i18n.getFixedT(null,$("widget",e))}const N=function(){const e=S();if(e)return function(t,n){return e.getRuntime().registerWidgetI18n(t,n)}}()||function(e,t){const n=$("widget",e);Object.entries(t).forEach((e=>{let[t,r]=e;c.i18n.addResourceBundle(t,n,r)}))},U="brick-next-devtools-panel",F="devtools-frame-active-change",D="devtools-panel-change";let j,K=!0;function V(e,t){const n=W();if(!n||"evaluation"===e&&(!K||j&&"Evaluations"!==j))return;const r=()=>{var r;null===(r=n.emit)||void 0===r||r.call(n,{type:e,payload:t})};"function"==typeof window.requestIdleCallback?window.requestIdleCallback(r):setTimeout(r,0)}function W(){return window.__BRICK_NEXT_DEVTOOLS_HOOK__}const H=()=>{throw new Error("Can't modify read-only proxy object")},G={set:H,defineProperty:H,deleteProperty:H,setPrototypeOf:H};function z(e){return new Proxy(e,G)}function q(e){let{get:t,ownKeys:n}=e;return W()?z(Object.fromEntries(n(null).map((e=>[e,t(null,e,null)])))):new Proxy(Object.freeze({}),{get:t})}let Y="light";const X=new u.JsonStorage(localStorage),J="apps-theme";function Q(e){if("dark"!==e&&"light"!==e&&"dark-v2"!==e)throw new Error(`Unsupported theme: ${e}`);Y=e}function Z(){return Y}function ee(){return document.documentElement.dataset.theme}function te(e){e?Q(e):e=Z(),e!==ee()&&(document.documentElement.dataset.theme=e,window.dispatchEvent(new CustomEvent("theme.change",{detail:e})))}function ne(e){X.setItem(J,{...re(),...e})}function re(){let e;try{e=X.getItem(J)}catch{console.error("JSON parse error inside `getLocalAppsTheme()`")}return e??{}}let oe="default";function ie(e){if("dashboard"!==e&&"default"!==e)throw new Error(`Unsupported mode: ${e}`);oe=e}function se(){return document.documentElement.dataset.mode}function ae(e){e?ie(e):e=oe,e!==se()&&(document.documentElement.dataset.mode=e,window.dispatchEvent(new CustomEvent("mode.change",{detail:e})))}function ce(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.documentElement;return n&&(null===(t=window.getComputedStyle(n))||void 0===t?void 0:t.getPropertyValue(e))||""}function le(e,t){const n={};for(const r of e){const e=ue(r,t);void 0!==e&&(n[r]=e)}return n}function ue(e,t){var n,r,o;let{collectCoverage:i,widgetId:s,widgetVersion:a,app:l,appendI18nNamespace:u,storyboardFunctions:d,isStoryboardFunction:p}=t;switch(e){case"BASE_URL":return i?"/next":f().replace(/\/$/,"");case"FN":return d;case"IMG":return i?{get:e=>`mock/images/${e}`}:s?null==li||null===(n=li.images)||void 0===n?void 0:n.widgetImagesFactory(s,a):null==li||null===(r=li.images)||void 0===r?void 0:r.imagesFactory(l.id,l.isBuildPush,l.currentVersion);case"I18N":return i?h.identity:s?B(s):c.i18n.getFixedT(null,[u,$("app",l.id)].filter(Boolean));case"I18N_TEXT":return i?de:c.i18nText;case"PERMISSIONS":return z({check:i?pe:null==li||null===(o=li.checkPermissions)||void 0===o?void 0:o.checkPermissions});case"THEME":return z({getTheme:i?()=>"light":Z,getCssPropertyValue:i?()=>"":ce});case"console":return p?z(console):void 0;case"location":return i?{href:"http://localhost:3000/functions/test",origin:"http://localhost:3000",host:"localhost:3000",hostname:"localhost"}:{href:location.href,origin:location.origin,host:location.host,hostname:location.hostname}}}function de(e){return null==e?void 0:e.en}function pe(){return!0}function fe(){let{widgetId:e,widgetVersion:t,collectCoverage:n,debuggerOverrides:r}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const o=new Map,i=null==r?void 0:r({precookFunction:O.precookFunction,cook:O.cook,supply:P.supply}),s=new Proxy(Object.freeze({}),{get:(c,l)=>function(c){const l=o.get(c);if(!l)return;if(l.processed)return l.cooked;let u;n&&(u=n.createCollector(c));const d=(0,O.precookFunction)(l.source,{typescript:l.typescript,hooks:u&&{beforeVisit:u.beforeVisit},cacheKey:l}),p=(0,P.supply)(d.attemptToVisitGlobals,le(d.attemptToVisitGlobals,{collectCoverage:n,widgetId:e,widgetVersion:t,app:a,storyboardFunctions:s,isStoryboardFunction:!0}),!!n);return l.cooked=(0,O.cook)(d.function,l.source,{rules:{noVar:!0},globalVariables:i?{...p,...null!=i&&i.LodashWithStaticFields&&d.attemptToVisitGlobals.has("_")?{_:{...p._,...i.LodashWithStaticFields}}:null,...null!=i&&i.ArrayConstructor&&d.attemptToVisitGlobals.has("Array")?{Array:i.ArrayConstructor}:null,...null!=i&&i.ObjectWithStaticFields&&d.attemptToVisitGlobals.has("Object")?{Object:{...p.Object,...i.ObjectWithStaticFields}}:null}:p,ArrayConstructor:null==i?void 0:i.ArrayConstructor,hooks:u&&{beforeEvaluate:u.beforeEvaluate,beforeCall:u.beforeCall,beforeBranch:u.beforeBranch},debug:!!r}),l.processed=!0,l.cooked}(l)});let a;return{storyboardFunctions:s,registerStoryboardFunctions:function(e,t){if(t&&(a=t),o.clear(),Array.isArray(e))for(const t of e){let e=t.deps;null==e&&(e=(0,T.collectMemberUsageInFunction)(t,"FN",!!n),e.delete(t.name));const r=t.perm??(0,T.collectMemberUsageInFunction)(t,"PERMISSIONS",!!n).has("check");o.set(t.name,{source:t.source,typescript:t.typescript,deps:e,hasPermissionsCheck:r})}},updateStoryboardFunction(e,t){const n={...t,name:e},r=(0,T.collectMemberUsageInFunction)(n,"FN",!0),i=(0,T.collectMemberUsageInFunction)(n,"PERMISSIONS",!0).has("check");o.set(e,{source:t.source,typescript:t.typescript,deps:r,hasPermissionsCheck:i})},checkPermissionsUsage(e){const t=new Set,n=e=>{if(!t.has(e)){t.add(e);const r=o.get(e);return!!r&&(r.hasPermissionsCheck||[...r.deps].some(n))}return!1};return e.some(n)},clearGlobalExecutionContextStack(){(0,O.__dev_only_clearGlobalExecutionContextStack)()},getGlobalExecutionContextStack:()=>(0,O.__dev_only_getGlobalExecutionContextStack)()}}const{storyboardFunctions:he,registerStoryboardFunctions:me,checkPermissionsUsage:ge}=fe();var ve={};try{ve.EventTarget=(new EventTarget).constructor}catch(e){!function(e,t){var n=e.create,r=e.defineProperty,o=i.prototype;function i(){t.set(this,n(null))}function s(e,t,n){r(e,t,{configurable:!0,writable:!0,value:n})}function a(e){var t=e.options;return t&&t.once&&e.target.removeEventListener(this.type,e.listener),"function"==typeof e.listener?e.listener.call(e.target,this):e.listener.handleEvent(this),this._stopImmediatePropagationFlag}s(o,"addEventListener",(function(e,n,r){for(var o=t.get(this),i=o[e]||(o[e]=[]),s=0,a=i.length;s<a;s++)if(i[s].listener===n)return;i.push({target:this,listener:n,options:r})})),s(o,"dispatchEvent",(function(e){var n=t.get(this)[e.type];return n&&(s(e,"target",this),s(e,"currentTarget",this),n.slice(0).some(a,e),delete e.currentTarget,delete e.target),!0})),s(o,"removeEventListener",(function(e,n){for(var r=t.get(this),o=r[e]||(r[e]=[]),i=0,s=o.length;i<s;i++)if(o[i].listener===n)return void o.splice(i,1)})),ve.EventTarget=i}(Object,new WeakMap)}const we=ve.EventTarget;let ye=function(e){return e.xLarge="xLarge",e.large="large",e.medium="medium",e.small="small",e.xSmall="xSmall",e}({});const Ee=new Map([[ye.xLarge,"1920px"],[ye.large,"1600px"],[ye.medium,"1280px"],[ye.small,"1024px"],[ye.xSmall,0]]),be=new we,Se={},Ae={};function ke(e,t){let n=!1;Se[t]=e.matches;for(const[e]of Ee)if(Se[e]&&Ae.breakpoint!==e){Ae.breakpoint=e,n=!0;break}n&&be.dispatchEvent(new CustomEvent("change",{detail:Ae}))}Ee.forEach(((e,t)=>{const n=window.matchMedia(`(min-width: ${e})`);ke(n,t),n.addEventListener?n.addEventListener("change",(e=>{ke(e,t)})):n.addListener((e=>{ke(e,t)}))}));const Ie=()=>Ae;function Ce(e){return function(t){const n="local"===e?localStorage:sessionStorage;return JSON.parse(n.getItem(t)??"null")}}function Re(e){var t,n;return!(null===(t=e?e.flags:null===(n=di())||void 0===n?void 0:n.getFeatureFlags())||void 0===t||!t["brick-next-v3-strict-mode"])}function Oe(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),o=2;o<n;o++)r[o-2]=arguments[o];const i=0===r.length?"":",";e?console.error(`${t} is dropped in v3 strict mode${i}`,...r):console.warn(`${t} is deprecated in v3 and will be dropped in strict mode${i}`,...r)}const Te=new Set(["prefix"]);var _e=new WeakMap;const Pe=function(){const e=S();if(e)return Object.freeze({define:(t,n)=>e.getRuntime().registerCustomTemplate(t,n)})}()||new class{constructor(){(0,i.A)(this,_e,new Map)}define(e,t){var n,r;let o=(0,a.A)(_e,this).has(e);o?console.warn(`Custom template of "${e}" already registered.`):(o=!!customElements.get(e),o&&console.warn(`Custom template of "${e}" already defined by customElements.`));const i=Re(),s=(null===(n=t.proxy)||void 0===n?void 0:n.properties)??{},c=[],l=[];for(const[t,n]of Object.entries(s))n.asVariable?(Oe(i,"Template `asVariable`",e,t),i||l.push(t)):n.mergeProperty||n.refTransform?console.error("Template `mergeProperty` and `refTransform` are dropped in v3:",e,t):n.ref&&c.push([t,n]);const u={...t,proxy:{...t.proxy,properties:Object.fromEntries(c)},state:(t.state?i?t.state:t.state.map((e=>({expose:!0,...e}))):[]).concat(l.map((e=>({name:e,expose:!0}))))};(0,a.A)(_e,this).set(e,{...u,name:e});const d=(p=u.state,(0,h.uniq)((null==p?void 0:p.filter((e=>e.expose)).map((e=>e.name)))??[]));var p;const f=Object.entries((null===(r=u.proxy)||void 0===r?void 0:r.methods)??{}),m=d.concat(c.map((e=>e[0]))),g=f.map((e=>e[0])),v=m.concat(g).filter((e=>e in HTMLElement.prototype&&!Te.has(e)));if(v.length>0&&(Oe(i,"Using native HTMLElement properties as template properties or methods",e,...v),i))throw new Error(`In custom template "${e}", ${v.map((e=>`"${e}"`)).join(", ")} are native HTMLElement properties, and should be avoid to be used as brick properties or methods.`);if(!o){class t extends HTMLElement{get $$typeof(){return"custom-template"}static get _dev_only_definedProperties(){return m}static get _dev_only_definedMethods(){return g}$$getElementByRef(e){var t;return null===(t=this.$$tplStateStore)||void 0===t||null===(t=t.hostBrick)||void 0===t||null===(t=t.tplHostMetadata)||void 0===t||null===(t=t.internalBricksByRef.get(e))||void 0===t?void 0:t.element}connectedCallback(){let e=this.shadowRoot;e||(e=this.attachShadow({mode:"open"}));const t=document.createDocumentFragment(),n=document.createElement("style");n.textContent=":host{display:block}:host([hidden]){display:none}";const r=document.createElement("slot");t.appendChild(n),t.appendChild(r),e.appendChild(t)}disconnectedCallback(){this.shadowRoot&&(this.shadowRoot.textContent="")}}for(const n of d)c.some((e=>e[0]===n))?console.error(`Cannot define an exposed state that is also a proxy property: "${n}" in ${e}`):Object.defineProperty(t.prototype,n,{get(){return this.$$tplStateStore.getValue(n)},set(e){var t;null===(t=this.$$tplStateStore)||void 0===t||t.updateValue(n,e,"replace")},enumerable:!0});for(const[e,n]of c)Object.defineProperty(t.prototype,e,{get(){return this.$$getElementByRef(n.ref)[n.refProperty??e]},set(t){var r;const o=null===(r=this.$$getElementByRef)||void 0===r?void 0:r.call(this,n.ref);o&&(o[n.refProperty??e]=t)},enumerable:!0});for(const[e,n]of f)Object.defineProperty(t.prototype,e,{value(){return this.$$getElementByRef(n.ref)[n.refMethod??e](...arguments)},enumerable:!0});customElements.define(e,t)}}get(e){return(0,a.A)(_e,this).get(e)}};function Me(e,t,n){let{tplStateStoreId:r,tplStateStoreMap:o}=e;if(!r)throw new Error(`Using "${t}" outside of a custom template${n??""}`);const i=o.get(r);if(!i)throw new Error(`Template state store is not found when using "${t}"${n??""}.\nThis is a bug of Brick Next, please report it.`);return i}function xe(e,t,n){const r=Me(e,t,n).hostBrick.element;if(!r)throw new Error(`Template host element is gone when using "${t}"${n??""}.\nThis is a bug of Brick Next, please report it.`);return r}const Le=new Map,$e=new Proxy(Object.freeze({}),{get:(e,t)=>Le.get(t)}),Be=function(){const e=S();if(e)return function(t,n,r){return e.getRuntime().registerWidgetFunctions(t,n,r)}}()||function(e,t,n){if(Le.has(e))throw new Error(`Widget functions of "${e}" already registered`);const{storyboardFunctions:r,registerStoryboardFunctions:o}=fe({widgetId:e,widgetVersion:n});Le.set(e,r),o(t)},Ne=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Ue=e=>{if("string"!=typeof e)throw new TypeError("Invalid argument expected string");const t=e.match(Ne);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},Fe=e=>"*"===e||"x"===e||"X"===e,De=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},je=(e,t)=>{if(Fe(e)||Fe(t))return 0;const[n,r]=((e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t])(De(e),De(t));return n>r?1:n<r?-1:0},Ke=(e,t)=>{for(let n=0;n<Math.max(e.length,t.length);n++){const r=je(e[n]||"0",t[n]||"0");if(0!==r)return r}return 0},Ve=(e,t,n)=>{Ge(n);const r=((e,t)=>{const n=Ue(e),r=Ue(t),o=n.pop(),i=r.pop(),s=Ke(n,r);return 0!==s?s:o&&i?Ke(o.split("."),i.split(".")):o||i?o?-1:1:0})(e,t);return We[n].includes(r)},We={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},He=Object.keys(We),Ge=e=>{if("string"!=typeof e)throw new TypeError("Invalid operator type, expected string but got "+typeof e);if(-1===He.indexOf(e))throw new Error(`Invalid operator, expected one of ${He.join("|")}`)};function ze(e,t){let n=Ei(e);if(!n&&null!=li&&li.checkInstalledApps&&(n=li.checkInstalledApps.getCheckedApp(e)),!n||"running"===n.installStatus)return!1;if(!t||!n.currentVersion)return!0;const r=t.match(/^([><]=?|=)(.*)$/);try{if(!r)throw new TypeError(`Invalid match version: ${t}`);return Ve(n.currentVersion,r[2],r[1])}catch(e){console.error(e)}return!1}function qe(e,t,n){let{formStateStoreId:r,formStateStoreMap:o}=e;if(!r)throw new Error(`Using "${t}" outside of form renderer${n??""}`);const i=o.get(r);if(!i)throw new Error(`Form state store is not found when using "${t}"${n??""}.\nThis is a bug of Brick Next, please report it.`);return i}const Ye=new Map;async function Xe(e){var t;const n=null==li||null===(t=li.flowApi)||void 0===t?void 0:t.isFlowApiProvider(e);n&&(e=li.flowApi.FLOW_API_PROVIDER);let r=Ye.get(e);if(r)return r;if(e.includes("-")&&!customElements.get(e))if(n)li.flowApi.registerFlowApiProvider();else if(await(0,l.loadBricksImperatively)([e],mi()),!customElements.get(e))throw new Error(`Provider not defined: "${e}".`);return r=document.createElement(e),Ye.set(e,r),r}let Je=new WeakSet;function Qe(e){if((0,u.isObject)(e)&&!Ze(e))if(Je.add(e),Array.isArray(e))e.forEach(Qe);else{const t=Object.getPrototypeOf(e);t&&t.constructor!==Object||Object.values(e).forEach(Qe)}}function Ze(e){return Je.has(e)}const et=new Map;async function tt(e,t,n){const{useProvider:r,method:o="resolve",args:i=[],onReject:s}=e,{provider:a,field:c}=e;if(a&&!r)throw new Error(`You're using "provider: ${a}" which is dropped in v3, please use "useProvider" instead`);const l=null!=c;if(l){const e=Re();if(Oe(e,"`resolve.field`"),e)throw new Error("Using deprecated `resolve.field`")}const[u,d]=await Promise.all([Xe(r),mt(i,t)]),p=null==n?void 0:n.renderId,f=nt(u,r,o,d,n,i,!!p&&p!==vi());let m,{transform:g}=e;try{const e=await f;m=l?(0,h.get)(e,c):e,Qe(m)}catch(e){if(!function(e){return!(null==e||!e.transform)}(s))throw e;g=s.transform,m=e}return g?"string"==typeof g?{[g]:m}:mt(g,{...t,data:m}):m}async function nt(e,t,n,r,o,i,s){let a,c;try{a=JSON.stringify({useProvider:t,method:n,args:r})}catch(e){if(!i)throw e;a=JSON.stringify({useProvider:t,method:n,originalArgs:i})}return"reload"!==(null==o?void 0:o.cache)&&(c=et.get(a)),c||(c=(async o=>{const i=null!=li&&null!==(o=li.flowApi)&&void 0!==o&&o.isFlowApiProvider(t)?await li.flowApi.getArgsOfFlowApi(t,r,n):r;return e[n](...i)})(),s||et.set(a,c)),c}const rt=Symbol.for("pre.evaluated.raw"),ot=Symbol.for("pre.evaluated.context");function it(e){return!(null==e||!e[rt])}function st(e){return e[rt]}function at(e){return"string"==typeof e?(0,O.shouldAllowRecursiveEvaluations)(e):(0,O.shouldAllowRecursiveEvaluations)(e[rt])}const ct=new WeakSet([SyntaxError,TypeError,ReferenceError]);function lt(e){return ct.has(e.constructor)?e.constructor:TypeError}function ut(e,t,n){const{run:r}=dt(e,t,n,!1);return r()}function dt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3?arguments[3]:void 0;const o=[];if("string"!=typeof e){const n=(0,h.omit)(t,["pendingPermissionsPreCheck","tplStateStoreMap","tplStateStoreScope","formStateStoreMap","formStateStoreScope"]);t={...e[ot],...n},e=e[rt]}const i={usedArgs:new Set},s={usedArgs:new Set};let a;try{a=(0,O.preevaluate)(e,{cache:!0,withParent:!0,hooks:{beforeVisitGlobal(e,t){(0,T.collectAppGetMenuUsage)(i,e,t),(0,T.collectInstalledAppsHasUsage)(s,e,t)}}})}catch(t){const n=`${t.message}, in "${e}"`;throw new(lt(t))(n)}if(i.hasNonStaticUsage)throw new Error(`Non-static usage of "APP.getMenu" is prohibited in v3, check your expression: "${e}"`);if(s.hasNonStaticUsage)throw new Error(`Non-static usage of "INSTALLED_APPS.has" is prohibited in v3, check your expression: "${e}"`);const c={},{attemptToVisitGlobals:d}=a;if(n.lazy||d.has("EVENT")&&!(0,u.hasOwnProperty)(t,"event")||d.has("DATA")&&!(0,u.hasOwnProperty)(t,"data"))return{blockingList:o,run:()=>Object.keys(t).length>0?{[rt]:e,[ot]:t}:e};let p,f,m,g;const v=Re(t);let w,y;(d.has("STATE")||!v&&d.has("TPL"))&&(g=Me(t,"STATE",`: "${e}"`)),d.has("FORM_STATE")&&(y=qe(t,"FORM_STATE",`: "${e}"`));const E=W();if(r||E){if(d.has("CTX")&&(p=(0,T.strictCollectMemberUsage)(e,"CTX"),r&&o.push(t.ctxStore.waitFor(p))),g){if(m=(0,T.strictCollectMemberUsage)(e,"STATE"),!v){const t=(0,T.strictCollectMemberUsage)(e,"TPL");for(const e of t)m.add(e)}r&&o.push(g.waitFor(m))}y&&(w=(0,T.strictCollectMemberUsage)(e,"FORM_STATE"),r&&o.push(y.waitFor(w))),d.has("PROCESSORS")&&(f=(0,T.strictCollectMemberUsage)(e,"PROCESSORS",2),r&&o.push((0,l.loadProcessorsImperatively)(f,mi())))}if(r){let n=d.has("PERMISSIONS");if(!n&&d.has("FN")){const t=[...(0,T.strictCollectMemberUsage)(e,"FN")];n=ge(t)}if(n&&o.push(...t.pendingPermissionsPreCheck),i.usedArgs.size>0&&null!=li&&li.menu){const e=[...i.usedArgs];o.push(Promise.all(e.map((e=>li.menu.fetchMenuById(e,t,{getStoryboardByAppId:yi,resolveData:tt,asyncComputeRealValue:mt})))))}var b;s.usedArgs.size>0&&o.push(null==li||null===(b=li.checkInstalledApps)||void 0===b?void 0:b.waitForCheckingApps([...s.usedArgs]))}return{blockingList:o,run(){var n,r;const{app:o,location:i,query:s,match:l,flags:E,sys:b,ctxStore:S,data:A,event:k}=t,I=t.overrideApp??o;for(const o of d)switch(o){case"ANCHOR":c[o]=i.hash?i.hash.substring(1):null;break;case"APP":if(null==I)throw new ReferenceError(`APP is not defined, in "${e}"`);c[o]={...(0,h.cloneDeep)(I),getMenu:null==li||null===(n=li.menu)||void 0===n?void 0:n.getMenuById};break;case"CTX":c[o]=q({get:(e,t)=>S.getValue(t),ownKeys:()=>Array.from(p)});break;case"DATA":c[o]=A;break;case"EVENT":c[o]=k;break;case"FLAGS":c[o]=z(E);break;case"FORM_STATE":c[o]=q({get:(e,t)=>y.getValue(t),ownKeys:()=>Array.from(w)});break;case"HASH":c[o]=i.hash;break;case"INSTALLED_APPS":c[o]=z({has:ze});break;case"ITEM":case"INDEX":case"SIZE":{const n="ITEM"===o?"forEachItem":"INDEX"===o?"forEachIndex":"forEachSize";(0,u.hasOwnProperty)(t,n)?c[o]=t[n]:console.error(`Using \`${o}\` but no \`:forEach\` is found, check your expression: "${e}"`);break}case"LOCAL_STORAGE":c[o]=z({getItem:Ce("local")});break;case"MEDIA":c[o]=z(Ie());break;case"MISC":c[o]=di().getMiscSettings();break;case"PARAMS":if(null==s)throw new ReferenceError(`PARAMS is not defined, in "${e}"`);c[o]=new URLSearchParams(s);break;case"PATH":c[o]=z((null==l?void 0:l.params)??{});break;case"PATH_NAME":c[o]=i.pathname;break;case"PROCESSORS":c[o]=q({get(e,t){const n=x.get(t);if(!n)throw new Error(`'PROCESSORS.${t}' is not registered! Have you installed the relevant brick package?`);return q({get:(e,t)=>n.get(t),ownKeys:()=>Array.from(n.keys())})},ownKeys(){const e=new Set;for(const t of f){const n=t.split(".")[0];e.add(n)}return Array.from(e)}});break;case"QUERY":if(null==s)throw new ReferenceError(`QUERY is not defined, in "${e}"`);c[o]=Object.fromEntries(Array.from(s.keys()).map((e=>[e,s.get(e)])));break;case"QUERY_ARRAY":if(null==s)throw new ReferenceError(`QUERY_ARRAY is not defined, in "${e}"`);c[o]=Object.fromEntries(Array.from(s.keys()).map((e=>[e,s.getAll(e)])));break;case"SESSION_STORAGE":c[o]=z({getItem:Ce("session")});break;case"TPL":if(Oe(v,'Using "TPL" in expression',`check your expression: "${e}"`),v)break;case"STATE":c[o]=q({get:(e,t)=>g.getValue(t),ownKeys:()=>Array.from(m)});break;case"SYS":c[o]=z(b??{});break;case"__WIDGET_FN__":c[o]=$e;break;case"__WIDGET_IMG__":c[o]=null==li||null===(r=li.images)||void 0===r?void 0:r.widgetImagesFactory;break;case"__WIDGET_I18N__":c[o]=B}Object.assign(c,le(a.attemptToVisitGlobals,{storyboardFunctions:he,app:I,appendI18nNamespace:t.appendI18nNamespace}));try{const t=(0,O.cook)(a.expression,a.source,{globalVariables:(0,P.supply)(a.attemptToVisitGlobals,c)});return V("evaluation",{raw:e,context:c,result:t}),t}catch(t){const n=`${t.message}, in "${e}"`;throw new(lt(t))(n)}}}}let pt=function(e){return e[e.INITIAL=0]="INITIAL",e[e.USE_BRICK=1]="USE_BRICK",e[e.USE_BRICK_ITEM=2]="USE_BRICK_ITEM",e[e.USE_BRICK_PROPERTIES=3]="USE_BRICK_PROPERTIES",e[e.USE_BRICK_TRANSFORM=4]="USE_BRICK_TRANSFORM",e[e.USE_BRICK_EVENTS=5]="USE_BRICK_EVENTS",e[e.USE_BRICK_IF=6]="USE_BRICK_IF",e[e.USE_BRICK_SLOTS=7]="USE_BRICK_SLOTS",e[e.USE_BRICK_SLOTS_ITEM=8]="USE_BRICK_SLOTS_ITEM",e[e.USE_BRICK_SLOTS_ITEM_BRICKS=9]="USE_BRICK_SLOTS_ITEM_BRICKS",e[e.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM=10]="USE_BRICK_SLOTS_ITEM_BRICKS_ITEM",e[e.USE_BRICK_LIFECYCLE=11]="USE_BRICK_LIFECYCLE",e[e.USE_BRICK_DATA_SOURCE=12]="USE_BRICK_DATA_SOURCE",e}({});function ft(e){switch(e){case pt.USE_BRICK_PROPERTIES:case pt.USE_BRICK_TRANSFORM:case pt.USE_BRICK_EVENTS:case pt.USE_BRICK_IF:case pt.USE_BRICK_LIFECYCLE:case pt.USE_BRICK_DATA_SOURCE:return!0}return!1}function ht(e,t,n){if(ft(e))return e;if(t)switch(e){case pt.USE_BRICK:return pt.USE_BRICK_ITEM;case pt.USE_BRICK_SLOTS_ITEM_BRICKS:return pt.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM}else switch(e){case pt.INITIAL:if("useBrick"===n)return pt.USE_BRICK;break;case pt.USE_BRICK:case pt.USE_BRICK_ITEM:case pt.USE_BRICK_SLOTS_ITEM_BRICKS_ITEM:switch(n){case"properties":return pt.USE_BRICK_PROPERTIES;case"transform":return pt.USE_BRICK_TRANSFORM;case"dataSource":return pt.USE_BRICK_DATA_SOURCE;case"events":return pt.USE_BRICK_EVENTS;case"slots":return pt.USE_BRICK_SLOTS;case"children":return pt.USE_BRICK_SLOTS_ITEM_BRICKS;case"if":return pt.USE_BRICK_IF;case"lifeCycle":return pt.USE_BRICK_LIFECYCLE}break;case pt.USE_BRICK_SLOTS:return pt.USE_BRICK_SLOTS_ITEM;case pt.USE_BRICK_SLOTS_ITEM:if("bricks"===n)return pt.USE_BRICK_SLOTS_ITEM_BRICKS}return pt.INITIAL}async function mt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=it(e);if(r||"string"==typeof e){const o=n.$$lazyForUseBrick&&ft(n.$$stateOfUseBrick);let i,s=o;return r||(0,O.isEvaluable)(e)?(i=await async function(e,t,n){const{blockingList:r,run:o}=dt(e,t,n,!0);return await Promise.all(r),o()}(e,t,{lazy:o}),s=at(e)):i=o?e:((0,u.hasOwnProperty)(t,"data")?n.noInject?_.transform:_.transformAndInject:n.noInject?wt:_.inject)(e,t),s||Qe(i),i}if(!(0,u.isObject)(e)||Ze(e)||"function"==typeof e)return e;if(Array.isArray(e)){const r=vt(n,!0);return Promise.all(e.map((e=>mt(e,t,r))))}return Object.fromEntries((await Promise.all(Object.entries(e).map((e=>{let[r,o]=e;return Promise.all([mt(r,t),mt(o,t,vt(n,!1,r))])})))).concat(n.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))}function gt(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=it(e);if(r||"string"==typeof e){const o=n.$$lazyForUseBrick&&ft(n.$$stateOfUseBrick);let i,s=o;return r||(0,O.isEvaluable)(e)?(i=ut(e,t),s=at(e)):i=o?e:((0,u.hasOwnProperty)(t,"data")?n.noInject?_.transform:_.transformAndInject:n.noInject?wt:_.inject)(e,t),s||Qe(i),i}if(!(0,u.isObject)(e)||Ze(e)||"function"==typeof e)return e;if(Array.isArray(e)){const r=vt(n,!0);return e.map((e=>gt(e,t,r)))}return Object.fromEntries(Object.entries(e).map((e=>{let[r,o]=e;return[gt(r,t),gt(o,t,vt(n,!1,r))]})).concat(n.ignoreSymbols?[]:Object.getOwnPropertySymbols(e).map((t=>[t,e[t]]))))}function vt(e,t,n){return e.$$lazyForUseBrick?{...e,$$stateOfUseBrick:ht(e.$$stateOfUseBrick,t,n)}:e}function wt(e){return e}async function yt(e,t){return!(0,u.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||it(e.if)?await mt(e.if,t):e.if)}function Et(e,t){return!(0,u.hasOwnProperty)(e,"if")||!!("string"==typeof e.if||it(e.if)?gt(e.if,t):e.if)}function bt(e){return!(0,u.hasOwnProperty)(e,"if")||!!e.if}const St=function(){const e=S();if(e)return e.looseCheckIfByTransform}()||function(e,t){return Et(e,{data:t})};function At(e){let t=!1,n=!1,r=!1;if("string"==typeof e?(0,O.isEvaluable)(e):it(e)){const o="string"==typeof e?e:st(e);if((0,O.isTrackAll)(o)){const e=(0,T.trackAll)(o);e&&(t=e.context,n=e.state,r=e.formState)}else t=(0,T.track)(o,"track context","CTX"),n=(0,T.track)(o,"track state","STATE"),r=(0,T.track)(o,"track formstate","FORM_STATE")}return{contextNames:t,stateNames:n,formStateNames:r}}async function kt(e,t){for(const[n,r,o]of e)if(n===t){const e=await r;if(void 0!==e||!o)return e}}async function It(e){const t={};for(const[n,r,o]of e){const e=await r;void 0===e&&o||!("style"!==n&&"dataset"!==n||(0,u.isObject)(e))||(t[n]=e)}return t}function Ct(e,t){if(t)for(const[n,r]of Object.entries(t))switch(n){case"style":case"dataset":for(const[t,o]of Object.entries(r))e[n][t]=o;break;case"constructor":case"__proto__":case"innerHTML":throw new Error(`set \`${n}\` is prohibited`);default:e[n]=r}}function Rt(e,t,n){const r=function(e,t){return(0,u.isObject)(e)?Object.fromEntries(Object.entries(e).map((e=>{let[n,r]=e;const o=gt(r,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===n?pt.USE_BRICK:pt.INITIAL});if("style"!==n&&"dataset"!==n||(0,u.isObject)(o))return[n,o]})).filter(Boolean)):{}}(t,n);Array.isArray(e)||(e=[e]),e.forEach((e=>{Ct(e,r)}))}function Ot(e,t,n){if(n)for(const{contextNames:r,stateNames:o,propValue:i}of t){if(r)for(const t of r)n.disposes.push(e.ctxStore.onChange(t,n.listener));if(o)for(const t of o){const r=Me(e,"STATE",`: "${i}"`);n.disposes.push(r.onChange(t,n.listener))}}}function Tt(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function _t(e){return e&&e.sensitive?"":"i"}function Pt(e,t,n){return function(e,t,n){void 0===n&&(n={});for(var r=n.strict,o=void 0!==r&&r,i=n.start,s=void 0===i||i,a=n.end,c=void 0===a||a,l=n.encode,u=void 0===l?function(e){return e}:l,d=n.delimiter,p=void 0===d?"/#?":d,f=n.endsWith,h="[".concat(Tt(void 0===f?"":f),"]|$"),m="[".concat(Tt(p),"]"),g=s?"^":"",v=0,w=e;v<w.length;v++){var y=w[v];if("string"==typeof y)g+=Tt(u(y));else{var E=Tt(u(y.prefix)),b=Tt(u(y.suffix));if(y.pattern)if(t&&t.push(y),E||b)if("+"===y.modifier||"*"===y.modifier){var S="*"===y.modifier?"?":"";g+="(?:".concat(E,"((?:").concat(y.pattern,")(?:").concat(b).concat(E,"(?:").concat(y.pattern,"))*)").concat(b,")").concat(S)}else g+="(?:".concat(E,"(").concat(y.pattern,")").concat(b,")").concat(y.modifier);else{if("+"===y.modifier||"*"===y.modifier)throw new TypeError('Can not repeat "'.concat(y.name,'" without a prefix and suffix'));g+="(".concat(y.pattern,")").concat(y.modifier)}else g+="(?:".concat(E).concat(b,")").concat(y.modifier)}}if(c)o||(g+="".concat(m,"?")),g+=n.endsWith?"(?=".concat(h,")"):"$";else{var A=e[e.length-1],k="string"==typeof A?m.indexOf(A[A.length-1])>-1:void 0===A;o||(g+="(?:".concat(m,"(?=").concat(h,"))?")),k||(g+="(?=".concat(m,"|").concat(h,")"))}return new RegExp(g,_t(n))}(function(e,t){void 0===t&&(t={});for(var n=function(e){for(var t=[],n=0;n<e.length;){var r=e[n];if("*"!==r&&"+"!==r&&"?"!==r)if("\\"!==r)if("{"!==r)if("}"!==r)if(":"!==r)if("("!==r)t.push({type:"CHAR",index:n,value:e[n++]});else{var o=1,i="";if("?"===e[a=n+1])throw new TypeError('Pattern cannot start with "?" at '.concat(a));for(;a<e.length;)if("\\"!==e[a]){if(")"===e[a]){if(0==--o){a++;break}}else if("("===e[a]&&(o++,"?"!==e[a+1]))throw new TypeError("Capturing groups are not allowed at ".concat(a));i+=e[a++]}else i+=e[a++]+e[a++];if(o)throw new TypeError("Unbalanced pattern at ".concat(n));if(!i)throw new TypeError("Missing pattern at ".concat(n));t.push({type:"PATTERN",index:n,value:i}),n=a}else{for(var s="",a=n+1;a<e.length;){var c=e.charCodeAt(a);if(!(c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||95===c))break;s+=e[a++]}if(!s)throw new TypeError("Missing parameter name at ".concat(n));t.push({type:"NAME",index:n,value:s}),n=a}else t.push({type:"CLOSE",index:n,value:e[n++]});else t.push({type:"OPEN",index:n,value:e[n++]});else t.push({type:"ESCAPED_CHAR",index:n++,value:e[n++]});else t.push({type:"MODIFIER",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),t}(e),r=t.prefixes,o=void 0===r?"./":r,i=t.delimiter,s=void 0===i?"/#?":i,a=[],c=0,l=0,u="",d=function(e){if(l<n.length&&n[l].type===e)return n[l++].value},p=function(e){var t=d(e);if(void 0!==t)return t;var r=n[l],o=r.type,i=r.index;throw new TypeError("Unexpected ".concat(o," at ").concat(i,", expected ").concat(e))},f=function(){for(var e,t="";e=d("CHAR")||d("ESCAPED_CHAR");)t+=e;return t},h=function(e){var t=a[a.length-1],n=e||(t&&"string"==typeof t?t:"");if(t&&!n)throw new TypeError('Must have text between two parameters, missing text after "'.concat(t.name,'"'));return!n||function(e){for(var t=0,n=s;t<n.length;t++){var r=n[t];if(e.indexOf(r)>-1)return!0}return!1}(n)?"[^".concat(Tt(s),"]+?"):"(?:(?!".concat(Tt(n),")[^").concat(Tt(s),"])+?")};l<n.length;){var m=d("CHAR"),g=d("NAME"),v=d("PATTERN");if(g||v){var w=m||"";-1===o.indexOf(w)&&(u+=w,w=""),u&&(a.push(u),u=""),a.push({name:g||c++,prefix:w,suffix:"",pattern:v||h(w),modifier:d("MODIFIER")||""})}else{var y=m||d("ESCAPED_CHAR");if(y)u+=y;else if(u&&(a.push(u),u=""),d("OPEN")){w=f();var E=d("NAME")||"",b=d("PATTERN")||"",S=f();p("CLOSE"),a.push({name:E||(b?c++:""),pattern:E&&!b?h(w):b,prefix:w,suffix:S,modifier:d("MODIFIER")||""})}else p("END")}}return a}(e,n),t,n)}function Mt(e,t,n){return e instanceof RegExp?function(e,t){if(!t)return e;for(var n=/\((?:\?<(.*?)>)?(?!\?)/g,r=0,o=n.exec(e.source);o;)t.push({name:o[1]||r++,prefix:"",suffix:"",modifier:"",pattern:""}),o=n.exec(e.source);return e}(e,t):Array.isArray(e)?function(e,t,n){var r=e.map((function(e){return Mt(e,t,n).source}));return new RegExp("(?:".concat(r.join("|"),")"),_t(n))}(e,t,n):Pt(e,t,n)}const xt=new Map,Lt=1e4;let $t=0;function Bt(e,t){const{path:n,exact:r=!1,strict:o=!1,sensitive:i=!0}=t;return(Array.isArray(n)?n:[n]).reduce(((t,n)=>{if(t)return t;const{regexp:s,keys:a}=function(e,t){const n=`${t.end}${t.strict}${t.sensitive}`;let r=xt.get(n);r||xt.set(n,r=new Map);const o=r.get(e);if(o)return o;const i=[],s={regexp:Mt(e,i,t),keys:i};return $t<Lt&&(r.set(e,s),$t++),s}(n,{end:r,strict:o,sensitive:i}),c=s.exec(e);if(!c)return null;const[l,...u]=c,d=e===l;return r&&!d?null:{path:n,url:"/"===n&&""===l?"/":l,isExact:d,params:a.reduce(((e,t,n)=>(e[t.name]=u[n],e)),{})}}),null)}function Nt(e,t,n){return Bt(n,{path:e.path.replace(/^\$\{APP.homepage\}/,t),exact:e.exact})}const Ut=Symbol.for("tpl.asyncComputedPropsFromHost"),Ft=Symbol.for("tpl.stateStoreId"),Dt=Symbol.for("tpl.externalForEachItem"),jt=Symbol.for("tpl.externalForEachIndex"),Kt=Symbol.for("tpl.externalForEachSize"),Vt=new Set;let Wt=function(e){return e.REQUEST_FAILED="REQUEST_FAILED",e.SOMETHING_WENT_WRONG="SOMETHING_WENT_WRONG",e.LOGIN_TIMEOUT_MESSAGE="LOGIN_TIMEOUT_MESSAGE",e.NETWORK_ERROR="NETWORK_ERROR",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.NO_PERMISSION="NO_PERMISSION",e.PAGE_NOT_FOUND="PAGE_NOT_FOUND",e.APP_NOT_FOUND="APP_NOT_FOUND",e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.GO_BACK_TO_PREVIOUS_PAGE="GO_BACK_TO_PREVIOUS_PAGE",e.GO_BACK_HOME="GO_BACK_HOME",e.RELOAD="RELOAD",e}({});const Ht={[Wt.REQUEST_FAILED]:"Request Failed",[Wt.SOMETHING_WENT_WRONG]:"Something went wrong!",[Wt.LOGIN_TIMEOUT_MESSAGE]:"You haven't logged in or your login session has expired. Login right now?",[Wt.NETWORK_ERROR]:"Network error, please check your network.",[Wt.LICENSE_EXPIRED]:"The license authorization has expired, please contact the platform administrator",[Wt.NO_PERMISSION]:"Unauthorized access, unable to retrieve the required resources for this page",[Wt.PAGE_NOT_FOUND]:"Page not found, please check the URL",[Wt.APP_NOT_FOUND]:"App not found, maybe the URL is wrong or you don't have permission to access",[Wt.UNKNOWN_ERROR]:"Oops! Something went wrong",[Wt.GO_BACK_TO_PREVIOUS_PAGE]:"Go back to previous page",[Wt.GO_BACK_HOME]:"Go back to home page",[Wt.RELOAD]:"Reload"},Gt={[Wt.REQUEST_FAILED]:"请求失败",[Wt.SOMETHING_WENT_WRONG]:"出现了一些问题!",[Wt.LOGIN_TIMEOUT_MESSAGE]:"您还未登录或登录信息已过期,现在重新登录?",[Wt.NETWORK_ERROR]:"网络错误,请检查您的网络连接。",[Wt.LICENSE_EXPIRED]:"License 授权失效,请联系平台管理员",[Wt.NO_PERMISSION]:"没有权限,无法获取页面所需要的资源",[Wt.PAGE_NOT_FOUND]:"请求的页面未找到,请确认 URL 是否正确",[Wt.APP_NOT_FOUND]:"请求的微应用无法找到, 可能是 URL 错误或者无权限访问",[Wt.UNKNOWN_ERROR]:"糟糕!页面出现了一些问题",[Wt.GO_BACK_TO_PREVIOUS_PAGE]:"回到上一页",[Wt.GO_BACK_HOME]:"回到首页",[Wt.RELOAD]:"刷新"},zt="core/runtime",qt={en:Ht,zh:Gt};let Yt;const Xt=Object.freeze({show:function(e){if(Yt)return Yt.resolve(e);if("confirm"===e.type){const t=confirm(e.content);return new Promise(((e,n)=>setTimeout((()=>{(t?e:n)()}),1)))}return alert(e.content),new Promise((e=>setTimeout((()=>{e()}),1)))}});function Jt(e){const{search:t,pathname:n}=e,r=n?window.btoa(encodeURIComponent(n)):"",o=t?window.btoa(encodeURIComponent(t)):"";document.cookie=`SALOGINPATH=${r}; path=/`,document.cookie=`SALOGINQUERY=${o}; path=/`}function Qt(e){if(e instanceof Event&&e.target instanceof HTMLScriptElement)return e.target.src;if(e instanceof R.HttpFetchError)return c.i18n.t(`${zt}:${Wt.NETWORK_ERROR}`);if(e instanceof R.HttpResponseError&&e.responseJson){if("string"==typeof e.responseJson.error)return e.responseJson.error;if("string"==typeof e.responseJson.msg)return e.responseJson.msg}return null==e?"Unknown error":e.toString()}function Zt(e){return e instanceof R.HttpResponseError&&401===e.response.status&&!!e.responseJson&&100003===e.responseJson.code}let en,tn,nn=!1;function rn(e){if(e instanceof R.HttpAbortError)return;if(Zt(e)&&!window.NO_AUTH_GUARD){if(nn)return;return nn=!0,void Xt.show({type:"confirm",content:c.i18n.t(`${zt}:${Wt.LOGIN_TIMEOUT_MESSAGE}`)}).then((()=>{!function(){const e=di().getFeatureFlags()["sso-enabled"],t=k();Jt(t.location),t.push(e?"/sso-auth/login":"/auth/login",{from:{...t.location,state:void 0}})}(),nn=!1}),(()=>{nn=!1}))}console.error(e);const t=Qt(e);t!==en&&(en=t,Xt.show({type:"error",title:c.i18n.t(`${zt}:${Wt.REQUEST_FAILED}`),content:t,contentStyle:{whiteSpace:"pre-wrap",wordBreak:"break-word"}}).then((()=>{en=void 0})))}const on=Object.freeze({show:function(e){tn?tn.resolve(e):alert(e.message)}});function sn(e,t,n){t&&Object.entries(t).forEach((t=>{let[r,o]=t;const i=dn(o,n,{element:e});e.addEventListener(r,i),e.$$listeners||(e.$$listeners=[]),e.$$listeners.push([r,i]),e.$$eventListeners||(e.$$eventListeners=[]);for(const t of[].concat(o))e.$$eventListeners.push([r,null,t])}))}function an(e){return"string"==typeof e.action}function cn(e){return"string"==typeof e.useProvider}function ln(e){return!(!e.target&&!e.targetRef||!e.method&&!e.properties)}function un(e){return!!e.then}function dn(e,t,n){return function(r){for(const o of[].concat(e))if(Et(o,{...t,event:r}))if(un(o))dn(o.then,t,n)(r);else if(an(o)){const[e,i]=o.action.split(".");switch(o.action){case"history.push":case"history.replace":case"history.pushQuery":case"history.replaceQuery":case"history.pushAnchor":case"history.block":case"history.goBack":case"history.goForward":case"history.reload":case"history.unblock":mn(r,i,o.args,o.callback,t);break;case"window.open":gn(r,o.args,t);break;case"window.postMessage":vn(r,o.args,t);break;case"parent.postMessage":wn(r,o.args,t);break;case"location.reload":case"location.assign":An(r,i,o.args,t);break;case"localStorage.setItem":case"localStorage.removeItem":case"sessionStorage.setItem":case"sessionStorage.removeItem":kn(r,e,i,o.args,t);break;case"event.preventDefault":r.preventDefault();break;case"event.stopPropagation":r.stopPropagation();break;case"console.log":case"console.error":case"console.warn":case"console.info":In(r,i,o.args,t);break;case"message.success":case"message.error":case"message.info":case"message.warn":Cn(r,i,o.args,t);break;case"handleHttpError":rn(r.detail);break;case"context.assign":case"context.replace":case"context.refresh":case"context.load":En(r,i,o.args,o.batch??!0,o.callback,t);break;case"state.update":case"state.refresh":case"state.load":bn(r,i,o.args,o.batch??!0,o.callback,t);break;case"tpl.dispatchEvent":{const[e,n]=Tn(o.args,t,r);xe(t,o.action,`: ${e}`).dispatchEvent(new CustomEvent(e,n));break}case"formstate.update":Sn(r,o.args,o.callback,t);break;case"message.subscribe":case"message.unsubscribe":Rn(r,i,o.args,t,n,o.callback);break;case"theme.setDarkTheme":case"theme.setLightTheme":te("theme.setDarkTheme"===o.action?"dark":"light");break;case"theme.setTheme":{const[e]=Tn(o.args,t,r);te(e);break}case"mode.setDashboardMode":case"mode.setDefaultMode":ae("mode.setDashboardMode"===o.action?"dashboard":"default");break;default:console.error("unknown event listener action:",o.action)}}else cn(o)?pn(r,o,t,n):ln(o)?fn(r,o,t,n):console.error("unknown event handler:",o);else o.else&&dn(o.else,t,n)(r)}}function pn(e,t,n,r){const o="saveAs"!==t.method?"resolve":"saveAs";hn(e,t.useProvider,t,o,n,r)}function fn(e,t,n,r){let o=[];const i=t.target,s=t.targetRef;let a=i;if(("string"==typeof i?(0,O.isEvaluable)(i):it(i))&&(a=gt(i,{...n,event:e})),"string"==typeof a)if("_self"===a)o.push(r.element);else if(t.multiple)o=Array.from(document.querySelectorAll(a));else{const e=document.querySelector(a);null!==e&&o.push(e)}else if(a)a instanceof HTMLElement?o.push(a):console.error("unexpected target:",a);else if(s){let t=s;("string"==typeof s?(0,O.isEvaluable)(s):it(s))&&(t=gt(s,{...n,event:e}));const r=[].concat(t),i=xe(n,"targetRef",`: ${r.join(", ")}`);o.push(...r.map((e=>{var t;return null===(t=i.$$getElementByRef)||void 0===t?void 0:t.call(i,e)})).filter(Boolean))}0!==o.length?function(e){return!!e.method}(t)?o.forEach((o=>{hn(e,o,t,t.method,n,r,{useEventAsDefault:!0})})):function(e){return!!e.properties}(t)&&Rt(o,t.properties,{...n,event:e}):console.error("target not found:",i||s)}async function hn(e,t,n,r,o,i,s){const a=cn(n),c=async()=>{var i;const c=a?await Xe(t):t;if("function"!=typeof c[r])throw new Error(`target <${c.tagName.toLowerCase()}> has no method: ${r}`);let l=Tn(n.args,o,e,s);var u;return cn(n)&&null!=li&&null!==(i=li.flowApi)&&void 0!==i&&i.isFlowApiProvider(n.useProvider)&&(l=await li.flowApi.getArgsOfFlowApi(n.useProvider,l,r,null===(u=n.sse)||void 0===u?void 0:u.stream)),c[r](...l)};if(!n.callback)return void c();const l=On(n.callback,o,i),u={progress:l("progress"),success:l("success"),error:l("error"),finally:l("finally")};if(a){var d,p;const t={...o,event:e};if(gt(null===(d=n.sse)||void 0===d?void 0:d.stream,t))return void async function(e,t){let{progress:n,success:r,error:o,finally:i}=t;const s=vi();try{const t=await e();for await(const e of t){if(s!==vi())return;null==n||n(e)}if(s!==vi())return;null==r||r()}catch(e){if(s!==vi())return;null==o||o(e)}finally{null==i||i()}}(c,u);if(gt(null===(p=n.poll)||void 0===p?void 0:p.enabled,t))return void function(e,t,n,r){let{progress:o,success:i,error:s,finally:a}=t;const{expectPollStopImmediately:c,expectPollEnd:l}=n,{interval:u,leadingRequestDelay:d,continueOnError:p,delegateLoadingBar:f}=gt((0,h.pick)(n,["interval","leadingRequestDelay","continueOnError","delegateLoadingBar"]),r),m=vi();let g;async function v(){let t;Vt.delete(g);try{var n;if(t=null===(n=gt(c,r))||void 0===n?void 0:n(),t)null==a||a();else{var d;const n=await e(),s=null===(d=gt(c,r))||void 0===d?void 0:d();var h;t=s||m!==vi(),t?s&&(null==a||a()):(null==o||o(n),null!==(h=gt(l,r))&&void 0!==h&&h(n)?(f&&window.dispatchEvent(new Event("request.end")),null==i||i(n),null==a||a()):w(u??3e3))}}catch(e){var v;const n=null===(v=gt(c,r))||void 0===v?void 0:v();t=n||m!==vi(),t?n&&(null==a||a()):(null==s||s(e),p?w(u??3e3):null==a||a())}finally{f&&t&&window.dispatchEvent(new Event("request.end"))}}function w(e){g=setTimeout(v,e),Vt.add(g)}w(d??0),f&&window.dispatchEvent(new Event("request.start"))}(c,u,n.poll,t)}try{const e=await c();u.success(e)}catch(e){u.error(e)}finally{u.finally()}}function mn(e,t,n,r,o){let i=0,s=!1,a=t;switch(t){case"push":case"replace":case"pushQuery":case"replaceQuery":case"pushAnchor":i=2,s=!0;break;case"reload":s=!0;break;case"block":i=1,a="setBlockMessage"}let c=[];if(i>0&&(c=Tn(n,o,e,{useEventDetailAsDefault:!0}),c.length=i),s&&r){const e=On(r,o,void 0);c.push((t=>{e(t?"error":"success")({blocked:t}),e("finally")({blocked:t})}))}k()[a](...c)}function gn(e,t,n){const[r,o,i]=Tn(t,n,e);window.open(r,o||"_self",i)}function vn(e,t,n){const r=Tn(t,n,e);1===r.length&&r.push(location.origin),window.postMessage(...r)}function wn(e,t,n){if(parent===window)throw new Error("parent is the window itself");const r=Tn(t,n,e);parent.postMessage(...r)}function yn(e,t,n,r,o,i){t?r.updateValues(e,n,(e=>Tn(e,o,i)[0])):e.forEach((e=>{const{name:t,value:s}=Tn([e],o,i)[0];r.updateValue(t,s,n)}))}function En(e,t,n,r,o,i){if(!Array.isArray(n)||!n.every(u.isObject)||"assign"!==t&&"replace"!==t){const[r,s]=Tn(n,i,e);i.ctxStore.updateValue(r,s,t,o,i)}else yn(n,r,t,i.ctxStore,i,e)}function bn(e,t,n,r,o,i){if(Array.isArray(n)&&n.every(u.isObject)&&"update"===t)yn(n,r,"replace",Me(i,`state.${t}`,`: ${JSON.stringify(n)}`),i,e);else{const[r,s]=Tn(n,i,e);Me(i,`state.${t}`,`: ${r}`).updateValue(r,s,"update"===t?"replace":t,o,i)}}function Sn(e,t,n,r){const[o,i]=Tn(t,r,e);qe(r,"formstate.update",`: ${o}`).updateValue(o,i,"replace",n,r)}function An(e,t,n,r){if("assign"===t){const[t]=Tn(n,r,e);location.assign(t)}else location[t]()}function kn(e,t,n,r,o){const i="localStorage"===t?localStorage:sessionStorage,[s,a]=Tn(r,o,e);"setItem"===n?void 0!==a&&i.setItem(s,JSON.stringify(a)):i.removeItem(s)}function In(e,t,n,r){console[t](...Tn(n,r,e,{useEventAsDefault:!0}))}function Cn(e,t,n,r){const o=Tn(n,r,e,{useEventAsDefault:!0});on.show({type:t,message:o[0]})}async function Rn(e,t,n,r,o,i){const s=()=>{var o;const i=Tn(n,r,e);return null==li||null===(o=li.messageDispatcher)||void 0===o?void 0:o[t](...i)};if(!i)return void s();const a=On(i,r,o);try{const e=await s();a("success")(e)}catch(e){a("error")(e)}finally{a("finally")()}}function On(e,t,n){return function(r){return function(o){const i=null==e?void 0:e[r];if(i)try{const e=new CustomEvent(`callback.${r}`,{detail:o});dn(i,t,n)(e)}catch(e){console.error(e)}else"error"===r&&console.error("Unhandled callback error:",o)}}}function Tn(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return Array.isArray(e)?gt(e,{...t,event:n}):r.useEventAsDefault?[n]:r.useEventDetailAsDefault?[n.detail]:[]}function _n(e){var t;const{ref:n,runtimeContext:r,element:o}=e;if(!n||!r.tplStateStoreId)return;const{hostBrick:i}=Me(r,"bindTemplateProxy"),s=i.tplHostMetadata;s.internalBricksByRef.set(n,e);const a=null===(t=s.proxy)||void 0===t?void 0:t.events;if(a)for(const[e,t]of Object.entries(a))if(t.ref===n){var c;const n=t=>{t.bubbles&&t.stopPropagation(),i.element.dispatchEvent(new CustomEvent(e,{detail:t.detail,bubbles:t.bubbles,cancelable:t.cancelable,composed:t.composed}))},r=t.refEvent??e;o.addEventListener(r,n),(c=o).$$proxyListeners??(c.$$proxyListeners=[]),o.$$proxyListeners.push([r,n])}}function Pn(e){const{ref:t,runtimeContext:n,element:r}=e;if(null==n||!n.tplStateStoreId||!t)return;const{hostBrick:o}=Me(n,"unbindTemplateProxy");o.tplHostMetadata.internalBricksByRef.delete(t);for(const[e,t]of r.$$proxyListeners??[])r.removeEventListener(e,t);delete r.$$proxyListeners}let Mn=function(e){return e[e.ROOT=1]="ROOT",e[e.BRICK=2]="BRICK",e[e.PLACEHOLDER=3]="PLACEHOLDER",e}({});function xn(e){e.replaceChildren()}function Ln(e,t){window.DISABLE_REACT_FLUSH_SYNC=!1;let n=e.child;const r=[];for(;n;){if(n.tag===Mn.BRICK){var o;const i=n.type;i.includes("-")&&!customElements.get(i)&&console.error(`Undefined custom element: ${i}`),"basic-bricks.script-brick"===i&&console.warn("`basic-bricks.script-brick` is deprecated, please take caution when using it");const s=t&&n===e.child?t:document.createElement(i);n.element=s,n.slotId&&s.setAttribute("slot",n.slotId),n.iid&&(s.dataset.iid=n.iid),null!==(o=n.tplHostMetadata)&&void 0!==o&&o.tplStateStoreId&&(s.dataset.tplStateStoreId=n.tplHostMetadata.tplStateStoreId),Ct(s,n.properties),sn(s,n.events,n.runtimeContext),n.tplHostMetadata&&(s.$$tplStateStore=Me({tplStateStoreId:n.tplHostMetadata.tplStateStoreId,tplStateStoreMap:n.runtimeContext.tplStateStoreMap},"mount")),_n(n),n.portal?r.push(s):n.return&&(n.return.childElements||(n.return.childElements=[]),n.return.childElements.push(s))}if(n.child)n=n.child;else if(n.sibling)n=n.sibling;else{var i;let e=n.return;for(;e;){var s;if(e.childElements)e.tag===Mn.ROOT?null===(s=e.container)||void 0===s||s.append(...e.childElements):e.element.append(...e.childElements),e.childElements=void 0;if(e.tag===Mn.ROOT&&r.length>0&&("function"==typeof e.createPortal?e.createPortal():e.createPortal).append(...r),e.sibling)break;e=e.return}n=null===(i=e)||void 0===i?void 0:i.sibling}}setTimeout((()=>{window.DISABLE_REACT_FLUSH_SYNC=!0}))}const $n=["onMount","onUnmount","onMediaChange","onScrollIntoView","onMessage","onMessageClose"],Bn=["onBeforePageLoad","onPageLoad","onPageLeave","onBeforePageLeave","onAnchorLoad","onAnchorUnload"];var Nn=new WeakMap,Un=new WeakMap,Fn=new WeakMap,Dn=new WeakMap,jn=new WeakMap,Kn=new WeakMap,Vn=new WeakMap,Wn=new WeakMap,Hn=new WeakMap,Gn=new WeakSet;class zn{constructor(e,t){(0,I.A)(this,Gn),(0,o.A)(this,"scope",void 0),(0,o.A)(this,"unknownBricks",void 0),(0,o.A)(this,"renderId",void 0),(0,i.A)(this,Nn,void 0),(0,i.A)(this,Un,{onBeforePageLoad:[],onPageLoad:[],onPageLeave:[],onBeforePageLeave:[],onAnchorLoad:[],onAnchorUnload:[],onMediaChange:[],onScrollIntoView:[],onMount:[],onUnmount:[],onMessage:[],onMessageClose:[]}),(0,i.A)(this,Fn,new Map),(0,i.A)(this,Dn,void 0),(0,i.A)(this,jn,new Map),(0,i.A)(this,Kn,void 0),(0,i.A)(this,Vn,void 0),(0,i.A)(this,Wn,new WeakMap),(0,i.A)(this,Hn,new Map),this.scope=e,this.unknownBricks=(null==t?void 0:t.unknownBricks)??"throw",(0,s.A)(Nn,this,null==t?void 0:t.routeHelper),this.renderId=null==t?void 0:t.renderId}setInitialMenuRequestNode(e){(0,s.A)(Vn,this,e)}memoizeMenuRequestNode(e,t){(0,a.A)(Wn,this).set(e,t)}getMenuRequests(){const e=[];let t=(0,a.A)(Vn,this);for(;t;)if(t.request&&e.push(t.request),t.child)t=t.child;else{for(var n;t&&!t.sibling;)t=t.return;t=null===(n=t)||void 0===n?void 0:n.sibling}return e}async reMergeMenuRequestNodes(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=(0,a.A)(Wn,this).get(t);(0,a.A)(Wn,this).set(t,n);let o,i=e.child;for(;i&&i!==r;)o=i,i=i.sibling;o?(o.sibling=n,n.sibling=null==r?void 0:r.sibling):e.child=n,await(0,a.A)(Nn,this).mergeMenus(this.getMenuRequests())}reBailout(e){return(0,a.A)(Nn,this).bailout(e)}reCatch(e,t){return(0,a.A)(Nn,this).catch(e,t,!1,!0)}async didPerformIncrementalRender(e,t){let n=!1;const r=[];for(const{parentRoutes:o,callback:i}of[...(0,a.A)(Hn,this).values()].reverse()){const s=o[o.length-1];if(r.includes(s))continue;const a=await i(e,t);a&&r.push(...o.slice(0,-1)),!1!==a&&(n=!0)}return n}performIncrementalRender(e,t,n){(0,a.A)(Hn,this).set(e,{parentRoutes:t,callback:n})}registerBrickLifeCycle(e,t){if(!t)return;const n=[...$n,..."page"===this.scope?Bn:[]];for(const r of n){const n=t[r];n&&(0,a.A)(Un,this)[r].push({brick:e,handlers:n})}(0,h.isEmpty)(t.useResolves)||console.error("`lifeCycle.useResolves` is dropped in v3:",t)}registerArbitraryLifeCycle(e,t){const n=(0,a.A)(jn,this).get(e);n?n.add(t):(0,a.A)(jn,this).set(e,new Set([t]))}memoize(e,t,n,r){(0,a.A)(Kn,this)||(0,s.A)(Kn,this,new WeakMap);const o=[e??"",...t].join(".");let i=(0,a.A)(Kn,this).get(r);i||(i=new Map,(0,a.A)(Kn,this).set(r,i)),i.set(o,{node:n,last:Qn(n),lastNormal:Zn(n),lastPortal:tr(n)})}reRender(e,t,n,r){const o=[e??"",...t].join("."),i=(0,a.A)(Kn,this).get(r).get(o),{node:s,last:c,lastNormal:l,lastPortal:u}=i;let d;const p=[];if((null==s?void 0:s.tag)===Mn.PLACEHOLDER){var f,h;d=(null===(f=function(e){return er(e,!0)}(s))||void 0===f?void 0:f.element)??null;const e=null===(h=function(e){return nr(e,!0)}(s))||void 0===h?void 0:h.element;e&&p.push(e)}else{var m,g;d=(null==l||null===(m=l.element)||void 0===m?void 0:m.nextSibling)??null;let e=null==u||null===(g=u.element)||void 0===g?void 0:g.nextSibling;for(;e&&(p.push(e),e instanceof HTMLElement&&"DIV"===e.tagName);)e=e.nextSibling}const v=Qn(n);let w;i.node=n,i.last=v,i.lastNormal=Zn(n),i.lastPortal=tr(n);let y=r.child;for(;y&&y!==c;){if(y.sibling===s){w=y;break}y=y.sibling}const E=document.createDocumentFragment(),b=document.createDocumentFragment(),S={tag:Mn.ROOT,container:E,createPortal:b,child:n};for(y=n;y;)y.return=S,y=y.sibling;const A=rr(s,c);for((0,C.A)(Gn,this,qn).call(this,A),Ln(S),w?w.sibling=n:r.child=n,v&&(v.sibling=null==c?void 0:c.sibling),y=n;y;)y.return=r,y=y.sibling;var k,I;if(E.hasChildNodes()&&(r.tag===Mn.ROOT?null===(k=r.container)||void 0===k||k.insertBefore(E,d):null===(I=r.element)||void 0===I||I.insertBefore(E,d)),b.hasChildNodes()){var R;let e=n;for(;e&&e.return;)e=e.return;if((null===(R=e)||void 0===R?void 0:R.tag)!==Mn.ROOT)throw new Error("Cannot find render root node. This is a bug of Brick Next, please report it.");const t="function"==typeof e.createPortal?e.createPortal():e.createPortal;let r=null;for(const e of p)if(t.contains(e)){r=e;break}t.insertBefore(b,r)}const O=rr(n,v);(0,C.A)(Gn,this,Yn).call(this,O)}dispose(){for(const e of Object.values((0,a.A)(Un,this)))e.length=0;for(const e of(0,a.A)(Fn,this).values()){for(const t of e)t.disconnect();e.length=0}(0,a.A)(Fn,this).clear(),(0,a.A)(Dn,this)&&(be.removeEventListener("change",(0,a.A)(Dn,this)),(0,s.A)(Dn,this,void 0)),(0,s.A)(Kn,this,void 0),(0,a.A)(jn,this).clear(),(0,a.A)(Hn,this).clear(),(0,s.A)(Wn,this,void 0)}dispatchBeforePageLoad(){(0,C.A)(Gn,this,Xn).call(this,"onBeforePageLoad",new CustomEvent("page.beforeLoad"))}dispatchPageLoad(){const e=new CustomEvent("page.load");(0,C.A)(Gn,this,Xn).call(this,"onPageLoad",e),window.dispatchEvent(e)}dispatchBeforePageLeave(e){(0,C.A)(Gn,this,Xn).call(this,"onBeforePageLeave",new CustomEvent("page.beforeLeave",{detail:e}))}dispatchPageLeave(){(0,C.A)(Gn,this,Xn).call(this,"onPageLeave",new CustomEvent("page.leave"))}dispatchAnchorLoad(){const{hash:e}=k().location;e&&"#"!==e?(0,C.A)(Gn,this,Xn).call(this,"onAnchorLoad",new CustomEvent("anchor.load",{detail:{hash:e,anchor:e.substring(1)}})):(0,C.A)(Gn,this,Xn).call(this,"onAnchorUnload",new CustomEvent("anchor.unload"))}initializeScrollIntoView(){for(const{brick:e,handlers:t}of(0,a.A)(Un,this).onScrollIntoView)(0,C.A)(Gn,this,Jn).call(this,e,t)}initializeMediaChange(){(0,s.A)(Dn,this,(e=>{(0,C.A)(Gn,this,Xn).call(this,"onMediaChange",new CustomEvent("media.change",{detail:z(e.detail)}))})),be.addEventListener("change",(0,a.A)(Dn,this))}initializeMessageDispatcher(){var e;for(const{brick:e,handlers:n}of(0,a.A)(Un,this).onMessage)for(const r of[].concat(n)){var t;null==li||null===(t=li.messageDispatcher)||void 0===t||t.onMessage(r.channel,(t=>{dn(r.handlers,e.runtimeContext,e)(new CustomEvent("message.push",{detail:t}))}))}null==li||null===(e=li.messageDispatcher)||void 0===e||e.onClose((()=>{(0,C.A)(Gn,this,Xn).call(this,"onMessageClose",new CustomEvent("message.close"))}))}dispatchOnMount(){(0,C.A)(Gn,this,Xn).call(this,"onMount",new CustomEvent("mount"))}dispatchOnUnmount(){(0,C.A)(Gn,this,Xn).call(this,"onUnmount",new CustomEvent("unmount"))}}function qn(e){const t=[...$n,..."page"===this.scope?Bn:[]],n=[];for(const r of t){const t=(0,h.remove)((0,a.A)(Un,this)[r],(t=>e.has(t.brick)));"onUnmount"===r&&n.push(...t)}for(const t of e){var r,o,i;const e=(0,a.A)(Fn,this).get(t);if(null!=e&&e.length){for(const t of e)t.disconnect();e.length=0,(0,a.A)(Fn,this).delete(t)}Pn(t),null===(r=t.element)||void 0===r||delete r.$$tplStateStore,null===(o=t.element)||void 0===o||o.remove(),null===(i=t.disposes)||void 0===i||i.forEach((e=>e())),delete t.disposes}const s=new CustomEvent("unmount");for(const{brick:e,handlers:t}of n)dn(t,e.runtimeContext,e)(s)}function Yn(e){const t=new CustomEvent("mount");for(const{brick:n,handlers:r}of(0,a.A)(Un,this).onMount)e.has(n)&&dn(r,n.runtimeContext,n)(t);for(const{brick:t,handlers:n}of(0,a.A)(Un,this).onScrollIntoView)e.has(t)&&(0,C.A)(Gn,this,Jn).call(this,t,n)}function Xn(e,t){for(const{brick:n,handlers:r}of(0,a.A)(Un,this)[e])dn(r,n.runtimeContext,n)(t);const n=(0,a.A)(jn,this).get(e);if(n)for(const e of n)e()}function Jn(e,t){const n=t.threshold??.1,r=new IntersectionObserver(((r,o)=>{r.forEach((r=>{r.isIntersecting&&r.intersectionRatio>=n&&(dn(t.handlers,e.runtimeContext,e)(new CustomEvent("scroll.into.view")),o.disconnect())}))}),{threshold:n});r.observe(e.element);let o=(0,a.A)(Fn,this).get(e);o||(o=[],(0,a.A)(Fn,this).set(e,o)),o.push(r)}function Qn(e){let t=e;for(;null!==(n=t)&&void 0!==n&&n.sibling;){var n;t=t.sibling}return t}function Zn(e){return er(e,!1)}function er(e,t){let n,r=e;for(;r;){if(r.tag===Mn.BRICK&&!r.portal){if(t)return r;n=r}r=r.sibling}return n}function tr(e){return nr(e,!1)}function nr(e,t){let n,r=e;for(;r;){if(r.tag===Mn.BRICK&&r.portal){if(t)return r;n=r}if(r.child)r=r.child;else if(r.sibling)r=r.sibling;else{var o;let e=r.return;for(;e&&!e.sibling;)e=e.return;r=null===(o=e)||void 0===o?void 0:o.sibling}}return n}function rr(e,t){const n=new Set;let r=e;for(;r;)if(r.tag===Mn.BRICK&&n.add(r),r.child)r=r.child;else{if(r===t)break;if(r.sibling)r=r.sibling;else{var o;let e=r.return;for(;e&&e!==t&&!e.sibling;)e=e.return;if(e===t)break;r=null===(o=e)||void 0===o?void 0:o.sibling}}return n}const or=new Map;function ir(e){return or.get(e)}const sr=Symbol.for("root.runtimeContext");async function ar(e,t,n){var r,o;const[i,s,a]=ro({...e[sr]??wi(),data:t,pendingPermissionsPreCheck:[]});i.tplStateStoreMap??(i.tplStateStoreMap=new Map),i.formStateStoreMap??(i.formStateStoreMap=new Map);const c=new zn("fragment"),l={tag:Mn.ROOT,createPortal:null},u=e.transform,d=Re();u&&Oe(d,"`useBrick.transform`",'please use "properties" instead, check your useBrick:',e);const p=await eo(l,d&&!n?e:{errorBoundary:n,...e,properties:{...e.properties,...u}},i,c,[],{}),f=[...s,...a];if(await no(p,i,f),(null===(r=p.node)||void 0===r?void 0:r.tag)===Mn.PLACEHOLDER)throw new Error("The root brick of useBrick cannot be an ignored control node");if(null!==(o=p.node)&&void 0!==o&&o.portal)throw new Error("The root brick of useBrick cannot be a portal brick");return l.child=p.node,{tagName:p.node?p.node.type:null,renderRoot:l,rendererContext:c,scopedStores:f}}function cr(e,t){let n,{renderRoot:r,rendererContext:o,scopedStores:i}=e;r.createPortal=()=>{const e=document.querySelector("#portal-mount-point");return n=document.createElement("div"),e.appendChild(n),n},Ln(r,t),o.dispatchOnMount(),o.initializeScrollIntoView(),o.initializeMediaChange(),o.initializeMessageDispatcher();for(const e of i)e.mountAsyncData();return{portal:n}}function lr(e,t){let{rendererContext:n}=e;t.portal&&(xn(t.portal),t.portal.remove()),n.dispatchOnUnmount(),n.dispose()}function ur(e,t,n){if(n)throw new Error("Legacy doTransform does not support options in v3");return gt(t,{...wi(),data:e},{noInject:!0})}function dr(e,t){const n=yi(e);Object.assign(n,{...t,meta:{...n.meta,...t.meta},$$fulfilling:null,$$fulfilled:!0,$$registerCustomTemplateProcessed:!1}),L(n)}function pr(e,t){const n=yi(e);let r=!1;function o(e){e.forEach(((n,s)=>{"routes"===n.type?o(n.routes):function(e){return e.path===t.path&&!e.exact==!t.exact}(n)?(r=!0,e[s]=t):Array.isArray(n.bricks)&&i(n.bricks)}))}function i(e){e.forEach((e=>{if(e.slots)for(const t of Object.values(e.slots))"routes"===t.type?o(t.routes):i(t.bricks)}))}o(n.routes),r||n.routes.unshift(t)}function fr(e,t,n){const r=`${e}.${t.name}`;Pe.define(r,{bricks:t.bricks,proxy:t.proxy,state:t.state}),hr(e,t.name,n)}function hr(e,t,n){wr(e,`\${APP.homepage}/_dev_only_/template-preview/${t}`,[{brick:t,...(0,h.pick)(n,"properties","events","lifeCycle","context","slots","children")}])}function mr(e){return`\${APP.homepage}/_dev_only_/snippet-preview/${e}`}function gr(e,t){var n;wr(e,mr(t.snippetId),null!==(n=t.bricks)&&void 0!==n&&n.length?t.bricks:[{brick:"span"}],t.context)}const vr=gr;function wr(e,t,n,r){const{routes:o}=yi(e),i=o.findIndex((e=>e.path===t)),s={path:t,bricks:n,context:r,menu:!1,exact:!0};-1===i?o.unshift(s):o.splice(i,1,s)}function yr(e,t){let{tplStateStoreId:n}=t;const r=wi();return n?Me({...r,tplStateStoreId:n},"STATE").getValue(e):r.ctxStore.getValue(e)}function Er(e){let{tplStateStoreId:t}=e;const n=wi();return t?Me({...n,tplStateStoreId:t},"STATE").getAllValues():n.ctxStore.getAllValues()}function br(e){return mi().find((t=>t.id?t.id===e:t.filePath.startsWith(`${e}/`)))}function Sr(e){return(0,l.loadBricksImperatively)(e,mi())}function Ar(e,t){return(0,l.loadEditorsImperatively)(e,t??mi())}function kr(){return vi()}async function Ir(e,t){let{appId:n,updateStoryboardType:r,collectUsedContracts:o}=t;const i=yi(n);let s;if("route"===r)s={routes:[e]};else if("template"===r)s={meta:{customTemplates:[e]}};else if("snippet"===r){var a;const t=mr(e.snippetId);s={routes:[null==i||null===(a=i.routes)||void 0===a?void 0:a.find((e=>e.path===t))]}}const c=[];return s&&o&&(await o(s)).forEach((e=>{var t;const[n,r,o]=e.match(/(.*)@(.*):\d\.\d\.\d/);null!=i&&null!==(t=i.meta)&&void 0!==t&&null!==(t=t.contracts)&&void 0!==t&&t.some((e=>e.namespaceId===r&&e.name===o))||c.push(e)})),c}async function Cr(e,t){let{tplStateStoreId:n,routeId:r}=t;const o={...wi(),tplStateStoreId:n,match:ir(r)};return e.resolve?tt(e.resolve,o,{cache:"reload"}):mt(e.value,o)}function Rr(e){const t=wi();return{app:(null==t?void 0:t.overrideApp)??(null==t?void 0:t.app),location:(0,h.pick)(location,["href","origin","hostname","host"]),...(0,h.pick)(t,["query","sys"]),match:ir(null==e?void 0:e.routeId)}}let Or;const Tr=[];function _r(e){Or=e;const t=Er({tplStateStoreId:e.tplStateStoreId});Mr({changeType:"initialize",tplStateStoreId:e.tplStateStoreId,detail:{data:t}})}function Pr(e){Tr.push(e)}function Mr(e){setTimeout((()=>{for(const t of Tr)try{t(e)}catch(t){console.error(`RealTimeDataInspectHook failed (${e.changeType}):`,t)}}))}const xr=["onBeforePageLoad","onPageLoad","onBeforePageLeave","onPageLeave","onAnchorLoad","onAnchorUnload"];class Lr{constructor(e,t,n,r){(0,o.A)(this,"type",void 0),(0,o.A)(this,"data",new Map),(0,o.A)(this,"changeEventType",void 0),(0,o.A)(this,"pendingStack",[]),(0,o.A)(this,"hostBrick",void 0),(0,o.A)(this,"stateStoreId",void 0),(0,o.A)(this,"batchUpdate",!1),(0,o.A)(this,"batchUpdateContextsNames",[]),(0,o.A)(this,"rendererContext",void 0),(0,o.A)(this,"routeMap",new WeakMap),this.type=e,this.changeEventType="FORM_STATE"===this.type?"formstate.change":"STATE"===this.type?"state.change":"context.change",this.hostBrick=t,this.rendererContext=n,this.stateStoreId=r}getAllValues(){return Object.fromEntries([...this.data.entries()].map((e=>{let[t,{value:n}]=e;return[t,n]})))}getValue(e){var t;return null===(t=this.data.get(e))||void 0===t?void 0:t.value}notifyRealTimeDataChange(e,t){if(Or){const{tplStateStoreId:n}=Or;(n?"STATE"===this.type&&this.stateStoreId===n:"CTX"===this.type)&&Mr({changeType:"update",tplStateStoreId:n,detail:{name:e,value:t}})}}getAffectListByContext(e){const t=[e];return this.data.forEach(((e,n)=>{e.deps&&e.deps.some((e=>t.includes(e)))&&t.push(n)&&t.push(...this.getAffectListByContext(n))})),t.shift(),[...new Set(t)]}updateValues(e,t,n){if(this.batchUpdate=!0,this.batchUpdateContextsNames=e.map((e=>e.name)),[...new Set(this.batchUpdateContextsNames)].length!==this.batchUpdateContextsNames.length)throw new Error("Batch update not allow to update same item");const r={},o={},i=[];e.forEach((e=>{const{name:o,value:s}=n([e]),a=this.data.get(o);i.push(...this.getAffectListByContext(o)),a&&(r[o]=a),this.updateValue(o,s,t)})),i.filter((e=>!r[e])).forEach((e=>{const t=this.data.get(e);t&&(o[e]=t)}));const s=e=>{for(const n in e){var t;const r=e[n];null===(t=r.eventTarget)||void 0===t||t.dispatchEvent(new CustomEvent(this.changeEventType,{detail:r.value}))}};s(r),s(o),this.batchUpdate=!1}updateValue(e,t,n,r,o){const i=this.data.get(e);if(!i)throw new Error(`${this.type} '${e}' is not defined`);if("refresh"!==n&&"load"!==n)"replace"===n?i.value=t:(0,u.isObject)(i.value)?Object.assign(i.value,t):(console.warn(`Non-object current value of "${this.type}.${e}" for "context.assign", try "context.replace" instead.`),i.value=t),this.batchUpdate||i.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:i.value}));else{if(!i.useResolve)throw new Error(`You can not ${n} "${this.type}.${e}" which is not using resolve`);let s;"load"===n&&(i.loaded?s=Promise.resolve(i.value):i.loading&&(s=i.loading));const a=e=>{var t;let n;return"FlowApiNotFoundError"===(null==e?void 0:e.name)&&!!(n=null===(t=this.rendererContext)||void 0===t?void 0:t.renderId)&&n!==vi()};if(s||(s=i.loading=i.load({cache:"load"===n?"default":"reload",...t}),s.then((e=>{this.finishLoad(i,e)}),(e=>{!i.useResolve||a(e)||null!=r&&r.error||rn(e)}))),r){const e=On(r,o);s.then((t=>{e("success")({value:t}),e("finally")()}),(t=>{!a(t)&&r.error&&e("error")(t),e("finally")()}))}}}finishLoad(e,t){e.useResolve&&(e.loaded=!0,e.value=t,e.eventTarget.dispatchEvent(new CustomEvent(this.changeEventType,{detail:t})))}define(e,t,n,r){if(Array.isArray(e)&&e.length>0){const o=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"CTX";const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"CTX",n=arguments.length>2?arguments[2]:void 0;const r=new Map;for(const o of e){const e=[o.if,o.value,o.resolve],i=(0,T.collectMemberUsage)(e,t);if(!n&&"STATE"===t){const t=(0,T.collectMemberUsage)(e,"TPL");for(const e of t.usedProperties)i.usedProperties.add(e);t.hasNonStaticUsage&&(i.hasNonStaticUsage=!0)}r.set(o,i)}return r}(e,n,arguments.length>3?arguments[3]:void 0),o=new Map;for(const e of Array.from(r.keys()).map((e=>e.name)))o.set(e,(o.get(e)??0)+1);const i=Array.from(r.values()).some((e=>e.hasNonStaticUsage)),s=new WeakSet,a=new Map,c=new Map([...new Set(e.map((e=>e.name)))].map((e=>[e,new Promise(((t,n)=>{a.set(e,{resolve:t,reject:n})}))]))),l=async e=>{s.add(e);const n=await t(e);r.delete(e);const i=o.get(e.name)??0;if(n){if(a.get(e.name).resolve(),o.delete(e.name),0===i)throw new Error(`Duplicated context defined: ${e.name}`)}else 1===i?(a.get(e.name).resolve(),o.delete(e.name)):o.set(e.name,i-1);await d()};let u=i;async function d(){const e=Array.from(r.entries()).filter(function(e,t){return(n,r)=>t?0===r:![...n[1].usedProperties].some((t=>e.has(t)))}(o,u)).map((e=>e[0])).filter((e=>!s.has(e)));await Promise.all(e.map(l))}return{pendingResult:d().then((async()=>{r.size>0&&(function(e,t){const n=new Map(e),r=new Set(Array.from(n.keys()).map((e=>e.name))),o=()=>{let e=!1;for(const[t,o]of n.entries())[...o.usedProperties].some((e=>r.has(e)))||(n.delete(t),r.delete(t.name),e=!0);e&&o()};if(o(),n.size>0)throw new ReferenceError(`Circular ${t} detected: ${Array.from(n.keys()).map((e=>e.name)).join(", ")}`)}(r,n),u=!0,await d());for(const e of a.values())e.resolve()})).catch((e=>{for(const t of a.values())t.reject(e);throw e})),pendingContexts:c}}(e,(e=>this.resolve(e,t,n,r)),this.type,Re(t));this.pendingStack.push(o)}}onChange(e,t){var n;const r=null===(n=this.data.get(e))||void 0===n?void 0:n.eventTarget;return null==r||r.addEventListener(this.changeEventType,t),()=>{null==r||r.removeEventListener(this.changeEventType,t)}}async waitFor(e){for(const{pendingContexts:t}of this.pendingStack)await Promise.all([...e].map((e=>t.get(e))))}async waitForAll(){for(const{pendingContexts:e}of this.pendingStack)for(const t of e.values())t.catch((()=>{}));for(const{pendingResult:e}of this.pendingStack)await e}mountAsyncData(e){this.data.forEach((t=>{var n;if(t.async&&(!e||null!==(n=this.routeMap.get(e))&&void 0!==n&&n.has(t.name))){if(t.asyncMounted)return void console.error(`Async data "${t.name}" already mounted. This is a bug of Brick Next, please report it.`);t.asyncMounted=!0,t.loading.then((e=>{this.finishLoad(t,e)}))}}))}async resolve(e,t,n,r){if(!await yt(e,t))return!1;let o,i,s,a,c,l;if(n&&("STATE"===this.type?e.expose:"FORM_STATE"===this.type)&&(o=await kt(n,e.name)),void 0===o){if(e.resolve){const n=(0,u.hasOwnProperty)(e,"value");c=e.track&&n&&(0,u.hasOwnProperty)(e.resolve,"if")&&(0,T.strictCollectMemberUsage)(e.resolve.if,this.type).size>0;const r={transform:"value",...e.resolve};if(a=await yt(e.resolve,t),(a||c)&&(i=async e=>{var n;return(await tt(r,t,{...e,renderId:null===(n=this.rendererContext)||void 0===n?void 0:n.renderId})).value}),a)l=e.resolve.async?"async":e.resolve.lazy?"lazy":"eager","eager"===l?o=await i():"async"===l&&(s=i());else if(!n)return!1}a&&"eager"===l||void 0===e.value||(o=await mt(e.value,t))}if(this.data.has(e.name))throw new Error(`${this.type} '${e.name}' has already been declared`);const d={name:e.name,value:o,eventTarget:new we,useResolve:a,load:i,loaded:"eager"===l,loading:s,async:"async"===l,deps:[]};if("lazy"===l){const{trigger:t}=e.resolve;var p;t&&xr.includes(t)&&(null===(p=this.rendererContext)||void 0===p||p.registerArbitraryLifeCycle(t,(()=>{this.updateValue(e.name,void 0,"load")})))}if(e.onChange&&d.eventTarget.addEventListener(this.changeEventType,dn(e.onChange,t)),e.track){const n=(0,T.strictCollectMemberUsage)(c?[e.resolve,e.value]:i?e.resolve:e.value,this.type);!i&&(d.deps=[...n]);for(const r of n)this.onChange(r,this.batchAddListener((()=>{d.useResolve=c?Et(e.resolve,t):!!i,d.useResolve?this.updateValue(e.name,{cache:"default"},"refresh"):this.updateValue(e.name,gt(e.value,t),"replace")}),e))}if(d.eventTarget.addEventListener(this.changeEventType,(t=>{this.notifyRealTimeDataChange(e.name,t.detail)})),this.data.set(e.name,d),Array.isArray(r))for(const t of r){const n=this.routeMap.get(t);n?n.add(e.name):this.routeMap.set(t,new Set([e.name]))}return!0}disposeDataInRoutes(e){for(const t of e){const e=this.routeMap.get(t);if(void 0!==e)for(const t of e)this.data.delete(t)}}batchAddListener(e,t){return n=>{this.batchUpdate&&this.batchUpdateContextsNames.includes(t.name)||e(n)}}}function $r(e,t,n){const{reversedProxies:r,asyncHostPropertyEntries:o,externalSlots:i,tplStateStoreId:s,hostBrick:a}=e;let c;if(t&&r){const e=r.properties.get(t);e&&(d=o,c=e.map((e=>{let{from:t,to:n}=e;const r=d.filter((e=>e[0]===t));if(r.length>0&&n.refProperty)return[n.refProperty,kt(r,t),!0]})).filter(Boolean));const s=r.slots.get(t);if(s&&i){const e=new Map;for(const{from:t,to:r}of s){var l;const o=(null===(l=i[t])||void 0===l?void 0:l.bricks)??[];if(!o.length)continue;const s=r.refSlot??t;let c=e.get(s);if(!c){c=[];const t=(0,u.hasOwnProperty)(n,s)?n[s].bricks.length+1:1;for(let e=0;e<t;e+=1)c.push([]);e.set(s,c)}const d=r.refPosition??-1,p=(0,u.hasOwnProperty)(a.runtimeContext,"forEachItem");c[(0,h.clamp)(d<0?c.length+d:d,0,c.length-1)].push(...p?Br(o,a.runtimeContext.forEachItem,a.runtimeContext.forEachIndex,a.runtimeContext.forEachSize):o)}for(const[t,r]of e.entries()){(0,u.hasOwnProperty)(n,t)||(n[t]={type:"bricks",bricks:[]});const e=n[t];e.bricks=r.flatMap(((t,n)=>n<e.bricks.length?t.concat(e.bricks[n]):t)),0===e.bricks.length&&delete n[t]}}}var d;return{[Ut]:c,[Ft]:s}}function Br(e,t,n,r){return e.map((e=>{let{children:o,slots:i,...s}=e;return{...s,[Dt]:t,[jt]:n,[Kt]:r,slots:":forEach"===s.brick?so(o,i):Object.fromEntries(Object.entries(so(o,i)??{}).map((e=>{let[o,i]=e;return[o,"routes"===i.type?{type:"routes",routes:Nr(i.routes,t,n,r)}:{type:"bricks",bricks:Br(i.bricks,t,n,r)}]})))}}))}function Nr(e,t,n,r){return e.map((e=>"routes"===e.type?{...e,routes:Nr(e.routes,t,n,r)}:"redirect"===e.type?e:{...e,bricks:Br(e.bricks,t,n,r)}))}function Ur(e,t){function n(e){return(0,u.isObject)(e)&&"function"!=typeof e?Array.isArray(e)?e.map(n):Object.fromEntries(Object.entries(e).map((e=>{let[t,o]=e;return(0,u.isObject)(o)&&"useBrick"===t?Array.isArray(o)?[t,o.map(r)]:[t,r(o)]:[t,n(o)]})).concat(Object.getOwnPropertySymbols(e).map((t=>[t,e[t]])))):e}function r(e){const{properties:o,slots:i,children:s,...a}=e,c=so(s,i),l=Object.fromEntries(Object.entries(c??{}).map((e=>{let[t,n]=e;return[t,{type:"bricks",bricks:(n.bricks??[]).map(r)}]})));return{...a,properties:n(o),slots:l,...$r(t,a.ref,l)}}return n(e)}function Fr(e,t,n,r,o){var i;const s=(0,h.uniqueId)("tpl-state-"),a={...n.runtimeContext,tplStateStoreId:s};delete a.forEachItem,delete a.forEachIndex,delete a.forEachSize,delete a.formStateStoreId;const c=new Lr("STATE",n,o,s);a.tplStateStoreMap.set(s,c),a.tplStateStoreScope&&a.tplStateStoreScope.push(c);const{bricks:l,proxy:u,state:d,contracts:p}=Pe.get(e);null==li||null===(i=li.flowApi)||void 0===i||i.collectWidgetContract(p),c.define(d,a,r);const{slots:f,children:m,...g}=t,v={...g,brick:e};n.tplHostMetadata={internalBricksByRef:new Map,tplStateStoreId:s,proxy:u};const w={properties:new Map,slots:new Map};if(null!=u&&u.properties)for(const[e,t]of Object.entries(u.properties)){let n=w.properties.get(t.ref);n||(n=[],w.properties.set(t.ref,n)),n.push({from:e,to:t})}if(null!=u&&u.slots)for(const[e,t]of Object.entries(u.slots)){let n=w.slots.get(t.ref);n||(n=[],w.slots.set(t.ref,n)),n.push({from:e,to:t})}const y={reversedProxies:w,asyncHostPropertyEntries:r,externalSlots:so(m,f),tplStateStoreId:s,hostBrick:n};return v.slots={"":{type:"bricks",bricks:l.map((e=>Dr(e,y)))}},v}function Dr(e,t){null===e.if&&delete e.if;const{properties:n,slots:r,children:o,...i}=e,s=so(o,r),a=Object.fromEntries(Object.entries(s??{}).map((e=>{let[n,r]=e;return[n,{type:"bricks",bricks:(r.bricks??[]).map((e=>Dr(e,t)))}]})));return{...i,properties:Ur(n,t),slots:a,...$r(t,i.ref,a)}}const jr="form-renderer.form-renderer",Kr=Symbol.for("form.stateStoreId"),Vr=["forms.general-form","form.general-form","eo-form"];function Wr(e,t,n){const{id:r,bricks:o,events:i,context:s,mountPoint:a,instanceId:c}=e;let{brick:l,properties:d}=e;const p=t.find((e=>e.fieldId===r));if(p){const e=function(e){let t;const n={id:e.fieldId,name:e.fieldId,label:e.name,dataset:{testid:e.fieldId}},r=()=>{var t,n;return{readOnly:null===(t=e.limit)||void 0===t?void 0:t.includes("READONLY"),required:null===(n=e.limit)||void 0===n?void 0:n.includes("REQUIRED")}};switch(e.fieldType){case"INT":t={brick:"forms.general-input-number",properties:{...n,...r(),placeholder:e.description,precision:0,inputBoxStyle:{width:"100%"}}};break;case"BOOLEAN":t={brick:"forms.general-switch",properties:{...n,...r()}};break;case"FLOAT":t={brick:"forms.general-input-number",properties:{...n,...r(),placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"ENUM":t={brick:"forms.general-select",properties:{...n,...r(),options:[{label:"选项一",value:1},{label:"选项二",value:2}],placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"ENUMS":t={brick:"forms.general-select",properties:{...n,...r(),mode:"multiple",options:[{label:"选项一",value:1},{label:"选项二",value:2}],placeholder:e.description,inputBoxStyle:{width:"100%"}}};break;case"DATE":case"TIME":t={brick:"forms.general-date-picker",properties:{...n,...r(),placeholder:e.description}};break;case"IP":t={brick:"forms.general-input",properties:{...n,...r(),placeholder:e.description,pattern:"((^s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]).){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))s*$)|(^s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*$))",message:{pattern:"输入字符不匹配IP格式"}}};break;case"JSON":t={brick:"forms.general-textarea",properties:{...n}};break;case"ARRAY":t={brick:"forms.general-select",properties:{...n}};break;case"STRUCTURE":case"STRUCTURE_ARRAY":t={brick:"forms.cmdb-instance-select-panel",properties:{...n,...r()}};break;default:t={brick:"forms.general-input",properties:{...n,...r(),placeholder:e.description}}}return t}(p);l||(l=e.brick),d={...e.properties,...d}}const f={brick:l,properties:d,iid:c,slot:a,events:i,context:s,children:Hr(o,t,n),[Kr]:n};return(0,u.hasOwnProperty)(e,"if")&&(f.if=e.if),f}function Hr(e,t,n){if(Array.isArray(e))return e.map((e=>Wr(e,t,n)))}var Gr=new WeakSet;class zr extends HTMLElement{constructor(){super(...arguments),(0,I.A)(this,Gr),(0,o.A)(this,"renderRoot",void 0)}get $$typeof(){return"formRenderer"}validate(){(0,C.A)(Gr,this,qr).call(this,"validate")}setInitValue(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];(0,C.A)(Gr,this,qr).call(this,"setInitValue",t)}resetFields(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];(0,C.A)(Gr,this,qr).call(this,"resetFields",t)}}function qr(e){var t,n;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const o=!1!==this.renderRoot?null===(t=this.firstElementChild)||void 0===t?void 0:t.firstElementChild:this.firstElementChild,i=null==o||null===(n=o.tagName)||void 0===n?void 0:n.toLowerCase();Vr.includes(i)?o[e](...r):console.error(`no ${e} method in the container element`,{container:i})}class Yr extends Error{constructor(e){super(e),this.name="PageNotFoundError",Error.captureStackTrace&&Error.captureStackTrace(this,l.BrickLoadError)}}async function Xr(e,t,n){const{title:r,variant:o,showLink:i,showDescription:s}=function(e){var t,n;return e instanceof Yr?"app not found"===e.message?{showLink:"home",title:c.i18n.t(`${zt}:${Wt.APP_NOT_FOUND}`),variant:"no-permission"}:{showLink:"home",variant:"not-found",title:c.i18n.t(`${zt}:${Wt.PAGE_NOT_FOUND}`)}:e instanceof l.BrickLoadError||e instanceof Error&&"ChunkLoadError"===e.name||e instanceof Event&&"error"===e.type&&e.target instanceof HTMLScriptElement?{showDescription:!0,title:c.i18n.t(`${zt}:${Wt.NETWORK_ERROR}`),variant:"internet-disconnected",showLink:"reload"}:e instanceof R.HttpResponseError&&403===(null===(t=e.response)||void 0===t?void 0:t.status)?{showLink:"previous",showDescription:!0,title:c.i18n.t(`${zt}:${Wt.NO_PERMISSION}`),variant:"no-permission"}:e instanceof R.HttpResponseError&&"200000"===(null===(n=e.responseJson)||void 0===n?void 0:n.code)?{showDescription:!0,title:c.i18n.t(`${zt}:${Wt.LICENSE_EXPIRED}`),variant:"license-expired"}:{showLink:"previous",showDescription:!0,title:c.i18n.t(`${zt}:${Wt.UNKNOWN_ERROR}`),variant:"unknown-error"}}(e);if(n){const n=gi().error??"illustrations.error-message";if(!1!==n){const a="eo-link",c=(i?[n,a]:[n]).filter((e=>!customElements.get(e)));try{await Promise.race([(0,l.loadBricksImperatively)(c,mi()),new Promise(((e,t)=>setTimeout((()=>{t(new Error("timeout"))}),3e3)))]);const u={tag:Mn.BRICK,type:n,properties:{errorTitle:r,description:s?Qt(e):void 0,variant:o,dataset:{errorBoundary:""}},runtimeContext:null,return:t};return i&&(u.child=Jr(i,a,u,"")),u}catch(e){console.error("Failed to load brick:",c.join(", "),e)}}}const a=n&&!!customElements.get("easyops-default-error"),u={tag:Mn.BRICK,type:a?"easyops-default-error":"div",properties:{errorTitle:r,dataset:{errorBoundary:""},style:{color:"var(--color-error)"}},runtimeContext:null,return:t},d={tag:Mn.BRICK,type:"div",properties:{textContent:a?s?Qt(e):"":s?`${r}: ${Qt(e)}`:r},runtimeContext:null,return:u};return u.child=d,n&&i&&(d.sibling=Jr(i,"a",u,a?"link":"")),u}function Jr(e,t,n,r){return{tag:Mn.BRICK,type:t,slotId:r,properties:{textContent:"home"===e?c.i18n.t(`${zt}:${Wt.GO_BACK_HOME}`):"reload"===e?c.i18n.t(`${zt}:${Wt.RELOAD}`):c.i18n.t(`${zt}:${Wt.GO_BACK_TO_PREVIOUS_PAGE}`),href:"home"===e?f():"reload"===e?location.href:void 0},events:"previous"===e?{click:{action:"history.goBack"}}:void 0,runtimeContext:null,return:n}}async function Qr(e,t,n,r,o,i,s,a,c){const u=await async function(e,t){for(const n of e){if("string"!=typeof n.path)throw console.error("Invalid route with invalid path:",n),new Error("Invalid route with invalid type of path: "+typeof n.path);const e=Nt(n,t.app.homepage,t.location.pathname);if(e&&await yt(n,t))return t.app.noAuthGuard||n.public||null==li||!li.auth||li.auth.isLoggedIn()?{match:e,route:n}:"unauthenticated"}return"missed"}(t,n),d={blockingList:[]},p=d.menuRequestNode={return:i};switch(u){case"missed":break;case"unauthenticated":d.unauthenticated=!0;break;default:{var f;const i=d.route=u.route;d.path=u.match.path;const g={...n,match:u.match};i.iid&&(h=i.iid,m=u.match,or.set(h,m)),a&&g.ctxStore.disposeDataInRoutes(t);const v=o.concat(i);g.ctxStore.define(i.context,g,void 0,v),g.pendingPermissionsPreCheck.push(null==li||null===(f=li.checkPermissions)||void 0===f?void 0:f.preCheckPermissionsForBrickOrRoute(i,(e=>mt(e,g))));const{preLoadBricks:w}=i;if(Array.isArray(w)&&d.blockingList.push((0,l.loadBricksImperatively)(w,mi())),"redirect"===i.type){let e;if(e="string"==typeof i.redirect?await mt(i.redirect,g):(await tt({transform:"redirect",...i.redirect},g)).redirect,"string"!=typeof e)throw console.error("Unexpected redirect result:",e),new Error("Unexpected type of redirect result: "+typeof e);d.redirect={path:e}}else{const n=function(e,t){if(e){if("brick"===e.type)throw console.error("Set menu with brick is dropped in v3:",e),new Error("Set menu with brick is dropped in v3");if("resolve"!==e.type)return mt(e,t);console.warn("Set menu with resolve is not supported in v3 yet:",e)}}(i.menu,g);let o;n&&(p.request=n),a||r.memoizeMenuRequestNode(t,p),o="routes"===i.type?await Qr(e,i.routes,g,r,v,p,s,void 0,c):await Zr(e,i.bricks,g,r,v,p,s,void 0,void 0,c),oo(d,o),io(p,o.menuRequestNode)}}}var h,m;return d}async function Zr(e,t,n,r,o,i,s,a,c,l){!function(e,t,n){function r(e){if((0,u.isObject)(e)&&"function"!=typeof e)if(Array.isArray(e))e.map(r);else for(const[t,n]of Object.entries(e))(0,u.isObject)(n)&&"useBrick"===t?Array.isArray(n)?n.forEach((e=>o(e,!0))):o(n,!0,!0):r(n)}function o(e,i,s){if(i&&(e[sr]=t),r(e.properties),n&&!s)return;const a=so(e.children,e.slots);for(const e of Object.values(a??{}))for(const t of e.bricks??[])o(t,i)}for(const t of e)o(t)}(t,n,!0);const d={blockingList:[]},p=c??[];return(await Promise.all(t.map(((t,c)=>eo(e,t,n,r,o,i,s,p.concat(c),a&&new Map(a),l))))).forEach(((t,n)=>{t.hasTrackingControls&&r.memoize(s,p.concat(n),t.node,e),oo(d,t)})),d}async function eo(e,t,n,r,o,i,s){let a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:[],c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:new Map,d=arguments.length>9?arguments[9]:void 0;try{return await async function(e,t,n,r,o,i,s,a,c,d){var p,f;const m={blockingList:[]};if(!t.brick)return t.template?console.error("Legacy templates are dropped in v3:",t):console.error("Invalid brick:",t),m;const{if:v,permissionsPreCheck:w,...y}=t;if(function(e){return"string"==typeof e?(0,O.isTrackAll)(e):it(e)&&(0,O.isTrackAll)(st(e))}(v))return eo(e,{brick:":if",dataSource:v,permissionsPreCheck:w,slots:{"":{type:"bricks",bricks:[y]}},...Object.getOwnPropertySymbols(t).reduce(((e,n)=>({...e,[n]:t[n]})),{})},n,r,o,i,s,a,c,d);const E=t[Ft],b=t[Kr],S={...n,tplStateStoreId:E,formStateStoreId:b};(0,u.hasOwnProperty)(t,Dt)&&(S.forEachItem=t[Dt],S.forEachIndex=t[jt],S.forEachSize=t[Kt]);const{context:A}=t;if(Array.isArray(A)&&A.length>0){const e=Re(S);Oe(e,"Defining context on bricks","check your brick:",t),e||S.ctxStore.define(A,S)}if(S.pendingPermissionsPreCheck.push(null==li||null===(p=li.checkPermissions)||void 0===p?void 0:p.preCheckPermissionsForBrickOrRoute(t,(e=>mt(e,S)))),!await async function(e,t){return(0,u.isObject)(e.if)&&!it(e.if)?bt(await tt(e.if,t)):yt(e,t)}(t,S))return m;const k=t.brick;if(k.startsWith(":")){!function(e){if(":forEach"!==e&&":if"!==e&&":switch"!==e)throw new Error(`Unknown storyboard control node: "${e}"`)}(k);const{dataSource:n}=t,{contextNames:l,stateNames:d}=At(n),p=async(p,f,h)=>{var m;const g=await mt(n,p);h&&Ot(p,[{contextNames:l,stateNames:d,propValue:n}],f);const v=":forEach"===k?"":":switch"===k?String(g):g?"":"else",w=so(t.children,t.slots),y=w&&(0,u.hasOwnProperty)(w,v)&&(null===(m=w[v])||void 0===m?void 0:m.bricks);if(!Array.isArray(y))return{blockingList:[]};switch(k){case":forEach":return Array.isArray(g)?async function(e,t,n,r,o,i,s,a,c,l,u){const d={blockingList:[]},p=t.length,f=await Promise.all(t.map(((t,d)=>Promise.all(n.map(((n,f)=>eo(e,n,{...r,forEachItem:t,forEachIndex:d,forEachSize:p},o,i,s,a,l.concat(d*p+f),c&&new Map(c),u)))))));return f.flat().forEach(((t,n)=>{t.hasTrackingControls&&o.memoize(a,l.concat(n),t.node,e),oo(d,t)})),d}(e,g,y,p,r,o,i,s,c,a,f):{blockingList:[]};case":if":case":switch":return Zr(e,y,p,r,o,i,s,c,a,f)}},f=async(n,r)=>{var o;let i=!1;const s={disposes:[],listener:()=>{i=!0}};let a,c=0,l=!0;for(;l||i;)if(i=!1,a=await p(n,s,l&&"initial"===r),s.disposes.forEach((e=>e())),s.disposes.length=0,l=!1,++c>10)throw new Error(`Maximum rerender stack overflowed (iid: ${t.iid})`);return(o=a).node??(o.node={tag:Mn.PLACEHOLDER,return:e}),a},m=await f(S,"initial"),{onMount:g,onUnmount:v}=t.lifeCycle??{};if(l||d){m.hasTrackingControls=!0;let t=0;const o=async()=>{const n=++t,[o,i,c]=ro(S),l=await f(o,"rerender"),u=[...i,...c];if(await no(l,o,u),t===n){v&&dn(v,S)(new CustomEvent("unmount",{detail:{rerender:!0}})),r.reRender(s,a,l.node,e),g&&dn(g,o)(new CustomEvent("mount",{detail:{rerender:!0}}));for(const e of u)e.mountAsyncData()}},i=(0,h.debounce)(o,0,{leading:!0,trailing:!0}),c=e.tag===Mn.BRICK?e:null,u=c?c.disposes??(c.disposes=[]):[];if(l)for(const e of l)u.push(S.ctxStore.onChange(e,i));if(d)for(const e of d){const t=Me(S,"STATE",`: "${n}"`);u.push(t.onChange(e,i))}}return g&&r.registerArbitraryLifeCycle("onMount",(()=>{dn(g,S)(new CustomEvent("mount",{detail:{rerender:!1}}))})),v&&r.registerArbitraryLifeCycle("onUnmount",(()=>{dn(v,S)(new CustomEvent("unmount",{detail:{rerender:!1}}))})),m}/\.tpl-/.test(k)&&!Pe.get(k)&&await ao((0,l.loadBricksImperatively)([k],mi()),"brick",k,r.unknownBricks);const I=function(e,t){if(!e.includes(".")&&e.startsWith("tpl-")&&t){const n=`${t}.${e}`;if(Pe.get(n))return n}return!!Pe.get(e)&&e}(k,null===(f=S.app)||void 0===f?void 0:f.id);if(I){const e=c.get(I)??0;if(e>=10)throw new Error(`Maximum custom template stack overflowed: "${I}"`);c.set(I,e+1)}else k.includes("-")&&!customElements.get(k)&&(k===jr?customElements.get(jr)||customElements.define(jr,zr):m.blockingList.push(ao((0,l.enqueueStableLoadBricks)([k],mi()),"brick",k,r.unknownBricks)));let C,R;var _;k===jr?(({formData:C,...R}=t.properties??{}),null!==(_=t.properties)&&void 0!==_&&_.compute&&(C=await mt(C,S))):R=t.properties;const P=[],M=function(e,t,n){return(0,u.isObject)(e)?Object.entries(e).map((e=>{let[r,o]=e;const{contextNames:i,stateNames:s,formStateNames:a}=At(o);return(i||s||a)&&n.push({contextNames:i,stateNames:s,formStateNames:a,propName:r,propValue:o}),[r,mt(o,t,{$$lazyForUseBrick:!0,$$stateOfUseBrick:"useBrick"===r?pt.USE_BRICK:pt.INITIAL})]})):[]}(R,S,P),x=t[Ut];x&&M.push(...x);const L="script"===k;if(L||"link"===k){const e=await It(M);if(L?e.src:"stylesheet"===e.rel&&e.href){const t=window.PUBLIC_ROOT??"";if(L){const{src:n,...r}=e;await ao((0,l.loadScript)(n,t,r),"script",n,"silent")}else{const{href:n,...r}=e;await ao((0,l.loadStyle)(n,t,r),"stylesheet",n,"silent")}return m}}const $={tag:Mn.BRICK,type:I||k,return:e,slotId:s,events:t.events,runtimeContext:S,portal:t.portal,iid:t.iid,ref:t.ref};m.node=$;const B=(0,T.strictCollectMemberUsage)([t.events,t.lifeCycle],"PROCESSORS",2);B.size>0&&m.blockingList.push(ao((0,l.loadProcessorsImperatively)(B,mi()),"processors",[...B].join(", "),r.unknownBricks));const N=[];Ot(S,P,d);N.push((async()=>{$.properties=await It(M),function(e,t){for(const n of t){const t=()=>{e.element&&Rt(e.element,{[n.propName]:n.propValue},e.runtimeContext)};if(e.disposes??(e.disposes=[]),n.contextNames)for(const r of n.contextNames)e.disposes.push(e.runtimeContext.ctxStore.onChange(r,t));if(n.stateNames){const r=Me(e.runtimeContext,"STATE",`: "${n.propValue}"`);for(const o of n.stateNames)e.disposes.push(r.onChange(o,t))}if(n.formStateNames){const r=qe(e.runtimeContext,"FORM_STATE",`: "${n.propValue}"`);for(const o of n.formStateNames)e.disposes.push(r.onChange(o,t))}}}($,P)})()),r.registerBrickLifeCycle($,t.lifeCycle);let U,F=t;I?F=Fr(I,t,$,M,r):k===jr&&(F=function(e,t,n,r,o){var i;const s="string"==typeof e?JSON.parse(e):e,a=(0,h.uniqueId)("form-state-"),c={...n.runtimeContext,formStateStoreId:a};delete c.forEachItem,delete c.forEachIndex,delete c.forEachSize,delete c.tplStateStoreId;const l=new Lr("FORM_STATE",void 0,o,a);c.formStateStoreMap.set(a,l),c.formStateStoreScope&&c.formStateStoreScope.push(l);const d=s.context??[];d.some((e=>"params"===e.name))||d.push({name:"params"}),l.define(d,c,r);const p=Wr(s.formSchema,s.fields,a);return Vr.includes(p.brick)&&t.events&&(p.events=function(e,t){const n=e??{};for(const[e,r]of Object.entries(t))n[e]=(0,u.hasOwnProperty)(n,e)?[n[e],r].flat():r;return n}(p.events,t.events)),"boolean"!=typeof(null===(i=t.properties)||void 0===i?void 0:i.renderRoot)||t.properties.renderRoot?{...t,slots:void 0,children:[{brick:"eo-micro-view",properties:{style:{padding:"12px"}},children:[p]}]}:{...t,slots:void 0,children:[p]}}(C,t,$,M,r)),F.portal&&($.slotId=void 0),I?(U={...S},delete U.forEachItem,delete U.forEachIndex,delete U.forEachSize):U=S;return N.push((async()=>{const e=so(F.children,F.slots);if(!e)return;const t=new Map,n=await Promise.all(Object.entries(e).map(((e,n)=>{let[s,a]=e;if("routes"!==a.type)return Zr($,a.bricks,U,r,o,i,s,c,void 0,d);const l=o[o.length-1];return null!=l&&l.incrementalSubRoutes&&(t.set(n,s),r.performIncrementalRender(a,o,(async(e,t)=>{const{homepage:n}=U.app,{pathname:c}=e;if(!g(n,c)||!o.every((e=>{let r,o;return(r=Nt(e,n,t.pathname))&&(o=Nt(e,n,c))&&(e!==l||(0,h.isEqual)(r.params,o.params))})))return!1;const[u,d,p]=ro({...U,location:e,query:new URLSearchParams(e.search)});let f,m=!1,v=[];try{if(f=await Qr($,a.routes,u,r,o,i,s,!0),f.route){if(r.reBailout(f))return!0;v=[...d,...p],await no(f,u,[u.ctxStore,...v])}await r.reMergeMenuRequestNodes(i,a.routes,f.menuRequestNode)}catch(e){console.error("Incremental sub-router failed:",e);const t=await r.reCatch(e,$);if(!t)return!0;({failed:m,output:f}=t),await r.reMergeMenuRequestNodes(i,a.routes,f.menuRequestNode)}if(r.reRender(s,[],f.node,$),!m){u.ctxStore.mountAsyncData(f.route);for(const e of v)e.mountAsyncData()}return!!f.route||null}))),Qr($,a.routes,U,r,o,i,s,void 0,d)}))),s={...m,node:void 0,blockingList:[],menuRequestNode:void 0};n.forEach(((e,n)=>{t.has(n)&&r.memoize(t.get(n),[],e.node,$),oo(s,e),function(e,t){const n=t.menuRequestNode;if(n)if(e.menuRequestNode){let t=e.menuRequestNode;for(;t.sibling;)t=t.sibling;t.sibling=n}else e.menuRequestNode=n}(s,e)})),s.node&&($.child=s.node),oo(m,{...s,node:void 0}),io(i,m.menuRequestNode=s.menuRequestNode)})()),await Promise.all(N),m}(e,t,n,r,o,i,s,a,c,d)}catch(n){if(t.errorBoundary)return console.error("Error caught by error boundary:",n),{node:await Xr(n,e),blockingList:[]};throw n}}function to(e){return[e.ctxStore,...e.tplStateStoreMap.values(),...e.formStateStoreMap.values()]}function no(e,t,n){return(0,l.flushStableLoadBricks)(),Promise.all([...e.blockingList,...n.map((e=>e.waitForAll())),...t.pendingPermissionsPreCheck])}function ro(e){const t=[],n=[];return[{...e,tplStateStoreScope:t,formStateStoreScope:n},t,n]}function oo(e,t){const{blockingList:n,node:r,menuRequestNode:o,hasTrackingControls:i,...s}=t;if(e.blockingList.push(...n),r)if(e.node){let t=e.node;for(;t.sibling;)t=t.sibling;t.sibling=r}else e.node=r;Object.assign(e,s)}function io(e,t){if(t)if(e.child){let n=e.child;for(;n.sibling;)n=n.sibling;n.sibling=t}else e.child=t}function so(e,t){let n=t;if(Array.isArray(e)&&!n){n={};for(const t of e){const e=t.slot??"";(0,u.hasOwnProperty)(n,e)||(n[e]={type:"bricks",bricks:[]}),n[e].bricks.push(t)}}return n}function ao(e,t,n,r){return"silent"===r?e.catch((e=>{console.error('Load %s "%s" failed:',t,n,e)})):e}let co,lo,uo;function po(){if(!co){if(co={isInIframe:!1,isInIframeOfSameSite:!1,isInIframeOfNext:!1,isInIframeOfVisualBuilder:!1,isInIframeOfLegacyConsole:!1},window!==window.parent){co.isInIframe=!0;try{if(window.origin===window.parent.origin){co.isInIframeOfSameSite=!0;const e="/next/"===f(),t=window.parent.location.pathname,n=t.startsWith("/next/");co.isInIframeOfNext=0==(Number(e)^Number(n));const r=n?"/next":"";co.isInIframeOfVisualBuilder=t.startsWith(`${r}/visual-builder/`)||t.startsWith(`${r}/visual-builder-`),co.isInIframeOfLegacyConsole=e&&!n}}catch{}}Object.freeze(co)}return co}function fo(e){var t;if(e.$$registerCustomTemplateProcessed)return;e.$$registerCustomTemplateProcessed=!0;const n=null===(t=e.meta)||void 0===t?void 0:t.customTemplates;if(Array.isArray(n))for(const t of n){const n=t.name.includes(".")?t.name:`${e.app.id}.${t.name}`;Pe.define(n,t)}}function ho(e){let t;t="8.2"===e?"v8-2":"v8",document.documentElement.dataset.ui=t}const mo="basic.show-watermark";var go=new WeakMap,vo=new WeakMap,wo=new WeakMap,yo=new WeakMap,Eo=new WeakMap,bo=new WeakMap,So=new WeakMap,Ao=new WeakMap,ko=new WeakMap,Io=new WeakMap,Co=new WeakMap,Ro=new WeakSet;class Oo{constructor(e){(0,I.A)(this,Ro),(0,i.A)(this,go,void 0),(0,i.A)(this,vo,!1),(0,i.A)(this,wo,void 0),(0,i.A)(this,yo,void 0),(0,i.A)(this,Eo,void 0),(0,i.A)(this,bo,new Set),(0,i.A)(this,So,0),(0,i.A)(this,Ao,void 0),(0,i.A)(this,ko,void 0),(0,i.A)(this,Io,void 0),(0,i.A)(this,Co,void 0),(0,s.A)(go,this,e);const t=k();window.addEventListener("beforeunload",(e=>{(0,C.A)(Ro,this,To).call(this,{})?(e.preventDefault(),e.returnValue=""):delete e.returnValue})),t.block(((e,t)=>(0,C.A)(Ro,this,To).call(this,{location:e,action:t})))}getRenderId(){return(0,a.A)(Ao,this)}getRuntimeContext(){return(0,a.A)(yo,this)}getRecentApps(){return{currentApp:(0,a.A)(ko,this),previousApp:(0,a.A)(Io,this)}}getNavConfig(){return(0,a.A)(Co,this)}bootstrap(){window.AbortController&&(lo=new AbortController,R.http.interceptors.request.use((e=>{var t;return{...e,options:{...e.options,signal:null!==(t=e.options)&&void 0!==t&&t.noAbortOnRouteChange?null:lo.signal}}})));const e=k();let t=e.location;return e.listen(((e,n)=>{const r=t;t=e,(0,a.A)(vo,this)?(0,s.A)(wo,this,{location:e,prevLocation:r,action:n}):(0,C.A)(Ro,this,Po).call(this,{location:e,prevLocation:r,action:n}).catch(rn)})),(0,C.A)(Ro,this,Po).call(this,{location:e.location})}}function To(e){var t;const n=k(),r=n.getBlockMessage();null===(t=(0,a.A)(Eo,this))||void 0===t||t.dispatchBeforePageLeave(e);const o=n.getBlockMessage();return!r&&o&&n.unblock(),o}function _o(e,t,n){var r,o;if((0,s.A)(So,this,(r=(0,a.A)(So,this),o=r++,r)),o>10){const t=`Infinite redirect detected: from "${n.pathname}${n.search}${n.hash}" to "${e}"`;throw new Error(t)}k().replace(e,t)}async function Po(e){(0,s.A)(vo,this,!0);try{await(0,C.A)(Ro,this,Mo).call(this,e)}finally{if((0,s.A)(vo,this,!1),(0,a.A)(wo,this)){const e=(0,a.A)(wo,this);(0,s.A)(wo,this,void 0),await(0,C.A)(Ro,this,Po).call(this,e)}}}async function Mo(e){let{location:t,prevLocation:n,action:r}=e;if(n){var o,i,s,c;let e;const u={hash:void 0,state:void 0};var l;if(void 0!==t.key&&("POP"!==r||void 0!==n.key&&!1!==(null===(o=n.state)||void 0===o?void 0:o.notify))||(u.key=void 0),((0,p.locationsAreEqual)({...n,...u},{...t,...u})||"POP"!==r&&!1===(null===(i=t.state)||void 0===i?void 0:i.notify))&&(e=!0),e||null!==(s=t.state)&&void 0!==s&&s.noIncremental||(e=await(null===(l=(0,a.A)(Eo,this))||void 0===l?void 0:l.didPerformIncrementalRender(t,n))),e)return;if(lo&&(lo.abort(),lo=new AbortController),null===(c=(0,a.A)(Eo,this))||void 0===c||c.dispatchPageLeave(),"POP"===r&&v(m((0,a.A)(go,this),t.pathname)))return void window.location.reload();V("locationChange")}return(0,C.A)(Ro,this,xo).call(this,t,!n)}async function xo(e,t){var n,r,o,i;const c=(0,s.A)(Ao,this,(0,h.uniqueId)("render-id-"));Je=new WeakSet,et.clear(),null==li||null===(n=li.flowApi)||void 0===n||n.clearCollectWidgetContract(),k().unblock();const u=null==li||null===(r=li.pageView)||void 0===r?void 0:r.create(),d=m((0,a.A)(go,this),e.pathname),p=null===(o=(0,a.A)(yo,this))||void 0===o?void 0:o.app,f=null==d||null===(i=d.app)||void 0===i?void 0:i.id;window.BOOTSTRAP_UNION_FILE&&f&&f!==(null==p?void 0:p.id)&&function(e){const{appId:t,version:n}=e;window.APP_ROOT_TPL&&(window.APP_ID=t,window.APP_ROOT=window.APP_ROOT_TPL.replace("{id}",t).replace("{version}",n))}({appId:f,version:d.app.currentVersion}),null!=d&&d.app&&await async function(e){if(!e.$$fulfilled)return e.$$fulfilling||(e.$$fulfilling=async function(e){var t;await(null==li||null===(t=li.fulfilStoryboard)||void 0===t?void 0:t.call(li,e)),L(e),Object.assign(e,{$$fulfilled:!0,$$fulfilling:null})}(e)),e.$$fulfilling}(d);const g=(0,s.A)(ko,this,null==d?void 0:d.app);!function(){var e,t,n,r,o;const i=di().getFeatureFlags(),s=di().getMiscSettings();if(!i["show-watermark"])return;const a="0.0.0"===(null===(e=window.APP_ROOT)||void 0===e||null===(e=e.match(/versions\/([^/]+)\//))||void 0===e?void 0:e[1])||"0.0.0"===(null===(t=window.APP_ROOT)||void 0===t||null===(t=t.match(/micro-apps\/(?:v2|v3)\/[^/]+\/([^/]+)/))||void 0===t?void 0:t[1]),c=(null==li||null===(n=li.auth)||void 0===n||null===(n=n.getAuth())||void 0===n?void 0:n.username)??"",u=s.watermarkConfig??{flags:{}},d=[..."string"==typeof u.content?[u.content]:u.content??[],null!==(r=u.flags)&&void 0!==r&&r["show-development"]&&a?"Development":"",null!==(o=u.flags)&&void 0!==o&&o["show-user"]?c:""].filter(Boolean);if(0===d.length)return;const p={content:d,zIndex:1001,width:200,font:{fontSize:28},gap:[190,190],...(0,h.omit)(u,["content","flags"])};uo?uo.resolve(p):(0,l.loadBricksImperatively)([mo],mi()).then((()=>{uo=document.createElement(mo),uo.resolve(p)}),(e=>{console.error("Load watermark service failed:",e)}))}();const v=p&&g?p.id!==g.id:p!==g;(0,O.clearExpressionASTCache)(),v&&(0,O.clearFunctionASTCache)();const w=di().getFeatureFlags(),y=(0,a.A)(Eo,this),E=(t,n)=>{null==u||u({status:"redirected"}),(0,a.A)(bo,this).add(y),(0,C.A)(Ro,this,_o).call(this,t,n,e)},b=()=>{const t=w["sso-enabled"]?"/sso-auth/login":"/auth/login";Jt(e),E(t,{from:e})},S=document.querySelector("#main-mount-point"),A=document.querySelector("#portal-mount-point"),I={tag:Mn.ROOT,container:S,createPortal:A},T=()=>{var e;xn(S),xn(A),(0,a.A)(bo,this).add(y);for(const e of(0,a.A)(bo,this))e&&(e.dispatchOnUnmount(),e.dispose());(0,a.A)(bo,this).clear(),null==li||null===(e=li.messageDispatcher)||void 0===e||e.reset(),v&&((0,s.A)(Io,this,p),window.dispatchEvent(new CustomEvent("app.change",{detail:{previousApp:p,currentApp:g}})))};if(Q(g&&(re()[g.id]||g.theme)||"light"),ie("default"),g){var _,P,M,x,$,B;null==li||null===(_=li.checkInstalledApps)||void 0===_||_.preCheckInstalledApps(d,(e=>!!Ei(e)));const n={bailout:e=>e.unauthenticated?(b(),!0):e.redirect?(E(e.redirect.path,e.redirect.state),!0):void(0,s.A)(So,this,0),mergeMenus:async e=>{const t=await Promise.all(e);(0,s.A)(Co,this,function(e){const t={breadcrumb:[]};for(const n of e){const{breadcrumb:e}=n;e&&(e.overwrite?t.breadcrumb=e.items:t.breadcrumb.push(...e.items))}return t}(t)),window.dispatchEvent(new CustomEvent("navConfig.change",{detail:(0,a.A)(Co,this)}))},catch:async(t,n,r,o)=>{if(!Zt(t)||window.NO_AUTH_GUARD){if(!(t instanceof R.HttpAbortError)){const i=di().getMiscSettings().noAuthGuardLoginPath;if(Zt(t)&&i)return void E(i,{from:e});if(r)throw t;return{failed:!0,output:{node:await Xr(t,n,!o),blockingList:[]}}}(0,a.A)(bo,this).add(y)}else b()}},r=(0,s.A)(Eo,this,new zn("page",{routeHelper:n,renderId:c})),o=(0,s.A)(yo,this,{app:g,location:e,query:new URLSearchParams(e.search),flags:w,sys:{...null==li||null===(P=li.auth)||void 0===P?void 0:P.getAuth(),...po(),settings:{brand:di().getBrandSettings()}},ctxStore:new Lr("CTX",void 0,r),pendingPermissionsPreCheck:[null==li||null===(M=li.checkPermissions)||void 0===M?void 0:M.preCheckPermissions(d)],tplStateStoreMap:new Map,formStateStoreMap:new Map});(0,s.A)(Co,this,void 0),fo(d),me(null===(x=d.meta)||void 0===x?void 0:x.functions,g),null==li||null===($=li.flowApi)||void 0===$||$.collectContract(null===(B=d.meta)||void 0===B?void 0:B.contracts);let i,l=!1,p=[];try{or.clear();const e={};if(i=await Qr(I,function(e){if(window.parent===window)return e;let t=e;const n=(0,h.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/template-preview/")));t=[...t.slice(0,n+1),{path:"${APP.homepage}/_dev_only_/template-preview/:templateId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(n+1)];const r=(0,h.findLastIndex)(t,(e=>e.path.startsWith("${APP.homepage}/_dev_only_/snippet-preview/")));return t=[...t.slice(0,r+1),{path:"${APP.homepage}/_dev_only_/snippet-preview/:snippetId",bricks:[{brick:"span"}],menu:!1,exact:!0},...t.slice(r+1)],t}(d.routes),o,r,[],e),n.bailout(i))return;p=to(o),await no(i,o,p),e.child=i.menuRequestNode,r.setInitialMenuRequestNode(e),await n.mergeMenus(r.getMenuRequests())}catch(e){console.error("Router failed:",e);const r=await n.catch(e,I,t);if(!r)return;({failed:l,output:i}=r)}if(I.child=i.node,T(),i.route&&"routes"!==i.route.type||l){if(l||r.dispatchBeforePageLoad(),te(),ae(),ho(null==g?void 0:g.uiVersion),Ln(I),window.scrollTo(0,0),l)null==u||u({status:"failed"});else{r.dispatchPageLoad(),r.dispatchAnchorLoad(),r.dispatchOnMount(),r.initializeScrollIntoView(),r.initializeMediaChange(),r.initializeMessageDispatcher();for(const e of p)e.mountAsyncData();null==u||u({status:"ok",path:i.path,pageTitle:document.title})}return void V("rendered")}}else{if(!window.NO_AUTH_GUARD&&null!=li&&li.auth&&!li.auth.isLoggedIn())return void b();T()}te(),ae();const N=await Xr(new Yr(g?"page not found":"app not found"),I,!0);I.child=N,Ln(I),window.scrollTo(0,0),null==u||u({status:"not-found"}),V("rendered")}const Lo="undefined"!=typeof BRICK_PACKAGES?BRICK_PACKAGES:null;var $o=n(4579),Bo=n(4501),No=2,Uo=.16,Fo=.05,Do=.05,jo=.15,Ko=5,Vo=4,Wo=[{index:7,opacity:.15},{index:6,opacity:.25},{index:5,opacity:.3},{index:5,opacity:.45},{index:5,opacity:.65},{index:5,opacity:.85},{index:4,opacity:.9},{index:3,opacity:.95},{index:2,opacity:.97},{index:1,opacity:.98}];function Ho(e){var t=e.r,n=e.g,r=e.b,o=(0,$o.wE)(t,n,r);return{h:360*o.h,s:o.s,v:o.v}}function Go(e){var t=e.r,n=e.g,r=e.b;return"#".concat((0,$o.Ob)(t,n,r,!1))}function zo(e,t,n){var r;return(r=Math.round(e.h)>=60&&Math.round(e.h)<=240?n?Math.round(e.h)-No*t:Math.round(e.h)+No*t:n?Math.round(e.h)+No*t:Math.round(e.h)-No*t)<0?r+=360:r>=360&&(r-=360),r}function qo(e,t,n){return 0===e.h&&0===e.s?e.s:((r=n?e.s-Uo*t:t===Vo?e.s+Uo:e.s+Fo*t)>1&&(r=1),n&&t===Ko&&r>.1&&(r=.1),r<.06&&(r=.06),Number(r.toFixed(2)));var r}function Yo(e,t,n){var r;return(r=n?e.v+Do*t:e.v-jo*t)>1&&(r=1),Number(r.toFixed(2))}function Xo(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[],r=(0,Bo.RO)(e),o=Ko;o>0;o-=1){var i=Ho(r),s=Go((0,Bo.RO)({h:zo(i,o,!0),s:qo(i,o,!0),v:Yo(i,o,!0)}));n.push(s)}n.push(Go(r));for(var a=1;a<=Vo;a+=1){var c=Ho(r),l=Go((0,Bo.RO)({h:zo(c,a),s:qo(c,a),v:Yo(c,a)}));n.push(l)}return"dark"===t.theme?Wo.map((function(e){var r,o,i,s=e.index,a=e.opacity;return Go((r=(0,Bo.RO)(t.backgroundColor||"#141414"),i=100*a/100,{r:((o=(0,Bo.RO)(n[s])).r-r.r)*i+r.r,g:(o.g-r.g)*i+r.g,b:(o.b-r.b)*i+r.b}))})):n}var Jo={red:"#F5222D",volcano:"#FA541C",orange:"#FA8C16",gold:"#FAAD14",yellow:"#FADB14",lime:"#A0D911",green:"#52C41A",cyan:"#13C2C2",blue:"#1890FF",geekblue:"#2F54EB",purple:"#722ED1",magenta:"#EB2F96",grey:"#666666"},Qo={},Zo={};function ei(e){return':root,\n[data-override-theme="light"] {\n'.concat(e,"}")}function ti(e){return'html[data-theme="dark-v2"],\n[data-override-theme="dark-v2"] {\n'.concat(e,"}")}function ni(e){return e.match(/[0-9a-fA-F]{2}/g).map((e=>parseInt(e,16))).join(", ")}function ri(e,t,n){return"dark"===t?Xo(e,{theme:t,backgroundColor:n})[5]:e}function oi(e){const t=[];if(["light","dark"].forEach((n=>{if(e[n])switch(e.type){case"brandColor":t.push(function(e,t){return("dark"===e?ti:ei)("string"==typeof(n=t)?" --color-brand: ".concat(n,";\n"):[" --color-brand: ".concat(n.default,";")," --color-brand-hover: ".concat(n.hover,";")," --color-brand-active: ".concat(n.active,";"),""].join("\n"));var n}(n,e[n]));break;case"baseColors":t.push(function(e,t,n){return("dark"===e?ti:ei)("".concat(function(e,t){return Object.entries(e).flatMap((e=>{var[n,r]=e;return function(e){if(!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(e))throw new Error("Invalid base color name: ".concat(JSON.stringify(e)))}(n),r.map(((e,r)=>[" --palette-".concat(n,"-").concat(r+1,"-channel: ").concat(ni(e),";")].concat("dark"===t?[]:" --palette-".concat(n,"-").concat(r+1,": rgb(var(--palette-").concat(n,"-").concat(r+1,"-channel));")).join("\n"))).concat("")})).join("\n")}(function(e,t,n){return Object.fromEntries(Object.entries(e).map((e=>{var[r,o]=e;return[r,Xo(o,"dark"===t?{theme:t,backgroundColor:n}:void 0)]})))}(t,e,n),e),"\n").concat(function(e,t,n){return Object.entries({green:"green",red:"red",blue:"blue",orange:"orange",cyan:"cyan",purple:"purple",geekblue:"indigo"}).flatMap((r=>{var[o,i]=r;return[" --theme-".concat(o,"-color-rgb-channel: ").concat(ni(ri(t[i],e,n)),";"),..."dark"===e?[]:[" --theme-".concat(o,"-color: var(--palette-").concat(i,"-6);")," --theme-".concat(o,"-border-color: var(--palette-").concat(i,"-3);")]," --theme-".concat(o,"-background: var(--palette-").concat(i,"-").concat("dark"===e?2:1,");"),""]})).join("\n")}(e,t,n)))}(n,e[n],e.backgroundColor));break;case"variables":t.push(function(e,t){return("dark"===e?ti:ei)(function(e){return Object.entries(e).map((e=>{var[t,n]=e;return function(e){if(!/^--[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/.test(e))throw new Error("Invalid css variable name: ".concat(JSON.stringify(e)))}(t)," ".concat(t,": ").concat(n,";")})).concat("").join("\n")}(t))}(n,e[n]))}})),t.length>0){const e=document.createElement("style");return e.textContent=t.join("\n\n"),document.head.appendChild(e),()=>{e.remove()}}}let ii,si,ai,ci,li;function ui(e){if(ii)throw new Error("Cannot create multiple runtimes");return window.addEventListener("message",(e=>{let{data:t}=e;if((null==t?void 0:t.source)!==U)return;const n=t.payload;switch(null==n?void 0:n.type){case F:K=n.active;break;case D:j=n.panel}})),li=null==e?void 0:e.hooks,(0,c.initializeI18n)(zt,qt),d.locale(c.i18n.language),c.i18n.on("languageChanged",(()=>{d.locale(c.i18n.language)})),A(),ii=new hi,ii}Object.keys(Jo).forEach((function(e){Qo[e]=Xo(Jo[e]),Qo[e].primary=Qo[e][5],Zo[e]=Xo(Jo[e],{theme:"dark",backgroundColor:"#141414"}),Zo[e].primary=Zo[e][5]})),Qo.red,Qo.volcano,Qo.gold,Qo.orange,Qo.yellow,Qo.lime,Qo.green,Qo.cyan,Qo.blue,Qo.geekblue,Qo.purple,Qo.magenta,Qo.grey;const di=function(){const e=S();if(e)return function(){return new Proxy(e.getRuntime(),{get(){switch(arguments.length<=1?void 0:arguments[1]){case"getCurrentApp":case"getRecentApps":case"hasInstalledApp":case"getDesktops":case"getLaunchpadSettings":case"getLaunchpadSiteMap":case"toggleLaunchpadEffect":case"applyPageTitle":case"getNavConfig":case"getFeatureFlags":case"getMiscSettings":case"getBrandSettings":return Reflect.get(...arguments)}}})}}()||function(){return ii};var pi=new WeakMap,fi=new WeakMap;class hi{constructor(){(0,i.A)(this,pi,!1),(0,i.A)(this,fi,!1),(0,o.A)(this,"version",3)}initialize(e){var t;if((0,a.A)(pi,this))throw new Error("The runtime cannot be initialized more than once");(0,s.A)(pi,this,!0),function(e){(0,u.isObject)(e.settings)&&(0,u.deepFreeze)(e.settings),e.brickPackages&&(0,u.deepFreeze)(e.brickPackages)}(e),si=e;const{notification:n,dialog:r}=gi();var o;!1!==n&&(o=n??"basic.show-notification",(0,this.loadBricks)([o]).then((()=>{tn=document.createElement(o)}),(e=>{console.error("Load notification service failed:",e)}))),!1!==r&&function(e,t){t([e]).then((()=>{Yt=document.createElement(e)}),(e=>{console.error("Load dialog service failed:",e)}))}(r??"basic.show-dialog",this.loadBricks),function(e){e&&(e.brandColor?oi({type:"brandColor",...e.brandColor}):e.baseColors?oi({type:"baseColors",...e.baseColors}):e.variables&&oi({type:"variables",...e.variables}))}(null===(t=e.settings)||void 0===t||null===(t=t.misc)||void 0===t?void 0:t.theme)}async bootstrap(e){if(e&&this.initialize(e),(0,a.A)(fi,this))throw new Error("The runtime cannot be bootstrapped more than once");(0,s.A)(fi,this,!0),ai=new Oo(si.storyboards),await ai.bootstrap()}getRecentApps(){var e;return(null===(e=ai)||void 0===e?void 0:e.getRecentApps())??{}}getCurrentApp(){var e;return null===(e=ai)||void 0===e?void 0:e.getRecentApps().currentApp}hasInstalledApp(e,t){return ze(e,t)}getFeatureFlags(){var e,t;return{...null===(e=si)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.featureFlags,...null===(t=ai)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.featureFlags,"migrate-to-brick-next-v3":!0}}getMiscSettings(){var e,t;return{...null===(e=si)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.misc,...null===(t=ai)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t||null===(t=t.config)||void 0===t||null===(t=t.settings)||void 0===t?void 0:t.misc}}getBrandSettings(){var e;return{base_title:"DevOps 管理专家",...null===(e=si)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.brand}}getLaunchpadSettings(){var e;return{columns:7,rows:4,...null===(e=si)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.launchpad}}getDesktops(){var e;return(null===(e=si)||void 0===e?void 0:e.desktops)??[]}getLaunchpadSiteMap(){var e;return(null===(e=si)||void 0===e?void 0:e.siteSort)??[]}toggleLaunchpadEffect(e){document.body.classList.toggle("launchpad-open",e)}applyPageTitle(e){var t;const n=this.getBrandSettings().base_title;document.title=(null===(t=ai)||void 0===t||null===(t=t.getRecentApps().currentApp)||void 0===t?void 0:t.localeTitle)||(e?`${e} - ${n}`:n)}getNavConfig(){var e;return null===(e=ai)||void 0===e?void 0:e.getNavConfig()}loadBricks(e){return(0,l.loadBricksImperatively)(e,mi())}}function mi(){var e;return ci??(ci=function(e,t){if(null==t||!t.length)return e;const n=new Map;return[...t,...e].forEach((e=>{const t=e.filePath.split("/")[1];n.has(t)||n.set(t,e)})),Array.from(n.values())}((null===(e=si)||void 0===e?void 0:e.brickPackages)??Lo??window.STANDALONE_BRICK_PACKAGES??[],window.PUBLIC_DEPS))}function gi(){var e;return(null===(e=si)||void 0===e||null===(e=e.settings)||void 0===e?void 0:e.presetBricks)??{}}function vi(){var e;return null===(e=ai)||void 0===e?void 0:e.getRenderId()}function wi(){var e;return null===(e=ai)||void 0===e?void 0:e.getRuntimeContext()}function yi(e){var t;return null===(t=si)||void 0===t||null===(t=t.storyboards)||void 0===t?void 0:t.find((t=>t.app.id===e))}function Ei(e){var t;return null===(t=yi(e))||void 0===t?void 0:t.app}function bi(){for(var e,t,n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];null==li||null===(e=li.auth)||void 0===e||null===(t=e.authenticate)||void 0===t||t.call(e,...r)}function Si(){var e;return null==li||null===(e=li.auth)||void 0===e?void 0:e.getAuth()}function Ai(){var e,t;return null==li||null===(e=li.auth)||void 0===e||null===(t=e.logout)||void 0===t?void 0:t.call(e)}function ki(){var e;return null==li||null===(e=li.auth)||void 0===e?void 0:e.isLoggedIn()}var Ii=new WeakMap;const Ci=new class{constructor(){(0,i.A)(this,Ii,new Map)}define(e,t){(0,a.A)(Ii,this).has(e)?console.error(`Custom editor of "${e}" already registered`):(0,a.A)(Ii,this).set(e,t)}get(e){return(0,a.A)(Ii,this).get(e)}};async function Ri(e,t,n){return nt(await Xe(e),e,"resolve",t,n)}function Oi(e){let t,{portal:n,scope:r="fragment",unknownBricks:o}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n;t=n||(()=>(i=document.createElement("div"),i.style.position="absolute",i.style.width=i.style.height="0",document.body.append(i),i));let s,a,l=!1;return{async render(n){let{theme:u,uiVersion:d,language:p,context:f,functions:m,templates:g,i18n:v,url:w,app:y}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(l)throw new Error("The root is unmounted and cannot be rendered any more");const E=[].concat(n),b=s,S=(0,h.uniqueId)("render-id-");s=new zn(r,{unknownBricks:o,renderId:S});const A={ctxStore:new Lr("CTX",void 0,s),pendingPermissionsPreCheck:[],tplStateStoreMap:new Map,formStateStoreMap:new Map};if(w){const e=new URL(w);A.query=e.searchParams,A.location={pathname:e.pathname,search:e.search,hash:e.hash,state:void 0}}const k={tag:Mn.ROOT,container:e,createPortal:t};if("page"===r){var I;Q(u??"light"),ie("default"),ho(d),p&&await c.i18n.changeLanguage(p),y??(y={id:"demo",homepage:"/demo"}),A.app=y;const e={app:y,meta:{i18n:v,customTemplates:g}};null===(I=a)||void 0===I||I(),a=L(e),fo(e),me(m,y)}A.ctxStore.define(f,A);let C,R=!1,O=[];try{C=await Zr(k,E,A,s,[],{}),O=to(A),await no(C,A,O)}catch(e){R=!0,C={node:await Xr(e,k,"page"===r),blockingList:[]}}if(k.child=C.node,null==b||b.dispatchOnUnmount(),null==b||b.dispose(),xn(e),i&&xn(i),"page"===r&&(R||s.dispatchBeforePageLoad(),te(),ae()),Ln(k),"page"===r&&window.scrollTo(0,0),!R){for(const e of O)e.mountAsyncData();"page"===r&&s.dispatchPageLoad(),s.dispatchOnMount(),s.initializeScrollIntoView(),s.initializeMediaChange(),s.initializeMessageDispatcher()}},unmount(){l||(l=!0,xn(e),i&&(xn(i),n||i.remove()))}}}function Ti(e){let{useRealTimeQuery:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={...wi()};t&&(n.query=new URLSearchParams(k().location.search));const r=t=>{if("string"==typeof t){if((0,O.isEvaluable)(t)){const e=ut(t,n);return Qe(e),e}return(0,_.inject)(t,n)}return!(0,u.isObject)(t)||Ze(e)?t:Array.isArray(t)?t.map((e=>r(e))):Object.fromEntries(Object.entries(t).map((e=>{let[t,n]=e;return[r(t),r(n)]})))};return r(e)}const _i=[];function Pi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3,t=-1;const n=()=>{if(t>-1){const e=_i.indexOf(t);e>-1&&_i.splice(e,1)}};return{push:()=>(n(),t=(_i[_i.length-1]??-1)+1,_i.push(t),t+e),pull:n}}}}]);
|
|
3
|
-
//# sourceMappingURL=4766.f59e3f71.js.map
|