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e,uBAAwB,oCAAqC,kBAAmB,yBAA0B,6BAA8B,0BAA2B,2CAA4C,mCAAoC,qBAAsB,SAAU,YAAa,gBAAiB,cAAe,IAAK,OAAQ,UAAW,MAAO,UAAW,SAAU,eAAgB,UAAW,0BAA2B,aAAc,WAAY,WAAY,qBAAsB,gBAAiB,oBAAqB,2BAA4B,iBAAkB,YAAa,wCAAyC,gCAAiC,cAAe,sBAAuB,uBAAwB,KAAM,WAAY,IAAK,8BAA+B,OAAQ,YAAa,aAAc,wCAAyC,qCAAsC,mCAAoC,oBAAqB","file":"/npm/idp-sequential-workflow-designer@1.0.0/lib/esm/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/idp-sequential-workflow-designer@1.0.0/lib/esm/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { StepChildrenType, DefinitionWalker } from 'sequential-workflow-model';\nexport * from 'sequential-workflow-model';\n\nclass Dom {\r\n    static svg(name, attributes) {\r\n        const element = document.createElementNS('http://www.w3.org/2000/svg', name);\r\n        if (attributes) {\r\n            Dom.attrs(element, attributes);\r\n        }\r\n        return element;\r\n    }\r\n    static translate(element, x, y) {\r\n        element.setAttribute('transform', `translate(${x}, ${y})`);\r\n    }\r\n    static attrs(element, attributes) {\r\n        Object.keys(attributes).forEach(name => {\r\n            const value = attributes[name];\r\n            element.setAttribute(name, typeof value === 'string' ? value : value.toString());\r\n        });\r\n    }\r\n    static element(name, attributes) {\r\n        const element = document.createElement(name);\r\n        if (attributes) {\r\n            Dom.attrs(element, attributes);\r\n        }\r\n        return element;\r\n    }\r\n    static toggleClass(element, isEnabled, className) {\r\n        if (isEnabled) {\r\n            element.classList.add(className);\r\n        }\r\n        else {\r\n            element.classList.remove(className);\r\n        }\r\n    }\r\n}\n\n// Source: https://fonts.google.com/icons or https://github.com/google/material-design-icons\r\nclass Icons {\r\n    static appendPath(parent, pathClassName, d, size) {\r\n        const g = Dom.svg('g');\r\n        const scale = size / 48;\r\n        const path = Dom.svg('path', {\r\n            d,\r\n            class: pathClassName,\r\n            transform: `scale(${scale})`\r\n        });\r\n        g.appendChild(path);\r\n        parent.appendChild(g);\r\n        return g;\r\n    }\r\n    static createSvg(className, d) {\r\n        const icon = Dom.svg('svg', {\r\n            class: className,\r\n            viewBox: '0 0 48 48'\r\n        });\r\n        const path = Dom.svg('path', {\r\n            d,\r\n            class: 'sqd-icon-path'\r\n        });\r\n        icon.appendChild(path);\r\n        return icon;\r\n    }\r\n}\r\nIcons.folderIn = 'M42.05 42.25H11.996v-7.12h17.388L6 11.746 11.546 6.2 34.93 29.584V12.196h7.12V42.25z';\r\nIcons.folderOut = 'M6 6.2h30.054v7.12H18.666L42.05 36.704l-5.546 5.546L13.12 18.866v17.388H6V6.2z';\r\nIcons.center = 'M9 42q-1.2 0-2.1-.9Q6 40.2 6 39v-8.6h3V39h8.6v3Zm21.4 0v-3H39v-8.6h3V39q0 1.2-.9 2.1-.9.9-2.1.9ZM24 31.15q-3.15 0-5.15-2-2-2-2-5.15 0-3.15 2-5.15 2-2 5.15-2 3.15 0 5.15 2 2 2 2 5.15 0 3.15-2 5.15-2 2-5.15 2ZM6 17.6V9q0-1.2.9-2.1Q7.8 6 9 6h8.6v3H9v8.6Zm33 0V9h-8.6V6H39q1.2 0 2.1.9.9.9.9 2.1v8.6Z';\r\nIcons.zoomIn = 'M39.8 41.95 26.65 28.8q-1.5 1.3-3.5 2.025-2 .725-4.25.725-5.4 0-9.15-3.75T6 18.75q0-5.3 3.75-9.05 3.75-3.75 9.1-3.75 5.3 0 9.025 3.75 3.725 3.75 3.725 9.05 0 2.15-.7 4.15-.7 2-2.1 3.75L42 39.75Zm-20.95-13.4q4.05 0 6.9-2.875Q28.6 22.8 28.6 18.75t-2.85-6.925Q22.9 8.95 18.85 8.95q-4.1 0-6.975 2.875T9 18.75q0 4.05 2.875 6.925t6.975 2.875ZM17.3 24.3v-4.1h-4.1v-3h4.1v-4.05h3v4.05h4.05v3H20.3v4.1Z';\r\nIcons.zoomOut = 'M39.8 41.95 26.65 28.8q-1.5 1.3-3.5 2.025-2 .725-4.25.725-5.4 0-9.15-3.75T6 18.75q0-5.3 3.75-9.05 3.75-3.75 9.1-3.75 5.3 0 9.025 3.75 3.725 3.75 3.725 9.05 0 2.15-.7 4.15-.7 2-2.1 3.75L42 39.75Zm-20.95-13.4q4.05 0 6.9-2.875Q28.6 22.8 28.6 18.75t-2.85-6.925Q22.9 8.95 18.85 8.95q-4.1 0-6.975 2.875T9 18.75q0 4.05 2.875 6.925t6.975 2.875Zm-5.1-8.35v-3H23.8v3Z';\r\nIcons.undo = 'M14 38v-3h14.45q3.5 0 6.025-2.325Q37 30.35 37 26.9t-2.525-5.775Q31.95 18.8 28.45 18.8H13.7l5.7 5.7-2.1 2.1L8 17.3 17.3 8l2.1 2.1-5.7 5.7h14.7q4.75 0 8.175 3.2Q40 22.2 40 26.9t-3.425 7.9Q33.15 38 28.4 38Z';\r\nIcons.redo = 'M19.6 38q-4.75 0-8.175-3.2Q8 31.6 8 26.9t3.425-7.9q3.425-3.2 8.175-3.2h14.7l-5.7-5.7L30.7 8l9.3 9.3-9.3 9.3-2.1-2.1 5.7-5.7H19.55q-3.5 0-6.025 2.325Q11 23.45 11 26.9t2.525 5.775Q16.05 35 19.55 35H34v3Z';\r\nIcons.move = 'm24 44-8.15-8.15 2.2-2.2 4.45 4.45v-9.45h3v9.45l4.45-4.45 2.2 2.2ZM11.9 31.9 4 24l7.95-7.95 2.2 2.2L9.9 22.5h9.45v3H9.9l4.2 4.2Zm24.2 0-2.2-2.2 4.2-4.2h-9.4v-3h9.4l-4.2-4.2 2.2-2.2L44 24ZM22.5 19.3V9.9l-4.2 4.2-2.2-2.2L24 4l7.9 7.9-2.2 2.2-4.2-4.2v9.4Z';\r\nIcons.delete = 'm16.5 33.6 7.5-7.5 7.5 7.5 2.1-2.1-7.5-7.5 7.5-7.5-2.1-2.1-7.5 7.5-7.5-7.5-2.1 2.1 7.5 7.5-7.5 7.5ZM24 44q-4.1 0-7.75-1.575-3.65-1.575-6.375-4.3-2.725-2.725-4.3-6.375Q4 28.1 4 24q0-4.15 1.575-7.8 1.575-3.65 4.3-6.35 2.725-2.7 6.375-4.275Q19.9 4 24 4q4.15 0 7.8 1.575 3.65 1.575 6.35 4.275 2.7 2.7 4.275 6.35Q44 19.85 44 24q0 4.1-1.575 7.75-1.575 3.65-4.275 6.375t-6.35 4.3Q28.15 44 24 44Z';\r\nIcons.folderUp = 'M22.5 34h3V23.75l3.7 3.7 2.1-2.1-7.3-7.3-7.3 7.3 2.1 2.1 3.7-3.7ZM7.05 40q-1.2 0-2.1-.925-.9-.925-.9-2.075V11q0-1.15.9-2.075Q5.85 8 7.05 8h14l3 3h17q1.15 0 2.075.925.925.925.925 2.075v23q0 1.15-.925 2.075Q42.2 40 41.05 40Zm0-29v26h34V14H22.8l-3-3H7.05Zm0 0v26Z';\r\nIcons.close = 'm12.45 37.65-2.1-2.1L21.9 24 10.35 12.45l2.1-2.1L24 21.9l11.55-11.55 2.1 2.1L26.1 24l11.55 11.55-2.1 2.1L24 26.1Z';\r\nIcons.options = 'm19.4 44-1-6.3q-.95-.35-2-.95t-1.85-1.25l-5.9 2.7L4 30l5.4-3.95q-.1-.45-.125-1.025Q9.25 24.45 9.25 24q0-.45.025-1.025T9.4 21.95L4 18l4.65-8.2 5.9 2.7q.8-.65 1.85-1.25t2-.9l1-6.35h9.2l1 6.3q.95.35 2.025.925Q32.7 11.8 33.45 12.5l5.9-2.7L44 18l-5.4 3.85q.1.5.125 1.075.025.575.025 1.075t-.025 1.05q-.025.55-.125 1.05L44 30l-4.65 8.2-5.9-2.7q-.8.65-1.825 1.275-1.025.625-2.025.925l-1 6.3ZM24 30.5q2.7 0 4.6-1.9 1.9-1.9 1.9-4.6 0-2.7-1.9-4.6-1.9-1.9-4.6-1.9-2.7 0-4.6 1.9-1.9 1.9-1.9 4.6 0 2.7 1.9 4.6 1.9 1.9 4.6 1.9Z';\r\nIcons.expand = 'm24 30.75-12-12 2.15-2.15L24 26.5l9.85-9.85L36 18.8Z';\r\nIcons.alert = 'M24 42q-1.45 0-2.475-1.025Q20.5 39.95 20.5 38.5q0-1.45 1.025-2.475Q22.55 35 24 35q1.45 0 2.475 1.025Q27.5 37.05 27.5 38.5q0 1.45-1.025 2.475Q25.45 42 24 42Zm-3.5-12V6h7v24Z';\r\nIcons.play = 'M14.75 40.15V7.55l25.6 16.3Z';\r\nIcons.stop = 'M10.75 37.25V10.7H37.3v26.55Z';\r\nIcons.folder = 'M7.05 40q-1.2 0-2.1-.925-.9-.925-.9-2.075V11q0-1.15.9-2.075Q5.85 8 7.05 8h14l3 3h17q1.15 0 2.075.925.925.925.925 2.075v23q0 1.15-.925 2.075Q42.2 40 41.05 40Z';\n\nclass ObjectCloner {\r\n    static deepClone(instance) {\r\n        if (typeof window.structuredClone !== 'undefined') {\r\n            return window.structuredClone(instance);\r\n        }\r\n        return JSON.parse(JSON.stringify(instance));\r\n    }\r\n}\n\nclass Vector {\r\n    constructor(x, y) {\r\n        this.x = x;\r\n        this.y = y;\r\n    }\r\n    add(v) {\r\n        return new Vector(this.x + v.x, this.y + v.y);\r\n    }\r\n    subtract(v) {\r\n        return new Vector(this.x - v.x, this.y - v.y);\r\n    }\r\n    multiplyByScalar(s) {\r\n        return new Vector(this.x * s, this.y * s);\r\n    }\r\n    divideByScalar(s) {\r\n        return new Vector(this.x / s, this.y / s);\r\n    }\r\n    round() {\r\n        return new Vector(Math.round(this.x), Math.round(this.y));\r\n    }\r\n    distance() {\r\n        return Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2));\r\n    }\r\n}\n\nfunction getAbsolutePosition(element) {\r\n    const rect = element.getBoundingClientRect();\r\n    return new Vector(rect.x + window.scrollX, rect.y + window.scrollY);\r\n}\n\nclass Uid {\r\n    static next() {\r\n        const bytes = new Uint8Array(16);\r\n        window.crypto.getRandomValues(bytes);\r\n        return Array.from(bytes, v => v.toString(16).padStart(2, '0')).join('');\r\n    }\r\n}\n\nclass SimpleEvent {\r\n    constructor() {\r\n        this.listeners = [];\r\n        this.forward = (value) => {\r\n            if (this.listeners.length > 0) {\r\n                this.listeners.forEach(listener => listener(value));\r\n            }\r\n        };\r\n    }\r\n    subscribe(listener) {\r\n        this.listeners.push(listener);\r\n    }\r\n    unsubscribe(listener) {\r\n        const index = this.listeners.indexOf(listener);\r\n        if (index >= 0) {\r\n            this.listeners.splice(index, 1);\r\n        }\r\n        else {\r\n            throw new Error('Unknown listener');\r\n        }\r\n    }\r\n    count() {\r\n        return this.listeners.length;\r\n    }\r\n    first() {\r\n        return new Promise(resolve => {\r\n            const handler = (value) => {\r\n                this.unsubscribe(handler);\r\n                resolve(value);\r\n            };\r\n            this.subscribe(handler);\r\n        });\r\n    }\r\n}\n\nfunction race(timeout, a, b, c, d) {\r\n    const value = [undefined, undefined, undefined, undefined];\r\n    const result = new SimpleEvent();\r\n    let scheduled = false;\r\n    function forward() {\r\n        if (scheduled) {\r\n            return;\r\n        }\r\n        scheduled = true;\r\n        setTimeout(() => {\r\n            try {\r\n                result.forward(value);\r\n            }\r\n            finally {\r\n                scheduled = false;\r\n                value.fill(undefined);\r\n            }\r\n        }, timeout);\r\n    }\r\n    function subscribe(event, index) {\r\n        event.subscribe(v => {\r\n            value[index] = v;\r\n            forward();\r\n        });\r\n    }\r\n    subscribe(a, 0);\r\n    subscribe(b, 1);\r\n    if (c) {\r\n        subscribe(c, 2);\r\n    }\r\n    if (d) {\r\n        subscribe(d, 3);\r\n    }\r\n    return result;\r\n}\n\nclass ControlBarApi {\r\n    static create(state, historyController, stateModifier) {\r\n        const api = new ControlBarApi(state, historyController, stateModifier);\r\n        race(0, state.onIsReadonlyChanged, state.onSelectedStepIdChanged, state.onIsDragDisabledChanged, api.isUndoRedoSupported() ? state.onDefinitionChanged : undefined).subscribe(api.onStateChanged.forward);\r\n        return api;\r\n    }\r\n    constructor(state, historyController, stateModifier) {\r\n        this.state = state;\r\n        this.historyController = historyController;\r\n        this.stateModifier = stateModifier;\r\n        this.onStateChanged = new SimpleEvent();\r\n    }\r\n    isDragDisabled() {\r\n        return this.state.isDragDisabled;\r\n    }\r\n    setIsDragDisabled(isDragDisabled) {\r\n        this.state.setIsDragDisabled(isDragDisabled);\r\n    }\r\n    toggleIsDragDisabled() {\r\n        this.setIsDragDisabled(!this.isDragDisabled());\r\n    }\r\n    isUndoRedoSupported() {\r\n        return !!this.historyController;\r\n    }\r\n    tryUndo() {\r\n        if (this.canUndo() && this.historyController) {\r\n            this.historyController.undo();\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n    canUndo() {\r\n        return !!this.historyController && this.historyController.canUndo() && !this.state.isReadonly && !this.state.isDragging;\r\n    }\r\n    tryRedo() {\r\n        if (this.canRedo() && this.historyController) {\r\n            this.historyController.redo();\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n    canRedo() {\r\n        return !!this.historyController && this.historyController.canRedo() && !this.state.isReadonly && !this.state.isDragging;\r\n    }\r\n    tryDelete() {\r\n        if (this.canDelete() && this.state.selectedStepId) {\r\n            this.stateModifier.tryDelete(this.state.selectedStepId);\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n    canDelete() {\r\n        return (!!this.state.selectedStepId &&\r\n            !this.state.isReadonly &&\r\n            !this.state.isDragging &&\r\n            this.stateModifier.isDeletable(this.state.selectedStepId));\r\n    }\r\n}\n\nvar KeyboardAction;\r\n(function (KeyboardAction) {\r\n    KeyboardAction[\"delete\"] = \"delete\";\r\n})(KeyboardAction || (KeyboardAction = {}));\r\nvar DefinitionChangeType;\r\n(function (DefinitionChangeType) {\r\n    DefinitionChangeType[DefinitionChangeType[\"stepNameChanged\"] = 1] = \"stepNameChanged\";\r\n    DefinitionChangeType[DefinitionChangeType[\"stepPropertyChanged\"] = 2] = \"stepPropertyChanged\";\r\n    DefinitionChangeType[DefinitionChangeType[\"stepChildrenChanged\"] = 3] = \"stepChildrenChanged\";\r\n    DefinitionChangeType[DefinitionChangeType[\"stepDeleted\"] = 4] = \"stepDeleted\";\r\n    DefinitionChangeType[DefinitionChangeType[\"stepMoved\"] = 5] = \"stepMoved\";\r\n    DefinitionChangeType[DefinitionChangeType[\"stepInserted\"] = 6] = \"stepInserted\";\r\n    DefinitionChangeType[DefinitionChangeType[\"rootPropertyChanged\"] = 7] = \"rootPropertyChanged\";\r\n    DefinitionChangeType[DefinitionChangeType[\"rootReplaced\"] = 8] = \"rootReplaced\";\r\n})(DefinitionChangeType || (DefinitionChangeType = {}));\n\nclass EditorRenderer {\r\n    static create(state, selectedStepIdProvider, definitionWalker, handler) {\r\n        const raceEvent = race(0, state.onDefinitionChanged, selectedStepIdProvider.onSelectedStepIdChanged, state.onIsReadonlyChanged);\r\n        const listener = new EditorRenderer(state, selectedStepIdProvider, definitionWalker, handler, raceEvent);\r\n        raceEvent.subscribe(listener.raceEventHandler);\r\n        listener.renderIfStepChanged(selectedStepIdProvider.selectedStepId);\r\n        return listener;\r\n    }\r\n    constructor(state, selectedStepIdProvider, definitionWalker, handler, raceEvent) {\r\n        this.state = state;\r\n        this.selectedStepIdProvider = selectedStepIdProvider;\r\n        this.definitionWalker = definitionWalker;\r\n        this.handler = handler;\r\n        this.raceEvent = raceEvent;\r\n        this.currentStepId = undefined;\r\n        this.raceEventHandler = ([definitionChanged, selectedStepId, isReadonlyChanged]) => {\r\n            if (isReadonlyChanged !== undefined) {\r\n                this.render(this.selectedStepIdProvider.selectedStepId);\r\n            }\r\n            else if (definitionChanged) {\r\n                if (definitionChanged.changeType === DefinitionChangeType.rootReplaced) {\r\n                    this.render(this.selectedStepIdProvider.selectedStepId);\r\n                }\r\n                else {\r\n                    this.renderIfStepChanged(this.selectedStepIdProvider.selectedStepId);\r\n                }\r\n            }\r\n            else if (selectedStepId !== undefined) {\r\n                this.renderIfStepChanged(selectedStepId);\r\n            }\r\n        };\r\n    }\r\n    destroy() {\r\n        this.raceEvent.unsubscribe(this.raceEventHandler);\r\n    }\r\n    render(stepId) {\r\n        const step = stepId ? this.definitionWalker.getById(this.state.definition, stepId) : null;\r\n        this.currentStepId = stepId;\r\n        this.handler(step);\r\n    }\r\n    renderIfStepChanged(stepId) {\r\n        if (this.currentStepId !== stepId) {\r\n            this.render(stepId);\r\n        }\r\n    }\r\n}\n\nclass EditorApi {\r\n    constructor(state, definitionWalker, stateModifier) {\r\n        this.state = state;\r\n        this.definitionWalker = definitionWalker;\r\n        this.stateModifier = stateModifier;\r\n    }\r\n    isCollapsed() {\r\n        return this.state.isEditorCollapsed;\r\n    }\r\n    isReadonly() {\r\n        return this.state.isReadonly;\r\n    }\r\n    toggleIsCollapsed() {\r\n        this.state.setIsEditorCollapsed(!this.state.isEditorCollapsed);\r\n    }\r\n    subscribeIsCollapsed(listener) {\r\n        this.state.onIsEditorCollapsedChanged.subscribe(listener);\r\n    }\r\n    getDefinition() {\r\n        return this.state.definition;\r\n    }\r\n    addDefinitionModifierDependency(dependency) {\r\n        this.stateModifier.addDependency(dependency);\r\n    }\r\n    runRenderer(rendererHandler, customSelectedStepIdProvider) {\r\n        const selectedStepIdProvider = customSelectedStepIdProvider || this.state;\r\n        return EditorRenderer.create(this.state, selectedStepIdProvider, this.definitionWalker, rendererHandler);\r\n    }\r\n    createStepEditorContext(stepId) {\r\n        if (!stepId) {\r\n            throw new Error('Step id is empty');\r\n        }\r\n        return {\r\n            notifyPropertiesChanged: () => {\r\n                this.state.notifyDefinitionChanged(DefinitionChangeType.stepPropertyChanged, stepId);\r\n            },\r\n            notifyNameChanged: () => {\r\n                this.state.notifyDefinitionChanged(DefinitionChangeType.stepNameChanged, stepId);\r\n            },\r\n            notifyChildrenChanged: () => {\r\n                this.state.notifyDefinitionChanged(DefinitionChangeType.stepChildrenChanged, stepId);\r\n                this.stateModifier.updateDependencies();\r\n            }\r\n        };\r\n    }\r\n    createRootEditorContext() {\r\n        return {\r\n            notifyPropertiesChanged: () => {\r\n                this.state.notifyDefinitionChanged(DefinitionChangeType.rootPropertyChanged, null);\r\n            }\r\n        };\r\n    }\r\n}\n\nclass PathBarApi {\r\n    constructor(state, definitionWalker) {\r\n        this.state = state;\r\n        this.definitionWalker = definitionWalker;\r\n        this.onStateChanged = race(0, this.state.onFolderPathChanged, this.state.onDefinitionChanged);\r\n    }\r\n    setFolderPath(path) {\r\n        this.state.setFolderPath(path);\r\n    }\r\n    getFolderPath() {\r\n        return this.state.folderPath;\r\n    }\r\n    getFolderPathStepNames() {\r\n        return this.state.folderPath.map(stepId => {\r\n            return this.definitionWalker.getById(this.state.definition, stepId).name;\r\n        });\r\n    }\r\n}\n\nclass DragStepView {\r\n    static create(step, theme, componentContext) {\r\n        var _a;\r\n        const body = (_a = componentContext.shadowRoot) !== null && _a !== void 0 ? _a : document.body;\r\n        const layer = Dom.element('div', {\r\n            class: `sqd-drag sqd-theme-${theme}`\r\n        });\r\n        body.appendChild(layer);\r\n        const component = componentContext.services.draggedComponent.create(layer, step, componentContext);\r\n        return new DragStepView(component, layer, body);\r\n    }\r\n    constructor(component, layer, body) {\r\n        this.component = component;\r\n        this.layer = layer;\r\n        this.body = body;\r\n    }\r\n    setPosition(position) {\r\n        this.layer.style.top = position.y + 'px';\r\n        this.layer.style.left = position.x + 'px';\r\n    }\r\n    remove() {\r\n        this.component.destroy();\r\n        this.body.removeChild(this.layer);\r\n    }\r\n}\n\nclass PlaceholderFinder {\r\n    static create(placeholders, state) {\r\n        const checker = new PlaceholderFinder(placeholders, state);\r\n        state.onViewportChanged.subscribe(checker.clearCache);\r\n        window.addEventListener('scroll', checker.clearCache, false);\r\n        return checker;\r\n    }\r\n    constructor(placeholders, state) {\r\n        this.placeholders = placeholders;\r\n        this.state = state;\r\n        this.clearCache = () => {\r\n            this.cache = undefined;\r\n        };\r\n    }\r\n    find(vLt, vWidth, vHeight) {\r\n        var _a;\r\n        if (!this.cache) {\r\n            const scroll = new Vector(window.scrollX, window.scrollY);\r\n            this.cache = this.placeholders.map(placeholder => {\r\n                const rect = placeholder.getClientRect();\r\n                return {\r\n                    placeholder,\r\n                    lt: new Vector(rect.x, rect.y).add(scroll),\r\n                    br: new Vector(rect.x + rect.width, rect.y + rect.height).add(scroll)\r\n                };\r\n            });\r\n            this.cache.sort((a, b) => a.lt.y - b.lt.y);\r\n        }\r\n        const vR = vLt.x + vWidth;\r\n        const vB = vLt.y + vHeight;\r\n        return (_a = this.cache.find(p => {\r\n            return Math.max(vLt.x, p.lt.x) < Math.min(vR, p.br.x) && Math.max(vLt.y, p.lt.y) < Math.min(vB, p.br.y);\r\n        })) === null || _a === void 0 ? void 0 : _a.placeholder;\r\n    }\r\n    destroy() {\r\n        this.state.onViewportChanged.unsubscribe(this.clearCache);\r\n        window.removeEventListener('scroll', this.clearCache, false);\r\n    }\r\n}\n\nclass DragStepBehavior {\r\n    static create(designerContext, step, draggedStepComponent) {\r\n        const view = DragStepView.create(step, designerContext.theme, designerContext.componentContext);\r\n        return new DragStepBehavior(view, designerContext.workspaceController, designerContext.placeholderController, designerContext.state, step, designerContext.stateModifier, draggedStepComponent);\r\n    }\r\n    constructor(view, workspaceController, placeholderController, designerState, step, stateModifier, draggedStepComponent) {\r\n        this.view = view;\r\n        this.workspaceController = workspaceController;\r\n        this.placeholderController = placeholderController;\r\n        this.designerState = designerState;\r\n        this.step = step;\r\n        this.stateModifier = stateModifier;\r\n        this.draggedStepComponent = draggedStepComponent;\r\n    }\r\n    onStart(position) {\r\n        let offset = null;\r\n        if (this.draggedStepComponent) {\r\n            this.draggedStepComponent.setIsDisabled(true);\r\n            this.draggedStepComponent.setIsDragging(true);\r\n            const hasSameSize = this.draggedStepComponent.view.width === this.view.component.width &&\r\n                this.draggedStepComponent.view.height === this.view.component.height;\r\n            if (hasSameSize) {\r\n                // Mouse cursor will be positioned on the same place as the source component.\r\n                const pagePosition = this.draggedStepComponent.view.getClientPosition();\r\n                offset = position.subtract(pagePosition);\r\n            }\r\n        }\r\n        if (!offset) {\r\n            // Mouse cursor will be positioned in the center of the component.\r\n            offset = new Vector(this.view.component.width, this.view.component.height).divideByScalar(2);\r\n        }\r\n        this.view.setPosition(position.subtract(offset));\r\n        this.designerState.setIsDragging(true);\r\n        const { placeholders, components } = this.resolvePlaceholders(this.draggedStepComponent);\r\n        this.state = {\r\n            placeholders,\r\n            components,\r\n            startPosition: position,\r\n            finder: PlaceholderFinder.create(placeholders, this.designerState),\r\n            offset\r\n        };\r\n        placeholders.forEach(placeholder => placeholder.setIsVisible(true));\r\n        components.forEach(component => component.setIsDragging(true));\r\n    }\r\n    onMove(delta) {\r\n        if (this.state) {\r\n            const newPosition = this.state.startPosition.subtract(delta).subtract(this.state.offset);\r\n            this.view.setPosition(newPosition);\r\n            const placeholder = this.state.finder.find(newPosition, this.view.component.width, this.view.component.height);\r\n            if (this.currentPlaceholder !== placeholder) {\r\n                if (this.currentPlaceholder) {\r\n                    this.currentPlaceholder.setIsHover(false);\r\n                }\r\n                if (placeholder) {\r\n                    placeholder.setIsHover(true);\r\n                }\r\n                this.currentPlaceholder = placeholder;\r\n            }\r\n        }\r\n    }\r\n    onEnd(interrupt) {\r\n        if (!this.state) {\r\n            throw new Error('Invalid state');\r\n        }\r\n        this.state.placeholders.forEach(placeholder => placeholder.setIsVisible(false));\r\n        this.state.components.forEach(component => component.setIsDragging(false));\r\n        this.state.finder.destroy();\r\n        this.state = undefined;\r\n        this.view.remove();\r\n        this.designerState.setIsDragging(false);\r\n        let modified = false;\r\n        if (!interrupt && this.currentPlaceholder) {\r\n            if (this.draggedStepComponent) {\r\n                modified = this.stateModifier.tryMove(this.draggedStepComponent.parentSequence, this.draggedStepComponent.step, this.currentPlaceholder.parentSequence, this.currentPlaceholder.index);\r\n            }\r\n            else {\r\n                modified = this.stateModifier.tryInsert(this.step, this.currentPlaceholder.parentSequence, this.currentPlaceholder.index);\r\n            }\r\n        }\r\n        if (!modified) {\r\n            if (this.draggedStepComponent) {\r\n                this.draggedStepComponent.setIsDisabled(false);\r\n                this.draggedStepComponent.setIsDragging(false);\r\n            }\r\n            if (this.currentPlaceholder) {\r\n                this.currentPlaceholder.setIsHover(false);\r\n            }\r\n        }\r\n        this.currentPlaceholder = undefined;\r\n    }\r\n    resolvePlaceholders(skipComponent) {\r\n        const result = this.workspaceController.resolvePlaceholders(skipComponent);\r\n        if (this.placeholderController.canShow) {\r\n            const canShow = this.placeholderController.canShow;\r\n            result.placeholders = result.placeholders.filter(placeholder => canShow(placeholder.parentSequence, placeholder.index, this.step.componentType, this.step.type));\r\n        }\r\n        return result;\r\n    }\r\n}\n\nclass ToolboxApi {\r\n    constructor(state, designerContext, behaviorController, toolboxDataProvider, uidGenerator) {\r\n        this.state = state;\r\n        this.designerContext = designerContext;\r\n        this.behaviorController = behaviorController;\r\n        this.toolboxDataProvider = toolboxDataProvider;\r\n        this.uidGenerator = uidGenerator;\r\n    }\r\n    isCollapsed() {\r\n        return this.state.isToolboxCollapsed;\r\n    }\r\n    toggleIsCollapsed() {\r\n        this.state.setIsToolboxCollapsed(!this.state.isToolboxCollapsed);\r\n    }\r\n    subscribeIsCollapsed(listener) {\r\n        this.state.onIsToolboxCollapsedChanged.subscribe(listener);\r\n    }\r\n    getAllGroups() {\r\n        return this.toolboxDataProvider.getAllGroups();\r\n    }\r\n    applyFilter(allGroups, filter) {\r\n        return this.toolboxDataProvider.applyFilter(allGroups, filter);\r\n    }\r\n    /**\r\n     * @param position Mouse or touch position.\r\n     * @param step Step definition.\r\n     * @returns If started dragging returns true, otherwise returns false.\r\n     */\r\n    tryDrag(position, step) {\r\n        if (!this.state.isReadonly) {\r\n            const newStep = this.activateStep(step);\r\n            this.behaviorController.start(position, DragStepBehavior.create(this.designerContext, newStep));\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n    activateStep(step) {\r\n        const newStep = ObjectCloner.deepClone(step);\r\n        newStep.id = this.uidGenerator ? this.uidGenerator() : Uid.next();\r\n        return newStep;\r\n    }\r\n}\n\nconst regexp = /^[a-zA-Z][a-zA-Z0-9_-]+$/;\r\nclass StepTypeValidator {\r\n    static validate(type) {\r\n        if (!regexp.test(type)) {\r\n            throw new Error(`Step type \"${type}\" contains not allowed characters`);\r\n        }\r\n    }\r\n}\n\nclass ToolboxDataProvider {\r\n    constructor(iconProvider, i18n, configuration) {\r\n        this.iconProvider = iconProvider;\r\n        this.i18n = i18n;\r\n        this.configuration = configuration;\r\n        this.createItemData = (step) => {\r\n            StepTypeValidator.validate(step.type);\r\n            const iconUrl = this.iconProvider.getIconUrl(step);\r\n            const rawLabel = this.configuration && this.configuration.labelProvider ? this.configuration.labelProvider(step) : step.name;\r\n            const label = this.i18n(`toolbox.item.${step.type}.label`, rawLabel);\r\n            const description = this.configuration && this.configuration.descriptionProvider ? this.configuration.descriptionProvider(step) : label;\r\n            const lowerCaseLabel = label.toLowerCase();\r\n            return {\r\n                iconUrl,\r\n                label,\r\n                description,\r\n                lowerCaseLabel,\r\n                step\r\n            };\r\n        };\r\n    }\r\n    getAllGroups() {\r\n        if (!this.configuration) {\r\n            return [];\r\n        }\r\n        return this.configuration.groups.map(group => {\r\n            return {\r\n                name: group.name,\r\n                items: group.steps.map(this.createItemData)\r\n            };\r\n        });\r\n    }\r\n    applyFilter(allGroups, filter) {\r\n        if (!filter) {\r\n            return allGroups;\r\n        }\r\n        const lowerCaseFilter = filter.toLowerCase();\r\n        return allGroups\r\n            .map(group => {\r\n            return {\r\n                name: group.name,\r\n                items: group.items.filter(s => {\r\n                    return s.lowerCaseLabel.includes(lowerCaseFilter);\r\n                })\r\n            };\r\n        })\r\n            .filter(group => group.items.length > 0);\r\n    }\r\n}\n\nfunction animate(interval, handler) {\r\n    const iv = setInterval(tick, 15);\r\n    const startTime = Date.now();\r\n    const anim = {\r\n        isAlive: true,\r\n        stop: () => {\r\n            anim.isAlive = false;\r\n            clearInterval(iv);\r\n        }\r\n    };\r\n    function tick() {\r\n        const progress = Math.min((Date.now() - startTime) / interval, 1);\r\n        handler(progress);\r\n        if (progress === 1) {\r\n            anim.stop();\r\n        }\r\n    }\r\n    return anim;\r\n}\n\nclass ViewportAnimator {\r\n    constructor(state) {\r\n        this.state = state;\r\n    }\r\n    execute(target) {\r\n        if (this.animation && this.animation.isAlive) {\r\n            this.animation.stop();\r\n        }\r\n        const startPosition = this.state.viewport.position;\r\n        const startScale = this.state.viewport.scale;\r\n        const deltaPosition = startPosition.subtract(target.position);\r\n        const deltaScale = startScale - target.scale;\r\n        this.animation = animate(150, progress => {\r\n            const newScale = startScale - deltaScale * progress;\r\n            this.state.setViewport({\r\n                position: startPosition.subtract(deltaPosition.multiplyByScalar(progress)),\r\n                scale: newScale\r\n            });\r\n        });\r\n    }\r\n}\n\nclass ZoomByWheelCalculator {\r\n    static calculate(controller, current, canvasPosition, e) {\r\n        if (e.deltaY === 0) {\r\n            return null;\r\n        }\r\n        const nextScale = controller.getNextScale(current.scale, e.deltaY < 0);\r\n        let scale;\r\n        const absDeltaY = Math.abs(e.deltaY);\r\n        if (absDeltaY < controller.smoothDeltaYLimit) {\r\n            const fraction = absDeltaY / controller.smoothDeltaYLimit;\r\n            const step = nextScale.next - nextScale.current;\r\n            scale = current.scale + step * fraction;\r\n        }\r\n        else {\r\n            scale = nextScale.next;\r\n        }\r\n        const mousePoint = new Vector(e.pageX, e.pageY).subtract(canvasPosition);\r\n        // The real point is point on canvas with no scale.\r\n        const mouseRealPoint = mousePoint.divideByScalar(current.scale).subtract(current.position.divideByScalar(current.scale));\r\n        const position = mouseRealPoint.multiplyByScalar(-scale).add(mousePoint);\r\n        return { position, scale };\r\n    }\r\n}\n\nclass ViewportApi {\r\n    constructor(state, workspaceController, viewportController) {\r\n        this.state = state;\r\n        this.workspaceController = workspaceController;\r\n        this.viewportController = viewportController;\r\n        this.animator = new ViewportAnimator(this.state);\r\n    }\r\n    limitScale(scale) {\r\n        return this.viewportController.limitScale(scale);\r\n    }\r\n    resetViewport() {\r\n        const defaultViewport = this.viewportController.getDefault();\r\n        this.state.setViewport(defaultViewport);\r\n    }\r\n    zoom(direction) {\r\n        const viewport = this.viewportController.getZoomed(direction);\r\n        if (viewport) {\r\n            this.state.setViewport(viewport);\r\n        }\r\n    }\r\n    moveViewportToStep(stepId) {\r\n        const component = this.workspaceController.getComponentByStepId(stepId);\r\n        const canvasPosition = this.workspaceController.getCanvasPosition();\r\n        const clientPosition = component.view.getClientPosition();\r\n        const componentPosition = clientPosition.subtract(canvasPosition);\r\n        const componentSize = new Vector(component.view.width, component.view.height);\r\n        const viewport = this.viewportController.getFocusedOnComponent(componentPosition, componentSize);\r\n        this.animator.execute(viewport);\r\n    }\r\n    handleWheelEvent(e) {\r\n        const canvasPosition = this.workspaceController.getCanvasPosition();\r\n        const newViewport = ZoomByWheelCalculator.calculate(this.viewportController, this.state.viewport, canvasPosition, e);\r\n        if (newViewport) {\r\n            this.state.setViewport(newViewport);\r\n        }\r\n    }\r\n}\n\nclass WorkspaceApi {\r\n    constructor(state, definitionWalker, workspaceController) {\r\n        this.state = state;\r\n        this.definitionWalker = definitionWalker;\r\n        this.workspaceController = workspaceController;\r\n    }\r\n    getViewport() {\r\n        return this.state.viewport;\r\n    }\r\n    setViewport(viewport) {\r\n        this.state.setViewport(viewport);\r\n    }\r\n    getCanvasPosition() {\r\n        return this.workspaceController.getCanvasPosition();\r\n    }\r\n    getCanvasSize() {\r\n        return this.workspaceController.getCanvasSize();\r\n    }\r\n    getRootComponentSize() {\r\n        return this.workspaceController.getRootComponentSize();\r\n    }\r\n    updateRootComponent() {\r\n        this.workspaceController.updateRootComponent();\r\n    }\r\n    updateBadges() {\r\n        this.workspaceController.updateBadges();\r\n    }\r\n    updateCanvasSize() {\r\n        this.workspaceController.updateCanvasSize();\r\n    }\r\n    getRootSequence() {\r\n        const stepId = this.state.tryGetLastStepIdFromFolderPath();\r\n        if (stepId) {\r\n            const parentStep = this.definitionWalker.getParentSequence(this.state.definition, stepId);\r\n            const children = this.definitionWalker.getChildren(parentStep.step);\r\n            if (!children || children.type !== StepChildrenType.sequence) {\r\n                throw new Error('Cannot find single sequence in folder step');\r\n            }\r\n            return {\r\n                sequence: children.items,\r\n                parentStep\r\n            };\r\n        }\r\n        return {\r\n            sequence: this.state.definition.sequence,\r\n            parentStep: null\r\n        };\r\n    }\r\n}\n\nclass DesignerApi {\r\n    static create(context) {\r\n        const workspace = new WorkspaceApi(context.state, context.definitionWalker, context.workspaceController);\r\n        const viewportController = context.services.viewportController.create(workspace);\r\n        const toolboxDataProvider = new ToolboxDataProvider(context.componentContext.iconProvider, context.i18n, context.configuration.toolbox);\r\n        return new DesignerApi(context.configuration.shadowRoot, ControlBarApi.create(context.state, context.historyController, context.stateModifier), new ToolboxApi(context.state, context, context.behaviorController, toolboxDataProvider, context.configuration.uidGenerator), new EditorApi(context.state, context.definitionWalker, context.stateModifier), workspace, new ViewportApi(context.state, context.workspaceController, viewportController), new PathBarApi(context.state, context.definitionWalker), context.definitionWalker, context.i18n);\r\n    }\r\n    constructor(shadowRoot, controlBar, toolbox, editor, workspace, viewport, pathBar, definitionWalker, i18n) {\r\n        this.shadowRoot = shadowRoot;\r\n        this.controlBar = controlBar;\r\n        this.toolbox = toolbox;\r\n        this.editor = editor;\r\n        this.workspace = workspace;\r\n        this.viewport = viewport;\r\n        this.pathBar = pathBar;\r\n        this.definitionWalker = definitionWalker;\r\n        this.i18n = i18n;\r\n    }\r\n}\n\nconst TYPE = 'selectStep';\r\nclass SelectStepBehaviorEndToken {\r\n    static is(token) {\r\n        return Boolean(token) && token.type === TYPE;\r\n    }\r\n    constructor(stepId, time) {\r\n        this.stepId = stepId;\r\n        this.time = time;\r\n        this.type = TYPE;\r\n    }\r\n}\n\nconst BADGE_GAP = 4;\r\nclass DefaultBadgesDecorator {\r\n    constructor(position, badges, g) {\r\n        this.position = position;\r\n        this.badges = badges;\r\n        this.g = g;\r\n    }\r\n    update() {\r\n        let offsetX = 0;\r\n        let maxHeight = 0;\r\n        let j = 0;\r\n        for (let i = 0; i < this.badges.length; i++) {\r\n            const badge = this.badges[i];\r\n            if (badge && badge.view) {\r\n                offsetX += j === 0 ? badge.view.width / 2 : badge.view.width;\r\n                maxHeight = Math.max(maxHeight, badge.view.height);\r\n                Dom.translate(badge.view.g, -offsetX, 0);\r\n                offsetX += BADGE_GAP;\r\n                j++;\r\n            }\r\n        }\r\n        Dom.translate(this.g, this.position.x, this.position.y + -maxHeight / 2);\r\n    }\r\n}\n\nclass Badges {\r\n    static createForStep(stepContext, view, componentContext) {\r\n        var _a, _b;\r\n        let g;\r\n        if (stepContext.step.properties.badge) {\r\n            g = createG(view.g, (_b = (_a = stepContext === null || stepContext === void 0 ? void 0 : stepContext.step) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.badge);\r\n        }\r\n        else {\r\n            g = createG(view.g);\r\n        }\r\n        const badges = componentContext.services.badges.map(ext => ext.createForStep(g, view, stepContext, componentContext));\r\n        const decorator = componentContext.services.stepBadgesDecorator.create(g, view, badges);\r\n        return new Badges(badges, decorator);\r\n    }\r\n    static createForRoot(parentElement, position, componentContext) {\r\n        const g = createG(parentElement);\r\n        const badges = componentContext.services.badges.map(ext => {\r\n            return ext.createForRoot ? ext.createForRoot(g, componentContext) : null;\r\n        });\r\n        const decorator = new DefaultBadgesDecorator(position, badges, g);\r\n        return new Badges(badges, decorator);\r\n    }\r\n    constructor(badges, decorator) {\r\n        this.badges = badges;\r\n        this.decorator = decorator;\r\n    }\r\n    update(result) {\r\n        const count = this.badges.length;\r\n        for (let i = 0; i < count; i++) {\r\n            const badge = this.badges[i];\r\n            if (badge) {\r\n                result[i] = badge.update(result[i]);\r\n            }\r\n        }\r\n        this.decorator.update();\r\n    }\r\n    resolveClick(click) {\r\n        for (const badge of this.badges) {\r\n            const command = badge && badge.resolveClick(click);\r\n            if (command) {\r\n                return command;\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n}\r\nfunction createG(parentElement, badge) {\r\n    const g = Dom.svg('g', {\r\n        class: 'sqd-badges'\r\n    });\r\n    if ((badge === null || badge === void 0 ? void 0 : badge.type) === 'text') {\r\n        const text = Dom.svg('text', {\r\n            x: 0,\r\n            y: 12,\r\n            fill: 'black',\r\n            'font-size': 12\r\n        });\r\n        text.textContent = 'Hello';\r\n        g.appendChild(text);\r\n    }\r\n    else if ((badge === null || badge === void 0 ? void 0 : badge.type) === 'icon') {\r\n        const checkGroup = Dom.svg('g', {\r\n            transform: 'translate(-10, -10)'\r\n        });\r\n        let skipCircle = false;\r\n        let content = null;\r\n        let circleColor = '#ccc';\r\n        switch (badge === null || badge === void 0 ? void 0 : badge.value) {\r\n            case 'Created':\r\n            case 'Running':\r\n            case 'Pending': {\r\n                skipCircle = true;\r\n                const spinnerGroup = Dom.svg('g', { transform: 'translate(0, 0)' });\r\n                const bg = Dom.svg('circle', {\r\n                    cx: 10,\r\n                    cy: 10,\r\n                    r: 10,\r\n                    fill: '#fff8e1'\r\n                });\r\n                const ring = Dom.svg('circle', {\r\n                    cx: 10,\r\n                    cy: 10,\r\n                    r: 7,\r\n                    fill: 'none',\r\n                    stroke: '#ffc107',\r\n                    'stroke-width': 2,\r\n                    'stroke-dasharray': '15,5'\r\n                });\r\n                ring.appendChild(Dom.svg('animateTransform', {\r\n                    attributeName: 'transform',\r\n                    attributeType: 'XML',\r\n                    type: 'rotate',\r\n                    from: '0 10 10',\r\n                    to: '360 10 10',\r\n                    dur: '1s',\r\n                    repeatCount: 'indefinite'\r\n                }));\r\n                spinnerGroup.appendChild(bg);\r\n                spinnerGroup.appendChild(ring);\r\n                content = spinnerGroup;\r\n                break;\r\n            }\r\n            case 'Warning': {\r\n                skipCircle = true;\r\n                const triangle = Dom.svg('path', {\r\n                    d: 'M10 0 L22 20 H-2 Z',\r\n                    fill: '#ffc107',\r\n                    stroke: '#ff9800',\r\n                    'stroke-width': 1\r\n                });\r\n                const exclamation = Dom.svg('text', {\r\n                    x: 8,\r\n                    y: 17,\r\n                    fill: '#000',\r\n                    'font-size': 13,\r\n                    'font-weight': 'bold',\r\n                    'font-family': 'Arial, sans-serif'\r\n                });\r\n                exclamation.textContent = '!';\r\n                checkGroup.appendChild(triangle);\r\n                checkGroup.appendChild(exclamation);\r\n                break;\r\n            }\r\n            case 'Completed': {\r\n                circleColor = '#d4edda';\r\n                const path = Dom.svg('path', {\r\n                    d: 'M5 10 L9 14 L15 6',\r\n                    stroke: '#28a745',\r\n                    'stroke-width': 2,\r\n                    fill: 'none'\r\n                });\r\n                content = path;\r\n                break;\r\n            }\r\n            case 'Failed': {\r\n                circleColor = '#EE0033';\r\n                const path = Dom.svg('path', {\r\n                    d: 'M6 6 L14 14 M14 6 L6 14',\r\n                    stroke: '#FFF',\r\n                    'stroke-width': 2,\r\n                    fill: 'none'\r\n                });\r\n                content = path;\r\n                break;\r\n            }\r\n            case 'Aborted': {\r\n                circleColor = '#e2e3e5';\r\n                const path = Dom.svg('path', {\r\n                    d: 'M6 6 L14 14 M14 6 L6 14',\r\n                    stroke: '#6c757d',\r\n                    'stroke-width': 2,\r\n                    fill: 'none'\r\n                });\r\n                content = path;\r\n                break;\r\n            }\r\n        }\r\n        if (!skipCircle) {\r\n            checkGroup.appendChild(Dom.svg('circle', {\r\n                cx: 10,\r\n                cy: 10,\r\n                r: 10,\r\n                fill: circleColor\r\n            }));\r\n        }\r\n        if (content) {\r\n            checkGroup.appendChild(content);\r\n        }\r\n        g.appendChild(checkGroup);\r\n    }\r\n    parentElement.appendChild(g);\r\n    return g;\r\n}\n\nclass ValidationErrorBadgeView {\r\n    static create(parent, cfg) {\r\n        const g = Dom.svg('g');\r\n        const halfOfSize = cfg.size / 2;\r\n        const circle = Dom.svg('path', {\r\n            class: 'sqd-validation-error',\r\n            d: `M 0 ${-halfOfSize} l ${halfOfSize} ${cfg.size} l ${-cfg.size} 0 Z`\r\n        });\r\n        Dom.translate(circle, halfOfSize, halfOfSize);\r\n        g.appendChild(circle);\r\n        const icon = Icons.appendPath(g, 'sqd-validation-error-icon-path', Icons.alert, cfg.iconSize);\r\n        const offsetX = (cfg.size - cfg.iconSize) / 2;\r\n        const offsetY = offsetX * 1.5;\r\n        Dom.translate(icon, offsetX, offsetY);\r\n        parent.appendChild(g);\r\n        return new ValidationErrorBadgeView(parent, g, cfg.size, cfg.size);\r\n    }\r\n    constructor(parent, g, width, height) {\r\n        this.parent = parent;\r\n        this.g = g;\r\n        this.width = width;\r\n        this.height = height;\r\n    }\r\n    destroy() {\r\n        this.parent.removeChild(this.g);\r\n    }\r\n}\n\nclass ValidatorFactory {\r\n    static createForStep(stepContext, view, componentContext) {\r\n        return () => {\r\n            if (!componentContext.validator.validateStep(stepContext.step, stepContext.parentSequence)) {\r\n                return false;\r\n            }\r\n            if (view.haveCollapsedChildren) {\r\n                let allChildrenValid = true;\r\n                componentContext.definitionWalker.forEachChildren(stepContext.step, (step, _, parentSequence) => {\r\n                    if (!componentContext.validator.validateStep(step, parentSequence)) {\r\n                        allChildrenValid = false;\r\n                        return false;\r\n                    }\r\n                });\r\n                if (!allChildrenValid) {\r\n                    return false;\r\n                }\r\n            }\r\n            return true;\r\n        };\r\n    }\r\n    static createForRoot(componentContext) {\r\n        return () => {\r\n            return componentContext.validator.validateRoot();\r\n        };\r\n    }\r\n}\n\nclass ValidationErrorBadge {\r\n    static createForStep(parentElement, view, stepContext, componentContext, configuration) {\r\n        const validator = ValidatorFactory.createForStep(stepContext, view, componentContext);\r\n        return new ValidationErrorBadge(parentElement, validator, configuration);\r\n    }\r\n    static createForRoot(parentElement, componentContext, configuration) {\r\n        const validator = ValidatorFactory.createForRoot(componentContext);\r\n        return new ValidationErrorBadge(parentElement, validator, configuration);\r\n    }\r\n    constructor(parentElement, validator, configuration) {\r\n        this.parentElement = parentElement;\r\n        this.validator = validator;\r\n        this.configuration = configuration;\r\n        this.view = null;\r\n    }\r\n    update(result) {\r\n        const isValid = this.validator();\r\n        if (isValid) {\r\n            if (this.view) {\r\n                this.view.destroy();\r\n                this.view = null;\r\n            }\r\n        }\r\n        else if (!this.view) {\r\n            this.view = ValidationErrorBadgeView.create(this.parentElement, this.configuration);\r\n        }\r\n        return isValid && result;\r\n    }\r\n    resolveClick() {\r\n        return null;\r\n    }\r\n}\n\nconst defaultConfiguration$7 = {\r\n    view: {\r\n        size: 22,\r\n        iconSize: 12\r\n    }\r\n};\r\nclass ValidationErrorBadgeExtension {\r\n    static create(configuration) {\r\n        return new ValidationErrorBadgeExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$7);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n        this.id = 'validationError';\r\n        this.createStartValue = () => true;\r\n    }\r\n    createForStep(parentElement, view, stepContext, componentContext) {\r\n        return ValidationErrorBadge.createForStep(parentElement, view, stepContext, componentContext, this.configuration.view);\r\n    }\r\n    createForRoot(parentElement, componentContext) {\r\n        return ValidationErrorBadge.createForRoot(parentElement, componentContext, this.configuration.view);\r\n    }\r\n}\n\nclass ComponentDom {\r\n    static stepG(componentClassName, type, id) {\r\n        return Dom.svg('g', {\r\n            class: `sqd-step-${componentClassName} sqd-type-${type}`,\r\n            'data-step-id': id\r\n        });\r\n    }\r\n}\n\nclass InputView {\r\n    static createRectInput(parent, x, y, size, radius, iconSize, iconUrl) {\r\n        const g = Dom.svg('g');\r\n        parent.appendChild(g);\r\n        const rect = Dom.svg('rect', {\r\n            class: 'sqd-input',\r\n            width: size,\r\n            height: size,\r\n            x: x - size / 2,\r\n            y: y + size / -2 + 0.5,\r\n            rx: radius,\r\n            ry: radius\r\n        });\r\n        g.appendChild(rect);\r\n        if (iconUrl) {\r\n            const icon = Dom.svg('image', {\r\n                href: iconUrl,\r\n                width: iconSize,\r\n                height: iconSize,\r\n                x: x - iconSize / 2,\r\n                y: y + iconSize / -2\r\n            });\r\n            g.appendChild(icon);\r\n        }\r\n        return new InputView(g);\r\n    }\r\n    static createRoundInput(parent, x, y, size) {\r\n        const circle = Dom.svg('circle', {\r\n            class: 'sqd-input',\r\n            cx: x,\r\n            xy: y,\r\n            r: size / 2\r\n        });\r\n        parent.appendChild(circle);\r\n        return new InputView(circle);\r\n    }\r\n    constructor(g) {\r\n        this.g = g;\r\n    }\r\n    setIsHidden(isHidden) {\r\n        Dom.attrs(this.g, {\r\n            visibility: isHidden ? 'hidden' : 'visible'\r\n        });\r\n    }\r\n}\n\nconst EPS = 0.5; // Epsilon, a tiny offset to avoid rendering issues\r\nclass JoinView {\r\n    static createStraightJoin(parent, start, height) {\r\n        const dy = Math.sign(height);\r\n        const join = Dom.svg('line', {\r\n            class: 'sqd-join',\r\n            x1: start.x,\r\n            y1: start.y - EPS * dy,\r\n            x2: start.x,\r\n            y2: start.y + height + EPS * dy\r\n        });\r\n        parent.insertBefore(join, parent.firstChild);\r\n    }\r\n    static createJoins(parent, start, targets) {\r\n        const firstTarget = targets[0];\r\n        const h = Math.abs(firstTarget.y - start.y) / 2; // half height\r\n        const dy = Math.sign(firstTarget.y - start.y); // direction y\r\n        switch (targets.length) {\r\n            case 1:\r\n                if (start.x === targets[0].x) {\r\n                    JoinView.createStraightJoin(parent, start, firstTarget.y * dy);\r\n                }\r\n                else {\r\n                    appendCurvedJoins(parent, start, targets, h, dy);\r\n                }\r\n                break;\r\n            case 2:\r\n                appendCurvedJoins(parent, start, targets, h, dy);\r\n                break;\r\n            default:\r\n                {\r\n                    const f = targets[0]; // first\r\n                    const l = targets[targets.length - 1]; // last\r\n                    const eps = EPS * dy;\r\n                    appendJoin(parent, `M ${f.x} ${f.y + eps} l 0 ${-eps} q ${h * 0.3} ${h * -dy * 0.8} ${h} ${h * -dy} ` +\r\n                        `l ${l.x - f.x - h * 2} 0 q ${h * 0.8} ${-h * -dy * 0.3} ${h} ${-h * -dy} l 0 ${eps}`);\r\n                    for (let i = 1; i < targets.length - 1; i++) {\r\n                        JoinView.createStraightJoin(parent, targets[i], h * -dy);\r\n                    }\r\n                    JoinView.createStraightJoin(parent, start, h * dy);\r\n                }\r\n                break;\r\n        }\r\n    }\r\n}\r\nfunction appendCurvedJoins(parent, start, targets, h, dy) {\r\n    const eps = EPS * dy;\r\n    for (const target of targets) {\r\n        const l = Math.abs(target.x - start.x) - h * 2; // straight line length\r\n        const dx = Math.sign(target.x - start.x); // direction x\r\n        appendJoin(parent, `M ${start.x} ${start.y - eps} l 0 ${eps} q ${dx * h * 0.3} ${dy * h * 0.8} ${dx * h} ${dy * h} ` +\r\n            `l ${dx * l} 0 q ${dx * h * 0.7} ${dy * h * 0.2} ${dx * h} ${dy * h} l 0 ${eps}`);\r\n    }\r\n}\r\nfunction appendJoin(parent, d) {\r\n    const join = Dom.svg('path', {\r\n        class: 'sqd-join',\r\n        fill: 'none',\r\n        d\r\n    });\r\n    parent.insertBefore(join, parent.firstChild);\r\n}\n\nclass LabelView {\r\n    static create(parent, y, cfg, text, theme) {\r\n        const g = Dom.svg('g', {\r\n            class: `sqd-label sqd-label-${theme}`\r\n        });\r\n        parent.appendChild(g);\r\n        const nameText = Dom.svg('text', {\r\n            class: 'sqd-label-text',\r\n            y: y + cfg.height / 2\r\n        });\r\n        nameText.textContent = text;\r\n        g.appendChild(nameText);\r\n        const width = Math.max(nameText.getBBox().width + cfg.paddingX * 2, cfg.minWidth);\r\n        const nameRect = Dom.svg('rect', {\r\n            class: 'sqd-label-rect',\r\n            width: width,\r\n            height: cfg.height,\r\n            x: -width / 2 + 0.5,\r\n            y: y + 0.5,\r\n            rx: cfg.radius,\r\n            ry: cfg.radius\r\n        });\r\n        g.insertBefore(nameRect, nameText);\r\n        return new LabelView(g, width, cfg.height);\r\n    }\r\n    constructor(g, width, height) {\r\n        this.g = g;\r\n        this.width = width;\r\n        this.height = height;\r\n    }\r\n}\n\nclass OutputView {\r\n    static create(parent, x, y, size) {\r\n        const circle = Dom.svg('circle', {\r\n            class: 'sqd-output',\r\n            cx: x,\r\n            cy: y,\r\n            r: size / 2\r\n        });\r\n        parent.appendChild(circle);\r\n        return new OutputView(circle);\r\n    }\r\n    constructor(root) {\r\n        this.root = root;\r\n    }\r\n    setIsHidden(isHidden) {\r\n        Dom.attrs(this.root, {\r\n            visibility: isHidden ? 'hidden' : 'visible'\r\n        });\r\n    }\r\n}\n\nclass DefaultSequenceComponentView {\r\n    static create(parent, sequenceContext, componentContext) {\r\n        const phWidth = componentContext.services.placeholder.gapSize.x;\r\n        const phHeight = componentContext.services.placeholder.gapSize.y;\r\n        const { sequence } = sequenceContext;\r\n        const g = Dom.svg('g');\r\n        parent.appendChild(g);\r\n        const components = [];\r\n        for (let index = 0; index < sequence.length; index++) {\r\n            const stepContext = {\r\n                parentSequence: sequenceContext.sequence,\r\n                step: sequence[index],\r\n                depth: sequenceContext.depth,\r\n                position: index,\r\n                isInputConnected: index === 0 ? sequenceContext.isInputConnected : components[index - 1].hasOutput,\r\n                isOutputConnected: index === sequence.length - 1 ? sequenceContext.isOutputConnected : true,\r\n                isPreview: sequenceContext.isPreview\r\n            };\r\n            components[index] = componentContext.stepComponentFactory.create(g, stepContext, componentContext);\r\n        }\r\n        let joinX;\r\n        let totalWidth;\r\n        if (components.length > 0) {\r\n            const restWidth = Math.max(...components.map(c => c.view.width - c.view.joinX));\r\n            joinX = Math.max(...components.map(c => c.view.joinX));\r\n            totalWidth = joinX + restWidth;\r\n        }\r\n        else {\r\n            joinX = phWidth / 2;\r\n            totalWidth = phWidth;\r\n        }\r\n        let offsetY = phHeight;\r\n        const placeholders = [];\r\n        for (let i = 0; i < components.length; i++) {\r\n            const component = components[i];\r\n            const offsetX = joinX - component.view.joinX;\r\n            if ((i === 0 && sequenceContext.isInputConnected) || (i > 0 && components[i - 1].hasOutput)) {\r\n                JoinView.createStraightJoin(g, new Vector(joinX, offsetY - phHeight), phHeight);\r\n            }\r\n            if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, i)) {\r\n                const ph = componentContext.services.placeholder.createForGap(g, sequence, i);\r\n                Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);\r\n                placeholders.push(ph);\r\n            }\r\n            Dom.translate(component.view.g, offsetX, offsetY);\r\n            offsetY += component.view.height + phHeight;\r\n        }\r\n        if (sequenceContext.isOutputConnected && (components.length === 0 || components[components.length - 1].hasOutput)) {\r\n            JoinView.createStraightJoin(g, new Vector(joinX, offsetY - phHeight), phHeight);\r\n        }\r\n        const newIndex = components.length;\r\n        if (!sequenceContext.isPreview && componentContext.placeholderController.canCreate(sequence, newIndex)) {\r\n            const ph = componentContext.services.placeholder.createForGap(g, sequence, newIndex);\r\n            Dom.translate(ph.view.g, joinX - phWidth / 2, offsetY - phHeight);\r\n            placeholders.push(ph);\r\n        }\r\n        return new DefaultSequenceComponentView(g, totalWidth, offsetY, joinX, placeholders, components);\r\n    }\r\n    constructor(g, width, height, joinX, placeholders, components) {\r\n        this.g = g;\r\n        this.width = width;\r\n        this.height = height;\r\n        this.joinX = joinX;\r\n        this.placeholders = placeholders;\r\n        this.components = components;\r\n    }\r\n    hasOutput() {\r\n        if (this.components.length > 0) {\r\n            return this.components[this.components.length - 1].hasOutput;\r\n        }\r\n        return true;\r\n    }\r\n}\n\nclass DefaultSequenceComponent {\r\n    static create(parentElement, sequenceContext, context) {\r\n        const view = DefaultSequenceComponentView.create(parentElement, sequenceContext, context);\r\n        return new DefaultSequenceComponent(view, view.hasOutput());\r\n    }\r\n    constructor(view, hasOutput) {\r\n        this.view = view;\r\n        this.hasOutput = hasOutput;\r\n    }\r\n    resolveClick(click) {\r\n        for (const component of this.view.components) {\r\n            const result = component.resolveClick(click);\r\n            if (result) {\r\n                return result;\r\n            }\r\n        }\r\n        for (const placeholder of this.view.placeholders) {\r\n            const result = placeholder.resolveClick(click);\r\n            if (result) {\r\n                return result;\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n    findById(stepId) {\r\n        for (const component of this.view.components) {\r\n            const sc = component.findById(stepId);\r\n            if (sc) {\r\n                return sc;\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n    resolvePlaceholders(skipComponent, result) {\r\n        this.view.placeholders.forEach(placeholder => result.placeholders.push(placeholder));\r\n        this.view.components.forEach(c => c.resolvePlaceholders(skipComponent, result));\r\n    }\r\n    updateBadges(result) {\r\n        for (const component of this.view.components) {\r\n            component.updateBadges(result);\r\n        }\r\n    }\r\n}\n\nvar ClickCommandType;\r\n(function (ClickCommandType) {\r\n    ClickCommandType[ClickCommandType[\"selectStep\"] = 1] = \"selectStep\";\r\n    ClickCommandType[ClickCommandType[\"rerenderStep\"] = 2] = \"rerenderStep\";\r\n    ClickCommandType[ClickCommandType[\"openFolder\"] = 3] = \"openFolder\";\r\n    ClickCommandType[ClickCommandType[\"triggerCustomAction\"] = 4] = \"triggerCustomAction\";\r\n})(ClickCommandType || (ClickCommandType = {}));\r\nvar PlaceholderDirection;\r\n(function (PlaceholderDirection) {\r\n    PlaceholderDirection[PlaceholderDirection[\"none\"] = 0] = \"none\";\r\n    PlaceholderDirection[PlaceholderDirection[\"in\"] = 1] = \"in\";\r\n    PlaceholderDirection[PlaceholderDirection[\"out\"] = 2] = \"out\";\r\n})(PlaceholderDirection || (PlaceholderDirection = {}));\n\nclass StartStopRootComponentView {\r\n    static create(parent, sequence, parentPlaceIndicator, context, cfg) {\r\n        const g = Dom.svg('g', {\r\n            class: 'sqd-root-start-stop'\r\n        });\r\n        parent.appendChild(g);\r\n        const sequenceComponent = DefaultSequenceComponent.create(g, {\r\n            sequence,\r\n            depth: 0,\r\n            isInputConnected: true,\r\n            isOutputConnected: true,\r\n            isPreview: false\r\n        }, context);\r\n        const view = sequenceComponent.view;\r\n        const x = view.joinX - cfg.size / 2;\r\n        const endY = cfg.size + view.height;\r\n        const iconSize = parentPlaceIndicator ? cfg.folderIconSize : cfg.defaultIconSize;\r\n        const startCircle = createCircle('start', parentPlaceIndicator ? cfg.folderIconD : cfg.startIconD, cfg.size, iconSize);\r\n        Dom.translate(startCircle, x, 0);\r\n        g.appendChild(startCircle);\r\n        Dom.translate(view.g, 0, cfg.size);\r\n        const stopCircle = createCircle('stop', parentPlaceIndicator ? cfg.folderIconD : cfg.stopIconD, cfg.size, iconSize);\r\n        Dom.translate(stopCircle, x, endY);\r\n        g.appendChild(stopCircle);\r\n        let startPlaceholder = null;\r\n        let endPlaceholder = null;\r\n        if (parentPlaceIndicator) {\r\n            const size = new Vector(cfg.size, cfg.size);\r\n            startPlaceholder = context.services.placeholder.createForArea(g, size, PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);\r\n            endPlaceholder = context.services.placeholder.createForArea(g, size, PlaceholderDirection.out, parentPlaceIndicator.sequence, parentPlaceIndicator.index);\r\n            Dom.translate(startPlaceholder.view.g, x, 0);\r\n            Dom.translate(endPlaceholder.view.g, x, endY);\r\n        }\r\n        const badges = Badges.createForRoot(g, new Vector(x + cfg.size, 0), context);\r\n        return new StartStopRootComponentView(g, view.width, view.height + cfg.size * 2, view.joinX, sequenceComponent, startPlaceholder, endPlaceholder, badges);\r\n    }\r\n    constructor(g, width, height, joinX, component, startPlaceholder, endPlaceholder, badges) {\r\n        this.g = g;\r\n        this.width = width;\r\n        this.height = height;\r\n        this.joinX = joinX;\r\n        this.component = component;\r\n        this.startPlaceholder = startPlaceholder;\r\n        this.endPlaceholder = endPlaceholder;\r\n        this.badges = badges;\r\n    }\r\n    destroy() {\r\n        var _a;\r\n        (_a = this.g.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(this.g);\r\n    }\r\n}\r\nfunction createCircle(classSuffix, d, size, iconSize) {\r\n    const g = Dom.svg('g', {\r\n        class: 'sqd-root-start-stop-' + classSuffix\r\n    });\r\n    const r = size / 2;\r\n    const circle = Dom.svg('circle', {\r\n        class: 'sqd-root-start-stop-circle',\r\n        cx: r,\r\n        cy: r,\r\n        r: r\r\n    });\r\n    g.appendChild(circle);\r\n    const offset = (size - iconSize) / 2;\r\n    const icon = Icons.appendPath(g, 'sqd-root-start-stop-icon', d, iconSize);\r\n    Dom.translate(icon, offset, offset);\r\n    return g;\r\n}\n\nclass StartStopRootComponent {\r\n    static create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration) {\r\n        const view = StartStopRootComponentView.create(parentElement, sequence, parentPlaceIndicator, context, viewConfiguration);\r\n        return new StartStopRootComponent(view);\r\n    }\r\n    constructor(view) {\r\n        this.view = view;\r\n    }\r\n    resolveClick(click) {\r\n        return this.view.component.resolveClick(click);\r\n    }\r\n    findById(stepId) {\r\n        return this.view.component.findById(stepId);\r\n    }\r\n    resolvePlaceholders(skipComponent, result) {\r\n        this.view.component.resolvePlaceholders(skipComponent, result);\r\n        if (this.view.startPlaceholder && this.view.endPlaceholder) {\r\n            result.placeholders.push(this.view.startPlaceholder);\r\n            result.placeholders.push(this.view.endPlaceholder);\r\n        }\r\n    }\r\n    updateBadges(result) {\r\n        this.view.badges.update(result);\r\n        this.view.component.updateBadges(result);\r\n    }\r\n}\n\nconst defaultConfiguration$6 = {\r\n    view: {\r\n        size: 30,\r\n        defaultIconSize: 22,\r\n        folderIconSize: 18,\r\n        startIconD: Icons.play,\r\n        stopIconD: Icons.stop,\r\n        folderIconD: Icons.folder\r\n    }\r\n};\r\nclass StartStopRootComponentExtension {\r\n    static create(configuration) {\r\n        return new StartStopRootComponentExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$6);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n    }\r\n    create(parentElement, sequence, parentPlaceIndicator, context) {\r\n        return StartStopRootComponent.create(parentElement, sequence, parentPlaceIndicator, context, this.configuration.view);\r\n    }\r\n}\n\nconst COMPONENT_CLASS_NAME$2 = 'container';\r\nconst createContainerStepComponentViewFactory = (cfg) => (parentElement, stepContext, viewContext) => {\r\n    return viewContext.createRegionComponentView(parentElement, COMPONENT_CLASS_NAME$2, (g, regionViewBuilder) => {\r\n        const step = stepContext.step;\r\n        const name = viewContext.getStepName();\r\n        const labelView = LabelView.create(g, cfg.paddingTop, cfg.label, name, 'primary');\r\n        const sequenceComponent = viewContext.createSequenceComponent(g, step.sequence);\r\n        const halfOfWidestElement = labelView.width / 2;\r\n        const offsetLeft = Math.max(halfOfWidestElement - sequenceComponent.view.joinX, 0) + cfg.paddingX;\r\n        const offsetRight = Math.max(halfOfWidestElement - (sequenceComponent.view.width - sequenceComponent.view.joinX), 0) + cfg.paddingX;\r\n        const width = offsetLeft + sequenceComponent.view.width + offsetRight;\r\n        const height = cfg.paddingTop + cfg.label.height + sequenceComponent.view.height;\r\n        const joinX = sequenceComponent.view.joinX + offsetLeft;\r\n        Dom.translate(labelView.g, joinX, 0);\r\n        Dom.translate(sequenceComponent.view.g, offsetLeft, cfg.paddingTop + cfg.label.height);\r\n        let inputView = null;\r\n        if (cfg.inputSize > 0) {\r\n            const iconUrl = viewContext.getStepIconUrl();\r\n            inputView = InputView.createRectInput(g, joinX, 0, cfg.inputSize, cfg.inputRadius, cfg.inputIconSize, iconUrl);\r\n        }\r\n        JoinView.createStraightJoin(g, new Vector(joinX, 0), cfg.paddingTop);\r\n        const regionView = regionViewBuilder(g, [width], height);\r\n        return {\r\n            g,\r\n            width,\r\n            height,\r\n            joinX,\r\n            placeholders: null,\r\n            sequenceComponents: [sequenceComponent],\r\n            hasOutput: sequenceComponent.hasOutput,\r\n            getClientPosition() {\r\n                return regionView.getClientPosition();\r\n            },\r\n            resolveClick(click) {\r\n                const result = regionView.resolveClick(click);\r\n                return result === true || (result === null && g.contains(click.element)) ? true : result;\r\n            },\r\n            setIsDragging(isDragging) {\r\n                if (cfg.autoHideInputOnDrag && inputView) {\r\n                    inputView.setIsHidden(isDragging);\r\n                }\r\n            },\r\n            setIsSelected(isSelected) {\r\n                regionView.setIsSelected(isSelected);\r\n            },\r\n            setIsDisabled(isDisabled) {\r\n                Dom.toggleClass(g, isDisabled, 'sqd-disabled');\r\n            }\r\n        };\r\n    });\r\n};\n\nconst COMPONENT_CLASS_NAME$1 = 'switch';\r\nfunction createView(g, width, height, joinX, viewContext, sequenceComponents, regionView, cfg) {\r\n    let inputView = null;\r\n    if (cfg.inputSize > 0) {\r\n        const iconUrl = viewContext.getStepIconUrl();\r\n        inputView = InputView.createRectInput(g, joinX, cfg.paddingTop1, cfg.inputSize, cfg.inputRadius, cfg.inputIconSize, iconUrl);\r\n    }\r\n    return {\r\n        g,\r\n        width,\r\n        height,\r\n        joinX,\r\n        placeholders: null,\r\n        sequenceComponents,\r\n        hasOutput: sequenceComponents ? sequenceComponents.some(c => c.hasOutput) : true,\r\n        getClientPosition() {\r\n            return regionView.getClientPosition();\r\n        },\r\n        resolveClick(click) {\r\n            const result = regionView.resolveClick(click);\r\n            return result === true || (result === null && g.contains(click.element)) ? true : result;\r\n        },\r\n        setIsDragging(isDragging) {\r\n            if (cfg.autoHideInputOnDrag && inputView) {\r\n                inputView.setIsHidden(isDragging);\r\n            }\r\n        },\r\n        setIsSelected(isSelected) {\r\n            regionView.setIsSelected(isSelected);\r\n        },\r\n        setIsDisabled(isDisabled) {\r\n            Dom.toggleClass(g, isDisabled, 'sqd-disabled');\r\n        }\r\n    };\r\n}\r\nconst createSwitchStepComponentViewFactory = (cfg) => (parent, stepContext, viewContext) => {\r\n    return viewContext.createRegionComponentView(parent, COMPONENT_CLASS_NAME$1, (g, regionViewBuilder) => {\r\n        const step = stepContext.step;\r\n        const paddingTop = cfg.paddingTop1 + cfg.paddingTop2;\r\n        const name = viewContext.getStepName();\r\n        const nameLabelView = LabelView.create(g, paddingTop, cfg.nameLabel, name, 'primary');\r\n        const branchNames = Object.keys(step.branches);\r\n        if (branchNames.length === 0) {\r\n            const width = Math.max(nameLabelView.width, cfg.minBranchWidth) + cfg.paddingX * 2;\r\n            const height = nameLabelView.height + paddingTop + cfg.noBranchPaddingBottom;\r\n            const joinX = width / 2;\r\n            const regionView = regionViewBuilder(g, [width], height);\r\n            Dom.translate(nameLabelView.g, joinX, 0);\r\n            JoinView.createStraightJoin(g, new Vector(joinX, 0), height);\r\n            return createView(g, width, height, joinX, viewContext, null, regionView, cfg);\r\n        }\r\n        const branchComponents = [];\r\n        const branchLabelViews = [];\r\n        const branchSizes = [];\r\n        let totalBranchesWidth = 0;\r\n        let maxBranchesHeight = 0;\r\n        branchNames.forEach(branchName => {\r\n            const component = viewContext.createSequenceComponent(g, step.branches[branchName]);\r\n            const labelY = paddingTop + cfg.nameLabel.height + cfg.connectionHeight;\r\n            const translatedBranchName = viewContext.i18n(`stepComponent.${step.type}.branchName`, branchName);\r\n            const labelView = LabelView.create(g, labelY, cfg.branchNameLabel, translatedBranchName, 'secondary');\r\n            const halfOfWidestBranchElement = Math.max(labelView.width, cfg.minBranchWidth) / 2;\r\n            const branchOffsetLeft = Math.max(halfOfWidestBranchElement - component.view.joinX, 0) + cfg.paddingX;\r\n            const branchOffsetRight = Math.max(halfOfWidestBranchElement - (component.view.width - component.view.joinX), 0) + cfg.paddingX;\r\n            const width = component.view.width + branchOffsetLeft + branchOffsetRight;\r\n            const joinX = component.view.joinX + branchOffsetLeft;\r\n            const offsetX = totalBranchesWidth;\r\n            totalBranchesWidth += width;\r\n            maxBranchesHeight = Math.max(maxBranchesHeight, component.view.height);\r\n            branchComponents.push(component);\r\n            branchLabelViews.push(labelView);\r\n            branchSizes.push({ width, branchOffsetLeft, offsetX, joinX });\r\n        });\r\n        const centerBranchIndex = Math.floor(branchNames.length / 2);\r\n        const centerBranchSize = branchSizes[centerBranchIndex];\r\n        let joinX = centerBranchSize.offsetX;\r\n        if (branchNames.length % 2 !== 0) {\r\n            joinX += centerBranchSize.joinX;\r\n        }\r\n        const halfOfWidestSwitchElement = nameLabelView.width / 2 + cfg.paddingX;\r\n        const switchOffsetLeft = Math.max(halfOfWidestSwitchElement - joinX, 0);\r\n        const switchOffsetRight = Math.max(halfOfWidestSwitchElement - (totalBranchesWidth - joinX), 0);\r\n        const viewWidth = switchOffsetLeft + totalBranchesWidth + switchOffsetRight;\r\n        const viewHeight = maxBranchesHeight + paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight * 2;\r\n        const shiftedJoinX = switchOffsetLeft + joinX;\r\n        Dom.translate(nameLabelView.g, shiftedJoinX, 0);\r\n        const branchOffsetTop = paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight;\r\n        branchComponents.forEach((component, i) => {\r\n            const branchSize = branchSizes[i];\r\n            const branchOffsetLeft = switchOffsetLeft + branchSize.offsetX + branchSize.branchOffsetLeft;\r\n            Dom.translate(branchLabelViews[i].g, switchOffsetLeft + branchSize.offsetX + branchSize.joinX, 0);\r\n            Dom.translate(component.view.g, branchOffsetLeft, branchOffsetTop);\r\n            if (component.hasOutput && stepContext.isOutputConnected) {\r\n                const endOffsetTopOfComponent = paddingTop + cfg.nameLabel.height + cfg.branchNameLabel.height + cfg.connectionHeight + component.view.height;\r\n                const missingHeight = viewHeight - endOffsetTopOfComponent - cfg.connectionHeight;\r\n                if (missingHeight > 0) {\r\n                    JoinView.createStraightJoin(g, new Vector(switchOffsetLeft + branchSize.offsetX + branchSize.joinX, endOffsetTopOfComponent), missingHeight);\r\n                }\r\n            }\r\n        });\r\n        JoinView.createStraightJoin(g, new Vector(shiftedJoinX, 0), paddingTop);\r\n        JoinView.createJoins(g, new Vector(shiftedJoinX, paddingTop + cfg.nameLabel.height), branchSizes.map(s => new Vector(switchOffsetLeft + s.offsetX + s.joinX, paddingTop + cfg.nameLabel.height + cfg.connectionHeight)));\r\n        if (stepContext.isOutputConnected) {\r\n            const ongoingSequenceIndexes = branchComponents\r\n                .map((component, index) => (component.hasOutput ? index : null))\r\n                .filter(index => index !== null);\r\n            const ongoingJoinTargets = ongoingSequenceIndexes.map((i) => {\r\n                const branchSize = branchSizes[i];\r\n                return new Vector(switchOffsetLeft + branchSize.offsetX + branchSize.joinX, paddingTop + cfg.connectionHeight + cfg.nameLabel.height + cfg.branchNameLabel.height + maxBranchesHeight);\r\n            });\r\n            if (ongoingJoinTargets.length > 0) {\r\n                JoinView.createJoins(g, new Vector(shiftedJoinX, viewHeight), ongoingJoinTargets);\r\n            }\r\n        }\r\n        const regions = branchSizes.map(s => s.width);\r\n        regions[0] += switchOffsetLeft;\r\n        regions[regions.length - 1] += switchOffsetRight;\r\n        const regionView = regionViewBuilder(g, regions, viewHeight);\r\n        return createView(g, viewWidth, viewHeight, shiftedJoinX, viewContext, branchComponents, regionView, cfg);\r\n    });\r\n};\n\nconst COMPONENT_CLASS_NAME = 'task';\r\nconst createTaskStepComponentViewFactory = (isInterrupted, cfg) => (parentElement, stepContext, viewContext) => {\r\n    const { step } = stepContext;\r\n    const g = ComponentDom.stepG(COMPONENT_CLASS_NAME, step.type, step.id);\r\n    parentElement.appendChild(g);\r\n    const boxHeight = cfg.paddingY * 2 + cfg.iconSize;\r\n    const text = Dom.svg('text', {\r\n        x: cfg.paddingLeft + cfg.iconSize + cfg.textMarginLeft,\r\n        y: boxHeight / 2,\r\n        class: 'sqd-step-task-text'\r\n    });\r\n    text.textContent = viewContext.getStepName();\r\n    g.appendChild(text);\r\n    const textWidth = Math.max(text.getBBox().width, cfg.minTextWidth);\r\n    const boxWidth = cfg.iconSize + cfg.paddingLeft + cfg.paddingRight + cfg.textMarginLeft + textWidth;\r\n    const rect = Dom.svg('rect', {\r\n        x: 0.5,\r\n        y: 0.5,\r\n        class: 'sqd-step-task-rect',\r\n        width: boxWidth,\r\n        height: boxHeight,\r\n        rx: cfg.radius,\r\n        ry: cfg.radius\r\n    });\r\n    g.insertBefore(rect, text);\r\n    const iconUrl = viewContext.getStepIconUrl();\r\n    const icon = iconUrl\r\n        ? Dom.svg('image', {\r\n            href: iconUrl\r\n        })\r\n        : Dom.svg('rect', {\r\n            class: 'sqd-step-task-empty-icon',\r\n            rx: cfg.radius,\r\n            ry: cfg.radius\r\n        });\r\n    Dom.attrs(icon, {\r\n        x: cfg.paddingLeft,\r\n        y: cfg.paddingY,\r\n        width: cfg.iconSize,\r\n        height: cfg.iconSize\r\n    });\r\n    g.appendChild(icon);\r\n    const isInputViewHidden = stepContext.depth === 0 && stepContext.position === 0 && !stepContext.isInputConnected;\r\n    const isOutputViewHidden = isInterrupted;\r\n    const inputView = isInputViewHidden ? null : InputView.createRoundInput(g, boxWidth / 2, 0, cfg.inputSize);\r\n    const outputView = isOutputViewHidden ? null : OutputView.create(g, boxWidth / 2, boxHeight, cfg.outputSize);\r\n    return {\r\n        g,\r\n        width: boxWidth,\r\n        height: boxHeight,\r\n        joinX: boxWidth / 2,\r\n        sequenceComponents: null,\r\n        placeholders: null,\r\n        hasOutput: !!outputView,\r\n        getClientPosition() {\r\n            return getAbsolutePosition(rect);\r\n        },\r\n        resolveClick(click) {\r\n            return g.contains(click.element) ? true : null;\r\n        },\r\n        setIsDragging(isDragging) {\r\n            inputView === null || inputView === void 0 ? void 0 : inputView.setIsHidden(isDragging);\r\n            outputView === null || outputView === void 0 ? void 0 : outputView.setIsHidden(isDragging);\r\n        },\r\n        setIsDisabled(isDisabled) {\r\n            Dom.toggleClass(g, isDisabled, 'sqd-disabled');\r\n        },\r\n        setIsSelected(isSelected) {\r\n            Dom.toggleClass(rect, isSelected, 'sqd-selected');\r\n        }\r\n    };\r\n};\n\nclass CenteredViewportCalculator {\r\n    static center(padding, canvasSize, rootComponentSize) {\r\n        if (canvasSize.x === 0 || canvasSize.y === 0) {\r\n            return {\r\n                position: new Vector(0, 0),\r\n                scale: 1\r\n            };\r\n        }\r\n        const canvasSafeWidth = Math.max(canvasSize.x - padding * 2, 0);\r\n        const canvasSafeHeight = Math.max(canvasSize.y - padding * 2, 0);\r\n        const scale = Math.min(Math.min(canvasSafeWidth / rootComponentSize.x, canvasSafeHeight / rootComponentSize.y), 1);\r\n        const width = rootComponentSize.x * scale;\r\n        const height = rootComponentSize.y * scale;\r\n        const x = Math.max(0, (canvasSize.x - width) / 2);\r\n        const y = Math.max(0, (canvasSize.y - height) / 2);\r\n        return {\r\n            position: new Vector(x, y),\r\n            scale\r\n        };\r\n    }\r\n    static getFocusedOnComponent(canvasSize, viewport, componentPosition, componentSize) {\r\n        const realPosition = viewport.position.divideByScalar(viewport.scale).subtract(componentPosition.divideByScalar(viewport.scale));\r\n        const componentOffset = componentSize.divideByScalar(2);\r\n        const position = realPosition.add(canvasSize.divideByScalar(2)).subtract(componentOffset);\r\n        return { position, scale: 1 };\r\n    }\r\n}\n\nclass ClassicWheelController {\r\n    static create(api) {\r\n        return new ClassicWheelController(api);\r\n    }\r\n    constructor(api) {\r\n        this.api = api;\r\n    }\r\n    onWheel(e) {\r\n        this.api.handleWheelEvent(e);\r\n    }\r\n}\n\nclass ClassicWheelControllerExtension {\r\n    constructor() {\r\n        this.create = ClassicWheelController.create;\r\n    }\r\n}\n\nclass NextQuantifiedNumber {\r\n    constructor(values) {\r\n        this.values = values;\r\n    }\r\n    next(value, direction) {\r\n        let bestIndex = 0;\r\n        let bestDistance = Number.MAX_VALUE;\r\n        for (let i = 0; i < this.values.length; i++) {\r\n            const distance = Math.abs(this.values[i] - value);\r\n            if (bestDistance > distance) {\r\n                bestIndex = i;\r\n                bestDistance = distance;\r\n            }\r\n        }\r\n        let index;\r\n        if (direction) {\r\n            index = Math.min(bestIndex + 1, this.values.length - 1);\r\n        }\r\n        else {\r\n            index = Math.max(bestIndex - 1, 0);\r\n        }\r\n        return {\r\n            current: this.values[bestIndex],\r\n            next: this.values[index]\r\n        };\r\n    }\r\n    limit(scale) {\r\n        const min = this.values[0];\r\n        const max = this.values[this.values.length - 1];\r\n        return Math.min(Math.max(scale, min), max);\r\n    }\r\n}\n\nconst defaultConfiguration$5 = {\r\n    scales: [0.06, 0.08, 0.1, 0.12, 0.16, 0.2, 0.26, 0.32, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1],\r\n    smoothDeltaYLimit: 16,\r\n    padding: 10\r\n};\r\nclass DefaultViewportController {\r\n    static create(api, configuration) {\r\n        const config = configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$5;\r\n        const nqn = new NextQuantifiedNumber(config.scales);\r\n        return new DefaultViewportController(config.smoothDeltaYLimit, nqn, api, config.padding);\r\n    }\r\n    constructor(smoothDeltaYLimit, nqn, api, padding) {\r\n        this.smoothDeltaYLimit = smoothDeltaYLimit;\r\n        this.nqn = nqn;\r\n        this.api = api;\r\n        this.padding = padding;\r\n    }\r\n    getDefault() {\r\n        const rootComponentSize = this.api.getRootComponentSize();\r\n        const canvasSize = this.api.getCanvasSize();\r\n        return CenteredViewportCalculator.center(this.padding, canvasSize, rootComponentSize);\r\n    }\r\n    getZoomed(direction) {\r\n        const current = this.api.getViewport();\r\n        const nextScale = this.nqn.next(current.scale, direction);\r\n        if (nextScale) {\r\n            return {\r\n                position: current.position,\r\n                scale: nextScale.next\r\n            };\r\n        }\r\n        return null;\r\n    }\r\n    getFocusedOnComponent(componentPosition, componentSize) {\r\n        const viewport = this.api.getViewport();\r\n        const canvasSize = this.api.getCanvasSize();\r\n        return CenteredViewportCalculator.getFocusedOnComponent(canvasSize, viewport, componentPosition, componentSize);\r\n    }\r\n    getNextScale(scale, direction) {\r\n        return this.nqn.next(scale, direction);\r\n    }\r\n    limitScale(scale) {\r\n        return this.nqn.limit(scale);\r\n    }\r\n}\n\nclass DefaultViewportControllerExtension {\r\n    static create(configuration) {\r\n        return new DefaultViewportControllerExtension(configuration);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n    }\r\n    create(api) {\r\n        return DefaultViewportController.create(api, this.configuration);\r\n    }\r\n}\n\nclass StepComponent {\r\n    static create(view, stepContext, componentContext) {\r\n        const badges = Badges.createForStep(stepContext, view, componentContext);\r\n        return new StepComponent(view, stepContext.step, stepContext.parentSequence, view.hasOutput, badges);\r\n    }\r\n    constructor(view, step, parentSequence, hasOutput, badges) {\r\n        this.view = view;\r\n        this.step = step;\r\n        this.parentSequence = parentSequence;\r\n        this.hasOutput = hasOutput;\r\n        this.badges = badges;\r\n    }\r\n    findById(stepId) {\r\n        if (this.step.id === stepId) {\r\n            return this;\r\n        }\r\n        if (this.view.sequenceComponents) {\r\n            for (const component of this.view.sequenceComponents) {\r\n                const result = component.findById(stepId);\r\n                if (result) {\r\n                    return result;\r\n                }\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n    resolveClick(click) {\r\n        if (this.view.sequenceComponents) {\r\n            for (const component of this.view.sequenceComponents) {\r\n                const result = component.resolveClick(click);\r\n                if (result) {\r\n                    return result;\r\n                }\r\n            }\r\n        }\r\n        const badgeResult = this.badges.resolveClick(click);\r\n        if (badgeResult) {\r\n            return badgeResult;\r\n        }\r\n        const viewResult = this.view.resolveClick(click);\r\n        if (viewResult) {\r\n            return viewResult === true\r\n                ? {\r\n                    type: ClickCommandType.selectStep,\r\n                    component: this\r\n                }\r\n                : viewResult;\r\n        }\r\n        return null;\r\n    }\r\n    resolvePlaceholders(skipComponent, result) {\r\n        if (skipComponent !== this) {\r\n            if (this.view.sequenceComponents) {\r\n                this.view.sequenceComponents.forEach(component => component.resolvePlaceholders(skipComponent, result));\r\n            }\r\n            if (this.view.placeholders) {\r\n                this.view.placeholders.forEach(ph => result.placeholders.push(ph));\r\n            }\r\n            result.components.push(this);\r\n        }\r\n    }\r\n    setIsDragging(isDragging) {\r\n        this.view.setIsDragging(isDragging);\r\n    }\r\n    setIsSelected(isSelected) {\r\n        this.view.setIsSelected(isSelected);\r\n    }\r\n    setIsDisabled(isDisabled) {\r\n        this.view.setIsDisabled(isDisabled);\r\n    }\r\n    updateBadges(result) {\r\n        if (this.view.sequenceComponents) {\r\n            this.view.sequenceComponents.forEach(component => component.updateBadges(result));\r\n        }\r\n        this.badges.update(result);\r\n    }\r\n}\n\nclass StepExtensionResolver {\r\n    static create(services) {\r\n        const dict = {};\r\n        for (let i = services.steps.length - 1; i >= 0; i--) {\r\n            const extension = services.steps[i];\r\n            dict[extension.componentType] = extension;\r\n        }\r\n        return new StepExtensionResolver(dict);\r\n    }\r\n    constructor(dict) {\r\n        this.dict = dict;\r\n    }\r\n    resolve(componentType) {\r\n        const extension = this.dict[componentType];\r\n        if (!extension) {\r\n            throw new Error(`Not supported component type: ${componentType}`);\r\n        }\r\n        return extension;\r\n    }\r\n}\n\nclass RectPlaceholderView {\r\n    static create(parent, width, height, radius, iconSize, direction) {\r\n        const g = Dom.svg('g', {\r\n            visibility: 'hidden',\r\n            class: 'sqd-placeholder'\r\n        });\r\n        parent.appendChild(g);\r\n        const rect = Dom.svg('rect', {\r\n            class: 'sqd-placeholder-rect',\r\n            width,\r\n            height,\r\n            rx: radius,\r\n            ry: radius\r\n        });\r\n        g.appendChild(rect);\r\n        if (direction) {\r\n            const iconD = direction === PlaceholderDirection.in ? Icons.folderIn : Icons.folderOut;\r\n            const icon = Icons.appendPath(g, 'sqd-placeholder-icon-path', iconD, iconSize);\r\n            Dom.translate(icon, (width - iconSize) / 2, (height - iconSize) / 2);\r\n        }\r\n        parent.appendChild(g);\r\n        return new RectPlaceholderView(rect, g);\r\n    }\r\n    constructor(rect, g) {\r\n        this.rect = rect;\r\n        this.g = g;\r\n    }\r\n    setIsHover(isHover) {\r\n        Dom.toggleClass(this.g, isHover, 'sqd-hover');\r\n    }\r\n    setIsVisible(isVisible) {\r\n        Dom.attrs(this.g, {\r\n            visibility: isVisible ? 'visible' : 'hidden'\r\n        });\r\n    }\r\n}\n\nclass RectPlaceholder {\r\n    static create(parent, size, direction, sequence, index, configuration) {\r\n        const view = RectPlaceholderView.create(parent, size.x, size.y, configuration.radius, configuration.iconSize, direction);\r\n        return new RectPlaceholder(view, sequence, index);\r\n    }\r\n    constructor(view, parentSequence, index) {\r\n        this.view = view;\r\n        this.parentSequence = parentSequence;\r\n        this.index = index;\r\n    }\r\n    getClientRect() {\r\n        return this.view.rect.getBoundingClientRect();\r\n    }\r\n    setIsHover(isHover) {\r\n        this.view.setIsHover(isHover);\r\n    }\r\n    setIsVisible(isVisible) {\r\n        this.view.setIsVisible(isVisible);\r\n    }\r\n    resolveClick() {\r\n        return null;\r\n    }\r\n}\n\nclass DefaultRegionView {\r\n    static create(parent, widths, height) {\r\n        const totalWidth = widths.reduce((result, width) => result + width, 0);\r\n        const lines = [\r\n            drawLine(parent, 0, 0, totalWidth, 0),\r\n            drawLine(parent, 0, 0, 0, height),\r\n            drawLine(parent, 0, height, totalWidth, height),\r\n            drawLine(parent, totalWidth, 0, totalWidth, height)\r\n        ];\r\n        let offsetX = widths[0];\r\n        for (let i = 1; i < widths.length; i++) {\r\n            lines.push(drawLine(parent, offsetX, 0, offsetX, height));\r\n            offsetX += widths[i];\r\n        }\r\n        return new DefaultRegionView(lines, totalWidth, height);\r\n    }\r\n    constructor(lines, width, height) {\r\n        this.lines = lines;\r\n        this.width = width;\r\n        this.height = height;\r\n    }\r\n    getClientPosition() {\r\n        return getAbsolutePosition(this.lines[0]);\r\n    }\r\n    resolveClick(click) {\r\n        const regionPosition = this.getClientPosition();\r\n        const d = click.position.subtract(regionPosition);\r\n        if (d.x >= 0 && d.y >= 0 && d.x < this.width * click.scale && d.y < this.height * click.scale) {\r\n            return true;\r\n        }\r\n        return null;\r\n    }\r\n    setIsSelected(isSelected) {\r\n        this.lines.forEach(region => {\r\n            Dom.toggleClass(region, isSelected, 'sqd-selected');\r\n        });\r\n    }\r\n}\r\nfunction drawLine(parent, x1, y1, x2, y2) {\r\n    const line = Dom.svg('line', {\r\n        class: 'sqd-region',\r\n        x1,\r\n        y1,\r\n        x2,\r\n        y2\r\n    });\r\n    parent.insertBefore(line, parent.firstChild);\r\n    return line;\r\n}\n\nclass DefaultRegionComponentViewExtension {\r\n    create(parentElement, componentClassName, stepContext, _, contentFactory) {\r\n        const g = ComponentDom.stepG(componentClassName, stepContext.step.type, stepContext.step.id);\r\n        parentElement.appendChild(g);\r\n        return contentFactory(g, DefaultRegionView.create);\r\n    }\r\n}\n\nclass DefaultViewportControllerDesignerExtension {\r\n    static create(configuration) {\r\n        return new DefaultViewportControllerDesignerExtension(DefaultViewportControllerExtension.create(configuration));\r\n    }\r\n    constructor(viewportController) {\r\n        this.viewportController = viewportController;\r\n    }\r\n}\n\nclass LineGrid {\r\n    static create(size) {\r\n        const path = Dom.svg('path', {\r\n            class: 'sqd-line-grid-path',\r\n            fill: 'none'\r\n        });\r\n        return new LineGrid(size, path);\r\n    }\r\n    constructor(size, element) {\r\n        this.size = size;\r\n        this.element = element;\r\n    }\r\n    setScale(_, scaledSize) {\r\n        Dom.attrs(this.element, {\r\n            d: `M ${scaledSize.x} 0 L 0 0 0 ${scaledSize.y}`\r\n        });\r\n    }\r\n}\n\nconst defaultConfiguration$4 = {\r\n    gridSizeX: 48,\r\n    gridSizeY: 48\r\n};\r\nclass LineGridExtension {\r\n    static create(configuration) {\r\n        return new LineGridExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$4);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n    }\r\n    create() {\r\n        const size = new Vector(this.configuration.gridSizeX, this.configuration.gridSizeY);\r\n        return LineGrid.create(size);\r\n    }\r\n}\n\nclass LineGridDesignerExtension {\r\n    static create(configuration) {\r\n        const grid = LineGridExtension.create(configuration);\r\n        return new LineGridDesignerExtension(grid);\r\n    }\r\n    constructor(grid) {\r\n        this.grid = grid;\r\n    }\r\n}\n\nclass StartStopRootComponentDesignerExtension {\r\n    static create(configuration) {\r\n        return new StartStopRootComponentDesignerExtension(StartStopRootComponentExtension.create(configuration));\r\n    }\r\n    constructor(rootComponent) {\r\n        this.rootComponent = rootComponent;\r\n    }\r\n}\n\nconst defaultConfiguration$3 = {\r\n    view: {\r\n        paddingTop: 20,\r\n        paddingX: 20,\r\n        inputSize: 18,\r\n        inputRadius: 4,\r\n        inputIconSize: 14,\r\n        autoHideInputOnDrag: true,\r\n        label: {\r\n            height: 22,\r\n            paddingX: 10,\r\n            minWidth: 50,\r\n            radius: 10\r\n        }\r\n    }\r\n};\r\nclass ContainerStepExtension {\r\n    static create(configuration) {\r\n        return new ContainerStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$3);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n        this.componentType = 'container';\r\n        this.createComponentView = createContainerStepComponentViewFactory(this.configuration.view);\r\n    }\r\n}\n\nconst defaultConfiguration$2 = {\r\n    view: {\r\n        minBranchWidth: 88,\r\n        paddingX: 20,\r\n        paddingTop1: 0,\r\n        paddingTop2: 22,\r\n        connectionHeight: 20,\r\n        noBranchPaddingBottom: 24,\r\n        inputSize: 18,\r\n        inputIconSize: 14,\r\n        inputRadius: 4,\r\n        autoHideInputOnDrag: true,\r\n        branchNameLabel: {\r\n            height: 22,\r\n            paddingX: 10,\r\n            minWidth: 50,\r\n            radius: 10\r\n        },\r\n        nameLabel: {\r\n            height: 22,\r\n            paddingX: 10,\r\n            minWidth: 50,\r\n            radius: 10\r\n        }\r\n    }\r\n};\r\nclass SwitchStepExtension {\r\n    static create(configuration) {\r\n        return new SwitchStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$2);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n        this.componentType = 'switch';\r\n        this.createComponentView = createSwitchStepComponentViewFactory(this.configuration.view);\r\n    }\r\n}\n\nconst defaultConfiguration$1 = {\r\n    view: {\r\n        paddingLeft: 12,\r\n        paddingRight: 12,\r\n        paddingY: 10,\r\n        textMarginLeft: 12,\r\n        minTextWidth: 70,\r\n        iconSize: 22,\r\n        radius: 5,\r\n        inputSize: 14,\r\n        outputSize: 10\r\n    }\r\n};\r\nclass TaskStepExtension {\r\n    static create(configuration) {\r\n        return new TaskStepExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration$1);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n        this.componentType = 'task';\r\n        this.createComponentView = createTaskStepComponentViewFactory(false, this.configuration.view);\r\n    }\r\n}\n\nclass StepsDesignerExtension {\r\n    static create(configuration) {\r\n        const steps = [];\r\n        if (configuration.container) {\r\n            steps.push(ContainerStepExtension.create(configuration.container));\r\n        }\r\n        if (configuration.switch) {\r\n            steps.push(SwitchStepExtension.create(configuration.switch));\r\n        }\r\n        if (configuration.task) {\r\n            steps.push(TaskStepExtension.create(configuration.task));\r\n        }\r\n        return new StepsDesignerExtension(steps);\r\n    }\r\n    constructor(steps) {\r\n        this.steps = steps;\r\n    }\r\n}\n\nclass DefinitionValidator {\r\n    constructor(configuration, state) {\r\n        this.configuration = configuration;\r\n        this.state = state;\r\n    }\r\n    validateStep(step, parentSequence) {\r\n        var _a;\r\n        if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.step) {\r\n            return this.configuration.step(step, parentSequence, this.state.definition);\r\n        }\r\n        return true;\r\n    }\r\n    validateRoot() {\r\n        var _a;\r\n        if ((_a = this.configuration) === null || _a === void 0 ? void 0 : _a.root) {\r\n            return this.configuration.root(this.state.definition);\r\n        }\r\n        return true;\r\n    }\r\n}\n\nclass IconProvider {\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n    }\r\n    getIconUrl(step) {\r\n        if (this.configuration.iconUrlProvider) {\r\n            return this.configuration.iconUrlProvider(step.componentType, step.type);\r\n        }\r\n        return null;\r\n    }\r\n}\n\nclass StepComponentViewContextFactory {\r\n    static create(stepContext, componentContext) {\r\n        const preferenceKeyPrefix = stepContext.step.id + ':';\r\n        return {\r\n            i18n: componentContext.i18n,\r\n            getStepIconUrl: () => componentContext.iconProvider.getIconUrl(stepContext.step),\r\n            getStepName: () => componentContext.i18n(`step.${stepContext.step.type}.name`, stepContext.step.name),\r\n            createSequenceComponent: (parentElement, sequence) => {\r\n                const sequenceContext = {\r\n                    sequence,\r\n                    depth: stepContext.depth + 1,\r\n                    isInputConnected: true,\r\n                    isOutputConnected: stepContext.isOutputConnected,\r\n                    isPreview: stepContext.isPreview\r\n                };\r\n                return componentContext.services.sequenceComponent.create(parentElement, sequenceContext, componentContext);\r\n            },\r\n            createRegionComponentView(parentElement, componentClassName, contentFactory) {\r\n                return componentContext.services.regionComponentView.create(parentElement, componentClassName, stepContext, this, contentFactory);\r\n            },\r\n            createPlaceholderForArea: componentContext.services.placeholder.createForArea.bind(componentContext.services.placeholder),\r\n            getPreference: (key) => componentContext.preferenceStorage.getItem(preferenceKeyPrefix + key),\r\n            setPreference: (key, value) => componentContext.preferenceStorage.setItem(preferenceKeyPrefix + key, value)\r\n        };\r\n    }\r\n}\n\nclass StepComponentFactory {\r\n    constructor(stepExtensionResolver) {\r\n        this.stepExtensionResolver = stepExtensionResolver;\r\n    }\r\n    create(parentElement, stepContext, componentContext) {\r\n        const viewContext = StepComponentViewContextFactory.create(stepContext, componentContext);\r\n        const extension = this.stepExtensionResolver.resolve(stepContext.step.componentType);\r\n        const view = extension.createComponentView(parentElement, stepContext, viewContext);\r\n        const wrappedView = componentContext.services.stepComponentViewWrapper.wrap(view, stepContext);\r\n        return StepComponent.create(wrappedView, stepContext, componentContext);\r\n    }\r\n}\n\nclass ComponentContext {\r\n    static create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services) {\r\n        const validator = new DefinitionValidator(configuration.validator, state);\r\n        const iconProvider = new IconProvider(configuration.steps);\r\n        const stepComponentFactory = new StepComponentFactory(stepExtensionResolver);\r\n        return new ComponentContext(configuration.shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n);\r\n    }\r\n    constructor(shadowRoot, validator, iconProvider, placeholderController, stepComponentFactory, definitionWalker, services, preferenceStorage, i18n) {\r\n        this.shadowRoot = shadowRoot;\r\n        this.validator = validator;\r\n        this.iconProvider = iconProvider;\r\n        this.placeholderController = placeholderController;\r\n        this.stepComponentFactory = stepComponentFactory;\r\n        this.definitionWalker = definitionWalker;\r\n        this.services = services;\r\n        this.preferenceStorage = preferenceStorage;\r\n        this.i18n = i18n;\r\n    }\r\n}\n\nclass CustomActionController {\r\n    constructor(configuration, state, stateModifier) {\r\n        this.configuration = configuration;\r\n        this.state = state;\r\n        this.stateModifier = stateModifier;\r\n    }\r\n    trigger(action, step, sequence) {\r\n        const handler = this.configuration.customActionHandler;\r\n        if (!handler) {\r\n            console.warn(`Custom action handler is not defined (action type: ${action.type})`);\r\n            return;\r\n        }\r\n        const context = this.createCustomActionHandlerContext();\r\n        handler(action, step, sequence, context);\r\n    }\r\n    createCustomActionHandlerContext() {\r\n        return {\r\n            notifyStepNameChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepNameChanged, stepId, false),\r\n            notifyStepPropertiesChanged: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepPropertyChanged, stepId, false),\r\n            notifyStepInserted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepInserted, stepId, true),\r\n            notifyStepMoved: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepMoved, stepId, true),\r\n            notifyStepDeleted: (stepId) => this.notifyStepChanged(DefinitionChangeType.stepDeleted, stepId, true)\r\n        };\r\n    }\r\n    notifyStepChanged(changeType, stepId, updateDependencies) {\r\n        if (!stepId) {\r\n            throw new Error('Step id is empty');\r\n        }\r\n        this.state.notifyDefinitionChanged(changeType, stepId);\r\n        if (updateDependencies) {\r\n            this.stateModifier.updateDependencies();\r\n        }\r\n    }\r\n}\n\nclass EditorView {\r\n    static create(parent) {\r\n        return new EditorView(parent);\r\n    }\r\n    constructor(parent) {\r\n        this.parent = parent;\r\n        this.currentContainer = null;\r\n    }\r\n    setContent(content, className) {\r\n        const container = Dom.element('div', {\r\n            class: className\r\n        });\r\n        container.appendChild(content);\r\n        if (this.currentContainer) {\r\n            this.parent.removeChild(this.currentContainer);\r\n        }\r\n        this.parent.appendChild(container);\r\n        this.currentContainer = container;\r\n    }\r\n    destroy() {\r\n        if (this.currentContainer) {\r\n            this.parent.removeChild(this.currentContainer);\r\n        }\r\n    }\r\n}\n\nclass Editor {\r\n    static create(parent, api, stepEditorClassName, stepEditorProvider, rootEditorClassName, rootEditorProvider, customSelectedStepIdProvider) {\r\n        const view = EditorView.create(parent);\r\n        function render(step) {\r\n            const definition = api.getDefinition();\r\n            let content;\r\n            let className;\r\n            if (step) {\r\n                const stepContext = api.createStepEditorContext(step.id);\r\n                content = stepEditorProvider(step, stepContext, definition, api.isReadonly());\r\n                className = stepEditorClassName;\r\n            }\r\n            else {\r\n                const rootContext = api.createRootEditorContext();\r\n                content = rootEditorProvider(definition, rootContext, api.isReadonly());\r\n                className = rootEditorClassName;\r\n            }\r\n            view.setContent(content, className);\r\n        }\r\n        const renderer = api.runRenderer(step => render(step), customSelectedStepIdProvider);\r\n        return new Editor(view, renderer);\r\n    }\r\n    constructor(view, renderer) {\r\n        this.view = view;\r\n        this.renderer = renderer;\r\n    }\r\n    destroy() {\r\n        this.view.destroy();\r\n        this.renderer.destroy();\r\n    }\r\n}\n\nfunction readMousePosition(e) {\r\n    return new Vector(e.pageX, e.pageY);\r\n}\r\nfunction readTouchClientPosition(e) {\r\n    if (e.touches.length > 0) {\r\n        const touch = e.touches[0];\r\n        return new Vector(touch.clientX, touch.clientY);\r\n    }\r\n    throw new Error('Unknown touch position');\r\n}\r\nfunction readTouchPosition(e) {\r\n    if (e.touches.length > 0) {\r\n        const touch = e.touches[0];\r\n        return new Vector(touch.pageX, touch.pageY);\r\n    }\r\n    throw new Error('Unknown touch position');\r\n}\r\nfunction calculateFingerDistance(e) {\r\n    if (e.touches.length === 2) {\r\n        const t0 = e.touches[0];\r\n        const t1 = e.touches[1];\r\n        return Math.hypot(t0.clientX - t1.clientX, t0.clientY - t1.clientY);\r\n    }\r\n    throw new Error('Cannot calculate finger distance');\r\n}\r\nfunction readFingerCenterPoint(e) {\r\n    if (e.touches.length === 2) {\r\n        const t0 = e.touches[0];\r\n        const t1 = e.touches[1];\r\n        return new Vector((t0.pageX + t1.pageX) / 2, (t0.pageY + t1.pageY) / 2);\r\n    }\r\n    throw new Error('Cannot calculate finger center point');\r\n}\n\nconst notInitializedError$1 = 'State is not initialized';\r\nconst nonPassiveOptions$1 = {\r\n    passive: false\r\n};\r\nclass BehaviorController {\r\n    static create(shadowRoot) {\r\n        return new BehaviorController(shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document, shadowRoot);\r\n    }\r\n    constructor(dom, shadowRoot) {\r\n        this.dom = dom;\r\n        this.shadowRoot = shadowRoot;\r\n        this.previousEndToken = null;\r\n        this.state = null;\r\n        this.onMouseMove = (e) => {\r\n            e.preventDefault();\r\n            e.stopPropagation();\r\n            this.move(readMousePosition(e));\r\n        };\r\n        this.onTouchMove = (e) => {\r\n            e.preventDefault();\r\n            e.stopPropagation();\r\n            this.move(readTouchPosition(e));\r\n        };\r\n        this.onMouseUp = (e) => {\r\n            e.preventDefault();\r\n            e.stopPropagation();\r\n            this.stop(false, e.target);\r\n        };\r\n        this.onTouchEnd = (e) => {\r\n            var _a;\r\n            e.preventDefault();\r\n            e.stopPropagation();\r\n            if (!this.state) {\r\n                throw new Error(notInitializedError$1);\r\n            }\r\n            const position = (_a = this.state.lastPosition) !== null && _a !== void 0 ? _a : this.state.startPosition;\r\n            const element = this.dom.elementFromPoint(position.x, position.y);\r\n            this.stop(false, element);\r\n        };\r\n        this.onTouchStart = (e) => {\r\n            e.preventDefault();\r\n            e.stopPropagation();\r\n            if (e.touches.length !== 1) {\r\n                this.stop(true, null);\r\n            }\r\n        };\r\n    }\r\n    start(startPosition, behavior) {\r\n        if (this.state) {\r\n            this.stop(true, null);\r\n            return;\r\n        }\r\n        this.state = {\r\n            startPosition,\r\n            behavior\r\n        };\r\n        behavior.onStart(this.state.startPosition);\r\n        if (this.shadowRoot) {\r\n            this.bind(this.shadowRoot);\r\n        }\r\n        this.bind(window);\r\n    }\r\n    bind(target) {\r\n        target.addEventListener('mousemove', this.onMouseMove, false);\r\n        target.addEventListener('touchmove', this.onTouchMove, nonPassiveOptions$1);\r\n        target.addEventListener('mouseup', this.onMouseUp, false);\r\n        target.addEventListener('touchend', this.onTouchEnd, nonPassiveOptions$1);\r\n        target.addEventListener('touchstart', this.onTouchStart, nonPassiveOptions$1);\r\n    }\r\n    unbind(target) {\r\n        target.removeEventListener('mousemove', this.onMouseMove, false);\r\n        target.removeEventListener('touchmove', this.onTouchMove, nonPassiveOptions$1);\r\n        target.removeEventListener('mouseup', this.onMouseUp, false);\r\n        target.removeEventListener('touchend', this.onTouchEnd, nonPassiveOptions$1);\r\n        target.removeEventListener('touchstart', this.onTouchStart, nonPassiveOptions$1);\r\n    }\r\n    move(position) {\r\n        if (!this.state) {\r\n            throw new Error(notInitializedError$1);\r\n        }\r\n        this.state.lastPosition = position;\r\n        const delta = this.state.startPosition.subtract(position);\r\n        const newBehavior = this.state.behavior.onMove(delta);\r\n        if (newBehavior) {\r\n            this.state.behavior.onEnd(true, null, null);\r\n            this.state.behavior = newBehavior;\r\n            this.state.startPosition = position;\r\n            this.state.behavior.onStart(this.state.startPosition);\r\n        }\r\n    }\r\n    stop(interrupt, element) {\r\n        if (!this.state) {\r\n            throw new Error(notInitializedError$1);\r\n        }\r\n        if (this.shadowRoot) {\r\n            this.unbind(this.shadowRoot);\r\n        }\r\n        this.unbind(window);\r\n        const endToken = this.state.behavior.onEnd(interrupt, element, this.previousEndToken);\r\n        this.state = null;\r\n        this.previousEndToken = endToken || null;\r\n    }\r\n}\n\nclass SequenceModifier {\r\n    static tryMoveStep(sourceSequence, step, targetSequence, targetIndex) {\r\n        const sourceIndex = sourceSequence.indexOf(step);\r\n        if (sourceIndex < 0) {\r\n            throw new Error('Step not found in source sequence');\r\n        }\r\n        const isSameSequence = sourceSequence === targetSequence;\r\n        if (isSameSequence) {\r\n            if (sourceIndex < targetIndex) {\r\n                targetIndex--;\r\n            }\r\n            if (sourceIndex === targetIndex) {\r\n                return null; // No changes\r\n            }\r\n        }\r\n        return function apply() {\r\n            sourceSequence.splice(sourceIndex, 1);\r\n            targetSequence.splice(targetIndex, 0, step);\r\n        };\r\n    }\r\n    static insertStep(step, targetSequence, targetIndex) {\r\n        targetSequence.splice(targetIndex, 0, step);\r\n    }\r\n    static deleteStep(step, parentSequence) {\r\n        const index = parentSequence.indexOf(step);\r\n        if (index < 0) {\r\n            throw new Error('Unknown step');\r\n        }\r\n        parentSequence.splice(index, 1);\r\n    }\r\n}\n\nclass StepDuplicator {\r\n    constructor(uidGenerator, definitionWalker) {\r\n        this.uidGenerator = uidGenerator;\r\n        this.definitionWalker = definitionWalker;\r\n    }\r\n    duplicate(step) {\r\n        const newStep = ObjectCloner.deepClone(step);\r\n        newStep.id = this.uidGenerator();\r\n        this.definitionWalker.forEachChildren(newStep, s => {\r\n            s.id = this.uidGenerator();\r\n        });\r\n        return newStep;\r\n    }\r\n}\n\nclass FolderPathDefinitionModifierDependency {\r\n    constructor(state, definitionWalker) {\r\n        this.state = state;\r\n        this.definitionWalker = definitionWalker;\r\n    }\r\n    update() {\r\n        for (let index = 0; index < this.state.folderPath.length; index++) {\r\n            const stepId = this.state.folderPath[index];\r\n            const found = this.definitionWalker.findById(this.state.definition, stepId);\r\n            if (!found) {\r\n                // We need to update path if any folder is deleted.\r\n                const newPath = this.state.folderPath.slice(0, index);\r\n                this.state.setFolderPath(newPath);\r\n                break;\r\n            }\r\n        }\r\n    }\r\n}\n\nclass SelectedStepIdDefinitionModifierDependency {\r\n    constructor(state, definitionWalker) {\r\n        this.state = state;\r\n        this.definitionWalker = definitionWalker;\r\n    }\r\n    update() {\r\n        if (this.state.selectedStepId) {\r\n            const found = this.definitionWalker.findById(this.state.definition, this.state.selectedStepId);\r\n            if (!found) {\r\n                // We need to unselect step when it's deleted.\r\n                this.state.setSelectedStepId(null);\r\n            }\r\n        }\r\n    }\r\n}\n\nclass StateModifier {\r\n    static create(definitionWalker, state, configuration) {\r\n        const dependencies = [];\r\n        dependencies.push(new SelectedStepIdDefinitionModifierDependency(state, definitionWalker));\r\n        dependencies.push(new FolderPathDefinitionModifierDependency(state, definitionWalker));\r\n        return new StateModifier(definitionWalker, state, configuration, dependencies);\r\n    }\r\n    constructor(definitionWalker, state, configuration, dependencies) {\r\n        this.definitionWalker = definitionWalker;\r\n        this.state = state;\r\n        this.configuration = configuration;\r\n        this.dependencies = dependencies;\r\n    }\r\n    addDependency(dependency) {\r\n        this.dependencies.push(dependency);\r\n    }\r\n    isSelectable(step, parentSequence) {\r\n        return this.configuration.steps.isSelectable ? this.configuration.steps.isSelectable(step, parentSequence) : true;\r\n    }\r\n    trySelectStep(step, parentSequence) {\r\n        if (this.isSelectable(step, parentSequence)) {\r\n            this.state.setSelectedStepId(step.id);\r\n        }\r\n    }\r\n    trySelectStepById(stepId) {\r\n        if (this.configuration.steps.isSelectable) {\r\n            const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);\r\n            this.trySelectStep(result.step, result.parentSequence);\r\n        }\r\n        else {\r\n            this.state.setSelectedStepId(stepId);\r\n        }\r\n    }\r\n    isDeletable(stepId) {\r\n        if (this.configuration.steps.isDeletable) {\r\n            const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);\r\n            return this.configuration.steps.isDeletable(result.step, result.parentSequence);\r\n        }\r\n        return true;\r\n    }\r\n    tryDelete(stepId) {\r\n        const result = this.definitionWalker.getParentSequence(this.state.definition, stepId);\r\n        const canDeleteStep = this.configuration.steps.canDeleteStep\r\n            ? this.configuration.steps.canDeleteStep(result.step, result.parentSequence)\r\n            : true;\r\n        if (!canDeleteStep) {\r\n            return false;\r\n        }\r\n        SequenceModifier.deleteStep(result.step, result.parentSequence);\r\n        this.state.notifyDefinitionChanged(DefinitionChangeType.stepDeleted, result.step.id);\r\n        this.updateDependencies();\r\n        return true;\r\n    }\r\n    tryInsert(step, targetSequence, targetIndex) {\r\n        const canInsertStep = this.configuration.steps.canInsertStep\r\n            ? this.configuration.steps.canInsertStep(step, targetSequence, targetIndex)\r\n            : true;\r\n        if (!canInsertStep) {\r\n            return false;\r\n        }\r\n        SequenceModifier.insertStep(step, targetSequence, targetIndex);\r\n        this.state.notifyDefinitionChanged(DefinitionChangeType.stepInserted, step.id);\r\n        if (!this.configuration.steps.isAutoSelectDisabled) {\r\n            this.trySelectStepById(step.id);\r\n        }\r\n        return true;\r\n    }\r\n    isDraggable(step, parentSequence) {\r\n        return this.configuration.steps.isDraggable ? this.configuration.steps.isDraggable(step, parentSequence) : true;\r\n    }\r\n    tryMove(sourceSequence, step, targetSequence, targetIndex) {\r\n        const apply = SequenceModifier.tryMoveStep(sourceSequence, step, targetSequence, targetIndex);\r\n        if (!apply) {\r\n            return false;\r\n        }\r\n        const canMoveStep = this.configuration.steps.canMoveStep\r\n            ? this.configuration.steps.canMoveStep(sourceSequence, step, targetSequence, targetIndex)\r\n            : true;\r\n        if (!canMoveStep) {\r\n            return false;\r\n        }\r\n        apply();\r\n        this.state.notifyDefinitionChanged(DefinitionChangeType.stepMoved, step.id);\r\n        if (!this.configuration.steps.isAutoSelectDisabled) {\r\n            this.trySelectStep(step, targetSequence);\r\n        }\r\n        return true;\r\n    }\r\n    isDuplicable(step, parentSequence) {\r\n        return this.configuration.steps.isDuplicable ? this.configuration.steps.isDuplicable(step, parentSequence) : false;\r\n    }\r\n    tryDuplicate(step, parentSequence) {\r\n        const uidGenerator = this.configuration.uidGenerator ? this.configuration.uidGenerator : Uid.next;\r\n        const duplicator = new StepDuplicator(uidGenerator, this.definitionWalker);\r\n        const index = parentSequence.indexOf(step);\r\n        const newStep = duplicator.duplicate(step);\r\n        return this.tryInsert(newStep, parentSequence, index + 1);\r\n    }\r\n    replaceDefinition(definition) {\r\n        if (!definition) {\r\n            throw new Error('Definition is empty');\r\n        }\r\n        this.state.setDefinition(definition);\r\n        this.updateDependencies();\r\n    }\r\n    updateDependencies() {\r\n        this.dependencies.forEach(dependency => dependency.update());\r\n    }\r\n}\n\nclass DesignerState {\r\n    constructor(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed) {\r\n        this.definition = definition;\r\n        this.isReadonly = isReadonly;\r\n        this.isToolboxCollapsed = isToolboxCollapsed;\r\n        this.isEditorCollapsed = isEditorCollapsed;\r\n        this.onViewportChanged = new SimpleEvent();\r\n        this.onSelectedStepIdChanged = new SimpleEvent();\r\n        this.onFolderPathChanged = new SimpleEvent();\r\n        this.onIsReadonlyChanged = new SimpleEvent();\r\n        this.onIsDraggingChanged = new SimpleEvent();\r\n        this.onIsDragDisabledChanged = new SimpleEvent();\r\n        this.onDefinitionChanged = new SimpleEvent();\r\n        this.onIsToolboxCollapsedChanged = new SimpleEvent();\r\n        this.onIsEditorCollapsedChanged = new SimpleEvent();\r\n        this.viewport = {\r\n            position: new Vector(0, 0),\r\n            scale: 1\r\n        };\r\n        this.selectedStepId = null;\r\n        this.folderPath = [];\r\n        this.isDragging = false;\r\n        this.isDragDisabled = false;\r\n    }\r\n    setSelectedStepId(stepId) {\r\n        if (this.selectedStepId !== stepId) {\r\n            this.selectedStepId = stepId;\r\n            this.onSelectedStepIdChanged.forward(stepId);\r\n        }\r\n    }\r\n    pushStepIdToFolderPath(stepId) {\r\n        this.folderPath.push(stepId);\r\n        this.onFolderPathChanged.forward(this.folderPath);\r\n    }\r\n    setFolderPath(path) {\r\n        this.folderPath = path;\r\n        this.onFolderPathChanged.forward(path);\r\n    }\r\n    tryGetLastStepIdFromFolderPath() {\r\n        return this.folderPath.length > 0 ? this.folderPath[this.folderPath.length - 1] : null;\r\n    }\r\n    setDefinition(definition) {\r\n        this.definition = definition;\r\n        this.notifyDefinitionChanged(DefinitionChangeType.rootReplaced, null);\r\n    }\r\n    notifyDefinitionChanged(changeType, stepId) {\r\n        this.onDefinitionChanged.forward({ changeType, stepId });\r\n    }\r\n    setViewport(viewport) {\r\n        this.viewport = viewport;\r\n        this.onViewportChanged.forward(viewport);\r\n    }\r\n    setIsReadonly(isReadonly) {\r\n        if (this.isReadonly !== isReadonly) {\r\n            this.isReadonly = isReadonly;\r\n            this.onIsReadonlyChanged.forward(isReadonly);\r\n        }\r\n    }\r\n    setIsDragging(isDragging) {\r\n        if (this.isDragging !== isDragging) {\r\n            this.isDragging = isDragging;\r\n            this.onIsDraggingChanged.forward(isDragging);\r\n        }\r\n    }\r\n    setIsDragDisabled(isDragDisabled) {\r\n        if (this.isDragDisabled !== isDragDisabled) {\r\n            this.isDragDisabled = isDragDisabled;\r\n            this.onIsDragDisabledChanged.forward(isDragDisabled);\r\n        }\r\n    }\r\n    setIsToolboxCollapsed(isCollapsed) {\r\n        if (this.isToolboxCollapsed !== isCollapsed) {\r\n            this.isToolboxCollapsed = isCollapsed;\r\n            this.onIsToolboxCollapsedChanged.forward(isCollapsed);\r\n        }\r\n    }\r\n    setIsEditorCollapsed(isCollapsed) {\r\n        if (this.isEditorCollapsed !== isCollapsed) {\r\n            this.isEditorCollapsed = isCollapsed;\r\n            this.onIsEditorCollapsedChanged.forward(isCollapsed);\r\n        }\r\n    }\r\n}\n\nclass HistoryController {\r\n    static create(initialStack, state, stateModifier, configuration) {\r\n        if (!configuration.undoStackSize || configuration.undoStackSize < 1) {\r\n            throw new Error('Invalid undo stack size');\r\n        }\r\n        const stack = initialStack || {\r\n            index: 0,\r\n            items: []\r\n        };\r\n        const controller = new HistoryController(stack, state, stateModifier, configuration.undoStackSize);\r\n        if (!initialStack) {\r\n            controller.rememberCurrent(DefinitionChangeType.rootReplaced, null);\r\n        }\r\n        state.onDefinitionChanged.subscribe(event => {\r\n            if (event.changeType !== DefinitionChangeType.rootReplaced) {\r\n                controller.rememberCurrent(event.changeType, event.stepId);\r\n            }\r\n        });\r\n        return controller;\r\n    }\r\n    constructor(stack, state, stateModifier, stackSize) {\r\n        this.stack = stack;\r\n        this.state = state;\r\n        this.stateModifier = stateModifier;\r\n        this.stackSize = stackSize;\r\n    }\r\n    canUndo() {\r\n        return this.stack.index > 1;\r\n    }\r\n    undo() {\r\n        this.stack.index--;\r\n        this.commit();\r\n    }\r\n    canRedo() {\r\n        return this.stack.index < this.stack.items.length;\r\n    }\r\n    redo() {\r\n        this.stack.index++;\r\n        this.commit();\r\n    }\r\n    dump() {\r\n        return Object.assign({}, this.stack);\r\n    }\r\n    replaceDefinition(definition) {\r\n        if (definition == this.state.definition) {\r\n            throw new Error('Cannot use the same instance of definition');\r\n        }\r\n        this.remember(definition, DefinitionChangeType.rootReplaced, null);\r\n        this.commit();\r\n    }\r\n    rememberCurrent(changeType, stepId) {\r\n        this.remember(this.state.definition, changeType, stepId);\r\n    }\r\n    remember(sourceDefinition, changeType, stepId) {\r\n        const definition = ObjectCloner.deepClone(sourceDefinition);\r\n        if (this.stack.items.length > 0 && this.stack.index === this.stack.items.length) {\r\n            const lastItem = this.stack.items[this.stack.items.length - 1];\r\n            if (areItemsEqual(lastItem, changeType, stepId)) {\r\n                lastItem.definition = definition;\r\n                return;\r\n            }\r\n        }\r\n        this.stack.items.splice(this.stack.index);\r\n        this.stack.items.push({\r\n            definition,\r\n            changeType,\r\n            stepId\r\n        });\r\n        if (this.stack.items.length > this.stackSize) {\r\n            this.stack.items.splice(0, this.stack.items.length - this.stackSize - 1);\r\n        }\r\n        this.stack.index = this.stack.items.length;\r\n    }\r\n    commit() {\r\n        const definition = ObjectCloner.deepClone(this.stack.items[this.stack.index - 1].definition);\r\n        this.stateModifier.replaceDefinition(definition);\r\n    }\r\n}\r\nfunction areItemsEqual(item, changeType, stepId) {\r\n    return changeType !== DefinitionChangeType.rootReplaced && item.changeType === changeType && item.stepId === stepId;\r\n}\n\nclass LayoutController {\r\n    constructor(placeholder) {\r\n        this.placeholder = placeholder;\r\n    }\r\n    isMobile() {\r\n        return this.placeholder.clientWidth < 400; // TODO\r\n    }\r\n}\n\nclass WorkspaceControllerWrapper {\r\n    set(controller) {\r\n        if (this.controller) {\r\n            throw new Error('Controller is already set');\r\n        }\r\n        this.controller = controller;\r\n    }\r\n    get() {\r\n        if (!this.controller) {\r\n            throw new Error('Controller is not set');\r\n        }\r\n        return this.controller;\r\n    }\r\n    resolvePlaceholders(skipComponent) {\r\n        return this.get().resolvePlaceholders(skipComponent);\r\n    }\r\n    getComponentByStepId(stepId) {\r\n        return this.get().getComponentByStepId(stepId);\r\n    }\r\n    getCanvasPosition() {\r\n        return this.get().getCanvasPosition();\r\n    }\r\n    getCanvasSize() {\r\n        return this.get().getCanvasSize();\r\n    }\r\n    getRootComponentSize() {\r\n        return this.get().getRootComponentSize();\r\n    }\r\n    updateBadges() {\r\n        this.get().updateBadges();\r\n    }\r\n    updateRootComponent() {\r\n        this.get().updateRootComponent();\r\n    }\r\n    updateCanvasSize() {\r\n        this.get().updateCanvasSize();\r\n    }\r\n}\n\nclass MemoryPreferenceStorage {\r\n    constructor() {\r\n        this.map = {};\r\n    }\r\n    setItem(key, value) {\r\n        this.map[key] = value;\r\n    }\r\n    getItem(key) {\r\n        var _a;\r\n        return (_a = this.map[key]) !== null && _a !== void 0 ? _a : null;\r\n    }\r\n}\n\nclass DesignerContext {\r\n    static create(placeholder, startDefinition, configuration, services) {\r\n        var _a, _b, _c, _d, _e;\r\n        const definition = ObjectCloner.deepClone(startDefinition);\r\n        const layoutController = new LayoutController(placeholder);\r\n        const isReadonly = Boolean(configuration.isReadonly);\r\n        const isToolboxCollapsed = configuration.toolbox ? (_a = configuration.toolbox.isCollapsed) !== null && _a !== void 0 ? _a : layoutController.isMobile() : false;\r\n        const isEditorCollapsed = configuration.editors ? (_b = configuration.editors.isCollapsed) !== null && _b !== void 0 ? _b : layoutController.isMobile() : false;\r\n        const theme = configuration.theme || 'light';\r\n        const state = new DesignerState(definition, isReadonly, isToolboxCollapsed, isEditorCollapsed);\r\n        const workspaceController = new WorkspaceControllerWrapper();\r\n        const placeholderController = services.placeholderController.create();\r\n        const behaviorController = BehaviorController.create(configuration.shadowRoot);\r\n        const stepExtensionResolver = StepExtensionResolver.create(services);\r\n        const definitionWalker = (_c = configuration.definitionWalker) !== null && _c !== void 0 ? _c : new DefinitionWalker();\r\n        const i18n = (_d = configuration.i18n) !== null && _d !== void 0 ? _d : ((_, defaultValue) => defaultValue);\r\n        const stateModifier = StateModifier.create(definitionWalker, state, configuration);\r\n        const customActionController = new CustomActionController(configuration, state, stateModifier);\r\n        let historyController = undefined;\r\n        if (configuration.undoStackSize) {\r\n            historyController = HistoryController.create(configuration.undoStack, state, stateModifier, configuration);\r\n        }\r\n        const preferenceStorage = (_e = configuration.preferenceStorage) !== null && _e !== void 0 ? _e : new MemoryPreferenceStorage();\r\n        const componentContext = ComponentContext.create(configuration, state, stepExtensionResolver, definitionWalker, preferenceStorage, placeholderController, i18n, services);\r\n        return new DesignerContext(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController);\r\n    }\r\n    constructor(theme, state, configuration, services, componentContext, definitionWalker, i18n, stateModifier, layoutController, workspaceController, placeholderController, behaviorController, customActionController, historyController) {\r\n        this.theme = theme;\r\n        this.state = state;\r\n        this.configuration = configuration;\r\n        this.services = services;\r\n        this.componentContext = componentContext;\r\n        this.definitionWalker = definitionWalker;\r\n        this.i18n = i18n;\r\n        this.stateModifier = stateModifier;\r\n        this.layoutController = layoutController;\r\n        this.workspaceController = workspaceController;\r\n        this.placeholderController = placeholderController;\r\n        this.behaviorController = behaviorController;\r\n        this.customActionController = customActionController;\r\n        this.historyController = historyController;\r\n    }\r\n    setWorkspaceController(controller) {\r\n        this.workspaceController.set(controller);\r\n    }\r\n}\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\r\n\r\n\r\nfunction __awaiter(thisArg, _arguments, P, generator) {\r\n    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n    return new (P || (P = Promise))(function (resolve, reject) {\r\n        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n        function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n        step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n    });\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n    var e = new Error(message);\r\n    return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nfunction isElementAttached(dom, element) {\r\n    return !(dom.compareDocumentPosition(element) & Node.DOCUMENT_POSITION_DISCONNECTED);\r\n}\n\nlet lastGridPatternId = 0;\r\nconst listenerOptions$1 = {\r\n    passive: false\r\n};\r\nclass WorkspaceView {\r\n    static create(parent, componentContext) {\r\n        const patternId = 'sqd-grid-pattern-' + lastGridPatternId++;\r\n        const pattern = Dom.svg('pattern', {\r\n            id: patternId,\r\n            patternUnits: 'userSpaceOnUse'\r\n        });\r\n        const gridPattern = componentContext.services.grid.create();\r\n        const defs = Dom.svg('defs');\r\n        pattern.appendChild(gridPattern.element);\r\n        defs.appendChild(pattern);\r\n        const foreground = Dom.svg('g');\r\n        const workspace = Dom.element('div', {\r\n            class: 'sqd-workspace'\r\n        });\r\n        const canvas = Dom.svg('svg', {\r\n            class: 'sqd-workspace-canvas'\r\n        });\r\n        canvas.appendChild(defs);\r\n        canvas.appendChild(Dom.svg('rect', {\r\n            width: '100%',\r\n            height: '100%',\r\n            fill: `url(#${patternId})`\r\n        }));\r\n        canvas.appendChild(foreground);\r\n        workspace.appendChild(canvas);\r\n        parent.appendChild(workspace);\r\n        const view = new WorkspaceView(componentContext.shadowRoot, workspace, canvas, pattern, gridPattern, foreground, componentContext);\r\n        window.addEventListener('resize', view.onResize, false);\r\n        return view;\r\n    }\r\n    constructor(shadowRoot, workspace, canvas, pattern, gridPattern, foreground, context) {\r\n        this.shadowRoot = shadowRoot;\r\n        this.workspace = workspace;\r\n        this.canvas = canvas;\r\n        this.pattern = pattern;\r\n        this.gridPattern = gridPattern;\r\n        this.foreground = foreground;\r\n        this.context = context;\r\n        this.onResize = () => {\r\n            this.refreshSize();\r\n        };\r\n    }\r\n    render(sequence, parentPlaceIndicator) {\r\n        if (this.rootComponent) {\r\n            this.foreground.removeChild(this.rootComponent.view.g);\r\n        }\r\n        this.rootComponent = this.context.services.rootComponent.create(this.foreground, sequence, parentPlaceIndicator, this.context);\r\n        this.refreshSize();\r\n    }\r\n    setPositionAndScale(position, scale) {\r\n        const scaledSize = this.gridPattern.size.multiplyByScalar(scale);\r\n        Dom.attrs(this.pattern, {\r\n            x: position.x,\r\n            y: position.y,\r\n            width: scaledSize.x,\r\n            height: scaledSize.y\r\n        });\r\n        this.gridPattern.setScale(scale, scaledSize);\r\n        Dom.attrs(this.foreground, {\r\n            transform: `translate(${position.x}, ${position.y}) scale(${scale})`\r\n        });\r\n    }\r\n    getCanvasPosition() {\r\n        return getAbsolutePosition(this.canvas);\r\n    }\r\n    getCanvasSize() {\r\n        return new Vector(this.canvas.clientWidth, this.canvas.clientHeight);\r\n    }\r\n    bindMouseDown(handler) {\r\n        this.canvas.addEventListener('mousedown', e => {\r\n            e.preventDefault();\r\n            handler(readMousePosition(e), e.target, e.button, e.altKey);\r\n        }, false);\r\n    }\r\n    bindTouchStart(clickHandler, pinchToZoomHandler) {\r\n        this.canvas.addEventListener('touchstart', e => {\r\n            var _a;\r\n            e.preventDefault();\r\n            if (e.touches.length === 2) {\r\n                pinchToZoomHandler(calculateFingerDistance(e), readFingerCenterPoint(e));\r\n                return;\r\n            }\r\n            const clientPosition = readTouchClientPosition(e);\r\n            const dom = (_a = this.shadowRoot) !== null && _a !== void 0 ? _a : document;\r\n            const element = dom.elementFromPoint(clientPosition.x, clientPosition.y);\r\n            if (element) {\r\n                const position = readTouchPosition(e);\r\n                clickHandler(position, element, 0, false);\r\n            }\r\n        }, listenerOptions$1);\r\n    }\r\n    bindContextMenu(handler) {\r\n        this.canvas.addEventListener('contextmenu', e => {\r\n            e.preventDefault();\r\n            handler(readMousePosition(e), e.target);\r\n        }, false);\r\n    }\r\n    bindWheel(handler) {\r\n        this.canvas.addEventListener('wheel', handler, listenerOptions$1);\r\n    }\r\n    destroy() {\r\n        window.removeEventListener('resize', this.onResize, false);\r\n    }\r\n    refreshSize() {\r\n        Dom.attrs(this.canvas, {\r\n            width: this.workspace.offsetWidth,\r\n            height: this.workspace.offsetHeight\r\n        });\r\n    }\r\n}\n\nclass MoveViewportBehavior {\r\n    static create(resetSelectedStep, context) {\r\n        return new MoveViewportBehavior(context.state.viewport.position, resetSelectedStep, context.state, context.stateModifier);\r\n    }\r\n    constructor(startPosition, resetSelectedStep, state, stateModifier) {\r\n        this.startPosition = startPosition;\r\n        this.resetSelectedStep = resetSelectedStep;\r\n        this.state = state;\r\n        this.stateModifier = stateModifier;\r\n    }\r\n    onStart() {\r\n        if (this.resetSelectedStep) {\r\n            const stepIdOrNull = this.state.tryGetLastStepIdFromFolderPath();\r\n            if (stepIdOrNull) {\r\n                this.stateModifier.trySelectStepById(stepIdOrNull);\r\n            }\r\n            else {\r\n                this.state.setSelectedStepId(null);\r\n            }\r\n        }\r\n    }\r\n    onMove(delta) {\r\n        this.state.setViewport({\r\n            position: this.startPosition.subtract(delta),\r\n            scale: this.state.viewport.scale\r\n        });\r\n    }\r\n    onEnd() {\r\n        // Nothing to do.\r\n    }\r\n}\n\nclass SelectStepBehavior {\r\n    static create(pressedStepComponent, forceMove, context) {\r\n        const isDragDisabled = forceMove ||\r\n            context.state.isDragDisabled ||\r\n            !context.stateModifier.isDraggable(pressedStepComponent.step, pressedStepComponent.parentSequence);\r\n        return new SelectStepBehavior(pressedStepComponent, isDragDisabled, context.state, context.stateModifier, context);\r\n    }\r\n    constructor(pressedStepComponent, isDragDisabled, state, stateModifier, context) {\r\n        this.pressedStepComponent = pressedStepComponent;\r\n        this.isDragDisabled = isDragDisabled;\r\n        this.state = state;\r\n        this.stateModifier = stateModifier;\r\n        this.context = context;\r\n    }\r\n    onStart() {\r\n        // Nothing to do.\r\n    }\r\n    onMove(delta) {\r\n        if (delta.distance() > 2) {\r\n            const canDrag = !this.state.isReadonly && !this.isDragDisabled;\r\n            if (canDrag) {\r\n                this.state.setSelectedStepId(null);\r\n                return DragStepBehavior.create(this.context, this.pressedStepComponent.step, this.pressedStepComponent);\r\n            }\r\n            else {\r\n                return MoveViewportBehavior.create(false, this.context);\r\n            }\r\n        }\r\n    }\r\n    onEnd(interrupt) {\r\n        if (interrupt) {\r\n            return;\r\n        }\r\n        this.stateModifier.trySelectStep(this.pressedStepComponent.step, this.pressedStepComponent.parentSequence);\r\n        return new SelectStepBehaviorEndToken(this.pressedStepComponent.step.id, Date.now());\r\n    }\r\n}\n\nclass PressingBehavior {\r\n    static create(clickedElement, handler) {\r\n        return new PressingBehavior(clickedElement, handler);\r\n    }\r\n    constructor(clickedElement, handler) {\r\n        this.clickedElement = clickedElement;\r\n        this.handler = handler;\r\n    }\r\n    onStart() {\r\n        // Nothing...\r\n    }\r\n    onMove() {\r\n        // Nothing...\r\n    }\r\n    onEnd(interrupt, element) {\r\n        if (!interrupt && element && this.clickedElement === element) {\r\n            this.handler.handle();\r\n        }\r\n    }\r\n}\n\nclass RerenderStepPressingBehaviorHandler {\r\n    constructor(command, designerContext) {\r\n        this.command = command;\r\n        this.designerContext = designerContext;\r\n    }\r\n    handle() {\r\n        if (this.command.beforeCallback) {\r\n            this.command.beforeCallback();\r\n        }\r\n        this.designerContext.workspaceController.updateRootComponent();\r\n    }\r\n}\n\nclass OpenFolderPressingBehaviorHandler {\r\n    constructor(command, designerContext) {\r\n        this.command = command;\r\n        this.designerContext = designerContext;\r\n    }\r\n    handle() {\r\n        const stepId = this.command.step.id;\r\n        this.designerContext.state.pushStepIdToFolderPath(stepId);\r\n    }\r\n}\n\nclass TriggerCustomActionPressingBehaviorHandler {\r\n    constructor(command, customActionController) {\r\n        this.command = command;\r\n        this.customActionController = customActionController;\r\n    }\r\n    handle() {\r\n        this.customActionController.trigger(this.command.action, this.command.step, this.command.sequence);\r\n    }\r\n}\n\nclass ClickBehaviorResolver {\r\n    constructor(context) {\r\n        this.context = context;\r\n    }\r\n    resolve(commandOrNull, element, forceMove) {\r\n        if (!commandOrNull) {\r\n            return MoveViewportBehavior.create(!forceMove, this.context);\r\n        }\r\n        switch (commandOrNull.type) {\r\n            case ClickCommandType.selectStep:\r\n                return SelectStepBehavior.create(commandOrNull.component, forceMove, this.context);\r\n            case ClickCommandType.rerenderStep:\r\n                return PressingBehavior.create(element, new RerenderStepPressingBehaviorHandler(commandOrNull, this.context));\r\n            case ClickCommandType.openFolder:\r\n                return PressingBehavior.create(element, new OpenFolderPressingBehaviorHandler(commandOrNull, this.context));\r\n            case ClickCommandType.triggerCustomAction:\r\n                return PressingBehavior.create(element, new TriggerCustomActionPressingBehaviorHandler(commandOrNull, this.context.customActionController));\r\n            default:\r\n                throw new Error('Not supported behavior type');\r\n        }\r\n    }\r\n}\n\nclass BadgesResultFactory {\r\n    static create(services) {\r\n        return services.badges.map(ext => ext.createStartValue());\r\n    }\r\n}\n\nfunction findValidationBadgeIndex(extensions) {\r\n    return extensions.findIndex(ext => ext.id === 'validationError');\r\n}\n\nclass ContextMenu {\r\n    static create(shadowRoot, position, theme, items) {\r\n        const menu = document.createElement('div');\r\n        menu.style.left = `${position.x}px`;\r\n        menu.style.top = `${position.y}px`;\r\n        menu.className = `sqd-context-menu sqd-theme-${theme}`;\r\n        const elements = [];\r\n        for (let index = 0; index < items.length; index++) {\r\n            const item = items[index];\r\n            const element = document.createElement('div');\r\n            if (item.callback) {\r\n                element.className = 'sqd-context-menu-item';\r\n                element.innerText = item.label;\r\n            }\r\n            else {\r\n                element.className = 'sqd-context-menu-group';\r\n                element.innerText = item.label;\r\n            }\r\n            elements.push(element);\r\n            menu.appendChild(element);\r\n        }\r\n        const body = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document.body;\r\n        const dom = shadowRoot !== null && shadowRoot !== void 0 ? shadowRoot : document;\r\n        const instance = new ContextMenu(body, dom, menu, elements, items, Date.now());\r\n        dom.addEventListener('mousedown', instance.mouseDown, false);\r\n        dom.addEventListener('mouseup', instance.mouseUp, false);\r\n        dom.addEventListener('touchstart', instance.mouseDown, false);\r\n        dom.addEventListener('touchend', instance.mouseUp, false);\r\n        body.appendChild(menu);\r\n        return instance;\r\n    }\r\n    constructor(body, dom, menu, elements, items, startTime) {\r\n        this.body = body;\r\n        this.dom = dom;\r\n        this.menu = menu;\r\n        this.elements = elements;\r\n        this.items = items;\r\n        this.startTime = startTime;\r\n        this.isAttached = true;\r\n        this.mouseDown = (e) => {\r\n            const index = this.findIndex(e.target);\r\n            if (index === null) {\r\n                this.tryDestroy();\r\n            }\r\n            else {\r\n                e.preventDefault();\r\n                e.stopPropagation();\r\n            }\r\n        };\r\n        this.mouseUp = (e) => {\r\n            const dt = Date.now() - this.startTime;\r\n            if (dt < 300) {\r\n                e.preventDefault();\r\n                e.stopPropagation();\r\n                return;\r\n            }\r\n            try {\r\n                const index = this.findIndex(e.target);\r\n                if (index !== null) {\r\n                    const item = this.items[index];\r\n                    if (item.callback) {\r\n                        item.callback();\r\n                    }\r\n                }\r\n            }\r\n            finally {\r\n                this.tryDestroy();\r\n            }\r\n        };\r\n    }\r\n    findIndex(element) {\r\n        for (let index = 0; index < this.elements.length; index++) {\r\n            if (this.elements[index].contains(element)) {\r\n                return index;\r\n            }\r\n        }\r\n        return null;\r\n    }\r\n    tryDestroy() {\r\n        if (this.isAttached) {\r\n            this.body.removeChild(this.menu);\r\n            this.dom.removeEventListener('mousedown', this.mouseDown, false);\r\n            this.dom.removeEventListener('mouseup', this.mouseUp, false);\r\n            this.dom.removeEventListener('touchstart', this.mouseDown, false);\r\n            this.dom.removeEventListener('touchend', this.mouseUp, false);\r\n            this.isAttached = false;\r\n        }\r\n    }\r\n}\n\nclass ContextMenuController {\r\n    constructor(theme, configuration, itemsBuilder) {\r\n        this.theme = theme;\r\n        this.configuration = configuration;\r\n        this.itemsBuilder = itemsBuilder;\r\n    }\r\n    tryOpen(position, commandOrNull) {\r\n        if (this.configuration.contextMenu === false) {\r\n            // Context menu is disabled.\r\n            return;\r\n        }\r\n        if (this.current) {\r\n            this.current.tryDestroy();\r\n        }\r\n        const items = this.itemsBuilder.build(commandOrNull);\r\n        this.current = ContextMenu.create(this.configuration.shadowRoot, position, this.theme, items);\r\n    }\r\n    destroy() {\r\n        if (this.current) {\r\n            this.current.tryDestroy();\r\n        }\r\n    }\r\n}\n\nclass ContextMenuItemsBuilder {\r\n    constructor(viewportApi, workspaceApi, i18n, stateModifier, state, customMenuItemsProvider) {\r\n        this.viewportApi = viewportApi;\r\n        this.workspaceApi = workspaceApi;\r\n        this.i18n = i18n;\r\n        this.stateModifier = stateModifier;\r\n        this.state = state;\r\n        this.customMenuItemsProvider = customMenuItemsProvider;\r\n    }\r\n    build(commandOrNull) {\r\n        const items = [];\r\n        if (commandOrNull && commandOrNull.type === ClickCommandType.selectStep) {\r\n            const ssc = commandOrNull;\r\n            const step = ssc.component.step;\r\n            const parentSequence = ssc.component.parentSequence;\r\n            const name = this.i18n(`step.${step.type}.name`, step.name);\r\n            items.push({\r\n                label: name,\r\n                order: 0\r\n            });\r\n            this.tryAppendCustomItems(items, step, parentSequence);\r\n            if (this.stateModifier.isSelectable(step, parentSequence)) {\r\n                if (this.state.selectedStepId === step.id) {\r\n                    items.push({\r\n                        label: this.i18n('contextMenu.unselect', 'Unselect'),\r\n                        order: 10,\r\n                        callback: () => {\r\n                            this.state.setSelectedStepId(null);\r\n                        }\r\n                    });\r\n                }\r\n                else {\r\n                    items.push({\r\n                        label: this.i18n('contextMenu.select', 'Select'),\r\n                        order: 20,\r\n                        callback: () => {\r\n                            this.stateModifier.trySelectStepById(step.id);\r\n                        }\r\n                    });\r\n                }\r\n            }\r\n            if (!this.state.isReadonly) {\r\n                if (this.stateModifier.isDeletable(step.id)) {\r\n                    items.push({\r\n                        label: this.i18n('contextMenu.delete', 'Delete'),\r\n                        order: 30,\r\n                        callback: () => {\r\n                            this.stateModifier.tryDelete(step.id);\r\n                        }\r\n                    });\r\n                }\r\n                if (this.stateModifier.isDuplicable(step, parentSequence)) {\r\n                    items.push({\r\n                        label: this.i18n('contextMenu.duplicate', 'Duplicate'),\r\n                        order: 40,\r\n                        callback: () => {\r\n                            this.stateModifier.tryDuplicate(step, parentSequence);\r\n                        }\r\n                    });\r\n                }\r\n            }\r\n        }\r\n        else if (!commandOrNull) {\r\n            const rootSequence = this.workspaceApi.getRootSequence();\r\n            this.tryAppendCustomItems(items, null, rootSequence.sequence);\r\n        }\r\n        items.push({\r\n            label: this.i18n('contextMenu.resetView', 'Reset view'),\r\n            order: 50,\r\n            callback: () => {\r\n                this.viewportApi.resetViewport();\r\n            }\r\n        });\r\n        items.sort((a, b) => a.order - b.order);\r\n        return items;\r\n    }\r\n    tryAppendCustomItems(items, step, parentSequence) {\r\n        if (this.customMenuItemsProvider) {\r\n            const customItems = this.customMenuItemsProvider.getItems(step, parentSequence, this.state.definition);\r\n            for (const customItem of customItems) {\r\n                items.push(customItem);\r\n            }\r\n        }\r\n    }\r\n}\n\nconst nonPassiveOptions = {\r\n    passive: false\r\n};\r\nconst notInitializedError = 'State is not initialized';\r\nclass PinchToZoomController {\r\n    static create(workspaceApi, viewportApi, shadowRoot) {\r\n        return new PinchToZoomController(workspaceApi, viewportApi, shadowRoot);\r\n    }\r\n    constructor(workspaceApi, viewportApi, shadowRoot) {\r\n        this.workspaceApi = workspaceApi;\r\n        this.viewportApi = viewportApi;\r\n        this.shadowRoot = shadowRoot;\r\n        this.state = null;\r\n        this.onTouchMove = (e) => {\r\n            e.preventDefault();\r\n            if (!this.state) {\r\n                throw new Error(notInitializedError);\r\n            }\r\n            const touchEvent = e;\r\n            const distance = calculateFingerDistance(touchEvent);\r\n            const centerPoint = readFingerCenterPoint(touchEvent);\r\n            const deltaCenterPoint = centerPoint.subtract(this.state.lastCenterPoint);\r\n            const scale = this.viewportApi.limitScale(this.state.startScale * (distance / this.state.startDistance));\r\n            const zoomPoint = centerPoint.subtract(this.state.canvasPosition);\r\n            const zoomRealPoint = zoomPoint\r\n                .divideByScalar(this.state.lastViewport.scale)\r\n                .subtract(this.state.lastViewport.position.divideByScalar(this.state.lastViewport.scale));\r\n            const position = zoomRealPoint.multiplyByScalar(-scale).add(zoomPoint).add(deltaCenterPoint);\r\n            const newViewport = {\r\n                position,\r\n                scale\r\n            };\r\n            this.workspaceApi.setViewport(newViewport);\r\n            this.state.lastCenterPoint = centerPoint;\r\n            this.state.lastViewport = newViewport;\r\n        };\r\n        this.onTouchEnd = (e) => {\r\n            e.preventDefault();\r\n            if (!this.state) {\r\n                throw new Error(notInitializedError);\r\n            }\r\n            if (this.shadowRoot) {\r\n                this.unbind(this.shadowRoot);\r\n            }\r\n            this.unbind(window);\r\n            this.state = null;\r\n        };\r\n    }\r\n    start(startDistance, centerPoint) {\r\n        if (this.state) {\r\n            throw new Error(`State is already initialized`);\r\n        }\r\n        if (this.shadowRoot) {\r\n            this.bind(this.shadowRoot);\r\n        }\r\n        this.bind(window);\r\n        const viewport = this.workspaceApi.getViewport();\r\n        this.state = {\r\n            canvasPosition: this.workspaceApi.getCanvasPosition(),\r\n            startScale: viewport.scale,\r\n            startDistance,\r\n            lastViewport: viewport,\r\n            lastCenterPoint: centerPoint\r\n        };\r\n    }\r\n    bind(target) {\r\n        target.addEventListener('touchmove', this.onTouchMove, nonPassiveOptions);\r\n        target.addEventListener('touchend', this.onTouchEnd, nonPassiveOptions);\r\n    }\r\n    unbind(target) {\r\n        target.removeEventListener('touchmove', this.onTouchMove, nonPassiveOptions);\r\n        target.removeEventListener('touchend', this.onTouchEnd, nonPassiveOptions);\r\n    }\r\n}\n\nclass Workspace {\r\n    static create(parent, designerContext, api) {\r\n        var _a;\r\n        const view = WorkspaceView.create(parent, designerContext.componentContext);\r\n        const clickBehaviorResolver = new ClickBehaviorResolver(designerContext);\r\n        const clickBehaviorWrapper = designerContext.services.clickBehaviorWrapperExtension.create(designerContext.customActionController);\r\n        const wheelController = designerContext.services.wheelController.create(api.viewport, api.workspace);\r\n        const pinchToZoomController = PinchToZoomController.create(api.workspace, api.viewport, api.shadowRoot);\r\n        const contextMenuItemsBuilder = new ContextMenuItemsBuilder(api.viewport, api.workspace, api.i18n, designerContext.stateModifier, designerContext.state, ((_a = designerContext.services.contextMenu) === null || _a === void 0 ? void 0 : _a.createItemsProvider)\r\n            ? designerContext.services.contextMenu.createItemsProvider(designerContext.customActionController)\r\n            : undefined);\r\n        const contextMenuController = new ContextMenuController(designerContext.theme, designerContext.configuration, contextMenuItemsBuilder);\r\n        const workspace = new Workspace(view, designerContext.state, designerContext.behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, api.viewport, api.workspace, designerContext.services);\r\n        designerContext.setWorkspaceController(workspace);\r\n        designerContext.state.onViewportChanged.subscribe(workspace.onViewportChanged);\r\n        race(0, designerContext.state.onDefinitionChanged, designerContext.state.onSelectedStepIdChanged, designerContext.state.onFolderPathChanged).subscribe(r => {\r\n            workspace.onStateChanged(r[0], r[1], r[2]);\r\n        });\r\n        view.bindMouseDown(workspace.onClick);\r\n        view.bindTouchStart(workspace.onClick, workspace.onPinchToZoom);\r\n        view.bindWheel(workspace.onWheel);\r\n        view.bindContextMenu(workspace.onContextMenu);\r\n        workspace.scheduleInit();\r\n        return workspace;\r\n    }\r\n    constructor(view, state, behaviorController, wheelController, pinchToZoomController, contextMenuController, clickBehaviorResolver, clickBehaviorWrapper, viewportApi, workspaceApi, services) {\r\n        this.view = view;\r\n        this.state = state;\r\n        this.behaviorController = behaviorController;\r\n        this.wheelController = wheelController;\r\n        this.pinchToZoomController = pinchToZoomController;\r\n        this.contextMenuController = contextMenuController;\r\n        this.clickBehaviorResolver = clickBehaviorResolver;\r\n        this.clickBehaviorWrapper = clickBehaviorWrapper;\r\n        this.viewportApi = viewportApi;\r\n        this.workspaceApi = workspaceApi;\r\n        this.services = services;\r\n        this.onRendered = new SimpleEvent();\r\n        this.isValid = false;\r\n        this.initTimeout = null;\r\n        this.selectedStepComponent = null;\r\n        this.validationErrorBadgeIndex = null;\r\n        this.onClick = (position, target, buttonIndex, altKey) => {\r\n            const isPrimaryButton = buttonIndex === 0;\r\n            const isMiddleButton = buttonIndex === 1;\r\n            if (isPrimaryButton || isMiddleButton) {\r\n                const forceMove = isMiddleButton || altKey;\r\n                const commandOrNull = this.resolveClick(target, position);\r\n                const behavior = this.clickBehaviorResolver.resolve(commandOrNull, target, forceMove);\r\n                const wrappedBehavior = this.clickBehaviorWrapper.wrap(behavior, commandOrNull);\r\n                this.behaviorController.start(position, wrappedBehavior);\r\n            }\r\n        };\r\n        this.onPinchToZoom = (distance, centerPoint) => {\r\n            this.pinchToZoomController.start(distance, centerPoint);\r\n        };\r\n        this.onWheel = (e) => {\r\n            e.preventDefault();\r\n            e.stopPropagation();\r\n            this.wheelController.onWheel(e);\r\n        };\r\n        this.onContextMenu = (position, target) => {\r\n            const commandOrNull = this.resolveClick(target, position);\r\n            this.contextMenuController.tryOpen(position, commandOrNull);\r\n        };\r\n        this.onViewportChanged = (viewport) => {\r\n            this.view.setPositionAndScale(viewport.position, viewport.scale);\r\n        };\r\n    }\r\n    scheduleInit() {\r\n        this.initTimeout = setTimeout(() => {\r\n            this.initTimeout = null;\r\n            this.updateRootComponent();\r\n            this.viewportApi.resetViewport();\r\n        });\r\n    }\r\n    updateRootComponent() {\r\n        this.selectedStepComponent = null;\r\n        const rootSequence = this.workspaceApi.getRootSequence();\r\n        const parentPlaceIndicator = rootSequence.parentStep\r\n            ? {\r\n                sequence: rootSequence.parentStep.parentSequence,\r\n                index: rootSequence.parentStep.index\r\n            }\r\n            : null;\r\n        this.view.render(rootSequence.sequence, parentPlaceIndicator);\r\n        this.trySelectStepComponent(this.state.selectedStepId);\r\n        this.updateBadges();\r\n        this.onRendered.forward();\r\n    }\r\n    updateBadges() {\r\n        const result = BadgesResultFactory.create(this.services);\r\n        this.getRootComponent().updateBadges(result);\r\n        if (this.validationErrorBadgeIndex === null) {\r\n            this.validationErrorBadgeIndex = findValidationBadgeIndex(this.services.badges);\r\n        }\r\n        this.isValid = Boolean(result[this.validationErrorBadgeIndex]);\r\n    }\r\n    resolvePlaceholders(skipComponent) {\r\n        const result = {\r\n            placeholders: [],\r\n            components: []\r\n        };\r\n        this.getRootComponent().resolvePlaceholders(skipComponent, result);\r\n        return result;\r\n    }\r\n    getComponentByStepId(stepId) {\r\n        const component = this.getRootComponent().findById(stepId);\r\n        if (!component) {\r\n            throw new Error(`Cannot find component for step id: ${stepId}`);\r\n        }\r\n        return component;\r\n    }\r\n    getCanvasPosition() {\r\n        return this.view.getCanvasPosition();\r\n    }\r\n    getCanvasSize() {\r\n        return this.view.getCanvasSize();\r\n    }\r\n    getRootComponentSize() {\r\n        const view = this.getRootComponent().view;\r\n        return new Vector(view.width, view.height);\r\n    }\r\n    updateCanvasSize() {\r\n        setTimeout(() => this.view.refreshSize());\r\n    }\r\n    destroy() {\r\n        if (this.initTimeout) {\r\n            clearTimeout(this.initTimeout);\r\n            this.initTimeout = null;\r\n        }\r\n        this.contextMenuController.destroy();\r\n        this.view.destroy();\r\n    }\r\n    onStateChanged(definitionChanged, selectedStepIdChanged, folderPathChanged) {\r\n        if (folderPathChanged) {\r\n            this.updateRootComponent();\r\n            this.viewportApi.resetViewport();\r\n        }\r\n        else if (definitionChanged) {\r\n            if (definitionChanged.changeType === DefinitionChangeType.stepPropertyChanged) {\r\n                this.updateBadges();\r\n            }\r\n            else {\r\n                this.updateRootComponent();\r\n            }\r\n        }\r\n        else if (selectedStepIdChanged !== undefined) {\r\n            this.trySelectStepComponent(selectedStepIdChanged);\r\n        }\r\n    }\r\n    trySelectStepComponent(stepId) {\r\n        if (this.selectedStepComponent) {\r\n            this.selectedStepComponent.setIsSelected(false);\r\n            this.selectedStepComponent = null;\r\n        }\r\n        if (stepId) {\r\n            this.selectedStepComponent = this.getRootComponent().findById(stepId);\r\n            if (this.selectedStepComponent) {\r\n                this.selectedStepComponent.setIsSelected(true);\r\n            }\r\n        }\r\n    }\r\n    resolveClick(element, position) {\r\n        const click = {\r\n            element,\r\n            position,\r\n            scale: this.state.viewport.scale\r\n        };\r\n        return this.getRootComponent().resolveClick(click);\r\n    }\r\n    getRootComponent() {\r\n        if (this.view.rootComponent) {\r\n            return this.view.rootComponent;\r\n        }\r\n        throw new Error('Root component not found');\r\n    }\r\n}\n\nclass DesignerView {\r\n    static create(parent, designerContext, api) {\r\n        const root = Dom.element('div', {\r\n            class: `sqd-designer sqd-theme-${designerContext.theme}`\r\n        });\r\n        parent.appendChild(root);\r\n        const workspace = Workspace.create(root, designerContext, api);\r\n        const uiComponents = designerContext.services.uiComponents.map(factory => factory.create(root, api));\r\n        const daemons = designerContext.services.daemons.map(factory => factory.create(api));\r\n        const view = new DesignerView(root, designerContext.layoutController, workspace, uiComponents, daemons);\r\n        view.applyLayout();\r\n        window.addEventListener('resize', view.onResize, false);\r\n        return view;\r\n    }\r\n    constructor(root, layoutController, workspace, uiComponents, daemons) {\r\n        this.root = root;\r\n        this.layoutController = layoutController;\r\n        this.workspace = workspace;\r\n        this.uiComponents = uiComponents;\r\n        this.daemons = daemons;\r\n        this.onResize = () => {\r\n            this.updateLayout();\r\n        };\r\n    }\r\n    updateLayout() {\r\n        this.applyLayout();\r\n        for (const component of this.uiComponents) {\r\n            component.updateLayout();\r\n        }\r\n    }\r\n    destroy() {\r\n        var _a;\r\n        window.removeEventListener('resize', this.onResize, false);\r\n        this.workspace.destroy();\r\n        this.uiComponents.forEach(component => component.destroy());\r\n        this.daemons.forEach(daemon => daemon.destroy());\r\n        (_a = this.root.parentElement) === null || _a === void 0 ? void 0 : _a.removeChild(this.root);\r\n    }\r\n    applyLayout() {\r\n        const isMobile = this.layoutController.isMobile();\r\n        Dom.toggleClass(this.root, !isMobile, 'sqd-layout-desktop');\r\n        Dom.toggleClass(this.root, isMobile, 'sqd-layout-mobile');\r\n    }\r\n}\n\nconst SAFE_OFFSET = 10;\r\nclass DefaultDraggedComponent {\r\n    static create(parent, step, componentContext) {\r\n        const canvas = Dom.svg('svg');\r\n        canvas.style.marginLeft = -10 + 'px';\r\n        canvas.style.marginTop = -10 + 'px';\r\n        parent.appendChild(canvas);\r\n        const previewStepContext = {\r\n            parentSequence: [],\r\n            step,\r\n            depth: 0,\r\n            position: 0,\r\n            isInputConnected: true,\r\n            isOutputConnected: true,\r\n            isPreview: true\r\n        };\r\n        const stepComponent = componentContext.stepComponentFactory.create(canvas, previewStepContext, componentContext);\r\n        Dom.attrs(canvas, {\r\n            width: stepComponent.view.width + SAFE_OFFSET * 2,\r\n            height: stepComponent.view.height + SAFE_OFFSET * 2\r\n        });\r\n        Dom.translate(stepComponent.view.g, SAFE_OFFSET, SAFE_OFFSET);\r\n        return new DefaultDraggedComponent(stepComponent.view.width, stepComponent.view.height);\r\n    }\r\n    constructor(width, height) {\r\n        this.width = width;\r\n        this.height = height;\r\n    }\r\n    destroy() {\r\n        // Nothing to destroy...\r\n    }\r\n}\n\nclass DefaultDraggedComponentExtension {\r\n    constructor() {\r\n        this.create = DefaultDraggedComponent.create;\r\n    }\r\n}\n\nclass ControlBarView {\r\n    static create(parent, isUndoRedoSupported, i18n) {\r\n        const root = Dom.element('div', {\r\n            class: 'sqd-control-bar'\r\n        });\r\n        const resetButton = createButton(Icons.center, i18n('controlBar.resetView', 'Reset view'));\r\n        root.appendChild(resetButton);\r\n        const zoomInButton = createButton(Icons.zoomIn, i18n('controlBar.zoomIn', 'Zoom in'));\r\n        root.appendChild(zoomInButton);\r\n        const zoomOutButton = createButton(Icons.zoomOut, i18n('controlBar.zoomOut', 'Zoom out'));\r\n        root.appendChild(zoomOutButton);\r\n        let undoButton = null;\r\n        let redoButton = null;\r\n        if (isUndoRedoSupported) {\r\n            undoButton = createButton(Icons.undo, i18n('controlBar.undo', 'Undo'));\r\n            root.appendChild(undoButton);\r\n            redoButton = createButton(Icons.redo, i18n('controlBar.redo', 'Redo'));\r\n            root.appendChild(redoButton);\r\n        }\r\n        const disableDragButton = createButton(Icons.move, i18n('controlBar.turnOnOffDragAndDrop', 'Turn on/off drag and drop'));\r\n        disableDragButton.classList.add('sqd-disabled');\r\n        root.appendChild(disableDragButton);\r\n        const deleteButton = createButton(Icons.delete, i18n('controlBar.deleteSelectedStep', 'Delete selected step'));\r\n        deleteButton.classList.add('sqd-delete');\r\n        deleteButton.classList.add('sqd-hidden');\r\n        root.appendChild(deleteButton);\r\n        parent.appendChild(root);\r\n        return new ControlBarView(resetButton, zoomInButton, zoomOutButton, undoButton, redoButton, disableDragButton, deleteButton);\r\n    }\r\n    constructor(resetButton, zoomInButton, zoomOutButton, undoButton, redoButton, disableDragButton, deleteButton) {\r\n        this.resetButton = resetButton;\r\n        this.zoomInButton = zoomInButton;\r\n        this.zoomOutButton = zoomOutButton;\r\n        this.undoButton = undoButton;\r\n        this.redoButton = redoButton;\r\n        this.disableDragButton = disableDragButton;\r\n        this.deleteButton = deleteButton;\r\n    }\r\n    bindResetButtonClick(handler) {\r\n        bindClick(this.resetButton, handler);\r\n    }\r\n    bindZoomInButtonClick(handler) {\r\n        bindClick(this.zoomInButton, handler);\r\n    }\r\n    bindZoomOutButtonClick(handler) {\r\n        bindClick(this.zoomOutButton, handler);\r\n    }\r\n    bindUndoButtonClick(handler) {\r\n        if (!this.undoButton) {\r\n            throw new Error('Undo button is disabled');\r\n        }\r\n        bindClick(this.undoButton, handler);\r\n    }\r\n    bindRedoButtonClick(handler) {\r\n        if (!this.redoButton) {\r\n            throw new Error('Redo button is disabled');\r\n        }\r\n        bindClick(this.redoButton, handler);\r\n    }\r\n    bindDisableDragButtonClick(handler) {\r\n        bindClick(this.disableDragButton, handler);\r\n    }\r\n    bindDeleteButtonClick(handler) {\r\n        bindClick(this.deleteButton, handler);\r\n    }\r\n    setIsDeleteButtonHidden(isHidden) {\r\n        Dom.toggleClass(this.deleteButton, isHidden, 'sqd-hidden');\r\n    }\r\n    setDisableDragButtonDisabled(isDisabled) {\r\n        Dom.toggleClass(this.disableDragButton, isDisabled, 'sqd-disabled');\r\n    }\r\n    setUndoButtonDisabled(isDisabled) {\r\n        if (!this.undoButton) {\r\n            throw new Error('Undo button is disabled');\r\n        }\r\n        Dom.toggleClass(this.undoButton, isDisabled, 'sqd-disabled');\r\n    }\r\n    setRedoButtonDisabled(isDisabled) {\r\n        if (!this.redoButton) {\r\n            throw new Error('Redo button is disabled');\r\n        }\r\n        Dom.toggleClass(this.redoButton, isDisabled, 'sqd-disabled');\r\n    }\r\n}\r\nfunction bindClick(element, handler) {\r\n    element.addEventListener('click', e => {\r\n        e.preventDefault();\r\n        handler();\r\n    }, false);\r\n}\r\nfunction createButton(d, title) {\r\n    const button = Dom.element('div', {\r\n        class: 'sqd-control-bar-button',\r\n        title\r\n    });\r\n    const icon = Icons.createSvg('sqd-control-bar-button-icon', d);\r\n    button.appendChild(icon);\r\n    return button;\r\n}\n\nclass ControlBar {\r\n    static create(parent, api) {\r\n        const isUndoRedoSupported = api.controlBar.isUndoRedoSupported();\r\n        const view = ControlBarView.create(parent, isUndoRedoSupported, api.i18n);\r\n        const bar = new ControlBar(view, api.controlBar, api.viewport, isUndoRedoSupported);\r\n        view.bindResetButtonClick(() => bar.onResetButtonClicked());\r\n        view.bindZoomInButtonClick(() => bar.onZoomInButtonClicked());\r\n        view.bindZoomOutButtonClick(() => bar.onZoomOutButtonClicked());\r\n        view.bindDisableDragButtonClick(() => bar.onMoveButtonClicked());\r\n        view.bindDeleteButtonClick(() => bar.onDeleteButtonClicked());\r\n        api.controlBar.onStateChanged.subscribe(() => bar.refreshButtons());\r\n        if (isUndoRedoSupported) {\r\n            view.bindUndoButtonClick(() => bar.onUndoButtonClicked());\r\n            view.bindRedoButtonClick(() => bar.onRedoButtonClicked());\r\n        }\r\n        bar.refreshButtons();\r\n        return bar;\r\n    }\r\n    constructor(view, controlBarApi, viewportApi, isUndoRedoSupported) {\r\n        this.view = view;\r\n        this.controlBarApi = controlBarApi;\r\n        this.viewportApi = viewportApi;\r\n        this.isUndoRedoSupported = isUndoRedoSupported;\r\n    }\r\n    updateLayout() {\r\n        //\r\n    }\r\n    destroy() {\r\n        //\r\n    }\r\n    onResetButtonClicked() {\r\n        this.viewportApi.resetViewport();\r\n    }\r\n    onZoomInButtonClicked() {\r\n        this.viewportApi.zoom(true);\r\n    }\r\n    onZoomOutButtonClicked() {\r\n        this.viewportApi.zoom(false);\r\n    }\r\n    onMoveButtonClicked() {\r\n        this.controlBarApi.toggleIsDragDisabled();\r\n    }\r\n    onUndoButtonClicked() {\r\n        this.controlBarApi.tryUndo();\r\n    }\r\n    onRedoButtonClicked() {\r\n        this.controlBarApi.tryRedo();\r\n    }\r\n    onDeleteButtonClicked() {\r\n        this.controlBarApi.tryDelete();\r\n    }\r\n    refreshButtons() {\r\n        this.refreshDeleteButtonVisibility();\r\n        this.refreshIsDragDisabled();\r\n        if (this.isUndoRedoSupported) {\r\n            this.refreshUndoRedoAvailability();\r\n        }\r\n    }\r\n    //\r\n    refreshIsDragDisabled() {\r\n        const isDragDisabled = this.controlBarApi.isDragDisabled();\r\n        this.view.setDisableDragButtonDisabled(!isDragDisabled);\r\n    }\r\n    refreshUndoRedoAvailability() {\r\n        const canUndo = this.controlBarApi.canUndo();\r\n        const canRedo = this.controlBarApi.canRedo();\r\n        this.view.setUndoButtonDisabled(!canUndo);\r\n        this.view.setRedoButtonDisabled(!canRedo);\r\n    }\r\n    refreshDeleteButtonVisibility() {\r\n        const canDelete = this.controlBarApi.canDelete();\r\n        this.view.setIsDeleteButtonHidden(!canDelete);\r\n    }\r\n}\n\nclass ControlBarExtension {\r\n    constructor() {\r\n        this.create = ControlBar.create;\r\n    }\r\n}\n\nconst ignoreTagNames = ['INPUT', 'TEXTAREA', 'SELECT'];\r\nclass KeyboardDaemon {\r\n    static create(api, configuration) {\r\n        const dom = api.shadowRoot || document;\r\n        const controller = new KeyboardDaemon(dom, api.controlBar, configuration);\r\n        dom.addEventListener('keyup', controller.onKeyUp, false);\r\n        return controller;\r\n    }\r\n    constructor(dom, controlBarApi, configuration) {\r\n        this.dom = dom;\r\n        this.controlBarApi = controlBarApi;\r\n        this.configuration = configuration;\r\n        this.onKeyUp = (e) => {\r\n            const ke = e;\r\n            const action = detectAction(ke);\r\n            if (!action) {\r\n                return;\r\n            }\r\n            if (document.activeElement && ignoreTagNames.includes(document.activeElement.tagName)) {\r\n                return;\r\n            }\r\n            if (this.configuration.canHandleKey && !this.configuration.canHandleKey(action, ke)) {\r\n                return;\r\n            }\r\n            const isDeletable = this.controlBarApi.canDelete();\r\n            if (isDeletable) {\r\n                e.preventDefault();\r\n                e.stopPropagation();\r\n                this.controlBarApi.tryDelete();\r\n            }\r\n        };\r\n    }\r\n    destroy() {\r\n        this.dom.removeEventListener('keyup', this.onKeyUp, false);\r\n    }\r\n}\r\nfunction detectAction(e) {\r\n    if (e.key === 'Backspace' || e.key === 'Delete') {\r\n        return KeyboardAction.delete;\r\n    }\r\n    return null;\r\n}\n\nclass KeyboardDaemonExtension {\r\n    static create(configuration) {\r\n        if (configuration === undefined || configuration === true) {\r\n            configuration = {};\r\n        }\r\n        return new KeyboardDaemonExtension(configuration);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n    }\r\n    create(api) {\r\n        return KeyboardDaemon.create(api, this.configuration);\r\n    }\r\n}\n\nclass SmartEditorView {\r\n    static create(parent, api, i18n, configuration) {\r\n        const root = Dom.element('div', {\r\n            class: 'sqd-smart-editor'\r\n        });\r\n        const toggle = Dom.element('div', {\r\n            class: 'sqd-smart-editor-toggle',\r\n            title: i18n('smartEditor.toggle', 'Toggle editor')\r\n        });\r\n        parent.appendChild(toggle);\r\n        parent.appendChild(root);\r\n        const editor = Editor.create(root, api, 'sqd-editor sqd-step-editor', configuration.stepEditorProvider, 'sqd-editor sqd-root-editor', configuration.rootEditorProvider, null);\r\n        return new SmartEditorView(root, toggle, editor);\r\n    }\r\n    constructor(root, toggle, editor) {\r\n        this.root = root;\r\n        this.toggle = toggle;\r\n        this.editor = editor;\r\n    }\r\n    bindToggleClick(handler) {\r\n        this.toggle.addEventListener('click', e => {\r\n            e.preventDefault();\r\n            handler();\r\n        }, false);\r\n    }\r\n    setIsCollapsed(isCollapsed) {\r\n        Dom.toggleClass(this.root, isCollapsed, 'sqd-hidden');\r\n        Dom.toggleClass(this.toggle, isCollapsed, 'sqd-collapsed');\r\n        if (this.toggleIcon) {\r\n            this.toggle.removeChild(this.toggleIcon);\r\n        }\r\n        this.toggleIcon = Icons.createSvg('sqd-smart-editor-toggle-icon', isCollapsed ? Icons.options : Icons.close);\r\n        this.toggle.appendChild(this.toggleIcon);\r\n    }\r\n    destroy() {\r\n        this.editor.destroy();\r\n    }\r\n}\n\nclass SmartEditor {\r\n    static create(parent, api, configuration) {\r\n        const view = SmartEditorView.create(parent, api.editor, api.i18n, configuration);\r\n        const editor = new SmartEditor(view, api.editor, api.workspace);\r\n        editor.updateVisibility();\r\n        view.bindToggleClick(() => editor.onToggleClicked());\r\n        api.editor.subscribeIsCollapsed(() => editor.onIsCollapsedChanged());\r\n        return editor;\r\n    }\r\n    constructor(view, editorApi, workspaceApi) {\r\n        this.view = view;\r\n        this.editorApi = editorApi;\r\n        this.workspaceApi = workspaceApi;\r\n    }\r\n    onToggleClicked() {\r\n        this.editorApi.toggleIsCollapsed();\r\n    }\r\n    setIsCollapsed(isCollapsed) {\r\n        this.view.setIsCollapsed(isCollapsed);\r\n    }\r\n    onIsCollapsedChanged() {\r\n        this.updateVisibility();\r\n        this.workspaceApi.updateCanvasSize();\r\n    }\r\n    updateVisibility() {\r\n        this.setIsCollapsed(this.editorApi.isCollapsed());\r\n    }\r\n    updateLayout() {\r\n        //\r\n    }\r\n    destroy() {\r\n        this.view.destroy();\r\n    }\r\n}\n\nclass SmartEditorExtension {\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n    }\r\n    create(root, api) {\r\n        return SmartEditor.create(root, api, this.configuration);\r\n    }\r\n}\n\nconst MAX_DELTA_Y = 25;\r\nconst listenerOptions = {\r\n    passive: false\r\n};\r\nclass ScrollBoxView {\r\n    static create(parent, viewport) {\r\n        const root = Dom.element('div', {\r\n            class: 'sqd-scrollbox'\r\n        });\r\n        parent.appendChild(root);\r\n        const view = new ScrollBoxView(root, viewport);\r\n        root.addEventListener('wheel', e => view.onWheel(e), listenerOptions);\r\n        root.addEventListener('touchstart', e => view.onTouchStart(e), listenerOptions);\r\n        root.addEventListener('mousedown', e => view.onMouseDown(e), false);\r\n        return view;\r\n    }\r\n    constructor(root, viewport) {\r\n        this.root = root;\r\n        this.viewport = viewport;\r\n        this.onTouchStart = (e) => {\r\n            e.preventDefault();\r\n            this.startScroll(readTouchPosition(e));\r\n        };\r\n        this.onMouseDown = (e) => {\r\n            e.preventDefault();\r\n            this.startScroll(readMousePosition(e));\r\n        };\r\n        this.onTouchMove = (e) => {\r\n            e.preventDefault();\r\n            this.moveScroll(readTouchPosition(e));\r\n        };\r\n        this.onMouseMove = (e) => {\r\n            e.preventDefault();\r\n            this.moveScroll(readMousePosition(e));\r\n        };\r\n        this.onTouchEnd = (e) => {\r\n            e.preventDefault();\r\n            this.stopScroll();\r\n        };\r\n        this.onMouseUp = (e) => {\r\n            e.preventDefault();\r\n            this.stopScroll();\r\n        };\r\n    }\r\n    setContent(element) {\r\n        if (this.content) {\r\n            this.root.removeChild(this.content.element);\r\n        }\r\n        element.classList.add('sqd-scrollbox-body');\r\n        this.root.appendChild(element);\r\n        this.reload(element);\r\n    }\r\n    updateLayout() {\r\n        if (this.content) {\r\n            this.reload(this.content.element);\r\n        }\r\n    }\r\n    destroy() {\r\n        //\r\n    }\r\n    reload(element) {\r\n        const maxHeightPercent = 0.7;\r\n        const minDistance = 206;\r\n        let height = Math.min(this.viewport.clientHeight * maxHeightPercent, element.clientHeight);\r\n        height = Math.min(height, this.viewport.clientHeight - minDistance);\r\n        this.root.style.height = height + 'px';\r\n        element.style.top = '0px';\r\n        this.content = {\r\n            element,\r\n            height\r\n        };\r\n    }\r\n    onWheel(e) {\r\n        e.preventDefault();\r\n        e.stopPropagation();\r\n        if (this.content) {\r\n            const delta = Math.sign(e.deltaY) * Math.min(Math.abs(e.deltaY), MAX_DELTA_Y);\r\n            const scrollTop = this.getScrollTop();\r\n            this.setScrollTop(scrollTop - delta);\r\n        }\r\n    }\r\n    startScroll(startPosition) {\r\n        if (!this.scroll) {\r\n            window.addEventListener('touchmove', this.onTouchMove, listenerOptions);\r\n            window.addEventListener('mousemove', this.onMouseMove, false);\r\n            window.addEventListener('touchend', this.onTouchEnd, listenerOptions);\r\n            window.addEventListener('mouseup', this.onMouseUp, false);\r\n        }\r\n        this.scroll = {\r\n            startPositionY: startPosition.y,\r\n            startScrollTop: this.getScrollTop()\r\n        };\r\n    }\r\n    moveScroll(position) {\r\n        if (this.scroll) {\r\n            const delta = position.y - this.scroll.startPositionY;\r\n            this.setScrollTop(this.scroll.startScrollTop + delta);\r\n        }\r\n    }\r\n    stopScroll() {\r\n        if (this.scroll) {\r\n            window.removeEventListener('touchmove', this.onTouchMove, listenerOptions);\r\n            window.removeEventListener('mousemove', this.onMouseMove, false);\r\n            window.removeEventListener('touchend', this.onTouchEnd, listenerOptions);\r\n            window.removeEventListener('mouseup', this.onMouseUp, false);\r\n            this.scroll = undefined;\r\n        }\r\n    }\r\n    getScrollTop() {\r\n        if (this.content && this.content.element.style.top) {\r\n            return parseInt(this.content.element.style.top);\r\n        }\r\n        return 0;\r\n    }\r\n    setScrollTop(scrollTop) {\r\n        if (this.content) {\r\n            const max = this.content.element.clientHeight - this.content.height;\r\n            const limited = Math.max(Math.min(scrollTop, 0), -max);\r\n            this.content.element.style.top = limited + 'px';\r\n        }\r\n    }\r\n}\n\nclass ToolboxItemView {\r\n    static create(parent, data) {\r\n        const root = Dom.element('div', {\r\n            class: `sqd-toolbox-item sqd-type-${data.step.type}`,\r\n            title: data.description\r\n        });\r\n        const icon = Dom.element('div', {\r\n            class: 'sqd-toolbox-item-icon'\r\n        });\r\n        if (data.iconUrl) {\r\n            const iconImage = Dom.element('img', {\r\n                class: 'sqd-toolbox-item-icon-image',\r\n                src: data.iconUrl,\r\n                draggable: 'false'\r\n            });\r\n            icon.appendChild(iconImage);\r\n        }\r\n        else {\r\n            icon.classList.add('sqd-no-icon');\r\n        }\r\n        const text = Dom.element('div', {\r\n            class: 'sqd-toolbox-item-text'\r\n        });\r\n        text.textContent = data.label;\r\n        root.appendChild(icon);\r\n        root.appendChild(text);\r\n        parent.appendChild(root);\r\n        return new ToolboxItemView(root);\r\n    }\r\n    constructor(root) {\r\n        this.root = root;\r\n    }\r\n    bindMousedown(handler) {\r\n        this.root.addEventListener('mousedown', handler, false);\r\n    }\r\n    bindTouchstart(handler) {\r\n        this.root.addEventListener('touchstart', handler, false);\r\n    }\r\n    bindContextMenu(handler) {\r\n        this.root.addEventListener('contextmenu', handler, false);\r\n    }\r\n}\n\nclass ToolboxItem {\r\n    static create(parent, data, api) {\r\n        const view = ToolboxItemView.create(parent, data);\r\n        const item = new ToolboxItem(data.step, api);\r\n        view.bindMousedown(e => item.onMousedown(e));\r\n        view.bindTouchstart(e => item.onTouchstart(e));\r\n        view.bindContextMenu(e => item.onContextMenu(e));\r\n        return item;\r\n    }\r\n    constructor(step, api) {\r\n        this.step = step;\r\n        this.api = api;\r\n    }\r\n    onTouchstart(e) {\r\n        e.preventDefault();\r\n        if (e.touches.length === 1) {\r\n            // We stop propagation only if it was a single touch event (we can start dragging).\r\n            // Otherwise we want to bubble up the event to the scrollbox.\r\n            e.stopPropagation();\r\n            this.tryDrag(readTouchPosition(e));\r\n        }\r\n    }\r\n    onMousedown(e) {\r\n        e.preventDefault();\r\n        e.stopPropagation();\r\n        const isPrimaryButton = e.button === 0;\r\n        if (isPrimaryButton) {\r\n            this.tryDrag(readMousePosition(e));\r\n        }\r\n    }\r\n    onContextMenu(e) {\r\n        e.preventDefault();\r\n    }\r\n    tryDrag(position) {\r\n        this.api.tryDrag(position, this.step);\r\n    }\r\n}\n\nclass ToolboxView {\r\n    static create(parent, api, i18n) {\r\n        const root = Dom.element('div', {\r\n            class: 'sqd-toolbox'\r\n        });\r\n        const header = Dom.element('div', {\r\n            class: 'sqd-toolbox-header'\r\n        });\r\n        const headerTitle = Dom.element('div', {\r\n            class: 'sqd-toolbox-header-title'\r\n        });\r\n        headerTitle.innerText = i18n('toolbox.title', 'Toolbox');\r\n        const body = Dom.element('div', {\r\n            class: 'sqd-toolbox-body'\r\n        });\r\n        const filter = Dom.element('div', {\r\n            class: 'sqd-toolbox-filter'\r\n        });\r\n        const filterInput = Dom.element('input', {\r\n            class: 'sqd-toolbox-filter-input',\r\n            type: 'text',\r\n            placeholder: i18n('toolbox.search', 'Search...')\r\n        });\r\n        root.appendChild(header);\r\n        root.appendChild(body);\r\n        header.appendChild(headerTitle);\r\n        filter.appendChild(filterInput);\r\n        body.appendChild(filter);\r\n        parent.appendChild(root);\r\n        const scrollBoxView = ScrollBoxView.create(body, parent);\r\n        return new ToolboxView(header, body, filterInput, scrollBoxView, api);\r\n    }\r\n    constructor(header, body, filterInput, scrollBoxView, api) {\r\n        this.header = header;\r\n        this.body = body;\r\n        this.filterInput = filterInput;\r\n        this.scrollBoxView = scrollBoxView;\r\n        this.api = api;\r\n    }\r\n    updateLayout() {\r\n        this.scrollBoxView.updateLayout();\r\n    }\r\n    bindToggleClick(handler) {\r\n        function forward(e) {\r\n            e.preventDefault();\r\n            handler();\r\n        }\r\n        this.header.addEventListener('click', forward, false);\r\n    }\r\n    bindFilterInputChange(handler) {\r\n        function forward(e) {\r\n            handler(e.target.value);\r\n        }\r\n        this.filterInput.addEventListener('keyup', forward, false);\r\n        this.filterInput.addEventListener('blur', forward, false);\r\n    }\r\n    setIsCollapsed(isCollapsed) {\r\n        Dom.toggleClass(this.body, isCollapsed, 'sqd-hidden');\r\n        if (this.headerToggleIcon) {\r\n            this.header.removeChild(this.headerToggleIcon);\r\n        }\r\n        this.headerToggleIcon = Icons.createSvg('sqd-toolbox-toggle-icon', isCollapsed ? Icons.expand : Icons.close);\r\n        this.header.appendChild(this.headerToggleIcon);\r\n        if (!isCollapsed) {\r\n            this.updateLayout();\r\n        }\r\n    }\r\n    setGroups(groups) {\r\n        const list = Dom.element('div');\r\n        groups.forEach(group => {\r\n            const groupTitle = Dom.element('div', {\r\n                class: 'sqd-toolbox-group-title'\r\n            });\r\n            groupTitle.innerText = group.name;\r\n            list.appendChild(groupTitle);\r\n            group.items.forEach(item => ToolboxItem.create(list, item, this.api));\r\n        });\r\n        this.scrollBoxView.setContent(list);\r\n    }\r\n    destroy() {\r\n        this.scrollBoxView.destroy();\r\n    }\r\n}\n\nclass Toolbox {\r\n    static create(root, api, i18n) {\r\n        const allGroups = api.getAllGroups();\r\n        const view = ToolboxView.create(root, api, i18n);\r\n        const toolbox = new Toolbox(view, api, allGroups);\r\n        toolbox.render();\r\n        toolbox.onIsCollapsedChanged();\r\n        view.bindToggleClick(() => toolbox.onToggleClicked());\r\n        view.bindFilterInputChange(v => toolbox.onFilterInputChanged(v));\r\n        api.subscribeIsCollapsed(() => toolbox.onIsCollapsedChanged());\r\n        return toolbox;\r\n    }\r\n    constructor(view, api, allGroups) {\r\n        this.view = view;\r\n        this.api = api;\r\n        this.allGroups = allGroups;\r\n    }\r\n    updateLayout() {\r\n        this.view.updateLayout();\r\n    }\r\n    destroy() {\r\n        this.view.destroy();\r\n    }\r\n    render() {\r\n        const groups = this.api.applyFilter(this.allGroups, this.filter);\r\n        this.view.setGroups(groups);\r\n    }\r\n    onIsCollapsedChanged() {\r\n        this.view.setIsCollapsed(this.api.isCollapsed());\r\n    }\r\n    onToggleClicked() {\r\n        this.api.toggleIsCollapsed();\r\n    }\r\n    onFilterInputChanged(value) {\r\n        this.filter = value;\r\n        this.render();\r\n    }\r\n}\n\nclass ToolboxExtension {\r\n    create(root, api) {\r\n        return Toolbox.create(root, api.toolbox, api.i18n);\r\n    }\r\n}\n\nclass DefaultPlaceholderControllerExtension {\r\n    create() {\r\n        return {\r\n            canCreate: () => true\r\n        };\r\n    }\r\n}\n\nconst defaultConfiguration = {\r\n    gapWidth: 88,\r\n    gapHeight: 24,\r\n    radius: 6,\r\n    iconSize: 16\r\n};\r\nclass RectPlaceholderExtension {\r\n    static create(configuration) {\r\n        return new RectPlaceholderExtension(configuration !== null && configuration !== void 0 ? configuration : defaultConfiguration);\r\n    }\r\n    constructor(configuration) {\r\n        this.configuration = configuration;\r\n        this.gapSize = new Vector(this.configuration.gapWidth, this.configuration.gapHeight);\r\n    }\r\n    createForGap(parent, parentSequence, index) {\r\n        return RectPlaceholder.create(parent, this.gapSize, PlaceholderDirection.none, parentSequence, index, this.configuration);\r\n    }\r\n    createForArea(parent, size, direction, parentSequence, index) {\r\n        return RectPlaceholder.create(parent, size, direction, parentSequence, index, this.configuration);\r\n    }\r\n}\n\nclass DefaultSequenceComponentExtension {\r\n    constructor() {\r\n        this.create = DefaultSequenceComponent.create;\r\n    }\r\n}\n\nclass DefaultStepComponentViewWrapperExtension {\r\n    constructor() {\r\n        this.wrap = (view) => view;\r\n    }\r\n}\n\nclass DefaultClickBehaviorWrapper {\r\n    constructor() {\r\n        this.wrap = (behavior) => behavior;\r\n    }\r\n}\n\nclass DefaultClickBehaviorWrapperExtension {\r\n    create() {\r\n        return new DefaultClickBehaviorWrapper();\r\n    }\r\n}\n\nclass DefaultStepBadgesDecoratorExtension {\r\n    create(g, view, badges) {\r\n        const position = new Vector(view.width, 0);\r\n        return new DefaultBadgesDecorator(position, badges, g);\r\n    }\r\n}\n\nclass ServicesResolver {\r\n    static resolve(extensions, configuration) {\r\n        const services = {};\r\n        merge(services, extensions || []);\r\n        setDefaults(services, configuration);\r\n        return services;\r\n    }\r\n}\r\nfunction merge(services, extensions) {\r\n    for (const ext of extensions) {\r\n        if (ext.steps) {\r\n            services.steps = (services.steps || []).concat(ext.steps);\r\n        }\r\n        if (ext.stepComponentViewWrapper) {\r\n            services.stepComponentViewWrapper = ext.stepComponentViewWrapper;\r\n        }\r\n        if (ext.stepBadgesDecorator) {\r\n            services.stepBadgesDecorator = ext.stepBadgesDecorator;\r\n        }\r\n        if (ext.clickBehaviorWrapperExtension) {\r\n            services.clickBehaviorWrapperExtension = ext.clickBehaviorWrapperExtension;\r\n        }\r\n        if (ext.badges) {\r\n            services.badges = (services.badges || []).concat(ext.badges);\r\n        }\r\n        if (ext.uiComponents) {\r\n            services.uiComponents = (services.uiComponents || []).concat(ext.uiComponents);\r\n        }\r\n        if (ext.draggedComponent) {\r\n            services.draggedComponent = ext.draggedComponent;\r\n        }\r\n        if (ext.wheelController) {\r\n            services.wheelController = ext.wheelController;\r\n        }\r\n        if (ext.placeholderController) {\r\n            services.placeholderController = ext.placeholderController;\r\n        }\r\n        if (ext.placeholder) {\r\n            services.placeholder = ext.placeholder;\r\n        }\r\n        if (ext.regionComponentView) {\r\n            services.regionComponentView = ext.regionComponentView;\r\n        }\r\n        if (ext.viewportController) {\r\n            services.viewportController = ext.viewportController;\r\n        }\r\n        if (ext.grid) {\r\n            services.grid = ext.grid;\r\n        }\r\n        if (ext.rootComponent) {\r\n            services.rootComponent = ext.rootComponent;\r\n        }\r\n        if (ext.sequenceComponent) {\r\n            services.sequenceComponent = ext.sequenceComponent;\r\n        }\r\n        if (ext.contextMenu) {\r\n            services.contextMenu = ext.contextMenu;\r\n        }\r\n        if (ext.daemons) {\r\n            services.daemons = (services.daemons || []).concat(ext.daemons);\r\n        }\r\n    }\r\n}\r\nfunction setDefaults(services, configuration) {\r\n    if (!services.steps) {\r\n        services.steps = [];\r\n    }\r\n    services.steps.push(ContainerStepExtension.create());\r\n    services.steps.push(SwitchStepExtension.create());\r\n    services.steps.push(TaskStepExtension.create());\r\n    if (!services.stepComponentViewWrapper) {\r\n        services.stepComponentViewWrapper = new DefaultStepComponentViewWrapperExtension();\r\n    }\r\n    if (!services.stepBadgesDecorator) {\r\n        services.stepBadgesDecorator = new DefaultStepBadgesDecoratorExtension();\r\n    }\r\n    if (!services.clickBehaviorWrapperExtension) {\r\n        services.clickBehaviorWrapperExtension = new DefaultClickBehaviorWrapperExtension();\r\n    }\r\n    if (!services.badges) {\r\n        services.badges = [];\r\n    }\r\n    if (findValidationBadgeIndex(services.badges) < 0) {\r\n        services.badges.push(ValidationErrorBadgeExtension.create());\r\n    }\r\n    if (!services.draggedComponent) {\r\n        services.draggedComponent = new DefaultDraggedComponentExtension();\r\n    }\r\n    if (!services.uiComponents) {\r\n        services.uiComponents = [];\r\n    }\r\n    if (configuration.controlBar) {\r\n        services.uiComponents.push(new ControlBarExtension());\r\n    }\r\n    if (configuration.editors) {\r\n        services.uiComponents.push(new SmartEditorExtension(configuration.editors));\r\n    }\r\n    if (configuration.toolbox) {\r\n        services.uiComponents.push(new ToolboxExtension());\r\n    }\r\n    if (!services.wheelController) {\r\n        services.wheelController = new ClassicWheelControllerExtension();\r\n    }\r\n    if (!services.placeholderController) {\r\n        services.placeholderController = new DefaultPlaceholderControllerExtension();\r\n    }\r\n    if (!services.placeholder) {\r\n        services.placeholder = RectPlaceholderExtension.create();\r\n    }\r\n    if (!services.regionComponentView) {\r\n        services.regionComponentView = new DefaultRegionComponentViewExtension();\r\n    }\r\n    if (!services.viewportController) {\r\n        services.viewportController = DefaultViewportControllerExtension.create();\r\n    }\r\n    if (!services.grid) {\r\n        services.grid = LineGridExtension.create();\r\n    }\r\n    if (!services.rootComponent) {\r\n        services.rootComponent = StartStopRootComponentExtension.create();\r\n    }\r\n    if (!services.sequenceComponent) {\r\n        services.sequenceComponent = new DefaultSequenceComponentExtension();\r\n    }\r\n    if (!services.daemons) {\r\n        services.daemons = [];\r\n    }\r\n    if (configuration.keyboard === undefined || configuration.keyboard) {\r\n        services.daemons.push(KeyboardDaemonExtension.create(configuration.keyboard));\r\n    }\r\n}\n\nfunction validateConfiguration(configuration) {\r\n    const validateProperty = (key) => {\r\n        if (configuration[key] === undefined) {\r\n            throw new Error(`The \"${key}\" property is not defined in the configuration`);\r\n        }\r\n    };\r\n    if (!configuration) {\r\n        throw new Error('Configuration is not defined');\r\n    }\r\n    validateProperty('steps');\r\n    validateProperty('toolbox');\r\n    validateProperty('editors');\r\n    validateProperty('controlBar');\r\n}\n\nclass Designer {\r\n    /**\r\n     * Creates a designer.\r\n     * @param placeholder Placeholder where the designer will be attached.\r\n     * @param startDefinition Start definition of a flow.\r\n     * @param configuration Designer's configuration.\r\n     * @returns An instance of the designer.\r\n     */\r\n    static create(placeholder, startDefinition, configuration) {\r\n        var _a;\r\n        if (!placeholder) {\r\n            throw new Error('Placeholder is not defined');\r\n        }\r\n        if (!startDefinition) {\r\n            throw new Error('Start definition is not defined');\r\n        }\r\n        const config = configuration;\r\n        validateConfiguration(config);\r\n        if (!isElementAttached((_a = config.shadowRoot) !== null && _a !== void 0 ? _a : document, placeholder)) {\r\n            throw new Error('Placeholder is not attached to the DOM');\r\n        }\r\n        const services = ServicesResolver.resolve(configuration.extensions, config);\r\n        const designerContext = DesignerContext.create(placeholder, startDefinition, config, services);\r\n        const designerApi = DesignerApi.create(designerContext);\r\n        const view = DesignerView.create(placeholder, designerContext, designerApi);\r\n        const designer = new Designer(view, designerContext.state, designerContext.stateModifier, designerContext.definitionWalker, designerContext.historyController, designerApi);\r\n        view.workspace.onRendered.first().then(designer.onReady.forward);\r\n        race(0, designerContext.state.onDefinitionChanged, designerContext.state.onSelectedStepIdChanged).subscribe(([definition, selectedStepId]) => {\r\n            if (definition !== undefined) {\r\n                designer.onDefinitionChanged.forward(designerContext.state.definition);\r\n            }\r\n            if (selectedStepId !== undefined) {\r\n                designer.onSelectedStepIdChanged.forward(designerContext.state.selectedStepId);\r\n            }\r\n        });\r\n        designerContext.state.onViewportChanged.subscribe(designer.onViewportChanged.forward);\r\n        designerContext.state.onIsToolboxCollapsedChanged.subscribe(designer.onIsToolboxCollapsedChanged.forward);\r\n        designerContext.state.onIsEditorCollapsedChanged.subscribe(designer.onIsEditorCollapsedChanged.forward);\r\n        return designer;\r\n    }\r\n    constructor(view, state, stateModifier, walker, historyController, api) {\r\n        this.view = view;\r\n        this.state = state;\r\n        this.stateModifier = stateModifier;\r\n        this.walker = walker;\r\n        this.historyController = historyController;\r\n        this.api = api;\r\n        /**\r\n         * @description Fires when the designer is initialized and ready to use.\r\n         */\r\n        this.onReady = new SimpleEvent();\r\n        /**\r\n         * @description Fires when the definition has changed.\r\n         */\r\n        this.onDefinitionChanged = new SimpleEvent();\r\n        /**\r\n         * @description Fires when the viewport has changed.\r\n         */\r\n        this.onViewportChanged = new SimpleEvent();\r\n        /**\r\n         * @description Fires when the selected step has changed.\r\n         */\r\n        this.onSelectedStepIdChanged = new SimpleEvent();\r\n        /**\r\n         * @description Fires when the toolbox is collapsed or expanded.\r\n         */\r\n        this.onIsToolboxCollapsedChanged = new SimpleEvent();\r\n        /**\r\n         * @description Fires when the editor is collapsed or expanded.\r\n         */\r\n        this.onIsEditorCollapsedChanged = new SimpleEvent();\r\n    }\r\n    /**\r\n     * @returns the current definition of the workflow.\r\n     */\r\n    getDefinition() {\r\n        return this.state.definition;\r\n    }\r\n    /**\r\n     * @returns the validation result of the current definition.\r\n     */\r\n    isValid() {\r\n        return this.view.workspace.isValid;\r\n    }\r\n    /**\r\n     * @returns the readonly flag.\r\n     */\r\n    isReadonly() {\r\n        return this.state.isReadonly;\r\n    }\r\n    /**\r\n     * @description Changes the readonly flag.\r\n     */\r\n    setIsReadonly(isReadonly) {\r\n        this.state.setIsReadonly(isReadonly);\r\n    }\r\n    /**\r\n     * @returns current selected step id or `null` if nothing is selected.\r\n     */\r\n    getSelectedStepId() {\r\n        return this.state.selectedStepId;\r\n    }\r\n    /**\r\n     * @description Selects a step by the id.\r\n     */\r\n    selectStepById(stepId) {\r\n        this.stateModifier.trySelectStepById(stepId);\r\n    }\r\n    /**\r\n     * @returns the current viewport.\r\n     */\r\n    getViewport() {\r\n        return this.state.viewport;\r\n    }\r\n    /**\r\n     * @description Sets the viewport.\r\n     * @param viewport Viewport.\r\n     */\r\n    setViewport(viewport) {\r\n        this.state.setViewport(viewport);\r\n    }\r\n    /**\r\n     * @description Resets the viewport.\r\n     */\r\n    resetViewport() {\r\n        this.api.viewport.resetViewport();\r\n    }\r\n    /**\r\n     * @description Unselects the selected step.\r\n     */\r\n    clearSelectedStep() {\r\n        this.state.setSelectedStepId(null);\r\n    }\r\n    /**\r\n     * @description Moves the viewport to the step with the animation.\r\n     */\r\n    moveViewportToStep(stepId) {\r\n        this.api.viewport.moveViewportToStep(stepId);\r\n    }\r\n    /**\r\n     * @description Rerender the root component and all its children.\r\n     */\r\n    updateRootComponent() {\r\n        this.api.workspace.updateRootComponent();\r\n    }\r\n    /**\r\n     * @description Updates the layout of the designer.\r\n     */\r\n    updateLayout() {\r\n        this.api.workspace.updateCanvasSize();\r\n        this.view.updateLayout();\r\n    }\r\n    /**\r\n     * @description Updates all badges.\r\n     */\r\n    updateBadges() {\r\n        this.api.workspace.updateBadges();\r\n    }\r\n    /**\r\n     * @returns a flag that indicates whether the toolbox is collapsed.\r\n     */\r\n    isToolboxCollapsed() {\r\n        return this.state.isToolboxCollapsed;\r\n    }\r\n    /**\r\n     * @description Sets a flag that indicates whether the toolbox is collapsed.\r\n     */\r\n    setIsToolboxCollapsed(isCollapsed) {\r\n        this.state.setIsToolboxCollapsed(isCollapsed);\r\n    }\r\n    /**\r\n     * @returns a flag that indicates whether the editor is collapsed.\r\n     */\r\n    isEditorCollapsed() {\r\n        return this.state.isEditorCollapsed;\r\n    }\r\n    /**\r\n     * @description Sets a flag that indicates whether the editor is collapsed.\r\n     */\r\n    setIsEditorCollapsed(isCollapsed) {\r\n        this.state.setIsEditorCollapsed(isCollapsed);\r\n    }\r\n    /**\r\n     * @description Dump the undo stack.\r\n     */\r\n    dumpUndoStack() {\r\n        return this.getHistoryController().dump();\r\n    }\r\n    /**\r\n     * Replaces the current definition with a new one and adds the previous definition to the undo stack.\r\n     * @param definition A new definition.\r\n     */\r\n    replaceDefinition(definition) {\r\n        return __awaiter(this, void 0, void 0, function* () {\r\n            this.getHistoryController().replaceDefinition(definition);\r\n            yield Promise.all([\r\n                this.view.workspace.onRendered.first(),\r\n                this.onDefinitionChanged.first()\r\n            ]);\r\n        });\r\n    }\r\n    /**\r\n     * @param needle A step, a sequence or a step id.\r\n     * @returns parent steps and branch names.\r\n     */\r\n    getStepParents(needle) {\r\n        return this.walker.getParents(this.state.definition, needle);\r\n    }\r\n    /**\r\n     * @returns the definition walker.\r\n     */\r\n    getWalker() {\r\n        return this.walker;\r\n    }\r\n    /**\r\n     * @description Destroys the designer and deletes all nodes from the placeholder.\r\n     */\r\n    destroy() {\r\n        this.view.destroy();\r\n    }\r\n    getHistoryController() {\r\n        if (!this.historyController) {\r\n            throw new Error('Undo feature is not activated');\r\n        }\r\n        return this.historyController;\r\n    }\r\n}\n\nexport { Badges, CenteredViewportCalculator, ClassicWheelControllerExtension, ClickCommandType, ComponentContext, ComponentDom, ControlBarApi, CustomActionController, DefaultRegionComponentViewExtension, DefaultRegionView, DefaultSequenceComponent, DefaultSequenceComponentView, DefaultViewportController, DefaultViewportControllerDesignerExtension, DefaultViewportControllerExtension, DefinitionChangeType, Designer, DesignerApi, DesignerContext, DesignerState, Dom, Editor, EditorApi, Icons, InputView, JoinView, KeyboardAction, LabelView, LineGridDesignerExtension, ObjectCloner, OutputView, PathBarApi, PlaceholderDirection, RectPlaceholder, RectPlaceholderView, SelectStepBehaviorEndToken, ServicesResolver, SimpleEvent, StartStopRootComponentDesignerExtension, StartStopRootComponentExtension, StepComponent, StepExtensionResolver, StepsDesignerExtension, TYPE, ToolboxApi, Uid, ValidationErrorBadgeExtension, Vector, ViewportApi, WorkspaceApi, createContainerStepComponentViewFactory, createSwitchStepComponentViewFactory, createTaskStepComponentViewFactory, getAbsolutePosition, race };\n"]}