From 1d3a4921792fc2a39facbb1c6aa0b6aa05539baf Mon Sep 17 00:00:00 2001 From: Jon Herron Date: Wed, 12 Oct 2022 10:21:19 -0400 Subject: [PATCH] Squashed 'bpmn-js-spiffworkflow/' content from commit b3eef6e5 git-subtree-dir: bpmn-js-spiffworkflow git-subtree-split: b3eef6e52cb91d10081f1586dc035701956f93a9 --- .eslintrc.js | 54 + .github/dependabot.yml | 18 + .github/labels.yml | 66 + .github/release-drafter.yml | 29 + .../workflows/auto-merge-dependabot-prs.yml | 28 + .github/workflows/labeler.yml | 19 + .github/workflows/publish.yml | 27 + .github/workflows/tests.yml | 30 + .gitignore | 3 + .prettierrc.js | 3 + .tool-versions | 1 + LICENSE | 21 + README.md | 72 + RELEASE_PROCESS.md | 15 + app/app.js | 81 + app/css/app.css | 59 + app/fileOperations.js | 83 + app/index.html | 27 + .../DataObject/DataObjectHelpers.js | 39 + .../DataObject/DataObjectInterceptor.js | 59 + .../DataObject/DataObjectRenderer.js | 44 + .../DataObject/DataObjectRules.js | 39 + app/spiffworkflow/DataObject/index.js | 20 + .../propertiesPanel/DataObjectArray.js | 151 + .../DataObjectPropertiesProvider.js | 99 + .../propertiesPanel/DataObjectSelect.js | 76 + .../propertiesPanel/DataReferenceGroup.js | 30 + .../InputOutput/IoInterceptor.js | 106 + app/spiffworkflow/InputOutput/IoPalette.js | 62 + app/spiffworkflow/InputOutput/IoRules.js | 45 + app/spiffworkflow/InputOutput/index.js | 11 + app/spiffworkflow/callActivity/index.js | 6 + .../CallActivityPropertiesProvider.js | 77 + app/spiffworkflow/conditions/index.js | 6 + .../ConditionsPropertiesProvider.js | 101 + app/spiffworkflow/constants.js | 1 + app/spiffworkflow/extensions/index.js | 7 + .../ExtensionsPropertiesProvider.js | 252 + .../propertiesPanel/ScriptUnitTestArray.js | 227 + .../SpiffExtensionCalledDecision.js | 81 + .../SpiffExtensionInstructionsForEndUser.js | 73 + .../SpiffExtensionServiceProperties.js | 289 + .../SpiffExtensionTextInput.js | 99 + .../propertiesPanel/SpiffScriptGroup.js | 163 + app/spiffworkflow/helpers.js | 14 + app/spiffworkflow/index.js | 40 + app/spiffworkflow/messages/MessageHelpers.js | 187 + app/spiffworkflow/messages/index.js | 6 + .../propertiesPanel/CorrelationKeysArray.js | 143 + .../CorrelationPropertiesArray.js | 334 + .../messages/propertiesPanel/MessageArray.js | 170 + .../MessageCorrelationPropertiesArray.js | 278 + .../propertiesPanel/MessagePayload.js | 64 + .../messages/propertiesPanel/MessageSelect.js | 83 + .../propertiesPanel/MessageVariable.js | 66 + .../MessagesPropertiesProvider.js | 186 + app/spiffworkflow/moddle/spiffworkflow.json | 213 + dist/index.js | 40349 ++++++++++++++++ dist/index.js.map | 1 + dist/src_moddle_spiffworkflow_json.index.js | 14 + docs/io.png | Bin 0 -> 9322 bytes karma.conf.js | 126 + package-lock.json | 16010 ++++++ package.json | 87 + resources/diagram.bpmn | 101 + test/.eslintrc | 3 + test/spec/BpmnInputOutputSpec.js | 29 + test/spec/BusinessRulePropsSpec.js | 70 + test/spec/CallActivitySpec.js | 60 + test/spec/DataObjectInterceptorSpec.js | 80 + test/spec/DataObjectPropsSpec.js | 81 + test/spec/DataObjectRulesSpec.js | 37 + test/spec/MessagesSpec.js | 136 + test/spec/ProcessPropsSpec.js | 94 + test/spec/ScriptTaskUnitTestSpec.js | 60 + test/spec/ScriptsPropsSpec.js | 74 + test/spec/ServiceTaskPropsSpec.js | 109 + test/spec/UserTaskPropsSpec.js | 85 + test/spec/bpmn/basic_message.bpmn | 154 + test/spec/bpmn/call_activity.bpmn | 39 + test/spec/bpmn/collaboration.bpmn | 195 + test/spec/bpmn/diagram.bpmn | 150 + test/spec/bpmn/empty_diagram.bpmn | 23 + test/spec/bpmn/gateway.bpmn | 110 + test/spec/bpmn/script_task.bpmn | 69 + test/spec/bpmn/service.bpmn | 39 + test/spec/bpmn/simple_collab.bpmn | 221 + test/spec/bpmn/subprocess.bpmn | 42 + test/spec/bpmn/user_form.bpmn | 51 + test/spec/helpers.js | 144 + test/spec/test.css | 40 + webpack.config.js | 49 + 92 files changed, 63515 insertions(+) create mode 100644 .eslintrc.js create mode 100644 .github/dependabot.yml create mode 100644 .github/labels.yml create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/auto-merge-dependabot-prs.yml create mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .gitignore create mode 100644 .prettierrc.js create mode 100644 .tool-versions create mode 100644 LICENSE create mode 100644 README.md create mode 100644 RELEASE_PROCESS.md create mode 100644 app/app.js create mode 100644 app/css/app.css create mode 100644 app/fileOperations.js create mode 100644 app/index.html create mode 100644 app/spiffworkflow/DataObject/DataObjectHelpers.js create mode 100644 app/spiffworkflow/DataObject/DataObjectInterceptor.js create mode 100644 app/spiffworkflow/DataObject/DataObjectRenderer.js create mode 100644 app/spiffworkflow/DataObject/DataObjectRules.js create mode 100644 app/spiffworkflow/DataObject/index.js create mode 100644 app/spiffworkflow/DataObject/propertiesPanel/DataObjectArray.js create mode 100644 app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js create mode 100644 app/spiffworkflow/DataObject/propertiesPanel/DataObjectSelect.js create mode 100644 app/spiffworkflow/DataObject/propertiesPanel/DataReferenceGroup.js create mode 100644 app/spiffworkflow/InputOutput/IoInterceptor.js create mode 100644 app/spiffworkflow/InputOutput/IoPalette.js create mode 100644 app/spiffworkflow/InputOutput/IoRules.js create mode 100644 app/spiffworkflow/InputOutput/index.js create mode 100644 app/spiffworkflow/callActivity/index.js create mode 100644 app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js create mode 100644 app/spiffworkflow/conditions/index.js create mode 100644 app/spiffworkflow/conditions/propertiesPanel/ConditionsPropertiesProvider.js create mode 100644 app/spiffworkflow/constants.js create mode 100644 app/spiffworkflow/extensions/index.js create mode 100644 app/spiffworkflow/extensions/propertiesPanel/ExtensionsPropertiesProvider.js create mode 100644 app/spiffworkflow/extensions/propertiesPanel/ScriptUnitTestArray.js create mode 100644 app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionCalledDecision.js create mode 100644 app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionInstructionsForEndUser.js create mode 100644 app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionServiceProperties.js create mode 100644 app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionTextInput.js create mode 100644 app/spiffworkflow/extensions/propertiesPanel/SpiffScriptGroup.js create mode 100644 app/spiffworkflow/helpers.js create mode 100644 app/spiffworkflow/index.js create mode 100644 app/spiffworkflow/messages/MessageHelpers.js create mode 100644 app/spiffworkflow/messages/index.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/CorrelationKeysArray.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/CorrelationPropertiesArray.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/MessageArray.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/MessagePayload.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/MessageSelect.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/MessageVariable.js create mode 100644 app/spiffworkflow/messages/propertiesPanel/MessagesPropertiesProvider.js create mode 100644 app/spiffworkflow/moddle/spiffworkflow.json create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 dist/src_moddle_spiffworkflow_json.index.js create mode 100644 docs/io.png create mode 100644 karma.conf.js create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 resources/diagram.bpmn create mode 100644 test/.eslintrc create mode 100644 test/spec/BpmnInputOutputSpec.js create mode 100644 test/spec/BusinessRulePropsSpec.js create mode 100644 test/spec/CallActivitySpec.js create mode 100644 test/spec/DataObjectInterceptorSpec.js create mode 100644 test/spec/DataObjectPropsSpec.js create mode 100644 test/spec/DataObjectRulesSpec.js create mode 100644 test/spec/MessagesSpec.js create mode 100644 test/spec/ProcessPropsSpec.js create mode 100644 test/spec/ScriptTaskUnitTestSpec.js create mode 100644 test/spec/ScriptsPropsSpec.js create mode 100644 test/spec/ServiceTaskPropsSpec.js create mode 100644 test/spec/UserTaskPropsSpec.js create mode 100644 test/spec/bpmn/basic_message.bpmn create mode 100644 test/spec/bpmn/call_activity.bpmn create mode 100644 test/spec/bpmn/collaboration.bpmn create mode 100644 test/spec/bpmn/diagram.bpmn create mode 100644 test/spec/bpmn/empty_diagram.bpmn create mode 100644 test/spec/bpmn/gateway.bpmn create mode 100644 test/spec/bpmn/script_task.bpmn create mode 100644 test/spec/bpmn/service.bpmn create mode 100644 test/spec/bpmn/simple_collab.bpmn create mode 100644 test/spec/bpmn/subprocess.bpmn create mode 100644 test/spec/bpmn/user_form.bpmn create mode 100644 test/spec/helpers.js create mode 100644 test/spec/test.css create mode 100644 webpack.config.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..169e7735 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,54 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + extends: [ + 'airbnb', + 'plugin:bpmn-io/es6', + 'plugin:prettier/recommended', + 'plugin:sonarjs/recommended', + 'plugin:import/errors', + 'plugin:import/warnings', + ], + parserOptions: { + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 'latest', + sourceType: 'module', + }, + rules: { + 'jsx-a11y/no-autofocus': 'off', + 'jsx-a11y/label-has-associated-control': 'off', + 'no-console': 'off', + 'no-unused-vars': [ + 'error', + { + destructuredArrayIgnorePattern: '^_', + varsIgnorePattern: '_', + argsIgnorePattern: '^_', + }, + ], + 'import/extensions': [ + 'error', + 'ignorePackages', + { + js: 'never', + jsx: 'never', + ts: 'never', + tsx: 'never', + }, + ], + + // We could try turning these on at some point but do not want to force it now + 'react/react-in-jsx-scope': 'off', + 'react/prop-types': 'off', + 'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }], + 'no-use-before-define': 0, + 'func-names': 'off', + 'react/destructuring-assignment': 'off', + 'import/prefer-default-export': 'off', + 'no-restricted-syntax': 'off', + }, +}; diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..a0a5c735 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + - package-ecosystem: pip + directory: "/.github/workflows" + schedule: + interval: daily + - package-ecosystem: pip + directory: "/docs" + schedule: + interval: daily + - package-ecosystem: pip + directory: "/" + schedule: + interval: daily diff --git a/.github/labels.yml b/.github/labels.yml new file mode 100644 index 00000000..f7f83aad --- /dev/null +++ b/.github/labels.yml @@ -0,0 +1,66 @@ +--- +# Labels names are important as they are used by Release Drafter to decide +# regarding where to record them in changelog or if to skip them. +# +# The repository labels will be automatically configured using this file and +# the GitHub Action https://github.com/marketplace/actions/github-labeler. +- name: breaking + description: Breaking Changes + color: bfd4f2 +- name: bug + description: Something isn't working + color: d73a4a +- name: build + description: Build System and Dependencies + color: bfdadc +- name: ci + description: Continuous Integration + color: 4a97d6 +- name: dependencies + description: Pull requests that update a dependency file + color: 0366d6 +- name: documentation + description: Improvements or additions to documentation + color: 0075ca +- name: duplicate + description: This issue or pull request already exists + color: cfd3d7 +- name: enhancement + description: New feature or request + color: a2eeef +- name: github_actions + description: Pull requests that update Github_actions code + color: "000000" +- name: good first issue + description: Good for newcomers + color: 7057ff +- name: help wanted + description: Extra attention is needed + color: 008672 +- name: invalid + description: This doesn't seem right + color: e4e669 +- name: performance + description: Performance + color: "016175" +- name: python + description: Pull requests that update Python code + color: 2b67c6 +- name: question + description: Further information is requested + color: d876e3 +- name: refactoring + description: Refactoring + color: ef67c4 +- name: removal + description: Removals and Deprecations + color: 9ae7ea +- name: style + description: Style + color: c120e5 +- name: testing + description: Testing + color: b1fc6f +- name: wontfix + description: This will not be worked on + color: ffffff diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..7a04410f --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,29 @@ +categories: + - title: ":boom: Breaking Changes" + label: "breaking" + - title: ":rocket: Features" + label: "enhancement" + - title: ":fire: Removals and Deprecations" + label: "removal" + - title: ":beetle: Fixes" + label: "bug" + - title: ":racehorse: Performance" + label: "performance" + - title: ":rotating_light: Testing" + label: "testing" + - title: ":construction_worker: Continuous Integration" + label: "ci" + - title: ":books: Documentation" + label: "documentation" + - title: ":hammer: Refactoring" + label: "refactoring" + - title: ":lipstick: Style" + label: "style" + - title: ":package: Dependencies" + labels: + - "dependencies" + - "build" +template: | + ## Changes + + $CHANGES diff --git a/.github/workflows/auto-merge-dependabot-prs.yml b/.github/workflows/auto-merge-dependabot-prs.yml new file mode 100644 index 00000000..f5e175f9 --- /dev/null +++ b/.github/workflows/auto-merge-dependabot-prs.yml @@ -0,0 +1,28 @@ +name: Dependabot auto-merge +on: + workflow_run: + workflows: ["Tests"] + types: + - completed + +permissions: + contents: write + +jobs: + dependabot: + runs-on: ubuntu-latest + if: ${{ github.actor == 'dependabot[bot]' && github.event.workflow_run.conclusion == 'success' && github.event_name == 'pull_request' }} + steps: + - name: Dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@v1.3.4 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + - name: Enable auto-merge for Dependabot PRs + # if: ${{contains(steps.metadata.outputs.dependency-names, 'pytest') && steps.metadata.outputs.update-type == 'version-update:semver-patch'}} + # if: ${{contains(steps.metadata.outputs.dependency-names, 'pytest')}} + # ideally we auto-merge if all checks pass + run: gh pr merge --auto --merge "$PR_URL" + env: + PR_URL: ${{github.event.pull_request.html_url}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 00000000..9da4ff43 --- /dev/null +++ b/.github/workflows/labeler.yml @@ -0,0 +1,19 @@ +name: Labeler + +on: + push: + branches: + - main + - master + +jobs: + labeler: + runs-on: ubuntu-latest + steps: + - name: Check out the repository + uses: actions/checkout@v3 + + - name: Run Labeler + uses: crazy-max/ghaction-github-labeler@v4.0.0 + with: + skip-delete: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..16e64908 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +name: Publish NPM + +# On a published release, run tests and deploy to NPM +on: + workflow_dispatch: + release: + types: [published] + +# Job Setup +jobs: + publish: + runs-on: ubuntu-latest + steps: + + - uses: actions/checkout@v3 #Checkout Repo + - uses: actions/setup-node@v3 #Setup Node + with: + node-version: 18 + - run: npm install + - run: npm test + - uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + access: public + - if: steps.publish.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..5484ad1c --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,30 @@ +name: Tests + +# Run on Pull Requests and pushes to main +on: + workflow_dispatch: + pull_request: + push: + branches: + - main + +# This allows a subsequently queued workflow run to interrupt previous runs +concurrency: + group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' + cancel-in-progress: true + +# Job Setup +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 #Checkout Repo + - uses: actions/setup-node@v3 #Setup Node + - uses: nanasess/setup-chromedriver@v1 + with: + node-version: '18' + - name: Run Karma Tests + run: | + npm ci + npm run test + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..6d8e0193 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules/ +public/ +.idea/ diff --git a/.prettierrc.js b/.prettierrc.js new file mode 100644 index 00000000..e340799c --- /dev/null +++ b/.prettierrc.js @@ -0,0 +1,3 @@ +module.exports = { + singleQuote: true, +}; diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..61b6cd03 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 18.3.0 diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..3fc5e235 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Sartography + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..cecac093 --- /dev/null +++ b/README.md @@ -0,0 +1,72 @@ + +![Tests](https://github.com/sartography/bpmn-js-spiffworkflow/actions/workflows/tests.yml/badge.svg?branch=main) + +# SpiffWorkflow Extensions for BPMN.js +This package provides extensions that can be applied to BPMN.js that will enable some important features of [SpiffWorkflow](https://github.com/sartography/SpiffWorkflow) - the Python BPMN Library for executing business processes. See below for more information. + +**IMPORTANT**: This is a work in progress, and is not yet released. + +# About + +This extension creates a BPMN editor with all the capabilities of [BPMN.js](https://github.com/bpmn-io/bpmn-js) and the following additions / modifications: + +* Ability to insert BPMN's Data Input and Data Output Objects. +* A SpiffWorkflow centric Properties Panel for specifying scripts to run before and after a task, and for defining documentation, and Mark-up content for displaying in user and manual tasks. Among other things. + +# Future Plans +* We look forward to integrating a real time Python execution environment for live script development. + +# Data Input and Data Output Element +This extension will allow you to drag BPMN Data Input and Data Output elements onto the diagram and give them appropriate labels. This will generate valid BPMN elements in the underlying XML file - connecting them to the IO Specification of the process, as shown below: +```xml + + + + + + ... +``` +![Screenshot](docs/io.png) + +Using these data input and outputs will allow you to create processes designed to be used as Call Activities. SpiffWorkflow (in a soon-to-be released version) will pick up this information, and enforce it. So that you must provide these input variables to execute, and only the variables mentioned in the output will be passed back to the calling process. + +## Usage +```javascript +import BpmnModeler from 'bpmn-js/lib/Modeler'; +import spiffworkflow from 'bpmn-js-spiffworkflow/app/spiffworkflow'; + + +var bpmnJS = new BpmnModeler({ + additionalModules: [ + spiffworkflow + ], + moddleExtensions: { + spiffworkflowModdle: spiffModdleExtension + } +}); +``` + +## Run the Example + +You need a [NodeJS](http://nodejs.org) development stack with [npm](https://npmjs.org) installed to build the project. + +To install all project dependencies execute + +```sh +npm install +``` + +To start the example execute + +```sh +npm start +``` + +To build the example into the `public` folder execute + +```sh +npm run all +``` + +## License +MIT diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md new file mode 100644 index 00000000..4f7ca7d3 --- /dev/null +++ b/RELEASE_PROCESS.md @@ -0,0 +1,15 @@ +## Releases + +Be sure to edit the package.json, and update the version. Releases won't create +a new NPM package unless the version was updated. +A good way to do go about this is with npm version. Which will increment the version in package.json and create a new commit and tag. Here are few examples that you might use, but +there is more information on [NPM Version](https://docs.npmjs.com/cli/v8/commands/npm-version). + +For doing a patch release, you can do +```bash +npm version patch -m "Upgrade to %s for reasons" +``` +aside from patch, you can use the keywords `minor`, and `major` (there are some others). + +Once this is complete, log into GitHub and do an offical release of the package. A published release will result in a new published version on NPM (via a GitHub Action) + diff --git a/app/app.js b/app/app.js new file mode 100644 index 00000000..a1a65951 --- /dev/null +++ b/app/app.js @@ -0,0 +1,81 @@ +import BpmnModeler from 'bpmn-js/lib/Modeler'; +import { + BpmnPropertiesPanelModule, + BpmnPropertiesProviderModule, +} from 'bpmn-js-properties-panel'; +import diagramXML from '../test/spec/bpmn/script_task.bpmn'; +import spiffworkflow from './spiffworkflow'; +import setupFileOperations from './fileOperations'; + +const modelerEl = document.getElementById('modeler'); +const panelEl = document.getElementById('panel'); +const spiffModdleExtension = require('./spiffworkflow/moddle/spiffworkflow.json'); + +let bpmnModeler; + +/** + * This provides an example of how to instantiate a BPMN Modeler configured with + * all the extensions and modifications in this application. + */ +try { + bpmnModeler = new BpmnModeler({ + container: modelerEl, + propertiesPanel: { + parent: panelEl, + }, + additionalModules: [ + spiffworkflow, + BpmnPropertiesPanelModule, + BpmnPropertiesProviderModule, + ], + moddleExtensions: { + spiffworkflowModdle: spiffModdleExtension, + }, + }); +} catch (error) { + if (error.constructor.name === 'AggregateError') { + console.log(error.message); + console.log(error.name); + console.log(error.errors); + } + throw error; +} + +// import XML +bpmnModeler.importXML(diagramXML).then(() => {}); + +/** + * It is possible to poplulate certain components using API calls to + * a backend. Here we mock out the API call, but this gives you + * a sense of how things might work. + * + */ +bpmnModeler.on('spiff.service_tasks.requested', (event) => { + event.eventBus.fire('spiff.service_tasks.returned', { + serviceTaskOperators: [ + { + id: 'Chuck Norris Fact Service', + parameters: [ + { + id: 'category', + type: 'string', + }, + ], + }, + { + id: 'Fact about a Number', + parameters: [ + { + id: 'number', + type: 'integer', + }, + ], + }, + ], + }); +}); + +// This handles the download and upload buttons - it isn't specific to +// the BPMN modeler or these extensions, just a quick way to allow you to +// create and save files. +setupFileOperations(bpmnModeler); diff --git a/app/css/app.css b/app/css/app.css new file mode 100644 index 00000000..bd44a1fe --- /dev/null +++ b/app/css/app.css @@ -0,0 +1,59 @@ +* { + box-sizing: border-box; + margin: 0; + outline: none; + padding: 0; +} + +html, body { + height: 100%; +} + +.hidden { + display: none; +} + +#container { + display: flex; + width: 100%; + height: 100%; +} + +#modeler { + flex-grow: 1; +} + +#panel { + background-color: #fafafa; + border: solid 1px #ccc; + border-radius: 2px; + font-family: 'Arial', sans-serif; + padding: 10px; + min-width: 400px; +} + +.djs-label { + font-family: 'Arial', sans-serif; +} + +.spiffworkflow-properties-panel-button { + margin: 2px 32px 6px 12px; + padding-left: 2px; + padding-right: 2px; +} + +/* Style buttons */ +.bpmn-js-spiffworkflow-btn { + background-color: DodgerBlue; + border: none; + color: white; + padding: 8px 15px; + cursor: pointer; + font-size: 16px; + margin: 12px; +} + +/* Darker background on mouse-over */ +.bpmn-js-spiffworkflow-btn:hover { + background-color: RoyalBlue; +} diff --git a/app/fileOperations.js b/app/fileOperations.js new file mode 100644 index 00000000..170a75c3 --- /dev/null +++ b/app/fileOperations.js @@ -0,0 +1,83 @@ +// FileSaver isn't really a dependency, we use it here to provide an example. +// eslint-disable-next-line import/no-extraneous-dependencies +import FileSaver from 'file-saver'; + +/** **************************************** + * Below are a few helper methods so we can upload and download files + * easily from the editor for testing purposes. + * ----------------------------------------- + */ +export default function setupFileOperations(bpmnModeler) { + /** + * Just a quick bit of code so we can save the XML that is output. + * Helps for debugging against other libraries (like SpiffWorkflow) + */ + const btn = document.getElementById('downloadButton'); + btn.addEventListener('click', (_event) => { + saveXML(); + }); + + async function saveXML() { + const { xml } = await bpmnModeler.saveXML({ format: true }); + const blob = new Blob([xml], { type: 'text/xml' }); + FileSaver.saveAs(blob, 'diagram.bpmn'); + } + + /** + * Just a quick bit of code so we can open a local XML file + * Helps for debugging against other libraries (like SpiffWorkflow) + */ + const uploadBtn = document.getElementById('uploadButton'); + uploadBtn.addEventListener('click', (_event) => { + openFile(displayFile); + }); + + function displayFile(contents) { + bpmnModeler.importXML(contents).then(() => {}); + } +} + +function clickElem(elem) { + const eventMouse = document.createEvent('MouseEvents'); + eventMouse.initMouseEvent( + 'click', + true, + false, + window, + 0, + 0, + 0, + 0, + 0, + false, + false, + false, + false, + 0, + null + ); + elem.dispatchEvent(eventMouse); +} + +export function openFile(func) { + const readFile = function readFileCallback(e) { + const file = e.target.files[0]; + if (!file) { + return; + } + const reader = new FileReader(); + reader.onload = function onloadCallback(onloadEvent) { + const contents = onloadEvent.target.result; + fileInput.func(contents); + document.body.removeChild(fileInput); + }; + reader.readAsText(file); + }; + let fileInput = document.createElement('input'); + fileInput.type = 'file'; + fileInput.style.display = 'none'; + fileInput.onchange = readFile; + fileInput.func = func; + document.body.appendChild(fileInput); + clickElem(fileInput); +} diff --git a/app/index.html b/app/index.html new file mode 100644 index 00000000..86d722f6 --- /dev/null +++ b/app/index.html @@ -0,0 +1,27 @@ + + + + bpmn-js-spiffworkflow + + + + + + + + + + + + + +
+
+
+
+ + + diff --git a/app/spiffworkflow/DataObject/DataObjectHelpers.js b/app/spiffworkflow/DataObject/DataObjectHelpers.js new file mode 100644 index 00000000..abff7ef7 --- /dev/null +++ b/app/spiffworkflow/DataObject/DataObjectHelpers.js @@ -0,0 +1,39 @@ +/** + * Returns the moddelElement if it is a process, otherwise, returns the + * + * @param container + */ + + +export function findDataObjects(process) { + let dataObjects = []; + if (!process || !process.flowElements) { + return dataObjects; + } + for (const element of process.flowElements) { + if (element.$type === 'bpmn:DataObject') { + dataObjects.push(element); + } + } + return dataObjects; +} + +export function findDataObject(process, id) { + for (const dataObj of findDataObjects(process)) { + if (dataObj.id === id) { + return dataObj; + } + } +} + +export function findDataReferenceShapes(processShape, id) { + let refs = []; + for (const shape of processShape.children) { + if (shape.type === 'bpmn:DataObjectReference') { + if (shape.businessObject.dataObjectRef && shape.businessObject.dataObjectRef.id === id) { + refs.push(shape); + } + } + } + return refs; +} diff --git a/app/spiffworkflow/DataObject/DataObjectInterceptor.js b/app/spiffworkflow/DataObject/DataObjectInterceptor.js new file mode 100644 index 00000000..bdbfb2da --- /dev/null +++ b/app/spiffworkflow/DataObject/DataObjectInterceptor.js @@ -0,0 +1,59 @@ +import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; +import { is } from 'bpmn-js/lib/util/ModelUtil'; +import { findDataObjects } from './DataObjectHelpers'; +var HIGH_PRIORITY = 1500; + +/** + * This Command Interceptor functions like the BpmnUpdator in BPMN.js - It hooks into events + * from Diagram.js and updates the underlying BPMN model accordingly. + * + * This handles some special cases we want to handle for DataObjects and DataObjectReferences, + * for instance: + * 1) Use existing data objects if possible when creating a new reference (don't create new objects each time) + * 2) Don't automatically delete a data object when you delete the reference - unless all references are removed. + * 3) Update the name of the DataObjectReference to match the id of the DataObject. + * 4) Don't allow someone to move a DataObjectReference from one process to another process. + */ +export default class DataObjectInterceptor extends CommandInterceptor { + constructor(eventBus, bpmnFactory, bpmnUpdater) { + super(eventBus); + + /** + * For DataObjectReferences only ... + * Prevent this from calling the CreateDataObjectBehavior in BPMN-js, as it will + * attempt to crete a dataObject immediately. We can't create the dataObject until + * we know where it is placed - as we want to reuse data objects of the parent when + * possible */ + this.preExecute([ 'shape.create' ], HIGH_PRIORITY, function(event) { + const context = event.context, shape = context.shape; + if (is(shape, 'bpmn:DataObjectReference') && shape.type !== 'label') { + event.stopPropagation(); + } + }); + + /** + * Don't just create a new data object, use the first existing one if it already exists + */ + this.executed([ 'shape.create' ], HIGH_PRIORITY, function(event) { + const context = event.context, shape = context.shape; + if (is(shape, 'bpmn:DataObjectReference') && shape.type !== 'label') { + let process = shape.parent.businessObject; + let existingDataObjects = findDataObjects(process); + let dataObject; + if (existingDataObjects.length > 0) { + dataObject = existingDataObjects[0]; + } else { + dataObject = bpmnFactory.create('bpmn:DataObject'); + } + + // Update the name of the reference to match the data object's id. + shape.businessObject.name = dataObject.id; + + // set the reference to the DataObject + shape.businessObject.dataObjectRef = dataObject; + } + }); + } +} + +DataObjectInterceptor.$inject = [ 'eventBus', 'bpmnFactory', 'bpmnUpdater' ]; diff --git a/app/spiffworkflow/DataObject/DataObjectRenderer.js b/app/spiffworkflow/DataObject/DataObjectRenderer.js new file mode 100644 index 00000000..d66fc7a4 --- /dev/null +++ b/app/spiffworkflow/DataObject/DataObjectRenderer.js @@ -0,0 +1,44 @@ +import BaseRenderer from 'diagram-js/lib/draw/BaseRenderer'; + +import { + attr as svgAttr +} from 'tiny-svg'; + +import { getBusinessObject, is } from 'bpmn-js/lib/util/ModelUtil'; +import { isAny } from 'bpmn-js/lib/features/modeling/util/ModelingUtil'; +import { findDataObject } from './DataObjectHelpers'; + +const HIGH_PRIORITY = 1500; + +/** + * Work in progress -- render data object references in red if they are + * not valid. + */ +export default class DataObjectRenderer extends BaseRenderer { + constructor(eventBus, bpmnRenderer) { + super(eventBus, HIGH_PRIORITY); + this.bpmnRenderer = bpmnRenderer; + } + + canRender(element) { + return isAny(element, [ 'bpmn:DataObjectReference' ]) && !element.labelTarget; + } + + drawShape(parentNode, element) { + const shape = this.bpmnRenderer.drawShape(parentNode, element); + if (is(element, 'bpmn:DataObjectReference')) { + let businessObject = getBusinessObject(element); + let dataObject = businessObject.dataObjectRef; + if (dataObject && dataObject.id) { + let parentObject = businessObject.$parent; + dataObject = findDataObject(parentObject, dataObject.id); + } + if (!dataObject) { + svgAttr(shape, 'stroke', 'red'); + } + return shape; + } + } +} + +DataObjectRenderer.$inject = [ 'eventBus', 'bpmnRenderer' ]; diff --git a/app/spiffworkflow/DataObject/DataObjectRules.js b/app/spiffworkflow/DataObject/DataObjectRules.js new file mode 100644 index 00000000..146962bc --- /dev/null +++ b/app/spiffworkflow/DataObject/DataObjectRules.js @@ -0,0 +1,39 @@ +/** + * Custom Rules for the DataObject - Rules allow you to prevent an + * action from happening in the diagram, such as dropping an element + * where it doesn't belong. + * + * Here we don't allow people to move a data object Reference + * from one parent to another, as we can't move the data objects + * from one parent to another. + * + */ +import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider'; +import inherits from 'inherits-browser'; +import { is } from 'bpmn-js/lib/util/ModelUtil'; + +export default function DataObjectRules(eventBus) { + RuleProvider.call(this, eventBus); +} +inherits(DataObjectRules, RuleProvider); +const HIGH_PRIORITY = 1500; + +DataObjectRules.prototype.init = function() { + this.addRule('elements.move', HIGH_PRIORITY,function(context) { + let elements = context.shapes; + let target = context.target; + return canDrop(elements, target); + }); +}; + +function canDrop(elements, target) { + for (let element of elements) { + if (is(element, 'bpmn:DataObjectReference') && element.parent && target) { + return target === element.parent; + } + // Intentionally returning null here to allow other rules to fire. + } +} + +DataObjectRules.prototype.canDrop = canDrop; +DataObjectRules.$inject = [ 'eventBus' ]; diff --git a/app/spiffworkflow/DataObject/index.js b/app/spiffworkflow/DataObject/index.js new file mode 100644 index 00000000..8489aec9 --- /dev/null +++ b/app/spiffworkflow/DataObject/index.js @@ -0,0 +1,20 @@ +import DataObjectInterceptor from './DataObjectInterceptor'; +import DataObjectRules from './DataObjectRules'; +import RulesModule from 'diagram-js/lib/features/rules'; +import DataObjectRenderer from './DataObjectRenderer'; +import DataObjectPropertiesProvider from './propertiesPanel/DataObjectPropertiesProvider'; + + +export default { + __depends__: [ + RulesModule + ], + __init__: [ 'dataInterceptor', 'dataObjectRules', 'dataObjectRenderer', 'dataObjectPropertiesProvider' ], + dataInterceptor: [ 'type', DataObjectInterceptor ], + dataObjectRules: [ 'type', DataObjectRules ], + dataObjectRenderer: [ 'type', DataObjectRenderer ], + dataObjectPropertiesProvider: [ 'type', DataObjectPropertiesProvider ] +}; + + + diff --git a/app/spiffworkflow/DataObject/propertiesPanel/DataObjectArray.js b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectArray.js new file mode 100644 index 00000000..d24cf54a --- /dev/null +++ b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectArray.js @@ -0,0 +1,151 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { + isTextFieldEntryEdited, + TextFieldEntry, +} from '@bpmn-io/properties-panel'; +import { without } from 'min-dash'; +import { is } from 'bpmn-js/lib/util/ModelUtil'; +import { findDataObjects, findDataReferenceShapes } from '../DataObjectHelpers'; + +/** + * Provides a list of data objects, and allows you to add / remove data objects, and change their ids. + * @param props + * @constructor + */ +export function DataObjectArray(props) { + const { moddle } = props; + const { element } = props; + const { commandStack } = props; + const { elementRegistry } = props; + let process; + + // This element might be a process, or something that will reference a process. + if (is(element.businessObject, 'bpmn:Process')) { + process = element.businessObject; + } else if (element.businessObject.processRef) { + process = element.businessObject.processRef; + } + + const dataObjects = findDataObjects(process); + const items = dataObjects.map((dataObject, index) => { + const id = `${process.id}-dataObj-${index}`; + return { + id, + label: dataObject.id, + entries: DataObjectGroup({ + idPrefix: id, + element, + dataObject, + }), + autoFocusEntry: `${id}-dataObject`, + remove: removeFactory({ + element, + dataObject, + process, + commandStack, + elementRegistry, + }), + }; + }); + + function add(event) { + event.stopPropagation(); + const newDataObject = moddle.create('bpmn:DataObject'); + const newElements = process.get('flowElements'); + newDataObject.id = moddle.ids.nextPrefixed('DataObject_'); + newElements.push(newDataObject); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + flowElements: newElements, + }, + }); + } + + return { items, add }; +} + +function removeFactory(props) { + const { element, dataObject, process, commandStack } = props; + + return function (event) { + event.stopPropagation(); + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: process, + properties: { + flowElements: without(process.get('flowElements'), dataObject), + }, + }); + // Also update the label of all the references + const references = findDataReferenceShapes(element, dataObject.id); + for (const ref of references) { + commandStack.execute('element.updateProperties', { + element: ref, + moddleElement: ref.businessObject, + properties: { + name: '???', + }, + changed: [ref], // everything is already marked as changed, don't recalculate. + }); + } + }; +} + +function DataObjectGroup(props) { + const { idPrefix, dataObject } = props; + + return [ + { + id: `${idPrefix}-dataObject`, + component: DataObjectTextField, + isEdited: isTextFieldEntryEdited, + idPrefix, + dataObject, + }, + ]; +} + +function DataObjectTextField(props) { + const { idPrefix, element, parameter, dataObject } = props; + + const commandStack = useService('commandStack'); + const debounce = useService('debounceInput'); + + const setValue = (value) => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: dataObject, + properties: { + id: value, + }, + }); + + // Also update the label of all the references + const references = findDataReferenceShapes(element, dataObject.id); + for (const ref of references) { + commandStack.execute('element.updateProperties', { + element: ref, + moddleElement: ref.businessObject, + properties: { + name: value, + }, + changed: [ref], // everything is already marked as changed, don't recalculate. + }); + } + }; + + const getValue = () => { + return dataObject.id; + }; + + return TextFieldEntry({ + element: parameter, + id: `${idPrefix}-id`, + label: 'Data Object Id', + getValue, + setValue, + debounce, + }); +} diff --git a/app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js new file mode 100644 index 00000000..f6be933e --- /dev/null +++ b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js @@ -0,0 +1,99 @@ +import { is, isAny } from 'bpmn-js/lib/util/ModelUtil'; +import { ListGroup, isTextFieldEntryEdited } from '@bpmn-io/properties-panel'; +import { DataObjectSelect } from './DataObjectSelect'; +import { DataObjectArray } from './DataObjectArray'; + +const LOW_PRIORITY = 500; + +export default function DataObjectPropertiesProvider( + propertiesPanel, + translate, + moddle, + commandStack, + elementRegistry +) { + this.getGroups = function (element) { + return function (groups) { + if (is(element, 'bpmn:DataObjectReference')) { + groups.push( + createDataObjectSelector(element, translate, moddle, commandStack) + ); + } + if ( + isAny(element, ['bpmn:Process', 'bpmn:SubProcess', 'bpmn:Participant']) + ) { + groups.push( + createDataObjectEditor( + element, + translate, + moddle, + commandStack, + elementRegistry + ) + ); + } + return groups; + }; + }; + propertiesPanel.registerProvider(LOW_PRIORITY, this); +} + +DataObjectPropertiesProvider.$inject = [ + 'propertiesPanel', + 'translate', + 'moddle', + 'commandStack', + 'elementRegistry', +]; + +/** + * Create a group on the main panel with a select box (for choosing the Data Object to connect) + * @param element + * @param translate + * @param moddle + * @returns entries + */ +function createDataObjectSelector(element, translate, moddle, commandStack) { + return { + id: 'data_object_properties', + label: translate('Data Object Properties'), + entries: [ + { + id: 'selectDataObject', + element, + component: DataObjectSelect, + isEdited: isTextFieldEntryEdited, + moddle, + commandStack, + }, + ], + }; +} + +/** + * Create a group on the main panel with a select box (for choosing the Data Object to connect) AND a + * full Data Object Array for modifying all the data objects. + * @param element + * @param translate + * @param moddle + * @returns entries + */ +function createDataObjectEditor( + element, + translate, + moddle, + commandStack, + elementRegistry +) { + const dataObjectArray = { + id: 'editDataObjects', + element, + label: 'Data Objects', + component: ListGroup, + ...DataObjectArray({ element, moddle, commandStack, elementRegistry }), + }; + + if (dataObjectArray.items) { + return dataObjectArray; + } +} diff --git a/app/spiffworkflow/DataObject/propertiesPanel/DataObjectSelect.js b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectSelect.js new file mode 100644 index 00000000..3d6d1ef9 --- /dev/null +++ b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectSelect.js @@ -0,0 +1,76 @@ +import {useService } from 'bpmn-js-properties-panel'; +import { SelectEntry } from '@bpmn-io/properties-panel'; + +/** + * Finds the value of the given type within the extensionElements + * given a type of "spiff:preScript", would find it in this, and return + * the object. + * + * + + + me = "100% awesome" + + + ... + + * + * @returns {string|null|*} + */ +export function DataObjectSelect(props) { + const element = props.element; + const commandStack = props.commandStack; + const debounce = useService('debounceInput'); + + + const getValue = () => { + return element.businessObject.dataObjectRef.id + } + + const setValue = value => { + const businessObject = element.businessObject; + for (const flowElem of businessObject.$parent.flowElements) { + if (flowElem.$type === 'bpmn:DataObject' && flowElem.id === value) { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + dataObjectRef: flowElem + } + }); + commandStack.execute('element.updateProperties', { + element, + moddleElement: businessObject, + properties: { + 'name': flowElem.id + } + }); + } + } + } + + const getOptions = value => { + const businessObject = element.businessObject; + const parent = businessObject.$parent; + let options = [] + for (const element of parent.flowElements) { + if (element.$type === 'bpmn:DataObject') { + options.push({label: element.id, value: element.id}) + } + } + return options + } + + return ; + +} diff --git a/app/spiffworkflow/DataObject/propertiesPanel/DataReferenceGroup.js b/app/spiffworkflow/DataObject/propertiesPanel/DataReferenceGroup.js new file mode 100644 index 00000000..8f36c5cb --- /dev/null +++ b/app/spiffworkflow/DataObject/propertiesPanel/DataReferenceGroup.js @@ -0,0 +1,30 @@ +import { ListGroup } from '@bpmn-io/properties-panel'; +import { DataObjectArray } from './DataObjectArray'; + +/** + * Also allows you to select which Data Objects are available + * in the process element. + * @param element The selected process + * @param moddle For updating the underlying xml object + * @returns {[{component: (function(*)), isEdited: *, id: string, element},{component: + * (function(*)), isEdited: *, id: string, element}]} + */ +export default function(element, moddle) { + + const groupSections = []; + const dataObjectArray = { + id: 'editDataObjects', + element, + label: 'Available Data Objects', + component: ListGroup, + ...DataObjectArray({ element, moddle }) + }; + + if (dataObjectArray.items) { + groupSections.push(dataObjectArray); + } + + return groupSections; +} + + diff --git a/app/spiffworkflow/InputOutput/IoInterceptor.js b/app/spiffworkflow/InputOutput/IoInterceptor.js new file mode 100644 index 00000000..05c9ea94 --- /dev/null +++ b/app/spiffworkflow/InputOutput/IoInterceptor.js @@ -0,0 +1,106 @@ +import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; +import { add as collectionAdd } from 'diagram-js/lib/util/Collections'; +import { remove as collectionRemove } from 'diagram-js/lib/util/Collections'; +import IdGenerator from 'diagram-js/lib/util/IdGenerator'; +var HIGH_PRIORITY = 1500; + +/** + * This Command Interceptor functions like the BpmnUpdator in BPMN.js - It hooks into events + * from Diagram.js and updates the underlying BPMN model accordingly. + * + * This handles the case where a new DataInput or DataOutput is added to + * the diagram, it assures that a place exists for the new Data object to go, and it places it there. + * There were a number of paces where I had to patch things in to get it to work correctly: + * * Create a InputOutputSpecification on the BPMN Moddle if it doesn't exist. + * * Correctly connect a new DI (display element in BPMN xml) for the input/output element. + * * Create a new DataInput/DataOutput Object (maybe incorrectly) + * Also handles delete, where it removes the objects from the BPMN Moddle (both the actual input/output and the DI) + * fixme: Assure that we need to create a new DataInput object here, already in IoPalette's call to ElementFactory + * fixme: If all inputs and outputs are deleted, remove the InputOutputSpecification completely. + */ +export default class IoInterceptor extends CommandInterceptor { + constructor(eventBus, bpmnFactory, bpmnUpdater) { + super(eventBus); + + this.execute([ 'shape.create' ], HIGH_PRIORITY, function(event) { + let context = event.context; + if ([ 'bpmn:DataInput', 'bpmn:DataOutput' ].includes(context.shape.type)) { + let type = context.shape.type; + let type_name = type.split(':')[1]; + let process = context.parent.businessObject; + let ioSpec = assureIOSpecificationExists(process, bpmnFactory); + let di = context.shape.di; + let generator = new IdGenerator(type_name), ioSpecification = process.get('ioSpecification'); + let dataIO = bpmnFactory.create(type, { id: generator.next() }); + context.shape.businessObject = dataIO; + dataIO.$parent = ioSpec; + di.businessObject = dataIO; + di.bpmnElement = dataIO; + di.id = dataIO.id + 'DI'; + bpmnUpdater.updateBounds(context.shape); + if (type == 'bpmn:DataInput') { + collectionAdd(ioSpecification.get('dataInputs'), dataIO); + } else { + collectionAdd(ioSpecification.get('dataOutputs'), dataIO); + } + } + }); + + this.execute([ 'shape.delete' ], HIGH_PRIORITY, function(event) { + let context = event.context; + if ([ 'bpmn:DataInput', 'bpmn:DataOutput' ].includes(context.shape.type)) { + let type = context.shape.type; + let process = context.shape.parent.businessObject; + let ioSpec = assureIOSpecificationExists(process, bpmnFactory); + if (type == 'bpmn:DataInput') { + collectionRemove(ioSpec.get('dataInputs'), context.shape.businessObject); + } else { + collectionRemove(ioSpec.get('dataOutputs'), context.shape.businessObject); + } + if (context.shape.di.$parent) { + collectionRemove(context.shape.di.$parent.planeElement, context.shape.di); + } + } + }); + + // Stop propagation on executed, to avoid the BpmnUpdator.js from causing errors. + this.executed([ 'shape.delete', 'shape.create' ], HIGH_PRIORITY, function(event) { + if ([ 'bpmn:DataInput', 'bpmn:DataOutput' ].includes(event.context.shape.type)) { + event.stopPropagation(); // Don't let the main code execute, it will fail. + } + }); + } +} + +/** + * + * + * + * + * + * + * @param process + * @param bpmnFactory + * @returns {bpmn:InputOutputSpecification} + */ + +function assureIOSpecificationExists(process, bpmnFactory) { + let ioSpecification = process.get('ioSpecification'); + + if (!ioSpecification) { + + // Create the BPMN + ioSpecification = bpmnFactory.create('bpmn:InputOutputSpecification', { + dataInputs: [], + inputSets: [], + dataOutputs: [], + outputSets: [] + }); + ioSpecification.$parent = process; + process.ioSpecification = ioSpecification; + } + return ioSpecification; +} + +IoInterceptor.$inject = [ 'eventBus', 'bpmnFactory', 'bpmnUpdater' ]; + diff --git a/app/spiffworkflow/InputOutput/IoPalette.js b/app/spiffworkflow/InputOutput/IoPalette.js new file mode 100644 index 00000000..e8f95670 --- /dev/null +++ b/app/spiffworkflow/InputOutput/IoPalette.js @@ -0,0 +1,62 @@ +import { assign } from 'min-dash'; +import translate from 'diagram-js/lib/i18n/translate/translate'; + +/** + * Add data inputs and data outputs to the panel. + */ +export default function IoPalette(palette, create, elementFactory,) { + this._create = create; + this._elementFactory = elementFactory; + palette.registerProvider(this); +} + +IoPalette.$inject = [ + 'palette', + 'create', + 'elementFactory' +]; + +IoPalette.prototype.getPaletteEntries = function() { + + let input_type = 'bpmn:DataInput'; + let output_type = 'bpmn:DataOutput'; + let elementFactory = this._elementFactory, create = this._create; + + function createListener(event, type) { + let shape = elementFactory.createShape(assign({ type: type }, {})); + shape.width = 36; // Fix up the shape dimensions from the defaults. + shape.height = 50; + create.start(event, shape); + } + + function createInputListener(event) { + createListener(event, input_type); + } + + function createOutputListener(event) { + createListener(event, output_type); + } + + return { + 'create.data-input': { + group: 'data-object', + className: 'bpmn-icon-data-input', + title: translate('Create DataInput'), + action: { + dragstart: createInputListener, + click: createInputListener + } + }, + 'create.data-output': { + group: 'data-object', + className: 'bpmn-icon-data-output', + title: translate('Create DataOutput'), + action: { + dragstart: createOutputListener, + click: createOutputListener + } + } + + }; +}; + diff --git a/app/spiffworkflow/InputOutput/IoRules.js b/app/spiffworkflow/InputOutput/IoRules.js new file mode 100644 index 00000000..1412c0fc --- /dev/null +++ b/app/spiffworkflow/InputOutput/IoRules.js @@ -0,0 +1,45 @@ +import inherits from 'inherits'; +import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider'; + +const HIGH_PRIORITY = 1500; + +/** + * A custom rule provider that will permit Data Inputs and Data + * Outputs to be placed within a process element (something BPMN.io currently denies) + * + * See {@link BpmnRules} for the default implementation + * of BPMN 2.0 modeling rules provided by bpmn-js. + * + * @param {EventBus} eventBus + */ +export default function IoRules(eventBus) { + RuleProvider.call(this, eventBus); +} + +inherits(IoRules, RuleProvider); + +IoRules.$inject = [ 'eventBus' ]; + +IoRules.prototype.init = function() { + this.addRule('shape.create', HIGH_PRIORITY, function(context) { + + let element = context.shape; + let target = context.target; + let position = context.position; + + return canCreate(element, target, position); + }); +}; + +/** + * Allow folks to drop a dataInput or DataOutput only on the top level process. + */ +function canCreate(element, target, position) { + if ([ 'bpmn:DataInput', 'bpmn:DataOutput' ].includes(element.type)) { + if (target.type == 'bpmn:Process') { + return true; + } + } +} + +IoRules.prototype.canCreate = canCreate; diff --git a/app/spiffworkflow/InputOutput/index.js b/app/spiffworkflow/InputOutput/index.js new file mode 100644 index 00000000..2db2ad21 --- /dev/null +++ b/app/spiffworkflow/InputOutput/index.js @@ -0,0 +1,11 @@ +import IoPalette from './IoPalette'; +import IoRules from './IoRules'; +import IoInterceptor from './IoInterceptor'; + +export default { + __init__: [ 'IoPalette', 'IoRules', 'IoInterceptor' ], + IoPalette: [ 'type', IoPalette ], + IoRules: [ 'type', IoRules ], + IoInterceptor: [ 'type', IoInterceptor ] +}; + diff --git a/app/spiffworkflow/callActivity/index.js b/app/spiffworkflow/callActivity/index.js new file mode 100644 index 00000000..e02bd0a1 --- /dev/null +++ b/app/spiffworkflow/callActivity/index.js @@ -0,0 +1,6 @@ +import CallActivityPropertiesProvider from './propertiesPanel/CallActivityPropertiesProvider'; + +export default { + __init__: ['callActivityPropertiesProvider'], + callActivityPropertiesProvider: ['type', CallActivityPropertiesProvider], +}; diff --git a/app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js b/app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js new file mode 100644 index 00000000..cf847d6a --- /dev/null +++ b/app/spiffworkflow/callActivity/propertiesPanel/CallActivityPropertiesProvider.js @@ -0,0 +1,77 @@ +import { is } from 'bpmn-js/lib/util/ModelUtil'; +import { TextFieldEntry } from '@bpmn-io/properties-panel'; +import { useService } from 'bpmn-js-properties-panel'; + +const LOW_PRIORITY = 500; + +export default function CallActivityPropertiesProvider( + propertiesPanel, + translate, + moddle, + commandStack, + _elementRegistry +) { + this.getGroups = function getGroupsCallback(element) { + return function pushGroup(groups) { + if (is(element, 'bpmn:CallActivity')) { + groups.push( + createCalledElementGroup(element, translate, moddle, commandStack) + ); + } + return groups; + }; + }; + propertiesPanel.registerProvider(LOW_PRIORITY, this); +} + +CallActivityPropertiesProvider.$inject = [ + 'propertiesPanel', + 'translate', + 'moddle', + 'commandStack', + 'elementRegistry', +]; + +function createCalledElementGroup(element, translate, moddle, commandStack) { + return { + id: 'called_element', + label: translate('Called Element'), + entries: [ + { + id: `called_element_text_field`, + element, + component: CalledElementTextField, + moddle, + commandStack, + translate, + }, + ], + }; +} + +function CalledElementTextField(props) { + const { element } = props; + const { translate } = props; + + const debounce = useService('debounceInput'); + const getValue = () => { + const { calledElement } = element.businessObject; + if (calledElement) { + return calledElement; + } + return ''; + }; + + const setValue = (value) => { + element.businessObject.calledElement = value; + }; + + return TextFieldEntry({ + element, + id: 'process_id', + label: translate('Process ID'), + getValue, + setValue, + debounce, + }); +} diff --git a/app/spiffworkflow/conditions/index.js b/app/spiffworkflow/conditions/index.js new file mode 100644 index 00000000..b37dceac --- /dev/null +++ b/app/spiffworkflow/conditions/index.js @@ -0,0 +1,6 @@ +import ConditionsPropertiesProvider from './propertiesPanel/ConditionsPropertiesProvider'; + +export default { + __init__: ['conditionsPropertiesProvider'], + conditionsPropertiesProvider: ['type', ConditionsPropertiesProvider], +}; diff --git a/app/spiffworkflow/conditions/propertiesPanel/ConditionsPropertiesProvider.js b/app/spiffworkflow/conditions/propertiesPanel/ConditionsPropertiesProvider.js new file mode 100644 index 00000000..f473de14 --- /dev/null +++ b/app/spiffworkflow/conditions/propertiesPanel/ConditionsPropertiesProvider.js @@ -0,0 +1,101 @@ +import { is } from 'bpmn-js/lib/util/ModelUtil'; +import { + isTextFieldEntryEdited, + TextFieldEntry, +} from '@bpmn-io/properties-panel'; +import { useService } from 'bpmn-js-properties-panel'; + +const LOW_PRIORITY = 500; + +export default function ConditionsPropertiesProvider( + propertiesPanel, + translate, + moddle, + commandStack, + _elementRegistry +) { + this.getGroups = function getGroupsCallback(element) { + return function pushGroup(groups) { + if (is(element, 'bpmn:SequenceFlow')) { + const { source } = element; + if (is(source, 'bpmn:ExclusiveGateway')) { + groups.push( + createConditionsGroup(element, translate, moddle, commandStack) + ); + } + } + return groups; + }; + }; + propertiesPanel.registerProvider(LOW_PRIORITY, this); +} + +ConditionsPropertiesProvider.$inject = [ + 'propertiesPanel', + 'translate', + 'moddle', + 'commandStack', + 'elementRegistry', +]; + +function createConditionsGroup(element, translate, moddle, commandStack) { + return { + id: 'conditions', + label: translate('Conditions'), + entries: conditionGroup( + element, + moddle, + 'Condition Expression', + 'Expression to Execute', + commandStack + ), + }; +} + +function conditionGroup(element, moddle, label, description, commandStack) { + return [ + { + id: `condition_expression`, + element, + component: ConditionExpressionTextField, + moddle, + label, + description, + commandStack, + }, + ]; +} + +function ConditionExpressionTextField(props) { + const { element } = props; + const { moddle } = props; + const { label } = props; + + const debounce = useService('debounceInput'); + const getValue = () => { + const { conditionExpression } = element.businessObject; + if (conditionExpression) { + return conditionExpression.body; + } + return ''; + }; + + const setValue = (value) => { + let { conditionExpressionModdleElement } = element.businessObject; + if (!conditionExpressionModdleElement) { + conditionExpressionModdleElement = moddle.create('bpmn:Expression'); + } + conditionExpressionModdleElement.body = value; + element.businessObject.conditionExpression = + conditionExpressionModdleElement; + }; + + return TextFieldEntry({ + element, + id: `the-id`, + label, + getValue, + setValue, + debounce, + }); +} diff --git a/app/spiffworkflow/constants.js b/app/spiffworkflow/constants.js new file mode 100644 index 00000000..1dc04c7a --- /dev/null +++ b/app/spiffworkflow/constants.js @@ -0,0 +1 @@ +export const SPIFFWORKFLOW_XML_NAMESPACE = 'spiffworkflow'; diff --git a/app/spiffworkflow/extensions/index.js b/app/spiffworkflow/extensions/index.js new file mode 100644 index 00000000..0b2f9ed2 --- /dev/null +++ b/app/spiffworkflow/extensions/index.js @@ -0,0 +1,7 @@ +import ExtensionsPropertiesProvider from './propertiesPanel/ExtensionsPropertiesProvider'; + +export default { + __init__: [ 'extensionsPropertiesProvider' ], + extensionsPropertiesProvider: [ 'type', ExtensionsPropertiesProvider ], +}; + diff --git a/app/spiffworkflow/extensions/propertiesPanel/ExtensionsPropertiesProvider.js b/app/spiffworkflow/extensions/propertiesPanel/ExtensionsPropertiesProvider.js new file mode 100644 index 00000000..121e72f4 --- /dev/null +++ b/app/spiffworkflow/extensions/propertiesPanel/ExtensionsPropertiesProvider.js @@ -0,0 +1,252 @@ +import { ListGroup } from '@bpmn-io/properties-panel'; +import { is, isAny } from 'bpmn-js/lib/util/ModelUtil'; +import scriptGroup, { SCRIPT_TYPE } from './SpiffScriptGroup'; +import { SpiffExtensionCalledDecision } from './SpiffExtensionCalledDecision'; +import { SpiffExtensionTextInput } from './SpiffExtensionTextInput'; +import { SpiffExtensionInstructionsForEndUser } from './SpiffExtensionInstructionsForEndUser'; +import { + ServiceTaskParameterArray, + ServiceTaskOperatorSelect, ServiceTaskResultTextInput, +} from './SpiffExtensionServiceProperties'; + +const LOW_PRIORITY = 500; + +export default function ExtensionsPropertiesProvider( + propertiesPanel, + translate, + moddle, + commandStack, + elementRegistry +) { + this.getGroups = function (element) { + return function (groups) { + if (is(element, 'bpmn:ScriptTask')) { + groups.push( + createScriptGroup(element, translate, moddle, commandStack) + ); + } else if ( + isAny(element, ['bpmn:Task', 'bpmn:CallActivity', 'bpmn:SubProcess']) + ) { + groups.push(preScriptPostScriptGroup(element, translate, moddle)); + } + if (is(element, 'bpmn:UserTask')) { + groups.push(createUserGroup(element, translate, moddle, commandStack)); + } + if (is(element, 'bpmn:BusinessRuleTask')) { + groups.push( + createBusinessRuleGroup(element, translate, moddle, commandStack) + ); + } + if (is(element, 'bpmn:ManualTask')) { + groups.push( + createManualTaskPropertiesGroup( + element, + translate, + moddle, + commandStack + ) + ); + } + if (is(element, 'bpmn:ServiceTask')) { + groups.push( + createServiceGroup(element, translate, moddle, commandStack) + ); + } + + return groups; + }; + }; + propertiesPanel.registerProvider(LOW_PRIORITY, this); +} + +ExtensionsPropertiesProvider.$inject = [ + 'propertiesPanel', + 'translate', + 'moddle', + 'commandStack', + 'elementRegistry', +]; + +/** + * Adds a group to the properties panel for the script task that allows you + * to set the script. + * @param element + * @param translate + * @returns The components to add to the properties panel. */ +function createScriptGroup(element, translate, moddle, commandStack) { + return { + id: 'spiff_script', + label: translate('Script'), + entries: scriptGroup({ + element, + moddle, + scriptType: SCRIPT_TYPE.bpmn, + label: 'Script', + description: 'Code to execute.', + translate, + commandStack, + }), + }; +} + +/** + * Adds a section to the properties' panel for NON-Script tasks, so that + * you can define a pre-script and a post-script for modifying data as it comes and out. + * @param element + * @param translate + * @param moddle For altering the underlying XML File. + * @returns The components to add to the properties panel. + */ +function preScriptPostScriptGroup(element, translate, moddle) { + return { + id: 'spiff_pre_post_scripts', + label: translate('SpiffWorkflow Scripts'), + entries: [ + ...scriptGroup({ + element, + moddle, + translate, + scriptType: SCRIPT_TYPE.pre, + label: 'Pre-Script', + description: 'code to execute prior to this task.', + }), + ...scriptGroup({ + element, + moddle, + translate, + scriptType: SCRIPT_TYPE.post, + label: 'Post-Script', + description: 'code to execute after this task.', + }), + ], + }; +} + +/** + * Create a group on the main panel with a select box (for choosing the Data Object to connect) + * @param element + * @param translate + * @param moddle + * @returns entries + */ +function createUserGroup(element, translate, moddle, commandStack) { + return { + id: 'user_task_properties', + label: translate('SpiffWorkflow Web Form'), + entries: [ + { + element, + moddle, + commandStack, + component: SpiffExtensionTextInput, + label: translate('JSON Schema Filename'), + description: translate('RJSF Json Data Structure Filename'), + name: 'formJsonSchemaFilename', + }, + { + element, + moddle, + commandStack, + component: SpiffExtensionTextInput, + label: translate('UI Schema Filename'), + description: translate('RJSF User Interface Filename'), + name: 'formUiSchemaFilename', + }, + ], + }; +} + +/** + * Create a group on the main panel with a text box (for choosing the dmn to connect) + * @param element + * @param translate + * @param moddle + * @returns entries + */ +function createBusinessRuleGroup(element, translate, moddle, commandStack) { + return { + id: 'business_rule_properties', + label: translate('Business Rule Properties'), + entries: [ + { + element, + moddle, + commandStack, + component: SpiffExtensionCalledDecision, + label: translate('Decision Id'), + description: translate('Id of the decision'), + }, + ], + }; +} + +/** + * Create a group on the main panel with a text box (for choosing the information to display to the user) + * @param element + * @param translate + * @param moddle + * @returns entries + */ +function createManualTaskPropertiesGroup( + element, + translate, + moddle, + commandStack +) { + return { + id: 'manual_task_properties', + label: translate('Manual Task Properties'), + entries: [ + { + element, + moddle, + commandStack, + component: SpiffExtensionInstructionsForEndUser, + label: translate('Instructions For End User'), + description: translate( + 'The instructions to show the user(s) who are responsible for completing the task.' + ), + }, + ], + }; +} + +/** + * Create a group on the main panel with a text box (for choosing the dmn to connect) + * @param element + * @param translate + * @param moddle + * @returns entries + */ +function createServiceGroup(element, translate, moddle, commandStack) { + return { + id: 'service_task_properties', + label: translate('Spiffworkflow Service Properties'), + entries: [ + { + element, + moddle, + commandStack, + component: ServiceTaskOperatorSelect, + translate, + }, + { + element, + moddle, + commandStack, + component: ServiceTaskResultTextInput, + translate, + }, + { + id: 'serviceTaskParameters', + label: translate('Parameters'), + component: ListGroup, + ...ServiceTaskParameterArray({ + element, + moddle, + translate, + }), + }, + ], + }; +} diff --git a/app/spiffworkflow/extensions/propertiesPanel/ScriptUnitTestArray.js b/app/spiffworkflow/extensions/propertiesPanel/ScriptUnitTestArray.js new file mode 100644 index 00000000..c329f0f6 --- /dev/null +++ b/app/spiffworkflow/extensions/propertiesPanel/ScriptUnitTestArray.js @@ -0,0 +1,227 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { TextFieldEntry, TextAreaEntry } from '@bpmn-io/properties-panel'; +import { + removeFirstInstanceOfItemFromArrayInPlace, + removeExtensionElementsIfEmpty, +} from '../../helpers'; + +const getScriptUnitTestsModdleElement = (shapeElement) => { + const bizObj = shapeElement.businessObject; + if (!bizObj.extensionElements) { + return null; + } + if (!bizObj.extensionElements.values) { + return null; + } + return bizObj.extensionElements + .get('values') + .filter(function getInstanceOfType(e) { + return e.$instanceOf('spiffworkflow:unitTests'); + })[0]; +}; + +const getScriptUnitTestModdleElements = (shapeElement) => { + const scriptUnitTestsModdleElement = + getScriptUnitTestsModdleElement(shapeElement); + if (scriptUnitTestsModdleElement) { + return scriptUnitTestsModdleElement.unitTests || []; + } + return []; +}; + +/** + * Provides a list of data objects, and allows you to add / remove data objects, and change their ids. + * @param props + * @constructor + */ +export function ScriptUnitTestArray(props) { + const { element, moddle, commandStack, translate } = props; + const scriptUnitTestModdleElements = getScriptUnitTestModdleElements(element); + const items = scriptUnitTestModdleElements.map( + (scriptUnitTestModdleElement, index) => { + const id = `scriptUnitTest-${index}`; + return { + id, + label: scriptUnitTestModdleElement.id, + entries: scriptUnitTestGroup({ + idPrefix: id, + element, + scriptUnitTestModdleElement, + commandStack, + translate, + }), + remove: removeFactory({ + element, + scriptUnitTestModdleElement, + commandStack, + moddle, + }), + autoFocusEntry: id, + }; + } + ); + + function add(event) { + event.stopPropagation(); + const scriptTaskModdleElement = element.businessObject; + if (!scriptTaskModdleElement.extensionElements) { + scriptTaskModdleElement.extensionElements = + scriptTaskModdleElement.$model.create('bpmn:ExtensionElements'); + } + + let scriptUnitTestsModdleElement = getScriptUnitTestsModdleElement(element); + + if (!scriptUnitTestsModdleElement) { + scriptUnitTestsModdleElement = scriptTaskModdleElement.$model.create( + 'spiffworkflow:unitTests' + ); + scriptTaskModdleElement.extensionElements + .get('values') + .push(scriptUnitTestsModdleElement); + } + const scriptUnitTestModdleElement = scriptTaskModdleElement.$model.create( + 'spiffworkflow:unitTest' + ); + const scriptUnitTestInputModdleElement = + scriptTaskModdleElement.$model.create('spiffworkflow:inputJson'); + const scriptUnitTestOutputModdleElement = + scriptTaskModdleElement.$model.create('spiffworkflow:expectedOutputJson'); + scriptUnitTestModdleElement.id = moddle.ids.nextPrefixed('ScriptUnitTest_'); + scriptUnitTestInputModdleElement.value = '{}'; + scriptUnitTestOutputModdleElement.value = '{}'; + scriptUnitTestModdleElement.inputJson = scriptUnitTestInputModdleElement; + scriptUnitTestModdleElement.expectedOutputJson = + scriptUnitTestOutputModdleElement; + + if (!scriptUnitTestsModdleElement.unitTests) { + scriptUnitTestsModdleElement.unitTests = []; + } + scriptUnitTestsModdleElement.unitTests.push(scriptUnitTestModdleElement); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + } + + return { items, add }; +} + +function removeFactory(props) { + const { element, scriptUnitTestModdleElement, commandStack } = props; + + return function (event) { + event.stopPropagation(); + const scriptUnitTestsModdleElement = + getScriptUnitTestsModdleElement(element); + removeFirstInstanceOfItemFromArrayInPlace( + scriptUnitTestsModdleElement.unitTests, + scriptUnitTestModdleElement + ); + if (scriptUnitTestsModdleElement.unitTests.length < 1) { + const scriptTaskModdleElement = element.businessObject; + removeFirstInstanceOfItemFromArrayInPlace( + scriptTaskModdleElement.extensionElements.values, + scriptUnitTestsModdleElement + ); + removeExtensionElementsIfEmpty(scriptTaskModdleElement); + } + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + }; +} + +// +// +// {} +// {} +// +// +function scriptUnitTestGroup(props) { + const { + idPrefix, + element, + scriptUnitTestModdleElement, + commandStack, + translate, + } = props; + return [ + { + id: `${idPrefix}-id`, + label: translate('ID:'), + element, + component: ScriptUnitTestIdTextField, + scriptUnitTestModdleElement, + commandStack, + }, + { + id: `${idPrefix}-input`, + label: translate('Input Json:'), + element, + component: ScriptUnitTestJsonTextArea, + scriptUnitTestJsonModdleElement: scriptUnitTestModdleElement.inputJson, + commandStack, + }, + { + id: `${idPrefix}-expected-output`, + label: translate('Expected Output Json:'), + element, + component: ScriptUnitTestJsonTextArea, + scriptUnitTestJsonModdleElement: + scriptUnitTestModdleElement.expectedOutputJson, + commandStack, + }, + ]; +} + +function ScriptUnitTestJsonTextArea(props) { + const { id, element, scriptUnitTestJsonModdleElement, label } = props; + + const debounce = useService('debounceInput'); + const setValue = (value) => { + scriptUnitTestJsonModdleElement.value = value; + }; + + const getValue = () => { + return scriptUnitTestJsonModdleElement.value; + }; + + return TextAreaEntry({ + element, + id: `${id}-textArea`, + getValue, + setValue, + debounce, + label, + }); +} + +function ScriptUnitTestIdTextField(props) { + const { id, element, scriptUnitTestModdleElement, label } = props; + + const debounce = useService('debounceInput'); + const commandStack = useService('commandStack'); + + const setValue = (value) => { + scriptUnitTestModdleElement.id = value; + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: scriptUnitTestModdleElement, + properties: {}, + }); + }; + + const getValue = () => { + return scriptUnitTestModdleElement.id; + }; + + return TextFieldEntry({ + element, + id: `${id}-textArea`, + getValue, + setValue, + debounce, + label, + }); +} diff --git a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionCalledDecision.js b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionCalledDecision.js new file mode 100644 index 00000000..7154fbc7 --- /dev/null +++ b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionCalledDecision.js @@ -0,0 +1,81 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { TextFieldEntry } from '@bpmn-io/properties-panel'; + +const SPIFF_PROP = 'spiffworkflow:calledDecisionId'; + +/** + * A generic properties' editor for text input. + * Allows you to provide additional SpiffWorkflow extension properties. Just + * uses whatever name is provide on the property, and adds or updates it as + * needed. + * + * + + + my_id + + + * + * @returns {string|null|*} + */ +export function SpiffExtensionCalledDecision(props) { + const { element } = props; + const { commandStack } = props; + const { moddle } = props; + const { label } = props; + const { description } = props; + const debounce = useService('debounceInput'); + + const getPropertyObject = () => { + const bizObj = element.businessObject; + if (!bizObj.extensionElements) { + return null; + } + return bizObj.extensionElements.get('values').filter(function (e) { + return e.$instanceOf(SPIFF_PROP); + })[0]; + }; + + const getValue = () => { + const property = getPropertyObject(); + if (property) { + return property.calledDecisionId; + } + return ''; + }; + + const setValue = (value) => { + let property = getPropertyObject(); + const { businessObject } = element; + let extensions = businessObject.extensionElements; + + if (!property) { + property = moddle.create(SPIFF_PROP); + if (!extensions) { + extensions = moddle.create('bpmn:ExtensionElements'); + } + extensions.get('values').push(property); + } + property.calledDecisionId = value; + + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + extensionElements: extensions, + }, + }); + }; + + return ( + + ); +} diff --git a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionInstructionsForEndUser.js b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionInstructionsForEndUser.js new file mode 100644 index 00000000..c8d2a821 --- /dev/null +++ b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionInstructionsForEndUser.js @@ -0,0 +1,73 @@ +import {useService } from 'bpmn-js-properties-panel'; +import { TextAreaEntry } from '@bpmn-io/properties-panel'; + +const SPIFF_PROP = "spiffworkflow:instructionsForEndUser" + +/** + * A generic properties' editor for text input. + * Allows you to provide additional SpiffWorkflow extension properties. Just + * uses whatever name is provide on the property, and adds or updates it as + * needed. + * + * + * + * @returns {string|null|*} + */ +export function SpiffExtensionInstructionsForEndUser(props) { + const element = props.element; + const commandStack = props.commandStack, moddle = props.moddle; + const label = props.label, description = props.description; + const debounce = useService('debounceInput'); + + const getPropertyObject = () => { + const bizObj = element.businessObject; + if (!bizObj.extensionElements) { + return null; + } else { + return bizObj.extensionElements.get("values").filter(function (e) { + return e.$instanceOf(SPIFF_PROP) + })[0]; + } + } + + const getValue = () => { + const property = getPropertyObject() + if (property) { + return property.instructionsForEndUser; + } + return "" + } + + const setValue = value => { + let property = getPropertyObject() + let businessObject = element.businessObject; + let extensions = businessObject.extensionElements; + + if (!property) { + property = moddle.create(SPIFF_PROP); + if (!extensions) { + extensions = moddle.create('bpmn:ExtensionElements'); + } + extensions.get('values').push(property); + } + property.instructionsForEndUser = value; + + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + "extensionElements": extensions + } + }); + }; + + return TextAreaEntry({ + id: 'extension_instruction_for_end_user', + element: element, + description: description, + label: label, + getValue: getValue, + setValue: setValue, + debounce: debounce, + }) +} diff --git a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionServiceProperties.js b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionServiceProperties.js new file mode 100644 index 00000000..3d60240a --- /dev/null +++ b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionServiceProperties.js @@ -0,0 +1,289 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { TextFieldEntry, SelectEntry } from '@bpmn-io/properties-panel'; +import { SPIFFWORKFLOW_XML_NAMESPACE } from '../../constants'; + +let serviceTaskOperators = []; + +// This stores the parameters for a given service task operator +// so that we can remember the values when switching between them +// the values should be the list of moddle elements that we push onto +// the parameterList of service task operator and the key should be +// the service task operator id +const previouslyUsedServiceTaskParameterValuesHash = {}; + +const LOW_PRIORITY = 500; +const SERVICE_TASK_OPERATOR_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:serviceTaskOperator`; +const SERVICE_TASK_PARAMETERS_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:parameters`; +const SERVICE_TASK_PARAMETER_ELEMENT_NAME = `${SPIFFWORKFLOW_XML_NAMESPACE}:parameter`; + +/** + * A generic properties' editor for text input. + * Allows you to provide additional SpiffWorkflow extension properties. Just + * uses whatever name is provide on the property, and adds or updates it as + * needed. + * + * + + + + + + + + + + + + * + * @returns {string|null|*} + */ + +function requestServiceTaskOperators(eventBus, element, commandStack) { + eventBus.fire('spiff.service_tasks.requested', { eventBus }); + eventBus.on('spiff.service_tasks.returned', (event) => { + if (event.serviceTaskOperators.length > 0) { + serviceTaskOperators = event.serviceTaskOperators.sort((a, b) => + a.id.localeCompare(b.id) + ); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + } + }); +} + +function getServiceTaskOperatorModdleElement(shapeElement) { + const { extensionElements } = shapeElement.businessObject; + if (extensionElements) { + for (const ee of extensionElements.values) { + if (ee.$type === SERVICE_TASK_OPERATOR_ELEMENT_NAME) { + return ee; + } + } + } + return null; +} + +function getServiceTaskParameterModdleElements(shapeElement) { + const serviceTaskOperatorModdleElement = + getServiceTaskOperatorModdleElement(shapeElement); + if (serviceTaskOperatorModdleElement) { + const { parameterList } = serviceTaskOperatorModdleElement; + if (parameterList) { + return parameterList.parameters.sort((a, b) => a.id.localeCompare(b.id)); + } + } + return []; +} + +export function ServiceTaskOperatorSelect(props) { + const { element } = props; + const { commandStack } = props; + const { translate } = props; + const { moddle } = props; + + const debounce = useService('debounceInput'); + const eventBus = useService('eventBus'); + + if (serviceTaskOperators.length === 0) { + requestServiceTaskOperators(eventBus, element, commandStack); + } + + const getValue = () => { + const serviceTaskOperatorModdleElement = + getServiceTaskOperatorModdleElement(element); + if (serviceTaskOperatorModdleElement) { + return serviceTaskOperatorModdleElement.id; + } + return ''; + }; + + const setValue = (value) => { + if (!value) { + return; + } + + const serviceTaskOperator = serviceTaskOperators.find( + (sto) => sto.id === value + ); + if (!serviceTaskOperator) { + console.error(`Could not find service task operator with id: ${value}`); + return; + } + + const previouslyUsedServiceTaskParameterValues = + previouslyUsedServiceTaskParameterValuesHash[value]; + + const { businessObject } = element; + let extensions = businessObject.extensionElements; + if (!extensions) { + extensions = moddle.create('bpmn:ExtensionElements'); + } + + const oldServiceTaskOperatorModdleElement = + getServiceTaskOperatorModdleElement(element); + + const newServiceTaskOperatorModdleElement = moddle.create( + SERVICE_TASK_OPERATOR_ELEMENT_NAME + ); + newServiceTaskOperatorModdleElement.id = value; + let newParameterList; + + if (previouslyUsedServiceTaskParameterValues) { + newParameterList = previouslyUsedServiceTaskParameterValues; + } else { + newParameterList = moddle.create(SERVICE_TASK_PARAMETERS_ELEMENT_NAME); + newParameterList.parameters = []; + serviceTaskOperator.parameters.forEach((stoParameter) => { + const newParameterModdleElement = moddle.create( + SERVICE_TASK_PARAMETER_ELEMENT_NAME + ); + newParameterModdleElement.id = stoParameter.id; + newParameterModdleElement.type = stoParameter.type; + newParameterList.parameters.push(newParameterModdleElement); + }); + previouslyUsedServiceTaskParameterValuesHash[value] = newParameterList; + if (oldServiceTaskOperatorModdleElement) { + previouslyUsedServiceTaskParameterValuesHash[ + oldServiceTaskOperatorModdleElement.id + ] = oldServiceTaskOperatorModdleElement.parameterList; + } + } + + newServiceTaskOperatorModdleElement.parameterList = newParameterList; + + const newExtensionValues = extensions.get('values').filter((extValue) => { + return extValue.$type !== SERVICE_TASK_OPERATOR_ELEMENT_NAME; + }); + newExtensionValues.push(newServiceTaskOperatorModdleElement); + extensions.values = newExtensionValues; + businessObject.extensionElements = extensions; + + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: {}, + }); + }; + + const getOptions = () => { + const optionList = []; + if (serviceTaskOperators) { + serviceTaskOperators.forEach((sto) => { + optionList.push({ + label: sto.id, + value: sto.id, + }); + }); + } + return optionList; + }; + + return SelectEntry({ + id: 'selectOperatorId', + element, + label: translate('Operator ID'), + getValue, + setValue, + getOptions, + debounce, + }); +} + +export function ServiceTaskParameterArray(props) { + const { element, commandStack } = props; + + const serviceTaskParameterModdleElements = + getServiceTaskParameterModdleElements(element); + const items = serviceTaskParameterModdleElements.map( + (serviceTaskParameterModdleElement, index) => { + const id = `serviceTaskParameter-${index}`; + return { + id, + label: serviceTaskParameterModdleElement.id, + entries: serviceTaskParameterEntries({ + idPrefix: id, + element, + serviceTaskParameterModdleElement, + commandStack, + }), + autoFocusEntry: id, + }; + } + ); + return { items }; +} + +function serviceTaskParameterEntries(props) { + const { idPrefix, serviceTaskParameterModdleElement, commandStack } = props; + return [ + { + idPrefix: `${idPrefix}-parameter`, + component: ServiceTaskParameterTextField, + serviceTaskParameterModdleElement, + commandStack, + }, + ]; +} + +function ServiceTaskParameterTextField(props) { + const { idPrefix, element, serviceTaskParameterModdleElement } = props; + + const debounce = useService('debounceInput'); + const setValue = (value) => { + serviceTaskParameterModdleElement.value = value; + }; + + const getValue = () => { + return serviceTaskParameterModdleElement.value; + }; + + return TextFieldEntry({ + element, + id: `${idPrefix}-textField`, + getValue, + setValue, + debounce, + }); +} + +export function ServiceTaskResultTextInput(props) { + const { element, translate, commandStack } = props; + + const debounce = useService('debounceInput'); + const serviceTaskOperatorModdleElement = + getServiceTaskOperatorModdleElement(element); + + const setValue = (value) => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: serviceTaskOperatorModdleElement, + properties: { + resultVariable: value, + }, + }); + }; + + const getValue = () => { + if (serviceTaskOperatorModdleElement) { + return serviceTaskOperatorModdleElement.resultVariable; + } + return ''; + }; + + if (serviceTaskOperatorModdleElement) { + return TextFieldEntry({ + element, + label: translate('Response Variable'), + description: translate( + 'response will be saved to this variable. Leave empty to discard the response.' + ), + id: `result-textField`, + getValue, + setValue, + debounce, + }); + } + return null; +} diff --git a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionTextInput.js b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionTextInput.js new file mode 100644 index 00000000..c08b80fd --- /dev/null +++ b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionTextInput.js @@ -0,0 +1,99 @@ +import {useService } from 'bpmn-js-properties-panel'; +import { TextFieldEntry } from '@bpmn-io/properties-panel'; + +const SPIFF_PARENT_PROP = "spiffworkflow:properties" +const SPIFF_PROP = "spiffworkflow:property" + +/** + * A generic properties' editor for text input. + * Allows you to provide additional SpiffWorkflow extension properties. Just + * uses whatever name is provide on the property, and adds or updates it as + * needed. + * + + + + + + + * + * @returns {string|null|*} + */ +export function SpiffExtensionTextInput(props) { + const element = props.element; + const commandStack = props.commandStack, moddle = props.moddle; + const name = props.name, label = props.label, description = props.description; + const debounce = useService('debounceInput'); + + const getPropertiesObject = () => { + const bizObj = element.businessObject; + if (!bizObj.extensionElements) { + return null; + } else { + const extensionElements = bizObj.extensionElements.get("values"); + return extensionElements.filter(function (extensionElement) { + if (extensionElement.$instanceOf(SPIFF_PARENT_PROP)) { + return extensionElement; + } + })[0]; + } + } + + const getPropertyObject = () => { + const parentElement = getPropertiesObject(); + if (parentElement) { + return parentElement.get("properties").filter(function (propertyElement) { + return propertyElement.$instanceOf(SPIFF_PROP) && propertyElement.name === name; + })[0]; + } + return null; + } + + const getValue = () => { + const property = getPropertyObject() + if (property) { + return property.value; + } + return "" + } + + const setValue = value => { + let properties = getPropertiesObject() + let property = getPropertyObject() + let businessObject = element.businessObject; + let extensions = businessObject.extensionElements; + + if (!extensions) { + extensions = moddle.create('bpmn:ExtensionElements'); + } + if (!properties) { + properties = moddle.create(SPIFF_PARENT_PROP); + extensions.get('values').push(properties); + } + if (!property) { + property = moddle.create(SPIFF_PROP); + properties.get('properties').push(property); + } + property.value = value; + property.name = name; + + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: businessObject, + properties: { + "extensionElements": extensions + } + }); + }; + + return ; + +} diff --git a/app/spiffworkflow/extensions/propertiesPanel/SpiffScriptGroup.js b/app/spiffworkflow/extensions/propertiesPanel/SpiffScriptGroup.js new file mode 100644 index 00000000..b7a74e17 --- /dev/null +++ b/app/spiffworkflow/extensions/propertiesPanel/SpiffScriptGroup.js @@ -0,0 +1,163 @@ +import { + HeaderButton, + TextAreaEntry, + isTextFieldEntryEdited, + ListGroup, +} from '@bpmn-io/properties-panel'; +import { useService } from 'bpmn-js-properties-panel'; +import { ScriptUnitTestArray } from './ScriptUnitTestArray'; + +export const SCRIPT_TYPE = { + bpmn: 'bpmn:script', + pre: 'spiffworkflow:preScript', + post: 'spiffworkflow:postScript', +}; + +function PythonScript(props) { + const { element, id } = props; + const { type } = props; + const { moddle } = props; + const { label } = props; + const { description } = props; + + const translate = useService('translate'); + const debounce = useService('debounceInput'); + + /** + * Finds the value of the given type within the extensionElements + * given a type of "spiff:preScript", would find it in this, and return + * the object. + * + * + + + me = "100% awesome" + + + ... + + * + * @returns {string|null|*} + */ + const getScriptObject = () => { + const bizObj = element.businessObject; + if (type === SCRIPT_TYPE.bpmn) { + return bizObj; + } + if (!bizObj.extensionElements) { + return null; + } + return bizObj.extensionElements + .get('values') + .filter(function getInstanceOfType(e) { + return e.$instanceOf(type); + })[0]; + }; + + const getValue = () => { + const scriptObj = getScriptObject(); + if (scriptObj) { + return scriptObj.script; + } + return ''; + }; + + const setValue = (value) => { + const { businessObject } = element; + let scriptObj = getScriptObject(); + // Create the script object if needed. + if (!scriptObj) { + scriptObj = moddle.create(type); + if (type !== SCRIPT_TYPE.bpmn) { + if (!businessObject.extensionElements) { + businessObject.extensionElements = moddle.create( + 'bpmn:ExtensionElements' + ); + } + businessObject.extensionElements.get('values').push(scriptObj); + } + } + scriptObj.script = value; + }; + + return TextAreaEntry({ + id, + element, + description: translate(description), + label: translate(label), + getValue, + setValue, + debounce, + }); +} + +function LaunchEditorButton(props) { + const { element, type } = props; + const eventBus = useService('eventBus'); + // fixme: add a call up date as a property + return HeaderButton({ + className: 'spiffworkflow-properties-panel-button', + onClick: () => { + eventBus.fire('launch.script.editor', { element, type }); + }, + children: 'Launch Editor', + }); +} + +/** + * Generates a python script. + * @param element The elemment that should get the script task. + * @param scriptType The type of script -- can be a preScript, postScript or a BPMN:Script for script tags + * @param moddle For updating the underlying xml document when needed. + * @returns {[{component: (function(*)), isEdited: *, id: string, element},{component: (function(*)), isEdited: *, id: string, element}]} + */ +export default function getEntries(props) { + const { + element, + moddle, + scriptType, + label, + description, + translate, + commandStack, + } = props; + + const entries = [ + { + id: `pythonScript_${scriptType}`, + element, + type: scriptType, + component: PythonScript, + isEdited: isTextFieldEntryEdited, + moddle, + label, + description, + }, + { + id: `launchEditorButton${scriptType}`, + type: scriptType, + element, + component: LaunchEditorButton, + isEdited: isTextFieldEntryEdited, + moddle, + }, + ]; + + // do not support testing pre and post scripts at the moment + if (scriptType === SCRIPT_TYPE.bpmn) { + entries.push({ + id: `scriptUnitTests${scriptType}`, + label: translate('Unit Tests'), + component: ListGroup, + ...ScriptUnitTestArray({ + element, + moddle, + translate, + commandStack, + }), + }); + } + + return entries; +} diff --git a/app/spiffworkflow/helpers.js b/app/spiffworkflow/helpers.js new file mode 100644 index 00000000..ec68280e --- /dev/null +++ b/app/spiffworkflow/helpers.js @@ -0,0 +1,14 @@ +// https://stackoverflow.com/a/5767357/6090676 +export function removeFirstInstanceOfItemFromArrayInPlace(arr, value) { + const index = arr.indexOf(value); + if (index > -1) { + arr.splice(index, 1); + } + return arr; +} + +export function removeExtensionElementsIfEmpty(moddleElement) { + if (moddleElement.extensionElements.values.length < 1) { + moddleElement.extensionElements = null; + } +} diff --git a/app/spiffworkflow/index.js b/app/spiffworkflow/index.js new file mode 100644 index 00000000..53277731 --- /dev/null +++ b/app/spiffworkflow/index.js @@ -0,0 +1,40 @@ +import RulesModule from 'diagram-js/lib/features/rules'; +import IoPalette from './InputOutput/IoPalette'; +import IoRules from './InputOutput/IoRules'; +import IoInterceptor from './InputOutput/IoInterceptor'; +import DataObjectInterceptor from './DataObject/DataObjectInterceptor'; +import DataObjectRules from './DataObject/DataObjectRules'; +import DataObjectRenderer from './DataObject/DataObjectRenderer'; +import DataObjectPropertiesProvider from './DataObject/propertiesPanel/DataObjectPropertiesProvider'; +import ConditionsPropertiesProvider from './conditions/propertiesPanel/ConditionsPropertiesProvider'; +import ExtensionsPropertiesProvider from './extensions/propertiesPanel/ExtensionsPropertiesProvider'; +import MessagesPropertiesProvider from './messages/propertiesPanel/MessagesPropertiesProvider'; +import CallActivityPropertiesProvider from './callActivity/propertiesPanel/CallActivityPropertiesProvider'; + +export default { + __depends__: [RulesModule], + __init__: [ + 'dataObjectInterceptor', + 'dataObjectRules', + 'dataObjectPropertiesProvider', + 'conditionsPropertiesProvider', + 'extensionsPropertiesProvider', + 'messagesPropertiesProvider', + 'callActivityPropertiesProvider', + 'ioPalette', + 'ioRules', + 'ioInterceptor', + 'dataObjectRenderer', + ], + dataObjectInterceptor: ['type', DataObjectInterceptor], + dataObjectRules: ['type', DataObjectRules], + dataObjectRenderer: ['type', DataObjectRenderer], + dataObjectPropertiesProvider: ['type', DataObjectPropertiesProvider], + conditionsPropertiesProvider: ['type', ConditionsPropertiesProvider], + extensionsPropertiesProvider: ['type', ExtensionsPropertiesProvider], + messagesPropertiesProvider: ['type', MessagesPropertiesProvider], + callActivityPropertiesProvider: ['type', CallActivityPropertiesProvider], + ioPalette: ['type', IoPalette], + ioRules: ['type', IoRules], + ioInterceptor: ['type', IoInterceptor], +}; diff --git a/app/spiffworkflow/messages/MessageHelpers.js b/app/spiffworkflow/messages/MessageHelpers.js new file mode 100644 index 00000000..9c4e6fb3 --- /dev/null +++ b/app/spiffworkflow/messages/MessageHelpers.js @@ -0,0 +1,187 @@ +import { is } from 'bpmn-js/lib/util/ModelUtil'; + +/** + * loops up until it can find the root. + * @param element + */ +export function getRoot(businessObject, moddle) { + // HACK: get the root element. need a more formal way to do this + if (moddle) { + for (const elementId in moddle.ids._seed.hats) { + if (elementId.startsWith('Definitions_')) { + return moddle.ids._seed.hats[elementId]; + } + } + } else { + // todo: Do we want businessObject to be a shape or moddle object? + if (businessObject.$type === 'bpmn:Definitions') { + return businessObject; + } + if (typeof businessObject.$parent !== 'undefined') { + return getRoot(businessObject.$parent); + } + } + return businessObject; +} + +export function isMessageElement(shapeElement) { + return ( + is(shapeElement, 'bpmn:SendTask') || + is(shapeElement, 'bpmn:ReceiveTask') || + isMessageEvent(shapeElement) + ); +} + +export function isMessageEvent(shapeElement) { + const { eventDefinitions } = shapeElement.businessObject; + if (eventDefinitions && eventDefinitions[0]) { + return eventDefinitions[0].$type === 'bpmn:MessageEventDefinition'; + } + return false; +} + +export function canReceiveMessage(shapeElement) { + if (is(shapeElement, 'bpmn:ReceiveTask')) { + return true; + } + if (isMessageEvent(shapeElement)) { + return ( + is(shapeElement, 'bpmn:StartEvent') || is(shapeElement, 'bpmn:CatchEvent') + ); + } + return false; +} + +export function getMessageRefElement(shapeElement) { + if (isMessageEvent(shapeElement)) { + const messageEventDefinition = + shapeElement.businessObject.eventDefinitions[0]; + if (messageEventDefinition && messageEventDefinition.messageRef) { + return messageEventDefinition.messageRef; + } + } else if ( + isMessageElement(shapeElement) && + shapeElement.businessObject.messageRef + ) { + return shapeElement.businessObject.messageRef; + } + return null; +} + +export function findCorrelationKeyForCorrelationProperty(shapeElement, moddle) { + const correlationKeyElements = findCorrelationKeys(shapeElement, moddle); + for (const cke of correlationKeyElements) { + if (cke.correlationPropertyRef) { + for (const correlationPropertyRef of cke.correlationPropertyRef) { + if (correlationPropertyRef.id === shapeElement.id) { + return cke; + } + } + } + } + return null; +} + +export function findCorrelationPropertiesAndRetrievalExpressionsForMessage( + shapeElement +) { + const formalExpressions = []; + const messageRefElement = getMessageRefElement(shapeElement); + if (messageRefElement) { + const root = getRoot(shapeElement.businessObject); + if (root.$type === 'bpmn:Definitions') { + for (const childElement of root.rootElements) { + if (childElement.$type === 'bpmn:CorrelationProperty') { + const retrievalExpression = + getRetrievalExpressionFromCorrelationProperty( + childElement, + messageRefElement + ); + if (retrievalExpression) { + const formalExpression = { + correlationPropertyModdleElement: childElement, + correlationPropertyRetrievalExpressionModdleElement: + retrievalExpression, + }; + formalExpressions.push(formalExpression); + } + } + } + } + } + return formalExpressions; +} + +export function getMessageElementForShapeElement(shapeElement) { + const { businessObject } = shapeElement; + const taskMessage = getMessageRefElement(shapeElement); + const messages = findMessageModdleElements(businessObject); + if (taskMessage) { + for (const message of messages) { + if (message.id === taskMessage.id) { + return message; + } + } + } + return null; +} + +function getRetrievalExpressionFromCorrelationProperty( + correlationProperty, + message +) { + if (correlationProperty.correlationPropertyRetrievalExpression) { + for (const retrievalExpression of correlationProperty.correlationPropertyRetrievalExpression) { + if ( + retrievalExpression.$type === + 'bpmn:CorrelationPropertyRetrievalExpression' && + retrievalExpression.messageRef && + retrievalExpression.messageRef.id === message.id + ) { + return retrievalExpression; + } + } + } + return null; +} + +export function findCorrelationProperties(businessObject, moddle) { + const root = getRoot(businessObject, moddle); + const correlationProperties = []; + for (const rootElement of root.rootElements) { + if (rootElement.$type === 'bpmn:CorrelationProperty') { + correlationProperties.push(rootElement); + } + } + return correlationProperties; +} + +export function findCorrelationKeys(businessObject, moddle) { + const root = getRoot(businessObject, moddle); + const correlationKeys = []; + if (root.rootElements) { + for (const rootElement of root.rootElements) { + if (rootElement.$type === 'bpmn:Collaboration') { + const currentKeys = rootElement.correlationKeys; + for (const correlationKey in currentKeys) { + const currentCorrelation = rootElement.correlationKeys[correlationKey]; + correlationKeys.push(currentCorrelation); + } + } + } + } + return correlationKeys; +} + +export function findMessageModdleElements(businessObject) { + const messages = []; + const root = getRoot(businessObject); + if (root.rootElements) { + for (const rootElement of root.rootElements) { + if (rootElement.$type === 'bpmn:Message') { + messages.push(rootElement); + } + } + } + return messages; +} diff --git a/app/spiffworkflow/messages/index.js b/app/spiffworkflow/messages/index.js new file mode 100644 index 00000000..3c54f264 --- /dev/null +++ b/app/spiffworkflow/messages/index.js @@ -0,0 +1,6 @@ +import MessagesPropertiesProvider from './propertiesPanel/MessagesPropertiesProvider'; + +export default { + __init__: ['messagesPropertiesProvider'], + messagesPropertiesProvider: ['type', MessagesPropertiesProvider], +}; diff --git a/app/spiffworkflow/messages/propertiesPanel/CorrelationKeysArray.js b/app/spiffworkflow/messages/propertiesPanel/CorrelationKeysArray.js new file mode 100644 index 00000000..58529068 --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/CorrelationKeysArray.js @@ -0,0 +1,143 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { SimpleEntry, TextFieldEntry } from '@bpmn-io/properties-panel'; +import { findCorrelationKeys, getRoot } from '../MessageHelpers'; +import { removeFirstInstanceOfItemFromArrayInPlace } from '../../helpers'; + +/** + * Provides a list of data objects, and allows you to add / remove data objects, and change their ids. + * @param props + * @constructor + */ +export function CorrelationKeysArray(props) { + const { element, moddle, commandStack } = props; + + const correlationKeyElements = findCorrelationKeys(element.businessObject); + const items = correlationKeyElements.map((correlationKeyElement, index) => { + const id = `correlationGroup-${index}`; + return { + id, + label: correlationKeyElement.name, + entries: correlationGroup({ + idPrefix: id, + element, + correlationKeyElement, + commandStack, + }), + remove: removeFactory({ + element, + correlationKeyElement, + commandStack, + moddle, + }), + autoFocusEntry: id, + }; + }); + + function add(event) { + event.stopPropagation(); + if (element.type === 'bpmn:Collaboration') { + const newCorrelationKeyElement = moddle.create('bpmn:CorrelationKey'); + newCorrelationKeyElement.name = + moddle.ids.nextPrefixed('CorrelationKey_'); + const currentCorrelationKeyElements = + element.businessObject.get('correlationKeys'); + currentCorrelationKeyElements.push(newCorrelationKeyElement); + commandStack.execute('element.updateProperties', { + element, + properties: {} + }); + } + } + + return { items, add }; +} + +function removeFactory(props) { + const { element, correlationKeyElement, moddle, commandStack } = props; + + return function (event) { + event.stopPropagation(); + const currentCorrelationKeyElements = + element.businessObject.get('correlationKeys'); + removeFirstInstanceOfItemFromArrayInPlace( + currentCorrelationKeyElements, + correlationKeyElement + ); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + }; +} + +// <--- The correlationGroup +// lover_name +// lover_instrument +// +// +function correlationGroup(props) { + const { idPrefix, correlationKeyElement, commandStack } = props; + const entries = [ + { + id: `${idPrefix}-key`, + component: CorrelationKeyTextField, + correlationKeyElement, + commandStack, + }, + ]; + (correlationKeyElement.correlationPropertyRef || []).forEach( + (correlationProperty, index) => { + entries.push({ + id: `${idPrefix}-${index}-text`, + component: CorrelationPropertyText, + correlationProperty, + }); + } + ); + return entries; +} + +function CorrelationKeyTextField(props) { + const { id, element, correlationKeyElement, commandStack } = props; + + const debounce = useService('debounceInput'); + const setValue = (value) => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: correlationKeyElement, + properties: { + name: value, + }, + }); + }; + + const getValue = () => { + return correlationKeyElement.name; + }; + + return TextFieldEntry({ + element, + id: `${id}-textField`, + getValue, + setValue, + debounce, + }); +} + +function CorrelationPropertyText(props) { + const { id, parameter, correlationProperty } = props; + const debounce = useService('debounceInput'); + + const getValue = () => { + return correlationProperty.id; + }; + + return SimpleEntry({ + element: parameter, + id: `${id}-textField`, + label: correlationProperty.id, + getValue, + disabled: true, + debounce, + }); +} diff --git a/app/spiffworkflow/messages/propertiesPanel/CorrelationPropertiesArray.js b/app/spiffworkflow/messages/propertiesPanel/CorrelationPropertiesArray.js new file mode 100644 index 00000000..cb7cfbcb --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/CorrelationPropertiesArray.js @@ -0,0 +1,334 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { + SelectEntry, + isTextFieldEntryEdited, + TextFieldEntry, +} from '@bpmn-io/properties-panel'; +import { + getRoot, + findCorrelationKeys, + findCorrelationProperties, + findCorrelationKeyForCorrelationProperty, +} from '../MessageHelpers'; +import { removeFirstInstanceOfItemFromArrayInPlace } from '../../helpers'; + +/** + * Allows the creation, or editing of messageCorrelations at the bpmn:sendTask level of a BPMN document. + */ +export function CorrelationPropertiesArray(props) { + const { moddle } = props; + const { element } = props; + const { commandStack } = props; + const { translate } = props; + + const correlationPropertyArray = findCorrelationProperties( + element.businessObject + ); + const items = correlationPropertyArray.map( + (correlationPropertyModdleElement, index) => { + const id = `correlation-${index}`; + const entries = MessageCorrelationPropertyGroup({ + idPrefix: id, + correlationPropertyModdleElement, + translate, + element, + commandStack, + moddle, + }); + return { + id, + label: correlationPropertyModdleElement.id, + entries, + autoFocusEntry: id, + remove: removeFactory({ + element, + correlationPropertyModdleElement, + commandStack, + moddle, + }), + }; + } + ); + + function add(event) { + event.stopPropagation(); + const newCorrelationPropertyElement = moddle.create( + 'bpmn:CorrelationProperty' + ); + const correlationPropertyId = moddle.ids.nextPrefixed( + 'CorrelationProperty_' + ); + newCorrelationPropertyElement.id = correlationPropertyId; + newCorrelationPropertyElement.name = correlationPropertyId; + const rootElement = getRoot(element.businessObject); + const { rootElements } = rootElement; + rootElements.push(newCorrelationPropertyElement); + + const correlationKeyElements = findCorrelationKeys( + newCorrelationPropertyElement, + moddle + ); + const correlationKeyElement = correlationKeyElements[0]; + if (correlationKeyElement.correlationPropertyRef) { + correlationKeyElement.correlationPropertyRef.push( + newCorrelationPropertyElement + ); + } else { + correlationKeyElement.correlationPropertyRef = [ + newCorrelationPropertyElement, + ]; + } + + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + } + + return { items, add }; +} + +function removeFactory(props) { + const { element, correlationPropertyModdleElement, moddle, commandStack } = + props; + + return function (event) { + event.stopPropagation(); + const rootElement = getRoot(element.businessObject); + const { rootElements } = rootElement; + + const oldCorrelationKeyElement = findCorrelationKeyForCorrelationProperty( + correlationPropertyModdleElement, + moddle + ); + if (oldCorrelationKeyElement) { + removeFirstInstanceOfItemFromArrayInPlace( + oldCorrelationKeyElement.correlationPropertyRef, + correlationPropertyModdleElement + ); + } + + removeFirstInstanceOfItemFromArrayInPlace( + rootElements, + correlationPropertyModdleElement + ); + commandStack.execute('element.updateProperties', { + element, + properties: { + messages: rootElements, + }, + }); + }; +} + +function MessageCorrelationPropertyGroup(props) { + const { + idPrefix, + correlationPropertyModdleElement, + translate, + element, + commandStack, + moddle, + } = props; + return [ + { + id: `${idPrefix}-correlation-key`, + component: MessageCorrelationKeySelect, + isEdited: isTextFieldEntryEdited, + idPrefix, + element, + correlationPropertyModdleElement, + translate, + moddle, + commandStack, + }, + { + id: `${idPrefix}-correlation-property-id`, + component: CorrelationPropertyIdTextField, + isEdited: isTextFieldEntryEdited, + idPrefix, + element, + correlationPropertyModdleElement, + translate, + commandStack, + }, + { + id: `${idPrefix}-correlation-property-name`, + component: CorrelationPropertyNameTextField, + isEdited: isTextFieldEntryEdited, + idPrefix, + element, + correlationPropertyModdleElement, + translate, + commandStack, + }, + ]; +} + +function MessageCorrelationKeySelect(props) { + const { + idPrefix, + correlationPropertyModdleElement, + translate, + element, + moddle, + commandStack, + } = props; + const debounce = useService('debounceInput'); + + const setValue = (value) => { + if ( + value === 'placeholder-never-should-be-used-as-an-actual-correlation-key' + ) { + return; + } + const correlationKeyElements = findCorrelationKeys( + correlationPropertyModdleElement, + moddle + ); + let newCorrelationKeyElement; + for (const cke of correlationKeyElements) { + if (cke.name === value) { + newCorrelationKeyElement = cke; + } + } + const oldCorrelationKeyElement = findCorrelationKeyForCorrelationProperty( + correlationPropertyModdleElement, + moddle + ); + + if (newCorrelationKeyElement.correlationPropertyRef) { + newCorrelationKeyElement.correlationPropertyRef.push( + correlationPropertyModdleElement + ); + } else { + newCorrelationKeyElement.correlationPropertyRef = [ + correlationPropertyModdleElement, + ]; + } + + if (oldCorrelationKeyElement) { + removeFirstInstanceOfItemFromArrayInPlace( + oldCorrelationKeyElement.correlationPropertyRef, + correlationPropertyModdleElement + ); + } + + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: correlationPropertyModdleElement, + properties: {}, + }); + }; + + const getValue = () => { + const correlationKeyElement = findCorrelationKeyForCorrelationProperty( + correlationPropertyModdleElement, + moddle + ); + if (correlationKeyElement) { + return correlationKeyElement.name; + } + return null; + }; + + const getOptions = () => { + const correlationKeyElements = findCorrelationKeys( + correlationPropertyModdleElement, + moddle + ); + const options = []; + if (correlationKeyElements.length === 0) { + options.push({ + label: 'Please Create a Correlation Key', + value: 'placeholder-never-should-be-used-as-an-actual-correlation-key', + disabled: true, + }); + } + for (const correlationKeyElement of correlationKeyElements) { + options.push({ + label: correlationKeyElement.name, + value: correlationKeyElement.name, + }); + } + return options; + }; + + return SelectEntry({ + id: `${idPrefix}-select`, + element, + label: translate('Correlation Key'), + getValue, + setValue, + getOptions, + debounce, + }); +} + +function CorrelationPropertyIdTextField(props) { + const { + id, + element, + correlationPropertyModdleElement, + commandStack, + translate, + } = props; + + const debounce = useService('debounceInput'); + const setValue = (value) => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: correlationPropertyModdleElement, + properties: { + id: value, + }, + }); + }; + + const getValue = () => { + return correlationPropertyModdleElement.id; + }; + + return TextFieldEntry({ + element, + id: `${id}-id-textField`, + label: translate('ID'), + getValue, + setValue, + debounce, + }); +} + +function CorrelationPropertyNameTextField(props) { + const { + id, + element, + correlationPropertyModdleElement, + commandStack, + translate, + } = props; + + const debounce = useService('debounceInput'); + const setValue = (value) => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: correlationPropertyModdleElement, + properties: { + name: value, + }, + }); + }; + + const getValue = () => { + return correlationPropertyModdleElement.name; + }; + + return TextFieldEntry({ + element, + id: `${id}-name-textField`, + label: translate('Name'), + getValue, + setValue, + debounce, + }); +} diff --git a/app/spiffworkflow/messages/propertiesPanel/MessageArray.js b/app/spiffworkflow/messages/propertiesPanel/MessageArray.js new file mode 100644 index 00000000..2f5b4c25 --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/MessageArray.js @@ -0,0 +1,170 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { TextFieldEntry } from '@bpmn-io/properties-panel'; +import { getRoot, findMessageModdleElements } from '../MessageHelpers'; +import { removeFirstInstanceOfItemFromArrayInPlace } from '../../helpers'; + +/** + * Provides a list of data objects, and allows you to add / remove data objects, and change their ids. + * @param props + * @constructor + */ +export function MessageArray(props) { + const { element, moddle, commandStack, translate } = props; + + const messageElements = findMessageModdleElements(element.businessObject); + const items = messageElements.map((messageElement, index) => { + const id = `messageElement-${index}`; + return { + id, + label: messageElement.name, + entries: messageGroup({ + idPrefix: id, + element, + messageElement, + commandStack, + translate, + }), + autoFocusEntry: id, + remove: removeFactory({ + element, + messageElement, + commandStack, + moddle, + }), + }; + }); + + function add(event) { + event.stopPropagation(); + if (element.type === 'bpmn:Collaboration') { + const newMessageElement = moddle.create('bpmn:Message'); + const messageId = moddle.ids.nextPrefixed('Message_'); + newMessageElement.id = messageId; + newMessageElement.name = messageId; + const rootElement = getRoot(element.businessObject); + const { rootElements } = rootElement; + rootElements.push(newMessageElement); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + } + } + + return { items, add }; +} + +function removeMessageRefs(messageElement, moddleElement) { + if ( + moddleElement.messageRef && + moddleElement.messageRef.id === messageElement.id + ) { + moddleElement.messageRef = null; + } else if (moddleElement.correlationPropertyRetrievalExpression) { + moddleElement.correlationPropertyRetrievalExpression.forEach((cpre) => { + removeMessageRefs(messageElement, cpre); + }); + } else if (moddleElement.flowElements) { + moddleElement.flowElements.forEach((fe) => { + removeMessageRefs(messageElement, fe); + }); + } else if (moddleElement.eventDefinitions) { + moddleElement.eventDefinitions.forEach((ed) => { + removeMessageRefs(messageElement, ed); + }); + } +} + +function removeFactory(props) { + const { element, messageElement, commandStack } = props; + + return function (event) { + event.stopPropagation(); + const rootElement = getRoot(element.businessObject); + const { rootElements } = rootElement; + removeFirstInstanceOfItemFromArrayInPlace(rootElements, messageElement); + rootElements.forEach((moddleElement) => { + removeMessageRefs(messageElement, moddleElement); + }); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + }; +} + +function messageGroup(props) { + const { messageElement, commandStack, translate, idPrefix } = props; + return [ + { + id: `${idPrefix}-id`, + component: MessageIdTextField, + messageElement, + commandStack, + translate, + }, + { + id: `${idPrefix}-name`, + component: MessageNameTextField, + messageElement, + commandStack, + translate, + }, + ]; +} + +function MessageIdTextField(props) { + const { id, element, messageElement, commandStack, translate } = props; + + const debounce = useService('debounceInput'); + const setValue = (value) => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: messageElement, + properties: { + id: value, + }, + }); + }; + + const getValue = () => { + return messageElement.id; + }; + + return TextFieldEntry({ + element, + id: `${id}-id-textField`, + label: translate('ID'), + getValue, + setValue, + debounce, + }); +} + +function MessageNameTextField(props) { + const { id, element, messageElement, commandStack, translate } = props; + + const debounce = useService('debounceInput'); + const setValue = (value) => { + commandStack.execute('element.updateModdleProperties', { + element, + moddleElement: messageElement, + properties: { + name: value, + }, + }); + }; + + const getValue = () => { + return messageElement.name; + }; + + return TextFieldEntry({ + element, + id: `${id}-name-textField`, + label: translate('Name'), + getValue, + setValue, + debounce, + }); +} diff --git a/app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js b/app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js new file mode 100644 index 00000000..bd62c693 --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js @@ -0,0 +1,278 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { + SelectEntry, + isTextFieldEntryEdited, + TextFieldEntry, +} from '@bpmn-io/properties-panel'; +import { + findCorrelationPropertiesAndRetrievalExpressionsForMessage, + findCorrelationProperties, + getMessageRefElement, +} from '../MessageHelpers'; +import { removeFirstInstanceOfItemFromArrayInPlace } from '../../helpers'; + +/** + * Allows the creation, or editing of messageCorrelations at the bpmn:sendTask level of a BPMN document. + */ +export function MessageCorrelationPropertiesArray(props) { + const { moddle } = props; + const { element } = props; + const { commandStack } = props; + const { translate } = props; + + const correlationPropertyObjectsForCurrentMessage = + findCorrelationPropertiesAndRetrievalExpressionsForMessage(element); + const allCorrelationPropertyModdleElements = findCorrelationProperties( + element, + moddle + ); + const items = correlationPropertyObjectsForCurrentMessage.map( + (correlationPropertyObject, index) => { + const { + correlationPropertyModdleElement, + correlationPropertyRetrievalExpressionModdleElement, + } = correlationPropertyObject; + const id = `correlation-${index}`; + const entries = MessageCorrelationPropertyGroup({ + idPrefix: id, + correlationPropertyModdleElement, + correlationPropertyRetrievalExpressionModdleElement, + translate, + moddle, + element, + commandStack, + }); + return { + id, + label: correlationPropertyModdleElement.id, + entries, + autoFocusEntry: id, + remove: removeFactory({ + element, + correlationPropertyModdleElement, + correlationPropertyRetrievalExpressionModdleElement, + commandStack, + }), + }; + } + ); + + function add(event) { + event.stopPropagation(); + + let correlationPropertyElement; + allCorrelationPropertyModdleElements.forEach((cpe) => { + let foundElement = false; + correlationPropertyObjectsForCurrentMessage.forEach((cpo) => { + const cpme = cpo.correlationPropertyModdleElement; + if (cpme.id === cpe.id) { + foundElement = true; + } + }); + if (!foundElement) { + correlationPropertyElement = cpe; + } + }); + + // TODO: we should have some way to show an error if element is not found instead + // we need to check this since the code assumes each message only has one ref + // and will not display all properties if there are multiple + if (correlationPropertyElement) { + const newRetrievalExpressionElement = moddle.create( + 'bpmn:CorrelationPropertyRetrievalExpression' + ); + const messageRefElement = getMessageRefElement(element); + const newFormalExpression = moddle.create('bpmn:FormalExpression'); + newFormalExpression.body = ''; + + newRetrievalExpressionElement.messageRef = messageRefElement; + newRetrievalExpressionElement.messagePath = newFormalExpression; + + if (!correlationPropertyElement.correlationPropertyRetrievalExpression) { + correlationPropertyElement.correlationPropertyRetrievalExpression = []; + } + correlationPropertyElement.correlationPropertyRetrievalExpression.push( + newRetrievalExpressionElement + ); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + } else { + console.error( + 'ERROR: There are not any more correlation properties this message can be added to' + ); + } + } + + const returnObject = { items }; + if (allCorrelationPropertyModdleElements.length !== 0) { + returnObject.add = add; + } + return returnObject; +} + +function removeFactory(props) { + const { + element, + correlationPropertyModdleElement, + correlationPropertyRetrievalExpressionModdleElement, + commandStack, + } = props; + + return function (event) { + event.stopPropagation(); + removeFirstInstanceOfItemFromArrayInPlace( + correlationPropertyModdleElement.correlationPropertyRetrievalExpression, + correlationPropertyRetrievalExpressionModdleElement + ); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + }; +} + +function MessageCorrelationPropertyGroup(props) { + const { + idPrefix, + correlationPropertyModdleElement, + correlationPropertyRetrievalExpressionModdleElement, + translate, + moddle, + element, + commandStack, + } = props; + return [ + { + id: `${idPrefix}-correlation-key`, + component: MessageCorrelationPropertySelect, + isEdited: isTextFieldEntryEdited, + idPrefix, + correlationPropertyModdleElement, + correlationPropertyRetrievalExpressionModdleElement, + translate, + moddle, + element, + commandStack, + }, + { + id: `${idPrefix}-expression`, + component: MessageCorrelationExpressionTextField, + isEdited: isTextFieldEntryEdited, + idPrefix, + correlationPropertyRetrievalExpressionModdleElement, + translate, + }, + ]; +} + +function MessageCorrelationPropertySelect(props) { + const { + idPrefix, + correlationPropertyModdleElement, + correlationPropertyRetrievalExpressionModdleElement, + translate, + parameter, + moddle, + element, + commandStack, + } = props; + const debounce = useService('debounceInput'); + + const setValue = (value) => { + const allCorrelationPropertyModdleElements = findCorrelationProperties( + correlationPropertyModdleElement, + moddle + ); + const newCorrelationPropertyElement = + allCorrelationPropertyModdleElements.find((cpe) => cpe.id === value); + + if (!newCorrelationPropertyElement.correlationPropertyRetrievalExpression) { + newCorrelationPropertyElement.correlationPropertyRetrievalExpression = []; + } + newCorrelationPropertyElement.correlationPropertyRetrievalExpression.push( + correlationPropertyRetrievalExpressionModdleElement + ); + removeFirstInstanceOfItemFromArrayInPlace( + correlationPropertyModdleElement.correlationPropertyRetrievalExpression, + correlationPropertyRetrievalExpressionModdleElement + ); + commandStack.execute('element.updateProperties', { + element, + properties: {}, + }); + }; + + const getValue = () => { + return correlationPropertyModdleElement.id; + }; + + const getOptions = () => { + const allCorrelationPropertyModdleElements = findCorrelationProperties( + correlationPropertyModdleElement, + moddle + ); + const correlationPropertyObjectsForCurrentMessage = + findCorrelationPropertiesAndRetrievalExpressionsForMessage(element); + const options = []; + for (const cpe of allCorrelationPropertyModdleElements) { + const foundElement = correlationPropertyObjectsForCurrentMessage.find( + (cpo) => { + const cpme = cpo.correlationPropertyModdleElement; + return cpme.id === cpe.id; + } + ); + if ( + !foundElement || + foundElement.correlationPropertyModdleElement === + correlationPropertyModdleElement + ) { + options.push({ + label: cpe.name, + value: cpe.id, + }); + } + } + return options; + }; + + return SelectEntry({ + id: `${idPrefix}-select`, + element: parameter, + label: translate('Correlation Property'), + getValue, + setValue, + getOptions, + debounce, + }); +} + +function MessageCorrelationExpressionTextField(props) { + const { + idPrefix, + parameter, + correlationPropertyRetrievalExpressionModdleElement, + translate, + } = props; + + const debounce = useService('debounceInput'); + + const setValue = (value) => { + correlationPropertyRetrievalExpressionModdleElement.messagePath.body = + value; + }; + + const getValue = (_parameter) => { + return correlationPropertyRetrievalExpressionModdleElement.messagePath.body; + }; + + return TextFieldEntry({ + element: parameter, + id: `${idPrefix}-textField`, + label: translate('Expression'), + getValue, + setValue, + debounce, + }); +} diff --git a/app/spiffworkflow/messages/propertiesPanel/MessagePayload.js b/app/spiffworkflow/messages/propertiesPanel/MessagePayload.js new file mode 100644 index 00000000..3ba4d6df --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/MessagePayload.js @@ -0,0 +1,64 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { TextAreaEntry } from '@bpmn-io/properties-panel'; +import { getMessageElementForShapeElement } from '../MessageHelpers'; + +/** + * Allows the creation, or editing of messagePayload at the bpmn:sendTask level of a BPMN document. + */ +export function MessagePayload(props) { + const shapeElement = props.element; + const debounce = useService('debounceInput'); + const messageElement = getMessageElementForShapeElement(shapeElement); + const disabled = !messageElement; + + const getMessagePayloadObject = () => { + if (messageElement) { + const { extensionElements } = messageElement; + if (extensionElements) { + return messageElement.extensionElements + .get('values') + .filter(function getInstanceOfType(e) { + return e.$instanceOf('spiffworkflow:messagePayload'); + })[0]; + } + } + return null; + }; + + const getValue = () => { + const messagePayloadObject = getMessagePayloadObject(); + if (messagePayloadObject) { + return messagePayloadObject.messagePayload; + } + return ''; + }; + + const setValue = (value) => { + let messagePayloadObject = getMessagePayloadObject(); + if (!messagePayloadObject) { + messagePayloadObject = messageElement.$model.create( + 'spiffworkflow:messagePayload' + ); + if (!messageElement.extensionElements) { + messageElement.extensionElements = messageElement.$model.create( + 'bpmn:ExtensionElements' + ); + } + messageElement.extensionElements.get('values').push(messagePayloadObject); + } + messagePayloadObject.messagePayload = value; + }; + + return ( + + ); +} diff --git a/app/spiffworkflow/messages/propertiesPanel/MessageSelect.js b/app/spiffworkflow/messages/propertiesPanel/MessageSelect.js new file mode 100644 index 00000000..e1df995d --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/MessageSelect.js @@ -0,0 +1,83 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { SelectEntry } from '@bpmn-io/properties-panel'; +import { + findMessageModdleElements, + getMessageRefElement, + isMessageEvent, +} from '../MessageHelpers'; + +/** + * Allows the selection, or creation, of Message at the Definitions level of a BPMN document. + */ +export function MessageSelect(props) { + const shapeElement = props.element; + const { commandStack } = props; + const debounce = useService('debounceInput'); + + const getValue = () => { + const messageRefElement = getMessageRefElement(shapeElement); + if (messageRefElement) { + return messageRefElement.id; + } + return ''; + }; + + const setValue = (value) => { + /* Need to add the selected message as the messageRef on the current message task */ + const { businessObject } = shapeElement; + const messages = findMessageModdleElements(shapeElement.businessObject); + for (const message of messages) { + if (message.id === value) { + if (isMessageEvent(shapeElement)) { + const messageEventDefinition = businessObject.eventDefinitions[0]; + messageEventDefinition.messageRef = message; + // call this to update the other elements in the props panel like payload + commandStack.execute('element.updateModdleProperties', { + element: shapeElement, + moddleElement: businessObject, + }); + } else if ( + businessObject.$type === 'bpmn:ReceiveTask' || + businessObject.$type === 'bpmn:SendTask' + ) { + commandStack.execute('element.updateModdleProperties', { + element: shapeElement, + moddleElement: businessObject, + properties: { + messageRef: message, + }, + }); + commandStack.execute('element.updateProperties', { + element: shapeElement, + moddleElement: businessObject, + properties: { + messageRef: message, + }, + }); + } + } + } + }; + + const getOptions = (_value) => { + const messages = findMessageModdleElements(shapeElement.businessObject); + const options = []; + for (const message of messages) { + options.push({ label: message.name, value: message.id }); + } + return options; + }; + + return ( + + ); +} diff --git a/app/spiffworkflow/messages/propertiesPanel/MessageVariable.js b/app/spiffworkflow/messages/propertiesPanel/MessageVariable.js new file mode 100644 index 00000000..8a0353f7 --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/MessageVariable.js @@ -0,0 +1,66 @@ +import { useService } from 'bpmn-js-properties-panel'; +import { TextFieldEntry } from '@bpmn-io/properties-panel'; +import { getMessageElementForShapeElement } from '../MessageHelpers'; + +/** + * Allows the creation, or editing of messageVariable at the bpmn:sendTask level of a BPMN document. + */ +export function MessageVariable(props) { + const shapeElement = props.element; + const debounce = useService('debounceInput'); + const messageElement = getMessageElementForShapeElement(shapeElement); + const disabled = !messageElement; + + const getMessageVariableObject = () => { + if (messageElement) { + const { extensionElements } = messageElement; + if (extensionElements) { + return messageElement.extensionElements + .get('values') + .filter(function getInstanceOfType(e) { + return e.$instanceOf('spiffworkflow:messageVariable'); + })[0]; + } + } + return null; + }; + + const getValue = () => { + const messageVariableObject = getMessageVariableObject(); + if (messageVariableObject) { + return messageVariableObject.messageVariable; + } + return ''; + }; + + const setValue = (value) => { + let messageVariableObject = getMessageVariableObject(); + if (!messageVariableObject) { + messageVariableObject = messageElement.$model.create( + 'spiffworkflow:messageVariable' + ); + if (!messageElement.extensionElements) { + messageElement.extensionElements = messageElement.$model.create( + 'bpmn:ExtensionElements' + ); + } + messageElement.extensionElements + .get('values') + .push(messageVariableObject); + } + messageVariableObject.messageVariable = value; + }; + + return ( + + ); +} diff --git a/app/spiffworkflow/messages/propertiesPanel/MessagesPropertiesProvider.js b/app/spiffworkflow/messages/propertiesPanel/MessagesPropertiesProvider.js new file mode 100644 index 00000000..6abf6c79 --- /dev/null +++ b/app/spiffworkflow/messages/propertiesPanel/MessagesPropertiesProvider.js @@ -0,0 +1,186 @@ +import { ListGroup, isTextFieldEntryEdited } from '@bpmn-io/properties-panel'; +import { is } from 'bpmn-js/lib/util/ModelUtil'; +import { CorrelationKeysArray } from './CorrelationKeysArray'; +import { MessageSelect } from './MessageSelect'; +import { MessagePayload } from './MessagePayload'; +import { MessageVariable } from './MessageVariable'; +import { CorrelationPropertiesArray } from './CorrelationPropertiesArray'; +import { MessageCorrelationPropertiesArray } from './MessageCorrelationPropertiesArray'; +import { MessageArray } from './MessageArray'; +import { isMessageElement, canReceiveMessage } from '../MessageHelpers'; + +const LOW_PRIORITY = 500; + +export default function MessagesPropertiesProvider( + propertiesPanel, + translate, + moddle, + commandStack, + elementRegistry +) { + this.getGroups = function getGroupsCallback(element) { + return function pushGroup(groups) { + if (is(element, 'bpmn:Collaboration')) { + groups.push( + ...createCollaborationGroup( + element, + translate, + moddle, + commandStack, + elementRegistry + ) + ); + } else if (isMessageElement(element)) { + const messageIndex = findEntry(groups, 'message'); + if (messageIndex) { + groups.splice(messageIndex, 1); + } + groups.push( + createMessageGroup( + element, + translate, + moddle, + commandStack, + elementRegistry + ) + ); + } + return groups; + }; + }; + + function findEntry(entries, entryId) { + let entryIndex = null; + entries.forEach(function (value, index) { + if (value.id === entryId) { + entryIndex = index; + } + }); + return entryIndex; + } + propertiesPanel.registerProvider(LOW_PRIORITY, this); +} + +MessagesPropertiesProvider.$inject = [ + 'propertiesPanel', + 'translate', + 'moddle', + 'commandStack', + 'elementRegistry', +]; + +/** + * Adds a group to the properties panel for the script task that allows you + * to set the script. + * @param element + * @param translate + * @returns The components to add to the properties panel. */ +function createCollaborationGroup( + element, + translate, + moddle, + commandStack, + elementRegistry +) { + return [ + { + id: 'correlation_keys', + label: translate('Correlation Keys'), + component: ListGroup, + ...CorrelationKeysArray({ + element, + moddle, + commandStack, + elementRegistry, + translate, + }), + }, + { + id: 'correlation_properties', + label: translate('Correlation Properties'), + component: ListGroup, + ...CorrelationPropertiesArray({ + element, + moddle, + commandStack, + elementRegistry, + translate, + }), + }, + { + id: 'messages', + label: translate('Messages'), + component: ListGroup, + ...MessageArray({ + element, + moddle, + commandStack, + elementRegistry, + translate, + }), + }, + ]; +} + +/** + * Adds a group to the properties panel for editing messages for the SendTask + * @param element + * @param translate + * @returns The components to add to the properties panel. */ +function createMessageGroup( + element, + translate, + moddle, + commandStack, + elementRegistry +) { + const entries = [ + { + id: 'selectMessage', + element, + component: MessageSelect, + isEdited: isTextFieldEntryEdited, + moddle, + commandStack, + }, + ]; + + if (canReceiveMessage(element)) { + entries.push({ + id: 'messageVariable', + element, + component: MessageVariable, + isEdited: isTextFieldEntryEdited, + moddle, + commandStack, + }); + } else { + entries.push({ + id: 'messagePayload', + element, + component: MessagePayload, + isEdited: isTextFieldEntryEdited, + moddle, + commandStack, + }); + } + + entries.push({ + id: 'correlationProperties', + label: translate('Correlation'), + component: ListGroup, + ...MessageCorrelationPropertiesArray({ + element, + moddle, + commandStack, + elementRegistry, + translate, + }), + }); + + return { + id: 'messages', + label: translate('Message'), + entries, + }; +} diff --git a/app/spiffworkflow/moddle/spiffworkflow.json b/app/spiffworkflow/moddle/spiffworkflow.json new file mode 100644 index 00000000..90cb3352 --- /dev/null +++ b/app/spiffworkflow/moddle/spiffworkflow.json @@ -0,0 +1,213 @@ +{ + "name": "SpiffWorkflow", + "uri": "http://spiffworkflow.org/bpmn/schema/1.0/core", + "prefix": "spiffworkflow", + "associations": [], + "types": [ + { + "name": "preScript", + "superClass": [ "Element" ], + "properties": [ + { + "name": "script", + "isBody": true, + "type": "String" + } + ] + }, + { + "name": "postScript", + "superClass": [ "Element" ], + "properties": [ + { + "name": "script", + "isBody": true, + "type": "String" + } + ] + }, + { + "name": "messagePayload", + "superClass": [ "Element" ], + "properties": [ + { + "name": "messagePayload", + "isBody": true, + "type": "String" + } + ] + }, + { + "name": "messageVariable", + "superClass": [ "Element" ], + "properties": [ + { + "name": "messageVariable", + "isBody": true, + "type": "String" + } + ] + }, + { + "name": "calledDecisionId", + "superClass": [ "Element" ], + "properties": [ + { + "name": "calledDecisionId", + "isBody": true, + "type": "String" + } + ] + }, + { + "name": "instructionsForEndUser", + "superClass": [ "Element" ], + "properties": [ + { + "name": "instructionsForEndUser", + "isBody": true, + "type": "String" + } + ] + }, + { + "name": "properties", + "superClass": [ + "Element" + ], + "properties": [ + { + "name": "properties", + "type": "property", + "isMany": true + } + ] + }, + { + "name": "property", + "superClass": [ "Element" ], + "properties": [ + { + "name": "name", + "isAttr": true, + "type": "String" + }, + { + "name": "value", + "isAttr": true, + "type": "String" + } + ] + }, + { + "name": "serviceTaskOperator", + "superClass": [ + "Element" + ], + "properties": [ + { + "name": "id", + "isAttr": true, + "type": "String" + }, + { + "name": "resultVariable", + "isAttr": true, + "type": "String" + }, + { + "name": "parameterList", + "type": "parameters" + } + ] + }, + { + "name": "parameters", + "superClass": [ + "Element" + ], + "properties": [ + { + "name": "parameters", + "type": "parameter", + "isMany": true + } + ] + }, + { + "name": "parameter", + "superClass": [ "Element" ], + "properties": [ + { + "name": "id", + "isAttr": true, + "type": "String" + }, + { + "name": "type", + "isAttr": true, + "type": "String" + }, + { + "name": "value", + "isAttr": true, + "type": "String" + } + ] + }, + { + "name": "unitTests", + "superClass": [ + "Element" + ], + "properties": [ + { + "name": "unitTests", + "type": "unitTest", + "isMany": true + } + ] + }, + { + "name": "unitTest", + "superClass": [ "Element" ], + "properties": [ + { + "name": "id", + "isAttr": true, + "type": "String" + }, + { + "name": "inputJson", + "type": "inputJson" + }, + { + "name": "expectedOutputJson", + "type": "expectedOutputJson" + } + ] + }, + { + "name": "inputJson", + "superClass": [ "Element" ], + "properties": [ + { + "name": "value", + "isBody": true, + "type": "string" + } + ] + }, + { + "name": "expectedOutputJson", + "superClass": [ "Element" ], + "properties": [ + { + "name": "value", + "isBody": true, + "type": "string" + } + ] + } + ] +} diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 00000000..7d83f3f8 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,40349 @@ +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ "./node_modules/@bpmn-io/element-templates-validator/dist/index.esm.js": +/*!*****************************************************************************!*\ + !*** ./node_modules/@bpmn-io/element-templates-validator/dist/index.esm.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "getSchemaPackage": () => (/* binding */ getSchemaPackage), +/* harmony export */ "getSchemaVersion": () => (/* binding */ getSchemaVersion), +/* harmony export */ "getZeebeSchemaPackage": () => (/* binding */ getZeebeSchemaPackage), +/* harmony export */ "getZeebeSchemaVersion": () => (/* binding */ getZeebeSchemaVersion), +/* harmony export */ "validate": () => (/* binding */ validate), +/* harmony export */ "validateAll": () => (/* binding */ validateAll), +/* harmony export */ "validateAllZeebe": () => (/* binding */ validateAllZeebe), +/* harmony export */ "validateZeebe": () => (/* binding */ validateZeebe) +/* harmony export */ }); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! min-dash */ "./node_modules/min-dash/dist/index.esm.js"); + + +var name$1 = "@camunda/element-templates-json-schema"; +var version$1 = "0.10.0"; + +// do not edit .js files directly - edit src/index.jst + + + +var fastDeepEqual = function equal(a, b) { + if (a === b) return true; + + if (a && b && typeof a == 'object' && typeof b == 'object') { + if (a.constructor !== b.constructor) return false; + + var length, i, keys; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) + if (!equal(a[i], b[i])) return false; + return true; + } + + + + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); + + keys = Object.keys(a); + length = keys.length; + if (length !== Object.keys(b).length) return false; + + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; + + for (i = length; i-- !== 0;) { + var key = keys[i]; + + if (!equal(a[key], b[key])) return false; + } + + return true; + } + + // true if both NaN, false otherwise + return a!==a && b!==b; +}; + +// do NOT remove this file - it would break pre-compiled schemas +// https://github.com/ajv-validator/ajv/issues/889 +var equal = fastDeepEqual; + +var standaloneValidator = validate14$1;var _default$1 = validate14$1;const schema17$1 = {"type":"object","allOf":[{"required":["name","id","appliesTo","properties"],"properties":{"name":{"$id":"#/name","type":"string","description":"The name of the element template."},"id":{"$id":"#/id","type":"string","description":"The identifier of the element template."},"description":{"$id":"#/description","type":"string","description":"The description of the element template."},"version":{"$id":"#/version","type":"number","description":"Optional version of the template. If you add a version to a template it will be considered unique based on its ID and version. Two templates can have the same ID if their version is different."},"isDefault":{"$id":"#/isDefault","type":"boolean","description":"Indicates whether the element template is a default template."},"appliesTo":{"$id":"#/appliesTo","type":"array","description":"List of BPMN types the template can be applied to.","default":[],"items":{"$id":"#/appliesTo/items","type":"string","pattern":"^[\\w\\d]+:[\\w\\d]+$","allOf":[{"examples":["bpmn:Task","bpmn:ServiceTask","bpmn:SequenceFlow","bpmn:Process","bpmn:StartEvent","bpmn:Gateway"]}],"errorMessage":{"pattern":"invalid item for \"appliesTo\", should contain namespaced property, example: \"bpmn:Task\""}}},"elementType":{"$id":"#/elementType","type":"object","description":"The BPMN type the element will be transformed into.","default":{},"required":["value"],"properties":{"value":{"$id":"#/elementType/value","type":"string","pattern":"^[\\w\\d]+:[\\w\\d]+$","allOf":[{"examples":["bpmn:ServiceTask","bpmn:UserTask","bpmn:StartEvent","bpmn:ExclusiveGateway","bpmn:ParallelGateway"]}],"errorMessage":{"pattern":"invalid item for \"elementType\", should contain namespaced property, example: \"bpmn:Task\""}}},"errorMessage":{"required":{"value":"missing elementType value"}}},"metadata":{"$id":"#/metadata","type":"object","description":"Some custom properties for further configuration.","default":{}},"entriesVisible":{"$id":"#/entriesVisible","type":"boolean","description":"Select whether non-template entries are visible in the properties panel."},"groups":{"$id":"#/groups","type":"array","description":"Custom fields can be ordered together via groups.","allOf":[{"examples":[[{"id":"group-1","label":"My Group"}]]}],"items":{"$id":"#/groups/group","type":"object","default":{},"required":["id","label"],"properties":{"id":{"$id":"#/groups/group/id","type":"string","description":"The id of the custom group"},"label":{"$id":"#/groups/group/label","type":"string","description":"The label of the custom group"}},"errorMessage":{"required":{"id":"missing id for group \"${0#}\"","label":"missing label for group \"${0#}\""}}}},"documentationRef":{"$id":"#/documentationRef","type":"string","pattern":"^(https|http)://.*","errorMessage":{"pattern":"Malformed documentation URL, must match \"^(https|http)://.*\""}}},"errorMessage":{"required":{"name":"missing template name","id":"missing template id","appliesTo":"missing appliesTo=[]","properties":"missing properties=[]"}}}],"properties":{"properties":{"$ref":"#/definitions/properties","$id":"#/properties"},"scopes":{"$id":"#/scopes","type":"array","description":"Special scoped bindings that allow you to configure nested elements.","allOf":[{"examples":[[{"type":"bpmn:Error","id":"Error_1","properties":[{"value":"error-code","binding":{"type":"property","name":"errorCode"}},{"value":"error-message","binding":{"type":"property","name":"camunda:errorMessage"}},{"value":"error-name","binding":{"type":"property","name":"name"}}]}]]}],"items":{"$id":"#/scopes/item","type":"object","default":{},"properties":{"type":{"$id":"#scopes/item/type","type":"string","description":"The type of a scope.","enum":["camunda:Connector","bpmn:Error"],"errorMessage":"invalid scope type ${0}; must be any of { camunda:Connector, bpmn:Error }"},"properties":{"$id":"#/scopes/properties","description":"List of properties of a scope.","default":[],"allOf":[{"$ref":"#/definitions/properties/allOf/0"},{"$ref":"#/definitions/properties/allOf/1"}]}},"required":["type","properties"],"allOf":[{"if":{"properties":{"type":{"enum":["bpmn:Error"]}},"required":["type"]},"then":{"required":["id"],"errorMessage":"invalid scope ${0/type}, missing id"}}],"errorMessage":{"required":{"type":"invalid scope, missing type","properties":"invalid scope ${0/type}, missing properties=[]"}}}}}};const schema18$1 = {"allOf":[{"type":"array","description":"List of properties of the element template.","allOf":[{"examples":[[{"label":"Name","type":"String","binding":{"type":"property","name":"name"}}]]}],"items":{"type":"object","default":{},"allOf":[{"if":{"properties":{"type":{"const":"Dropdown"}},"required":["type"]},"then":{"required":["choices"],"errorMessage":"must provide choices=[] with \"Dropdown\" type"}}],"properties":{"id":{"type":"string","description":"Unique identifier of the property."},"value":{"$id":"#/properties/property/value","type":["string","boolean"],"description":"The value of a control field."},"description":{"$id":"#/properties/property/description","type":"string","description":"The description of a control field."},"label":{"$id":"#/properties/property/label","type":"string","description":"The label of a control field."},"type":{"$id":"#/properties/property/type","type":"string","description":"The type of a control field."},"editable":{"$id":"#/properties/property/editable","type":"boolean","description":"Indicates whether a control field is editable or not."},"choices":{"$id":"#/properties/property/choices","type":"array","description":"The choices for dropdown fields.","default":[],"items":{"$id":"#/properties/property/choices/item","type":"object","default":{},"properties":{"name":{"$id":"#/properties/property/choices/item/name","type":"string","description":"The name of a choice."},"value":{"$id":"#/properties/property/choices/item/value","type":"string","description":"The value of a choice."}},"required":["value","name"],"errorMessage":{"required":"{ name, value } must be specified for \"Dropdown\" choices"}}},"constraints":{"$id":"#/properties/property/constraints","type":"object","description":"The validation constraints of a control field.","allOf":[{"examples":[{"notEmpty":true}]}],"properties":{"notEmpty":{"$id":"#/properties/property/constraints/notEmpty","type":"boolean","description":"The control field must not be empty."},"minLength":{"$id":"#/properties/property/constraints/minLength","type":"number","description":"The minimal length of a control field value."},"maxLength":{"$id":"#/properties/property/constraints/maxLength","type":"number","description":"The maximal length for a control field value."},"pattern":{"$id":"#/properties/property/constraints/pattern","description":"A regular expression pattern for a constraint.","oneOf":[{"type":"object","default":{},"properties":{"value":{"$id":"#/properties/property/constraints/pattern/value","type":"string","description":"The regular expression of a pattern."},"message":{"$id":"#/properties/property/constraints/pattern/message","type":"string","description":"The validation message of a pattern."}}},{"type":"string"}]}}},"group":{"$id":"#/properties/property/group","type":"string","description":"The custom group of a control field."},"condition":{"$id":"#/condition","type":"object","description":"Condition to activate the binding.","allOf":[{"examples":[{"type":"simple","property":"httpMethod","equals":"GET"},{"type":"simple","property":"httpMethod","oneOf":["POST","PUT","DELETE"]}]}],"required":["property"],"properties":{"type":{"$id":"#/condition/type","const":"simple","description":"The type of the condition.","default":"simple"},"property":{"$id":"#/condition/property","type":"string","description":"The id of the property to check."}},"oneOf":[{"properties":{"equals":{"type":["string","number","boolean"]}},"required":["equals"]},{"properties":{"oneOf":{"type":"array","items":{"type":["string","number"]}}},"required":["oneOf"]}],"errorMessage":{"required":{"property":"missing property name for condition"}}}}}},{"$schema":"http://json-schema.org/draft-07/schema","type":"array","description":"List of properties of the element template.","items":{"type":"object","default":{},"required":["binding"],"allOf":[{"if":{"properties":{"binding":{"properties":{"type":{"const":"property"}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Text","Hidden","Dropdown","Boolean"],"errorMessage":"invalid property type ${0} for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean }"}}}},{"if":{"properties":{"binding":{"properties":{"type":{"const":"camunda:executionListener"}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["Hidden"],"errorMessage":"invalid property type ${1/type} for binding type \"camunda:executionListener\"; must be \"Hidden\""}}}},{"if":{"properties":{"binding":{"properties":{"type":{"enum":["camunda:property","camunda:outputParameter","camunda:in","camunda:in:businessKey","camunda:out","camunda:errorEventDefinition"]}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Hidden","Dropdown"],"errorMessage":"invalid property type ${0} for binding type ${1/binding/type}; must be any of { String, Hidden, Dropdown }"}}}},{"if":{"properties":{"binding":{"properties":{"type":{"enum":["camunda:inputParameter","camunda:field"]}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Text","Hidden","Dropdown"],"errorMessage":"invalid property type ${0} for binding type ${1/binding/type}; must be any of { String, Text, Hidden, Dropdown }"}}}}],"properties":{"binding":{"$id":"#/properties/property/binding","type":"object","description":"Specifying how the property is mapped to BPMN or Camunda extension elements and attributes.","required":["type"],"allOf":[{"if":{"properties":{"type":{"enum":["property","camunda:property","camunda:inputParameter","camunda:field"]}},"required":["type"]},"then":{"required":["name"],"errorMessage":"property.binding ${0/type} requires name"}},{"if":{"properties":{"type":{"const":"camunda:outputParameter"}},"required":["type"]},"then":{"required":["source"],"errorMessage":"property.binding ${0/type} requires source"}},{"if":{"properties":{"type":{"const":"camunda:in"}},"required":["type"]},"then":{"anyOf":[{"required":["variables"]},{"required":["target"]}],"errorMessage":"property.binding ${0/type} requires variables, target, or both"}},{"if":{"properties":{"type":{"const":"camunda:out"}},"required":["type"]},"then":{"oneOf":[{"required":["variables"],"not":{"anyOf":[{"required":["source"]},{"required":["sourceExpression"]}]}},{"required":["source"],"not":{"anyOf":[{"required":["variables"]},{"required":["sourceExpression"]}]}},{"required":["sourceExpression"],"not":{"anyOf":[{"required":["variables"]},{"required":["source"]}]}},{"required":["variables","sourceExpression"],"not":{"required":["source"]}},{"required":["variables","source"],"not":{"required":["sourceExpression"]}}],"errorMessage":"property.binding ${0/type} requires one of the following: variables, sourceExpression, source, (sourceExpression and variables), or (source and variables)"}},{"if":{"properties":{"type":{"const":"camunda:errorEventDefinition"}},"required":["type"]},"then":{"oneOf":[{"required":["errorRef"]}],"errorMessage":"property.binding ${0/type} requires errorRef"}},{"examples":[{"type":"property","name":"name"},{"type":"camunda:property","name":"property"},{"type":"camunda:inputParameter","name":"input"},{"type":"camunda:outputParameter","source":"output"},{"type":"camunda:in","target":"target"},{"type":"camunda:in:businessKey"},{"type":"camunda:out","source":"output"},{"type":"camunda:executionListener","event":"start"},{"type":"camunda:field","name":"field"},{"type":"camunda:errorEventDefinition","errorRef":"error"},{"type":"camunda:errorEventDefinition","errorRef":"error"}]}],"properties":{"type":{"$id":"#/properties/property/binding/type","type":"string","enum":["property","camunda:property","camunda:inputParameter","camunda:outputParameter","camunda:in","camunda:out","camunda:in:businessKey","camunda:executionListener","camunda:field","camunda:errorEventDefinition"],"description":"The type of a property binding.","errorMessage":"invalid property.binding type ${0}; must be any of { property, camunda:property, camunda:inputParameter, camunda:outputParameter, camunda:in, camunda:out, camunda:in:businessKey, camunda:executionListener, camunda:field, camunda:errorEventDefinition }"},"name":{"$id":"#/properties/property/binding/name","type":"string","description":"The name of a property binding."},"event":{"$id":"#/properties/property/binding/event","type":"string","description":"The event type of a property binding (camunda:executionListener)."},"scriptFormat":{"$id":"#/properties/property/binding/scriptFormat","type":"string","description":"The script format of a property binding (camunda:outputParameter, camunda:inputParameter)."},"source":{"$id":"#/properties/property/binding/source","type":"string","description":"The source value of a property binding (camunda:outputParameter, camunda:out)."},"target":{"$id":"#/properties/property/binding/target","type":"string","description":"The target value of a property binding (camunda:in)."},"expression":{"$id":"#/properties/property/binding/expression","type":"boolean","description":"Indicates whether the control field value is an expression (camunda:in, camunda:field)."},"variables":{"$id":"#/properties/property/binding/variables","type":"string","enum":["all","local"],"description":"The variable mapping of a property binding (camunda:in)."},"sourceExpression":{"$id":"#/properties/property/binding/sourceExpression","type":"string","description":"The string containing the expression for the source attribute (camunda:out)."}}}},"errorMessage":{"required":"missing binding for property \"${0#}\""}}}]};const schema19 = {"type":"array","description":"List of properties of the element template.","allOf":[{"examples":[[{"label":"Name","type":"String","binding":{"type":"property","name":"name"}}]]}],"items":{"type":"object","default":{},"allOf":[{"if":{"properties":{"type":{"const":"Dropdown"}},"required":["type"]},"then":{"required":["choices"],"errorMessage":"must provide choices=[] with \"Dropdown\" type"}}],"properties":{"id":{"type":"string","description":"Unique identifier of the property."},"value":{"$id":"#/properties/property/value","type":["string","boolean"],"description":"The value of a control field."},"description":{"$id":"#/properties/property/description","type":"string","description":"The description of a control field."},"label":{"$id":"#/properties/property/label","type":"string","description":"The label of a control field."},"type":{"$id":"#/properties/property/type","type":"string","description":"The type of a control field."},"editable":{"$id":"#/properties/property/editable","type":"boolean","description":"Indicates whether a control field is editable or not."},"choices":{"$id":"#/properties/property/choices","type":"array","description":"The choices for dropdown fields.","default":[],"items":{"$id":"#/properties/property/choices/item","type":"object","default":{},"properties":{"name":{"$id":"#/properties/property/choices/item/name","type":"string","description":"The name of a choice."},"value":{"$id":"#/properties/property/choices/item/value","type":"string","description":"The value of a choice."}},"required":["value","name"],"errorMessage":{"required":"{ name, value } must be specified for \"Dropdown\" choices"}}},"constraints":{"$id":"#/properties/property/constraints","type":"object","description":"The validation constraints of a control field.","allOf":[{"examples":[{"notEmpty":true}]}],"properties":{"notEmpty":{"$id":"#/properties/property/constraints/notEmpty","type":"boolean","description":"The control field must not be empty."},"minLength":{"$id":"#/properties/property/constraints/minLength","type":"number","description":"The minimal length of a control field value."},"maxLength":{"$id":"#/properties/property/constraints/maxLength","type":"number","description":"The maximal length for a control field value."},"pattern":{"$id":"#/properties/property/constraints/pattern","description":"A regular expression pattern for a constraint.","oneOf":[{"type":"object","default":{},"properties":{"value":{"$id":"#/properties/property/constraints/pattern/value","type":"string","description":"The regular expression of a pattern."},"message":{"$id":"#/properties/property/constraints/pattern/message","type":"string","description":"The validation message of a pattern."}}},{"type":"string"}]}}},"group":{"$id":"#/properties/property/group","type":"string","description":"The custom group of a control field."},"condition":{"$id":"#/condition","type":"object","description":"Condition to activate the binding.","allOf":[{"examples":[{"type":"simple","property":"httpMethod","equals":"GET"},{"type":"simple","property":"httpMethod","oneOf":["POST","PUT","DELETE"]}]}],"required":["property"],"properties":{"type":{"$id":"#/condition/type","const":"simple","description":"The type of the condition.","default":"simple"},"property":{"$id":"#/condition/property","type":"string","description":"The id of the property to check."}},"oneOf":[{"properties":{"equals":{"type":["string","number","boolean"]}},"required":["equals"]},{"properties":{"oneOf":{"type":"array","items":{"type":["string","number"]}}},"required":["oneOf"]}],"errorMessage":{"required":{"property":"missing property name for condition"}}}}}};const schema20 = {"$schema":"http://json-schema.org/draft-07/schema","type":"array","description":"List of properties of the element template.","items":{"type":"object","default":{},"required":["binding"],"allOf":[{"if":{"properties":{"binding":{"properties":{"type":{"const":"property"}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Text","Hidden","Dropdown","Boolean"],"errorMessage":"invalid property type ${0} for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean }"}}}},{"if":{"properties":{"binding":{"properties":{"type":{"const":"camunda:executionListener"}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["Hidden"],"errorMessage":"invalid property type ${1/type} for binding type \"camunda:executionListener\"; must be \"Hidden\""}}}},{"if":{"properties":{"binding":{"properties":{"type":{"enum":["camunda:property","camunda:outputParameter","camunda:in","camunda:in:businessKey","camunda:out","camunda:errorEventDefinition"]}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Hidden","Dropdown"],"errorMessage":"invalid property type ${0} for binding type ${1/binding/type}; must be any of { String, Hidden, Dropdown }"}}}},{"if":{"properties":{"binding":{"properties":{"type":{"enum":["camunda:inputParameter","camunda:field"]}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Text","Hidden","Dropdown"],"errorMessage":"invalid property type ${0} for binding type ${1/binding/type}; must be any of { String, Text, Hidden, Dropdown }"}}}}],"properties":{"binding":{"$id":"#/properties/property/binding","type":"object","description":"Specifying how the property is mapped to BPMN or Camunda extension elements and attributes.","required":["type"],"allOf":[{"if":{"properties":{"type":{"enum":["property","camunda:property","camunda:inputParameter","camunda:field"]}},"required":["type"]},"then":{"required":["name"],"errorMessage":"property.binding ${0/type} requires name"}},{"if":{"properties":{"type":{"const":"camunda:outputParameter"}},"required":["type"]},"then":{"required":["source"],"errorMessage":"property.binding ${0/type} requires source"}},{"if":{"properties":{"type":{"const":"camunda:in"}},"required":["type"]},"then":{"anyOf":[{"required":["variables"]},{"required":["target"]}],"errorMessage":"property.binding ${0/type} requires variables, target, or both"}},{"if":{"properties":{"type":{"const":"camunda:out"}},"required":["type"]},"then":{"oneOf":[{"required":["variables"],"not":{"anyOf":[{"required":["source"]},{"required":["sourceExpression"]}]}},{"required":["source"],"not":{"anyOf":[{"required":["variables"]},{"required":["sourceExpression"]}]}},{"required":["sourceExpression"],"not":{"anyOf":[{"required":["variables"]},{"required":["source"]}]}},{"required":["variables","sourceExpression"],"not":{"required":["source"]}},{"required":["variables","source"],"not":{"required":["sourceExpression"]}}],"errorMessage":"property.binding ${0/type} requires one of the following: variables, sourceExpression, source, (sourceExpression and variables), or (source and variables)"}},{"if":{"properties":{"type":{"const":"camunda:errorEventDefinition"}},"required":["type"]},"then":{"oneOf":[{"required":["errorRef"]}],"errorMessage":"property.binding ${0/type} requires errorRef"}},{"examples":[{"type":"property","name":"name"},{"type":"camunda:property","name":"property"},{"type":"camunda:inputParameter","name":"input"},{"type":"camunda:outputParameter","source":"output"},{"type":"camunda:in","target":"target"},{"type":"camunda:in:businessKey"},{"type":"camunda:out","source":"output"},{"type":"camunda:executionListener","event":"start"},{"type":"camunda:field","name":"field"},{"type":"camunda:errorEventDefinition","errorRef":"error"},{"type":"camunda:errorEventDefinition","errorRef":"error"}]}],"properties":{"type":{"$id":"#/properties/property/binding/type","type":"string","enum":["property","camunda:property","camunda:inputParameter","camunda:outputParameter","camunda:in","camunda:out","camunda:in:businessKey","camunda:executionListener","camunda:field","camunda:errorEventDefinition"],"description":"The type of a property binding.","errorMessage":"invalid property.binding type ${0}; must be any of { property, camunda:property, camunda:inputParameter, camunda:outputParameter, camunda:in, camunda:out, camunda:in:businessKey, camunda:executionListener, camunda:field, camunda:errorEventDefinition }"},"name":{"$id":"#/properties/property/binding/name","type":"string","description":"The name of a property binding."},"event":{"$id":"#/properties/property/binding/event","type":"string","description":"The event type of a property binding (camunda:executionListener)."},"scriptFormat":{"$id":"#/properties/property/binding/scriptFormat","type":"string","description":"The script format of a property binding (camunda:outputParameter, camunda:inputParameter)."},"source":{"$id":"#/properties/property/binding/source","type":"string","description":"The source value of a property binding (camunda:outputParameter, camunda:out)."},"target":{"$id":"#/properties/property/binding/target","type":"string","description":"The target value of a property binding (camunda:in)."},"expression":{"$id":"#/properties/property/binding/expression","type":"boolean","description":"Indicates whether the control field value is an expression (camunda:in, camunda:field)."},"variables":{"$id":"#/properties/property/binding/variables","type":"string","enum":["all","local"],"description":"The variable mapping of a property binding (camunda:in)."},"sourceExpression":{"$id":"#/properties/property/binding/sourceExpression","type":"string","description":"The string containing the expression for the source attribute (camunda:out)."}}}},"errorMessage":{"required":"missing binding for property \"${0#}\""}}};const pattern0$1 = new RegExp("^[\\w\\d]+:[\\w\\d]+$", "u");const pattern2$1 = new RegExp("^(https|http)://.*", "u");const obj0$1 = {"required":"missingProperty","dependencies":"property","dependentRequired":"property"};function validate15$1(data, {dataPath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.name === undefined){const err0 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "name"},message:"should have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.id === undefined){const err1 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "id"},message:"should have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.appliesTo === undefined){const err2 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "appliesTo"},message:"should have required property '"+"appliesTo"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.properties === undefined){const err3 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "properties"},message:"should have required property '"+"properties"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.name !== undefined){if(typeof data.name !== "string"){const err4 = {keyword:"type",dataPath:dataPath+"/name",schemaPath:"#/allOf/0/properties/name/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.id !== undefined){if(typeof data.id !== "string"){const err5 = {keyword:"type",dataPath:dataPath+"/id",schemaPath:"#/allOf/0/properties/id/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.description !== undefined){if(typeof data.description !== "string"){const err6 = {keyword:"type",dataPath:dataPath+"/description",schemaPath:"#/allOf/0/properties/description/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.version !== undefined){if(!(typeof data.version == "number")){const err7 = {keyword:"type",dataPath:dataPath+"/version",schemaPath:"#/allOf/0/properties/version/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.isDefault !== undefined){if(typeof data.isDefault !== "boolean"){const err8 = {keyword:"type",dataPath:dataPath+"/isDefault",schemaPath:"#/allOf/0/properties/isDefault/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.appliesTo !== undefined){let data5 = data.appliesTo;if(Array.isArray(data5)){const len0 = data5.length;for(let i0=0; i0 0){const emErrors0 = {"pattern":[]};const templates0 = {};for(const err11 of vErrors){if((((((err11.keyword !== "errorMessage") && (!err11.emUsed)) && (err11.dataPath === dataPath+"/appliesTo/" + i0)) && (err11.keyword in emErrors0)) && (err11.schemaPath.indexOf("#/allOf/0/properties/appliesTo/items") === 0)) && (/^\/[^\/]*$/.test(err11.schemaPath.slice(36)))){emErrors0[err11.keyword].push(err11);err11.emUsed = true;}}for(const key0 in emErrors0){if(emErrors0[key0].length){const err12 = {keyword:"errorMessage",dataPath:dataPath+"/appliesTo/" + i0,schemaPath:"#/allOf/0/properties/appliesTo/items/errorMessage",params:{errors: emErrors0[key0]},message:key0 in templates0 ? templates0[key0]() : schema17$1.allOf[0].properties.appliesTo.items.errorMessage[key0]};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}const emErrs0 = [];for(const err13 of vErrors){if(!err13.emUsed){emErrs0.push(err13);}}vErrors = emErrs0;errors = emErrs0.length;}}}else {const err14 = {keyword:"type",dataPath:dataPath+"/appliesTo",schemaPath:"#/allOf/0/properties/appliesTo/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.elementType !== undefined){let data7 = data.elementType;if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.value === undefined){const err15 = {keyword:"required",dataPath:dataPath+"/elementType",schemaPath:"#/allOf/0/properties/elementType/required",params:{missingProperty: "value"},message:"should have required property '"+"value"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data7.value !== undefined){let data8 = data7.value;if(typeof data8 === "string"){if(!pattern0$1.test(data8)){const err16 = {keyword:"pattern",dataPath:dataPath+"/elementType/value",schemaPath:"#/allOf/0/properties/elementType/properties/value/pattern",params:{pattern: "^[\\w\\d]+:[\\w\\d]+$"},message:"should match pattern \""+"^[\\w\\d]+:[\\w\\d]+$"+"\""};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}else {const err17 = {keyword:"type",dataPath:dataPath+"/elementType/value",schemaPath:"#/allOf/0/properties/elementType/properties/value/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(errors > 0){const emErrors1 = {"pattern":[]};const templates1 = {};for(const err18 of vErrors){if((((((err18.keyword !== "errorMessage") && (!err18.emUsed)) && (err18.dataPath === dataPath+"/elementType/value")) && (err18.keyword in emErrors1)) && (err18.schemaPath.indexOf("#/allOf/0/properties/elementType/properties/value") === 0)) && (/^\/[^\/]*$/.test(err18.schemaPath.slice(49)))){emErrors1[err18.keyword].push(err18);err18.emUsed = true;}}for(const key1 in emErrors1){if(emErrors1[key1].length){const err19 = {keyword:"errorMessage",dataPath:dataPath+"/elementType/value",schemaPath:"#/allOf/0/properties/elementType/properties/value/errorMessage",params:{errors: emErrors1[key1]},message:key1 in templates1 ? templates1[key1]() : schema17$1.allOf[0].properties.elementType.properties.value.errorMessage[key1]};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}const emErrs1 = [];for(const err20 of vErrors){if(!err20.emUsed){emErrs1.push(err20);}}vErrors = emErrs1;errors = emErrs1.length;}}}else {const err21 = {keyword:"type",dataPath:dataPath+"/elementType",schemaPath:"#/allOf/0/properties/elementType/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(errors > 0){const emErrors2 = {"required":{"value":[]}};const templates2 = {required:{}};let emPropParams0;let emParamsErrors0;for(const err22 of vErrors){if((((((err22.keyword !== "errorMessage") && (!err22.emUsed)) && (err22.dataPath === dataPath+"/elementType")) && (err22.keyword in emErrors2)) && (err22.schemaPath.indexOf("#/allOf/0/properties/elementType") === 0)) && (/^\/[^\/]*$/.test(err22.schemaPath.slice(32)))){emPropParams0 = obj0$1[err22.keyword];emParamsErrors0 = emErrors2[err22.keyword][err22.params[emPropParams0]];if(emParamsErrors0){emParamsErrors0.push(err22);err22.emUsed = true;}}}for(const key2 in emErrors2){for(const keyProp0 in emErrors2[key2]){emParamsErrors0 = emErrors2[key2][keyProp0];if(emParamsErrors0.length){const tmpl0 = templates2[key2] && templates2[key2][keyProp0];const err23 = {keyword:"errorMessage",dataPath:dataPath+"/elementType",schemaPath:"#/allOf/0/properties/elementType/errorMessage",params:{errors: emParamsErrors0},message:tmpl0 ? tmpl0() : schema17$1.allOf[0].properties.elementType.errorMessage[key2][keyProp0]};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}const emErrs2 = [];for(const err24 of vErrors){if(!err24.emUsed){emErrs2.push(err24);}}vErrors = emErrs2;errors = emErrs2.length;}}if(data.metadata !== undefined){let data9 = data.metadata;if(!(data9 && typeof data9 == "object" && !Array.isArray(data9))){const err25 = {keyword:"type",dataPath:dataPath+"/metadata",schemaPath:"#/allOf/0/properties/metadata/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.entriesVisible !== undefined){if(typeof data.entriesVisible !== "boolean"){const err26 = {keyword:"type",dataPath:dataPath+"/entriesVisible",schemaPath:"#/allOf/0/properties/entriesVisible/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.groups !== undefined){let data11 = data.groups;if(Array.isArray(data11)){const len1 = data11.length;for(let i1=0; i1 0){const emErrors3 = {"required":{"id":[],"label":[]}};const templates3 = {required:{id:function(){return "missing id for group \"" + JSON.stringify(i1) + "\""},label:function(){return "missing label for group \"" + JSON.stringify(i1) + "\""}}};let emPropParams1;let emParamsErrors1;for(const err32 of vErrors){if((((((err32.keyword !== "errorMessage") && (!err32.emUsed)) && (err32.dataPath === dataPath+"/groups/" + i1)) && (err32.keyword in emErrors3)) && (err32.schemaPath.indexOf("#/allOf/0/properties/groups/items") === 0)) && (/^\/[^\/]*$/.test(err32.schemaPath.slice(33)))){emPropParams1 = obj0$1[err32.keyword];emParamsErrors1 = emErrors3[err32.keyword][err32.params[emPropParams1]];if(emParamsErrors1){emParamsErrors1.push(err32);err32.emUsed = true;}}}for(const key3 in emErrors3){for(const keyProp1 in emErrors3[key3]){emParamsErrors1 = emErrors3[key3][keyProp1];if(emParamsErrors1.length){const tmpl1 = templates3[key3] && templates3[key3][keyProp1];const err33 = {keyword:"errorMessage",dataPath:dataPath+"/groups/" + i1,schemaPath:"#/allOf/0/properties/groups/items/errorMessage",params:{errors: emParamsErrors1},message:tmpl1 ? tmpl1() : schema17$1.allOf[0].properties.groups.items.errorMessage[key3][keyProp1]};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}const emErrs3 = [];for(const err34 of vErrors){if(!err34.emUsed){emErrs3.push(err34);}}vErrors = emErrs3;errors = emErrs3.length;}}}else {const err35 = {keyword:"type",dataPath:dataPath+"/groups",schemaPath:"#/allOf/0/properties/groups/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data.documentationRef !== undefined){let data15 = data.documentationRef;if(typeof data15 === "string"){if(!pattern2$1.test(data15)){const err36 = {keyword:"pattern",dataPath:dataPath+"/documentationRef",schemaPath:"#/allOf/0/properties/documentationRef/pattern",params:{pattern: "^(https|http)://.*"},message:"should match pattern \""+"^(https|http)://.*"+"\""};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}else {const err37 = {keyword:"type",dataPath:dataPath+"/documentationRef",schemaPath:"#/allOf/0/properties/documentationRef/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(errors > 0){const emErrors4 = {"pattern":[]};const templates4 = {};for(const err38 of vErrors){if((((((err38.keyword !== "errorMessage") && (!err38.emUsed)) && (err38.dataPath === dataPath+"/documentationRef")) && (err38.keyword in emErrors4)) && (err38.schemaPath.indexOf("#/allOf/0/properties/documentationRef") === 0)) && (/^\/[^\/]*$/.test(err38.schemaPath.slice(37)))){emErrors4[err38.keyword].push(err38);err38.emUsed = true;}}for(const key4 in emErrors4){if(emErrors4[key4].length){const err39 = {keyword:"errorMessage",dataPath:dataPath+"/documentationRef",schemaPath:"#/allOf/0/properties/documentationRef/errorMessage",params:{errors: emErrors4[key4]},message:key4 in templates4 ? templates4[key4]() : schema17$1.allOf[0].properties.documentationRef.errorMessage[key4]};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}const emErrs4 = [];for(const err40 of vErrors){if(!err40.emUsed){emErrs4.push(err40);}}vErrors = emErrs4;errors = emErrs4.length;}}}if(errors > 0){const emErrors5 = {"required":{"name":[],"id":[],"appliesTo":[],"properties":[]}};const templates5 = {required:{}};let emPropParams2;let emParamsErrors2;for(const err41 of vErrors){if((((((err41.keyword !== "errorMessage") && (!err41.emUsed)) && (err41.dataPath === dataPath)) && (err41.keyword in emErrors5)) && (err41.schemaPath.indexOf("#/allOf/0") === 0)) && (/^\/[^\/]*$/.test(err41.schemaPath.slice(9)))){emPropParams2 = obj0$1[err41.keyword];emParamsErrors2 = emErrors5[err41.keyword][err41.params[emPropParams2]];if(emParamsErrors2){emParamsErrors2.push(err41);err41.emUsed = true;}}}for(const key5 in emErrors5){for(const keyProp2 in emErrors5[key5]){emParamsErrors2 = emErrors5[key5][keyProp2];if(emParamsErrors2.length){const tmpl2 = templates5[key5] && templates5[key5][keyProp2];const err42 = {keyword:"errorMessage",dataPath,schemaPath:"#/allOf/0/errorMessage",params:{errors: emParamsErrors2},message:tmpl2 ? tmpl2() : schema17$1.allOf[0].errorMessage[key5][keyProp2]};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}const emErrs5 = [];for(const err43 of vErrors){if(!err43.emUsed){emErrs5.push(err43);}}vErrors = emErrs5;errors = emErrs5.length;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.properties !== undefined){let data16 = data.properties;if(Array.isArray(data16)){const len2 = data16.length;for(let i2=0; i2 0){const emErrs6 = [];for(const err47 of vErrors){if(((((err47.keyword !== "errorMessage") && (!err47.emUsed)) && ((err47.dataPath === dataPath+"/properties/" + i2) || ((err47.dataPath.indexOf(dataPath+"/properties/" + i2) === 0) && (err47.dataPath[dataPath+"/properties/" + i2.length] === "/")))) && (err47.schemaPath.indexOf("#/definitions/properties/allOf/0/items/allOf/0/then") === 0)) && (err47.schemaPath["#/definitions/properties/allOf/0/items/allOf/0/then".length] === "/")){emErrs6.push(err47);err47.emUsed = true;}}if(emErrs6.length){const err48 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i2,schemaPath:"#/definitions/properties/allOf/0/items/allOf/0/then/errorMessage",params:{errors: emErrs6},message:"must provide choices=[] with \"Dropdown\" type"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}const emErrs7 = [];for(const err49 of vErrors){if(!err49.emUsed){emErrs7.push(err49);}}vErrors = emErrs7;errors = emErrs7.length;}var _valid0 = _errs44 === errors;valid18 = _valid0;}if(!valid18){const err50 = {keyword:"if",dataPath:dataPath+"/properties/" + i2,schemaPath:"#/definitions/properties/allOf/0/items/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(data17.id !== undefined){if(typeof data17.id !== "string"){const err51 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/id",schemaPath:"#/definitions/properties/allOf/0/items/properties/id/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data17.value !== undefined){let data20 = data17.value;if((typeof data20 !== "string") && (typeof data20 !== "boolean")){const err52 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/value",schemaPath:"#/definitions/properties/allOf/0/items/properties/value/type",params:{type: schema18$1.allOf[0].items.properties.value.type},message:"should be string,boolean"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data17.description !== undefined){if(typeof data17.description !== "string"){const err53 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/description",schemaPath:"#/definitions/properties/allOf/0/items/properties/description/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data17.label !== undefined){if(typeof data17.label !== "string"){const err54 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/label",schemaPath:"#/definitions/properties/allOf/0/items/properties/label/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data17.type !== undefined){if(typeof data17.type !== "string"){const err55 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/type",schemaPath:"#/definitions/properties/allOf/0/items/properties/type/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data17.editable !== undefined){if(typeof data17.editable !== "boolean"){const err56 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/editable",schemaPath:"#/definitions/properties/allOf/0/items/properties/editable/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data17.choices !== undefined){let data25 = data17.choices;if(Array.isArray(data25)){const len3 = data25.length;for(let i3=0; i3 0){const emErrors6 = {"required":[]};const templates6 = {};for(const err62 of vErrors){if((((((err62.keyword !== "errorMessage") && (!err62.emUsed)) && (err62.dataPath === dataPath+"/properties/" + i2+"/choices/" + i3)) && (err62.keyword in emErrors6)) && (err62.schemaPath.indexOf("#/definitions/properties/allOf/0/items/properties/choices/items") === 0)) && (/^\/[^\/]*$/.test(err62.schemaPath.slice(63)))){emErrors6[err62.keyword].push(err62);err62.emUsed = true;}}for(const key6 in emErrors6){if(emErrors6[key6].length){const err63 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i2+"/choices/" + i3,schemaPath:"#/definitions/properties/allOf/0/items/properties/choices/items/errorMessage",params:{errors: emErrors6[key6]},message:key6 in templates6 ? templates6[key6]() : schema18$1.allOf[0].items.properties.choices.items.errorMessage[key6]};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}const emErrs8 = [];for(const err64 of vErrors){if(!err64.emUsed){emErrs8.push(err64);}}vErrors = emErrs8;errors = emErrs8.length;}}}else {const err65 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/choices",schemaPath:"#/definitions/properties/allOf/0/items/properties/choices/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data17.constraints !== undefined){let data29 = data17.constraints;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(data29.notEmpty !== undefined){if(typeof data29.notEmpty !== "boolean"){const err66 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/notEmpty",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/notEmpty/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}if(data29.minLength !== undefined){if(!(typeof data29.minLength == "number")){const err67 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/minLength",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/minLength/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data29.maxLength !== undefined){if(!(typeof data29.maxLength == "number")){const err68 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/maxLength",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/maxLength/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data29.pattern !== undefined){let data33 = data29.pattern;const _errs74 = errors;let valid26 = false;let passing0 = null;const _errs75 = errors;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.value !== undefined){if(typeof data33.value !== "string"){const err69 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern/value",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/properties/value/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}if(data33.message !== undefined){if(typeof data33.message !== "string"){const err70 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern/message",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/properties/message/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}var _valid1 = _errs75 === errors;if(_valid1){valid26 = true;passing0 = 0;}const _errs81 = errors;if(typeof data33 !== "string"){const err72 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/1/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}var _valid1 = _errs81 === errors;if(_valid1 && valid26){valid26 = false;passing0 = [passing0, 1];}else {if(_valid1){valid26 = true;passing0 = 1;}}if(!valid26){const err73 = {keyword:"oneOf",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf",params:{passingSchemas: passing0},message:"should match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}else {errors = _errs74;if(vErrors !== null){if(_errs74){vErrors.length = _errs74;}else {vErrors = null;}}}}}else {const err74 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data17.group !== undefined){if(typeof data17.group !== "string"){const err75 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/group",schemaPath:"#/definitions/properties/allOf/0/items/properties/group/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data17.condition !== undefined){let data37 = data17.condition;const _errs87 = errors;let valid28 = false;let passing1 = null;const _errs88 = errors;if(data37 && typeof data37 == "object" && !Array.isArray(data37)){if(data37.equals === undefined){const err76 = {keyword:"required",dataPath:dataPath+"/properties/" + i2+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/0/required",params:{missingProperty: "equals"},message:"should have required property '"+"equals"+"'"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(data37.equals !== undefined){let data38 = data37.equals;if(((typeof data38 !== "string") && (!(typeof data38 == "number"))) && (typeof data38 !== "boolean")){const err77 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/condition/equals",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/0/properties/equals/type",params:{type: schema18$1.allOf[0].items.properties.condition.oneOf[0].properties.equals.type},message:"should be string,number,boolean"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}var _valid2 = _errs88 === errors;if(_valid2){valid28 = true;passing1 = 0;}const _errs91 = errors;if(data37 && typeof data37 == "object" && !Array.isArray(data37)){if(data37.oneOf === undefined){const err78 = {keyword:"required",dataPath:dataPath+"/properties/" + i2+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/1/required",params:{missingProperty: "oneOf"},message:"should have required property '"+"oneOf"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data37.oneOf !== undefined){let data39 = data37.oneOf;if(Array.isArray(data39)){const len4 = data39.length;for(let i4=0; i4 0){const emErrors7 = {"required":{"property":[]}};const templates7 = {required:{}};let emPropParams3;let emParamsErrors3;for(const err86 of vErrors){if((((((err86.keyword !== "errorMessage") && (!err86.emUsed)) && (err86.dataPath === dataPath+"/properties/" + i2+"/condition")) && (err86.keyword in emErrors7)) && (err86.schemaPath.indexOf("#/definitions/properties/allOf/0/items/properties/condition") === 0)) && (/^\/[^\/]*$/.test(err86.schemaPath.slice(59)))){emPropParams3 = obj0$1[err86.keyword];emParamsErrors3 = emErrors7[err86.keyword][err86.params[emPropParams3]];if(emParamsErrors3){emParamsErrors3.push(err86);err86.emUsed = true;}}}for(const key7 in emErrors7){for(const keyProp3 in emErrors7[key7]){emParamsErrors3 = emErrors7[key7][keyProp3];if(emParamsErrors3.length){const tmpl3 = templates7[key7] && templates7[key7][keyProp3];const err87 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i2+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/errorMessage",params:{errors: emParamsErrors3},message:tmpl3 ? tmpl3() : schema18$1.allOf[0].items.properties.condition.errorMessage[key7][keyProp3]};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}const emErrs9 = [];for(const err88 of vErrors){if(!err88.emUsed){emErrs9.push(err88);}}vErrors = emErrs9;errors = emErrs9.length;}}}else {const err89 = {keyword:"type",dataPath:dataPath+"/properties/" + i2,schemaPath:"#/definitions/properties/allOf/0/items/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}}else {const err90 = {keyword:"type",dataPath:dataPath+"/properties",schemaPath:"#/definitions/properties/allOf/0/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(Array.isArray(data16)){const len5 = data16.length;for(let i5=0; i5 0){const emErrs10 = [];for(const err95 of vErrors){if(((((err95.keyword !== "errorMessage") && (!err95.emUsed)) && ((err95.dataPath === dataPath+"/properties/" + i5+"/type") || ((err95.dataPath.indexOf(dataPath+"/properties/" + i5+"/type") === 0) && (err95.dataPath[dataPath+"/properties/" + i5+"/type".length] === "/")))) && (err95.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/0/then/properties/type") === 0)) && (err95.schemaPath["#/definitions/properties/allOf/1/items/allOf/0/then/properties/type".length] === "/")){emErrs10.push(err95);err95.emUsed = true;}}if(emErrs10.length){const err96 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/0/then/properties/type/errorMessage",params:{errors: emErrs10},message:"invalid property type " + JSON.stringify(data46) + " for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean }"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}const emErrs11 = [];for(const err97 of vErrors){if(!err97.emUsed){emErrs11.push(err97);}}vErrors = emErrs11;errors = emErrs11.length;}}}var _valid3 = _errs108 === errors;valid38 = _valid3;}if(!valid38){const err98 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}const _errs111 = errors;let valid42 = true;const _errs112 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if((data43.binding === undefined) && ("binding")){const err99 = {};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}else {if(data43.binding !== undefined){let data47 = data43.binding;if(data47 && typeof data47 == "object" && !Array.isArray(data47)){if((data47.type === undefined) && ("type")){const err100 = {};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}else {if(data47.type !== undefined){if(!equal(data47.type, "camunda:executionListener")){const err101 = {};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}}}}}}var _valid4 = _errs112 === errors;errors = _errs111;if(vErrors !== null){if(_errs111){vErrors.length = _errs111;}else {vErrors = null;}}if(_valid4){const _errs115 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.type !== undefined){if(!(data43.type === "Hidden")){const err102 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/then/properties/type/enum",params:{allowedValues: schema18$1.allOf[1].items.allOf[1].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if(errors > 0){const emErrs12 = [];for(const err103 of vErrors){if(((((err103.keyword !== "errorMessage") && (!err103.emUsed)) && ((err103.dataPath === dataPath+"/properties/" + i5+"/type") || ((err103.dataPath.indexOf(dataPath+"/properties/" + i5+"/type") === 0) && (err103.dataPath[dataPath+"/properties/" + i5+"/type".length] === "/")))) && (err103.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/1/then/properties/type") === 0)) && (err103.schemaPath["#/definitions/properties/allOf/1/items/allOf/1/then/properties/type".length] === "/")){emErrs12.push(err103);err103.emUsed = true;}}if(emErrs12.length){const err104 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/then/properties/type/errorMessage",params:{errors: emErrs12},message:"invalid property type " + JSON.stringify(data43 && data43.type) + " for binding type \"camunda:executionListener\"; must be \"Hidden\""};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}const emErrs13 = [];for(const err105 of vErrors){if(!err105.emUsed){emErrs13.push(err105);}}vErrors = emErrs13;errors = emErrs13.length;}}}var _valid4 = _errs115 === errors;valid42 = _valid4;}if(!valid42){const err106 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}const _errs118 = errors;let valid46 = true;const _errs119 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if((data43.binding === undefined) && ("binding")){const err107 = {};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}else {if(data43.binding !== undefined){let data50 = data43.binding;if(data50 && typeof data50 == "object" && !Array.isArray(data50)){if((data50.type === undefined) && ("type")){const err108 = {};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}else {if(data50.type !== undefined){let data51 = data50.type;if(!((((((data51 === "camunda:property") || (data51 === "camunda:outputParameter")) || (data51 === "camunda:in")) || (data51 === "camunda:in:businessKey")) || (data51 === "camunda:out")) || (data51 === "camunda:errorEventDefinition"))){const err109 = {};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}}}}}}}var _valid5 = _errs119 === errors;errors = _errs118;if(vErrors !== null){if(_errs118){vErrors.length = _errs118;}else {vErrors = null;}}if(_valid5){const _errs122 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.type !== undefined){let data52 = data43.type;if(!(((data52 === "String") || (data52 === "Hidden")) || (data52 === "Dropdown"))){const err110 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/then/properties/type/enum",params:{allowedValues: schema18$1.allOf[1].items.allOf[2].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if(errors > 0){const emErrs14 = [];for(const err111 of vErrors){if(((((err111.keyword !== "errorMessage") && (!err111.emUsed)) && ((err111.dataPath === dataPath+"/properties/" + i5+"/type") || ((err111.dataPath.indexOf(dataPath+"/properties/" + i5+"/type") === 0) && (err111.dataPath[dataPath+"/properties/" + i5+"/type".length] === "/")))) && (err111.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/2/then/properties/type") === 0)) && (err111.schemaPath["#/definitions/properties/allOf/1/items/allOf/2/then/properties/type".length] === "/")){emErrs14.push(err111);err111.emUsed = true;}}if(emErrs14.length){const err112 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/then/properties/type/errorMessage",params:{errors: emErrs14},message:"invalid property type " + JSON.stringify(data52) + " for binding type " + JSON.stringify(data43 && data43.binding && data43.binding.type) + "; must be any of { String, Hidden, Dropdown }"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}const emErrs15 = [];for(const err113 of vErrors){if(!err113.emUsed){emErrs15.push(err113);}}vErrors = emErrs15;errors = emErrs15.length;}}}var _valid5 = _errs122 === errors;valid46 = _valid5;}if(!valid46){const err114 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}const _errs125 = errors;let valid50 = true;const _errs126 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if((data43.binding === undefined) && ("binding")){const err115 = {};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}else {if(data43.binding !== undefined){let data53 = data43.binding;if(data53 && typeof data53 == "object" && !Array.isArray(data53)){if((data53.type === undefined) && ("type")){const err116 = {};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}else {if(data53.type !== undefined){let data54 = data53.type;if(!((data54 === "camunda:inputParameter") || (data54 === "camunda:field"))){const err117 = {};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}}}}}}}var _valid6 = _errs126 === errors;errors = _errs125;if(vErrors !== null){if(_errs125){vErrors.length = _errs125;}else {vErrors = null;}}if(_valid6){const _errs129 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.type !== undefined){let data55 = data43.type;if(!((((data55 === "String") || (data55 === "Text")) || (data55 === "Hidden")) || (data55 === "Dropdown"))){const err118 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/then/properties/type/enum",params:{allowedValues: schema18$1.allOf[1].items.allOf[3].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(errors > 0){const emErrs16 = [];for(const err119 of vErrors){if(((((err119.keyword !== "errorMessage") && (!err119.emUsed)) && ((err119.dataPath === dataPath+"/properties/" + i5+"/type") || ((err119.dataPath.indexOf(dataPath+"/properties/" + i5+"/type") === 0) && (err119.dataPath[dataPath+"/properties/" + i5+"/type".length] === "/")))) && (err119.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/3/then/properties/type") === 0)) && (err119.schemaPath["#/definitions/properties/allOf/1/items/allOf/3/then/properties/type".length] === "/")){emErrs16.push(err119);err119.emUsed = true;}}if(emErrs16.length){const err120 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/then/properties/type/errorMessage",params:{errors: emErrs16},message:"invalid property type " + JSON.stringify(data55) + " for binding type " + JSON.stringify(data43 && data43.binding && data43.binding.type) + "; must be any of { String, Text, Hidden, Dropdown }"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}const emErrs17 = [];for(const err121 of vErrors){if(!err121.emUsed){emErrs17.push(err121);}}vErrors = emErrs17;errors = emErrs17.length;}}}var _valid6 = _errs129 === errors;valid50 = _valid6;}if(!valid50){const err122 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.binding === undefined){const err123 = {keyword:"required",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/required",params:{missingProperty: "binding"},message:"should have required property '"+"binding"+"'"};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}if(data43.binding !== undefined){let data56 = data43.binding;const _errs134 = errors;let valid56 = true;const _errs135 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.type === undefined) && ("type")){const err124 = {};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}else {if(data56.type !== undefined){let data57 = data56.type;if(!((((data57 === "property") || (data57 === "camunda:property")) || (data57 === "camunda:inputParameter")) || (data57 === "camunda:field"))){const err125 = {};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}}}var _valid7 = _errs135 === errors;errors = _errs134;if(vErrors !== null){if(_errs134){vErrors.length = _errs134;}else {vErrors = null;}}if(_valid7){const _errs137 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.name === undefined){const err126 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then/required",params:{missingProperty: "name"},message:"should have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}}if(errors > 0){const emErrs18 = [];for(const err127 of vErrors){if(((((err127.keyword !== "errorMessage") && (!err127.emUsed)) && ((err127.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err127.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err127.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err127.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then") === 0)) && (err127.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then".length] === "/")){emErrs18.push(err127);err127.emUsed = true;}}if(emErrs18.length){const err128 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then/errorMessage",params:{errors: emErrs18},message:"property.binding " + JSON.stringify(data56 && data56.type) + " requires name"};if(vErrors === null){vErrors = [err128];}else {vErrors.push(err128);}errors++;}const emErrs19 = [];for(const err129 of vErrors){if(!err129.emUsed){emErrs19.push(err129);}}vErrors = emErrs19;errors = emErrs19.length;}var _valid7 = _errs137 === errors;valid56 = _valid7;}if(!valid56){const err130 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err130];}else {vErrors.push(err130);}errors++;}const _errs139 = errors;let valid58 = true;const _errs140 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.type === undefined) && ("type")){const err131 = {};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}else {if(data56.type !== undefined){if(!equal(data56.type, "camunda:outputParameter")){const err132 = {};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}}}}var _valid8 = _errs140 === errors;errors = _errs139;if(vErrors !== null){if(_errs139){vErrors.length = _errs139;}else {vErrors = null;}}if(_valid8){const _errs142 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.source === undefined){const err133 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then/required",params:{missingProperty: "source"},message:"should have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}}if(errors > 0){const emErrs20 = [];for(const err134 of vErrors){if(((((err134.keyword !== "errorMessage") && (!err134.emUsed)) && ((err134.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err134.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err134.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err134.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then") === 0)) && (err134.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then".length] === "/")){emErrs20.push(err134);err134.emUsed = true;}}if(emErrs20.length){const err135 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then/errorMessage",params:{errors: emErrs20},message:"property.binding " + JSON.stringify(data56 && data56.type) + " requires source"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}const emErrs21 = [];for(const err136 of vErrors){if(!err136.emUsed){emErrs21.push(err136);}}vErrors = emErrs21;errors = emErrs21.length;}var _valid8 = _errs142 === errors;valid58 = _valid8;}if(!valid58){const err137 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}const _errs144 = errors;let valid60 = true;const _errs145 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.type === undefined) && ("type")){const err138 = {};if(vErrors === null){vErrors = [err138];}else {vErrors.push(err138);}errors++;}else {if(data56.type !== undefined){if(!equal(data56.type, "camunda:in")){const err139 = {};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}}}}var _valid9 = _errs145 === errors;errors = _errs144;if(vErrors !== null){if(_errs144){vErrors.length = _errs144;}else {vErrors = null;}}if(_valid9){const _errs147 = errors;const _errs148 = errors;let valid62 = false;const _errs149 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.variables === undefined){const err140 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/anyOf/0/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}}var _valid10 = _errs149 === errors;valid62 = valid62 || _valid10;if(!valid62){const _errs150 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.target === undefined){const err141 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/anyOf/1/required",params:{missingProperty: "target"},message:"should have required property '"+"target"+"'"};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}var _valid10 = _errs150 === errors;valid62 = valid62 || _valid10;}if(!valid62){const err142 = {keyword:"anyOf",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/anyOf",params:{},message:"should match some schema in anyOf"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}else {errors = _errs148;if(vErrors !== null){if(_errs148){vErrors.length = _errs148;}else {vErrors = null;}}}if(errors > 0){const emErrs22 = [];for(const err143 of vErrors){if(((((err143.keyword !== "errorMessage") && (!err143.emUsed)) && ((err143.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err143.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err143.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err143.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then") === 0)) && (err143.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then".length] === "/")){emErrs22.push(err143);err143.emUsed = true;}}if(emErrs22.length){const err144 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/errorMessage",params:{errors: emErrs22},message:"property.binding " + JSON.stringify(data56 && data56.type) + " requires variables, target, or both"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}const emErrs23 = [];for(const err145 of vErrors){if(!err145.emUsed){emErrs23.push(err145);}}vErrors = emErrs23;errors = emErrs23.length;}var _valid9 = _errs147 === errors;valid60 = _valid9;}if(!valid60){const err146 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}const _errs152 = errors;let valid63 = true;const _errs153 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.type === undefined) && ("type")){const err147 = {};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}else {if(data56.type !== undefined){if(!equal(data56.type, "camunda:out")){const err148 = {};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}}var _valid11 = _errs153 === errors;errors = _errs152;if(vErrors !== null){if(_errs152){vErrors.length = _errs152;}else {vErrors = null;}}if(_valid11){const _errs155 = errors;const _errs156 = errors;let valid65 = false;let passing2 = null;const _errs157 = errors;const _errs158 = errors;const _errs159 = errors;const _errs160 = errors;let valid67 = false;const _errs161 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.source === undefined) && ("source")){const err149 = {};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}var _valid13 = _errs161 === errors;valid67 = valid67 || _valid13;if(!valid67){const _errs162 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.sourceExpression === undefined) && ("sourceExpression")){const err150 = {};if(vErrors === null){vErrors = [err150];}else {vErrors.push(err150);}errors++;}}var _valid13 = _errs162 === errors;valid67 = valid67 || _valid13;}if(!valid67){const err151 = {};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}else {errors = _errs160;if(vErrors !== null){if(_errs160){vErrors.length = _errs160;}else {vErrors = null;}}}var valid66 = _errs159 === errors;if(!valid66){errors = _errs158;if(vErrors !== null){if(_errs158){vErrors.length = _errs158;}else {vErrors = null;}}}else {const err152 = {keyword:"not",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/0/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err152];}else {vErrors.push(err152);}errors++;}if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.variables === undefined){const err153 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/0/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}}var _valid12 = _errs157 === errors;if(_valid12){valid65 = true;passing2 = 0;}const _errs163 = errors;const _errs164 = errors;const _errs165 = errors;const _errs166 = errors;let valid69 = false;const _errs167 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.variables === undefined) && ("variables")){const err154 = {};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}}var _valid14 = _errs167 === errors;valid69 = valid69 || _valid14;if(!valid69){const _errs168 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.sourceExpression === undefined) && ("sourceExpression")){const err155 = {};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}}var _valid14 = _errs168 === errors;valid69 = valid69 || _valid14;}if(!valid69){const err156 = {};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}else {errors = _errs166;if(vErrors !== null){if(_errs166){vErrors.length = _errs166;}else {vErrors = null;}}}var valid68 = _errs165 === errors;if(!valid68){errors = _errs164;if(vErrors !== null){if(_errs164){vErrors.length = _errs164;}else {vErrors = null;}}}else {const err157 = {keyword:"not",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/1/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err157];}else {vErrors.push(err157);}errors++;}if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.source === undefined){const err158 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/1/required",params:{missingProperty: "source"},message:"should have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}}var _valid12 = _errs163 === errors;if(_valid12 && valid65){valid65 = false;passing2 = [passing2, 1];}else {if(_valid12){valid65 = true;passing2 = 1;}const _errs169 = errors;const _errs170 = errors;const _errs171 = errors;const _errs172 = errors;let valid71 = false;const _errs173 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.variables === undefined) && ("variables")){const err159 = {};if(vErrors === null){vErrors = [err159];}else {vErrors.push(err159);}errors++;}}var _valid15 = _errs173 === errors;valid71 = valid71 || _valid15;if(!valid71){const _errs174 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.source === undefined) && ("source")){const err160 = {};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}var _valid15 = _errs174 === errors;valid71 = valid71 || _valid15;}if(!valid71){const err161 = {};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}else {errors = _errs172;if(vErrors !== null){if(_errs172){vErrors.length = _errs172;}else {vErrors = null;}}}var valid70 = _errs171 === errors;if(!valid70){errors = _errs170;if(vErrors !== null){if(_errs170){vErrors.length = _errs170;}else {vErrors = null;}}}else {const err162 = {keyword:"not",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/2/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.sourceExpression === undefined){const err163 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/2/required",params:{missingProperty: "sourceExpression"},message:"should have required property '"+"sourceExpression"+"'"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}var _valid12 = _errs169 === errors;if(_valid12 && valid65){valid65 = false;passing2 = [passing2, 2];}else {if(_valid12){valid65 = true;passing2 = 2;}const _errs175 = errors;const _errs176 = errors;const _errs177 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.source === undefined) && ("source")){const err164 = {};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}var valid72 = _errs177 === errors;if(!valid72){errors = _errs176;if(vErrors !== null){if(_errs176){vErrors.length = _errs176;}else {vErrors = null;}}}else {const err165 = {keyword:"not",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/3/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.variables === undefined){const err166 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/3/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}if(data56.sourceExpression === undefined){const err167 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/3/required",params:{missingProperty: "sourceExpression"},message:"should have required property '"+"sourceExpression"+"'"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}}var _valid12 = _errs175 === errors;if(_valid12 && valid65){valid65 = false;passing2 = [passing2, 3];}else {if(_valid12){valid65 = true;passing2 = 3;}const _errs178 = errors;const _errs179 = errors;const _errs180 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.sourceExpression === undefined) && ("sourceExpression")){const err168 = {};if(vErrors === null){vErrors = [err168];}else {vErrors.push(err168);}errors++;}}var valid73 = _errs180 === errors;if(!valid73){errors = _errs179;if(vErrors !== null){if(_errs179){vErrors.length = _errs179;}else {vErrors = null;}}}else {const err169 = {keyword:"not",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/4/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.variables === undefined){const err170 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/4/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err170];}else {vErrors.push(err170);}errors++;}if(data56.source === undefined){const err171 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/4/required",params:{missingProperty: "source"},message:"should have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}var _valid12 = _errs178 === errors;if(_valid12 && valid65){valid65 = false;passing2 = [passing2, 4];}else {if(_valid12){valid65 = true;passing2 = 4;}}}}}if(!valid65){const err172 = {keyword:"oneOf",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf",params:{passingSchemas: passing2},message:"should match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}else {errors = _errs156;if(vErrors !== null){if(_errs156){vErrors.length = _errs156;}else {vErrors = null;}}}if(errors > 0){const emErrs24 = [];for(const err173 of vErrors){if(((((err173.keyword !== "errorMessage") && (!err173.emUsed)) && ((err173.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err173.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err173.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err173.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then") === 0)) && (err173.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then".length] === "/")){emErrs24.push(err173);err173.emUsed = true;}}if(emErrs24.length){const err174 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/errorMessage",params:{errors: emErrs24},message:"property.binding " + JSON.stringify(data56 && data56.type) + " requires one of the following: variables, sourceExpression, source, (sourceExpression and variables), or (source and variables)"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}const emErrs25 = [];for(const err175 of vErrors){if(!err175.emUsed){emErrs25.push(err175);}}vErrors = emErrs25;errors = emErrs25.length;}var _valid11 = _errs155 === errors;valid63 = _valid11;}if(!valid63){const err176 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}const _errs182 = errors;let valid74 = true;const _errs183 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if((data56.type === undefined) && ("type")){const err177 = {};if(vErrors === null){vErrors = [err177];}else {vErrors.push(err177);}errors++;}else {if(data56.type !== undefined){if(!equal(data56.type, "camunda:errorEventDefinition")){const err178 = {};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}}}}var _valid16 = _errs183 === errors;errors = _errs182;if(vErrors !== null){if(_errs182){vErrors.length = _errs182;}else {vErrors = null;}}if(_valid16){const _errs185 = errors;const _errs186 = errors;let valid76 = false;let passing3 = null;const _errs187 = errors;if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.errorRef === undefined){const err179 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then/oneOf/0/required",params:{missingProperty: "errorRef"},message:"should have required property '"+"errorRef"+"'"};if(vErrors === null){vErrors = [err179];}else {vErrors.push(err179);}errors++;}}var _valid17 = _errs187 === errors;if(_valid17){valid76 = true;passing3 = 0;}if(!valid76){const err180 = {keyword:"oneOf",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then/oneOf",params:{passingSchemas: passing3},message:"should match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}else {errors = _errs186;if(vErrors !== null){if(_errs186){vErrors.length = _errs186;}else {vErrors = null;}}}if(errors > 0){const emErrs26 = [];for(const err181 of vErrors){if(((((err181.keyword !== "errorMessage") && (!err181.emUsed)) && ((err181.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err181.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err181.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err181.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then") === 0)) && (err181.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then".length] === "/")){emErrs26.push(err181);err181.emUsed = true;}}if(emErrs26.length){const err182 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then/errorMessage",params:{errors: emErrs26},message:"property.binding " + JSON.stringify(data56 && data56.type) + " requires errorRef"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}const emErrs27 = [];for(const err183 of vErrors){if(!err183.emUsed){emErrs27.push(err183);}}vErrors = emErrs27;errors = emErrs27.length;}var _valid16 = _errs185 === errors;valid74 = _valid16;}if(!valid74){const err184 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err184];}else {vErrors.push(err184);}errors++;}if(data56 && typeof data56 == "object" && !Array.isArray(data56)){if(data56.type === undefined){const err185 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/required",params:{missingProperty: "type"},message:"should have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err185];}else {vErrors.push(err185);}errors++;}if(data56.type !== undefined){let data62 = data56.type;if(typeof data62 !== "string"){const err186 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err186];}else {vErrors.push(err186);}errors++;}if(!((((((((((data62 === "property") || (data62 === "camunda:property")) || (data62 === "camunda:inputParameter")) || (data62 === "camunda:outputParameter")) || (data62 === "camunda:in")) || (data62 === "camunda:out")) || (data62 === "camunda:in:businessKey")) || (data62 === "camunda:executionListener")) || (data62 === "camunda:field")) || (data62 === "camunda:errorEventDefinition"))){const err187 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/enum",params:{allowedValues: schema18$1.allOf[1].items.properties.binding.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err187];}else {vErrors.push(err187);}errors++;}if(errors > 0){const emErrs28 = [];for(const err188 of vErrors){if(((((err188.keyword !== "errorMessage") && (!err188.emUsed)) && ((err188.dataPath === dataPath+"/properties/" + i5+"/binding/type") || ((err188.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding/type") === 0) && (err188.dataPath[dataPath+"/properties/" + i5+"/binding/type".length] === "/")))) && (err188.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/properties/type") === 0)) && (err188.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/properties/type".length] === "/")){emErrs28.push(err188);err188.emUsed = true;}}if(emErrs28.length){const err189 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/errorMessage",params:{errors: emErrs28},message:"invalid property.binding type " + JSON.stringify(data62) + "; must be any of { property, camunda:property, camunda:inputParameter, camunda:outputParameter, camunda:in, camunda:out, camunda:in:businessKey, camunda:executionListener, camunda:field, camunda:errorEventDefinition }"};if(vErrors === null){vErrors = [err189];}else {vErrors.push(err189);}errors++;}const emErrs29 = [];for(const err190 of vErrors){if(!err190.emUsed){emErrs29.push(err190);}}vErrors = emErrs29;errors = emErrs29.length;}}if(data56.name !== undefined){if(typeof data56.name !== "string"){const err191 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/name",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/name/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err191];}else {vErrors.push(err191);}errors++;}}if(data56.event !== undefined){if(typeof data56.event !== "string"){const err192 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/event",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/event/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err192];}else {vErrors.push(err192);}errors++;}}if(data56.scriptFormat !== undefined){if(typeof data56.scriptFormat !== "string"){const err193 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/scriptFormat",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/scriptFormat/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err193];}else {vErrors.push(err193);}errors++;}}if(data56.source !== undefined){if(typeof data56.source !== "string"){const err194 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/source",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/source/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err194];}else {vErrors.push(err194);}errors++;}}if(data56.target !== undefined){if(typeof data56.target !== "string"){const err195 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/target",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/target/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err195];}else {vErrors.push(err195);}errors++;}}if(data56.expression !== undefined){if(typeof data56.expression !== "boolean"){const err196 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/expression",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/expression/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err196];}else {vErrors.push(err196);}errors++;}}if(data56.variables !== undefined){let data69 = data56.variables;if(typeof data69 !== "string"){const err197 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/variables",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/variables/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err197];}else {vErrors.push(err197);}errors++;}if(!((data69 === "all") || (data69 === "local"))){const err198 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/binding/variables",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/variables/enum",params:{allowedValues: schema18$1.allOf[1].items.properties.binding.properties.variables.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err198];}else {vErrors.push(err198);}errors++;}}if(data56.sourceExpression !== undefined){if(typeof data56.sourceExpression !== "string"){const err199 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/sourceExpression",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/sourceExpression/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err199];}else {vErrors.push(err199);}errors++;}}}else {const err200 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err200];}else {vErrors.push(err200);}errors++;}}}else {const err201 = {keyword:"type",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err201];}else {vErrors.push(err201);}errors++;}if(errors > 0){const emErrors8 = {"required":[]};const templates8 = {required:function(){return "missing binding for property \"" + JSON.stringify(i5) + "\""}};for(const err202 of vErrors){if((((((err202.keyword !== "errorMessage") && (!err202.emUsed)) && (err202.dataPath === dataPath+"/properties/" + i5)) && (err202.keyword in emErrors8)) && (err202.schemaPath.indexOf("#/definitions/properties/allOf/1/items") === 0)) && (/^\/[^\/]*$/.test(err202.schemaPath.slice(38)))){emErrors8[err202.keyword].push(err202);err202.emUsed = true;}}for(const key8 in emErrors8){if(emErrors8[key8].length){const err203 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/errorMessage",params:{errors: emErrors8[key8]},message:key8 in templates8 ? templates8[key8]() : schema18$1.allOf[1].items.errorMessage[key8]};if(vErrors === null){vErrors = [err203];}else {vErrors.push(err203);}errors++;}}const emErrs30 = [];for(const err204 of vErrors){if(!err204.emUsed){emErrs30.push(err204);}}vErrors = emErrs30;errors = emErrs30.length;}}}else {const err205 = {keyword:"type",dataPath:dataPath+"/properties",schemaPath:"#/definitions/properties/allOf/1/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err205];}else {vErrors.push(err205);}errors++;}}if(data.scopes !== undefined){let data71 = data.scopes;if(Array.isArray(data71)){const len6 = data71.length;for(let i6=0; i6 0){const emErrs31 = [];for(const err209 of vErrors){if(((((err209.keyword !== "errorMessage") && (!err209.emUsed)) && ((err209.dataPath === dataPath+"/scopes/" + i6) || ((err209.dataPath.indexOf(dataPath+"/scopes/" + i6) === 0) && (err209.dataPath[dataPath+"/scopes/" + i6.length] === "/")))) && (err209.schemaPath.indexOf("#/properties/scopes/items/allOf/0/then") === 0)) && (err209.schemaPath["#/properties/scopes/items/allOf/0/then".length] === "/")){emErrs31.push(err209);err209.emUsed = true;}}if(emErrs31.length){const err210 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6,schemaPath:"#/properties/scopes/items/allOf/0/then/errorMessage",params:{errors: emErrs31},message:"invalid scope " + JSON.stringify(data72 && data72.type) + ", missing id"};if(vErrors === null){vErrors = [err210];}else {vErrors.push(err210);}errors++;}const emErrs32 = [];for(const err211 of vErrors){if(!err211.emUsed){emErrs32.push(err211);}}vErrors = emErrs32;errors = emErrs32.length;}var _valid18 = _errs214 === errors;valid82 = _valid18;}if(!valid82){const err212 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6,schemaPath:"#/properties/scopes/items/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err212];}else {vErrors.push(err212);}errors++;}if(data72 && typeof data72 == "object" && !Array.isArray(data72)){if(data72.type === undefined){const err213 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6,schemaPath:"#/properties/scopes/items/required",params:{missingProperty: "type"},message:"should have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err213];}else {vErrors.push(err213);}errors++;}if(data72.properties === undefined){const err214 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6,schemaPath:"#/properties/scopes/items/required",params:{missingProperty: "properties"},message:"should have required property '"+"properties"+"'"};if(vErrors === null){vErrors = [err214];}else {vErrors.push(err214);}errors++;}if(data72.type !== undefined){let data74 = data72.type;if(typeof data74 !== "string"){const err215 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/type",schemaPath:"#/properties/scopes/items/properties/type/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err215];}else {vErrors.push(err215);}errors++;}if(!((data74 === "camunda:Connector") || (data74 === "bpmn:Error"))){const err216 = {keyword:"enum",dataPath:dataPath+"/scopes/" + i6+"/type",schemaPath:"#/properties/scopes/items/properties/type/enum",params:{allowedValues: schema17$1.properties.scopes.items.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err216];}else {vErrors.push(err216);}errors++;}if(errors > 0){const emErrs33 = [];for(const err217 of vErrors){if(((((err217.keyword !== "errorMessage") && (!err217.emUsed)) && ((err217.dataPath === dataPath+"/scopes/" + i6+"/type") || ((err217.dataPath.indexOf(dataPath+"/scopes/" + i6+"/type") === 0) && (err217.dataPath[dataPath+"/scopes/" + i6+"/type".length] === "/")))) && (err217.schemaPath.indexOf("#/properties/scopes/items/properties/type") === 0)) && (err217.schemaPath["#/properties/scopes/items/properties/type".length] === "/")){emErrs33.push(err217);err217.emUsed = true;}}if(emErrs33.length){const err218 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/type",schemaPath:"#/properties/scopes/items/properties/type/errorMessage",params:{errors: emErrs33},message:"invalid scope type " + JSON.stringify(data74) + "; must be any of { camunda:Connector, bpmn:Error }"};if(vErrors === null){vErrors = [err218];}else {vErrors.push(err218);}errors++;}const emErrs34 = [];for(const err219 of vErrors){if(!err219.emUsed){emErrs34.push(err219);}}vErrors = emErrs34;errors = emErrs34.length;}}if(data72.properties !== undefined){let data75 = data72.properties;if(Array.isArray(data75)){const len7 = data75.length;for(let i7=0; i7 0){const emErrs35 = [];for(const err223 of vErrors){if(((((err223.keyword !== "errorMessage") && (!err223.emUsed)) && ((err223.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i7) || ((err223.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i7) === 0) && (err223.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i7.length] === "/")))) && (err223.schemaPath.indexOf("#/definitions/properties/allOf/0/items/allOf/0/then") === 0)) && (err223.schemaPath["#/definitions/properties/allOf/0/items/allOf/0/then".length] === "/")){emErrs35.push(err223);err223.emUsed = true;}}if(emErrs35.length){const err224 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7,schemaPath:"#/definitions/properties/allOf/0/items/allOf/0/then/errorMessage",params:{errors: emErrs35},message:"must provide choices=[] with \"Dropdown\" type"};if(vErrors === null){vErrors = [err224];}else {vErrors.push(err224);}errors++;}const emErrs36 = [];for(const err225 of vErrors){if(!err225.emUsed){emErrs36.push(err225);}}vErrors = emErrs36;errors = emErrs36.length;}var _valid19 = _errs227 === errors;valid91 = _valid19;}if(!valid91){const err226 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7,schemaPath:"#/definitions/properties/allOf/0/items/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err226];}else {vErrors.push(err226);}errors++;}if(data76 && typeof data76 == "object" && !Array.isArray(data76)){if(data76.id !== undefined){if(typeof data76.id !== "string"){const err227 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/id",schemaPath:"#/definitions/properties/allOf/0/items/properties/id/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err227];}else {vErrors.push(err227);}errors++;}}if(data76.value !== undefined){let data79 = data76.value;if((typeof data79 !== "string") && (typeof data79 !== "boolean")){const err228 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/value",schemaPath:"#/definitions/properties/allOf/0/items/properties/value/type",params:{type: schema19.items.properties.value.type},message:"should be string,boolean"};if(vErrors === null){vErrors = [err228];}else {vErrors.push(err228);}errors++;}}if(data76.description !== undefined){if(typeof data76.description !== "string"){const err229 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/description",schemaPath:"#/definitions/properties/allOf/0/items/properties/description/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err229];}else {vErrors.push(err229);}errors++;}}if(data76.label !== undefined){if(typeof data76.label !== "string"){const err230 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/label",schemaPath:"#/definitions/properties/allOf/0/items/properties/label/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err230];}else {vErrors.push(err230);}errors++;}}if(data76.type !== undefined){if(typeof data76.type !== "string"){const err231 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/type",schemaPath:"#/definitions/properties/allOf/0/items/properties/type/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err231];}else {vErrors.push(err231);}errors++;}}if(data76.editable !== undefined){if(typeof data76.editable !== "boolean"){const err232 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/editable",schemaPath:"#/definitions/properties/allOf/0/items/properties/editable/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err232];}else {vErrors.push(err232);}errors++;}}if(data76.choices !== undefined){let data84 = data76.choices;if(Array.isArray(data84)){const len8 = data84.length;for(let i8=0; i8 0){const emErrors9 = {"required":[]};const templates9 = {};for(const err238 of vErrors){if((((((err238.keyword !== "errorMessage") && (!err238.emUsed)) && (err238.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i7+"/choices/" + i8)) && (err238.keyword in emErrors9)) && (err238.schemaPath.indexOf("#/definitions/properties/allOf/0/items/properties/choices/items") === 0)) && (/^\/[^\/]*$/.test(err238.schemaPath.slice(63)))){emErrors9[err238.keyword].push(err238);err238.emUsed = true;}}for(const key9 in emErrors9){if(emErrors9[key9].length){const err239 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/choices/" + i8,schemaPath:"#/definitions/properties/allOf/0/items/properties/choices/items/errorMessage",params:{errors: emErrors9[key9]},message:key9 in templates9 ? templates9[key9]() : schema19.items.properties.choices.items.errorMessage[key9]};if(vErrors === null){vErrors = [err239];}else {vErrors.push(err239);}errors++;}}const emErrs37 = [];for(const err240 of vErrors){if(!err240.emUsed){emErrs37.push(err240);}}vErrors = emErrs37;errors = emErrs37.length;}}}else {const err241 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/choices",schemaPath:"#/definitions/properties/allOf/0/items/properties/choices/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err241];}else {vErrors.push(err241);}errors++;}}if(data76.constraints !== undefined){let data88 = data76.constraints;if(data88 && typeof data88 == "object" && !Array.isArray(data88)){if(data88.notEmpty !== undefined){if(typeof data88.notEmpty !== "boolean"){const err242 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/notEmpty",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/notEmpty/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err242];}else {vErrors.push(err242);}errors++;}}if(data88.minLength !== undefined){if(!(typeof data88.minLength == "number")){const err243 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/minLength",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/minLength/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err243];}else {vErrors.push(err243);}errors++;}}if(data88.maxLength !== undefined){if(!(typeof data88.maxLength == "number")){const err244 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/maxLength",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/maxLength/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err244];}else {vErrors.push(err244);}errors++;}}if(data88.pattern !== undefined){let data92 = data88.pattern;const _errs257 = errors;let valid99 = false;let passing4 = null;const _errs258 = errors;if(data92 && typeof data92 == "object" && !Array.isArray(data92)){if(data92.value !== undefined){if(typeof data92.value !== "string"){const err245 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/pattern/value",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/properties/value/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err245];}else {vErrors.push(err245);}errors++;}}if(data92.message !== undefined){if(typeof data92.message !== "string"){const err246 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/pattern/message",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/properties/message/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err246];}else {vErrors.push(err246);}errors++;}}}else {const err247 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err247];}else {vErrors.push(err247);}errors++;}var _valid20 = _errs258 === errors;if(_valid20){valid99 = true;passing4 = 0;}const _errs264 = errors;if(typeof data92 !== "string"){const err248 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/1/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err248];}else {vErrors.push(err248);}errors++;}var _valid20 = _errs264 === errors;if(_valid20 && valid99){valid99 = false;passing4 = [passing4, 1];}else {if(_valid20){valid99 = true;passing4 = 1;}}if(!valid99){const err249 = {keyword:"oneOf",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf",params:{passingSchemas: passing4},message:"should match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err249];}else {vErrors.push(err249);}errors++;}else {errors = _errs257;if(vErrors !== null){if(_errs257){vErrors.length = _errs257;}else {vErrors = null;}}}}}else {const err250 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/constraints",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err250];}else {vErrors.push(err250);}errors++;}}if(data76.group !== undefined){if(typeof data76.group !== "string"){const err251 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/group",schemaPath:"#/definitions/properties/allOf/0/items/properties/group/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err251];}else {vErrors.push(err251);}errors++;}}if(data76.condition !== undefined){let data96 = data76.condition;const _errs270 = errors;let valid101 = false;let passing5 = null;const _errs271 = errors;if(data96 && typeof data96 == "object" && !Array.isArray(data96)){if(data96.equals === undefined){const err252 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/0/required",params:{missingProperty: "equals"},message:"should have required property '"+"equals"+"'"};if(vErrors === null){vErrors = [err252];}else {vErrors.push(err252);}errors++;}if(data96.equals !== undefined){let data97 = data96.equals;if(((typeof data97 !== "string") && (!(typeof data97 == "number"))) && (typeof data97 !== "boolean")){const err253 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/condition/equals",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/0/properties/equals/type",params:{type: schema19.items.properties.condition.oneOf[0].properties.equals.type},message:"should be string,number,boolean"};if(vErrors === null){vErrors = [err253];}else {vErrors.push(err253);}errors++;}}}var _valid21 = _errs271 === errors;if(_valid21){valid101 = true;passing5 = 0;}const _errs274 = errors;if(data96 && typeof data96 == "object" && !Array.isArray(data96)){if(data96.oneOf === undefined){const err254 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/1/required",params:{missingProperty: "oneOf"},message:"should have required property '"+"oneOf"+"'"};if(vErrors === null){vErrors = [err254];}else {vErrors.push(err254);}errors++;}if(data96.oneOf !== undefined){let data98 = data96.oneOf;if(Array.isArray(data98)){const len9 = data98.length;for(let i9=0; i9 0){const emErrors10 = {"required":{"property":[]}};const templates10 = {required:{}};let emPropParams4;let emParamsErrors4;for(const err262 of vErrors){if((((((err262.keyword !== "errorMessage") && (!err262.emUsed)) && (err262.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i7+"/condition")) && (err262.keyword in emErrors10)) && (err262.schemaPath.indexOf("#/definitions/properties/allOf/0/items/properties/condition") === 0)) && (/^\/[^\/]*$/.test(err262.schemaPath.slice(59)))){emPropParams4 = obj0$1[err262.keyword];emParamsErrors4 = emErrors10[err262.keyword][err262.params[emPropParams4]];if(emParamsErrors4){emParamsErrors4.push(err262);err262.emUsed = true;}}}for(const key10 in emErrors10){for(const keyProp4 in emErrors10[key10]){emParamsErrors4 = emErrors10[key10][keyProp4];if(emParamsErrors4.length){const tmpl4 = templates10[key10] && templates10[key10][keyProp4];const err263 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/errorMessage",params:{errors: emParamsErrors4},message:tmpl4 ? tmpl4() : schema19.items.properties.condition.errorMessage[key10][keyProp4]};if(vErrors === null){vErrors = [err263];}else {vErrors.push(err263);}errors++;}}}const emErrs38 = [];for(const err264 of vErrors){if(!err264.emUsed){emErrs38.push(err264);}}vErrors = emErrs38;errors = emErrs38.length;}}}else {const err265 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i7,schemaPath:"#/definitions/properties/allOf/0/items/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err265];}else {vErrors.push(err265);}errors++;}}}else {const err266 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties",schemaPath:"#/definitions/properties/allOf/0/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err266];}else {vErrors.push(err266);}errors++;}if(Array.isArray(data75)){const len10 = data75.length;for(let i10=0; i10 0){const emErrs39 = [];for(const err271 of vErrors){if(((((err271.keyword !== "errorMessage") && (!err271.emUsed)) && ((err271.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") || ((err271.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") === 0) && (err271.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/type".length] === "/")))) && (err271.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/0/then/properties/type") === 0)) && (err271.schemaPath["#/definitions/properties/allOf/1/items/allOf/0/then/properties/type".length] === "/")){emErrs39.push(err271);err271.emUsed = true;}}if(emErrs39.length){const err272 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/0/then/properties/type/errorMessage",params:{errors: emErrs39},message:"invalid property type " + JSON.stringify(data105) + " for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean }"};if(vErrors === null){vErrors = [err272];}else {vErrors.push(err272);}errors++;}const emErrs40 = [];for(const err273 of vErrors){if(!err273.emUsed){emErrs40.push(err273);}}vErrors = emErrs40;errors = emErrs40.length;}}}var _valid22 = _errs292 === errors;valid112 = _valid22;}if(!valid112){const err274 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10,schemaPath:"#/definitions/properties/allOf/1/items/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err274];}else {vErrors.push(err274);}errors++;}const _errs295 = errors;let valid116 = true;const _errs296 = errors;if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if((data102.binding === undefined) && ("binding")){const err275 = {};if(vErrors === null){vErrors = [err275];}else {vErrors.push(err275);}errors++;}else {if(data102.binding !== undefined){let data106 = data102.binding;if(data106 && typeof data106 == "object" && !Array.isArray(data106)){if((data106.type === undefined) && ("type")){const err276 = {};if(vErrors === null){vErrors = [err276];}else {vErrors.push(err276);}errors++;}else {if(data106.type !== undefined){if(!equal(data106.type, "camunda:executionListener")){const err277 = {};if(vErrors === null){vErrors = [err277];}else {vErrors.push(err277);}errors++;}}}}}}}var _valid23 = _errs296 === errors;errors = _errs295;if(vErrors !== null){if(_errs295){vErrors.length = _errs295;}else {vErrors = null;}}if(_valid23){const _errs299 = errors;if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if(data102.type !== undefined){if(!(data102.type === "Hidden")){const err278 = {keyword:"enum",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/then/properties/type/enum",params:{allowedValues: schema20.items.allOf[1].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err278];}else {vErrors.push(err278);}errors++;}if(errors > 0){const emErrs41 = [];for(const err279 of vErrors){if(((((err279.keyword !== "errorMessage") && (!err279.emUsed)) && ((err279.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") || ((err279.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") === 0) && (err279.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/type".length] === "/")))) && (err279.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/1/then/properties/type") === 0)) && (err279.schemaPath["#/definitions/properties/allOf/1/items/allOf/1/then/properties/type".length] === "/")){emErrs41.push(err279);err279.emUsed = true;}}if(emErrs41.length){const err280 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/then/properties/type/errorMessage",params:{errors: emErrs41},message:"invalid property type " + JSON.stringify(data102 && data102.type) + " for binding type \"camunda:executionListener\"; must be \"Hidden\""};if(vErrors === null){vErrors = [err280];}else {vErrors.push(err280);}errors++;}const emErrs42 = [];for(const err281 of vErrors){if(!err281.emUsed){emErrs42.push(err281);}}vErrors = emErrs42;errors = emErrs42.length;}}}var _valid23 = _errs299 === errors;valid116 = _valid23;}if(!valid116){const err282 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10,schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err282];}else {vErrors.push(err282);}errors++;}const _errs302 = errors;let valid120 = true;const _errs303 = errors;if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if((data102.binding === undefined) && ("binding")){const err283 = {};if(vErrors === null){vErrors = [err283];}else {vErrors.push(err283);}errors++;}else {if(data102.binding !== undefined){let data109 = data102.binding;if(data109 && typeof data109 == "object" && !Array.isArray(data109)){if((data109.type === undefined) && ("type")){const err284 = {};if(vErrors === null){vErrors = [err284];}else {vErrors.push(err284);}errors++;}else {if(data109.type !== undefined){let data110 = data109.type;if(!((((((data110 === "camunda:property") || (data110 === "camunda:outputParameter")) || (data110 === "camunda:in")) || (data110 === "camunda:in:businessKey")) || (data110 === "camunda:out")) || (data110 === "camunda:errorEventDefinition"))){const err285 = {};if(vErrors === null){vErrors = [err285];}else {vErrors.push(err285);}errors++;}}}}}}}var _valid24 = _errs303 === errors;errors = _errs302;if(vErrors !== null){if(_errs302){vErrors.length = _errs302;}else {vErrors = null;}}if(_valid24){const _errs306 = errors;if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if(data102.type !== undefined){let data111 = data102.type;if(!(((data111 === "String") || (data111 === "Hidden")) || (data111 === "Dropdown"))){const err286 = {keyword:"enum",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/then/properties/type/enum",params:{allowedValues: schema20.items.allOf[2].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err286];}else {vErrors.push(err286);}errors++;}if(errors > 0){const emErrs43 = [];for(const err287 of vErrors){if(((((err287.keyword !== "errorMessage") && (!err287.emUsed)) && ((err287.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") || ((err287.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") === 0) && (err287.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/type".length] === "/")))) && (err287.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/2/then/properties/type") === 0)) && (err287.schemaPath["#/definitions/properties/allOf/1/items/allOf/2/then/properties/type".length] === "/")){emErrs43.push(err287);err287.emUsed = true;}}if(emErrs43.length){const err288 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/then/properties/type/errorMessage",params:{errors: emErrs43},message:"invalid property type " + JSON.stringify(data111) + " for binding type " + JSON.stringify(data102 && data102.binding && data102.binding.type) + "; must be any of { String, Hidden, Dropdown }"};if(vErrors === null){vErrors = [err288];}else {vErrors.push(err288);}errors++;}const emErrs44 = [];for(const err289 of vErrors){if(!err289.emUsed){emErrs44.push(err289);}}vErrors = emErrs44;errors = emErrs44.length;}}}var _valid24 = _errs306 === errors;valid120 = _valid24;}if(!valid120){const err290 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10,schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err290];}else {vErrors.push(err290);}errors++;}const _errs309 = errors;let valid124 = true;const _errs310 = errors;if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if((data102.binding === undefined) && ("binding")){const err291 = {};if(vErrors === null){vErrors = [err291];}else {vErrors.push(err291);}errors++;}else {if(data102.binding !== undefined){let data112 = data102.binding;if(data112 && typeof data112 == "object" && !Array.isArray(data112)){if((data112.type === undefined) && ("type")){const err292 = {};if(vErrors === null){vErrors = [err292];}else {vErrors.push(err292);}errors++;}else {if(data112.type !== undefined){let data113 = data112.type;if(!((data113 === "camunda:inputParameter") || (data113 === "camunda:field"))){const err293 = {};if(vErrors === null){vErrors = [err293];}else {vErrors.push(err293);}errors++;}}}}}}}var _valid25 = _errs310 === errors;errors = _errs309;if(vErrors !== null){if(_errs309){vErrors.length = _errs309;}else {vErrors = null;}}if(_valid25){const _errs313 = errors;if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if(data102.type !== undefined){let data114 = data102.type;if(!((((data114 === "String") || (data114 === "Text")) || (data114 === "Hidden")) || (data114 === "Dropdown"))){const err294 = {keyword:"enum",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/then/properties/type/enum",params:{allowedValues: schema20.items.allOf[3].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err294];}else {vErrors.push(err294);}errors++;}if(errors > 0){const emErrs45 = [];for(const err295 of vErrors){if(((((err295.keyword !== "errorMessage") && (!err295.emUsed)) && ((err295.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") || ((err295.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/type") === 0) && (err295.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/type".length] === "/")))) && (err295.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/3/then/properties/type") === 0)) && (err295.schemaPath["#/definitions/properties/allOf/1/items/allOf/3/then/properties/type".length] === "/")){emErrs45.push(err295);err295.emUsed = true;}}if(emErrs45.length){const err296 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/then/properties/type/errorMessage",params:{errors: emErrs45},message:"invalid property type " + JSON.stringify(data114) + " for binding type " + JSON.stringify(data102 && data102.binding && data102.binding.type) + "; must be any of { String, Text, Hidden, Dropdown }"};if(vErrors === null){vErrors = [err296];}else {vErrors.push(err296);}errors++;}const emErrs46 = [];for(const err297 of vErrors){if(!err297.emUsed){emErrs46.push(err297);}}vErrors = emErrs46;errors = emErrs46.length;}}}var _valid25 = _errs313 === errors;valid124 = _valid25;}if(!valid124){const err298 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10,schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err298];}else {vErrors.push(err298);}errors++;}if(data102 && typeof data102 == "object" && !Array.isArray(data102)){if(data102.binding === undefined){const err299 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10,schemaPath:"#/definitions/properties/allOf/1/items/required",params:{missingProperty: "binding"},message:"should have required property '"+"binding"+"'"};if(vErrors === null){vErrors = [err299];}else {vErrors.push(err299);}errors++;}if(data102.binding !== undefined){let data115 = data102.binding;const _errs318 = errors;let valid130 = true;const _errs319 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.type === undefined) && ("type")){const err300 = {};if(vErrors === null){vErrors = [err300];}else {vErrors.push(err300);}errors++;}else {if(data115.type !== undefined){let data116 = data115.type;if(!((((data116 === "property") || (data116 === "camunda:property")) || (data116 === "camunda:inputParameter")) || (data116 === "camunda:field"))){const err301 = {};if(vErrors === null){vErrors = [err301];}else {vErrors.push(err301);}errors++;}}}}var _valid26 = _errs319 === errors;errors = _errs318;if(vErrors !== null){if(_errs318){vErrors.length = _errs318;}else {vErrors = null;}}if(_valid26){const _errs321 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.name === undefined){const err302 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then/required",params:{missingProperty: "name"},message:"should have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err302];}else {vErrors.push(err302);}errors++;}}if(errors > 0){const emErrs47 = [];for(const err303 of vErrors){if(((((err303.keyword !== "errorMessage") && (!err303.emUsed)) && ((err303.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") || ((err303.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") === 0) && (err303.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding".length] === "/")))) && (err303.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then") === 0)) && (err303.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then".length] === "/")){emErrs47.push(err303);err303.emUsed = true;}}if(emErrs47.length){const err304 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then/errorMessage",params:{errors: emErrs47},message:"property.binding " + JSON.stringify(data115 && data115.type) + " requires name"};if(vErrors === null){vErrors = [err304];}else {vErrors.push(err304);}errors++;}const emErrs48 = [];for(const err305 of vErrors){if(!err305.emUsed){emErrs48.push(err305);}}vErrors = emErrs48;errors = emErrs48.length;}var _valid26 = _errs321 === errors;valid130 = _valid26;}if(!valid130){const err306 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err306];}else {vErrors.push(err306);}errors++;}const _errs323 = errors;let valid132 = true;const _errs324 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.type === undefined) && ("type")){const err307 = {};if(vErrors === null){vErrors = [err307];}else {vErrors.push(err307);}errors++;}else {if(data115.type !== undefined){if(!equal(data115.type, "camunda:outputParameter")){const err308 = {};if(vErrors === null){vErrors = [err308];}else {vErrors.push(err308);}errors++;}}}}var _valid27 = _errs324 === errors;errors = _errs323;if(vErrors !== null){if(_errs323){vErrors.length = _errs323;}else {vErrors = null;}}if(_valid27){const _errs326 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.source === undefined){const err309 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then/required",params:{missingProperty: "source"},message:"should have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err309];}else {vErrors.push(err309);}errors++;}}if(errors > 0){const emErrs49 = [];for(const err310 of vErrors){if(((((err310.keyword !== "errorMessage") && (!err310.emUsed)) && ((err310.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") || ((err310.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") === 0) && (err310.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding".length] === "/")))) && (err310.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then") === 0)) && (err310.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then".length] === "/")){emErrs49.push(err310);err310.emUsed = true;}}if(emErrs49.length){const err311 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then/errorMessage",params:{errors: emErrs49},message:"property.binding " + JSON.stringify(data115 && data115.type) + " requires source"};if(vErrors === null){vErrors = [err311];}else {vErrors.push(err311);}errors++;}const emErrs50 = [];for(const err312 of vErrors){if(!err312.emUsed){emErrs50.push(err312);}}vErrors = emErrs50;errors = emErrs50.length;}var _valid27 = _errs326 === errors;valid132 = _valid27;}if(!valid132){const err313 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err313];}else {vErrors.push(err313);}errors++;}const _errs328 = errors;let valid134 = true;const _errs329 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.type === undefined) && ("type")){const err314 = {};if(vErrors === null){vErrors = [err314];}else {vErrors.push(err314);}errors++;}else {if(data115.type !== undefined){if(!equal(data115.type, "camunda:in")){const err315 = {};if(vErrors === null){vErrors = [err315];}else {vErrors.push(err315);}errors++;}}}}var _valid28 = _errs329 === errors;errors = _errs328;if(vErrors !== null){if(_errs328){vErrors.length = _errs328;}else {vErrors = null;}}if(_valid28){const _errs331 = errors;const _errs332 = errors;let valid136 = false;const _errs333 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.variables === undefined){const err316 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/anyOf/0/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err316];}else {vErrors.push(err316);}errors++;}}var _valid29 = _errs333 === errors;valid136 = valid136 || _valid29;if(!valid136){const _errs334 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.target === undefined){const err317 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/anyOf/1/required",params:{missingProperty: "target"},message:"should have required property '"+"target"+"'"};if(vErrors === null){vErrors = [err317];}else {vErrors.push(err317);}errors++;}}var _valid29 = _errs334 === errors;valid136 = valid136 || _valid29;}if(!valid136){const err318 = {keyword:"anyOf",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/anyOf",params:{},message:"should match some schema in anyOf"};if(vErrors === null){vErrors = [err318];}else {vErrors.push(err318);}errors++;}else {errors = _errs332;if(vErrors !== null){if(_errs332){vErrors.length = _errs332;}else {vErrors = null;}}}if(errors > 0){const emErrs51 = [];for(const err319 of vErrors){if(((((err319.keyword !== "errorMessage") && (!err319.emUsed)) && ((err319.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") || ((err319.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") === 0) && (err319.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding".length] === "/")))) && (err319.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then") === 0)) && (err319.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then".length] === "/")){emErrs51.push(err319);err319.emUsed = true;}}if(emErrs51.length){const err320 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/errorMessage",params:{errors: emErrs51},message:"property.binding " + JSON.stringify(data115 && data115.type) + " requires variables, target, or both"};if(vErrors === null){vErrors = [err320];}else {vErrors.push(err320);}errors++;}const emErrs52 = [];for(const err321 of vErrors){if(!err321.emUsed){emErrs52.push(err321);}}vErrors = emErrs52;errors = emErrs52.length;}var _valid28 = _errs331 === errors;valid134 = _valid28;}if(!valid134){const err322 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err322];}else {vErrors.push(err322);}errors++;}const _errs336 = errors;let valid137 = true;const _errs337 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.type === undefined) && ("type")){const err323 = {};if(vErrors === null){vErrors = [err323];}else {vErrors.push(err323);}errors++;}else {if(data115.type !== undefined){if(!equal(data115.type, "camunda:out")){const err324 = {};if(vErrors === null){vErrors = [err324];}else {vErrors.push(err324);}errors++;}}}}var _valid30 = _errs337 === errors;errors = _errs336;if(vErrors !== null){if(_errs336){vErrors.length = _errs336;}else {vErrors = null;}}if(_valid30){const _errs339 = errors;const _errs340 = errors;let valid139 = false;let passing6 = null;const _errs341 = errors;const _errs342 = errors;const _errs343 = errors;const _errs344 = errors;let valid141 = false;const _errs345 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.source === undefined) && ("source")){const err325 = {};if(vErrors === null){vErrors = [err325];}else {vErrors.push(err325);}errors++;}}var _valid32 = _errs345 === errors;valid141 = valid141 || _valid32;if(!valid141){const _errs346 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.sourceExpression === undefined) && ("sourceExpression")){const err326 = {};if(vErrors === null){vErrors = [err326];}else {vErrors.push(err326);}errors++;}}var _valid32 = _errs346 === errors;valid141 = valid141 || _valid32;}if(!valid141){const err327 = {};if(vErrors === null){vErrors = [err327];}else {vErrors.push(err327);}errors++;}else {errors = _errs344;if(vErrors !== null){if(_errs344){vErrors.length = _errs344;}else {vErrors = null;}}}var valid140 = _errs343 === errors;if(!valid140){errors = _errs342;if(vErrors !== null){if(_errs342){vErrors.length = _errs342;}else {vErrors = null;}}}else {const err328 = {keyword:"not",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/0/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err328];}else {vErrors.push(err328);}errors++;}if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.variables === undefined){const err329 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/0/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err329];}else {vErrors.push(err329);}errors++;}}var _valid31 = _errs341 === errors;if(_valid31){valid139 = true;passing6 = 0;}const _errs347 = errors;const _errs348 = errors;const _errs349 = errors;const _errs350 = errors;let valid143 = false;const _errs351 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.variables === undefined) && ("variables")){const err330 = {};if(vErrors === null){vErrors = [err330];}else {vErrors.push(err330);}errors++;}}var _valid33 = _errs351 === errors;valid143 = valid143 || _valid33;if(!valid143){const _errs352 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.sourceExpression === undefined) && ("sourceExpression")){const err331 = {};if(vErrors === null){vErrors = [err331];}else {vErrors.push(err331);}errors++;}}var _valid33 = _errs352 === errors;valid143 = valid143 || _valid33;}if(!valid143){const err332 = {};if(vErrors === null){vErrors = [err332];}else {vErrors.push(err332);}errors++;}else {errors = _errs350;if(vErrors !== null){if(_errs350){vErrors.length = _errs350;}else {vErrors = null;}}}var valid142 = _errs349 === errors;if(!valid142){errors = _errs348;if(vErrors !== null){if(_errs348){vErrors.length = _errs348;}else {vErrors = null;}}}else {const err333 = {keyword:"not",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/1/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err333];}else {vErrors.push(err333);}errors++;}if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.source === undefined){const err334 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/1/required",params:{missingProperty: "source"},message:"should have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err334];}else {vErrors.push(err334);}errors++;}}var _valid31 = _errs347 === errors;if(_valid31 && valid139){valid139 = false;passing6 = [passing6, 1];}else {if(_valid31){valid139 = true;passing6 = 1;}const _errs353 = errors;const _errs354 = errors;const _errs355 = errors;const _errs356 = errors;let valid145 = false;const _errs357 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.variables === undefined) && ("variables")){const err335 = {};if(vErrors === null){vErrors = [err335];}else {vErrors.push(err335);}errors++;}}var _valid34 = _errs357 === errors;valid145 = valid145 || _valid34;if(!valid145){const _errs358 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.source === undefined) && ("source")){const err336 = {};if(vErrors === null){vErrors = [err336];}else {vErrors.push(err336);}errors++;}}var _valid34 = _errs358 === errors;valid145 = valid145 || _valid34;}if(!valid145){const err337 = {};if(vErrors === null){vErrors = [err337];}else {vErrors.push(err337);}errors++;}else {errors = _errs356;if(vErrors !== null){if(_errs356){vErrors.length = _errs356;}else {vErrors = null;}}}var valid144 = _errs355 === errors;if(!valid144){errors = _errs354;if(vErrors !== null){if(_errs354){vErrors.length = _errs354;}else {vErrors = null;}}}else {const err338 = {keyword:"not",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/2/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err338];}else {vErrors.push(err338);}errors++;}if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.sourceExpression === undefined){const err339 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/2/required",params:{missingProperty: "sourceExpression"},message:"should have required property '"+"sourceExpression"+"'"};if(vErrors === null){vErrors = [err339];}else {vErrors.push(err339);}errors++;}}var _valid31 = _errs353 === errors;if(_valid31 && valid139){valid139 = false;passing6 = [passing6, 2];}else {if(_valid31){valid139 = true;passing6 = 2;}const _errs359 = errors;const _errs360 = errors;const _errs361 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.source === undefined) && ("source")){const err340 = {};if(vErrors === null){vErrors = [err340];}else {vErrors.push(err340);}errors++;}}var valid146 = _errs361 === errors;if(!valid146){errors = _errs360;if(vErrors !== null){if(_errs360){vErrors.length = _errs360;}else {vErrors = null;}}}else {const err341 = {keyword:"not",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/3/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err341];}else {vErrors.push(err341);}errors++;}if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.variables === undefined){const err342 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/3/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err342];}else {vErrors.push(err342);}errors++;}if(data115.sourceExpression === undefined){const err343 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/3/required",params:{missingProperty: "sourceExpression"},message:"should have required property '"+"sourceExpression"+"'"};if(vErrors === null){vErrors = [err343];}else {vErrors.push(err343);}errors++;}}var _valid31 = _errs359 === errors;if(_valid31 && valid139){valid139 = false;passing6 = [passing6, 3];}else {if(_valid31){valid139 = true;passing6 = 3;}const _errs362 = errors;const _errs363 = errors;const _errs364 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.sourceExpression === undefined) && ("sourceExpression")){const err344 = {};if(vErrors === null){vErrors = [err344];}else {vErrors.push(err344);}errors++;}}var valid147 = _errs364 === errors;if(!valid147){errors = _errs363;if(vErrors !== null){if(_errs363){vErrors.length = _errs363;}else {vErrors = null;}}}else {const err345 = {keyword:"not",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/4/not",params:{},message:"should NOT be valid"};if(vErrors === null){vErrors = [err345];}else {vErrors.push(err345);}errors++;}if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.variables === undefined){const err346 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/4/required",params:{missingProperty: "variables"},message:"should have required property '"+"variables"+"'"};if(vErrors === null){vErrors = [err346];}else {vErrors.push(err346);}errors++;}if(data115.source === undefined){const err347 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf/4/required",params:{missingProperty: "source"},message:"should have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err347];}else {vErrors.push(err347);}errors++;}}var _valid31 = _errs362 === errors;if(_valid31 && valid139){valid139 = false;passing6 = [passing6, 4];}else {if(_valid31){valid139 = true;passing6 = 4;}}}}}if(!valid139){const err348 = {keyword:"oneOf",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/oneOf",params:{passingSchemas: passing6},message:"should match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err348];}else {vErrors.push(err348);}errors++;}else {errors = _errs340;if(vErrors !== null){if(_errs340){vErrors.length = _errs340;}else {vErrors = null;}}}if(errors > 0){const emErrs53 = [];for(const err349 of vErrors){if(((((err349.keyword !== "errorMessage") && (!err349.emUsed)) && ((err349.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") || ((err349.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") === 0) && (err349.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding".length] === "/")))) && (err349.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then") === 0)) && (err349.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then".length] === "/")){emErrs53.push(err349);err349.emUsed = true;}}if(emErrs53.length){const err350 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/then/errorMessage",params:{errors: emErrs53},message:"property.binding " + JSON.stringify(data115 && data115.type) + " requires one of the following: variables, sourceExpression, source, (sourceExpression and variables), or (source and variables)"};if(vErrors === null){vErrors = [err350];}else {vErrors.push(err350);}errors++;}const emErrs54 = [];for(const err351 of vErrors){if(!err351.emUsed){emErrs54.push(err351);}}vErrors = emErrs54;errors = emErrs54.length;}var _valid30 = _errs339 === errors;valid137 = _valid30;}if(!valid137){const err352 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/3/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err352];}else {vErrors.push(err352);}errors++;}const _errs366 = errors;let valid148 = true;const _errs367 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if((data115.type === undefined) && ("type")){const err353 = {};if(vErrors === null){vErrors = [err353];}else {vErrors.push(err353);}errors++;}else {if(data115.type !== undefined){if(!equal(data115.type, "camunda:errorEventDefinition")){const err354 = {};if(vErrors === null){vErrors = [err354];}else {vErrors.push(err354);}errors++;}}}}var _valid35 = _errs367 === errors;errors = _errs366;if(vErrors !== null){if(_errs366){vErrors.length = _errs366;}else {vErrors = null;}}if(_valid35){const _errs369 = errors;const _errs370 = errors;let valid150 = false;let passing7 = null;const _errs371 = errors;if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.errorRef === undefined){const err355 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then/oneOf/0/required",params:{missingProperty: "errorRef"},message:"should have required property '"+"errorRef"+"'"};if(vErrors === null){vErrors = [err355];}else {vErrors.push(err355);}errors++;}}var _valid36 = _errs371 === errors;if(_valid36){valid150 = true;passing7 = 0;}if(!valid150){const err356 = {keyword:"oneOf",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then/oneOf",params:{passingSchemas: passing7},message:"should match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err356];}else {vErrors.push(err356);}errors++;}else {errors = _errs370;if(vErrors !== null){if(_errs370){vErrors.length = _errs370;}else {vErrors = null;}}}if(errors > 0){const emErrs55 = [];for(const err357 of vErrors){if(((((err357.keyword !== "errorMessage") && (!err357.emUsed)) && ((err357.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") || ((err357.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding") === 0) && (err357.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding".length] === "/")))) && (err357.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then") === 0)) && (err357.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then".length] === "/")){emErrs55.push(err357);err357.emUsed = true;}}if(emErrs55.length){const err358 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/then/errorMessage",params:{errors: emErrs55},message:"property.binding " + JSON.stringify(data115 && data115.type) + " requires errorRef"};if(vErrors === null){vErrors = [err358];}else {vErrors.push(err358);}errors++;}const emErrs56 = [];for(const err359 of vErrors){if(!err359.emUsed){emErrs56.push(err359);}}vErrors = emErrs56;errors = emErrs56.length;}var _valid35 = _errs369 === errors;valid148 = _valid35;}if(!valid148){const err360 = {keyword:"if",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/4/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err360];}else {vErrors.push(err360);}errors++;}if(data115 && typeof data115 == "object" && !Array.isArray(data115)){if(data115.type === undefined){const err361 = {keyword:"required",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/required",params:{missingProperty: "type"},message:"should have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err361];}else {vErrors.push(err361);}errors++;}if(data115.type !== undefined){let data121 = data115.type;if(typeof data121 !== "string"){const err362 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err362];}else {vErrors.push(err362);}errors++;}if(!((((((((((data121 === "property") || (data121 === "camunda:property")) || (data121 === "camunda:inputParameter")) || (data121 === "camunda:outputParameter")) || (data121 === "camunda:in")) || (data121 === "camunda:out")) || (data121 === "camunda:in:businessKey")) || (data121 === "camunda:executionListener")) || (data121 === "camunda:field")) || (data121 === "camunda:errorEventDefinition"))){const err363 = {keyword:"enum",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/enum",params:{allowedValues: schema20.items.properties.binding.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err363];}else {vErrors.push(err363);}errors++;}if(errors > 0){const emErrs57 = [];for(const err364 of vErrors){if(((((err364.keyword !== "errorMessage") && (!err364.emUsed)) && ((err364.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/type") || ((err364.dataPath.indexOf(dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/type") === 0) && (err364.dataPath[dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/type".length] === "/")))) && (err364.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/properties/type") === 0)) && (err364.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/properties/type".length] === "/")){emErrs57.push(err364);err364.emUsed = true;}}if(emErrs57.length){const err365 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/errorMessage",params:{errors: emErrs57},message:"invalid property.binding type " + JSON.stringify(data121) + "; must be any of { property, camunda:property, camunda:inputParameter, camunda:outputParameter, camunda:in, camunda:out, camunda:in:businessKey, camunda:executionListener, camunda:field, camunda:errorEventDefinition }"};if(vErrors === null){vErrors = [err365];}else {vErrors.push(err365);}errors++;}const emErrs58 = [];for(const err366 of vErrors){if(!err366.emUsed){emErrs58.push(err366);}}vErrors = emErrs58;errors = emErrs58.length;}}if(data115.name !== undefined){if(typeof data115.name !== "string"){const err367 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/name",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/name/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err367];}else {vErrors.push(err367);}errors++;}}if(data115.event !== undefined){if(typeof data115.event !== "string"){const err368 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/event",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/event/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err368];}else {vErrors.push(err368);}errors++;}}if(data115.scriptFormat !== undefined){if(typeof data115.scriptFormat !== "string"){const err369 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/scriptFormat",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/scriptFormat/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err369];}else {vErrors.push(err369);}errors++;}}if(data115.source !== undefined){if(typeof data115.source !== "string"){const err370 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/source",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/source/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err370];}else {vErrors.push(err370);}errors++;}}if(data115.target !== undefined){if(typeof data115.target !== "string"){const err371 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/target",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/target/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err371];}else {vErrors.push(err371);}errors++;}}if(data115.expression !== undefined){if(typeof data115.expression !== "boolean"){const err372 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/expression",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/expression/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err372];}else {vErrors.push(err372);}errors++;}}if(data115.variables !== undefined){let data128 = data115.variables;if(typeof data128 !== "string"){const err373 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/variables",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/variables/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err373];}else {vErrors.push(err373);}errors++;}if(!((data128 === "all") || (data128 === "local"))){const err374 = {keyword:"enum",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/variables",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/variables/enum",params:{allowedValues: schema20.items.properties.binding.properties.variables.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err374];}else {vErrors.push(err374);}errors++;}}if(data115.sourceExpression !== undefined){if(typeof data115.sourceExpression !== "string"){const err375 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding/sourceExpression",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/sourceExpression/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err375];}else {vErrors.push(err375);}errors++;}}}else {const err376 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err376];}else {vErrors.push(err376);}errors++;}}}else {const err377 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10,schemaPath:"#/definitions/properties/allOf/1/items/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err377];}else {vErrors.push(err377);}errors++;}if(errors > 0){const emErrors11 = {"required":[]};const templates11 = {required:function(){return "missing binding for property \"" + JSON.stringify(i10) + "\""}};for(const err378 of vErrors){if((((((err378.keyword !== "errorMessage") && (!err378.emUsed)) && (err378.dataPath === dataPath+"/scopes/" + i6+"/properties/" + i10)) && (err378.keyword in emErrors11)) && (err378.schemaPath.indexOf("#/definitions/properties/allOf/1/items") === 0)) && (/^\/[^\/]*$/.test(err378.schemaPath.slice(38)))){emErrors11[err378.keyword].push(err378);err378.emUsed = true;}}for(const key11 in emErrors11){if(emErrors11[key11].length){const err379 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6+"/properties/" + i10,schemaPath:"#/definitions/properties/allOf/1/items/errorMessage",params:{errors: emErrors11[key11]},message:key11 in templates11 ? templates11[key11]() : schema20.items.errorMessage[key11]};if(vErrors === null){vErrors = [err379];}else {vErrors.push(err379);}errors++;}}const emErrs59 = [];for(const err380 of vErrors){if(!err380.emUsed){emErrs59.push(err380);}}vErrors = emErrs59;errors = emErrs59.length;}}}else {const err381 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6+"/properties",schemaPath:"#/definitions/properties/allOf/1/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err381];}else {vErrors.push(err381);}errors++;}}}else {const err382 = {keyword:"type",dataPath:dataPath+"/scopes/" + i6,schemaPath:"#/properties/scopes/items/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err382];}else {vErrors.push(err382);}errors++;}if(errors > 0){const emErrors12 = {"required":{"type":[],"properties":[]}};const templates12 = {required:{properties:function(){return "invalid scope " + JSON.stringify(data72 && data72.type) + ", missing properties=[]"}}};let emPropParams5;let emParamsErrors5;for(const err383 of vErrors){if((((((err383.keyword !== "errorMessage") && (!err383.emUsed)) && (err383.dataPath === dataPath+"/scopes/" + i6)) && (err383.keyword in emErrors12)) && (err383.schemaPath.indexOf("#/properties/scopes/items") === 0)) && (/^\/[^\/]*$/.test(err383.schemaPath.slice(25)))){emPropParams5 = obj0$1[err383.keyword];emParamsErrors5 = emErrors12[err383.keyword][err383.params[emPropParams5]];if(emParamsErrors5){emParamsErrors5.push(err383);err383.emUsed = true;}}}for(const key12 in emErrors12){for(const keyProp5 in emErrors12[key12]){emParamsErrors5 = emErrors12[key12][keyProp5];if(emParamsErrors5.length){const tmpl5 = templates12[key12] && templates12[key12][keyProp5];const err384 = {keyword:"errorMessage",dataPath:dataPath+"/scopes/" + i6,schemaPath:"#/properties/scopes/items/errorMessage",params:{errors: emParamsErrors5},message:tmpl5 ? tmpl5() : schema17$1.properties.scopes.items.errorMessage[key12][keyProp5]};if(vErrors === null){vErrors = [err384];}else {vErrors.push(err384);}errors++;}}}const emErrs60 = [];for(const err385 of vErrors){if(!err385.emUsed){emErrs60.push(err385);}}vErrors = emErrs60;errors = emErrs60.length;}}}else {const err386 = {keyword:"type",dataPath:dataPath+"/scopes",schemaPath:"#/properties/scopes/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err386];}else {vErrors.push(err386);}errors++;}}}else {const err387 = {keyword:"type",dataPath,schemaPath:"#/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err387];}else {vErrors.push(err387);}errors++;}validate15$1.errors = vErrors;return errors === 0;}function validate14$1(data, {dataPath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;const _errs0 = errors;let valid0 = false;let passing0 = null;const _errs1 = errors;if(!(validate15$1(data, {dataPath,parentData,parentDataProperty,rootData}))){vErrors = vErrors === null ? validate15$1.errors : vErrors.concat(validate15$1.errors);errors = vErrors.length;}var _valid0 = _errs1 === errors;if(_valid0){valid0 = true;passing0 = 0;}const _errs2 = errors;if(Array.isArray(data)){const len0 = data.length;for(let i0=0; i0= 0) + data = parseNumber(); + else + unexpectedToken(); + } + map(ptr, 'valueEnd'); + whitespace(); + if (topLevel && pos < source.length) unexpectedToken(); + return data; + } + + function whitespace() { + loop: + while (pos < source.length) { + switch (source[pos]) { + case ' ': column++; break; + case '\t': column += 4; break; + case '\r': column = 0; break; + case '\n': column = 0; line++; break; + default: break loop; + } + pos++; + } + } + + function parseString() { + var str = ''; + var char; + while (true) { + char = getChar(); + if (char == '"') { + break; + } else if (char == '\\') { + char = getChar(); + if (char in escapedChars) + str += escapedChars[char]; + else if (char == 'u') + str += getCharCode(); + else + wasUnexpectedToken(); + } else { + str += char; + } + } + return str; + } + + function parseNumber() { + var numStr = ''; + var integer = true; + if (source[pos] == '-') numStr += getChar(); + + numStr += source[pos] == '0' + ? getChar() + : getDigits(); + + if (source[pos] == '.') { + numStr += getChar() + getDigits(); + integer = false; + } + + if (source[pos] == 'e' || source[pos] == 'E') { + numStr += getChar(); + if (source[pos] == '+' || source[pos] == '-') numStr += getChar(); + numStr += getDigits(); + integer = false; + } + + var result = +numStr; + return bigint && integer && (result > Number.MAX_SAFE_INTEGER || result < Number.MIN_SAFE_INTEGER) + ? BigInt(numStr) + : result; + } + + function parseArray(ptr) { + whitespace(); + var arr = []; + var i = 0; + if (getChar() == ']') return arr; + backChar(); + + while (true) { + var itemPtr = ptr + '/' + i; + arr.push(_parse(itemPtr)); + whitespace(); + var char = getChar(); + if (char == ']') break; + if (char != ',') wasUnexpectedToken(); + whitespace(); + i++; + } + return arr; + } + + function parseObject(ptr) { + whitespace(); + var obj = {}; + if (getChar() == '}') return obj; + backChar(); + + while (true) { + var loc = getLoc(); + if (getChar() != '"') wasUnexpectedToken(); + var key = parseString(); + var propPtr = ptr + '/' + escapeJsonPointer(key); + mapLoc(propPtr, 'key', loc); + map(propPtr, 'keyEnd'); + whitespace(); + if (getChar() != ':') wasUnexpectedToken(); + whitespace(); + obj[key] = _parse(propPtr); + whitespace(); + var char = getChar(); + if (char == '}') break; + if (char != ',') wasUnexpectedToken(); + whitespace(); + } + return obj; + } + + function read(str) { + for (var i=0; i= 'a' && char <= 'f') + code += char.charCodeAt() - A_CODE + 10; + else if (char >= '0' && char <= '9') + code += +char; + else + wasUnexpectedToken(); + } + return String.fromCharCode(code); + } + + function getDigits() { + var digits = ''; + while (source[pos] >= '0' && source[pos] <= '9') + digits += getChar(); + + if (digits.length) return digits; + checkUnexpectedEnd(); + unexpectedToken(); + } + + function map(ptr, prop) { + mapLoc(ptr, prop, getLoc()); + } + + function mapLoc(ptr, prop, loc) { + pointers[ptr] = pointers[ptr] || {}; + pointers[ptr][prop] = loc; + } + + function getLoc() { + return { + line: line, + column: column, + pos: pos + }; + } + + function unexpectedToken() { + throw new SyntaxError('Unexpected token ' + source[pos] + ' in JSON at position ' + pos); + } + + function wasUnexpectedToken() { + backChar(); + unexpectedToken(); + } + + function checkUnexpectedEnd() { + if (pos >= source.length) + throw new SyntaxError('Unexpected end of JSON input'); + } +}; + + +var stringify = function (data, _, options) { + if (!validType(data)) return; + var wsLine = 0; + var wsPos, wsColumn; + var whitespace = typeof options == 'object' + ? options.space + : options; + switch (typeof whitespace) { + case 'number': + var len = whitespace > 10 + ? 10 + : whitespace < 0 + ? 0 + : Math.floor(whitespace); + whitespace = len && repeat(len, ' '); + wsPos = len; + wsColumn = len; + break; + case 'string': + whitespace = whitespace.slice(0, 10); + wsPos = 0; + wsColumn = 0; + for (var j=0; j= 0; +} + + +var ESC_QUOTE = /"|\\/g; +var ESC_B = /[\b]/g; +var ESC_F = /\f/g; +var ESC_N = /\n/g; +var ESC_R = /\r/g; +var ESC_T = /\t/g; +function quoted(str) { + str = str.replace(ESC_QUOTE, '\\$&') + .replace(ESC_F, '\\f') + .replace(ESC_B, '\\b') + .replace(ESC_N, '\\n') + .replace(ESC_R, '\\r') + .replace(ESC_T, '\\t'); + return '"' + str + '"'; +} + + +var ESC_0 = /~/g; +var ESC_1 = /\//g; +function escapeJsonPointer(str) { + return str.replace(ESC_0, '~0') + .replace(ESC_1, '~1'); +} + +var jsonSourceMap = { + parse: parse, + stringify: stringify +}; + +function _validate(object, validateFn) { + const dataPointerMap = generateDataPointerMap(object); + + const valid = validateFn(object); + + let errors = validateFn.errors; + + if (errors && errors.length) { + + // @pinussilvestrus: the extensions produces a couple of + // unnecessary errors when using an attribute. + // Therefore, we should flatten the produced errors a bit to not + // confuse the consumer of this library. + + // (1) wrap raw errors in case of custom errorMessage attribute + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.forEach)(errors, wrapRawErrors); + + // (2) ignore supportive error messages (e.g. "if-then-rules") + errors = ignoreSupportiveErrors(errors); + + // (3) set data pointer for each error + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.forEach)(errors, function(error) { + setDataPointer(error, dataPointerMap); + }); + } + + return { + valid: valid, + object: object, + errors: errors + }; +} + +function _validateAll(objects, validateFn) { + + const results = []; + + let allValid = true; + + (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.forEach)(objects, function(object) { + const result = validateFn(object); + + if (!result.valid) { + allValid = false; + } + + results.push(result); + }); + + return { + valid: allValid, + results: results + }; +} + + +// helper ////////////// +function wrapRawErrors(error) { + const params = error.params; + + if (params && params.errors) { + params.rawErrors = params.errors; + delete params.errors; + } +} + +function setDataPointer(error, dataPointerMap) { + const dataPath = error.dataPath; + + const pointer = dataPointerMap[dataPath]; + + error.dataPointer = pointer; +} + +function ignoreSupportiveErrors(errors) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_0__.filter)(errors, function(error) { + return error.keyword !== 'if'; + }); +} + +/** + * Generates a key-pointer map for the object. + * + * Example: + * + * { + * foo: 'bar' + * } + * + * => + * + * { + * '': { + * value: { line: 0, column: 0, pos: 0 }, + * valueEnd: { line: 2, column: 1, pos: 18 } + * }, + * '/foo': { + * key: { line: 1, column: 2, pos: 4 }, + * keyEnd: { line: 1, column: 7, pos: 9 }, + * value: { line: 1, column: 9, pos: 11 }, + * valueEnd: { line: 1, column: 14, pos: 16 } + * } + * } + * + * @param {Object} object + * @return {Object} + */ +function generateDataPointerMap(object) { + return jsonSourceMap.stringify(object, null, 2).pointers; +} + +function getSchemaVersion() { + return version$1; +} + +function getSchemaPackage() { + return name$1; +} + +/** + * Validate a single object. + * + * @param {Object} object + * @return {Object} single object validation result + */ +function validate(object) { + return _validate(object, standaloneValidator); +} + +/** + * Validate a list of objects + * + * @param {Object[]} objects + * @return {Object} list validation result + */ +function validateAll(objects) { + return _validateAll(objects, validate); +} + +var name = "@camunda/zeebe-element-templates-json-schema"; +var version = "0.5.0"; + +var standaloneZeebeValidator = validate14;var _default = validate14;const schema17 = {"type":"object","allOf":[{"required":["name","id","appliesTo","properties"],"properties":{"name":{"$id":"#/name","type":"string","description":"The name of the element template."},"id":{"$id":"#/id","type":"string","description":"The identifier of the element template."},"description":{"$id":"#/description","type":"string","description":"The description of the element template."},"version":{"$id":"#/version","type":"number","description":"Optional version of the template. If you add a version to a template it will be considered unique based on its ID and version. Two templates can have the same ID if their version is different."},"isDefault":{"$id":"#/isDefault","type":"boolean","description":"Indicates whether the element template is a default template."},"appliesTo":{"$id":"#/appliesTo","type":"array","description":"List of BPMN types the template can be applied to.","default":[],"items":{"$id":"#/appliesTo/items","type":"string","pattern":"^[\\w\\d]+:[\\w\\d]+$","allOf":[{"examples":["bpmn:Task","bpmn:ServiceTask","bpmn:SequenceFlow","bpmn:Process","bpmn:StartEvent","bpmn:Gateway"]}],"errorMessage":{"pattern":"invalid item for \"appliesTo\", should contain namespaced property, example: \"bpmn:Task\""}}},"elementType":{"$id":"#/elementType","type":"object","description":"The BPMN type the element will be transformed into.","default":{},"required":["value"],"properties":{"value":{"$id":"#/elementType/value","type":"string","pattern":"^[\\w\\d]+:[\\w\\d]+$","allOf":[{"examples":["bpmn:ServiceTask","bpmn:UserTask","bpmn:StartEvent","bpmn:ExclusiveGateway","bpmn:ParallelGateway"]}],"errorMessage":{"pattern":"invalid item for \"elementType\", should contain namespaced property, example: \"bpmn:Task\""}}},"errorMessage":{"required":{"value":"missing elementType value"}}},"metadata":{"$id":"#/metadata","type":"object","description":"Some custom properties for further configuration.","default":{}},"entriesVisible":{"$id":"#/entriesVisible","type":"boolean","description":"Select whether non-template entries are visible in the properties panel."},"groups":{"$id":"#/groups","type":"array","description":"Custom fields can be ordered together via groups.","allOf":[{"examples":[[{"id":"group-1","label":"My Group"}]]}],"items":{"$id":"#/groups/group","type":"object","default":{},"required":["id","label"],"properties":{"id":{"$id":"#/groups/group/id","type":"string","description":"The id of the custom group"},"label":{"$id":"#/groups/group/label","type":"string","description":"The label of the custom group"}},"errorMessage":{"required":{"id":"missing id for group \"${0#}\"","label":"missing label for group \"${0#}\""}}}},"documentationRef":{"$id":"#/documentationRef","type":"string","pattern":"^(https|http)://.*","errorMessage":{"pattern":"Malformed documentation URL, must match \"^(https|http)://.*\""}}},"errorMessage":{"required":{"name":"missing template name","id":"missing template id","appliesTo":"missing appliesTo=[]","properties":"missing properties=[]"}}}],"properties":{"properties":{"$ref":"#/definitions/properties","$id":"#/properties"},"icon":{"$id":"#/icon","type":"object","description":"Custom icon to be shown on the element","default":{},"properties":{"contents":{"$id":"#/icon/contents","type":"string","description":"The URL of an icon.","pattern":"^(https?|data):.*","errorMessage":{"pattern":"Malformed icon source, must be a valid HTTP(s) or data URL"}}},"required":["contents"],"errorMessage":{"required":{"contents":"missing icon contents"}}}}};const schema18 = {"allOf":[{"type":"array","description":"List of properties of the element template.","allOf":[{"examples":[[{"label":"Name","type":"String","binding":{"type":"property","name":"name"}}]]}],"items":{"type":"object","default":{},"allOf":[{"if":{"properties":{"type":{"const":"Dropdown"}},"required":["type"]},"then":{"required":["choices"],"errorMessage":"must provide choices=[] with \"Dropdown\" type"}}],"properties":{"id":{"type":"string","description":"Unique identifier of the property."},"value":{"$id":"#/properties/property/value","type":["string","boolean"],"description":"The value of a control field."},"description":{"$id":"#/properties/property/description","type":"string","description":"The description of a control field."},"label":{"$id":"#/properties/property/label","type":"string","description":"The label of a control field."},"type":{"$id":"#/properties/property/type","type":"string","description":"The type of a control field."},"editable":{"$id":"#/properties/property/editable","type":"boolean","description":"Indicates whether a control field is editable or not."},"choices":{"$id":"#/properties/property/choices","type":"array","description":"The choices for dropdown fields.","default":[],"items":{"$id":"#/properties/property/choices/item","type":"object","default":{},"properties":{"name":{"$id":"#/properties/property/choices/item/name","type":"string","description":"The name of a choice."},"value":{"$id":"#/properties/property/choices/item/value","type":"string","description":"The value of a choice."}},"required":["value","name"],"errorMessage":{"required":"{ name, value } must be specified for \"Dropdown\" choices"}}},"constraints":{"$id":"#/properties/property/constraints","type":"object","description":"The validation constraints of a control field.","allOf":[{"examples":[{"notEmpty":true}]}],"properties":{"notEmpty":{"$id":"#/properties/property/constraints/notEmpty","type":"boolean","description":"The control field must not be empty."},"minLength":{"$id":"#/properties/property/constraints/minLength","type":"number","description":"The minimal length of a control field value."},"maxLength":{"$id":"#/properties/property/constraints/maxLength","type":"number","description":"The maximal length for a control field value."},"pattern":{"$id":"#/properties/property/constraints/pattern","description":"A regular expression pattern for a constraint.","oneOf":[{"type":"object","default":{},"properties":{"value":{"$id":"#/properties/property/constraints/pattern/value","type":"string","description":"The regular expression of a pattern."},"message":{"$id":"#/properties/property/constraints/pattern/message","type":"string","description":"The validation message of a pattern."}}},{"type":"string"}]}}},"group":{"$id":"#/properties/property/group","type":"string","description":"The custom group of a control field."},"condition":{"$id":"#/condition","type":"object","description":"Condition to activate the binding.","allOf":[{"examples":[{"type":"simple","property":"httpMethod","equals":"GET"},{"type":"simple","property":"httpMethod","oneOf":["POST","PUT","DELETE"]}]}],"required":["property"],"properties":{"type":{"$id":"#/condition/type","const":"simple","description":"The type of the condition.","default":"simple"},"property":{"$id":"#/condition/property","type":"string","description":"The id of the property to check."}},"oneOf":[{"properties":{"equals":{"type":["string","number","boolean"]}},"required":["equals"]},{"properties":{"oneOf":{"type":"array","items":{"type":["string","number"]}}},"required":["oneOf"]}],"errorMessage":{"required":{"property":"missing property name for condition"}}}}}},{"$schema":"http://json-schema.org/draft-07/schema","type":"array","description":"List of properties of the element template.","items":{"type":"object","default":{},"required":["binding"],"allOf":[{"if":{"properties":{"binding":{"properties":{"type":{"const":"property"}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Text","Hidden","Dropdown","Boolean"],"errorMessage":"invalid property type ${0} for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean }"}}}},{"if":{"properties":{"binding":{"properties":{"type":{"enum":["zeebe:input","zeebe:output","zeebe:taskHeader","zeebe:taskDefinition:type"]}},"required":["type"]}},"required":["binding"]},"then":{"properties":{"type":{"enum":["String","Text","Hidden","Dropdown"],"errorMessage":"invalid property type ${0} for binding type ${1/binding/type}; must be any of { String, Text, Hidden, Dropdown }"}}}},{"if":{"properties":{"optional":{"const":true}},"required":["optional"]},"then":{"properties":{"binding":{"properties":{"type":{"enum":["zeebe:input","zeebe:output"],"errorMessage":"optional is not supported for binding type ${0}; must be any of { zeebe:input, zeebe:output }"}},"required":["type"]}}}},{"if":{"properties":{"optional":{"const":true}},"required":["optional"]},"then":{"properties":{"constraints":{"properties":{"notEmpty":{"const":false,"errorMessage":"optional is not allowed for truthy \"notEmpty\" constraint"}},"required":["notEmpty"]}}}},{"if":{"properties":{"feel":{"not":{"const":null}}},"required":["feel"]},"then":{"properties":{"type":{"enum":["String","Text"],"errorMessage":"feel is only supported for \"String\" and \"Text\" type"}},"required":["type"]}}],"properties":{"binding":{"$id":"#/properties/property/binding","type":"object","description":"Specifying how the property is mapped to BPMN or Zeebe extension elements and attributes.","required":["type"],"allOf":[{"if":{"properties":{"type":{"enum":["property","zeebe:input"]}},"required":["type"]},"then":{"required":["name"],"errorMessage":"property.binding ${0/type} requires name"}},{"if":{"properties":{"type":{"const":"zeebe:output"}},"required":["type"]},"then":{"required":["source"],"errorMessage":"property.binding ${0/type} requires source"}},{"if":{"properties":{"type":{"const":"zeebe:taskHeader"}},"required":["type"]},"then":{"required":["key"],"errorMessage":"property.binding ${0/type} requires key"}},{"examples":[{"type":"property","name":"name"},{"type":"zeebe:input","name":"input"},{"type":"zeebe:output","source":"output"},{"type":"zeebe:taskDefinition:type"},{"type":"zeebe:taskHeader","key":"key"}]}],"properties":{"type":{"$id":"#/properties/property/binding/type","type":"string","description":"The type of a property binding.","enum":["property","zeebe:taskDefinition:type","zeebe:input","zeebe:output","zeebe:taskHeader"],"errorMessage":"invalid property.binding type ${0}; must be any of { property, zeebe:taskDefinition:type, zeebe:input, zeebe:output, zeebe:taskHeader }"},"name":{"$id":"#/properties/property/binding/name","type":"string","description":"The name of a property binding."},"source":{"$id":"#/properties/property/binding/source","type":"string","description":"The source value of a property binding (zeebe:output)."},"key":{"$id":"#/properties/property/binding/key","type":"string","description":"The key value of a property binding (zeebe:taskHeader)."}}},"optional":{"$id":"#/optional","type":"boolean","description":"Indicates whether a property is optional. Optional bindings do not persist empty values in the underlying BPMN 2.0 XML."},"feel":{"$id":"#/properties/property/feel","type":"string","default":null,"description":"Indicates whether the property can be a feel expression","enum":[null,"optional","required"]}},"errorMessage":{"required":{"binding":"missing binding for property \"${0#}\""}}}}]};const pattern0 = new RegExp("^[\\w\\d]+:[\\w\\d]+$", "u");const pattern2 = new RegExp("^(https|http)://.*", "u");const pattern3 = new RegExp("^(https?|data):.*", "u");const obj0 = {"required":"missingProperty","dependencies":"property","dependentRequired":"property"};function validate15(data, {dataPath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(data && typeof data == "object" && !Array.isArray(data)){if(data.name === undefined){const err0 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "name"},message:"should have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}if(data.id === undefined){const err1 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "id"},message:"should have required property '"+"id"+"'"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}if(data.appliesTo === undefined){const err2 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "appliesTo"},message:"should have required property '"+"appliesTo"+"'"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;}if(data.properties === undefined){const err3 = {keyword:"required",dataPath,schemaPath:"#/allOf/0/required",params:{missingProperty: "properties"},message:"should have required property '"+"properties"+"'"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}if(data.name !== undefined){if(typeof data.name !== "string"){const err4 = {keyword:"type",dataPath:dataPath+"/name",schemaPath:"#/allOf/0/properties/name/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}}if(data.id !== undefined){if(typeof data.id !== "string"){const err5 = {keyword:"type",dataPath:dataPath+"/id",schemaPath:"#/allOf/0/properties/id/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;}}if(data.description !== undefined){if(typeof data.description !== "string"){const err6 = {keyword:"type",dataPath:dataPath+"/description",schemaPath:"#/allOf/0/properties/description/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}}if(data.version !== undefined){if(!(typeof data.version == "number")){const err7 = {keyword:"type",dataPath:dataPath+"/version",schemaPath:"#/allOf/0/properties/version/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}}if(data.isDefault !== undefined){if(typeof data.isDefault !== "boolean"){const err8 = {keyword:"type",dataPath:dataPath+"/isDefault",schemaPath:"#/allOf/0/properties/isDefault/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;}}if(data.appliesTo !== undefined){let data5 = data.appliesTo;if(Array.isArray(data5)){const len0 = data5.length;for(let i0=0; i0 0){const emErrors0 = {"pattern":[]};const templates0 = {};for(const err11 of vErrors){if((((((err11.keyword !== "errorMessage") && (!err11.emUsed)) && (err11.dataPath === dataPath+"/appliesTo/" + i0)) && (err11.keyword in emErrors0)) && (err11.schemaPath.indexOf("#/allOf/0/properties/appliesTo/items") === 0)) && (/^\/[^\/]*$/.test(err11.schemaPath.slice(36)))){emErrors0[err11.keyword].push(err11);err11.emUsed = true;}}for(const key0 in emErrors0){if(emErrors0[key0].length){const err12 = {keyword:"errorMessage",dataPath:dataPath+"/appliesTo/" + i0,schemaPath:"#/allOf/0/properties/appliesTo/items/errorMessage",params:{errors: emErrors0[key0]},message:key0 in templates0 ? templates0[key0]() : schema17.allOf[0].properties.appliesTo.items.errorMessage[key0]};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}}const emErrs0 = [];for(const err13 of vErrors){if(!err13.emUsed){emErrs0.push(err13);}}vErrors = emErrs0;errors = emErrs0.length;}}}else {const err14 = {keyword:"type",dataPath:dataPath+"/appliesTo",schemaPath:"#/allOf/0/properties/appliesTo/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;}}if(data.elementType !== undefined){let data7 = data.elementType;if(data7 && typeof data7 == "object" && !Array.isArray(data7)){if(data7.value === undefined){const err15 = {keyword:"required",dataPath:dataPath+"/elementType",schemaPath:"#/allOf/0/properties/elementType/required",params:{missingProperty: "value"},message:"should have required property '"+"value"+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;}if(data7.value !== undefined){let data8 = data7.value;if(typeof data8 === "string"){if(!pattern0.test(data8)){const err16 = {keyword:"pattern",dataPath:dataPath+"/elementType/value",schemaPath:"#/allOf/0/properties/elementType/properties/value/pattern",params:{pattern: "^[\\w\\d]+:[\\w\\d]+$"},message:"should match pattern \""+"^[\\w\\d]+:[\\w\\d]+$"+"\""};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}}else {const err17 = {keyword:"type",dataPath:dataPath+"/elementType/value",schemaPath:"#/allOf/0/properties/elementType/properties/value/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}if(errors > 0){const emErrors1 = {"pattern":[]};const templates1 = {};for(const err18 of vErrors){if((((((err18.keyword !== "errorMessage") && (!err18.emUsed)) && (err18.dataPath === dataPath+"/elementType/value")) && (err18.keyword in emErrors1)) && (err18.schemaPath.indexOf("#/allOf/0/properties/elementType/properties/value") === 0)) && (/^\/[^\/]*$/.test(err18.schemaPath.slice(49)))){emErrors1[err18.keyword].push(err18);err18.emUsed = true;}}for(const key1 in emErrors1){if(emErrors1[key1].length){const err19 = {keyword:"errorMessage",dataPath:dataPath+"/elementType/value",schemaPath:"#/allOf/0/properties/elementType/properties/value/errorMessage",params:{errors: emErrors1[key1]},message:key1 in templates1 ? templates1[key1]() : schema17.allOf[0].properties.elementType.properties.value.errorMessage[key1]};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}}const emErrs1 = [];for(const err20 of vErrors){if(!err20.emUsed){emErrs1.push(err20);}}vErrors = emErrs1;errors = emErrs1.length;}}}else {const err21 = {keyword:"type",dataPath:dataPath+"/elementType",schemaPath:"#/allOf/0/properties/elementType/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}if(errors > 0){const emErrors2 = {"required":{"value":[]}};const templates2 = {required:{}};let emPropParams0;let emParamsErrors0;for(const err22 of vErrors){if((((((err22.keyword !== "errorMessage") && (!err22.emUsed)) && (err22.dataPath === dataPath+"/elementType")) && (err22.keyword in emErrors2)) && (err22.schemaPath.indexOf("#/allOf/0/properties/elementType") === 0)) && (/^\/[^\/]*$/.test(err22.schemaPath.slice(32)))){emPropParams0 = obj0[err22.keyword];emParamsErrors0 = emErrors2[err22.keyword][err22.params[emPropParams0]];if(emParamsErrors0){emParamsErrors0.push(err22);err22.emUsed = true;}}}for(const key2 in emErrors2){for(const keyProp0 in emErrors2[key2]){emParamsErrors0 = emErrors2[key2][keyProp0];if(emParamsErrors0.length){const tmpl0 = templates2[key2] && templates2[key2][keyProp0];const err23 = {keyword:"errorMessage",dataPath:dataPath+"/elementType",schemaPath:"#/allOf/0/properties/elementType/errorMessage",params:{errors: emParamsErrors0},message:tmpl0 ? tmpl0() : schema17.allOf[0].properties.elementType.errorMessage[key2][keyProp0]};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}}const emErrs2 = [];for(const err24 of vErrors){if(!err24.emUsed){emErrs2.push(err24);}}vErrors = emErrs2;errors = emErrs2.length;}}if(data.metadata !== undefined){let data9 = data.metadata;if(!(data9 && typeof data9 == "object" && !Array.isArray(data9))){const err25 = {keyword:"type",dataPath:dataPath+"/metadata",schemaPath:"#/allOf/0/properties/metadata/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}}if(data.entriesVisible !== undefined){if(typeof data.entriesVisible !== "boolean"){const err26 = {keyword:"type",dataPath:dataPath+"/entriesVisible",schemaPath:"#/allOf/0/properties/entriesVisible/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;}}if(data.groups !== undefined){let data11 = data.groups;if(Array.isArray(data11)){const len1 = data11.length;for(let i1=0; i1 0){const emErrors3 = {"required":{"id":[],"label":[]}};const templates3 = {required:{id:function(){return "missing id for group \"" + JSON.stringify(i1) + "\""},label:function(){return "missing label for group \"" + JSON.stringify(i1) + "\""}}};let emPropParams1;let emParamsErrors1;for(const err32 of vErrors){if((((((err32.keyword !== "errorMessage") && (!err32.emUsed)) && (err32.dataPath === dataPath+"/groups/" + i1)) && (err32.keyword in emErrors3)) && (err32.schemaPath.indexOf("#/allOf/0/properties/groups/items") === 0)) && (/^\/[^\/]*$/.test(err32.schemaPath.slice(33)))){emPropParams1 = obj0[err32.keyword];emParamsErrors1 = emErrors3[err32.keyword][err32.params[emPropParams1]];if(emParamsErrors1){emParamsErrors1.push(err32);err32.emUsed = true;}}}for(const key3 in emErrors3){for(const keyProp1 in emErrors3[key3]){emParamsErrors1 = emErrors3[key3][keyProp1];if(emParamsErrors1.length){const tmpl1 = templates3[key3] && templates3[key3][keyProp1];const err33 = {keyword:"errorMessage",dataPath:dataPath+"/groups/" + i1,schemaPath:"#/allOf/0/properties/groups/items/errorMessage",params:{errors: emParamsErrors1},message:tmpl1 ? tmpl1() : schema17.allOf[0].properties.groups.items.errorMessage[key3][keyProp1]};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}}}const emErrs3 = [];for(const err34 of vErrors){if(!err34.emUsed){emErrs3.push(err34);}}vErrors = emErrs3;errors = emErrs3.length;}}}else {const err35 = {keyword:"type",dataPath:dataPath+"/groups",schemaPath:"#/allOf/0/properties/groups/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;}}if(data.documentationRef !== undefined){let data15 = data.documentationRef;if(typeof data15 === "string"){if(!pattern2.test(data15)){const err36 = {keyword:"pattern",dataPath:dataPath+"/documentationRef",schemaPath:"#/allOf/0/properties/documentationRef/pattern",params:{pattern: "^(https|http)://.*"},message:"should match pattern \""+"^(https|http)://.*"+"\""};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}}else {const err37 = {keyword:"type",dataPath:dataPath+"/documentationRef",schemaPath:"#/allOf/0/properties/documentationRef/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}if(errors > 0){const emErrors4 = {"pattern":[]};const templates4 = {};for(const err38 of vErrors){if((((((err38.keyword !== "errorMessage") && (!err38.emUsed)) && (err38.dataPath === dataPath+"/documentationRef")) && (err38.keyword in emErrors4)) && (err38.schemaPath.indexOf("#/allOf/0/properties/documentationRef") === 0)) && (/^\/[^\/]*$/.test(err38.schemaPath.slice(37)))){emErrors4[err38.keyword].push(err38);err38.emUsed = true;}}for(const key4 in emErrors4){if(emErrors4[key4].length){const err39 = {keyword:"errorMessage",dataPath:dataPath+"/documentationRef",schemaPath:"#/allOf/0/properties/documentationRef/errorMessage",params:{errors: emErrors4[key4]},message:key4 in templates4 ? templates4[key4]() : schema17.allOf[0].properties.documentationRef.errorMessage[key4]};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}}const emErrs4 = [];for(const err40 of vErrors){if(!err40.emUsed){emErrs4.push(err40);}}vErrors = emErrs4;errors = emErrs4.length;}}}if(errors > 0){const emErrors5 = {"required":{"name":[],"id":[],"appliesTo":[],"properties":[]}};const templates5 = {required:{}};let emPropParams2;let emParamsErrors2;for(const err41 of vErrors){if((((((err41.keyword !== "errorMessage") && (!err41.emUsed)) && (err41.dataPath === dataPath)) && (err41.keyword in emErrors5)) && (err41.schemaPath.indexOf("#/allOf/0") === 0)) && (/^\/[^\/]*$/.test(err41.schemaPath.slice(9)))){emPropParams2 = obj0[err41.keyword];emParamsErrors2 = emErrors5[err41.keyword][err41.params[emPropParams2]];if(emParamsErrors2){emParamsErrors2.push(err41);err41.emUsed = true;}}}for(const key5 in emErrors5){for(const keyProp2 in emErrors5[key5]){emParamsErrors2 = emErrors5[key5][keyProp2];if(emParamsErrors2.length){const tmpl2 = templates5[key5] && templates5[key5][keyProp2];const err42 = {keyword:"errorMessage",dataPath,schemaPath:"#/allOf/0/errorMessage",params:{errors: emParamsErrors2},message:tmpl2 ? tmpl2() : schema17.allOf[0].errorMessage[key5][keyProp2]};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}}}const emErrs5 = [];for(const err43 of vErrors){if(!err43.emUsed){emErrs5.push(err43);}}vErrors = emErrs5;errors = emErrs5.length;}if(data && typeof data == "object" && !Array.isArray(data)){if(data.properties !== undefined){let data16 = data.properties;if(Array.isArray(data16)){const len2 = data16.length;for(let i2=0; i2 0){const emErrs6 = [];for(const err47 of vErrors){if(((((err47.keyword !== "errorMessage") && (!err47.emUsed)) && ((err47.dataPath === dataPath+"/properties/" + i2) || ((err47.dataPath.indexOf(dataPath+"/properties/" + i2) === 0) && (err47.dataPath[dataPath+"/properties/" + i2.length] === "/")))) && (err47.schemaPath.indexOf("#/definitions/properties/allOf/0/items/allOf/0/then") === 0)) && (err47.schemaPath["#/definitions/properties/allOf/0/items/allOf/0/then".length] === "/")){emErrs6.push(err47);err47.emUsed = true;}}if(emErrs6.length){const err48 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i2,schemaPath:"#/definitions/properties/allOf/0/items/allOf/0/then/errorMessage",params:{errors: emErrs6},message:"must provide choices=[] with \"Dropdown\" type"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}const emErrs7 = [];for(const err49 of vErrors){if(!err49.emUsed){emErrs7.push(err49);}}vErrors = emErrs7;errors = emErrs7.length;}var _valid0 = _errs44 === errors;valid18 = _valid0;}if(!valid18){const err50 = {keyword:"if",dataPath:dataPath+"/properties/" + i2,schemaPath:"#/definitions/properties/allOf/0/items/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;}if(data17 && typeof data17 == "object" && !Array.isArray(data17)){if(data17.id !== undefined){if(typeof data17.id !== "string"){const err51 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/id",schemaPath:"#/definitions/properties/allOf/0/items/properties/id/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err51];}else {vErrors.push(err51);}errors++;}}if(data17.value !== undefined){let data20 = data17.value;if((typeof data20 !== "string") && (typeof data20 !== "boolean")){const err52 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/value",schemaPath:"#/definitions/properties/allOf/0/items/properties/value/type",params:{type: schema18.allOf[0].items.properties.value.type},message:"should be string,boolean"};if(vErrors === null){vErrors = [err52];}else {vErrors.push(err52);}errors++;}}if(data17.description !== undefined){if(typeof data17.description !== "string"){const err53 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/description",schemaPath:"#/definitions/properties/allOf/0/items/properties/description/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err53];}else {vErrors.push(err53);}errors++;}}if(data17.label !== undefined){if(typeof data17.label !== "string"){const err54 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/label",schemaPath:"#/definitions/properties/allOf/0/items/properties/label/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err54];}else {vErrors.push(err54);}errors++;}}if(data17.type !== undefined){if(typeof data17.type !== "string"){const err55 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/type",schemaPath:"#/definitions/properties/allOf/0/items/properties/type/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err55];}else {vErrors.push(err55);}errors++;}}if(data17.editable !== undefined){if(typeof data17.editable !== "boolean"){const err56 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/editable",schemaPath:"#/definitions/properties/allOf/0/items/properties/editable/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err56];}else {vErrors.push(err56);}errors++;}}if(data17.choices !== undefined){let data25 = data17.choices;if(Array.isArray(data25)){const len3 = data25.length;for(let i3=0; i3 0){const emErrors6 = {"required":[]};const templates6 = {};for(const err62 of vErrors){if((((((err62.keyword !== "errorMessage") && (!err62.emUsed)) && (err62.dataPath === dataPath+"/properties/" + i2+"/choices/" + i3)) && (err62.keyword in emErrors6)) && (err62.schemaPath.indexOf("#/definitions/properties/allOf/0/items/properties/choices/items") === 0)) && (/^\/[^\/]*$/.test(err62.schemaPath.slice(63)))){emErrors6[err62.keyword].push(err62);err62.emUsed = true;}}for(const key6 in emErrors6){if(emErrors6[key6].length){const err63 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i2+"/choices/" + i3,schemaPath:"#/definitions/properties/allOf/0/items/properties/choices/items/errorMessage",params:{errors: emErrors6[key6]},message:key6 in templates6 ? templates6[key6]() : schema18.allOf[0].items.properties.choices.items.errorMessage[key6]};if(vErrors === null){vErrors = [err63];}else {vErrors.push(err63);}errors++;}}const emErrs8 = [];for(const err64 of vErrors){if(!err64.emUsed){emErrs8.push(err64);}}vErrors = emErrs8;errors = emErrs8.length;}}}else {const err65 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/choices",schemaPath:"#/definitions/properties/allOf/0/items/properties/choices/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err65];}else {vErrors.push(err65);}errors++;}}if(data17.constraints !== undefined){let data29 = data17.constraints;if(data29 && typeof data29 == "object" && !Array.isArray(data29)){if(data29.notEmpty !== undefined){if(typeof data29.notEmpty !== "boolean"){const err66 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/notEmpty",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/notEmpty/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err66];}else {vErrors.push(err66);}errors++;}}if(data29.minLength !== undefined){if(!(typeof data29.minLength == "number")){const err67 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/minLength",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/minLength/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err67];}else {vErrors.push(err67);}errors++;}}if(data29.maxLength !== undefined){if(!(typeof data29.maxLength == "number")){const err68 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/maxLength",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/maxLength/type",params:{type: "number"},message:"should be number"};if(vErrors === null){vErrors = [err68];}else {vErrors.push(err68);}errors++;}}if(data29.pattern !== undefined){let data33 = data29.pattern;const _errs74 = errors;let valid26 = false;let passing0 = null;const _errs75 = errors;if(data33 && typeof data33 == "object" && !Array.isArray(data33)){if(data33.value !== undefined){if(typeof data33.value !== "string"){const err69 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern/value",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/properties/value/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err69];}else {vErrors.push(err69);}errors++;}}if(data33.message !== undefined){if(typeof data33.message !== "string"){const err70 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern/message",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/properties/message/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err70];}else {vErrors.push(err70);}errors++;}}}else {const err71 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/0/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err71];}else {vErrors.push(err71);}errors++;}var _valid1 = _errs75 === errors;if(_valid1){valid26 = true;passing0 = 0;}const _errs81 = errors;if(typeof data33 !== "string"){const err72 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf/1/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err72];}else {vErrors.push(err72);}errors++;}var _valid1 = _errs81 === errors;if(_valid1 && valid26){valid26 = false;passing0 = [passing0, 1];}else {if(_valid1){valid26 = true;passing0 = 1;}}if(!valid26){const err73 = {keyword:"oneOf",dataPath:dataPath+"/properties/" + i2+"/constraints/pattern",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/properties/pattern/oneOf",params:{passingSchemas: passing0},message:"should match exactly one schema in oneOf"};if(vErrors === null){vErrors = [err73];}else {vErrors.push(err73);}errors++;}else {errors = _errs74;if(vErrors !== null){if(_errs74){vErrors.length = _errs74;}else {vErrors = null;}}}}}else {const err74 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/constraints",schemaPath:"#/definitions/properties/allOf/0/items/properties/constraints/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err74];}else {vErrors.push(err74);}errors++;}}if(data17.group !== undefined){if(typeof data17.group !== "string"){const err75 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/group",schemaPath:"#/definitions/properties/allOf/0/items/properties/group/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err75];}else {vErrors.push(err75);}errors++;}}if(data17.condition !== undefined){let data37 = data17.condition;const _errs87 = errors;let valid28 = false;let passing1 = null;const _errs88 = errors;if(data37 && typeof data37 == "object" && !Array.isArray(data37)){if(data37.equals === undefined){const err76 = {keyword:"required",dataPath:dataPath+"/properties/" + i2+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/0/required",params:{missingProperty: "equals"},message:"should have required property '"+"equals"+"'"};if(vErrors === null){vErrors = [err76];}else {vErrors.push(err76);}errors++;}if(data37.equals !== undefined){let data38 = data37.equals;if(((typeof data38 !== "string") && (!(typeof data38 == "number"))) && (typeof data38 !== "boolean")){const err77 = {keyword:"type",dataPath:dataPath+"/properties/" + i2+"/condition/equals",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/0/properties/equals/type",params:{type: schema18.allOf[0].items.properties.condition.oneOf[0].properties.equals.type},message:"should be string,number,boolean"};if(vErrors === null){vErrors = [err77];}else {vErrors.push(err77);}errors++;}}}var _valid2 = _errs88 === errors;if(_valid2){valid28 = true;passing1 = 0;}const _errs91 = errors;if(data37 && typeof data37 == "object" && !Array.isArray(data37)){if(data37.oneOf === undefined){const err78 = {keyword:"required",dataPath:dataPath+"/properties/" + i2+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/oneOf/1/required",params:{missingProperty: "oneOf"},message:"should have required property '"+"oneOf"+"'"};if(vErrors === null){vErrors = [err78];}else {vErrors.push(err78);}errors++;}if(data37.oneOf !== undefined){let data39 = data37.oneOf;if(Array.isArray(data39)){const len4 = data39.length;for(let i4=0; i4 0){const emErrors7 = {"required":{"property":[]}};const templates7 = {required:{}};let emPropParams3;let emParamsErrors3;for(const err86 of vErrors){if((((((err86.keyword !== "errorMessage") && (!err86.emUsed)) && (err86.dataPath === dataPath+"/properties/" + i2+"/condition")) && (err86.keyword in emErrors7)) && (err86.schemaPath.indexOf("#/definitions/properties/allOf/0/items/properties/condition") === 0)) && (/^\/[^\/]*$/.test(err86.schemaPath.slice(59)))){emPropParams3 = obj0[err86.keyword];emParamsErrors3 = emErrors7[err86.keyword][err86.params[emPropParams3]];if(emParamsErrors3){emParamsErrors3.push(err86);err86.emUsed = true;}}}for(const key7 in emErrors7){for(const keyProp3 in emErrors7[key7]){emParamsErrors3 = emErrors7[key7][keyProp3];if(emParamsErrors3.length){const tmpl3 = templates7[key7] && templates7[key7][keyProp3];const err87 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i2+"/condition",schemaPath:"#/definitions/properties/allOf/0/items/properties/condition/errorMessage",params:{errors: emParamsErrors3},message:tmpl3 ? tmpl3() : schema18.allOf[0].items.properties.condition.errorMessage[key7][keyProp3]};if(vErrors === null){vErrors = [err87];}else {vErrors.push(err87);}errors++;}}}const emErrs9 = [];for(const err88 of vErrors){if(!err88.emUsed){emErrs9.push(err88);}}vErrors = emErrs9;errors = emErrs9.length;}}}else {const err89 = {keyword:"type",dataPath:dataPath+"/properties/" + i2,schemaPath:"#/definitions/properties/allOf/0/items/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err89];}else {vErrors.push(err89);}errors++;}}}else {const err90 = {keyword:"type",dataPath:dataPath+"/properties",schemaPath:"#/definitions/properties/allOf/0/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err90];}else {vErrors.push(err90);}errors++;}if(Array.isArray(data16)){const len5 = data16.length;for(let i5=0; i5 0){const emErrs10 = [];for(const err95 of vErrors){if(((((err95.keyword !== "errorMessage") && (!err95.emUsed)) && ((err95.dataPath === dataPath+"/properties/" + i5+"/type") || ((err95.dataPath.indexOf(dataPath+"/properties/" + i5+"/type") === 0) && (err95.dataPath[dataPath+"/properties/" + i5+"/type".length] === "/")))) && (err95.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/0/then/properties/type") === 0)) && (err95.schemaPath["#/definitions/properties/allOf/1/items/allOf/0/then/properties/type".length] === "/")){emErrs10.push(err95);err95.emUsed = true;}}if(emErrs10.length){const err96 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/0/then/properties/type/errorMessage",params:{errors: emErrs10},message:"invalid property type " + JSON.stringify(data46) + " for binding type \"property\"; must be any of { String, Text, Hidden, Dropdown, Boolean }"};if(vErrors === null){vErrors = [err96];}else {vErrors.push(err96);}errors++;}const emErrs11 = [];for(const err97 of vErrors){if(!err97.emUsed){emErrs11.push(err97);}}vErrors = emErrs11;errors = emErrs11.length;}}}var _valid3 = _errs108 === errors;valid38 = _valid3;}if(!valid38){const err98 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err98];}else {vErrors.push(err98);}errors++;}const _errs111 = errors;let valid42 = true;const _errs112 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if((data43.binding === undefined) && ("binding")){const err99 = {};if(vErrors === null){vErrors = [err99];}else {vErrors.push(err99);}errors++;}else {if(data43.binding !== undefined){let data47 = data43.binding;if(data47 && typeof data47 == "object" && !Array.isArray(data47)){if((data47.type === undefined) && ("type")){const err100 = {};if(vErrors === null){vErrors = [err100];}else {vErrors.push(err100);}errors++;}else {if(data47.type !== undefined){let data48 = data47.type;if(!((((data48 === "zeebe:input") || (data48 === "zeebe:output")) || (data48 === "zeebe:taskHeader")) || (data48 === "zeebe:taskDefinition:type"))){const err101 = {};if(vErrors === null){vErrors = [err101];}else {vErrors.push(err101);}errors++;}}}}}}}var _valid4 = _errs112 === errors;errors = _errs111;if(vErrors !== null){if(_errs111){vErrors.length = _errs111;}else {vErrors = null;}}if(_valid4){const _errs115 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.type !== undefined){let data49 = data43.type;if(!((((data49 === "String") || (data49 === "Text")) || (data49 === "Hidden")) || (data49 === "Dropdown"))){const err102 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/then/properties/type/enum",params:{allowedValues: schema18.allOf[1].items.allOf[1].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err102];}else {vErrors.push(err102);}errors++;}if(errors > 0){const emErrs12 = [];for(const err103 of vErrors){if(((((err103.keyword !== "errorMessage") && (!err103.emUsed)) && ((err103.dataPath === dataPath+"/properties/" + i5+"/type") || ((err103.dataPath.indexOf(dataPath+"/properties/" + i5+"/type") === 0) && (err103.dataPath[dataPath+"/properties/" + i5+"/type".length] === "/")))) && (err103.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/1/then/properties/type") === 0)) && (err103.schemaPath["#/definitions/properties/allOf/1/items/allOf/1/then/properties/type".length] === "/")){emErrs12.push(err103);err103.emUsed = true;}}if(emErrs12.length){const err104 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/then/properties/type/errorMessage",params:{errors: emErrs12},message:"invalid property type " + JSON.stringify(data49) + " for binding type " + JSON.stringify(data43 && data43.binding && data43.binding.type) + "; must be any of { String, Text, Hidden, Dropdown }"};if(vErrors === null){vErrors = [err104];}else {vErrors.push(err104);}errors++;}const emErrs13 = [];for(const err105 of vErrors){if(!err105.emUsed){emErrs13.push(err105);}}vErrors = emErrs13;errors = emErrs13.length;}}}var _valid4 = _errs115 === errors;valid42 = _valid4;}if(!valid42){const err106 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/1/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err106];}else {vErrors.push(err106);}errors++;}const _errs118 = errors;let valid46 = true;const _errs119 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if((data43.optional === undefined) && ("optional")){const err107 = {};if(vErrors === null){vErrors = [err107];}else {vErrors.push(err107);}errors++;}else {if(data43.optional !== undefined){if(!equal(data43.optional, true)){const err108 = {};if(vErrors === null){vErrors = [err108];}else {vErrors.push(err108);}errors++;}}}}var _valid5 = _errs119 === errors;errors = _errs118;if(vErrors !== null){if(_errs118){vErrors.length = _errs118;}else {vErrors = null;}}if(_valid5){const _errs121 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.binding !== undefined){let data51 = data43.binding;if(data51 && typeof data51 == "object" && !Array.isArray(data51)){if(data51.type === undefined){const err109 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/then/properties/binding/required",params:{missingProperty: "type"},message:"should have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err109];}else {vErrors.push(err109);}errors++;}if(data51.type !== undefined){let data52 = data51.type;if(!((data52 === "zeebe:input") || (data52 === "zeebe:output"))){const err110 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/then/properties/binding/properties/type/enum",params:{allowedValues: schema18.allOf[1].items.allOf[2].then.properties.binding.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err110];}else {vErrors.push(err110);}errors++;}if(errors > 0){const emErrs14 = [];for(const err111 of vErrors){if(((((err111.keyword !== "errorMessage") && (!err111.emUsed)) && ((err111.dataPath === dataPath+"/properties/" + i5+"/binding/type") || ((err111.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding/type") === 0) && (err111.dataPath[dataPath+"/properties/" + i5+"/binding/type".length] === "/")))) && (err111.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/2/then/properties/binding/properties/type") === 0)) && (err111.schemaPath["#/definitions/properties/allOf/1/items/allOf/2/then/properties/binding/properties/type".length] === "/")){emErrs14.push(err111);err111.emUsed = true;}}if(emErrs14.length){const err112 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/then/properties/binding/properties/type/errorMessage",params:{errors: emErrs14},message:"optional is not supported for binding type " + JSON.stringify(data52) + "; must be any of { zeebe:input, zeebe:output }"};if(vErrors === null){vErrors = [err112];}else {vErrors.push(err112);}errors++;}const emErrs15 = [];for(const err113 of vErrors){if(!err113.emUsed){emErrs15.push(err113);}}vErrors = emErrs15;errors = emErrs15.length;}}}}}var _valid5 = _errs121 === errors;valid46 = _valid5;}if(!valid46){const err114 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/2/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err114];}else {vErrors.push(err114);}errors++;}const _errs125 = errors;let valid50 = true;const _errs126 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if((data43.optional === undefined) && ("optional")){const err115 = {};if(vErrors === null){vErrors = [err115];}else {vErrors.push(err115);}errors++;}else {if(data43.optional !== undefined){if(!equal(data43.optional, true)){const err116 = {};if(vErrors === null){vErrors = [err116];}else {vErrors.push(err116);}errors++;}}}}var _valid6 = _errs126 === errors;errors = _errs125;if(vErrors !== null){if(_errs125){vErrors.length = _errs125;}else {vErrors = null;}}if(_valid6){const _errs128 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.constraints !== undefined){let data54 = data43.constraints;if(data54 && typeof data54 == "object" && !Array.isArray(data54)){if(data54.notEmpty === undefined){const err117 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/constraints",schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/then/properties/constraints/required",params:{missingProperty: "notEmpty"},message:"should have required property '"+"notEmpty"+"'"};if(vErrors === null){vErrors = [err117];}else {vErrors.push(err117);}errors++;}if(data54.notEmpty !== undefined){if(!equal(data54.notEmpty, false)){const err118 = {keyword:"const",dataPath:dataPath+"/properties/" + i5+"/constraints/notEmpty",schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/then/properties/constraints/properties/notEmpty/const",params:{allowedValue: false},message:"should be equal to constant"};if(vErrors === null){vErrors = [err118];}else {vErrors.push(err118);}errors++;}if(errors > 0){const emErrs16 = [];for(const err119 of vErrors){if(((((err119.keyword !== "errorMessage") && (!err119.emUsed)) && ((err119.dataPath === dataPath+"/properties/" + i5+"/constraints/notEmpty") || ((err119.dataPath.indexOf(dataPath+"/properties/" + i5+"/constraints/notEmpty") === 0) && (err119.dataPath[dataPath+"/properties/" + i5+"/constraints/notEmpty".length] === "/")))) && (err119.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/3/then/properties/constraints/properties/notEmpty") === 0)) && (err119.schemaPath["#/definitions/properties/allOf/1/items/allOf/3/then/properties/constraints/properties/notEmpty".length] === "/")){emErrs16.push(err119);err119.emUsed = true;}}if(emErrs16.length){const err120 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/constraints/notEmpty",schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/then/properties/constraints/properties/notEmpty/errorMessage",params:{errors: emErrs16},message:"optional is not allowed for truthy \"notEmpty\" constraint"};if(vErrors === null){vErrors = [err120];}else {vErrors.push(err120);}errors++;}const emErrs17 = [];for(const err121 of vErrors){if(!err121.emUsed){emErrs17.push(err121);}}vErrors = emErrs17;errors = emErrs17.length;}}}}}var _valid6 = _errs128 === errors;valid50 = _valid6;}if(!valid50){const err122 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/3/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err122];}else {vErrors.push(err122);}errors++;}const _errs132 = errors;let valid54 = true;const _errs133 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if((data43.feel === undefined) && ("feel")){const err123 = {};if(vErrors === null){vErrors = [err123];}else {vErrors.push(err123);}errors++;}else {if(data43.feel !== undefined){const _errs135 = errors;const _errs136 = errors;if(!equal(data43.feel, schema18.allOf[1].items.allOf[4].if.properties.feel.not.const)){const err124 = {};if(vErrors === null){vErrors = [err124];}else {vErrors.push(err124);}errors++;}var valid56 = _errs136 === errors;if(!valid56){errors = _errs135;if(vErrors !== null){if(_errs135){vErrors.length = _errs135;}else {vErrors = null;}}}else {const err125 = {};if(vErrors === null){vErrors = [err125];}else {vErrors.push(err125);}errors++;}}}}var _valid7 = _errs133 === errors;errors = _errs132;if(vErrors !== null){if(_errs132){vErrors.length = _errs132;}else {vErrors = null;}}if(_valid7){const _errs137 = errors;if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.type === undefined){const err126 = {keyword:"required",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/4/then/required",params:{missingProperty: "type"},message:"should have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err126];}else {vErrors.push(err126);}errors++;}if(data43.type !== undefined){let data57 = data43.type;if(!((data57 === "String") || (data57 === "Text"))){const err127 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/4/then/properties/type/enum",params:{allowedValues: schema18.allOf[1].items.allOf[4].then.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err127];}else {vErrors.push(err127);}errors++;}if(errors > 0){const emErrs18 = [];for(const err128 of vErrors){if(((((err128.keyword !== "errorMessage") && (!err128.emUsed)) && ((err128.dataPath === dataPath+"/properties/" + i5+"/type") || ((err128.dataPath.indexOf(dataPath+"/properties/" + i5+"/type") === 0) && (err128.dataPath[dataPath+"/properties/" + i5+"/type".length] === "/")))) && (err128.schemaPath.indexOf("#/definitions/properties/allOf/1/items/allOf/4/then/properties/type") === 0)) && (err128.schemaPath["#/definitions/properties/allOf/1/items/allOf/4/then/properties/type".length] === "/")){emErrs18.push(err128);err128.emUsed = true;}}if(emErrs18.length){const err129 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/type",schemaPath:"#/definitions/properties/allOf/1/items/allOf/4/then/properties/type/errorMessage",params:{errors: emErrs18},message:"feel is only supported for \"String\" and \"Text\" type"};if(vErrors === null){vErrors = [err129];}else {vErrors.push(err129);}errors++;}const emErrs19 = [];for(const err130 of vErrors){if(!err130.emUsed){emErrs19.push(err130);}}vErrors = emErrs19;errors = emErrs19.length;}}}var _valid7 = _errs137 === errors;valid54 = _valid7;}if(!valid54){const err131 = {keyword:"if",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/allOf/4/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err131];}else {vErrors.push(err131);}errors++;}if(data43 && typeof data43 == "object" && !Array.isArray(data43)){if(data43.binding === undefined){const err132 = {keyword:"required",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/required",params:{missingProperty: "binding"},message:"should have required property '"+"binding"+"'"};if(vErrors === null){vErrors = [err132];}else {vErrors.push(err132);}errors++;}if(data43.binding !== undefined){let data58 = data43.binding;const _errs142 = errors;let valid60 = true;const _errs143 = errors;if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if((data58.type === undefined) && ("type")){const err133 = {};if(vErrors === null){vErrors = [err133];}else {vErrors.push(err133);}errors++;}else {if(data58.type !== undefined){let data59 = data58.type;if(!((data59 === "property") || (data59 === "zeebe:input"))){const err134 = {};if(vErrors === null){vErrors = [err134];}else {vErrors.push(err134);}errors++;}}}}var _valid8 = _errs143 === errors;errors = _errs142;if(vErrors !== null){if(_errs142){vErrors.length = _errs142;}else {vErrors = null;}}if(_valid8){const _errs145 = errors;if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if(data58.name === undefined){const err135 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then/required",params:{missingProperty: "name"},message:"should have required property '"+"name"+"'"};if(vErrors === null){vErrors = [err135];}else {vErrors.push(err135);}errors++;}}if(errors > 0){const emErrs20 = [];for(const err136 of vErrors){if(((((err136.keyword !== "errorMessage") && (!err136.emUsed)) && ((err136.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err136.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err136.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err136.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then") === 0)) && (err136.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then".length] === "/")){emErrs20.push(err136);err136.emUsed = true;}}if(emErrs20.length){const err137 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/then/errorMessage",params:{errors: emErrs20},message:"property.binding " + JSON.stringify(data58 && data58.type) + " requires name"};if(vErrors === null){vErrors = [err137];}else {vErrors.push(err137);}errors++;}const emErrs21 = [];for(const err138 of vErrors){if(!err138.emUsed){emErrs21.push(err138);}}vErrors = emErrs21;errors = emErrs21.length;}var _valid8 = _errs145 === errors;valid60 = _valid8;}if(!valid60){const err139 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/0/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err139];}else {vErrors.push(err139);}errors++;}const _errs147 = errors;let valid62 = true;const _errs148 = errors;if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if((data58.type === undefined) && ("type")){const err140 = {};if(vErrors === null){vErrors = [err140];}else {vErrors.push(err140);}errors++;}else {if(data58.type !== undefined){if(!equal(data58.type, "zeebe:output")){const err141 = {};if(vErrors === null){vErrors = [err141];}else {vErrors.push(err141);}errors++;}}}}var _valid9 = _errs148 === errors;errors = _errs147;if(vErrors !== null){if(_errs147){vErrors.length = _errs147;}else {vErrors = null;}}if(_valid9){const _errs150 = errors;if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if(data58.source === undefined){const err142 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then/required",params:{missingProperty: "source"},message:"should have required property '"+"source"+"'"};if(vErrors === null){vErrors = [err142];}else {vErrors.push(err142);}errors++;}}if(errors > 0){const emErrs22 = [];for(const err143 of vErrors){if(((((err143.keyword !== "errorMessage") && (!err143.emUsed)) && ((err143.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err143.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err143.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err143.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then") === 0)) && (err143.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then".length] === "/")){emErrs22.push(err143);err143.emUsed = true;}}if(emErrs22.length){const err144 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/then/errorMessage",params:{errors: emErrs22},message:"property.binding " + JSON.stringify(data58 && data58.type) + " requires source"};if(vErrors === null){vErrors = [err144];}else {vErrors.push(err144);}errors++;}const emErrs23 = [];for(const err145 of vErrors){if(!err145.emUsed){emErrs23.push(err145);}}vErrors = emErrs23;errors = emErrs23.length;}var _valid9 = _errs150 === errors;valid62 = _valid9;}if(!valid62){const err146 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/1/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err146];}else {vErrors.push(err146);}errors++;}const _errs152 = errors;let valid64 = true;const _errs153 = errors;if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if((data58.type === undefined) && ("type")){const err147 = {};if(vErrors === null){vErrors = [err147];}else {vErrors.push(err147);}errors++;}else {if(data58.type !== undefined){if(!equal(data58.type, "zeebe:taskHeader")){const err148 = {};if(vErrors === null){vErrors = [err148];}else {vErrors.push(err148);}errors++;}}}}var _valid10 = _errs153 === errors;errors = _errs152;if(vErrors !== null){if(_errs152){vErrors.length = _errs152;}else {vErrors = null;}}if(_valid10){const _errs155 = errors;if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if(data58.key === undefined){const err149 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/required",params:{missingProperty: "key"},message:"should have required property '"+"key"+"'"};if(vErrors === null){vErrors = [err149];}else {vErrors.push(err149);}errors++;}}if(errors > 0){const emErrs24 = [];for(const err150 of vErrors){if(((((err150.keyword !== "errorMessage") && (!err150.emUsed)) && ((err150.dataPath === dataPath+"/properties/" + i5+"/binding") || ((err150.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding") === 0) && (err150.dataPath[dataPath+"/properties/" + i5+"/binding".length] === "/")))) && (err150.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then") === 0)) && (err150.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then".length] === "/")){emErrs24.push(err150);err150.emUsed = true;}}if(emErrs24.length){const err151 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/then/errorMessage",params:{errors: emErrs24},message:"property.binding " + JSON.stringify(data58 && data58.type) + " requires key"};if(vErrors === null){vErrors = [err151];}else {vErrors.push(err151);}errors++;}const emErrs25 = [];for(const err152 of vErrors){if(!err152.emUsed){emErrs25.push(err152);}}vErrors = emErrs25;errors = emErrs25.length;}var _valid10 = _errs155 === errors;valid64 = _valid10;}if(!valid64){const err153 = {keyword:"if",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/allOf/2/if",params:{failingKeyword: "then"},message:"should match \"then\" schema"};if(vErrors === null){vErrors = [err153];}else {vErrors.push(err153);}errors++;}if(data58 && typeof data58 == "object" && !Array.isArray(data58)){if(data58.type === undefined){const err154 = {keyword:"required",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/required",params:{missingProperty: "type"},message:"should have required property '"+"type"+"'"};if(vErrors === null){vErrors = [err154];}else {vErrors.push(err154);}errors++;}if(data58.type !== undefined){let data62 = data58.type;if(typeof data62 !== "string"){const err155 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err155];}else {vErrors.push(err155);}errors++;}if(!(((((data62 === "property") || (data62 === "zeebe:taskDefinition:type")) || (data62 === "zeebe:input")) || (data62 === "zeebe:output")) || (data62 === "zeebe:taskHeader"))){const err156 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/enum",params:{allowedValues: schema18.allOf[1].items.properties.binding.properties.type.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err156];}else {vErrors.push(err156);}errors++;}if(errors > 0){const emErrs26 = [];for(const err157 of vErrors){if(((((err157.keyword !== "errorMessage") && (!err157.emUsed)) && ((err157.dataPath === dataPath+"/properties/" + i5+"/binding/type") || ((err157.dataPath.indexOf(dataPath+"/properties/" + i5+"/binding/type") === 0) && (err157.dataPath[dataPath+"/properties/" + i5+"/binding/type".length] === "/")))) && (err157.schemaPath.indexOf("#/definitions/properties/allOf/1/items/properties/binding/properties/type") === 0)) && (err157.schemaPath["#/definitions/properties/allOf/1/items/properties/binding/properties/type".length] === "/")){emErrs26.push(err157);err157.emUsed = true;}}if(emErrs26.length){const err158 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5+"/binding/type",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/type/errorMessage",params:{errors: emErrs26},message:"invalid property.binding type " + JSON.stringify(data62) + "; must be any of { property, zeebe:taskDefinition:type, zeebe:input, zeebe:output, zeebe:taskHeader }"};if(vErrors === null){vErrors = [err158];}else {vErrors.push(err158);}errors++;}const emErrs27 = [];for(const err159 of vErrors){if(!err159.emUsed){emErrs27.push(err159);}}vErrors = emErrs27;errors = emErrs27.length;}}if(data58.name !== undefined){if(typeof data58.name !== "string"){const err160 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/name",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/name/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err160];}else {vErrors.push(err160);}errors++;}}if(data58.source !== undefined){if(typeof data58.source !== "string"){const err161 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/source",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/source/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err161];}else {vErrors.push(err161);}errors++;}}if(data58.key !== undefined){if(typeof data58.key !== "string"){const err162 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding/key",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/properties/key/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err162];}else {vErrors.push(err162);}errors++;}}}else {const err163 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/binding",schemaPath:"#/definitions/properties/allOf/1/items/properties/binding/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err163];}else {vErrors.push(err163);}errors++;}}if(data43.optional !== undefined){if(typeof data43.optional !== "boolean"){const err164 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/optional",schemaPath:"#/definitions/properties/allOf/1/items/properties/optional/type",params:{type: "boolean"},message:"should be boolean"};if(vErrors === null){vErrors = [err164];}else {vErrors.push(err164);}errors++;}}if(data43.feel !== undefined){let data67 = data43.feel;if(typeof data67 !== "string"){const err165 = {keyword:"type",dataPath:dataPath+"/properties/" + i5+"/feel",schemaPath:"#/definitions/properties/allOf/1/items/properties/feel/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err165];}else {vErrors.push(err165);}errors++;}if(!(((data67 === null) || (data67 === "optional")) || (data67 === "required"))){const err166 = {keyword:"enum",dataPath:dataPath+"/properties/" + i5+"/feel",schemaPath:"#/definitions/properties/allOf/1/items/properties/feel/enum",params:{allowedValues: schema18.allOf[1].items.properties.feel.enum},message:"should be equal to one of the allowed values"};if(vErrors === null){vErrors = [err166];}else {vErrors.push(err166);}errors++;}}}else {const err167 = {keyword:"type",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err167];}else {vErrors.push(err167);}errors++;}if(errors > 0){const emErrors8 = {"required":{"binding":[]}};const templates8 = {required:{binding:function(){return "missing binding for property \"" + JSON.stringify(i5) + "\""}}};let emPropParams4;let emParamsErrors4;for(const err168 of vErrors){if((((((err168.keyword !== "errorMessage") && (!err168.emUsed)) && (err168.dataPath === dataPath+"/properties/" + i5)) && (err168.keyword in emErrors8)) && (err168.schemaPath.indexOf("#/definitions/properties/allOf/1/items") === 0)) && (/^\/[^\/]*$/.test(err168.schemaPath.slice(38)))){emPropParams4 = obj0[err168.keyword];emParamsErrors4 = emErrors8[err168.keyword][err168.params[emPropParams4]];if(emParamsErrors4){emParamsErrors4.push(err168);err168.emUsed = true;}}}for(const key8 in emErrors8){for(const keyProp4 in emErrors8[key8]){emParamsErrors4 = emErrors8[key8][keyProp4];if(emParamsErrors4.length){const tmpl4 = templates8[key8] && templates8[key8][keyProp4];const err169 = {keyword:"errorMessage",dataPath:dataPath+"/properties/" + i5,schemaPath:"#/definitions/properties/allOf/1/items/errorMessage",params:{errors: emParamsErrors4},message:tmpl4 ? tmpl4() : schema18.allOf[1].items.errorMessage[key8][keyProp4]};if(vErrors === null){vErrors = [err169];}else {vErrors.push(err169);}errors++;}}}const emErrs28 = [];for(const err170 of vErrors){if(!err170.emUsed){emErrs28.push(err170);}}vErrors = emErrs28;errors = emErrs28.length;}}}else {const err171 = {keyword:"type",dataPath:dataPath+"/properties",schemaPath:"#/definitions/properties/allOf/1/type",params:{type: "array"},message:"should be array"};if(vErrors === null){vErrors = [err171];}else {vErrors.push(err171);}errors++;}}if(data.icon !== undefined){let data68 = data.icon;if(data68 && typeof data68 == "object" && !Array.isArray(data68)){if(data68.contents === undefined){const err172 = {keyword:"required",dataPath:dataPath+"/icon",schemaPath:"#/properties/icon/required",params:{missingProperty: "contents"},message:"should have required property '"+"contents"+"'"};if(vErrors === null){vErrors = [err172];}else {vErrors.push(err172);}errors++;}if(data68.contents !== undefined){let data69 = data68.contents;if(typeof data69 === "string"){if(!pattern3.test(data69)){const err173 = {keyword:"pattern",dataPath:dataPath+"/icon/contents",schemaPath:"#/properties/icon/properties/contents/pattern",params:{pattern: "^(https?|data):.*"},message:"should match pattern \""+"^(https?|data):.*"+"\""};if(vErrors === null){vErrors = [err173];}else {vErrors.push(err173);}errors++;}}else {const err174 = {keyword:"type",dataPath:dataPath+"/icon/contents",schemaPath:"#/properties/icon/properties/contents/type",params:{type: "string"},message:"should be string"};if(vErrors === null){vErrors = [err174];}else {vErrors.push(err174);}errors++;}if(errors > 0){const emErrors9 = {"pattern":[]};const templates9 = {};for(const err175 of vErrors){if((((((err175.keyword !== "errorMessage") && (!err175.emUsed)) && (err175.dataPath === dataPath+"/icon/contents")) && (err175.keyword in emErrors9)) && (err175.schemaPath.indexOf("#/properties/icon/properties/contents") === 0)) && (/^\/[^\/]*$/.test(err175.schemaPath.slice(37)))){emErrors9[err175.keyword].push(err175);err175.emUsed = true;}}for(const key9 in emErrors9){if(emErrors9[key9].length){const err176 = {keyword:"errorMessage",dataPath:dataPath+"/icon/contents",schemaPath:"#/properties/icon/properties/contents/errorMessage",params:{errors: emErrors9[key9]},message:key9 in templates9 ? templates9[key9]() : schema17.properties.icon.properties.contents.errorMessage[key9]};if(vErrors === null){vErrors = [err176];}else {vErrors.push(err176);}errors++;}}const emErrs29 = [];for(const err177 of vErrors){if(!err177.emUsed){emErrs29.push(err177);}}vErrors = emErrs29;errors = emErrs29.length;}}}else {const err178 = {keyword:"type",dataPath:dataPath+"/icon",schemaPath:"#/properties/icon/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err178];}else {vErrors.push(err178);}errors++;}if(errors > 0){const emErrors10 = {"required":{"contents":[]}};const templates10 = {required:{}};let emPropParams5;let emParamsErrors5;for(const err179 of vErrors){if((((((err179.keyword !== "errorMessage") && (!err179.emUsed)) && (err179.dataPath === dataPath+"/icon")) && (err179.keyword in emErrors10)) && (err179.schemaPath.indexOf("#/properties/icon") === 0)) && (/^\/[^\/]*$/.test(err179.schemaPath.slice(17)))){emPropParams5 = obj0[err179.keyword];emParamsErrors5 = emErrors10[err179.keyword][err179.params[emPropParams5]];if(emParamsErrors5){emParamsErrors5.push(err179);err179.emUsed = true;}}}for(const key10 in emErrors10){for(const keyProp5 in emErrors10[key10]){emParamsErrors5 = emErrors10[key10][keyProp5];if(emParamsErrors5.length){const tmpl5 = templates10[key10] && templates10[key10][keyProp5];const err180 = {keyword:"errorMessage",dataPath:dataPath+"/icon",schemaPath:"#/properties/icon/errorMessage",params:{errors: emParamsErrors5},message:tmpl5 ? tmpl5() : schema17.properties.icon.errorMessage[key10][keyProp5]};if(vErrors === null){vErrors = [err180];}else {vErrors.push(err180);}errors++;}}}const emErrs30 = [];for(const err181 of vErrors){if(!err181.emUsed){emErrs30.push(err181);}}vErrors = emErrs30;errors = emErrs30.length;}}}else {const err182 = {keyword:"type",dataPath,schemaPath:"#/type",params:{type: "object"},message:"should be object"};if(vErrors === null){vErrors = [err182];}else {vErrors.push(err182);}errors++;}validate15.errors = vErrors;return errors === 0;}function validate14(data, {dataPath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;const _errs0 = errors;let valid0 = false;let passing0 = null;const _errs1 = errors;if(!(validate15(data, {dataPath,parentData,parentDataProperty,rootData}))){vErrors = vErrors === null ? validate15.errors : vErrors.concat(validate15.errors);errors = vErrors.length;}var _valid0 = _errs1 === errors;if(_valid0){valid0 = true;passing0 = 0;}const _errs2 = errors;if(Array.isArray(data)){const len0 = data.length;for(let i0=0; i0 { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var minDash = __webpack_require__(/*! min-dash */ "./node_modules/min-dash/dist/index.esm.js"); + +/** + * Get a inputOutput from the business object + * + * @param {ModdleElement} element + * + * @return {ModdleElement} the inputOutput object + */ +function getInputOutput(element) { + return (getElements(element, 'camunda:InputOutput') || [])[0]; +} + +/** + * Return all input parameters existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * + * @return {Array} a list of input parameter objects + */ +function getInputParameters(element) { + return getParameters(element, 'inputParameters'); +} + +/** + * Return all output parameters existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * @param {boolean} insideConnector + * + * @return {Array} a list of output parameter objects + */ +function getOutputParameters(element) { + return getParameters(element, 'outputParameters'); +} + +/** + * Return all form fields existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * + * @return {Array} a list of form fields + */ +function getFormFields(element) { + var formData = getFormData(element); + return (formData && formData.get('fields')) || []; +} + +/** + * Return form data existing in the business object + * + * @param {ModdleElement} element + * + * @return {ModdleElement} + */ +function getFormData(element) { + return getElements(element, 'camunda:FormData')[0]; +} + +/** + * Return out mappings existing in the business object + * + * @param {ModdleElement} element + * + * @return {Array} + */ +function getOutMappings(element) { + return getElements(element, 'camunda:Out'); +} + + +// helpers ////////// + +function getElements(element, type, property) { + var elements = getExtensionElements(element, type); + + return !property ? elements : (elements[0] || {})[property] || []; +} + +function getParameters(element, property) { + var inputOutput = getInputOutput(element); + + return (inputOutput && inputOutput.get(property)) || []; +} + +function getExtensionElements(element, type) { + var elements = []; + var extensionElements = element.get('extensionElements'); + + if (typeof extensionElements !== 'undefined') { + var extensionValues = extensionElements.get('values'); + + if (typeof extensionValues !== 'undefined') { + elements = minDash.filter(extensionValues, function(value) { + return is(value, type); + }); + } + } + + return elements; +} + +function is(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} + +/** + * Get all parent elements for a given element. + * + * @param {ModdleElement|string} element + * + * @returns {Array} + */ +function getParents(element) { + var parents = []; + var current = element; + + while (current.$parent) { + parents.push(current.$parent); + current = current.$parent; + } + + return parents; +} + +/** + * Iterate over each element in a collection, calling the iterator function `fn` + * with (element, index, recursionDepth). + * + * Recurse into all elements that are returned by `fn`. + * + * @param {Object|Array} elements + * @param {Function} fn iterator function called with (element, index, recursionDepth) + * @param {number} [depth] maximum recursion depth + */ +function eachElement(elements, fn, depth) { + depth = depth || 0; + + if (!minDash.isArray(elements)) { + elements = [elements]; + } + + minDash.forEach(elements, function(s, i) { + var filter = fn(s, i, depth); + + if (minDash.isArray(filter) && filter.length) { + eachElement(filter, fn, depth + 1); + } + }); +} + +/** + * Adds an element to a collection and returns true if the + * element was added. + * + * @param {Array} elements + * @param {Object} e + * @param {boolean} unique + */ +function add(elements, e, unique) { + var canAdd = !unique || elements.indexOf(e) === -1; + + if (canAdd) { + elements.push(e); + } + + return canAdd; +} + +/** + * Collects self + flow elements up to a given depth from a list of elements. + * + * @param {ModdleElement|Array} elements the elements to select the flowElements from + * @param {boolean} unique whether to return a unique result set (no duplicates) + * @param {number} maxDepth the depth to search through or -1 for infinite + * + * @return {Array} found elements + */ +function selfAndFlowElements(elements, unique, maxDepth) { + var result = [], + processedFlowElements = []; + + eachElement(elements, function(element, i, depth) { + add(result, element, unique); + + var flowElements = element.flowElements; + + // max traversal depth not reached yet + if (maxDepth === -1 || depth < maxDepth) { + + // flowElements exist && flowElements not yet processed + if (flowElements && add(processedFlowElements, flowElements, unique)) { + return flowElements; + } + } + }); + + return result; +} + +/** + * Return self + ALL flowElements for a number of elements + * + * @param {Array} elements to query + * @param {boolean} allowDuplicates to allow duplicates in the result set + * + * @return {Array} the collected elements + */ +function selfAndAllFlowElements(elements, allowDuplicates) { + return selfAndFlowElements(elements, !allowDuplicates, -1); +} + +/** + * Return full moddle element for given element id + * + * @param {string} elementId + * @param {ModdleElement} rootElement + * + * @returns {ModdleElement} + */ +function getElement(elementId, rootElement) { + var allElements = selfAndAllFlowElements(rootElement); + + return minDash.find(allElements, function(element) { + return element.id === elementId; + }); +} + +function addVariableToList(variablesList, newVariable) { + var foundIdx = minDash.findIndex(variablesList, function(variable) { + return ( + variable.name === newVariable.name && variable.scope === newVariable.scope + ); + }); + + if (foundIdx >= 0) { + variablesList[foundIdx].origin = combineArrays( + variablesList[foundIdx].origin, + newVariable.origin + ); + } else { + variablesList.push(newVariable); + } +} + +/** + * Creates new process variable definition object + * Identifies correct (highest) scope, in which variable is available + * + * @param {ModdleElement} flowElement + * @param {String} name + * @param {ModdleElement} defaultScope + * + * @returns {ProcessVariable} + */ +function createProcessVariable(flowElement, name, defaultScope) { + var scope = getScope(flowElement, defaultScope, name); + + return { + name: name, + origin: [flowElement], + scope: scope, + }; +} + + +// helpers //////////////////// + +/** + * Set parent container if it defines it's own scope for the variable, so + * when it defines an input mapping for it. Otherwise returns the default global scope + */ +function getScope(element, globalScope, variableName) { + var parents = getParents(element); + + var scopedParent = minDash.find(parents, function(parent) { + return ( + is$1(parent, 'bpmn:SubProcess') && hasInputParameter(parent, variableName) + ); + }); + + return scopedParent ? scopedParent : globalScope; +} + +function is$1(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} + +function hasInputParameter(element, name) { + return minDash.find(getInputParameters(element), function(input) { + return input.name === name; + }); +} + +function combineArrays(a, b) { + return a.concat(b); +} + +/** + * Retrieves process variables defined in output parameters, e.g. + * + * + * 200 + * ${myLocalVar + 20} + * + * + * => Adds two variables "variable1" & "variable2" to the list. + * + */ +function extractOutputParameters(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + // variables are created by output parameters + var outputParameters = getOutputParameters(element); + + // extract all variables with correct scope + minDash.forEach(outputParameters, function(parameter) { + var newVariable = createProcessVariable( + element, + parameter.name, + containerElement + ); + + addVariableToList(processVariables, newVariable); + }); + }); + + return processVariables; +} + +/** + * Retrieves process variables defined in result variables, e.g. + * + * + * + * => Adds one variable "variable1"to the list. + * + */ +function extractResultVariables(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var resultVariable = getResultVariable(element); + + if (resultVariable) { + var newVariable = createProcessVariable( + element, + resultVariable, + containerElement + ); + + addVariableToList(processVariables, newVariable); + } + }); + + return processVariables; +} + + +// helpers /////////////////////// + +function getResultVariable(element) { + return element.get('camunda:resultVariable'); +} + +/** + * Retrieves process variables defined in form fields, e.g. + * + * + * + * + * + * + * => Adds two variables "variable1" & "variable2" to the list. + * + */ +function extractFormFields(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var formFields = getFormFields(element); + + // extract all variables with correct scope + minDash.forEach(formFields, function(field) { + var newVariable = createProcessVariable( + element, + field.id, + containerElement + ); + + addVariableToList(processVariables, newVariable); + }); + }); + + return processVariables; +} + +/** + * Retrieves process variables defined in output mappings and + * ignores local variables, e.g. + * + * + * + * + * + * + * => Adds one variable "variable1" to the list. + * + */ +function extractOutMappings(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var outMappings = getOutMappings(element); + + // extract all variables with correct scope + minDash.forEach(outMappings, function(mapping) { + + // do not use variables marked as + if (mapping.local) { + return; + } + + var newVariable = createProcessVariable( + element, + mapping.target, + containerElement + ); + + addVariableToList(processVariables, newVariable); + }); + }); + + return processVariables; +} + +/** + * + * @param {ModdleElement} element + * @param {string} [type] - optional + * + * @return {Array|undefined} collection of event definitions or none + */ +function getEventDefinitions(element, type) { + var eventDefinitions = element.eventDefinitions; + + if (!eventDefinitions || !type) { + return eventDefinitions; + } + + return minDash.filter(eventDefinitions, function(definition) { + return is$2(definition, type); + }); +} + +/** + * Returns error event definitions for a given element. + * + * @param {ModdleElement} element + * + * @return {Array} collection of error event definitions + */ +function getErrorEventDefinitions(element) { + return getEventDefinitions(element, 'bpmn:ErrorEventDefinition'); +} + +/** + * Returns escalation event definitions for a given element. + * + * @param {ModdleElement} element + * + * @return {Array} collection of escalation event definitions + */ +function getEscalationEventDefinitions(element) { + return getEventDefinitions(element, 'bpmn:EscalationEventDefinition'); +} + + +// helper //////////////// + +function is$2(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} + +/** + * Retrieves process variables defined in event definitions, e.g. + * + * + * + * => Adds one variable "variable1" to the list. + * + * + * + * => Adds two variables "variable2" & "variable3" to the list. + * + */ +function extractEventDefinitionVariables(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + var addVariable = function(element, name) { + var newVariable = createProcessVariable( + element, + name, + containerElement + ); + + addVariableToList(processVariables, newVariable); + }; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + // (1) error event code + message variable + var errorEventDefinitions = getErrorEventDefinitions(element); + + minDash.forEach(errorEventDefinitions, function(definition) { + + var errorCodeVariable = definition.get('errorCodeVariable'), + errorMessageVariable = definition.get('errorMessageVariable'); + + if (errorCodeVariable) { + addVariable(element, errorCodeVariable); + } + + if (errorMessageVariable) { + addVariable(element, errorMessageVariable); + } + }); + + // (2) escalation code variable + var escalationEventDefinitions = getEscalationEventDefinitions(element); + + minDash.forEach(escalationEventDefinitions, function(definition) { + + var escalationCodeVariable = definition.get('escalationCodeVariable'); + + if (escalationCodeVariable) { + addVariable(element, escalationCodeVariable); + } + }); + + }); + + return processVariables; +} + +var extractors = [ + extractOutputParameters, + extractResultVariables, + extractFormFields, + extractOutMappings, + extractEventDefinitionVariables +]; + +/** + * @typedef {Object} ProcessVariable + * @property {string} name + * @property {Array} origin + * @property {ModdleElement} scope + */ + +// api ///////////////////////// + +/** + * Retrieves all process variables for a given container element. + * @param {ModdleElement} containerElement + * + * @returns {Array} + */ +function getProcessVariables(containerElement) { + var processVariables = []; + + // (1) extract all flow elements inside the container + var elements = selfAndAllFlowElements([containerElement], false); + + // (2) extract all variables from the extractors + minDash.forEach(extractors, function(extractor) { + extractor({ + elements: elements, + containerElement: containerElement, + processVariables: processVariables + }); + }); + + return processVariables; +} + +/** + * Retrieves all variables which are available in the given scope + * + * * Exclude variables which are only available in other scopes + * * Exclude variables which are produced by the given element + * * Include variables which are available in parent scopes + * + * @param {string} scope + * @param {ModdleElement} rootElement element from where to extract all variables + * + * @returns {Array} + */ +function getVariablesForScope(scope, rootElement) { + + var allVariables = getProcessVariables(rootElement); + + var scopeElement = getElement(scope, rootElement); + + // (1) get variables for given scope + var scopeVariables = minDash.filter(allVariables, function(variable) { + return variable.scope.id === scopeElement.id; + }); + + // (2) get variables for parent scopes + var parents = getParents(scopeElement); + + var parentsScopeVariables = minDash.filter(allVariables, function(variable) { + return minDash.find(parents, function(parent) { + return parent.id === variable.scope.id; + }); + }); + + return combineArrays$1(scopeVariables, parentsScopeVariables); +} + +// helpers //////////////////// + +function combineArrays$1(a, b) { + return a.concat(b); +} + +exports.getProcessVariables = getProcessVariables; +exports.getVariablesForScope = getVariablesForScope; + + +/***/ }), + +/***/ "./node_modules/@bpmn-io/extract-process-variables/zeebe/index.js": +/*!************************************************************************!*\ + !*** ./node_modules/@bpmn-io/extract-process-variables/zeebe/index.js ***! + \************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var minDash = __webpack_require__(/*! min-dash */ "./node_modules/min-dash/dist/index.esm.js"); + +/** + * Get a inputOutput from the business object + * + * @param {ModdleElement} element + * + * @return {ModdleElement} the inputOutput object + */ +function getInputOutput(element) { + return (getElements(element, 'zeebe:IoMapping') || [])[0]; +} + +/** + * Return all input parameters existing in the business object, and + * an empty array if none exist. + * + * @param {ModdleElement} element + * + * @return {Array} a list of input parameter objects + */ +function getInputParameters(element) { + return getParameters(element, 'inputParameters'); +} + +/** + * Return out mappings existing in the business object + * + * @param {ModdleElement} element + * + * @return {Array} + */ +function getOutMappings(element) { + return (getInputOutput(element) || {}).outputParameters; +} + +/** + * Return out mappings existing in the business object + * + * @param {ModdleElement} element + * + * @return {Array} + */ +function getInMappings(element) { + return (getInputOutput(element) || {}).inputParameters; +} + +/** + * Get the inputElement name from a loopCharacteristics + * + * @param {MoodleElement} loopCharacteristics + * @returns {String} outputCollection + */ +function getInputElement(loopCharacteristics) { + const extensionElement = getElements(loopCharacteristics, 'zeebe:LoopCharacteristics')[0]; + return extensionElement && extensionElement.inputElement; +} + +/** + * Get the outputCollection name from a loopCharacteristics + * + * @param {MoodleElement} loopCharacteristics + * @returns {String} outputCollection + */ +function getOutputCollection(loopCharacteristics) { + const extensionElement = getElements(loopCharacteristics, 'zeebe:LoopCharacteristics')[0]; + return extensionElement && extensionElement.outputCollection; + +} + +/** + * Get a calledDecision from the business object + * + * @param {MoodleElement} element + * @returns {MoodleElement} the calledDecision object + */ +function getCalledDecision(element) { + return (getElements(element, 'zeebe:CalledDecision') || [])[0]; +} + + +// helpers ////////// + +function getElements(element, type, property) { + var elements = getExtensionElements(element, type); + + return !property ? elements : (elements[0] || {})[property] || []; +} + +function getParameters(element, property) { + var inputOutput = getInputOutput(element); + + return (inputOutput && inputOutput.get(property)) || []; +} + +function getExtensionElements(element, type) { + var elements = []; + var extensionElements = element.get('extensionElements'); + + if (typeof extensionElements !== 'undefined') { + var extensionValues = extensionElements.get('values'); + + if (typeof extensionValues !== 'undefined') { + elements = minDash.filter(extensionValues, function(value) { + return is(value, type); + }); + } + } + + return elements; +} + +function is(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} + +/** + * Get all parent elements for a given element. + * + * @param {ModdleElement|string} element + * + * @returns {Array} + */ +function getParents(element) { + var parents = []; + var current = element; + + while (current.$parent) { + parents.push(current.$parent); + current = current.$parent; + } + + return parents; +} + +/** + * Iterate over each element in a collection, calling the iterator function `fn` + * with (element, index, recursionDepth). + * + * Recurse into all elements that are returned by `fn`. + * + * @param {Object|Array} elements + * @param {Function} fn iterator function called with (element, index, recursionDepth) + * @param {number} [depth] maximum recursion depth + */ +function eachElement(elements, fn, depth) { + depth = depth || 0; + + if (!minDash.isArray(elements)) { + elements = [elements]; + } + + minDash.forEach(elements, function(s, i) { + var filter = fn(s, i, depth); + + if (minDash.isArray(filter) && filter.length) { + eachElement(filter, fn, depth + 1); + } + }); +} + +/** + * Adds an element to a collection and returns true if the + * element was added. + * + * @param {Array} elements + * @param {Object} e + * @param {boolean} unique + */ +function add(elements, e, unique) { + var canAdd = !unique || elements.indexOf(e) === -1; + + if (canAdd) { + elements.push(e); + } + + return canAdd; +} + +/** + * Collects self + flow elements up to a given depth from a list of elements. + * + * @param {ModdleElement|Array} elements the elements to select the flowElements from + * @param {boolean} unique whether to return a unique result set (no duplicates) + * @param {number} maxDepth the depth to search through or -1 for infinite + * + * @return {Array} found elements + */ +function selfAndFlowElements(elements, unique, maxDepth) { + var result = [], + processedFlowElements = []; + + eachElement(elements, function(element, i, depth) { + add(result, element, unique); + + var flowElements = element.flowElements; + + // max traversal depth not reached yet + if (maxDepth === -1 || depth < maxDepth) { + + // flowElements exist && flowElements not yet processed + if (flowElements && add(processedFlowElements, flowElements, unique)) { + return flowElements; + } + } + }); + + return result; +} + +/** + * Return self + ALL flowElements for a number of elements + * + * @param {Array} elements to query + * @param {boolean} allowDuplicates to allow duplicates in the result set + * + * @return {Array} the collected elements + */ +function selfAndAllFlowElements(elements, allowDuplicates) { + return selfAndFlowElements(elements, !allowDuplicates, -1); +} + +/** + * Return full moddle element for given element id + * + * @param {string} elementId + * @param {ModdleElement} rootElement + * + * @returns {ModdleElement} + */ +function getElement(elementId, rootElement) { + var allElements = selfAndAllFlowElements(rootElement); + + return minDash.find(allElements, function(element) { + return element.id === elementId; + }); +} + +function addVariableToList(variablesList, newVariable) { + var foundIdx = minDash.findIndex(variablesList, function(variable) { + return ( + variable.name === newVariable.name && variable.scope === newVariable.scope + ); + }); + + if (foundIdx >= 0) { + variablesList[foundIdx].origin = combineArrays( + variablesList[foundIdx].origin, + newVariable.origin + ); + } else { + variablesList.push(newVariable); + } +} + +/** + * Creates new process variable definition object + * Identifies correct (highest) scope, in which variable is available + * + * @param {ModdleElement} flowElement + * @param {String} name + * @param {ModdleElement} defaultScope + * + * @returns {ProcessVariable} + */ +function createProcessVariable(flowElement, name, defaultScope) { + var scope = getScope(flowElement, defaultScope, name); + + return { + name: name, + origin: [flowElement], + scope: scope + }; +} + + +// helpers //////////////////// + +/** + * Set parent container if it defines it's own scope for the variable, so + * when it defines an input mapping for it. Otherwise returns the default global scope + */ +function getScope(element, globalScope, variableName) { + var parents = getParents(element); + + var scopedParent = minDash.find(parents, function(parent) { + return ( + is$1(parent, 'bpmn:SubProcess') && hasInputParameter(parent, variableName) + ); + }); + + return scopedParent ? scopedParent : globalScope; +} + +function is$1(element, type) { + return ( + element && + typeof element.$instanceOf === 'function' && + element.$instanceOf(type) + ); +} + +function hasInputParameter(element, name) { + return minDash.find(getInputParameters(element), function(input) { + return input.target === name; + }); +} + +function combineArrays(a, b) { + return a.concat(b); +} + +/** + * Retrieves process variables defined in output mappings, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "variable1" to the list. + * + */ +function extractInMappings(options) { + var elements = options.elements, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var inMappings = getInMappings(element); + + // extract all variables with correct scope + minDash.forEach(inMappings, function(mapping) { + + var newVariable = createProcessVariable( + element, + mapping.target, + element + ); + + addVariableToList(processVariables, newVariable); + }); + }); + + return processVariables; +} + +/** + * Retrieves process variables defined in result variables, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "inputElement"to the list. + * + */ +function extractInputElement(options) { + var elements = options.elements, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var loopCharacteristics = element.loopCharacteristics; + + var inputElement = loopCharacteristics && getInputElement(loopCharacteristics); + + if (inputElement) { + var newVariable = createProcessVariable( + element, + inputElement, + element + ); + + addVariableToList(processVariables, newVariable); + } + }); + + return processVariables; +} + +/** + * Retrieves process variables defined in output mappings, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "variable1" to the list. + * + */ +function extractOutMappings(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var outMappings = getOutMappings(element); + + // extract all variables with correct scope + minDash.forEach(outMappings, function(mapping) { + var newVariable = createProcessVariable( + element, + mapping.target, + containerElement + ); + + addVariableToList(processVariables, newVariable); + }); + }); + + return processVariables; +} + +/** + * Retrieves process variables defined in output collection, e.g. + * + * + * + * + * + * + * + * + * + * => Adds one variable "outputCollection"to the list. + * + */ +function extractOutputCollections(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var loopCharacteristics = element.loopCharacteristics; + + var outputCollection = loopCharacteristics && getOutputCollection(loopCharacteristics); + + if (outputCollection) { + var newVariable = createProcessVariable( + element, + outputCollection, + containerElement + ); + + addVariableToList(processVariables, newVariable); + } + }); + + return processVariables; +} + +/** + * Retrieves process variables defined in result variables, e.g. + * + * + * + * + * + * + * + * + * => Adds one variable "variable1"to the list. + * + */ +function extractResultVariables(options) { + var elements = options.elements, + containerElement = options.containerElement, + processVariables = options.processVariables; + + if (!minDash.isArray(elements)) { + elements = [ elements ]; + } + + minDash.forEach(elements, function(element) { + + var calledDecision = getCalledDecision(element); + + if (!calledDecision) { + return; + } + + var resultVariable = calledDecision.resultVariable; + + if (resultVariable) { + var newVariable = createProcessVariable( + element, + resultVariable, + containerElement + ); + + addVariableToList(processVariables, newVariable); + } + }); + + return processVariables; +} + +var extractors = [ + extractInMappings, + extractInputElement, + extractOutMappings, + extractOutputCollections, + extractResultVariables +]; + +/** + * @typedef {Object} ProcessVariable + * @property {string} name + * @property {Array} origin + * @property {ModdleElement} scope + */ + +// api ///////////////////////// + +/** + * Retrieves all process variables for a given container element. + * @param {ModdleElement} containerElement + * + * @returns {Array} + */ +function getProcessVariables(containerElement) { + var processVariables = []; + + // (1) extract all flow elements inside the container + var elements = selfAndAllFlowElements([containerElement], false); + + // (2) extract all variables from the extractors + minDash.forEach(extractors, function(extractor) { + extractor({ + elements: elements, + containerElement: containerElement, + processVariables: processVariables + }); + }); + + return processVariables; +} + +/** + * Retrieves all variables which are available in the given scope + * + * * Exclude variables which are only available in other scopes + * * Exclude variables which are produced by the given element + * * Include variables which are available in parent scopes + * + * @param {string} scope + * @param {ModdleElement} rootElement element from where to extract all variables + * + * @returns {Array} + */ +function getVariablesForScope(scope, rootElement) { + + var allVariables = getProcessVariables(rootElement); + + var scopeElement = getElement(scope, rootElement); + + // (1) get variables for given scope + var scopeVariables = minDash.filter(allVariables, function(variable) { + return variable.scope.id === scopeElement.id; + }); + + // (2) get variables for parent scopes + var parents = getParents(scopeElement); + + var parentsScopeVariables = minDash.filter(allVariables, function(variable) { + return minDash.find(parents, function(parent) { + return parent.id === variable.scope.id; + }); + }); + + return combineArrays$1(scopeVariables, parentsScopeVariables); +} + + +function getVariablesForElement(element) { + return getVariablesForScope(getScope$1(element), getRootElement(element)); +} + +function getScope$1(element) { + const bo = getBusinessObject(element); + + if (is$2(element, 'bpmn:Participant')) { + return bo.processRef.id; + } + + return bo.id; +} + +function getRootElement(element) { + const businessObject = getBusinessObject(element); + + if (is$2(businessObject, 'bpmn:Participant')) { + return businessObject.processRef; + } + + if (is$2(businessObject, 'bpmn:Process')) { + return businessObject; + } + + let parent = businessObject; + + while (parent.$parent && !is$2(parent, 'bpmn:Process')) { + parent = parent.$parent; + } + + return parent; +} + + +// helpers //////////////////// + +function combineArrays$1(a, b) { + return a.concat(b); +} + + +function getBusinessObject(element) { + return (element && element.businessObject) || element; +} + + +function is$2(element, type) { + var bo = getBusinessObject(element); + + return bo && (typeof bo.$instanceOf === 'function') && bo.$instanceOf(type); +} + +exports.getProcessVariables = getProcessVariables; +exports.getVariablesForElement = getVariablesForElement; +exports.getVariablesForScope = getVariablesForScope; + + +/***/ }), + +/***/ "./node_modules/@bpmn-io/properties-panel/dist/index.esm.js": +/*!******************************************************************!*\ + !*** ./node_modules/@bpmn-io/properties-panel/dist/index.esm.js ***! + \******************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "ArrowIcon": () => (/* binding */ ArrowIcon), +/* harmony export */ "CheckboxEntry": () => (/* binding */ CheckboxEntry), +/* harmony export */ "CollapsibleEntry": () => (/* binding */ CollapsibleEntry), +/* harmony export */ "CreateIcon": () => (/* binding */ CreateIcon), +/* harmony export */ "DebounceInputModule": () => (/* binding */ index), +/* harmony export */ "DeleteIcon": () => (/* binding */ DeleteIcon), +/* harmony export */ "DescriptionContext": () => (/* binding */ DescriptionContext), +/* harmony export */ "DescriptionEntry": () => (/* binding */ Description), +/* harmony export */ "DropdownButton": () => (/* binding */ DropdownButton), +/* harmony export */ "ErrorsContext": () => (/* binding */ ErrorsContext), +/* harmony export */ "EventContext": () => (/* binding */ EventContext), +/* harmony export */ "ExternalLinkIcon": () => (/* binding */ ExternalLinkIcon), +/* harmony export */ "FeelEntry": () => (/* binding */ FeelEntry), +/* harmony export */ "FeelOptionalIcon": () => (/* binding */ FeelOptionalIcon), +/* harmony export */ "FeelRequiredIcon": () => (/* binding */ FeelRequiredIcon), +/* harmony export */ "FeelTextAreaEntry": () => (/* binding */ FeelTextArea), +/* harmony export */ "Group": () => (/* binding */ Group), +/* harmony export */ "Header": () => (/* binding */ Header), +/* harmony export */ "HeaderButton": () => (/* binding */ HeaderButton), +/* harmony export */ "LayoutContext": () => (/* binding */ LayoutContext), +/* harmony export */ "ListEntry": () => (/* binding */ List), +/* harmony export */ "ListGroup": () => (/* binding */ ListGroup), +/* harmony export */ "ListItem": () => (/* binding */ ListItem), +/* harmony export */ "NumberFieldEntry": () => (/* binding */ NumberFieldEntry), +/* harmony export */ "Placeholder": () => (/* binding */ Placeholder), +/* harmony export */ "PropertiesPanel": () => (/* binding */ PropertiesPanel), +/* harmony export */ "PropertiesPanelContext": () => (/* binding */ LayoutContext), +/* harmony export */ "SelectEntry": () => (/* binding */ SelectEntry), +/* harmony export */ "SimpleEntry": () => (/* binding */ Simple), +/* harmony export */ "TextAreaEntry": () => (/* binding */ TextAreaEntry), +/* harmony export */ "TextFieldEntry": () => (/* binding */ TextfieldEntry), +/* harmony export */ "ToggleSwitchEntry": () => (/* binding */ ToggleSwitchEntry), +/* harmony export */ "isCheckboxEntryEdited": () => (/* binding */ isEdited$7), +/* harmony export */ "isFeelEntryEdited": () => (/* binding */ isEdited$6), +/* harmony export */ "isNumberFieldEntryEdited": () => (/* binding */ isEdited$5), +/* harmony export */ "isSelectEntryEdited": () => (/* binding */ isEdited$4), +/* harmony export */ "isSimpleEntryEdited": () => (/* binding */ isEdited$3), +/* harmony export */ "isTextAreaEntryEdited": () => (/* binding */ isEdited$2), +/* harmony export */ "isTextFieldEntryEdited": () => (/* binding */ isEdited$1), +/* harmony export */ "isToggleSwitchEntryEdited": () => (/* binding */ isEdited), +/* harmony export */ "useDescriptionContext": () => (/* binding */ useDescriptionContext), +/* harmony export */ "useError": () => (/* binding */ useError), +/* harmony export */ "useEvent": () => (/* binding */ useEvent), +/* harmony export */ "useEventBuffer": () => (/* binding */ useEventBuffer), +/* harmony export */ "useKeyFactory": () => (/* binding */ useKeyFactory), +/* harmony export */ "useLayoutState": () => (/* binding */ useLayoutState), +/* harmony export */ "usePrevious": () => (/* binding */ usePrevious), +/* harmony export */ "useShowEntryEvent": () => (/* binding */ useShowEntryEvent), +/* harmony export */ "useStaticCallback": () => (/* binding */ useStaticCallback), +/* harmony export */ "useStickyIntersectionObserver": () => (/* binding */ useStickyIntersectionObserver) +/* harmony export */ }); +/* harmony import */ var _preact_hooks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../preact/hooks */ "./node_modules/@bpmn-io/properties-panel/preact/hooks/dist/hooks.module.js"); +/* harmony import */ var min_dash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! min-dash */ "./node_modules/min-dash/dist/index.esm.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js"); +/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _preact_compat__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../preact/compat */ "./node_modules/@bpmn-io/properties-panel/preact/compat/dist/compat.module.js"); +/* harmony import */ var _preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../preact/jsx-runtime */ "./node_modules/@bpmn-io/properties-panel/preact/jsx-runtime/dist/jsxRuntime.module.js"); +/* harmony import */ var min_dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! min-dom */ "./node_modules/min-dom/dist/index.esm.js"); +/* harmony import */ var _preact__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../preact */ "./node_modules/@bpmn-io/properties-panel/preact/dist/preact.module.js"); + + + + + + + + +var ArrowIcon = function ArrowIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("svg", { ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + fillRule: "evenodd", + d: "m11.657 8-4.95 4.95a1 1 0 0 1-1.414-1.414L8.828 8 5.293 4.464A1 1 0 1 1 6.707 3.05L11.657 8z" + }) + }); +}; + +ArrowIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16" +}; + +var CreateIcon = function CreateIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("svg", { ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + fillRule: "evenodd", + d: "M9 13V9h4a1 1 0 0 0 0-2H9V3a1 1 0 1 0-2 0v4H3a1 1 0 1 0 0 2h4v4a1 1 0 0 0 2 0z" + }) + }); +}; + +CreateIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16" +}; + +var DeleteIcon = function DeleteIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("svg", { ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + fillRule: "evenodd", + d: "M12 6v7c0 1.1-.4 1.55-1.5 1.55h-5C4.4 14.55 4 14.1 4 13V6h8zm-1.5 1.5h-5v4.3c0 .66.5 1.2 1.111 1.2H9.39c.611 0 1.111-.54 1.111-1.2V7.5zM13 3h-2l-1-1H6L5 3H3v1.5h10V3z" + }) + }); +}; + +DeleteIcon.defaultProps = { + xmlns: "http://www.w3.org/2000/svg", + width: "16", + height: "16" +}; + +var ExternalLinkIcon = function ExternalLinkIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("svg", { ...props, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12.637 12.637v-4.72h1.362v4.721c0 .36-.137.676-.411.95-.275.275-.591.412-.95.412H3.362c-.38 0-.703-.132-.967-.396A1.315 1.315 0 0 1 2 12.638V3.362c0-.38.132-.703.396-.967S2.982 2 3.363 2h4.553v1.363H3.363v9.274h9.274zM14 2H9.28l-.001 1.362h2.408L5.065 9.984l.95.95 6.622-6.622v2.409H14V2z", + fill: "#818798" + }) + }); +}; + +ExternalLinkIcon.defaultProps = { + width: "16", + height: "16", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}; + +var FeelRequiredIcon = function FeelRequiredIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("svg", { ...props, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + d: "M5.8 7.06V5.95h4.307v1.11H5.8zm0 3.071v-1.11h4.307v1.11H5.8z", + fill: "currentColor" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M8 3.268A4.732 4.732 0 1 0 12.732 8H14a6 6 0 1 1-6-6v1.268z", + fill: "currentColor" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + d: "m11.28 6.072-.832-.56 1.016-1.224L10 3.848l.312-.912 1.392.584L11.632 2h1.032l-.072 1.52 1.392-.584.312.912-1.464.44 1.008 1.224-.832.552-.864-1.296-.864 1.304z", + fill: "currentColor" + })] + }); +}; + +FeelRequiredIcon.defaultProps = { + viewBox: "0 0 16 16", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}; + +var FeelOptionalIcon = function FeelOptionalIcon(props) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("svg", { ...props, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + d: "M5.845 7.04V5.93h4.307v1.11H5.845zm0 3.07V9h4.307v1.11H5.845z", + fill: "currentColor" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("path", { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.286 8a4.714 4.714 0 1 0 9.428 0 4.714 4.714 0 0 0-9.428 0zM8 2a6 6 0 1 0 0 12A6 6 0 0 0 8 2z", + fill: "currentColor" + })] + }); +}; + +FeelOptionalIcon.defaultProps = { + viewBox: "0 0 16 16", + fill: "none", + xmlns: "http://www.w3.org/2000/svg" +}; + +function Header(props) { + const { + element, + headerProvider + } = props; + const { + getElementIcon, + getDocumentationRef, + getElementLabel, + getTypeLabel + } = headerProvider; + const label = getElementLabel(element); + const type = getTypeLabel(element); + const documentationRef = getDocumentationRef && getDocumentationRef(element); + const ElementIcon = getElementIcon(element); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-header", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-header-icon", + children: ElementIcon && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ElementIcon, { + width: "32", + height: "32", + viewBox: "0 0 32 32" + }) + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-header-labels", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + title: type, + class: "bio-properties-panel-header-type", + children: type + }), label ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + title: label, + class: "bio-properties-panel-header-label", + children: label + }) : null] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-header-actions", + children: documentationRef ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("a", { + rel: "noopener", + class: "bio-properties-panel-header-link", + href: documentationRef, + title: "Open documentation", + target: "_blank", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ExternalLinkIcon, {}) + }) : null + })] + }); +} + +const DescriptionContext = (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createContext)({ + description: {}, + getDescriptionForId: () => {} +}); + +const ErrorsContext = (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createContext)({ + errors: {} +}); + +/** + * @typedef {Function} callback + * + * @example + * + * useEvent('propertiesPanel.showEntry', ({ focus = false, ...rest }) => { + * // ... + * }); + * + * @param {Object} context + * @param {boolean} [context.focus] + * + * @returns void + */ +const EventContext = (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createContext)({ + eventBus: null +}); + +const LayoutContext = (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createContext)({ + layout: {}, + setLayout: () => {}, + getLayoutForKey: () => {}, + setLayoutForKey: () => {} +}); + +/** + * Accesses the global DescriptionContext and returns a description for a given id and element. + * + * @example + * ```jsx + * function TextField(props) { + * const description = useDescriptionContext('input1', element); + * } + * ``` + * + * @param {string} id + * @param {object} element + * + * @returns {string} + */ + +function useDescriptionContext(id, element) { + const { + getDescriptionForId + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(DescriptionContext); + return getDescriptionForId(id, element); +} + +function useError(id) { + const { + errors + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(ErrorsContext); + return errors[id]; +} + +/** + * Subscribe to an event immediately. Update subscription after inputs changed. + * + * @param {string} event + * @param {Function} callback + */ + +function useEvent(event, callback, eventBus) { + const eventContext = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(EventContext); + + if (!eventBus) { + ({ + eventBus + } = eventContext); + } + + const didMount = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); // (1) subscribe immediately + + if (eventBus && !didMount.current) { + eventBus.on(event, callback); + } // (2) update subscription after inputs changed + + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (eventBus && didMount.current) { + eventBus.on(event, callback); + } + + didMount.current = true; + return () => { + if (eventBus) { + eventBus.off(event, callback); + } + }; + }, [callback, event, eventBus]); +} + +const HIGH_PRIORITY = 10000; +/** + * Buffer events and re-fire during passive effect phase. + * + * @param {string[]} bufferedEvents + * @param {Object} [eventBus] + */ + +function useEventBuffer(bufferedEvents, eventBus) { + const buffer = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)([]), + buffering = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(true); + + const createCallback = event => data => { + if (buffering.current === true) { + buffer.current.unshift([event, data]); + } + }; // (1) buffer events + + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!eventBus) { + return; + } + + const listeners = bufferedEvents.map(event => { + return [event, createCallback(event)]; + }); + listeners.forEach(([event, callback]) => { + eventBus.on(event, HIGH_PRIORITY, callback); + }); + return () => { + listeners.forEach(([event, callback]) => { + eventBus.off(event, callback); + }); + }; + }, [bufferedEvents, eventBus]); // (2) re-fire events + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!eventBus) { + return; + } + + buffering.current = false; + + while (buffer.current.length) { + const [event, data] = buffer.current.pop(); + eventBus.fire(event, data); + } + + buffering.current = true; + }); +} + +const KEY_LENGTH = 6; +/** + * Create a persistent key factory for plain objects without id. + * + * @example + * ```jsx + * function List({ objects }) { + * const getKey = useKeyFactory(); + * return (
    { + * objects.map(obj => { + * const key = getKey(obj); + * return
  1. obj.name
  2. + * }) + * }
); + * } + * ``` + * + * @param {any[]} dependencies + * @returns {(element: object) => string} + */ + +function useKeyFactory(dependencies = []) { + const map = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => new Map(), dependencies); + + const getKey = el => { + let key = map.get(el); + + if (!key) { + key = Math.random().toString().slice(-KEY_LENGTH); + map.set(el, key); + } + + return key; + }; + + return getKey; +} + +/** + * Creates a state that persists in the global LayoutContext. + * + * @example + * ```jsx + * function Group(props) { + * const [ open, setOpen ] = useLayoutState([ 'groups', 'foo', 'open' ], false); + * } + * ``` + * + * @param {(string|number)[]} path + * @param {any} [defaultValue] + * + * @returns {[ any, Function ]} + */ + +function useLayoutState(path, defaultValue) { + const { + getLayoutForKey, + setLayoutForKey + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext); + const layoutForKey = getLayoutForKey(path, defaultValue); + const [value, set] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(layoutForKey); + + const setState = newValue => { + // (1) set component state + set(newValue); // (2) set context + + setLayoutForKey(path, newValue); + }; + + return [value, setState]; +} + +/** + * @pinussilvestrus: we need to introduce our own hook to persist the previous + * state on updates. + * + * cf. https://reactjs.org/docs/hooks-faq.html#how-to-get-the-previous-props-or-state + */ + +function usePrevious(value) { + const ref = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + ref.current = value; + }); + return ref.current; +} + +/** + * Subscribe to `propertiesPanel.showEntry`. + * + * @param {string} id + * + * @returns {import('preact').Ref} + */ + +function useShowEntryEvent(id) { + const { + onShow + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext); + const ref = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(); + const focus = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); + const onShowEntry = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(event => { + if (event.id === id) { + onShow(); + + if (!focus.current) { + focus.current = true; + } + } + }, [id]); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (focus.current && ref.current) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isFunction)(ref.current.focus)) { + ref.current.focus(); + } + + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isFunction)(ref.current.select)) { + ref.current.select(); + } + + focus.current = false; + } + }); + useEvent('propertiesPanel.showEntry', onShowEntry); + return ref; +} + +/** + * @callback setSticky + * @param {boolean} value + */ + +/** + * Use IntersectionObserver to identify when DOM element is in sticky mode. + * If sticky is observered setSticky(true) will be called. + * If sticky mode is left, setSticky(false) will be called. + * + * + * @param {Object} ref + * @param {string} scrollContainerSelector + * @param {setSticky} setSticky + */ + +function useStickyIntersectionObserver(ref, scrollContainerSelector, setSticky) { + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const Observer = IntersectionObserver; // return early if IntersectionObserver is not available + + if (!Observer) { + return; + } + + let observer; + + if (ref.current) { + const scrollContainer = (0,min_dom__WEBPACK_IMPORTED_MODULE_6__.query)(scrollContainerSelector); + observer = new Observer(entries => { + entries.forEach(entry => { + if (entry.intersectionRatio < 1) { + setSticky(true); + } else if (entry.intersectionRatio === 1) { + setSticky(false); + } + }); + }, { + root: scrollContainer, + rootMargin: '0px 0px 999999% 0px', + // Use bottom margin to avoid stickyness when scrolling out to bottom + threshold: [1] + }); + observer.observe(ref.current); + } // Unobserve if unmounted + + + return () => { + if (ref.current && observer) { + observer.unobserve(ref.current); + } + }; + }, [ref, scrollContainerSelector, setSticky]); +} + +/** + * Creates a static function reference with changing body. + * This is necessary when external libraries require a callback function + * that has references to state variables. + * + * Usage: + * const callback = useStaticCallback((val) => {val === currentState}); + * + * The `callback` reference is static and can be safely used in external + * libraries or as a prop that does not cause rerendering of children. + * + * @param {Function} callback function with changing reference + * @returns {Function} static function reference + */ + +function useStaticCallback(callback) { + const callbackRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(callback); + callbackRef.current = callback; + return (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)((...args) => callbackRef.current(...args), []); +} + +function Group(props) { + const { + element, + entries = [], + id, + label, + shouldOpen = false + } = props; + const groupRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [open, setOpen] = useLayoutState(['groups', id, 'open'], shouldOpen); + const onShow = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => setOpen(true), [setOpen]); + + const toggleOpen = () => setOpen(!open); + + const [edited, setEdited] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const [sticky, setSticky] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); // set edited state depending on all entries + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + const hasOneEditedEntry = entries.find(entry => { + const { + id, + isEdited + } = entry; + const entryNode = (0,min_dom__WEBPACK_IMPORTED_MODULE_6__.query)(`[data-entry-id="${id}"]`); + + if (!(0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isFunction)(isEdited) || !entryNode) { + return false; + } + + const inputNode = (0,min_dom__WEBPACK_IMPORTED_MODULE_6__.query)('.bio-properties-panel-input', entryNode); + return isEdited(inputNode); + }); + setEdited(hasOneEditedEntry); + }, [entries]); // set css class when group is sticky to top + + useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky); + const propertiesPanelContext = { ...(0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext), + onShow + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-group", + "data-group-id": 'group-' + id, + ref: groupRef, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-group-header', edited ? '' : 'empty', open ? 'open' : '', sticky && open ? 'sticky' : ''), + onClick: toggleOpen, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + title: label, + class: "bio-properties-panel-group-header-title", + children: label + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-group-header-buttons", + children: [edited && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(DataMarker, {}), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("button", { + title: "Toggle section", + class: "bio-properties-panel-group-header-button bio-properties-panel-arrow", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + })] + })] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-group-entries', open ? 'open' : ''), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: entries.map(entry => { + const { + component: Component, + id + } = entry; + return (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createElement)(Component, { ...entry, + element: element, + key: id + }); + }) + }) + })] + }); +} + +function DataMarker() { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + title: "Section contains data", + class: "bio-properties-panel-dot" + }); +} + +/** + * @typedef { { + * text: (element: object) => string, + * icon?: (element: Object) => import('preact').Component + * } } PlaceholderDefinition + * + * @param { PlaceholderDefinition } props + */ +function Placeholder(props) { + const { + text, + icon: Icon + } = props; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel open", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("section", { + class: "bio-properties-panel-placeholder", + children: [Icon && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Icon, { + class: "bio-properties-panel-placeholder-icon" + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("p", { + class: "bio-properties-panel-placeholder-text", + children: text + })] + }) + }); +} + +const DEFAULT_LAYOUT = { + open: true +}; +const DEFAULT_DESCRIPTION = {}; +const bufferedEvents = ['propertiesPanel.showEntry', 'propertiesPanel.setErrors']; +/** + * @typedef { { + * component: import('preact').Component, + * id: String, + * isEdited?: Function + * } } EntryDefinition + * + * @typedef { { + * autoFocusEntry: String, + * autoOpen?: Boolean, + * entries: Array, + * id: String, + * label: String, + * remove: (event: MouseEvent) => void + * } } ListItemDefinition + * + * @typedef { { + * add: (event: MouseEvent) => void, + * component: import('preact').Component, + * element: Object, + * id: String, + * items: Array, + * label: String, + * shouldSort?: Boolean, + * shouldOpen?: Boolean + * } } ListGroupDefinition + * + * @typedef { { + * component?: import('preact').Component, + * entries: Array, + * id: String, + * label: String, + * shouldOpen?: Boolean + * } } GroupDefinition + * + * @typedef { { + * [id: String]: GetDescriptionFunction + * } } DescriptionConfig + * + * @callback { { + * @param {string} id + * @param {Object} element + * @returns {string} + * } } GetDescriptionFunction + * + * @typedef { { + * getEmpty: (element: object) => import('./components/Placeholder').PlaceholderDefinition, + * getMultiple: (element: Object) => import('./components/Placeholder').PlaceholderDefinition + * } } PlaceholderProvider + * + */ + +/** + * A basic properties panel component. Describes *how* content will be rendered, accepts + * data from implementor to describe *what* will be rendered. + * + * @param {Object} props + * @param {Object|Array} props.element + * @param {import('./components/Header').HeaderProvider} props.headerProvider + * @param {PlaceholderProvider} [props.placeholderProvider] + * @param {Array} props.groups + * @param {Object} [props.layoutConfig] + * @param {Function} [props.layoutChanged] + * @param {DescriptionConfig} [props.descriptionConfig] + * @param {Function} [props.descriptionLoaded] + * @param {Object} [props.eventBus] + */ + +function PropertiesPanel(props) { + const { + element, + headerProvider, + placeholderProvider, + groups, + layoutConfig = {}, + layoutChanged, + descriptionConfig = {}, + descriptionLoaded, + eventBus + } = props; // set-up layout context + + const [layout, setLayout] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(createLayout(layoutConfig)); + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (typeof layoutChanged === 'function') { + layoutChanged(layout); + } + }, [layout, layoutChanged]); + + const getLayoutForKey = (key, defaultValue) => { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.get)(layout, key, defaultValue); + }; + + const setLayoutForKey = (key, config) => { + const newLayout = (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.assign)({}, layout); + (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.set)(newLayout, key, config); + setLayout(newLayout); + }; + + const layoutContext = { + layout, + setLayout, + getLayoutForKey, + setLayoutForKey + }; // set-up description context + + const description = createDescriptionContext(descriptionConfig); + + if (typeof descriptionLoaded === 'function') { + descriptionLoaded(description); + } + + const getDescriptionForId = (id, element) => { + return description[id] && description[id](element); + }; + + const descriptionContext = { + description, + getDescriptionForId + }; + useEventBuffer(bufferedEvents, eventBus); + const [errors, setErrors] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)({}); + + const onSetErrors = ({ + errors + }) => setErrors(errors); + + useEvent('propertiesPanel.setErrors', onSetErrors, eventBus); + const errorsContext = { + errors + }; + const eventContext = { + eventBus + }; + const propertiesPanelContext = { + element + }; // empty state + + if (placeholderProvider && !element) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Placeholder, { ...placeholderProvider.getEmpty() + }); + } // multiple state + + + if (placeholderProvider && (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isArray)(element)) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Placeholder, { ...placeholderProvider.getMultiple() + }); + } + + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ErrorsContext.Provider, { + value: errorsContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(DescriptionContext.Provider, { + value: descriptionContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(LayoutContext.Provider, { + value: layoutContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(EventContext.Provider, { + value: eventContext, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel', layout.open ? 'open' : ''), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Header, { + element: element, + headerProvider: headerProvider + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-scroll-container", + children: groups.map(group => { + const { + component: Component = Group, + id + } = group; + return (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createElement)(Component, { ...group, + key: id, + element: element + }); + }) + })] + }) + }) + }) + }) + }) + }); +} // helpers ////////////////// + +function createLayout(overrides) { + return { ...DEFAULT_LAYOUT, + ...overrides + }; +} + +function createDescriptionContext(overrides) { + return { ...DEFAULT_DESCRIPTION, + ...overrides + }; +} + +function DropdownButton(props) { + const { + class: className, + children, + menuItems = [] + } = props; + const dropdownRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const menuRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [open, setOpen] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + + const close = () => setOpen(false); + + function onDropdownToggle(event) { + if (menuRef.current && menuRef.current.contains(event.target)) { + return; + } + + event.stopPropagation(); + setOpen(open => !open); + } + + function onActionClick(event, action) { + event.stopPropagation(); + close(); + action(); + } + + useGlobalClick([dropdownRef.current], () => close()); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-dropdown-button', { + open + }, className), + onClick: onDropdownToggle, + ref: dropdownRef, + children: [children, (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-dropdown-button__menu", + ref: menuRef, + children: menuItems.map((item, index) => (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(MenuItem, { + onClick: onActionClick, + item: item + }, index)) + })] + }); +} + +function MenuItem({ + item, + onClick +}) { + if (item.separator) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--separator" + }); + } + + if (item.action) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("button", { + class: "bio-properties-panel-dropdown-button__menu-item bio-properties-panel-dropdown-button__menu-item--actionable", + onClick: event => onClick(event, item.action), + children: item.entry + }); + } + + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-dropdown-button__menu-item", + children: item.entry + }); +} +/** + * + * @param {Array} ignoredElements + * @param {Function} callback + */ + + +function useGlobalClick(ignoredElements, callback) { + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + /** + * @param {MouseEvent} event + */ + function listener(event) { + if (ignoredElements.some(element => element && element.contains(event.target))) { + return; + } + + callback(); + } + + document.addEventListener('click', listener, { + capture: true + }); + return () => document.removeEventListener('click', listener, { + capture: true + }); + }, [...ignoredElements, callback]); +} + +function HeaderButton(props) { + const { + children = null, + class: classname, + onClick = () => {}, + ...otherProps + } = props; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("button", { ...otherProps, + onClick: onClick, + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-group-header-button', classname), + children: children + }); +} + +function CollapsibleEntry(props) { + const { + element, + entries = [], + id, + label, + open: shouldOpen, + remove + } = props; + const [open, setOpen] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(shouldOpen); + + const toggleOpen = () => setOpen(!open); + + const { + onShow + } = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext); + const propertiesPanelContext = { ...(0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext), + onShow: (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => { + setOpen(true); + + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isFunction)(onShow)) { + onShow(); + } + }, [onShow, setOpen]) + }; // todo(pinussilvestrus): translate once we have a translate mechanism for the core + + const placeholderLabel = ''; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + "data-entry-id": id, + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-collapsible-entry', open ? 'open' : ''), + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-collapsible-entry-header", + onClick: toggleOpen, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + title: label || placeholderLabel, + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-collapsible-entry-header-title', !label && 'empty'), + children: label || placeholderLabel + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("button", { + title: "Toggle list item", + class: "bio-properties-panel-arrow bio-properties-panel-collapsible-entry-arrow", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + }), remove ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("button", { + title: "Delete item", + class: "bio-properties-panel-remove-entry", + onClick: remove, + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(DeleteIcon, {}) + }) : null] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-collapsible-entry-entries', open ? 'open' : ''), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: entries.map(entry => { + const { + component: Component, + id + } = entry; + return (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createElement)(Component, { ...entry, + element: element, + key: id + }); + }) + }) + })] + }); +} + +function ListItem(props) { + const { + autoFocusEntry, + autoOpen + } = props; // focus specified entry on auto open + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (autoOpen && autoFocusEntry) { + const entry = (0,min_dom__WEBPACK_IMPORTED_MODULE_6__.query)(`[data-entry-id="${autoFocusEntry}"]`); + const focusableInput = (0,min_dom__WEBPACK_IMPORTED_MODULE_6__.query)('.bio-properties-panel-input', entry); + + if (focusableInput) { + if ((0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isFunction)(focusableInput.select)) { + focusableInput.select(); + } else if ((0,min_dash__WEBPACK_IMPORTED_MODULE_5__.isFunction)(focusableInput.focus)) { + focusableInput.focus(); + } + } + } + }, [autoOpen, autoFocusEntry]); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-list-item", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(CollapsibleEntry, { ...props, + open: autoOpen + }) + }); +} + +const noop$2 = () => {}; +/** + * @param {import('../PropertiesPanel').ListGroupDefinition} props + */ + + +function ListGroup(props) { + const { + add, + element, + id, + items, + label, + shouldOpen = true, + shouldSort = true + } = props; + const groupRef = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); + const [open, setOpen] = useLayoutState(['groups', id, 'open'], false); + const [sticky, setSticky] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const onShow = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => setOpen(true), [setOpen]); + const [ordering, setOrdering] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)([]); + const [newItemAdded, setNewItemAdded] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(false); + const prevItems = usePrevious(items); + const prevElement = usePrevious(element); + const elementChanged = element !== prevElement; + const shouldHandleEffects = !elementChanged && (shouldSort || shouldOpen); // reset initial ordering when element changes (before first render) + + if (elementChanged) { + setOrdering(createOrdering(shouldSort ? sortItems(items) : items)); + } // keep ordering in sync to items - and open changes + // (0) set initial ordering from given items + + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (!prevItems || !shouldSort) { + setOrdering(createOrdering(items)); + } + }, [items, element]); // (1) items were added + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (shouldHandleEffects && prevItems && items.length > prevItems.length) { + let add = []; + items.forEach(item => { + if (!ordering.includes(item.id)) { + add.push(item.id); + } + }); + let newOrdering = ordering; // open if not open and configured + + if (!open && shouldOpen) { + toggleOpen(); // if I opened and I should sort, then sort items + + if (shouldSort) { + newOrdering = createOrdering(sortItems(items)); + } + } // add new items on top or bottom depending on sorting behavior + + + newOrdering = newOrdering.filter(item => !add.includes(item)); + + if (shouldSort) { + newOrdering.unshift(...add); + } else { + newOrdering.push(...add); + } + + setOrdering(newOrdering); + setNewItemAdded(true); + } else { + setNewItemAdded(false); + } + }, [items, open, shouldHandleEffects]); // (2) sort items on open if shouldSort is set + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (shouldSort && open && !newItemAdded) { + setOrdering(createOrdering(sortItems(items))); + } + }, [open, shouldSort]); // (3) items were deleted + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (shouldHandleEffects && prevItems && items.length < prevItems.length) { + let keep = []; + ordering.forEach(o => { + if (getItem(items, o)) { + keep.push(o); + } + }); + setOrdering(keep); + } + }, [items, shouldHandleEffects]); // set css class when group is sticky to top + + useStickyIntersectionObserver(groupRef, 'div.bio-properties-panel-scroll-container', setSticky); + + const toggleOpen = () => setOpen(!open); + + const hasItems = !!items.length; + const propertiesPanelContext = { ...(0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useContext)(LayoutContext), + onShow + }; + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-group", + "data-group-id": 'group-' + id, + ref: groupRef, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-group-header', hasItems ? '' : 'empty', hasItems && open ? 'open' : '', sticky && open ? 'sticky' : ''), + onClick: hasItems ? toggleOpen : noop$2, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + title: label, + class: "bio-properties-panel-group-header-title", + children: label + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-group-header-buttons", + children: [add ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("button", { + title: "Create new list item", + class: "bio-properties-panel-group-header-button bio-properties-panel-add-entry", + onClick: add, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(CreateIcon, {}), !hasItems ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("span", { + class: "bio-properties-panel-add-entry-label", + children: "Create" + }) : null] + }) : null, hasItems ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + title: `List contains ${items.length} item${items.length != 1 ? 's' : ''}`, + class: "bio-properties-panel-list-badge", + children: items.length + }) : null, hasItems ? (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("button", { + title: "Toggle section", + class: "bio-properties-panel-group-header-button bio-properties-panel-arrow", + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(ArrowIcon, { + class: open ? 'bio-properties-panel-arrow-down' : 'bio-properties-panel-arrow-right' + }) + }) : null] + })] + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: classnames__WEBPACK_IMPORTED_MODULE_1___default()('bio-properties-panel-list', open && hasItems ? 'open' : ''), + children: (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(LayoutContext.Provider, { + value: propertiesPanelContext, + children: ordering.map((o, index) => { + const item = getItem(items, o); + + if (!item) { + return; + } + + const { + id + } = item; // if item was added, open first or last item based on ordering + + const autoOpen = newItemAdded && (shouldSort ? index === 0 : index === ordering.length - 1); + return (0,_preact__WEBPACK_IMPORTED_MODULE_4__.createElement)(ListItem, { ...item, + autoOpen: autoOpen, + element: element, + index: index, + key: id + }); + }) + }) + })] + }); +} // helpers //////////////////// + +/** + * Sorts given items alphanumeric by label + */ + +function sortItems(items) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.sortBy)(items, i => i.label.toLowerCase()); +} + +function getItem(items, id) { + return (0,min_dash__WEBPACK_IMPORTED_MODULE_5__.find)(items, i => i.id === id); +} + +function createOrdering(items) { + return items.map(i => i.id); +} + +function Description(props) { + const { + element, + forId, + value + } = props; + const contextDescription = useDescriptionContext(forId, element); + const description = value || contextDescription; + + if (description) { + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-description", + children: description + }); + } +} + +function Checkbox(props) { + const { + id, + label, + onChange, + disabled, + value = false + } = props; + const [localValue, setLocalValue] = (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useState)(value); + + const handleChangeCallback = ({ + target + }) => { + onChange(target.checked); + }; + + const handleChange = e => { + handleChangeCallback(e); + setLocalValue(e.target.value); + }; + + (0,_preact_hooks__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => { + if (value === localValue) { + return; + } + + setLocalValue(value); + }, [value]); + const ref = useShowEntryEvent(id); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-checkbox", + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("input", { + ref: ref, + id: prefixId$7(id), + name: id, + type: "checkbox", + class: "bio-properties-panel-input", + onChange: handleChange, + checked: localValue, + disabled: disabled + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("label", { + for: prefixId$7(id), + class: "bio-properties-panel-label", + children: label + })] + }); +} +/** + * @param {Object} props + * @param {Object} props.element + * @param {String} props.id + * @param {String} props.description + * @param {String} props.label + * @param {Function} props.getValue + * @param {Function} props.setValue + * @param {boolean} [props.disabled] + */ + + +function CheckboxEntry(props) { + const { + element, + id, + description, + label, + getValue, + setValue, + disabled + } = props; + const value = getValue(element); + const error = useError(id); + return (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsxs)("div", { + class: "bio-properties-panel-entry bio-properties-panel-checkbox-entry", + "data-entry-id": id, + children: [(0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Checkbox, { + disabled: disabled, + id: id, + label: label, + onChange: setValue, + value: value + }, element), error && (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)("div", { + class: "bio-properties-panel-error", + children: error + }), (0,_preact_jsx_runtime__WEBPACK_IMPORTED_MODULE_3__.jsx)(Description, { + forId: id, + element: element, + value: description + })] + }); +} +function isEdited$7(node) { + return node && !!node.checked; +} // helpers ///////////////// + +function prefixId$7(id) { + return `bio-properties-panel-${id}`; +} + +/** +The data structure for documents. @nonabstract +*/class Text{/** + @internal + */constructor(){}/** + Get the line description around the given position. + */lineAt(pos){if(pos<0||pos>this.length)throw new RangeError(`Invalid position ${pos} in document of length ${this.length}`);return this.lineInner(pos,false,1,0);}/** + Get the description for the given (1-based) line number. + */line(n){if(n<1||n>this.lines)throw new RangeError(`Invalid line number ${n} in ${this.lines}-line document`);return this.lineInner(n,true,1,0);}/** + Replace a range of the text with the given content. + */replace(from,to,text){let parts=[];this.decompose(0,from,parts,2/* To */);if(text.length)text.decompose(0,text.length,parts,1/* From */|2/* To */);this.decompose(to,this.length,parts,1/* From */);return TextNode.from(parts,this.length-(to-from)+text.length);}/** + Append another document to this one. + */append(other){return this.replace(this.length,this.length,other);}/** + Retrieve the text between the given points. + */slice(from,to=this.length){let parts=[];this.decompose(from,to,parts,0);return TextNode.from(parts,to-from);}/** + Test whether this text is equal to another instance. + */eq(other){if(other==this)return true;if(other.length!=this.length||other.lines!=this.lines)return false;let start=this.scanIdentical(other,1),end=this.length-this.scanIdentical(other,-1);let a=new RawTextCursor(this),b=new RawTextCursor(other);for(let skip=start,pos=start;;){a.next(skip);b.next(skip);skip=0;if(a.lineBreak!=b.lineBreak||a.done!=b.done||a.value!=b.value)return false;pos+=a.value.length;if(a.done||pos>=end)return true;}}/** + Iterate over the text. When `dir` is `-1`, iteration happens + from end to start. This will return lines and the breaks between + them as separate strings. + */iter(dir=1){return new RawTextCursor(this,dir);}/** + Iterate over a range of the text. When `from` > `to`, the + iterator will run in reverse. + */iterRange(from,to=this.length){return new PartialTextCursor(this,from,to);}/** + Return a cursor that iterates over the given range of lines, + _without_ returning the line breaks between, and yielding empty + strings for empty lines. + + When `from` and `to` are given, they should be 1-based line numbers. + */iterLines(from,to){let inner;if(from==null){inner=this.iter();}else {if(to==null)to=this.lines+1;let start=this.line(from).from;inner=this.iterRange(start,Math.max(start,to==this.lines+1?this.length:to<=1?0:this.line(to-1).to));}return new LineCursor(inner);}/** + @internal + */toString(){return this.sliceString(0);}/** + Convert the document to an array of lines (which can be + deserialized again via [`Text.of`](https://codemirror.net/6/docs/ref/#state.Text^of)). + */toJSON(){let lines=[];this.flatten(lines);return lines;}/** + Create a `Text` instance for the given array of lines. + */static of(text){if(text.length==0)throw new RangeError("A document must have at least one line");if(text.length==1&&!text[0])return Text.empty;return text.length<=32/* Branch */?new TextLeaf(text):TextNode.from(TextLeaf.split(text,[]));}}// Leaves store an array of line strings. There are always line breaks +// between these strings. Leaves are limited in size and have to be +// contained in TextNode instances for bigger documents. +class TextLeaf extends Text{constructor(text,length=textLength(text)){super();this.text=text;this.length=length;}get lines(){return this.text.length;}get children(){return null;}lineInner(target,isLine,line,offset){for(let i=0;;i++){let string=this.text[i],end=offset+string.length;if((isLine?line:end)>=target)return new Line(offset,end,line,string);offset=end+1;line++;}}decompose(from,to,target,open){let text=from<=0&&to>=this.length?this:new TextLeaf(sliceText(this.text,from,to),Math.min(to,this.length)-Math.max(0,from));if(open&1/* From */){let prev=target.pop();let joined=appendText(text.text,prev.text.slice(),0,text.length);if(joined.length<=32/* Branch */){target.push(new TextLeaf(joined,prev.length+text.length));}else {let mid=joined.length>>1;target.push(new TextLeaf(joined.slice(0,mid)),new TextLeaf(joined.slice(mid)));}}else {target.push(text);}}replace(from,to,text){if(!(text instanceof TextLeaf))return super.replace(from,to,text);let lines=appendText(this.text,appendText(text.text,sliceText(this.text,0,from)),to);let newLen=this.length+text.length-(to-from);if(lines.length<=32/* Branch */)return new TextLeaf(lines,newLen);return TextNode.from(TextLeaf.split(lines,[]),newLen);}sliceString(from,to=this.length,lineSep="\n"){let result="";for(let pos=0,i=0;pos<=to&&ifrom&&i)result+=lineSep;if(frompos)result+=line.slice(Math.max(0,from-pos),to-pos);pos=end+1;}return result;}flatten(target){for(let line of this.text)target.push(line);}scanIdentical(){return 0;}static split(text,target){let part=[],len=-1;for(let line of text){part.push(line);len+=line.length+1;if(part.length==32/* Branch */){target.push(new TextLeaf(part,len));part=[];len=-1;}}if(len>-1)target.push(new TextLeaf(part,len));return target;}}// Nodes provide the tree structure of the `Text` type. They store a +// number of other nodes or leaves, taking care to balance themselves +// on changes. There are implied line breaks _between_ the children of +// a node (but not before the first or after the last child). +class TextNode extends Text{constructor(children,length){super();this.children=children;this.length=length;this.lines=0;for(let child of children)this.lines+=child.lines;}lineInner(target,isLine,line,offset){for(let i=0;;i++){let child=this.children[i],end=offset+child.length,endLine=line+child.lines-1;if((isLine?endLine:end)>=target)return child.lineInner(target,isLine,line,offset);offset=end+1;line=endLine+1;}}decompose(from,to,target,open){for(let i=0,pos=0;pos<=to&&i=pos){let childOpen=open&((pos<=from?1/* From */:0)|(end>=to?2/* To */:0));if(pos>=from&&end<=to&&!childOpen)target.push(child);else child.decompose(from-pos,to-pos,target,childOpen);}pos=end+1;}}replace(from,to,text){if(text.lines=pos&&to<=end){let updated=child.replace(from-pos,to-pos,text);let totalLines=this.lines-child.lines+updated.lines;if(updated.lines>5/* BranchShift */-1&&updated.lines>totalLines>>5/* BranchShift */+1){let copy=this.children.slice();copy[i]=updated;return new TextNode(copy,this.length-(to-from)+text.length);}return super.replace(pos,end,updated);}pos=end+1;}return super.replace(from,to,text);}sliceString(from,to=this.length,lineSep="\n"){let result="";for(let i=0,pos=0;ifrom&&i)result+=lineSep;if(frompos)result+=child.sliceString(from-pos,to-pos,lineSep);pos=end+1;}return result;}flatten(target){for(let child of this.children)child.flatten(target);}scanIdentical(other,dir){if(!(other instanceof TextNode))return 0;let length=0;let[iA,iB,eA,eB]=dir>0?[0,0,this.children.length,other.children.length]:[this.children.length-1,other.children.length-1,-1,-1];for(;;iA+=dir,iB+=dir){if(iA==eA||iB==eB)return length;let chA=this.children[iA],chB=other.children[iB];if(chA!=chB)return length+chA.scanIdentical(chB,dir);length+=chA.length+1;}}static from(children,length=children.reduce((l,ch)=>l+ch.length+1,-1)){let lines=0;for(let ch of children)lines+=ch.lines;if(lines<32/* Branch */){let flat=[];for(let ch of children)ch.flatten(flat);return new TextLeaf(flat,length);}let chunk=Math.max(32/* Branch */,lines>>5/* BranchShift */),maxChunk=chunk<<1,minChunk=chunk>>1;let chunked=[],currentLines=0,currentLen=-1,currentChunk=[];function add(child){let last;if(child.lines>maxChunk&&child instanceof TextNode){for(let node of child.children)add(node);}else if(child.lines>minChunk&&(currentLines>minChunk||!currentLines)){flush();chunked.push(child);}else if(child instanceof TextLeaf&¤tLines&&(last=currentChunk[currentChunk.length-1])instanceof TextLeaf&&child.lines+last.lines<=32/* Branch */){currentLines+=child.lines;currentLen+=child.length+1;currentChunk[currentChunk.length-1]=new TextLeaf(last.text.concat(child.text),last.length+1+child.length);}else {if(currentLines+child.lines>chunk)flush();currentLines+=child.lines;currentLen+=child.length+1;currentChunk.push(child);}}function flush(){if(currentLines==0)return;chunked.push(currentChunk.length==1?currentChunk[0]:TextNode.from(currentChunk,currentLen));currentLen=-1;currentLines=currentChunk.length=0;}for(let child of children)add(child);flush();return chunked.length==1?chunked[0]:new TextNode(chunked,length);}}Text.empty=/*@__PURE__*/new TextLeaf([""],0);function textLength(text){let length=-1;for(let line of text)length+=line.length+1;return length;}function appendText(text,target,from=0,to=1e9){for(let pos=0,i=0,first=true;i=from){if(end>to)line=line.slice(0,to-pos);if(pos0?1:(text instanceof TextLeaf?text.text.length:text.children.length)<<1];}nextInner(skip,dir){this.done=this.lineBreak=false;for(;;){let last=this.nodes.length-1;let top=this.nodes[last],offsetValue=this.offsets[last],offset=offsetValue>>1;let size=top instanceof TextLeaf?top.text.length:top.children.length;if(offset==(dir>0?size:0)){if(last==0){this.done=true;this.value="";return this;}if(dir>0)this.offsets[last-1]++;this.nodes.pop();this.offsets.pop();}else if((offsetValue&1)==(dir>0?0:1)){this.offsets[last]+=dir;if(skip==0){this.lineBreak=true;this.value="\n";return this;}skip--;}else if(top instanceof TextLeaf){// Move to the next string +let next=top.text[offset+(dir<0?-1:0)];this.offsets[last]+=dir;if(next.length>Math.max(0,skip)){this.value=skip==0?next:dir>0?next.slice(skip):next.slice(0,next.length-skip);return this;}skip-=next.length;}else {let next=top.children[offset+(dir<0?-1:0)];if(skip>next.length){skip-=next.length;this.offsets[last]+=dir;}else {if(dir<0)this.offsets[last]--;this.nodes.push(next);this.offsets.push(dir>0?1:(next instanceof TextLeaf?next.text.length:next.children.length)<<1);}}}}next(skip=0){if(skip<0){this.nextInner(-skip,-this.dir);skip=this.value.length;}return this.nextInner(skip,this.dir);}}class PartialTextCursor{constructor(text,start,end){this.value="";this.done=false;this.cursor=new RawTextCursor(text,start>end?-1:1);this.pos=start>end?text.length:0;this.from=Math.min(start,end);this.to=Math.max(start,end);}nextInner(skip,dir){if(dir<0?this.pos<=this.from:this.pos>=this.to){this.value="";this.done=true;return this;}skip+=Math.max(0,dir<0?this.pos-this.to:this.from-this.pos);let limit=dir<0?this.pos-this.from:this.to-this.pos;if(skip>limit)skip=limit;limit-=skip;let{value}=this.cursor.next(skip);this.pos+=(value.length+skip)*dir;this.value=value.length<=limit?value:dir<0?value.slice(value.length-limit):value.slice(0,limit);this.done=!this.value;return this;}next(skip=0){if(skip<0)skip=Math.max(skip,this.from-this.pos);else if(skip>0)skip=Math.min(skip,this.to-this.pos);return this.nextInner(skip,this.cursor.dir);}get lineBreak(){return this.cursor.lineBreak&&this.value!="";}}class LineCursor{constructor(inner){this.inner=inner;this.afterBreak=true;this.value="";this.done=false;}next(skip=0){let{done,lineBreak,value}=this.inner.next(skip);if(done){this.done=true;this.value="";}else if(lineBreak){if(this.afterBreak){this.value="";}else {this.afterBreak=true;this.next();}}else {this.value=value;this.afterBreak=false;}return this;}get lineBreak(){return false;}}if(typeof Symbol!="undefined"){Text.prototype[Symbol.iterator]=function(){return this.iter();};RawTextCursor.prototype[Symbol.iterator]=PartialTextCursor.prototype[Symbol.iterator]=LineCursor.prototype[Symbol.iterator]=function(){return this;};}/** +This type describes a line in the document. It is created +on-demand when lines are [queried](https://codemirror.net/6/docs/ref/#state.Text.lineAt). +*/class Line{/** + @internal + */constructor(/** + The position of the start of the line. + */from,/** + The position at the end of the line (_before_ the line break, + or at the end of document for the last line). + */to,/** + This line's line number (1-based). + */number,/** + The line's content. + */text){this.from=from;this.to=to;this.number=number;this.text=text;}/** + The length of the line (not including any line break after it). + */get length(){return this.to-this.from;}}// Compressed representation of the Grapheme_Cluster_Break=Extend +// information from +// http://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt. +// Each pair of elements represents a range, as an offet from the +// previous range and a length. Numbers are in base-36, with the empty +// string being a shorthand for 1. +let extend=/*@__PURE__*/"lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(s=>s?parseInt(s,36):1);// Convert offsets into absolute values +for(let i=1;icode)return extend[i-1]<=code;return false;}function isRegionalIndicator(code){return code>=0x1F1E6&&code<=0x1F1FF;}const ZWJ=0x200d;/** +Returns a next grapheme cluster break _after_ (not equal to) +`pos`, if `forward` is true, or before otherwise. Returns `pos` +itself if no further cluster break is available in the string. +Moves across surrogate pairs, extending characters (when +`includeExtending` is true), characters joined with zero-width +joiners, and flag emoji. +*/function findClusterBreak(str,pos,forward=true,includeExtending=true){return (forward?nextClusterBreak:prevClusterBreak)(str,pos,includeExtending);}function nextClusterBreak(str,pos,includeExtending){if(pos==str.length)return pos;// If pos is in the middle of a surrogate pair, move to its start +if(pos&&surrogateLow(str.charCodeAt(pos))&&surrogateHigh(str.charCodeAt(pos-1)))pos--;let prev=codePointAt(str,pos);pos+=codePointSize(prev);while(pos=0&&isRegionalIndicator(codePointAt(str,i))){countBefore++;i-=2;}if(countBefore%2==0)break;else pos+=2;}else {break;}}return pos;}function prevClusterBreak(str,pos,includeExtending){while(pos>0){let found=nextClusterBreak(str,pos-2,includeExtending);if(found=0xDC00&&ch<0xE000;}function surrogateHigh(ch){return ch>=0xD800&&ch<0xDC00;}/** +Find the code point at the given position in a string (like the +[`codePointAt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/codePointAt) +string method). +*/function codePointAt(str,pos){let code0=str.charCodeAt(pos);if(!surrogateHigh(code0)||pos+1==str.length)return code0;let code1=str.charCodeAt(pos+1);if(!surrogateLow(code1))return code0;return (code0-0xd800<<10)+(code1-0xdc00)+0x10000;}/** +Given a Unicode codepoint, return the JavaScript string that +respresents it (like +[`String.fromCodePoint`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint)). +*/function fromCodePoint(code){if(code<=0xffff)return String.fromCharCode(code);code-=0x10000;return String.fromCharCode((code>>10)+0xd800,(code&1023)+0xdc00);}/** +The amount of positions a character takes up a JavaScript string. +*/function codePointSize(code){return code<0x10000?1:2;}const DefaultSplit=/\r\n?|\n/;/** +Distinguishes different ways in which positions can be mapped. +*/var MapMode=/*@__PURE__*/function(MapMode){/** + Map a position to a valid new position, even when its context + was deleted. + */MapMode[MapMode["Simple"]=0]="Simple";/** + Return null if deletion happens across the position. + */MapMode[MapMode["TrackDel"]=1]="TrackDel";/** + Return null if the character _before_ the position is deleted. + */MapMode[MapMode["TrackBefore"]=2]="TrackBefore";/** + Return null if the character _after_ the position is deleted. + */MapMode[MapMode["TrackAfter"]=3]="TrackAfter";return MapMode;}(MapMode||(MapMode={}));/** +A change description is a variant of [change set](https://codemirror.net/6/docs/ref/#state.ChangeSet) +that doesn't store the inserted text. As such, it can't be +applied, but is cheaper to store and manipulate. +*/class ChangeDesc{// Sections are encoded as pairs of integers. The first is the +// length in the current document, and the second is -1 for +// unaffected sections, and the length of the replacement content +// otherwise. So an insertion would be (0, n>0), a deletion (n>0, +// 0), and a replacement two positive numbers. +/** + @internal + */constructor(/** + @internal + */sections){this.sections=sections;}/** + The length of the document before the change. + */get length(){let result=0;for(let i=0;ipos)return posB+(pos-posA);posB+=len;}else {if(mode!=MapMode.Simple&&endA>=pos&&(mode==MapMode.TrackDel&&posApos||mode==MapMode.TrackBefore&&posApos))return null;if(endA>pos||endA==pos&&assoc<0&&!len)return pos==posA||assoc<0?posB:posB+ins;posB+=ins;}posA=endA;}if(pos>posA)throw new RangeError(`Position ${pos} is out of range for changeset of length ${posA}`);return posB;}/** + Check whether these changes touch a given range. When one of the + changes entirely covers the range, the string `"cover"` is + returned. + */touchesRange(from,to=from){for(let i=0,pos=0;i=0&&pos<=to&&end>=from)return posto?"cover":true;pos=end;}return false;}/** + @internal + */toString(){let result="";for(let i=0;i=0?":"+ins:"");}return result;}/** + Serialize this change desc to a JSON-representable value. + */toJSON(){return this.sections;}/** + Create a change desc from its JSON representation (as produced + by [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeDesc.toJSON). + */static fromJSON(json){if(!Array.isArray(json)||json.length%2||json.some(a=>typeof a!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ChangeDesc(json);}/** + @internal + */static create(sections){return new ChangeDesc(sections);}}/** +A change set represents a group of modifications to a document. It +stores the document length, and can only be applied to documents +with exactly that length. +*/class ChangeSet extends ChangeDesc{constructor(sections,/** + @internal + */inserted){super(sections);this.inserted=inserted;}/** + Apply the changes to a document, returning the modified + document. + */apply(doc){if(this.length!=doc.length)throw new RangeError("Applying change set to a document with the wrong length");iterChanges(this,(fromA,toA,fromB,_toB,text)=>doc=doc.replace(fromB,fromB+(toA-fromA),text),false);return doc;}mapDesc(other,before=false){return mapSet(this,other,before,true);}/** + Given the document as it existed _before_ the changes, return a + change set that represents the inverse of this set, which could + be used to go from the document created by the changes back to + the document as it existed before the changes. + */invert(doc){let sections=this.sections.slice(),inserted=[];for(let i=0,pos=0;i=0){sections[i]=ins;sections[i+1]=len;let index=i>>1;while(inserted.length0)addInsert(resultInserted,resultSections,iter.text);iter.forward(len);pos+=len;}let end=ranges[i++];while(pos>1].toJSON()));}return parts;}/** + Create a change set for the given changes, for a document of the + given length, using `lineSep` as line separator. + */static of(changes,length,lineSep){let sections=[],inserted=[],pos=0;let total=null;function flush(force=false){if(!force&&!sections.length)return;if(posto||from<0||to>length)throw new RangeError(`Invalid change range ${from} to ${to} (in doc of length ${length})`);let insText=!insert?Text.empty:typeof insert=="string"?Text.of(insert.split(lineSep||DefaultSplit)):insert;let insLen=insText.length;if(from==to&&insLen==0)return;if(frompos)addSection(sections,from-pos,-1);addSection(sections,to-from,insLen);addInsert(inserted,sections,insText);pos=to;}}process(changes);flush(!total);return total;}/** + Create an empty changeset of the given length. + */static empty(length){return new ChangeSet(length?[length,-1]:[],[]);}/** + Create a changeset from its JSON representation (as produced by + [`toJSON`](https://codemirror.net/6/docs/ref/#state.ChangeSet.toJSON). + */static fromJSON(json){if(!Array.isArray(json))throw new RangeError("Invalid JSON representation of ChangeSet");let sections=[],inserted=[];for(let i=0;ii&&typeof e!="string")){throw new RangeError("Invalid JSON representation of ChangeSet");}else if(part.length==1){sections.push(part[0],0);}else {while(inserted.length=0&&ins<=0&&ins==sections[last+1])sections[last]+=len;else if(len==0&§ions[last]==0)sections[last+1]+=ins;else if(forceJoin){sections[last]+=len;sections[last+1]+=ins;}else sections.push(len,ins);}function addInsert(values,sections,value){if(value.length==0)return;let index=sections.length-2>>1;if(index>1]);if(individual||i==desc.sections.length||desc.sections[i+1]<0)break;len=desc.sections[i++];ins=desc.sections[i++];}f(posA,endA,posB,endB,text);posA=endA;posB=endB;}}}function mapSet(setA,setB,before,mkSet=false){let sections=[],insert=mkSet?[]:null;let a=new SectionIter(setA),b=new SectionIter(setB);for(let posA=0,posB=0;;){if(a.ins==-1){posA+=a.len;a.next();}else if(b.ins==-1&&posB=0&&(a.done||posBposB&&!a.done&&posA+a.len=0){let len=0,end=posA+a.len;for(;;){if(b.ins>=0&&posB>posA&&posB+b.lenlen||b.ins>=0&&b.len>len)&&(open||sections.length>sectionLen);a.forward2(len);b.forward(len);}}}class SectionIter{constructor(set){this.set=set;this.i=0;this.next();}next(){let{sections}=this.set;if(this.i>1;return index>=inserted.length?Text.empty:inserted[index];}textBit(len){let{inserted}=this.set,index=this.i-2>>1;return index>=inserted.length&&!len?Text.empty:inserted[index].slice(this.off,len==null?undefined:this.off+len);}forward(len){if(len==this.len)this.next();else {this.len-=len;this.off+=len;}}forward2(len){if(this.ins==-1)this.forward(len);else if(len==this.ins)this.next();else {this.ins-=len;this.off+=len;}}}/** +A single selection range. When +[`allowMultipleSelections`](https://codemirror.net/6/docs/ref/#state.EditorState^allowMultipleSelections) +is enabled, a [selection](https://codemirror.net/6/docs/ref/#state.EditorSelection) may hold +multiple ranges. By default, selections hold exactly one range. +*/class SelectionRange{constructor(/** + The lower boundary of the range. + */from,/** + The upper boundary of the range. + */to,flags){this.from=from;this.to=to;this.flags=flags;}/** + The anchor of the range—the side that doesn't move when you + extend it. + */get anchor(){return this.flags&16/* Inverted */?this.to:this.from;}/** + The head of the range, which is moved when the range is + [extended](https://codemirror.net/6/docs/ref/#state.SelectionRange.extend). + */get head(){return this.flags&16/* Inverted */?this.from:this.to;}/** + True when `anchor` and `head` are at the same position. + */get empty(){return this.from==this.to;}/** + If this is a cursor that is explicitly associated with the + character on one of its sides, this returns the side. -1 means + the character before its position, 1 the character after, and 0 + means no association. + */get assoc(){return this.flags&4/* AssocBefore */?-1:this.flags&8/* AssocAfter */?1:0;}/** + The bidirectional text level associated with this cursor, if + any. + */get bidiLevel(){let level=this.flags&3/* BidiLevelMask */;return level==3?null:level;}/** + The goal column (stored vertical offset) associated with a + cursor. This is used to preserve the vertical position when + [moving](https://codemirror.net/6/docs/ref/#view.EditorView.moveVertically) across + lines of different length. + */get goalColumn(){let value=this.flags>>5/* GoalColumnOffset */;return value==33554431/* NoGoalColumn */?undefined:value;}/** + Map this range through a change, producing a valid range in the + updated document. + */map(change,assoc=-1){let from,to;if(this.empty){from=to=change.mapPos(this.from,assoc);}else {from=change.mapPos(this.from,1);to=change.mapPos(this.to,-1);}return from==this.from&&to==this.to?this:new SelectionRange(from,to,this.flags);}/** + Extend this range to cover at least `from` to `to`. + */extend(from,to=from){if(from<=this.anchor&&to>=this.anchor)return EditorSelection.range(from,to);let head=Math.abs(from-this.anchor)>Math.abs(to-this.anchor)?from:to;return EditorSelection.range(this.anchor,head);}/** + Compare this range to another range. + */eq(other){return this.anchor==other.anchor&&this.head==other.head;}/** + Return a JSON-serializable object representing the range. + */toJSON(){return {anchor:this.anchor,head:this.head};}/** + Convert a JSON representation of a range to a `SelectionRange` + instance. + */static fromJSON(json){if(!json||typeof json.anchor!="number"||typeof json.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return EditorSelection.range(json.anchor,json.head);}/** + @internal + */static create(from,to,flags){return new SelectionRange(from,to,flags);}}/** +An editor selection holds one or more selection ranges. +*/class EditorSelection{constructor(/** + The ranges in the selection, sorted by position. Ranges cannot + overlap (but they may touch, if they aren't empty). + */ranges,/** + The index of the _main_ range in the selection (which is + usually the range that was added last). + */mainIndex){this.ranges=ranges;this.mainIndex=mainIndex;}/** + Map a selection through a change. Used to adjust the selection + position for changes. + */map(change,assoc=-1){if(change.empty)return this;return EditorSelection.create(this.ranges.map(r=>r.map(change,assoc)),this.mainIndex);}/** + Compare this selection to another selection. + */eq(other){if(this.ranges.length!=other.ranges.length||this.mainIndex!=other.mainIndex)return false;for(let i=0;ir.toJSON()),main:this.mainIndex};}/** + Create a selection from a JSON representation. + */static fromJSON(json){if(!json||!Array.isArray(json.ranges)||typeof json.main!="number"||json.main>=json.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new EditorSelection(json.ranges.map(r=>SelectionRange.fromJSON(r)),json.main);}/** + Create a selection holding a single range. + */static single(anchor,head=anchor){return new EditorSelection([EditorSelection.range(anchor,head)],0);}/** + Sort and merge the given set of ranges, creating a valid + selection. + */static create(ranges,mainIndex=0){if(ranges.length==0)throw new RangeError("A selection needs at least one range");for(let pos=0,i=0;ianchor?4/* AssocBefore */:0));}/** + @internal + */static normalized(ranges,mainIndex=0){let main=ranges[mainIndex];ranges.sort((a,b)=>a.from-b.from);mainIndex=ranges.indexOf(main);for(let i=1;irange.head?EditorSelection.range(to,from):EditorSelection.range(from,to));}}return new EditorSelection(ranges,mainIndex);}}function checkSelection(selection,docLength){for(let range of selection.ranges)if(range.to>docLength)throw new RangeError("Selection points outside of document");}let nextID=0;/** +A facet is a labeled value that is associated with an editor +state. It takes inputs from any number of extensions, and combines +those into a single output value. + +Examples of uses of facets are the [tab +size](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize), [editor +attributes](https://codemirror.net/6/docs/ref/#view.EditorView^editorAttributes), and [update +listeners](https://codemirror.net/6/docs/ref/#view.EditorView^updateListener). +*/class Facet{constructor(/** + @internal + */combine,/** + @internal + */compareInput,/** + @internal + */compare,isStatic,/** + @internal + */extensions){this.combine=combine;this.compareInput=compareInput;this.compare=compare;this.isStatic=isStatic;this.extensions=extensions;/** + @internal + */this.id=nextID++;this.default=combine([]);}/** + Define a new facet. + */static define(config={}){return new Facet(config.combine||(a=>a),config.compareInput||((a,b)=>a===b),config.compare||(!config.combine?sameArray$1:(a,b)=>a===b),!!config.static,config.enables);}/** + Returns an extension that adds the given value to this facet. + */of(value){return new FacetProvider([],this,0/* Static */,value);}/** + Create an extension that computes a value for the facet from a + state. You must take care to declare the parts of the state that + this value depends on, since your function is only called again + for a new state when one of those parts changed. + + In cases where your value depends only on a single field, you'll + want to use the [`from`](https://codemirror.net/6/docs/ref/#state.Facet.from) method instead. + */compute(deps,get){if(this.isStatic)throw new Error("Can't compute a static facet");return new FacetProvider(deps,this,1/* Single */,get);}/** + Create an extension that computes zero or more values for this + facet from a state. + */computeN(deps,get){if(this.isStatic)throw new Error("Can't compute a static facet");return new FacetProvider(deps,this,2/* Multi */,get);}from(field,get){if(!get)get=x=>x;return this.compute([field],state=>get(state.field(field)));}}function sameArray$1(a,b){return a==b||a.length==b.length&&a.every((e,i)=>e===b[i]);}class FacetProvider{constructor(dependencies,facet,type,value){this.dependencies=dependencies;this.facet=facet;this.type=type;this.value=value;this.id=nextID++;}dynamicSlot(addresses){var _a;let getter=this.value;let compare=this.facet.compareInput;let id=this.id,idx=addresses[id]>>1,multi=this.type==2/* Multi */;let depDoc=false,depSel=false,depAddrs=[];for(let dep of this.dependencies){if(dep=="doc")depDoc=true;else if(dep=="selection")depSel=true;else if((((_a=addresses[dep.id])!==null&&_a!==void 0?_a:1)&1)==0)depAddrs.push(addresses[dep.id]);}return {create(state){state.values[idx]=getter(state);return 1/* Changed */;},update(state,tr){if(depDoc&&tr.docChanged||depSel&&(tr.docChanged||tr.selection)||ensureAll(state,depAddrs)){let newVal=getter(state);if(multi?!compareArray(newVal,state.values[idx],compare):!compare(newVal,state.values[idx])){state.values[idx]=newVal;return 1/* Changed */;}}return 0;},reconfigure:(state,oldState)=>{let newVal=getter(state);let oldAddr=oldState.config.address[id];if(oldAddr!=null){let oldVal=getAddr(oldState,oldAddr);if(this.dependencies.every(dep=>{return dep instanceof Facet?oldState.facet(dep)===state.facet(dep):dep instanceof StateField?oldState.field(dep,false)==state.field(dep,false):true;})||(multi?compareArray(newVal,oldVal,compare):compare(newVal,oldVal))){state.values[idx]=oldVal;return 0;}}state.values[idx]=newVal;return 1/* Changed */;}};}}function compareArray(a,b,compare){if(a.length!=b.length)return false;for(let i=0;iaddresses[p.id]);let providerTypes=providers.map(p=>p.type);let dynamic=providerAddrs.filter(p=>!(p&1));let idx=addresses[facet.id]>>1;function get(state){let values=[];for(let i=0;ia===b),config);if(config.provide)field.provides=config.provide(field);return field;}create(state){let init=state.facet(initField).find(i=>i.field==this);return ((init===null||init===void 0?void 0:init.create)||this.createF)(state);}/** + @internal + */slot(addresses){let idx=addresses[this.id]>>1;return {create:state=>{state.values[idx]=this.create(state);return 1/* Changed */;},update:(state,tr)=>{let oldVal=state.values[idx];let value=this.updateF(oldVal,tr);if(this.compareF(oldVal,value))return 0;state.values[idx]=value;return 1/* Changed */;},reconfigure:(state,oldState)=>{if(oldState.config.address[this.id]!=null){state.values[idx]=oldState.field(this);return 0;}state.values[idx]=this.create(state);return 1/* Changed */;}};}/** + Returns an extension that enables this field and overrides the + way it is initialized. Can be useful when you need to provide a + non-default starting value for the field. + */init(create){return [this,initField.of({field:this,create})];}/** + State field instances can be used as + [`Extension`](https://codemirror.net/6/docs/ref/#state.Extension) values to enable the field in a + given state. + */get extension(){return this;}}const Prec_={lowest:4,low:3,default:2,high:1,highest:0};function prec(value){return ext=>new PrecExtension(ext,value);}/** +By default extensions are registered in the order they are found +in the flattened form of nested array that was provided. +Individual extension values can be assigned a precedence to +override this. Extensions that do not have a precedence set get +the precedence of the nearest parent with a precedence, or +[`default`](https://codemirror.net/6/docs/ref/#state.Prec.default) if there is no such parent. The +final ordering of extensions is determined by first sorting by +precedence and then by order within each precedence. +*/const Prec={/** + The highest precedence level, for extensions that should end up + near the start of the precedence ordering. + */highest:/*@__PURE__*/prec(Prec_.highest),/** + A higher-than-default precedence, for extensions that should + come before those with default precedence. + */high:/*@__PURE__*/prec(Prec_.high),/** + The default precedence, which is also used for extensions + without an explicit precedence. + */default:/*@__PURE__*/prec(Prec_.default),/** + A lower-than-default precedence. + */low:/*@__PURE__*/prec(Prec_.low),/** + The lowest precedence level. Meant for things that should end up + near the end of the extension order. + */lowest:/*@__PURE__*/prec(Prec_.lowest)};class PrecExtension{constructor(inner,prec){this.inner=inner;this.prec=prec;}}/** +Extension compartments can be used to make a configuration +dynamic. By [wrapping](https://codemirror.net/6/docs/ref/#state.Compartment.of) part of your +configuration in a compartment, you can later +[replace](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) that part through a +transaction. +*/class Compartment{/** + Create an instance of this compartment to add to your [state + configuration](https://codemirror.net/6/docs/ref/#state.EditorStateConfig.extensions). + */of(ext){return new CompartmentInstance(this,ext);}/** + Create an [effect](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects) that + reconfigures this compartment. + */reconfigure(content){return Compartment.reconfigure.of({compartment:this,extension:content});}/** + Get the current content of the compartment in the state, or + `undefined` if it isn't present. + */get(state){return state.config.compartments.get(this);}}class CompartmentInstance{constructor(compartment,inner){this.compartment=compartment;this.inner=inner;}}class Configuration{constructor(base,compartments,dynamicSlots,address,staticValues,facets){this.base=base;this.compartments=compartments;this.dynamicSlots=dynamicSlots;this.address=address;this.staticValues=staticValues;this.facets=facets;this.statusTemplate=[];while(this.statusTemplate.length>1];}static resolve(base,compartments,oldState){let fields=[];let facets=Object.create(null);let newCompartments=new Map();for(let ext of flatten(base,compartments,newCompartments)){if(ext instanceof StateField)fields.push(ext);else (facets[ext.facet.id]||(facets[ext.facet.id]=[])).push(ext);}let address=Object.create(null);let staticValues=[];let dynamicSlots=[];for(let field of fields){address[field.id]=dynamicSlots.length<<1;dynamicSlots.push(a=>field.slot(a));}let oldFacets=oldState===null||oldState===void 0?void 0:oldState.config.facets;for(let id in facets){let providers=facets[id],facet=providers[0].facet;let oldProviders=oldFacets&&oldFacets[id]||[];if(providers.every(p=>p.type==0/* Static */)){address[facet.id]=staticValues.length<<1|1;if(sameArray$1(oldProviders,providers)){staticValues.push(oldState.facet(facet));}else {let value=facet.combine(providers.map(p=>p.value));staticValues.push(oldState&&facet.compare(value,oldState.facet(facet))?oldState.facet(facet):value);}}else {for(let p of providers){if(p.type==0/* Static */){address[p.id]=staticValues.length<<1|1;staticValues.push(p.value);}else {address[p.id]=dynamicSlots.length<<1;dynamicSlots.push(a=>p.dynamicSlot(a));}}address[facet.id]=dynamicSlots.length<<1;dynamicSlots.push(a=>dynamicFacetSlot(a,facet,providers));}}let dynamic=dynamicSlots.map(f=>f(address));return new Configuration(base,newCompartments,dynamic,address,staticValues,facets);}}function flatten(extension,compartments,newCompartments){let result=[[],[],[],[],[]];let seen=new Map();function inner(ext,prec){let known=seen.get(ext);if(known!=null){if(known<=prec)return;let found=result[known].indexOf(ext);if(found>-1)result[known].splice(found,1);if(ext instanceof CompartmentInstance)newCompartments.delete(ext.compartment);}seen.set(ext,prec);if(Array.isArray(ext)){for(let e of ext)inner(e,prec);}else if(ext instanceof CompartmentInstance){if(newCompartments.has(ext.compartment))throw new RangeError(`Duplicate use of compartment in extensions`);let content=compartments.get(ext.compartment)||ext.inner;newCompartments.set(ext.compartment,content);inner(content,prec);}else if(ext instanceof PrecExtension){inner(ext.inner,ext.prec);}else if(ext instanceof StateField){result[prec].push(ext);if(ext.provides)inner(ext.provides,prec);}else if(ext instanceof FacetProvider){result[prec].push(ext);if(ext.facet.extensions)inner(ext.facet.extensions,prec);}else {let content=ext.extension;if(!content)throw new Error(`Unrecognized extension value in extension set (${ext}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);inner(content,prec);}}inner(extension,Prec_.default);return result.reduce((a,b)=>a.concat(b));}function ensureAddr(state,addr){if(addr&1)return 2/* Computed */;let idx=addr>>1;let status=state.status[idx];if(status==4/* Computing */)throw new Error("Cyclic dependency between fields and/or facets");if(status&2/* Computed */)return status;state.status[idx]=4/* Computing */;let changed=state.computeSlot(state,state.config.dynamicSlots[idx]);return state.status[idx]=2/* Computed */|changed;}function getAddr(state,addr){return addr&1?state.config.staticValues[addr>>1]:state.values[addr>>1];}const languageData=/*@__PURE__*/Facet.define();const allowMultipleSelections=/*@__PURE__*/Facet.define({combine:values=>values.some(v=>v),static:true});const lineSeparator=/*@__PURE__*/Facet.define({combine:values=>values.length?values[0]:undefined,static:true});const changeFilter=/*@__PURE__*/Facet.define();const transactionFilter=/*@__PURE__*/Facet.define();const transactionExtender=/*@__PURE__*/Facet.define();const readOnly=/*@__PURE__*/Facet.define({combine:values=>values.length?values[0]:false});/** +Annotations are tagged values that are used to add metadata to +transactions in an extensible way. They should be used to model +things that effect the entire transaction (such as its [time +stamp](https://codemirror.net/6/docs/ref/#state.Transaction^time) or information about its +[origin](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent)). For effects that happen +_alongside_ the other changes made by the transaction, [state +effects](https://codemirror.net/6/docs/ref/#state.StateEffect) are more appropriate. +*/class Annotation{/** + @internal + */constructor(/** + The annotation type. + */type,/** + The value of this annotation. + */value){this.type=type;this.value=value;}/** + Define a new type of annotation. + */static define(){return new AnnotationType();}}/** +Marker that identifies a type of [annotation](https://codemirror.net/6/docs/ref/#state.Annotation). +*/class AnnotationType{/** + Create an instance of this annotation. + */of(value){return new Annotation(this,value);}}/** +Representation of a type of state effect. Defined with +[`StateEffect.define`](https://codemirror.net/6/docs/ref/#state.StateEffect^define). +*/class StateEffectType{/** + @internal + */constructor(// The `any` types in these function types are there to work +// around TypeScript issue #37631, where the type guard on +// `StateEffect.is` mysteriously stops working when these properly +// have type `Value`. +/** + @internal + */map){this.map=map;}/** + Create a [state effect](https://codemirror.net/6/docs/ref/#state.StateEffect) instance of this + type. + */of(value){return new StateEffect(this,value);}}/** +State effects can be used to represent additional effects +associated with a [transaction](https://codemirror.net/6/docs/ref/#state.Transaction.effects). They +are often useful to model changes to custom [state +fields](https://codemirror.net/6/docs/ref/#state.StateField), when those changes aren't implicit in +document or selection changes. +*/class StateEffect{/** + @internal + */constructor(/** + @internal + */type,/** + The value of this effect. + */value){this.type=type;this.value=value;}/** + Map this effect through a position mapping. Will return + `undefined` when that ends up deleting the effect. + */map(mapping){let mapped=this.type.map(this.value,mapping);return mapped===undefined?undefined:mapped==this.value?this:new StateEffect(this.type,mapped);}/** + Tells you whether this effect object is of a given + [type](https://codemirror.net/6/docs/ref/#state.StateEffectType). + */is(type){return this.type==type;}/** + Define a new effect type. The type parameter indicates the type + of values that his effect holds. + */static define(spec={}){return new StateEffectType(spec.map||(v=>v));}/** + Map an array of effects through a change set. + */static mapEffects(effects,mapping){if(!effects.length)return effects;let result=[];for(let effect of effects){let mapped=effect.map(mapping);if(mapped)result.push(mapped);}return result;}}/** +This effect can be used to reconfigure the root extensions of +the editor. Doing this will discard any extensions +[appended](https://codemirror.net/6/docs/ref/#state.StateEffect^appendConfig), but does not reset +the content of [reconfigured](https://codemirror.net/6/docs/ref/#state.Compartment.reconfigure) +compartments. +*/StateEffect.reconfigure=/*@__PURE__*/StateEffect.define();/** +Append extensions to the top-level configuration of the editor. +*/StateEffect.appendConfig=/*@__PURE__*/StateEffect.define();/** +Changes to the editor state are grouped into transactions. +Typically, a user action creates a single transaction, which may +contain any number of document changes, may change the selection, +or have other effects. Create a transaction by calling +[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update), or immediately +dispatch one by calling +[`EditorView.dispatch`](https://codemirror.net/6/docs/ref/#view.EditorView.dispatch). +*/class Transaction{constructor(/** + The state from which the transaction starts. + */startState,/** + The document changes made by this transaction. + */changes,/** + The selection set by this transaction, or undefined if it + doesn't explicitly set a selection. + */selection,/** + The effects added to the transaction. + */effects,/** + @internal + */annotations,/** + Whether the selection should be scrolled into view after this + transaction is dispatched. + */scrollIntoView){this.startState=startState;this.changes=changes;this.selection=selection;this.effects=effects;this.annotations=annotations;this.scrollIntoView=scrollIntoView;/** + @internal + */this._doc=null;/** + @internal + */this._state=null;if(selection)checkSelection(selection,changes.newLength);if(!annotations.some(a=>a.type==Transaction.time))this.annotations=annotations.concat(Transaction.time.of(Date.now()));}/** + @internal + */static create(startState,changes,selection,effects,annotations,scrollIntoView){return new Transaction(startState,changes,selection,effects,annotations,scrollIntoView);}/** + The new document produced by the transaction. Contrary to + [`.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state)`.doc`, accessing this won't + force the entire new state to be computed right away, so it is + recommended that [transaction + filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) use this getter + when they need to look at the new document. + */get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc));}/** + The new selection produced by the transaction. If + [`this.selection`](https://codemirror.net/6/docs/ref/#state.Transaction.selection) is undefined, + this will [map](https://codemirror.net/6/docs/ref/#state.EditorSelection.map) the start state's + current selection through the changes made by the transaction. + */get newSelection(){return this.selection||this.startState.selection.map(this.changes);}/** + The new state created by the transaction. Computed on demand + (but retained for subsequent access), so it is recommended not to + access it in [transaction + filters](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter) when possible. + */get state(){if(!this._state)this.startState.applyTransaction(this);return this._state;}/** + Get the value of the given annotation type, if any. + */annotation(type){for(let ann of this.annotations)if(ann.type==type)return ann.value;return undefined;}/** + Indicates whether the transaction changed the document. + */get docChanged(){return !this.changes.empty;}/** + Indicates whether this transaction reconfigures the state + (through a [configuration compartment](https://codemirror.net/6/docs/ref/#state.Compartment) or + with a top-level configuration + [effect](https://codemirror.net/6/docs/ref/#state.StateEffect^reconfigure). + */get reconfigured(){return this.startState.config!=this.state.config;}/** + Returns true if the transaction has a [user + event](https://codemirror.net/6/docs/ref/#state.Transaction^userEvent) annotation that is equal to + or more specific than `event`. For example, if the transaction + has `"select.pointer"` as user event, `"select"` and + `"select.pointer"` will match it. + */isUserEvent(event){let e=this.annotation(Transaction.userEvent);return !!(e&&(e==event||e.length>event.length&&e.slice(0,event.length)==event&&e[event.length]=="."));}}/** +Annotation used to store transaction timestamps. Automatically +added to every transaction, holding `Date.now()`. +*/Transaction.time=/*@__PURE__*/Annotation.define();/** +Annotation used to associate a transaction with a user interface +event. Holds a string identifying the event, using a +dot-separated format to support attaching more specific +information. The events used by the core libraries are: + + - `"input"` when content is entered + - `"input.type"` for typed input + - `"input.type.compose"` for composition + - `"input.paste"` for pasted input + - `"input.drop"` when adding content with drag-and-drop + - `"input.complete"` when autocompleting + - `"delete"` when the user deletes content + - `"delete.selection"` when deleting the selection + - `"delete.forward"` when deleting forward from the selection + - `"delete.backward"` when deleting backward from the selection + - `"delete.cut"` when cutting to the clipboard + - `"move"` when content is moved + - `"move.drop"` when content is moved within the editor through drag-and-drop + - `"select"` when explicitly changing the selection + - `"select.pointer"` when selecting with a mouse or other pointing device + - `"undo"` and `"redo"` for history actions + +Use [`isUserEvent`](https://codemirror.net/6/docs/ref/#state.Transaction.isUserEvent) to check +whether the annotation matches a given event. +*/Transaction.userEvent=/*@__PURE__*/Annotation.define();/** +Annotation indicating whether a transaction should be added to +the undo history or not. +*/Transaction.addToHistory=/*@__PURE__*/Annotation.define();/** +Annotation indicating (when present and true) that a transaction +represents a change made by some other actor, not the user. This +is used, for example, to tag other people's changes in +collaborative editing. +*/Transaction.remote=/*@__PURE__*/Annotation.define();function joinRanges(a,b){let result=[];for(let iA=0,iB=0;;){let from,to;if(iA=a[iA])){from=a[iA++];to=a[iA++];}else if(iB=0;i--){let filtered=filters[i](tr);if(filtered instanceof Transaction)tr=filtered;else if(Array.isArray(filtered)&&filtered.length==1&&filtered[0]instanceof Transaction)tr=filtered[0];else tr=resolveTransaction(state,asArray(filtered),false);}return tr;}function extendTransaction(tr){let state=tr.startState,extenders=state.facet(transactionExtender),spec=tr;for(let i=extenders.length-1;i>=0;i--){let extension=extenders[i](tr);if(extension&&Object.keys(extension).length)spec=mergeTransaction(tr,resolveTransactionInner(state,extension,tr.changes.newLength),true);}return spec==tr?tr:Transaction.create(state,tr.changes,tr.selection,spec.effects,spec.annotations,spec.scrollIntoView);}const none$1=[];function asArray(value){return value==null?none$1:Array.isArray(value)?value:[value];}/** +The categories produced by a [character +categorizer](https://codemirror.net/6/docs/ref/#state.EditorState.charCategorizer). These are used +do things like selecting by word. +*/var CharCategory=/*@__PURE__*/function(CharCategory){/** + Word characters. + */CharCategory[CharCategory["Word"]=0]="Word";/** + Whitespace. + */CharCategory[CharCategory["Space"]=1]="Space";/** + Anything else. + */CharCategory[CharCategory["Other"]=2]="Other";return CharCategory;}(CharCategory||(CharCategory={}));const nonASCIISingleCaseWordChar=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let wordChar;try{wordChar=/*@__PURE__*/new RegExp("[\\p{Alphabetic}\\p{Number}_]","u");}catch(_){}function hasWordChar(str){if(wordChar)return wordChar.test(str);for(let i=0;i"\x80"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch)))return true;}return false;}function makeCategorizer(wordChars){return char=>{if(!/\S/.test(char))return CharCategory.Space;if(hasWordChar(char))return CharCategory.Word;for(let i=0;i-1)return CharCategory.Word;return CharCategory.Other;};}/** +The editor state class is a persistent (immutable) data structure. +To update a state, you [create](https://codemirror.net/6/docs/ref/#state.EditorState.update) a +[transaction](https://codemirror.net/6/docs/ref/#state.Transaction), which produces a _new_ state +instance, without modifying the original object. + +As such, _never_ mutate properties of a state directly. That'll +just break things. +*/class EditorState{constructor(/** + @internal + */config,/** + The current document. + */doc,/** + The current selection. + */selection,/** + @internal + */values,computeSlot,tr){this.config=config;this.doc=doc;this.selection=selection;this.values=values;this.status=config.statusTemplate.slice();this.computeSlot=computeSlot;// Fill in the computed state immediately, so that further queries +// for it made during the update return this state +if(tr)tr._state=this;for(let i=0;icompartments.set(key,val));conf=null;}compartments.set(effect.value.compartment,effect.value.extension);}else if(effect.is(StateEffect.reconfigure)){conf=null;base=effect.value;}else if(effect.is(StateEffect.appendConfig)){conf=null;base=asArray(base).concat(effect.value);}}let startValues;if(!conf){conf=Configuration.resolve(base,compartments,this);let intermediateState=new EditorState(conf,this.doc,this.selection,conf.dynamicSlots.map(()=>null),(state,slot)=>slot.reconfigure(state,this),null);startValues=intermediateState.values;}else {startValues=tr.startState.values.slice();}new EditorState(conf,tr.newDoc,tr.newSelection,startValues,(state,slot)=>slot.update(state,tr),tr);}/** + Create a [transaction spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec) that + replaces every selection range with the given content. + */replaceSelection(text){if(typeof text=="string")text=this.toText(text);return this.changeByRange(range=>({changes:{from:range.from,to:range.to,insert:text},range:EditorSelection.cursor(range.from+text.length)}));}/** + Create a set of changes and a new selection by running the given + function for each range in the active selection. The function + can return an optional set of changes (in the coordinate space + of the start document), plus an updated range (in the coordinate + space of the document produced by the call's own changes). This + method will merge all the changes and ranges into a single + changeset and selection, and return it as a [transaction + spec](https://codemirror.net/6/docs/ref/#state.TransactionSpec), which can be passed to + [`update`](https://codemirror.net/6/docs/ref/#state.EditorState.update). + */changeByRange(f){let sel=this.selection;let result1=f(sel.ranges[0]);let changes=this.changes(result1.changes),ranges=[result1.range];let effects=asArray(result1.effects);for(let i=1;ifield.spec.fromJSON(value,state)));}return EditorState.create({doc:json.doc,selection:EditorSelection.fromJSON(json.selection),extensions:config.extensions?fieldInit.concat([config.extensions]):fieldInit});}/** + Create a new state. You'll usually only need this when + initializing an editor—updated states are created by applying + transactions. + */static create(config={}){let configuration=Configuration.resolve(config.extensions||[],new Map());let doc=config.doc instanceof Text?config.doc:Text.of((config.doc||"").split(configuration.staticFacet(EditorState.lineSeparator)||DefaultSplit));let selection=!config.selection?EditorSelection.single(0):config.selection instanceof EditorSelection?config.selection:EditorSelection.single(config.selection.anchor,config.selection.head);checkSelection(selection,doc.length);if(!configuration.staticFacet(allowMultipleSelections))selection=selection.asSingle();return new EditorState(configuration,doc,selection,configuration.dynamicSlots.map(()=>null),(state,slot)=>slot.create(state),null);}/** + The size (in columns) of a tab in the document, determined by + the [`tabSize`](https://codemirror.net/6/docs/ref/#state.EditorState^tabSize) facet. + */get tabSize(){return this.facet(EditorState.tabSize);}/** + Get the proper [line-break](https://codemirror.net/6/docs/ref/#state.EditorState^lineSeparator) + string for this state. + */get lineBreak(){return this.facet(EditorState.lineSeparator)||"\n";}/** + Returns true when the editor is + [configured](https://codemirror.net/6/docs/ref/#state.EditorState^readOnly) to be read-only. + */get readOnly(){return this.facet(readOnly);}/** + Look up a translation for the given phrase (via the + [`phrases`](https://codemirror.net/6/docs/ref/#state.EditorState^phrases) facet), or return the + original string if no translation is found. + + If additional arguments are passed, they will be inserted in + place of markers like `$1` (for the first value) and `$2`, etc. + A single `$` is equivalent to `$1`, and `$$` will produce a + literal dollar sign. + */phrase(phrase,...insert){for(let map of this.facet(EditorState.phrases))if(Object.prototype.hasOwnProperty.call(map,phrase)){phrase=map[phrase];break;}if(insert.length)phrase=phrase.replace(/\$(\$|\d*)/g,(m,i)=>{if(i=="$")return "$";let n=+(i||1);return n>insert.length?m:insert[n-1];});return phrase;}/** + Find the values for a given language data field, provided by the + the [`languageData`](https://codemirror.net/6/docs/ref/#state.EditorState^languageData) facet. + */languageDataAt(name,pos,side=-1){let values=[];for(let provider of this.facet(languageData)){for(let result of provider(this,pos,side)){if(Object.prototype.hasOwnProperty.call(result,name))values.push(result[name]);}}return values;}/** + Return a function that can categorize strings (expected to + represent a single [grapheme cluster](https://codemirror.net/6/docs/ref/#state.findClusterBreak)) + into one of: + + - Word (contains an alphanumeric character or a character + explicitly listed in the local language's `"wordChars"` + language data, which should be a string) + - Space (contains only whitespace) + - Other (anything else) + */charCategorizer(at){return makeCategorizer(this.languageDataAt("wordChars",at).join(""));}/** + Find the word at the given position, meaning the range + containing all [word](https://codemirror.net/6/docs/ref/#state.CharCategory.Word) characters + around it. If no word characters are adjacent to the position, + this returns null. + */wordAt(pos){let{text,from,length}=this.doc.lineAt(pos);let cat=this.charCategorizer(pos);let start=pos-from,end=pos-from;while(start>0){let prev=findClusterBreak(text,start,false);if(cat(text.slice(prev,start))!=CharCategory.Word)break;start=prev;}while(endvalues.length?values[0]:4});/** +The line separator to use. By default, any of `"\n"`, `"\r\n"` +and `"\r"` is treated as a separator when splitting lines, and +lines are joined with `"\n"`. + +When you configure a value here, only that precise separator +will be used, allowing you to round-trip documents through the +editor without normalizing line separators. +*/EditorState.lineSeparator=lineSeparator;/** +This facet controls the value of the +[`readOnly`](https://codemirror.net/6/docs/ref/#state.EditorState.readOnly) getter, which is +consulted by commands and extensions that implement editing +functionality to determine whether they should apply. It +defaults to false, but when its highest-precedence value is +`true`, such functionality disables itself. + +Not to be confused with +[`EditorView.editable`](https://codemirror.net/6/docs/ref/#view.EditorView^editable), which +controls whether the editor's DOM is set to be editable (and +thus focusable). +*/EditorState.readOnly=readOnly;/** +Registers translation phrases. The +[`phrase`](https://codemirror.net/6/docs/ref/#state.EditorState.phrase) method will look through +all objects registered with this facet to find translations for +its argument. +*/EditorState.phrases=/*@__PURE__*/Facet.define({compare(a,b){let kA=Object.keys(a),kB=Object.keys(b);return kA.length==kB.length&&kA.every(k=>a[k]==b[k]);}});/** +A facet used to register [language +data](https://codemirror.net/6/docs/ref/#state.EditorState.languageDataAt) providers. +*/EditorState.languageData=languageData;/** +Facet used to register change filters, which are called for each +transaction (unless explicitly +[disabled](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter)), and can suppress +part of the transaction's changes. + +Such a function can return `true` to indicate that it doesn't +want to do anything, `false` to completely stop the changes in +the transaction, or a set of ranges in which changes should be +suppressed. Such ranges are represented as an array of numbers, +with each pair of two numbers indicating the start and end of a +range. So for example `[10, 20, 100, 110]` suppresses changes +between 10 and 20, and between 100 and 110. +*/EditorState.changeFilter=changeFilter;/** +Facet used to register a hook that gets a chance to update or +replace transaction specs before they are applied. This will +only be applied for transactions that don't have +[`filter`](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter) set to `false`. You +can either return a single transaction spec (possibly the input +transaction), or an array of specs (which will be combined in +the same way as the arguments to +[`EditorState.update`](https://codemirror.net/6/docs/ref/#state.EditorState.update)). + +When possible, it is recommended to avoid accessing +[`Transaction.state`](https://codemirror.net/6/docs/ref/#state.Transaction.state) in a filter, +since it will force creation of a state that will then be +discarded again, if the transaction is actually filtered. + +(This functionality should be used with care. Indiscriminately +modifying transaction is likely to break something or degrade +the user experience.) +*/EditorState.transactionFilter=transactionFilter;/** +This is a more limited form of +[`transactionFilter`](https://codemirror.net/6/docs/ref/#state.EditorState^transactionFilter), +which can only add +[annotations](https://codemirror.net/6/docs/ref/#state.TransactionSpec.annotations) and +[effects](https://codemirror.net/6/docs/ref/#state.TransactionSpec.effects). _But_, this type +of filter runs even if the transaction has disabled regular +[filtering](https://codemirror.net/6/docs/ref/#state.TransactionSpec.filter), making it suitable +for effects that don't need to touch the changes or selection, +but do want to process every transaction. + +Extenders run _after_ filters, when both are present. +*/EditorState.transactionExtender=transactionExtender;Compartment.reconfigure=/*@__PURE__*/StateEffect.define();/** +Utility function for combining behaviors to fill in a config +object from an array of provided configs. `defaults` should hold +default values for all optional fields in `Config`. + +The function will, by default, error +when a field gets two values that aren't `===`-equal, but you can +provide combine functions per field to do something else. +*/function combineConfig(configs,defaults,// Should hold only the optional properties of Config, but I haven't managed to express that +combine={}){let result={};for(let config of configs)for(let key of Object.keys(config)){let value=config[key],current=result[key];if(current===undefined)result[key]=value;else if(current===value||value===undefined);// No conflict +else if(Object.hasOwnProperty.call(combine,key))result[key]=combine[key](current,value);else throw new Error("Config merge conflict for field "+key);}for(let key in defaults)if(result[key]===undefined)result[key]=defaults[key];return result;}/** +Each range is associated with a value, which must inherit from +this class. +*/class RangeValue{/** + Compare this value with another value. Used when comparing + rangesets. The default implementation compares by identity. + Unless you are only creating a fixed number of unique instances + of your value type, it is a good idea to implement this + properly. + */eq(other){return this==other;}/** + Create a [range](https://codemirror.net/6/docs/ref/#state.Range) with this value. + */range(from,to=from){return Range$2.create(from,to,this);}}RangeValue.prototype.startSide=RangeValue.prototype.endSide=0;RangeValue.prototype.point=false;RangeValue.prototype.mapMode=MapMode.TrackDel;/** +A range associates a value with a range of positions. +*/class Range$2{constructor(/** + The range's start position. + */from,/** + Its end position. + */to,/** + The value associated with this range. + */value){this.from=from;this.to=to;this.value=value;}/** + @internal + */static create(from,to,value){return new Range$2(from,to,value);}}function cmpRange(a,b){return a.from-b.from||a.value.startSide-b.value.startSide;}class Chunk{constructor(from,to,value,// Chunks are marked with the largest point that occurs +// in them (or -1 for no points), so that scans that are +// only interested in points (such as the +// heightmap-related logic) can skip range-only chunks. +maxPoint){this.from=from;this.to=to;this.value=value;this.maxPoint=maxPoint;}get length(){return this.to[this.to.length-1];}// Find the index of the given position and side. Use the ranges' +// `from` pos when `end == false`, `to` when `end == true`. +findIndex(pos,side,end,startAt=0){let arr=end?this.to:this.from;for(let lo=startAt,hi=arr.length;;){if(lo==hi)return lo;let mid=lo+hi>>1;let diff=arr[mid]-pos||(end?this.value[mid].endSide:this.value[mid].startSide)-side;if(mid==lo)return diff>=0?lo:hi;if(diff>=0)hi=mid;else lo=mid+1;}}between(offset,from,to,f){for(let i=this.findIndex(from,-1000000000/* Far */,true),e=this.findIndex(to,1000000000/* Far */,false,i);inewTo||newFrom==newTo&&val.startSide>0&&val.endSide<=0)continue;}if((newTo-newFrom||val.endSide-val.startSide)<0)continue;if(newPos<0)newPos=newFrom;if(val.point)maxPoint=Math.max(maxPoint,newTo-newFrom);value.push(val);from.push(newFrom-newPos);to.push(newTo-newPos);}return {mapped:value.length?new Chunk(from,to,value,maxPoint):null,pos:newPos};}}/** +A range set stores a collection of [ranges](https://codemirror.net/6/docs/ref/#state.Range) in a +way that makes them efficient to [map](https://codemirror.net/6/docs/ref/#state.RangeSet.map) and +[update](https://codemirror.net/6/docs/ref/#state.RangeSet.update). This is an immutable data +structure. +*/class RangeSet{constructor(/** + @internal + */chunkPos,/** + @internal + */chunk,/** + @internal + */nextLayer,/** + @internal + */maxPoint){this.chunkPos=chunkPos;this.chunk=chunk;this.nextLayer=nextLayer;this.maxPoint=maxPoint;}/** + @internal + */static create(chunkPos,chunk,nextLayer,maxPoint){return new RangeSet(chunkPos,chunk,nextLayer,maxPoint);}/** + @internal + */get length(){let last=this.chunk.length-1;return last<0?0:Math.max(this.chunkEnd(last),this.nextLayer.length);}/** + The number of ranges in the set. + */get size(){if(this.isEmpty)return 0;let size=this.nextLayer.size;for(let chunk of this.chunk)size+=chunk.value.length;return size;}/** + @internal + */chunkEnd(index){return this.chunkPos[index]+this.chunk[index].length;}/** + Update the range set, optionally adding new ranges or filtering + out existing ones. + + (Note: The type parameter is just there as a kludge to work + around TypeScript variance issues that prevented `RangeSet` + from being a subtype of `RangeSet` when `X` is a subtype of + `Y`.) + */update(updateSpec){let{add=[],sort=false,filterFrom=0,filterTo=this.length}=updateSpec;let filter=updateSpec.filter;if(add.length==0&&!filter)return this;if(sort)add=add.slice().sort(cmpRange);if(this.isEmpty)return add.length?RangeSet.of(add):this;let cur=new LayerCursor(this,null,-1).goto(0),i=0,spill=[];let builder=new RangeSetBuilder();while(cur.value||i=0){let range=add[i++];if(!builder.addInner(range.from,range.to,range.value))spill.push(range);}else if(cur.rangeIndex==1&&cur.chunkIndexthis.chunkEnd(cur.chunkIndex)||filterTocur.to||filterTo=start&&from<=start+chunk.length&&chunk.between(start,from-start,to-start,f)===false)return;}this.nextLayer.between(from,to,f);}/** + Iterate over the ranges in this set, in order, including all + ranges that end at or after `from`. + */iter(from=0){return HeapCursor.from([this]).goto(from);}/** + @internal + */get isEmpty(){return this.nextLayer==this;}/** + Iterate over the ranges in a collection of sets, in order, + starting from `from`. + */static iter(sets,from=0){return HeapCursor.from(sets).goto(from);}/** + Iterate over two groups of sets, calling methods on `comparator` + to notify it of possible differences. + */static compare(oldSets,newSets,/** + This indicates how the underlying data changed between these + ranges, and is needed to synchronize the iteration. `from` and + `to` are coordinates in the _new_ space, after these changes. + */textDiff,comparator,/** + Can be used to ignore all non-point ranges, and points below + the given size. When -1, all ranges are compared. + */minPointSize=-1){let a=oldSets.filter(set=>set.maxPoint>0||!set.isEmpty&&set.maxPoint>=minPointSize);let b=newSets.filter(set=>set.maxPoint>0||!set.isEmpty&&set.maxPoint>=minPointSize);let sharedChunks=findSharedChunks(a,b,textDiff);let sideA=new SpanCursor(a,sharedChunks,minPointSize);let sideB=new SpanCursor(b,sharedChunks,minPointSize);textDiff.iterGaps((fromA,fromB,length)=>compare(sideA,fromA,sideB,fromB,length,comparator));if(textDiff.empty&&textDiff.length==0)compare(sideA,0,sideB,0,0,comparator);}/** + Compare the contents of two groups of range sets, returning true + if they are equivalent in the given range. + */static eq(oldSets,newSets,from=0,to){if(to==null)to=1000000000/* Far */;let a=oldSets.filter(set=>!set.isEmpty&&newSets.indexOf(set)<0);let b=newSets.filter(set=>!set.isEmpty&&oldSets.indexOf(set)<0);if(a.length!=b.length)return false;if(!a.length)return true;let sharedChunks=findSharedChunks(a,b);let sideA=new SpanCursor(a,sharedChunks,0).goto(from),sideB=new SpanCursor(b,sharedChunks,0).goto(from);for(;;){if(sideA.to!=sideB.to||!sameValues(sideA.active,sideB.active)||sideA.point&&(!sideB.point||!sideA.point.eq(sideB.point)))return false;if(sideA.to>to)return true;sideA.next();sideB.next();}}/** + Iterate over a group of range sets at the same time, notifying + the iterator about the ranges covering every given piece of + content. Returns the open count (see + [`SpanIterator.span`](https://codemirror.net/6/docs/ref/#state.SpanIterator.span)) at the end + of the iteration. + */static spans(sets,from,to,iterator,/** + When given and greater than -1, only points of at least this + size are taken into account. + */minPointSize=-1){let cursor=new SpanCursor(sets,null,minPointSize).goto(from),pos=from;let open=cursor.openStart;for(;;){let curTo=Math.min(cursor.to,to);if(cursor.point){iterator.point(pos,curTo,cursor.point,cursor.activeForPoint(cursor.to),open,cursor.pointRank);open=cursor.openEnd(curTo)+(cursor.to>curTo?1:0);}else if(curTo>pos){iterator.span(pos,curTo,cursor.active,open);open=cursor.openEnd(curTo);}if(cursor.to>to)break;pos=cursor.to;cursor.next();}return open;}/** + Create a range set for the given range or array of ranges. By + default, this expects the ranges to be _sorted_ (by start + position and, if two start at the same position, + `value.startSide`). You can pass `true` as second argument to + cause the method to sort them. + */static of(ranges,sort=false){let build=new RangeSetBuilder();for(let range of ranges instanceof Range$2?[ranges]:sort?lazySort(ranges):ranges)build.add(range.from,range.to,range.value);return build.finish();}}/** +The empty set of ranges. +*/RangeSet.empty=/*@__PURE__*/new RangeSet([],[],null,-1);function lazySort(ranges){if(ranges.length>1)for(let prev=ranges[0],i=1;i0)return ranges.slice().sort(cmpRange);prev=cur;}return ranges;}RangeSet.empty.nextLayer=RangeSet.empty;/** +A range set builder is a data structure that helps build up a +[range set](https://codemirror.net/6/docs/ref/#state.RangeSet) directly, without first allocating +an array of [`Range`](https://codemirror.net/6/docs/ref/#state.Range) objects. +*/class RangeSetBuilder{/** + Create an empty builder. + */constructor(){this.chunks=[];this.chunkPos=[];this.chunkStart=-1;this.last=null;this.lastFrom=-1000000000/* Far */;this.lastTo=-1000000000/* Far */;this.from=[];this.to=[];this.value=[];this.maxPoint=-1;this.setMaxPoint=-1;this.nextLayer=null;}finishChunk(newArrays){this.chunks.push(new Chunk(this.from,this.to,this.value,this.maxPoint));this.chunkPos.push(this.chunkStart);this.chunkStart=-1;this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint);this.maxPoint=-1;if(newArrays){this.from=[];this.to=[];this.value=[];}}/** + Add a range. Ranges should be added in sorted (by `from` and + `value.startSide`) order. + */add(from,to,value){if(!this.addInner(from,to,value))(this.nextLayer||(this.nextLayer=new RangeSetBuilder())).add(from,to,value);}/** + @internal + */addInner(from,to,value){let diff=from-this.lastTo||value.startSide-this.last.endSide;if(diff<=0&&(from-this.lastFrom||value.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");if(diff<0)return false;if(this.from.length==250/* ChunkSize */)this.finishChunk(true);if(this.chunkStart<0)this.chunkStart=from;this.from.push(from-this.chunkStart);this.to.push(to-this.chunkStart);this.last=value;this.lastFrom=from;this.lastTo=to;this.value.push(value);if(value.point)this.maxPoint=Math.max(this.maxPoint,to-from);return true;}/** + @internal + */addChunk(from,chunk){if((from-this.lastTo||chunk.value[0].startSide-this.last.endSide)<0)return false;if(this.from.length)this.finishChunk(true);this.setMaxPoint=Math.max(this.setMaxPoint,chunk.maxPoint);this.chunks.push(chunk);this.chunkPos.push(from);let last=chunk.value.length-1;this.last=chunk.value[last];this.lastFrom=chunk.from[last]+from;this.lastTo=chunk.to[last]+from;return true;}/** + Finish the range set. Returns the new set. The builder can't be + used anymore after this has been called. + */finish(){return this.finishInner(RangeSet.empty);}/** + @internal + */finishInner(next){if(this.from.length)this.finishChunk(false);if(this.chunks.length==0)return next;let result=RangeSet.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(next):next,this.setMaxPoint);this.from=null;// Make sure further `add` calls produce errors +return result;}}function findSharedChunks(a,b,textDiff){let inA=new Map();for(let set of a)for(let i=0;i=this.minPoint)break;}}}setRangeIndex(index){if(index==this.layer.chunk[this.chunkIndex].value.length){this.chunkIndex++;if(this.skip){while(this.chunkIndex=minPoint)heap.push(new LayerCursor(cur,skip,minPoint,i));}}return heap.length==1?heap[0]:new HeapCursor(heap);}get startSide(){return this.value?this.value.startSide:0;}goto(pos,side=-1000000000/* Far */){for(let cur of this.heap)cur.goto(pos,side);for(let i=this.heap.length>>1;i>=0;i--)heapBubble(this.heap,i);this.next();return this;}forward(pos,side){for(let cur of this.heap)cur.forward(pos,side);for(let i=this.heap.length>>1;i>=0;i--)heapBubble(this.heap,i);if((this.to-pos||this.value.endSide-side)<0)this.next();}next(){if(this.heap.length==0){this.from=this.to=1000000000/* Far */;this.value=null;this.rank=-1;}else {let top=this.heap[0];this.from=top.from;this.to=top.to;this.value=top.value;this.rank=top.rank;if(top.value)top.next();heapBubble(this.heap,0);}}}function heapBubble(heap,index){for(let cur=heap[index];;){let childIndex=(index<<1)+1;if(childIndex>=heap.length)break;let child=heap[childIndex];if(childIndex+1=0){child=heap[childIndex+1];childIndex++;}if(cur.compare(child)<0)break;heap[childIndex]=cur;heap[index]=child;index=childIndex;}}class SpanCursor{constructor(sets,skip,minPoint){this.minPoint=minPoint;this.active=[];this.activeTo=[];this.activeRank=[];this.minActive=-1;// A currently active point range, if any +this.point=null;this.pointFrom=0;this.pointRank=0;this.to=-1000000000/* Far */;this.endSide=0;this.openStart=-1;this.cursor=HeapCursor.from(sets,skip,minPoint);}goto(pos,side=-1000000000/* Far */){this.cursor.goto(pos,side);this.active.length=this.activeTo.length=this.activeRank.length=0;this.minActive=-1;this.to=pos;this.endSide=side;this.openStart=-1;this.next();return this;}forward(pos,side){while(this.minActive>-1&&(this.activeTo[this.minActive]-pos||this.active[this.minActive].endSide-side)<0)this.removeActive(this.minActive);this.cursor.forward(pos,side);}removeActive(index){remove(this.active,index);remove(this.activeTo,index);remove(this.activeRank,index);this.minActive=findMinIndex(this.active,this.activeTo);}addActive(trackOpen){let i=0,{value,to,rank}=this.cursor;while(i-1&&(this.activeTo[a]-this.cursor.from||this.active[a].endSide-this.cursor.startSide)<0){if(this.activeTo[a]>from){this.to=this.activeTo[a];this.endSide=this.active[a].endSide;break;}this.removeActive(a);if(trackOpen)remove(trackOpen,a);}else if(!this.cursor.value){this.to=this.endSide=1000000000/* Far */;break;}else if(this.cursor.from>from){this.to=this.cursor.from;this.endSide=this.cursor.startSide;break;}else {let nextVal=this.cursor.value;if(!nextVal.point){// Opening a range +this.addActive(trackOpen);this.cursor.next();}else if(wasPoint&&this.cursor.to==this.to&&this.cursor.from=0;i--){if(this.activeRank[i]to||this.activeTo[i]==to&&this.active[i].endSide>=this.point.endSide)active.push(this.active[i]);}return active.reverse();}openEnd(to){let open=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>to;i--)open++;return open;}}function compare(a,startA,b,startB,length,comparator){a.goto(startA);b.goto(startB);let endB=startB+length;let pos=startB,dPos=startB-startA;for(;;){let diff=a.to+dPos-b.to||a.endSide-b.endSide;let end=diff<0?a.to+dPos:b.to,clipEnd=Math.min(end,endB);if(a.point||b.point){if(!(a.point&&b.point&&(a.point==b.point||a.point.eq(b.point))&&sameValues(a.activeForPoint(a.to+dPos),b.activeForPoint(b.to))))comparator.comparePoint(pos,clipEnd,a.point,b.point);}else {if(clipEnd>pos&&!sameValues(a.active,b.active))comparator.compareRange(pos,clipEnd,a.active,b.active);}if(end>endB)break;pos=end;if(diff<=0)a.next();if(diff>=0)b.next();}}function sameValues(a,b){if(a.length!=b.length)return false;for(let i=0;i=index;i--)array[i+1]=array[i];array[index]=value;}function findMinIndex(value,array){let found=-1,foundPos=1000000000/* Far */;for(let i=0;i=col)return i;if(i==string.length)break;n+=string.charCodeAt(i)==9?tabSize-n%tabSize:1;i=findClusterBreak(string,i);}return strict===true?-1:string.length;}const C="\u037c";const COUNT=typeof Symbol=="undefined"?"__"+C:Symbol.for(C);const SET=typeof Symbol=="undefined"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet");const top=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:{};// :: - Style modules encapsulate a set of CSS rules defined from +// JavaScript. Their definitions are only available in a given DOM +// root after it has been _mounted_ there with `StyleModule.mount`. +// +// Style modules should be created once and stored somewhere, as +// opposed to re-creating them every time you need them. The amount of +// CSS rules generated for a given DOM root is bounded by the amount +// of style modules that were used. So to avoid leaking rules, don't +// create these dynamically, but treat them as one-time allocations. +class StyleModule{// :: (Object