diff --git a/.eslintrc.cjs b/.eslintrc.cjs deleted file mode 100644 index 8d839f89..00000000 --- a/.eslintrc.cjs +++ /dev/null @@ -1,38 +0,0 @@ -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - // 'plugin:@typescript-eslint/recommended-requiring-type-checking', - 'prettier' - ], - plugins: ['svelte3', 'tailwindcss', '@typescript-eslint'], - ignorePatterns: ['docs/*', '*.cjs', 'snapshots.js', 'svelte.config.js', 'package.json'], - overrides: [{ files: ['*.svelte'], processor: 'svelte3/svelte3' }], - settings: { - 'svelte3/typescript': () => require('typescript') - }, - parserOptions: { - sourceType: 'module', - ecmaVersion: 2019, - tsconfigRootDir: __dirname, - project: ['./tsconfig.json'], - extraFileExtensions: ['.svelte'] - }, - env: { - browser: true, - es2017: true, - node: true - }, - rules: { - '@typescript-eslint/ban-ts-comment': [ - 'error', - { - 'ts-ignore': 'allow-with-description' - } - ], - '@typescript-eslint/no-unsafe-member-access': 'warn', - '@typescript-eslint/no-unsafe-assignment': 'warn' - } -}; diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 9246b53c..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: bug -assignees: '' ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Link to Live Editor: -Steps to reproduce the behavior: - -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - -- OS: [e.g. iOS] -- Browser [e.g. chrome, safari] -- Version [e.g. 22] - -**Smartphone (please complete the following information):** - -- Device: [e.g. iPhone6] -- OS: [e.g. iOS8.1] -- Browser [e.g. stock browser, safari] -- Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 5f0a04ce..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,19 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: enhancement -assignees: '' ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/codeql/config.yml b/.github/codeql/config.yml deleted file mode 100644 index af2bab52..00000000 --- a/.github/codeql/config.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: 'Mermaid CodeQL config' - -paths: - - src -paths-ignore: - - node_modules - - '**/*.spec.js' diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 9b517748..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,8 +0,0 @@ -version: 2 -updates: - - package-ecosystem: 'npm' - directory: '/' - target-branch: 'develop' - schedule: - interval: 'weekly' - day: 'friday' diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index ba659117..00000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,17 +0,0 @@ -## :bookmark_tabs: Summary - -Brief description about the content of your PR: - -Resolves # - -## :straight_ruler: Design Decisions - -Describe the way your implementation works or what design decisions you made if applicable: - -### :clipboard: Tasks - -Make sure you - -- [ ] :book: have read the [contribution guidelines](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md) -- [ ] :computer: have added unit/e2e tests (if appropriate) -- [ ] :bookmark: targeted `master` branch diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml deleted file mode 100644 index 3e562342..00000000 --- a/.github/workflows/codeql-analysis.yml +++ /dev/null @@ -1,68 +0,0 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# -name: 'CodeQL' - -on: - push: - branches: [master] - pull_request: - # The branches below must be a subset of the branches above - branches: [master] - schedule: - - cron: '36 1 * * 2' - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - language: ['javascript'] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] - # Learn more: - # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - config-file: ./.github/codeql/config.yml - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - # - name: Autobuild - # uses: github/codeql-action/autobuild@v1 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl - - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language - - #- run: | - # make bootstrap - # make release - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml deleted file mode 100644 index 13cf59fa..00000000 --- a/.github/workflows/cypress.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Cypress Tests - -on: - push: - pull_request: - branches: - - master - -jobs: - cypress-run: - runs-on: ubuntu-latest - container: cypress/browsers:node14.16.0-chrome90-ff88 - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - uses: actions/cache@v2 - id: yarn-and-build-cache - with: - path: | - ~/.cache/Cypress - build - node_modules - key: ${{ runner.os }}-node_modules-build-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node_modules-build- - - # Install NPM dependencies, cache them correctly - # and run all Cypress tests - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - build: yarn build - start: yarn preview - wait-on: 'http://localhost:3000' - wait-on-timeout: 120 - # record: true - headless: true - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 1a790775..00000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Deploy Live Editor -on: - push: - branches: - - master - pull_request: - branches: - - master -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/setup-node@v2 - with: - node-version: '14' - - - name: Checkout - uses: actions/checkout@v2 - - - uses: actions/cache@v2 - id: yarn-and-build-cache - with: - path: | - node_modules - key: ${{ runner.os }}-node_modules-build-deploy-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-node_modules-build-deploy- - - - name: Setup Beta - if: ${{ github.event_name == 'pull_request' }} - run: | - export BETA=true - rm -rf docs/beta/ - - - name: Cleanup build - if: ${{ github.event_name != 'pull_request' }} - run: | - rm -rf docs/_app/ - - - name: Build & Deploy - run: | - npm i -g yarn - export DEPLOY=true - echo "$GITHUB_EVENT_NAME" - yarn install - # yarn run lint - version=$(yarn version --patch --no-git-tag-version | grep "New version" | cut -d':' -f 2) - yarn build - cd bin - ./fix-path - cd .. - git config user.name github-actions - git config user.email github-actions@github.com - git pull origin gh-pages - git add . - git commit -nm "Release $version" - git push origin gh-pages diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml deleted file mode 100644 index d9a8f32d..00000000 --- a/.github/workflows/stale.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Mark stale issues and pull requests - -on: - schedule: - - cron: '0 0 * * 4' - -jobs: - stale: - runs-on: ubuntu-latest - steps: - - uses: actions/stale@v3 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - exempt-issue-labels: 'retained' - exempt-pr-labels: 'retained' - stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days' - stale-pr-message: 'This pr is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days' diff --git a/.gitignore b/.gitignore deleted file mode 100644 index edc0e07e..00000000 --- a/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -node_modules/ -coverage/ -.cache/ -build/ -yarn-error.log -.npmrc -.DS_Store -/.svelte-kit -/build -/functions -/snapshots.js -/cypress/videos -/cypress/screenshots diff --git a/.husky/.gitignore b/.husky/.gitignore deleted file mode 100644 index 31354ec1..00000000 --- a/.husky/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_ diff --git a/.husky/pre-commit b/.husky/pre-commit deleted file mode 100755 index d0612ad3..00000000 --- a/.husky/pre-commit +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -. "$(dirname "$0")/_/husky.sh" - -npm run pre-commit diff --git a/.npmrc b/.npmrc deleted file mode 100644 index b6f27f13..00000000 --- a/.npmrc +++ /dev/null @@ -1 +0,0 @@ -engine-strict=true diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1a41f98d..00000000 --- a/.prettierignore +++ /dev/null @@ -1,6 +0,0 @@ -docs/** -.svelte-kit/** -static/** -build/** -node_modules/** -snapshots.js \ No newline at end of file diff --git a/.prettierrc b/.prettierrc deleted file mode 100644 index b193cb40..00000000 --- a/.prettierrc +++ /dev/null @@ -1,8 +0,0 @@ -{ - "singleQuote": true, - "svelteSortOrder": "options-scripts-markup-styles", - "svelteBracketNewLine": false, - "useTabs": true, - "trailingComma": "none", - "printWidth": 100 -} diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index bd507041..00000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,46 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment include: - -- Using welcoming and inclusive language -- Being respectful of differing viewpoints and experiences -- Gracefully accepting constructive criticism -- Focusing on what is best for the community -- Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -- The use of sexualized language or imagery and unwelcome sexual attention or advances -- Trolling, insulting/derogatory comments, and personal or political attacks -- Public or private harassment -- Publishing others' private information, such as a physical or electronic address, without explicit permission -- Other conduct which could reasonably be considered inappropriate in a professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the maintainers. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - -[homepage]: http://contributor-covenant.org -[version]: http://contributor-covenant.org/version/1/4/ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index fcfaf19b..00000000 --- a/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Two-stage docker container for mermaid-js/mermaid-live-editor -# Build : docker build -t mermaid-js/mermaid-live-editor . -# Run : docker run --name mermaid-live-editor --publish 8080:80 mermaid-js/mermaid-live-editor -# Start : docker start mermaid-live-editor -# Use webbrowser : http://localhost:8080 -# Stop : press ctrl + c -# or -# docker stop mermaid-live-editor - -FROM node:14.16.0-alpine3.13 as mermaid-live-editor-builder -COPY --chown=node:node . /home -WORKDIR /home -RUN yarn install -RUN yarn build - -FROM nginx:alpine as mermaid-live-editor-runner -COPY --from=mermaid-live-editor-builder --chown=nginx:nginx /home/docs /usr/share/nginx/html diff --git a/LICENSE b/LICENSE deleted file mode 100644 index e2d2ad4e..00000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 - 2021 Knut Sveidqvist - -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 deleted file mode 100644 index 13b95909..00000000 --- a/README.md +++ /dev/null @@ -1,58 +0,0 @@ -[![Join our Slack!](https://img.shields.io/static/v1?message=join%20chat&color=9cf&logo=slack&label=slack)](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE) - -# Contributors are welcome - -If you want to speed up the progress for mermaid-live-editor, join the slack channel and contact knsv. - -# mermaid-live-editor - -Edit, preview and share mermaid charts/diagrams. - -## Features - -- Edit and preview flowcharts, sequence diagrams, gantt diagrams in real time. -- Save the result as a svg -- Get a link to a viewer of the diagram so that you can share it with others. -- Get a link to edit the diagram so that someone else can tweak it and send a new link back - -## Live demo - -You can try out a live version [here](https://mermaid-js.github.io/mermaid-live-editor/). - -## Setup - -[Volta](https://volta.sh) is used for managing node and yarn versions. - -This project is set up using [Yarn](https://classic.yarnpkg.com/en/docs/getting-started). : - -``` -yarn install -``` - -or in develop branch to use the beta version of mermaid use - -``` -yarn install --update-checksums -``` - -This together with a .npmrc file: - -``` -registry=https://registry.npmjs.com/ -@mermaid-js:registry=https://npm.pkg.github.com -//npm.pkg.github.com/:_authToken="XXXXXXXXX" -``` - -## Development - -``` -yarn dev -- --open -``` - -This app is created with Svelte Kit. - -## Release - -``` -yarn release -``` diff --git a/docs/_app/assets/pages/__layout.svelte-adbca494.css b/_app/assets/pages/__layout.svelte-adbca494.css similarity index 100% rename from docs/_app/assets/pages/__layout.svelte-adbca494.css rename to _app/assets/pages/__layout.svelte-adbca494.css diff --git a/docs/_app/assets/pages/edit.svelte-05f3059c.css b/_app/assets/pages/edit.svelte-05f3059c.css similarity index 100% rename from docs/_app/assets/pages/edit.svelte-05f3059c.css rename to _app/assets/pages/edit.svelte-05f3059c.css diff --git a/docs/_app/assets/start-0826e215.css b/_app/assets/start-0826e215.css similarity index 100% rename from docs/_app/assets/start-0826e215.css rename to _app/assets/start-0826e215.css diff --git a/docs/_app/assets/util-53f38408.css b/_app/assets/util-53f38408.css similarity index 100% rename from docs/_app/assets/util-53f38408.css rename to _app/assets/util-53f38408.css diff --git a/docs/_app/chunks/analytics-plugin-ga.browser.es-9bc8c1dc.js b/_app/chunks/analytics-plugin-ga.browser.es-9bc8c1dc.js similarity index 100% rename from docs/_app/chunks/analytics-plugin-ga.browser.es-9bc8c1dc.js rename to _app/chunks/analytics-plugin-ga.browser.es-9bc8c1dc.js diff --git a/docs/_app/chunks/analytics.browser.es-eaddcc60.js b/_app/chunks/analytics.browser.es-eaddcc60.js similarity index 100% rename from docs/_app/chunks/analytics.browser.es-eaddcc60.js rename to _app/chunks/analytics.browser.es-eaddcc60.js diff --git a/docs/_app/chunks/paths-45dac81d.js b/_app/chunks/paths-45dac81d.js similarity index 100% rename from docs/_app/chunks/paths-45dac81d.js rename to _app/chunks/paths-45dac81d.js diff --git a/docs/_app/chunks/preload-helper-9f12a5fd.js b/_app/chunks/preload-helper-9f12a5fd.js similarity index 100% rename from docs/_app/chunks/preload-helper-9f12a5fd.js rename to _app/chunks/preload-helper-9f12a5fd.js diff --git a/docs/_app/chunks/singletons-bb9012b7.js b/_app/chunks/singletons-bb9012b7.js similarity index 100% rename from docs/_app/chunks/singletons-bb9012b7.js rename to _app/chunks/singletons-bb9012b7.js diff --git a/docs/_app/chunks/util-b71e0722.js b/_app/chunks/util-b71e0722.js similarity index 100% rename from docs/_app/chunks/util-b71e0722.js rename to _app/chunks/util-b71e0722.js diff --git a/docs/_app/chunks/vendor-8b597521.js b/_app/chunks/vendor-8b597521.js similarity index 100% rename from docs/_app/chunks/vendor-8b597521.js rename to _app/chunks/vendor-8b597521.js diff --git a/docs/_app/error.svelte-690d0ef1.js b/_app/error.svelte-690d0ef1.js similarity index 100% rename from docs/_app/error.svelte-690d0ef1.js rename to _app/error.svelte-690d0ef1.js diff --git a/docs/_app/pages/__layout.svelte-809d1245.js b/_app/pages/__layout.svelte-809d1245.js similarity index 100% rename from docs/_app/pages/__layout.svelte-809d1245.js rename to _app/pages/__layout.svelte-809d1245.js diff --git a/_app/pages/edit.svelte-7b949399.js b/_app/pages/edit.svelte-7b949399.js new file mode 100644 index 00000000..86229965 --- /dev/null +++ b/_app/pages/edit.svelte-7b949399.js @@ -0,0 +1 @@ +var e;import{S as t,i as a,s as n,e as s,c as i,a as o,d as r,b as l,f as c,G as h,H as d,I as u,z as f,J as m,K as g,k as p,t as v,n as $,g as w,F as b,L as x,M as y,N as E,O as k,P as I,Q as D,h as C,R as O,T,U as S,v as A,B as V,r as N,u as M,V as _,D as R,E as L,j as P,m as B,o as U,W as G,w as H,X as j,Y,Z as z,_ as J,$ as q,a0 as F,a1 as K,a2 as W,a3 as Z,C as X,a4 as Q,a5 as ee,a6 as te,l as ae,a7 as ne,a8 as se}from"../chunks/vendor-8b597521.js";import{c as ie,a as oe,u as re,g as le,V as ce,b as he,e as de,i as ue,s as fe,d as me}from"../chunks/util-b71e0722.js";import{b as ge}from"../chunks/paths-45dac81d.js";import"../chunks/preload-helper-9f12a5fd.js";function pe(e){let t;return{c(){t=s("div"),this.h()},l(e){t=i(e,"DIV",{id:!0,class:!0}),o(t).forEach(r),this.h()},h(){l(t,"id","editor"),l(t,"class","overflow-hidden")},m(a,n){c(a,t,n),e[9](t)},p:h,i:h,o:h,d(a){a&&r(t),e[9](null)}}}function ve(e,t,a){let n;d(e,ie,(e=>a(8,n=e)));var s=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(s,i){function o(e){try{l(n.next(e))}catch(t){i(t)}}function r(e){try{l(n.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,r)}l((n=n.apply(e,t||[])).next())}))};let i,o,r=null,{text:l}=t,{language:c}=t,{editorOptions:h={value:l,language:c,scrollBeyondLastLine:!1,minimap:{enabled:!1},theme:"myCoolTheme",overviewRulerLanes:0}}=t,{errorMarkers:g=[]}=t,p=l;const v=u();return f((()=>s(void 0,void 0,void 0,(function*(){var e;yield s(void 0,void 0,void 0,(function*(){let e=0;for(;e++<10;)try{return void a(6,o=monaco)}catch(t){yield new Promise((e=>setTimeout(e,500)))}alert("Loading Monaco Editor failed. Please try refreshing the page.")})),(e=o).languages.register({id:"mermaid"}),e.languages.setMonarchTokensProvider("mermaid",{typeKeywords:["graph","stateDiagram","sequenceDiagram","classDiagram","pie","erDiagram","flowchart","gantt","gitGraph","journey"],keywords:["patricipant","as"],arrows:["---","===","--\x3e","==>","->>","->"],tokenizer:{root:[[/[{}]/,"delimiter.bracket"],[/[a-z_$][\w$]*/,{cases:{"@typeKeywords":"keyword","@keywords":"keyword"}}],[/[-=>ox]+/,{cases:{"@arrows":"transition"}}],[/[[{(}]+.+?[)\]}]+/,"string"],[/".*"/,"string"]]},whitespace:[[/[ \t\r\n]+/,"white"],[/%%.*$/,"comment"]]}),e.editor.defineTheme("myCoolTheme",{base:"vs",inherit:!1,rules:[{token:"keyword",foreground:"880000",fontStyle:"bold"},{token:"custom-error",foreground:"ff0000",fontStyle:"bold"},{token:"string",foreground:"AA8500"},{token:"transition",foreground:"008800",fontStyle:"bold"},{token:"delimiter.bracket",foreground:"000000",fontStyle:"bold"}]}),e.languages.registerCompletionItemProvider("mermaid",{provideCompletionItems:()=>({suggestions:[{label:"simpleText",kind:e.languages.CompletionItemKind.Text,insertText:"simpleText"},{label:"testing",kind:e.languages.CompletionItemKind.Keyword,insertText:"testing(${1:condition})",insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"ifelse",kind:e.languages.CompletionItemKind.Snippet,insertText:["if (${1:condition}) {","\t$0","} else {","\t","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"If-Else Statement"}]})}),a(5,i=o.editor.create(r,h)),i.onDidChangeModelContent((()=>{a(1,l=i.getValue()),v("update",{text:l})}));return new ResizeObserver((e=>{i.layout({height:e[0].contentRect.height,width:e[0].contentRect.width})})).observe(r.parentElement),()=>{i.dispose()}})))),e.$$set=e=>{"text"in e&&a(1,l=e.text),"language"in e&&a(2,c=e.language),"editorOptions"in e&&a(3,h=e.editorOptions),"errorMarkers"in e&&a(4,g=e.errorMarkers)},e.$$.update=()=>{100&e.$$.dirty&&(null==o||o.editor.setModelLanguage(i.getModel(),c)),498&e.$$.dirty&&(l!==p&&(n.updateEditor&&(null==i||i.setValue(l)),a(7,p=l)),null==o||o.editor.setModelMarkers(i.getModel(),"test",g))},[r,l,c,h,g,i,o,p,n,function(e){m[e?"unshift":"push"]((()=>{r=e,a(0,r)}))}]}class $e extends t{constructor(e){super(),a(this,e,ve,pe,n,{text:1,language:2,editorOptions:3,errorMarkers:4})}}function we(e,t,a){const n=e.slice();return n[1]=t[a].title,n[2]=t[a].href,n[3]=t[a].icon,n}function be(e){let t,a,n,d,u,f=e[1]+"",m=e[3]&&function(e){let t;return{c(){t=s("i"),this.h()},l(e){t=i(e,"I",{class:!0}),o(t).forEach(r),this.h()},h(){l(t,"class",e[3])},m(e,a){c(e,t,a)},p:h,d(e){e&&r(t)}}}(e);return{c(){t=s("li"),a=s("a"),m&&m.c(),n=p(),d=v(f),u=p(),this.h()},l(e){t=i(e,"LI",{});var s=o(t);a=i(s,"A",{class:!0,target:!0,href:!0});var l=o(a);m&&m.l(l),n=$(l),d=w(l,f),l.forEach(r),u=$(s),s.forEach(r),this.h()},h(){l(a,"class","nav-btn"),l(a,"target","_blank"),l(a,"href",e[2])},m(e,s){c(e,t,s),b(t,a),m&&m.m(a,null),b(a,n),b(a,d),b(t,u)},p(e,t){e[3]&&m.p(e,t)},d(e){e&&r(t),m&&m.d()}}}function xe(e){let t,a,n,d,u,f,m,E,k,I,D,C,O,T,S,A,V,N,M,_,R=e[0],L=[];for(let s=0;s{a||(a=T(t,S,{},!0)),a.run(1)})),n=!0)},o(e){a||(a=T(t,S,{},!1)),a.run(0),n=!1},d(e){e&&r(t),y(d,e),e&&a&&a.end()}}}function Ce(e){let t,a,n,h,d,u,f,m,g,x,y=e[10].title+"";function E(){return e[7](e[10])}return{c(){t=s("li"),a=s("div"),n=s("i"),d=p(),u=v(y),m=p(),this.h()},l(e){t=i(e,"LI",{class:!0});var s=o(t);a=i(s,"DIV",{class:!0});var l=o(a);n=i(l,"I",{class:!0}),o(n).forEach(r),d=$(l),u=w(l,y),l.forEach(r),m=$(s),s.forEach(r),this.h()},h(){l(n,"class",h=k(e[10].icon)+" svelte-1qkpo3v"),l(a,"class",f="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t block leading-normal "+(e[4]===e[10].id?"text-indigo-500 bg-white border-white":"text-white bg-indigo-500 border-indigo-500 hover:bg-indigo-600")),l(t,"class","mr-2 last:mr-0 w-28 h-6 flex-auto text-center")},m(e,s){c(e,t,s),b(t,a),b(a,n),b(a,d),b(a,u),b(t,m),g||(x=I(a,"click",D(E)),g=!0)},p(t,s){e=t,4&s&&h!==(h=k(e[10].icon)+" svelte-1qkpo3v")&&l(n,"class",h),4&s&&y!==(y=e[10].title+"")&&C(u,y),20&s&&f!==(f="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t block leading-normal "+(e[4]===e[10].id?"text-indigo-500 bg-white border-white":"text-white bg-indigo-500 border-indigo-500 hover:bg-indigo-600"))&&l(a,"class",f)},d(e){e&&r(t),g=!1,x()}}}function Oe(e){let t,a,n,h,d,u,f,m,g=e[1]&&Ie(e),x=e[0]&&e[2]&&De(e);return{c(){t=s("div"),a=s("span"),g&&g.c(),n=p(),h=v(e[3]),d=p(),x&&x.c(),this.h()},l(s){t=i(s,"DIV",{class:!0});var l=o(t);a=i(l,"SPAN",{class:!0});var c=o(a);g&&g.l(c),n=$(c),h=w(c,e[3]),c.forEach(r),d=$(l),x&&x.l(l),l.forEach(r),this.h()},h(){l(a,"class","text-white mr-2 font-semibold"),l(t,"class","flex cursor-default")},m(s,i){c(s,t,i),b(t,a),g&&g.m(a,null),b(a,n),b(a,h),b(t,d),x&&x.m(t,null),u=!0,f||(m=I(a,"click",D(e[6])),f=!0)},p(e,[s]){e[1]?g?g.p(e,s):(g=Ie(e),g.c(),g.m(a,n)):g&&(g.d(1),g=null),(!u||8&s)&&C(h,e[3]),e[0]&&e[2]?x?(x.p(e,s),5&s&&A(x,1)):(x=De(e),x.c(),A(x,1),x.m(t,null)):x&&(V(),N(x,1,1,(()=>{x=null})),M())},i(e){u||(A(x),u=!0)},o(e){N(x),u=!1},d(e){e&&r(t),g&&g.d(),x&&x.d(),f=!1,m()}}}function Te(e,t,a){var n;let{isCloseable:s=!0}=t,{tabs:i=[]}=t,{title:o}=t,{isOpen:r=!1}=t,l=null===(n=i[0])||void 0===n?void 0:n.id;const c=u(),h=e=>{a(4,l=e.id),c("select",e)};return e.$$set=e=>{"isCloseable"in e&&a(1,s=e.isCloseable),"tabs"in e&&a(2,i=e.tabs),"title"in e&&a(3,o=e.title),"isOpen"in e&&a(0,r=e.isOpen)},[r,s,i,o,l,h,()=>a(0,r=!r),e=>h(e)]}class Se extends t{constructor(e){super(),a(this,e,Te,Oe,n,{isCloseable:1,tabs:2,title:3,isOpen:0})}}const Ae=e=>({}),Ve=e=>({});function Ne(e){let t,a,n;const h=e[5].default,d=R(h,e,e[4],null);return{c(){t=s("div"),d&&d.c(),this.h()},l(e){t=i(e,"DIV",{class:!0});var a=o(t);d&&d.l(a),a.forEach(r),this.h()},h(){l(t,"class","flex-grow overflow-auto")},m(e,a){c(e,t,a),d&&d.m(t,null),n=!0},p(e,t){d&&d.p&&(!n||16&t)&&L(d,h,e,e[4],t,null,null)},i(e){n||(A(d,e),O((()=>{a||(a=T(t,j,{},!0)),a.run(1)})),n=!0)},o(e){N(d,e),a||(a=T(t,j,{},!1)),a.run(0),n=!1},d(e){e&&r(t),d&&d.d(e),e&&a&&a.end()}}}function Me(e){let t,a,n,h,d,u,f,g,v,w,x;function y(t){e[6](t)}let E={tabs:e[2],title:e[3],isCloseable:e[1]};void 0!==e[0]&&(E.isOpen=e[0]),h=new Se({props:E}),m.push((()=>_(h,"isOpen",y))),h.$on("select",e[7]);const k=e[5].actions,D=R(k,e,e[4],Ve);let C=e[0]&&Ne(e);return{c(){t=s("div"),a=s("div"),n=s("div"),P(h.$$.fragment),u=p(),f=s("div"),D&&D.c(),g=p(),C&&C.c(),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=o(t);a=i(s,"DIV",{class:!0});var l=o(a);n=i(l,"DIV",{class:!0});var c=o(n);B(h.$$.fragment,c),u=$(c),f=i(c,"DIV",{class:!0});var d=o(f);D&&D.l(d),d.forEach(r),c.forEach(r),l.forEach(r),g=$(s),C&&C.l(s),s.forEach(r),this.h()},h(){l(f,"class","flex gap-x-4 items-center text-white"),l(n,"class","flex justify-between"),l(a,"class","bg-indigo-400 border-gray-400 p-2 flex-none"),l(t,"class","bg-white rounded overflow-hidden shadow m-2 flex-grow flex flex-col")},m(s,i){c(s,t,i),b(t,a),b(a,n),U(h,n,null),b(n,u),b(n,f),D&&D.m(f,null),b(t,g),C&&C.m(t,null),v=!0,w||(x=I(a,"click",e[8]),w=!0)},p(e,[a]){const n={};4&a&&(n.tabs=e[2]),8&a&&(n.title=e[3]),2&a&&(n.isCloseable=e[1]),!d&&1&a&&(d=!0,n.isOpen=e[0],G((()=>d=!1))),h.$set(n),D&&D.p&&(!v||16&a)&&L(D,k,e,e[4],a,Ae,Ve),e[0]?C?(C.p(e,a),1&a&&A(C,1)):(C=Ne(e),C.c(),A(C,1),C.m(t,null)):C&&(V(),N(C,1,1,(()=>{C=null})),M())},i(e){v||(A(h.$$.fragment,e),A(D,e),A(C),v=!0)},o(e){N(h.$$.fragment,e),N(D,e),N(C),v=!1},d(e){e&&r(t),H(h),D&&D.d(e),C&&C.d(),w=!1,x()}}}function _e(e,t,a){let{$$slots:n={},$$scope:s}=t,{isCloseable:i=!0}=t,{isOpen:o=!0}=t,{tabs:r=[]}=t,{title:l}=t;return e.$$set=e=>{"isCloseable"in e&&a(1,i=e.isCloseable),"isOpen"in e&&a(0,o=e.isOpen),"tabs"in e&&a(2,r=e.tabs),"title"in e&&a(3,l=e.title),"$$scope"in e&&a(4,s=e.$$scope)},e.$$.update=()=>{3&e.$$.dirty&&a(0,o=!i||o)},[o,i,r,l,s,n,function(e){o=e,a(0,o),a(1,i)},function(t){Y(e,t)},()=>a(0,o=!o)]}class Re extends t{constructor(e){super(),a(this,e,_e,Me,n,{isCloseable:1,isOpen:0,tabs:2,title:3})}}function Le(e,t,a){const n=e.slice();return n[3]=t[a],n}function Pe(e){let t,a,n,h,d=e[3]+"";function u(){return e[2](e[3])}return{c(){t=s("button"),a=v(d),this.h()},l(e){t=i(e,"BUTTON",{class:!0});var n=o(t);a=w(n,d),n.forEach(r),this.h()},h(){l(t,"class","action-btn")},m(e,s){c(e,t,s),b(t,a),n||(h=I(t,"click",u),n=!0)},p(t,a){e=t},d(e){e&&r(t),n=!1,h()}}}function Be(e){let t,a=Object.keys(e[0]),n=[];for(let s=0;s>+John: Hello John, how are you?\n Alice->>+John: John, can you hear me?\n John--\x3e>-Alice: Hi Alice, I can hear you!\n John--\x3e>-Alice: I feel great!\n ","Class Diagram":"classDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal <|-- Zebra\n Animal : +int age\n Animal : +String gender\n Animal: +isMammal()\n Animal: +mate()\n class Duck{\n +String beakColor\n +swim()\n +quack()\n }\n class Fish{\n -int sizeInFeet\n -canEat()\n }\n class Zebra{\n +bool is_wild\n +run()\n }\n ","State Diagram":"stateDiagram-v2\n [*] --\x3e Still\n Still --\x3e [*]\n Still --\x3e Moving\n Moving --\x3e Still\n Moving --\x3e Crash\n Crash --\x3e [*]\n ","Gantt Chart":"gantt\n title A Gantt Diagram\n dateFormat YYYY-MM-DD\n section Section\n A task :a1, 2014-01-01, 30d\n Another task :after a1 , 20d\n section Another\n Task in sec :2014-01-12 , 12d\n another task : 24d\n ","Pie Chart":'pie title Pets adopted by volunteers\n "Dogs" : 386\n "Cats" : 85\n "Rats" : 15\n ',"ER Diagram":'erDiagram\n CUSTOMER }|..|{ DELIVERY-ADDRESS : has\n CUSTOMER ||--o{ ORDER : places\n CUSTOMER ||--o{ INVOICE : "liable for"\n DELIVERY-ADDRESS ||--o{ ORDER : receives\n INVOICE ||--|{ ORDER : covers\n ORDER ||--|{ ORDER-ITEM : includes\n PRODUCT-CATEGORY ||--|{ PRODUCT : contains\n PRODUCT ||--o{ ORDER-ITEM : "ordered in"\n ',"Git Graph":'gitGraph:\noptions\n{\n "nodeSpacing": 150,\n "nodeRadius": 10\n}\nend\ncommit\nbranch newbranch\ncheckout newbranch\ncommit\ncommit\ncheckout master\ncommit\ncommit\nmerge newbranch\n\n ',"User Journey":" journey\n title My working day\n section Go to work\n Make tea: 5: Me\n Go upstairs: 3: Me\n Do work: 1: Me, Cat\n section Go home\n Go downstairs: 5: Me\n Sit down: 3: Me\n "},a=e=>{re(t[e],!0,!0)};return[t,a,e=>a(e)]}class He extends t{constructor(e){super(),a(this,e,Ge,Ue,n,{})}}function je(e){let t,a,n;return{c(){t=s("input"),this.h()},l(e){t=i(e,"INPUT",{id:!0,type:!0,min:!0,max:!0}),this.h()},h(){l(t,"id","height"),l(t,"type","number"),l(t,"min","3"),l(t,"max","10000")},m(s,i){c(s,t,i),J(t,e[4]),a||(n=I(t,"input",e[14]),a=!0)},p(e,a){16&a&&q(t.value)!==e[4]&&J(t,e[4])},d(e){e&&r(t),a=!1,n()}}}function Ye(e){let t,a,n,d,u,f,m,g,x,y,E,k,D,C,O,T,S,A,V,N,M,_,R,L,P,B,U,G,H,j,Y,z,J,q,K,W,Z,X,Q,ee,te,ae,ne,se,ie,oe=e[5](),re=oe&&function(e){let t,a,n,d,u;return{c(){t=s("button"),a=s("i"),n=v(" Copy Image to clipboard"),this.h()},l(e){t=i(e,"BUTTON",{class:!0});var s=o(t);a=i(s,"I",{class:!0}),o(a).forEach(r),n=w(s," Copy Image to clipboard"),s.forEach(r),this.h()},h(){l(a,"class","far fa-copy"),l(t,"class","action-btn w-full")},m(s,i){c(s,t,i),b(t,a),b(t,n),d||(u=I(t,"click",e[6]),d=!0)},p:h,d(e){e&&r(t),d=!1,u()}}}(e),le="auto"!==e[3]&&je(e);return{c(){t=s("div"),re&&re.c(),a=p(),n=s("button"),d=s("i"),u=v(" PNG"),f=p(),m=s("button"),g=s("i"),x=v(" SVG"),y=p(),E=s("button"),k=s("a"),D=s("i"),C=v(" PNG"),O=p(),T=s("button"),S=s("a"),A=s("i"),V=v(" SVG"),N=p(),M=s("div"),_=v("PNG size\n\t\t\t"),R=s("input"),L=p(),P=s("label"),B=v("Auto"),U=p(),G=s("input"),H=p(),j=s("label"),Y=v("Width"),z=p(),J=s("input"),q=p(),K=s("label"),W=v("Height"),Z=p(),le&&le.c(),X=p(),Q=s("div"),ee=s("label"),te=v("Copy Markdown"),ae=p(),ne=s("input"),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=o(t);re&&re.l(s),a=$(s),n=i(s,"BUTTON",{class:!0});var l=o(n);d=i(l,"I",{class:!0}),o(d).forEach(r),u=w(l," PNG"),l.forEach(r),f=$(s),m=i(s,"BUTTON",{class:!0});var c=o(m);g=i(c,"I",{class:!0}),o(g).forEach(r),x=w(c," SVG"),c.forEach(r),y=$(s),E=i(s,"BUTTON",{class:!0});var h=o(E);k=i(h,"A",{target:!0,href:!0});var p=o(k);D=i(p,"I",{class:!0}),o(D).forEach(r),C=w(p," PNG"),p.forEach(r),h.forEach(r),O=$(s),T=i(s,"BUTTON",{class:!0});var v=o(T);S=i(v,"A",{target:!0,href:!0});var b=o(S);A=i(b,"I",{class:!0}),o(A).forEach(r),V=w(b," SVG"),b.forEach(r),v.forEach(r),N=$(s),M=i(s,"DIV",{class:!0});var I=o(M);_=w(I,"PNG size\n\t\t\t"),R=i(I,"INPUT",{type:!0,value:!0,id:!0}),L=$(I),P=i(I,"LABEL",{for:!0});var F=o(P);B=w(F,"Auto"),F.forEach(r),U=$(I),G=i(I,"INPUT",{type:!0,value:!0,id:!0}),H=$(I),j=i(I,"LABEL",{for:!0});var se=o(j);Y=w(se,"Width"),se.forEach(r),z=$(I),J=i(I,"INPUT",{type:!0,value:!0,id:!0}),q=$(I),K=i(I,"LABEL",{for:!0});var ie=o(K);W=w(ie,"Height"),ie.forEach(r),Z=$(I),le&&le.l(I),I.forEach(r),X=$(s),Q=i(s,"DIV",{class:!0});var oe=o(Q);ee=i(oe,"LABEL",{for:!0});var ce=o(ee);te=w(ce,"Copy Markdown"),ce.forEach(r),ae=$(oe),ne=i(oe,"INPUT",{class:!0,id:!0,type:!0,value:!0}),oe.forEach(r),s.forEach(r),this.h()},h(){l(d,"class","fas fa-download"),l(n,"class","action-btn flex-auto"),l(g,"class","fas fa-download"),l(m,"class","action-btn flex-auto"),l(D,"class","fas fa-external-link-alt"),l(k,"target","_blank"),l(k,"href",e[0]),l(E,"class","action-btn flex-auto"),l(A,"class","fas fa-external-link-alt"),l(S,"target","_blank"),l(S,"href",e[1]),l(T,"class","action-btn flex-auto"),l(R,"type","radio"),R.__value="auto",R.value=R.__value,l(R,"id","autosize"),e[11][0].push(R),l(P,"for","autosize"),l(G,"type","radio"),G.__value="width",G.value=G.__value,l(G,"id","width-active"),e[11][0].push(G),l(j,"for","width"),l(J,"type","radio"),J.__value="height",J.value=J.__value,l(J,"id","height-active"),e[11][0].push(J),l(K,"for","height"),l(M,"class","flex gap-2 items-center"),l(ee,"for","markdown"),l(ne,"class","flex-1"),l(ne,"id","markdown"),l(ne,"type","text"),ne.value=e[2],l(Q,"class","w-full flex gap-2 items-center"),l(t,"class","flex flex-wrap gap-2 m-2")},m(s,i){c(s,t,i),re&&re.m(t,null),b(t,a),b(t,n),b(n,d),b(n,u),b(t,f),b(t,m),b(m,g),b(m,x),b(t,y),b(t,E),b(E,k),b(k,D),b(k,C),b(t,O),b(t,T),b(T,S),b(S,A),b(S,V),b(t,N),b(t,M),b(M,_),b(M,R),R.checked=R.__value===e[3],b(M,L),b(M,P),b(P,B),b(M,U),b(M,G),G.checked=G.__value===e[3],b(M,H),b(M,j),b(j,Y),b(M,z),b(M,J),J.checked=J.__value===e[3],b(M,q),b(M,K),b(K,W),b(M,Z),le&&le.m(M,null),b(t,X),b(t,Q),b(Q,ee),b(ee,te),b(Q,ae),b(Q,ne),se||(ie=[I(n,"click",e[7]),I(m,"click",e[8]),I(R,"change",e[10]),I(G,"change",e[12]),I(J,"change",e[13]),I(ne,"click",e[9])],se=!0)},p(e,t){oe&&re.p(e,t),1&t&&l(k,"href",e[0]),2&t&&l(S,"href",e[1]),8&t&&(R.checked=R.__value===e[3]),8&t&&(G.checked=G.__value===e[3]),8&t&&(J.checked=J.__value===e[3]),"auto"!==e[3]?le?le.p(e,t):(le=je(e),le.c(),le.m(M,null)):le&&(le.d(1),le=null),4&t&&ne.value!==e[2]&&(ne.value=e[2])},d(a){a&&r(t),re&&re.d(),e[11][0].splice(e[11][0].indexOf(R),1),e[11][0].splice(e[11][0].indexOf(G),1),e[11][0].splice(e[11][0].indexOf(J),1),le&&le.d(),se=!1,F(ie)}}}function ze(e){let t,a;return t=new Re({props:{title:"Actions",isOpen:!1,$$slots:{default:[Ye]},$$scope:{ctx:e}}}),{c(){P(t.$$.fragment)},l(e){B(t.$$.fragment,e)},m(e,n){U(t,e,n),a=!0},p(e,[a]){const n={};1048607&a&&(n.$$scope={dirty:a,ctx:e}),t.$set(n)},i(e){a||(A(t.$$.fragment,e),a=!0)},o(e){N(t.$$.fragment,e),a=!1},d(e){H(t,e)}}}function Je(e,t,a){const n=(e,t,a)=>{null==e||e.setAttribute("height",`${a}px`),null==e||e.setAttribute("width",`${t}px`),e||(e=document.querySelector("#container svg"));const n=e.outerHTML.replaceAll("
","
");return z(n)},s=(e,t)=>{const a=document.createElement("canvas"),s=document.querySelector("#container svg"),i=s.getBoundingClientRect();if(a.width=i.width,a.height=i.height,"width"===d){const e=i.height/i.width;a.width=u,a.height=u*e}else if("height"===d){const e=i.width/i.height;a.width=u*e,a.height=u}const o=a.getContext("2d");o.fillStyle="white",o.fillRect(0,0,a.width,a.height);const r=new Image;r.onload=t(o,r),r.src=`data:image/svg+xml;base64,${n(s,a.width,a.height)}`,e.stopPropagation(),e.preventDefault()},i=(e,t)=>{const a=document.createElement("a");a.download=e,a.href=t,a.click(),a.remove()},o=(e,t)=>()=>{const{canvas:a}=e;e.drawImage(t,0,0,a.width,a.height),i(`mermaid-diagram-${K().format("YYYYMMDDHHmmss")}.png`,a.toDataURL("image/png").replace("image/png","image/octet-stream"))},r=(e,t)=>()=>{const{canvas:a}=e;e.drawImage(t,0,0,a.width,a.height),a.toBlob((e=>{try{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])}catch(t){console.error(t)}}))};let l,c,h,d="auto",u=1080;ie.subscribe((e=>{const t=JSON.parse(JSON.stringify(e));"string"==typeof t.mermaid&&(t.mermaid=JSON.parse(t.mermaid));const n=z(JSON.stringify(t),!0);a(0,l=`https://mermaid.ink/img/${n}`),a(1,c=`https://mermaid.ink/svg/${n}`),a(2,h=`[![](${l})](${window.location.protocol}//${window.location.host}${window.location.pathname}#${window.location.hash})`)}));return[l,c,h,d,u,()=>Object.prototype.hasOwnProperty.call(window,"ClipboardItem"),e=>{s(e,r)},e=>{s(e,o)},()=>{i(`mermaid-diagram-${K().format("YYYYMMDDHHmmss")}.svg`,`data:image/svg+xml;base64,${n()}`)},e=>{e.target.select(),document.execCommand("Copy")},function(){d=this.__value,a(3,d)},[[]],function(){d=this.__value,a(3,d)},function(){d=this.__value,a(3,d)},function(){u=q(this.value),a(4,u)}]}class qe extends t{constructor(e){super(),a(this,e,Je,ze,n,{})}}const Fe=W(X(!0),Z(),"autoHistoryMode"),Ke=W(X([]),Z(),"autoHistoryStore"),We=W(X([]),Z(),"manualHistoryStore"),Ze=Q([Fe,Ke,We],(([e,t,a],n)=>{n(e?t:a)}));function Xe(e,t,a){const n=e.slice();return n[14]=t[a].state,n[15]=t[a].time,n[16]=t[a].name,n}function Qe(e){let t,a,n,d,u,f;return{c(){t=s("div"),a=v("No items in History"),n=s("br"),d=v("\n\t\t\t\tClick the Save button to save current state and restore it later."),u=s("br"),f=v("\n\t\t\t\tTimeline will automatically be saved every minute."),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=o(t);a=w(s,"No items in History"),n=i(s,"BR",{}),d=w(s,"\n\t\t\t\tClick the Save button to save current state and restore it later."),u=i(s,"BR",{}),f=w(s,"\n\t\t\t\tTimeline will automatically be saved every minute."),s.forEach(r),this.h()},h(){l(t,"class","m-2 text-gray-600")},m(e,s){c(e,t,s),b(t,a),b(t,n),b(t,d),b(t,u),b(t,f)},p:h,d(e){e&&r(t)}}}function et(e){let t,a=e[1],n=[];for(let s=0;s0?et:Qe}let n=a(e),h=n(e);return{c(){t=s("ul"),h.c(),this.h()},l(e){t=i(e,"UL",{class:!0,id:!0});var a=o(t);h.l(a),a.forEach(r),this.h()},h(){l(t,"class","p-2 space-y-2 overflow-auto h-56"),l(t,"id","historyList")},m(e,a){c(e,t,a),h.m(t,null)},p(e,s){n===(n=a(e))&&h?h.p(e,s):(h.d(1),h=n(e),h&&(h.c(),h.m(t,null)))},d(e){e&&r(t),h.d()}}}function nt(e){let t,a,n,d,u,f,m,g;return{c(){t=s("div"),a=s("button"),n=s("i"),d=p(),u=s("button"),f=s("i"),this.h()},l(e){t=i(e,"DIV",{slot:!0});var s=o(t);a=i(s,"BUTTON",{id:!0,class:!0,title:!0});var l=o(a);n=i(l,"I",{class:!0}),o(n).forEach(r),l.forEach(r),d=$(s),u=i(s,"BUTTON",{id:!0,class:!0,title:!0});var c=o(u);f=i(c,"I",{class:!0}),o(f).forEach(r),c.forEach(r),s.forEach(r),this.h()},h(){l(n,"class","far fa-save"),l(a,"id","saveHistory"),l(a,"class","btn"),l(a,"title","Save current state"),l(f,"class","fas fa-trash-alt"),l(u,"id","clearHistory"),l(u,"class","btn text-red-400"),l(u,"title","Delete all saved states"),l(t,"slot","actions")},m(s,i){c(s,t,i),b(t,a),b(a,n),b(t,d),b(t,u),b(u,f),m||(g=[I(a,"click",D(e[8])),I(u,"click",D(e[9]))],m=!0)},p:h,d(e){e&&r(t),m=!1,F(g)}}}function st(e){let t,a,n;function s(t){e[12](t)}let i={tabs:e[3],title:"History",$$slots:{actions:[nt],default:[at]},$$scope:{ctx:e}};return void 0!==e[0]&&(i.isOpen=e[0]),t=new Re({props:i}),m.push((()=>_(t,"isOpen",s))),t.$on("select",e[2]),{c(){P(t.$$.fragment)},l(e){B(t.$$.fragment,e)},m(e,a){U(t,e,a),n=!0},p(e,[n]){const s={};524290&n&&(s.$$scope={dirty:n,ctx:e}),!a&&1&n&&(a=!0,s.isOpen=e[0],G((()=>a=!1))),t.$set(s)},i(e){n||(A(t.$$.fragment,e),n=!0)},o(e){N(t.$$.fragment,e),n=!1},d(e){H(t,e)}}}function it(e,t,a){let n,s;d(e,ie,(e=>a(13,n=e))),d(e,Ze,(e=>a(1,s=e)));const i=(e=!1)=>{const t=le();var a;(e=>{const t=te(e?Ke:We);return t.length>0?JSON.stringify(t[0].state):""})(e)!==t?((a={state:n,time:Date.now(),auto:e}).name=ee(2),a.auto?Ke.update((e=>(30===e.length&&e.pop(),[a,...e]))):We.update((e=>[a,...e]))):e||alert("State already saved.")},o=e=>{var t;(e||confirm("Clear all saved items?"))&&(t=e,(te(Fe)?Ke:We).update((e=>e.filter((e=>t&&e.time!=t)))))},r=e=>{ie.set(Object.assign(Object.assign({},e),{updateEditor:!0,updateDiagram:!0}))};f((()=>{Fe.set(!1),setInterval((()=>{i(!0)}),6e4)}));let l=!0;return[l,s,e=>{Fe.set("timeline"===e.detail.id)},[{id:"saved",title:"Saved",icon:"far fa-bookmark"},{id:"timeline",title:"Timeline",icon:"fas fa-history"}],i,o,r,e=>{const t=new Date(e);return`${new Date(t).toLocaleString()} (${K(t).fromNow()})`},()=>i(),()=>o(),e=>r(e),e=>o(e),function(e){l=e,a(0,l)}]}class ot extends t{constructor(e){super(),a(this,e,it,st,n,{})}}function rt(e){let t,a,n;function s(t){e[10](t)}let i={language:e[2],errorMarkers:e[3]};return void 0!==e[1]&&(i.text=e[1]),t=new $e({props:i}),m.push((()=>_(t,"text",s))),t.$on("update",e[6]),{c(){P(t.$$.fragment)},l(e){B(t.$$.fragment,e)},m(e,a){U(t,e,a),n=!0},p(e,n){const s={};4&n&&(s.language=e[2]),8&n&&(s.errorMarkers=e[3]),!a&&2&n&&(a=!0,s.text=e[1],G((()=>a=!1))),t.$set(s)},i(e){n||(A(t.$$.fragment,e),n=!0)},o(e){N(t.$$.fragment,e),n=!1},d(e){H(t,e)}}}function lt(e){let t,a,n,d;return{c(){t=s("button"),a=s("i"),this.h()},l(e){t=i(e,"BUTTON",{class:!0,title:!0,"data-cy":!0});var n=o(t);a=i(n,"I",{class:!0}),o(a).forEach(r),n.forEach(r),this.h()},h(){l(a,"class","fas fa-sync"),l(t,"class","bg-indigo-500 hover:bg-indigo-700 rounded px-4 mx-2"),l(t,"title","Sync Diagram"),l(t,"data-cy","sync")},m(e,s){c(e,t,s),b(t,a),n||(d=I(t,"click",fe),n=!0)},p:h,d(e){e&&r(t),n=!1,d()}}}function ct(e){let t,a,n,h,d,u,f,m=!e[0].autoSync&<();return{c(){t=s("div"),m&&m.c(),a=p(),n=s("label"),h=s("input"),d=v("\n\t\t\t\t\t\tAuto sync"),this.h()},l(e){t=i(e,"DIV",{slot:!0});var s=o(t);m&&m.l(s),a=$(s),n=i(s,"LABEL",{for:!0,style:!0});var l=o(n);h=i(l,"INPUT",{type:!0,id:!0}),d=w(l,"\n\t\t\t\t\t\tAuto sync"),l.forEach(r),s.forEach(r),this.h()},h(){l(h,"type","checkbox"),l(h,"id","autoSync"),l(n,"for","autoSync"),ne(n,"white-space","nowrap"),ne(n,"overflow","hidden"),ne(n,"text-overflow","ellipsis"),l(t,"slot","actions")},m(s,i){c(s,t,i),m&&m.m(t,null),b(t,a),b(t,n),b(n,h),h.checked=e[0].autoSync,b(n,d),u||(f=I(h,"change",e[9]),u=!0)},p(e,n){e[0].autoSync?m&&(m.d(1),m=null):m?m.p(e,n):(m=lt(),m.c(),m.m(t,a)),1&n&&(h.checked=e[0].autoSync)},d(e){e&&r(t),m&&m.d(),u=!1,f()}}}function ht(e){let t,a,n;return a=new ce({}),{c(){t=s("div"),P(a.$$.fragment),this.h()},l(e){t=i(e,"DIV",{class:!0});var n=o(t);B(a.$$.fragment,n),n.forEach(r),this.h()},h(){l(t,"class","flex-1 overflow-auto")},m(e,s){c(e,t,s),U(a,t,null),n=!0},i(e){n||(A(a.$$.fragment,e),n=!0)},o(e){N(a.$$.fragment,e),n=!1},d(e){e&&r(t),H(a)}}}function dt(e){let t,a,n,d,u;return{c(){t=s("button"),a=s("i"),n=v(" View"),this.h()},l(e){t=i(e,"BUTTON",{slot:!0,class:!0,title:!0});var s=o(t);a=i(s,"I",{class:!0}),o(a).forEach(r),n=w(s," View"),s.forEach(r),this.h()},h(){l(a,"class","far fa-eye"),l(t,"slot","actions"),l(t,"class","btn"),l(t,"title","View diagram in new page")},m(s,i){c(s,t,i),b(t,a),b(t,n),d||(u=I(t,"click",D(e[11])),d=!0)},p:h,d(e){e&&r(t),d=!1,u()}}}function ut(e){let t,a,n,h,d,u,f,m,g,x,y,E,k,I,D,C,O,T,S,V,M,_;return a=new Ee({}),u=new Re({props:{tabs:e[5],isCloseable:!1,title:"Mermaid",$$slots:{actions:[ct],default:[rt]},$$scope:{ctx:e}}}),u.$on("select",e[4]),g=new He({}),y=new ot({}),k=new qe({}),T=new Re({props:{title:"Diagram",isCloseable:!1,$$slots:{actions:[dt],default:[ht]},$$scope:{ctx:e}}}),{c(){t=s("div"),P(a.$$.fragment),n=p(),h=s("div"),d=s("div"),P(u.$$.fragment),f=p(),m=s("div"),P(g.$$.fragment),x=p(),P(y.$$.fragment),E=p(),P(k.$$.fragment),I=p(),D=s("div"),C=p(),O=s("div"),P(T.$$.fragment),S=p(),V=s("div"),M=v("Code editing not supported on mobile. Please use a desktop browser."),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=o(t);B(a.$$.fragment,s),n=$(s),h=i(s,"DIV",{class:!0});var l=o(h);d=i(l,"DIV",{class:!0,id:!0,style:!0});var c=o(d);B(u.$$.fragment,c),f=$(c),m=i(c,"DIV",{class:!0});var p=o(m);B(g.$$.fragment,p),x=$(p),B(y.$$.fragment,p),E=$(p),B(k.$$.fragment,p),p.forEach(r),c.forEach(r),I=$(l),D=i(l,"DIV",{id:!0,class:!0}),o(D).forEach(r),C=$(l),O=i(l,"DIV",{class:!0});var v=o(O);B(T.$$.fragment,v),S=$(v),V=i(v,"DIV",{class:!0});var b=o(V);M=w(b,"Code editing not supported on mobile. Please use a desktop browser."),b.forEach(r),v.forEach(r),l.forEach(r),s.forEach(r),this.h()},h(){l(m,"class","-mt-2"),l(d,"class","hidden md:flex flex-col"),l(d,"id","editorPane"),ne(d,"width","40%"),l(D,"id","resizeHandler"),l(D,"class","svelte-ub8fux"),l(V,"class","md:hidden bg-white rounded shadow p-2 mx-2"),l(O,"class","flex-1 flex flex-col overflow-hidden"),l(h,"class","flex-1 flex overflow-hidden"),l(t,"class","h-full flex flex-col overflow-hidden bg-gray-100")},m(e,s){c(e,t,s),U(a,t,null),b(t,n),b(t,h),b(h,d),U(u,d,null),b(d,f),b(d,m),U(g,m,null),b(m,x),U(y,m,null),b(m,E),U(k,m,null),b(h,I),b(h,D),b(h,C),b(h,O),U(T,O,null),b(O,S),b(O,V),b(V,M),_=!0},p(e,[t]){const a={};262159&t&&(a.$$scope={dirty:t,ctx:e}),u.$set(a);const n={};262144&t&&(n.$$scope={dirty:t,ctx:e}),T.$set(n)},i(e){_||(A(a.$$.fragment,e),A(u.$$.fragment,e),A(g.$$.fragment,e),A(y.$$.fragment,e),A(k.$$.fragment,e),A(T.$$.fragment,e),_=!0)},o(e){N(a.$$.fragment,e),N(u.$$.fragment,e),N(g.$$.fragment,e),N(y.$$.fragment,e),N(k.$$.fragment,e),N(T.$$.fragment,e),_=!1},d(e){e&&r(t),H(a),H(u),H(g),H(y),H(k),H(T)}}}function ft(e,t,a){let n,s;d(e,ie,(e=>a(0,n=e))),d(e,he,(e=>a(12,s=e)));var i=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(s,i){function o(e){try{l(n.next(e))}catch(t){i(t)}}function r(e){try{l(n.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(o,r)}l((n=n.apply(e,t||[])).next())}))};const o=window.mermaid;let r="code";const l={code:"mermaid",config:"json"};let c="",h="mermaid",u=[];ie.subscribe((e=>{e.updateEditor&&a(1,c="code"===r?e.code:e.mermaid)}));const m=()=>{window.open(`${ge}/view#${s}`,"_blank").focus()};f((()=>i(void 0,void 0,void 0,(function*(){yield ue();const e=document.getElementById("resizeHandler"),t=document.getElementById("editorPane"),a=e=>{const a=e.pageX-t.getBoundingClientRect().left;a>50&&(t.style.width=`${a}px`)},n=()=>{window.removeEventListener("mousemove",a)};e.addEventListener("mousedown",(e=>{e.preventDefault(),window.addEventListener("mousemove",a),window.addEventListener("mouseup",n)}))}))));return e.$$.update=()=>{256&e.$$.dirty&&a(2,h=l[r]),257&e.$$.dirty&&a(1,c="code"===r?n.code:n.mermaid)},[n,c,h,u,e=>{se(ie,n.updateEditor=!0,n),a(8,r=e.detail.id)},[{id:"code",title:"Code",icon:"fas fa-code"},{id:"config",title:"Config",icon:"fas fa-cogs"}],e=>{try{"code"===r?(n=e.detail.text,o.parse(n),re(n,!1)):(t=e.detail.text,JSON.parse(t),me(t,!1)),de.set(void 0),a(3,u=[])}catch(s){if(de.set(s),s.hash){const e={severity:8,startLineNumber:s.hash.loc.first_line,startColumn:s.hash.loc.first_column,endLineNumber:s.hash.loc.last_line,endColumn:s.hash.loc.last_column+1,message:s.str};u.push(e),a(3,u=u.filter((t=>t.startLineNumber>=e.startLineNumber&&t.startColumn>=e.startColumn)))}console.error(s)}var t,n},m,r,function(){n.autoSync=this.checked,ie.set(n)},function(e){c=e,a(1,c),a(8,r),a(0,n)},()=>m()]}export default class extends t{constructor(e){super(),a(this,e,ft,ut,n,{})}} diff --git a/docs/_app/pages/index.svelte-c7dd545d.js b/_app/pages/index.svelte-c7dd545d.js similarity index 100% rename from docs/_app/pages/index.svelte-c7dd545d.js rename to _app/pages/index.svelte-c7dd545d.js diff --git a/docs/_app/pages/view.svelte-4d357761.js b/_app/pages/view.svelte-4d357761.js similarity index 100% rename from docs/_app/pages/view.svelte-4d357761.js rename to _app/pages/view.svelte-4d357761.js diff --git a/docs/_app/start-50d0be99.js b/_app/start-96e74604.js similarity index 99% rename from docs/_app/start-50d0be99.js rename to _app/start-96e74604.js index 9eafdedd..9f092482 100644 --- a/docs/_app/start-50d0be99.js +++ b/_app/start-96e74604.js @@ -1 +1 @@ -var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,n=(e,r,s)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,i=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&n(t,r,e[r]);if(s)for(var r of s(e))o.call(e,r)&&n(t,r,e[r]);return t};import{S as l,i as c,s as u,e as h,c as d,a as p,d as f,b as g,f as m,t as _,g as y,h as b,j as v,k as $,l as w,m as x,n as E,o as q,p as R,q as S,r as L,u as k,v as j,w as O,x as U,y as A,z as P,A as T,B as I,C as N}from"./chunks/vendor-8b597521.js";import{_ as C}from"./chunks/preload-helper-9f12a5fd.js";import{i as D}from"./chunks/singletons-bb9012b7.js";import{s as V}from"./chunks/paths-45dac81d.js";function B(t){let e,r,s;const a=[t[2]||{}];var o=t[0][1];function n(t){let e={$$slots:{default:[M]},$$scope:{ctx:t}};for(let r=0;r{O(t,1)})),k()}o?(e=new o(n(t)),v(e.$$.fragment),j(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else o&&e.$set(i)},i(t){s||(e&&j(e.$$.fragment,t),s=!0)},o(t){e&&L(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&O(e,t)}}}function K(t){let e,r,s;const a=[t[3]||{}];var o=t[0][2];function n(t){let e={};for(let r=0;r{O(t,1)})),k()}o?(e=new o(n()),v(e.$$.fragment),j(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else o&&e.$set(i)},i(t){s||(e&&j(e.$$.fragment,t),s=!0)},o(t){e&&L(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&O(e,t)}}}function M(t){let e,r,s=t[0][2]&&K(t);return{c(){s&&s.c(),e=w()},l(t){s&&s.l(t),e=w()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][2]?s?(s.p(t,r),1&r&&j(s,1)):(s=K(t),s.c(),j(s,1),s.m(e.parentNode,e)):s&&(I(),L(s,1,1,(()=>{s=null})),k())},i(t){r||(j(s),r=!0)},o(t){L(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function W(t){let e,r,s=t[0][1]&&B(t);return{c(){s&&s.c(),e=w()},l(t){s&&s.l(t),e=w()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][1]?s?(s.p(t,r),1&r&&j(s,1)):(s=B(t),s.c(),j(s,1),s.m(e.parentNode,e)):s&&(I(),L(s,1,1,(()=>{s=null})),k())},i(t){r||(j(s),r=!0)},o(t){L(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function Y(t){let e,r=t[5]&&z(t);return{c(){e=h("div"),r&&r.c(),this.h()},l(t){e=d(t,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,class:!0});var s=p(e);r&&r.l(s),s.forEach(f),this.h()},h(){g(e,"id","svelte-announcer"),g(e,"aria-live","assertive"),g(e,"aria-atomic","true"),g(e,"class","svelte-1pdgbjn")},m(t,s){m(t,e,s),r&&r.m(e,null)},p(t,s){t[5]?r?r.p(t,s):(r=z(t),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},d(t){t&&f(e),r&&r.d()}}}function z(t){let e;return{c(){e=_(t[6])},l(r){e=y(r,t[6])},m(t,r){m(t,e,r)},p(t,r){64&r&&b(e,t[6])},d(t){t&&f(e)}}}function G(t){let e,r,s,a;const o=[t[1]||{}];var n=t[0][0];function i(t){let e={$$slots:{default:[W]},$$scope:{ctx:t}};for(let r=0;r{O(t,1)})),k()}n?(e=new n(i(t)),v(e.$$.fragment),j(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else n&&e.$set(c);t[4]?l?l.p(t,a):(l=Y(t),l.c(),l.m(s.parentNode,s)):l&&(l.d(1),l=null)},i(t){a||(e&&j(e.$$.fragment,t),a=!0)},o(t){e&&L(e.$$.fragment,t),a=!1},d(t){e&&O(e,t),t&&f(r),l&&l.d(t),t&&f(s)}}}function J(t,e,r){let{stores:s}=e,{page:a}=e,{components:o}=e,{props_0:n=null}=e,{props_1:i=null}=e,{props_2:l=null}=e;U("__svelte__",s),A(s.page.notify);let c=!1,u=!1,h=null;return P((()=>{const t=s.page.subscribe((()=>{c&&(r(5,u=!0),r(6,h=document.title||"untitled page"))}));return r(4,c=!0),t})),t.$$set=t=>{"stores"in t&&r(7,s=t.stores),"page"in t&&r(8,a=t.page),"components"in t&&r(0,o=t.components),"props_0"in t&&r(1,n=t.props_0),"props_1"in t&&r(2,i=t.props_1),"props_2"in t&&r(3,l=t.props_2)},t.$$.update=()=>{384&t.$$.dirty&&s.page.set(a)},[o,n,i,l,c,u,h,s,a]}class X extends l{constructor(t){super(),c(this,t,J,G,u,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const F=[()=>C((()=>import("./pages/__layout.svelte-809d1245.js")),["/mermaid-live-editor/_app/pages/__layout.svelte-809d1245.js","/mermaid-live-editor/_app/assets/pages/__layout.svelte-adbca494.css","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/paths-45dac81d.js"]),()=>C((()=>import("./error.svelte-690d0ef1.js")),["/mermaid-live-editor/_app/error.svelte-690d0ef1.js","/mermaid-live-editor/_app/chunks/vendor-8b597521.js"]),()=>C((()=>import("./pages/index.svelte-c7dd545d.js")),["/mermaid-live-editor/_app/pages/index.svelte-c7dd545d.js","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/singletons-bb9012b7.js","/mermaid-live-editor/_app/chunks/paths-45dac81d.js"]),()=>C((()=>import("./pages/edit.svelte-da6fda5c.js")),["/mermaid-live-editor/_app/pages/edit.svelte-da6fda5c.js","/mermaid-live-editor/_app/assets/pages/edit.svelte-05f3059c.css","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/util-b71e0722.js","/mermaid-live-editor/_app/assets/util-53f38408.css","/mermaid-live-editor/_app/chunks/preload-helper-9f12a5fd.js","/mermaid-live-editor/_app/chunks/paths-45dac81d.js"]),()=>C((()=>import("./pages/view.svelte-4d357761.js")),["/mermaid-live-editor/_app/pages/view.svelte-4d357761.js","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/util-b71e0722.js","/mermaid-live-editor/_app/assets/util-53f38408.css","/mermaid-live-editor/_app/chunks/preload-helper-9f12a5fd.js"])],H=[[/^\/$/,[F[0],F[2]],[F[1]]],[/^\/manifest\.json$/],[/^\/edit\/?$/,[F[0],F[3]],[F[1]]],[/^\/view\/?$/,[F[0],F[4]],[F[1]]]],Q=[F[0](),F[1]()];function Z(){return{x:pageXOffset,y:pageYOffset}}function tt(t){for(;t&&"A"!==t.nodeName.toUpperCase();)t=t.parentNode;return t}class et{constructor({base:t,routes:e,trailing_slash:r}){this.base=t,this.routes=e,this.trailing_slash=r}init(t){let s;this.renderer=t,t.router=this,this.enabled=!0,"scrollRestoration"in history&&(history.scrollRestoration="manual"),addEventListener("beforeunload",(()=>{history.scrollRestoration="auto"})),addEventListener("load",(()=>{history.scrollRestoration="manual"})),addEventListener("scroll",(()=>{clearTimeout(s),s=setTimeout((()=>{const t=(s=i({},history.state||{}),a={"sveltekit:scroll":Z()},e(s,r(a)));var s,a;history.replaceState(t,document.title,window.location.href)}),50)}));const a=t=>{const e=tt(t.target);e&&e.href&&e.hasAttribute("sveltekit:prefetch")&&this.prefetch(new URL(e.href))};let o;addEventListener("touchstart",a),addEventListener("mousemove",(t=>{clearTimeout(o),o=setTimeout((()=>{a(t)}),20)})),addEventListener("click",(t=>{var e;if(!this.enabled)return;if(t.button||1!==t.which)return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;if(t.defaultPrevented)return;const r=tt(t.target);if(!r)return;if(!r.href)return;const s="object"==typeof r.href&&"SVGAnimatedString"===r.href.constructor.name,a=String(s?r.href.baseVal:r.href);if(a===location.href)return void(location.hash||t.preventDefault());const o=null==(e=r.getAttribute("rel"))?void 0:e.split(/\s+/);if(r.hasAttribute("download")||o&&o.includes("external"))return;if(s?r.target.baseVal:r.target)return;const n=new URL(a);if(!this.owns(n))return;const i=r.hasAttribute("sveltekit:noscroll");history.pushState({},"",n.href),this._navigate(n,i?Z():null,[],n.hash),t.preventDefault()})),addEventListener("popstate",(t=>{if(t.state&&this.enabled){const e=new URL(location.href);this._navigate(e,t.state["sveltekit:scroll"],[])}})),document.body.setAttribute("tabindex","-1"),history.replaceState(history.state||{},"",location.href)}owns(t){return t.origin===location.origin&&t.pathname.startsWith(this.base)}parse(t){if(this.owns(t)){const e=decodeURIComponent(t.pathname.slice(this.base.length)||"/"),r=this.routes.filter((([t])=>t.test(e))),s=new URLSearchParams(t.search);return{id:`${e}?${s}`,routes:r,path:e,query:s}}}async goto(t,{noscroll:e=!1,replaceState:r=!1}={},s){const a=new URL(t,function(t){let e=t.baseURI;if(!e){const r=t.getElementsByTagName("base");e=r.length?r[0].href:t.URL}return e}(document));return this.enabled&&this.owns(a)?(history[r?"replaceState":"pushState"]({},"",t),this._navigate(a,e?Z():null,s,a.hash)):(location.href=a.href,new Promise((()=>{})))}enable(){this.enabled=!0}disable(){this.enabled=!1}async prefetch(t){const e=this.parse(t);if(!e)throw new Error("Attempted to prefetch a URL that does not belong to this app");return this.renderer.load(e)}async _navigate(t,e,r,s){const a=this.parse(t);if(!a)throw new Error("Attempted to navigate to a URL that does not belong to this app");if("/"!==a.path){const t=a.path.endsWith("/");(t&&"never"===this.trailing_slash||!t&&"always"===this.trailing_slash&&!a.path.split("/").pop().includes("."))&&(a.path=t?a.path.slice(0,-1):a.path+"/",history.replaceState({},"",`${a.path}${location.search}`))}this.renderer.notify({path:a.path,query:a.query}),await this.renderer.update(a,r,!1),document.body.focus();const o=s&&document.getElementById(s.slice(1));e?scrollTo(e.x,e.y):o?scrollTo(0,o.getBoundingClientRect().top+scrollY):scrollTo(0,0)}}function rt(t){const e=N(t);let r=!0;return{notify:function(){r=!0,e.update((t=>t))},set:function(t){r=!1,e.set(t)},subscribe:function(t){let s;return e.subscribe((e=>{(void 0===s||r&&e!==s)&&t(s=e)}))}}}function st(t,e){let r=`script[type="svelte-data"][url="${"string"==typeof t?t:t.url}"]`;e&&"string"==typeof e.body&&(r+=`[body="${function(t){let e=5381,r=t.length;if("string"==typeof t)for(;r;)e=33*e^t.charCodeAt(--r);else for(;r;)e=33*e^t[--r];return(e>>>0).toString(36)}(e.body)}"]`);const n=document.querySelector(r);if(n){const t=JSON.parse(n.textContent),{body:e}=t,r=((t,e)=>{var r={};for(var n in t)a.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&s)for(var n of s(t))e.indexOf(n)<0&&o.call(t,n)&&(r[n]=t[n]);return r})(t,["body"]);return Promise.resolve(new Response(e,r))}return fetch(t,e)}class at{constructor({Root:t,fallback:e,target:r,session:s,host:a}){this.Root=t,this.fallback=e,this.host=a,this.router=null,this.target=r,this.started=!1,this.session_id=1,this.invalid=new Set,this.invalidating=null,this.current={page:null,session_id:null,branch:[]},this.cache=new Map,this.loading={id:null,promise:null},this.stores={page:rt({}),navigating:N(null),session:N(s)},this.$session=null,this.root=null;let o=!1;this.stores.session.subscribe((async t=>{if(this.$session=t,!o)return;this.session_id+=1;const e=this.router.parse(new URL(location.href));this.update(e,[],!0)})),o=!0}async start({status:t,error:e,nodes:r,page:s}){const a=[];let o,n,l,c={};try{for(let o=0;o10||e.includes(t.path)))return void(this.router?this.router.goto(a.redirect,{replaceState:!0},[...e,t.path]):location.href=new URL(a.redirect,location.href).href);a=await this._load_error({status:500,error:new Error("Redirect loop"),path:t.path,query:t.query})}a.reload?location.reload():this.started?(this.current=a.state,this.root.$set(a.props),this.stores.navigating.set(null),await 0):this._init(a),dispatchEvent(new CustomEvent("sveltekit:navigation-end")),this.loading.promise=null,this.loading.id=null;const o=a.state.branch[a.state.branch.length-1];o&&!1===o.module.router?this.router.disable():this.router.enable()}load(t){return this.loading.promise=this._get_navigation_result(t,!1),this.loading.id=t.id,this.loading.promise}invalidate(t){return this.invalid.add(t),this.invalidating||(this.invalidating=Promise.resolve().then((async()=>{const t=this.router.parse(new URL(location.href));await this.update(t,[],!0),this.invalidating=null}))),this.invalidating}_init(t){this.current=t.state;const e=document.querySelector("style[data-svelte]");e&&e.remove(),this.root=new this.Root({target:this.target,props:i({stores:this.stores},t.props),hydrate:!0}),this.started=!0}async _get_navigation_result(t,e){if(this.loading.id===t.id)return this.loading.promise;for(let r=0;rt())),a+=1}const o=await this._load({route:s,path:t.path,query:t.query},e);if(o)return o}return await this._load_error({status:404,error:new Error(`Not found: ${t.path}`),path:t.path,query:t.query})}async _get_navigation_result_from_branch({page:t,branch:e}){const r=e.filter(Boolean),s={state:{page:t,branch:e,session_id:this.session_id},props:{components:r.map((t=>t.module.default))}};for(let n=0;n{this.cache.get(e)===s&&this.cache.delete(e),i(),clearTimeout(n)},n=setTimeout(a,1e3*o),i=this.stores.session.subscribe((()=>{r&&a()}));r=!0,this.cache.set(e,s)}return s}async _load_node({status:t,error:e,module:r,page:s,context:a}){const o={module:r,uses:{params:new Set,path:!1,query:!1,session:!1,context:!1,dependencies:[]},loaded:null,context:a},n={};for(const i in s.params)Object.defineProperty(n,i,{get:()=>(o.uses.params.add(i),s.params[i]),enumerable:!0});const l=this.$session;if(r.load){const{started:c}=this,u={page:{host:s.host,params:n,get path(){return o.uses.path=!0,s.path},get query(){return o.uses.query=!0,s.query}},get session(){return o.uses.session=!0,l},get context(){return o.uses.context=!0,i({},a)},fetch(t,e){const r="string"==typeof t?t:t.url,{href:a}=new URL(r,new URL(s.path,document.baseURI));return o.uses.dependencies.push(a),c?fetch(t,e):st(t,e)}};e&&(u.status=t,u.error=e);const h=await r.load.call(null,u);if(!h)return;o.loaded=function(t){if(t.error){const e="string"==typeof t.error?new Error(t.error):t.error,r=t.status;return e instanceof Error?!r||r<400||r>599?(console.warn('"error" returned from load() without a valid status code — defaulting to 500'),{status:500,error:e}):{status:r,error:e}:{status:500,error:new Error(`"error" property returned from load() must be a string or instance of Error, received type "${typeof e}"`)}}if(t.redirect){if(!t.status||3!==Math.floor(t.status/100))return{status:500,error:new Error('"redirect" property returned from load() must be accompanied by a 3xx status code')};if("string"!=typeof t.redirect)return{status:500,error:new Error('"redirect" property returned from load() must be a string')}}return t}(h),o.loaded.context&&(o.context=o.loaded.context)}return o}async _load({route:t,path:e,query:r},s){const a=`${e}?${r}`;if(!s&&this.cache.has(a))return this.cache.get(a);const[o,n,l,c]=t,u=c?c(o.exec(e)):{},h=this.current.page&&{path:e!==this.current.page.path,params:Object.keys(u).filter((t=>this.current.page.params[t]!==u[t])),query:r.toString()!==this.current.page.query.toString(),session:this.session_id!==this.current.session_id},d={host:this.host,path:e,query:r,params:u},p=[];let f={},g=!1,m=200,_=null;n.forEach((t=>t()));t:for(let b=0;br.uses.params.has(t)))||h.query&&r.uses.query||h.session&&r.uses.session||r.uses.dependencies.some((t=>this.invalid.has(t)))||g&&r.uses.context){t=await this._load_node({module:e,page:d,context:f});const r=b===n.length-1;if(t&&t.loaded){if(t.loaded.error&&(m=t.loaded.status,_=t.loaded.error),t.loaded.redirect)return{redirect:t.loaded.redirect};t.loaded.context&&(g=!0)}else if(r&&e.load)return}else t=r}catch(y){m=500,_=y}if(_){for(;b--;)if(l[b]){let t,e,r=b;for(;!(e=p[r]);)r-=1;try{if(t=await this._load_node({status:m,error:_,module:await l[b](),page:d,context:e.context}),t.loaded.error)continue;p.push(t);break t}catch(y){continue}}return await this._load_error({status:m,error:_,path:e,query:r})}t&&t.loaded&&t.loaded.context&&(f=i(i({},f),t.loaded.context)),p.push(t)}return await this._get_navigation_result_from_branch({page:d,branch:p})}async _load_error({status:t,error:e,path:r,query:s}){const a={host:this.host,path:r,query:s,params:{}},o=await this._load_node({module:await this.fallback[0],page:a,context:{}}),n=[o,await this._load_node({status:t,error:e,module:await this.fallback[1],page:a,context:o&&o.loaded&&o.loaded.context})];return await this._get_navigation_result_from_branch({page:a,branch:n})}}async function ot({paths:t,target:e,session:r,host:s,route:a,spa:o,trailing_slash:n,hydrate:i}){const l=a&&new et({base:t.base,routes:H,trailing_slash:n}),c=new at({Root:X,fallback:Q,target:e,session:r,host:s});D(l),V(t),i&&await c.start(i),a&&l.init(c),o&&l.goto(location.href,{replaceState:!0},[]),dispatchEvent(new CustomEvent("sveltekit:start"))}export{ot as start}; +var t=Object.defineProperty,e=Object.defineProperties,r=Object.getOwnPropertyDescriptors,s=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable,n=(e,r,s)=>r in e?t(e,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[r]=s,i=(t,e)=>{for(var r in e||(e={}))a.call(e,r)&&n(t,r,e[r]);if(s)for(var r of s(e))o.call(e,r)&&n(t,r,e[r]);return t};import{S as l,i as c,s as u,e as h,c as d,a as p,d as f,b as g,f as m,t as _,g as y,h as b,j as v,k as $,l as w,m as x,n as E,o as q,p as R,q as S,r as L,u as k,v as j,w as O,x as U,y as A,z as P,A as T,B as I,C as N}from"./chunks/vendor-8b597521.js";import{_ as C}from"./chunks/preload-helper-9f12a5fd.js";import{i as D}from"./chunks/singletons-bb9012b7.js";import{s as V}from"./chunks/paths-45dac81d.js";function B(t){let e,r,s;const a=[t[2]||{}];var o=t[0][1];function n(t){let e={$$slots:{default:[M]},$$scope:{ctx:t}};for(let r=0;r{O(t,1)})),k()}o?(e=new o(n(t)),v(e.$$.fragment),j(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else o&&e.$set(i)},i(t){s||(e&&j(e.$$.fragment,t),s=!0)},o(t){e&&L(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&O(e,t)}}}function K(t){let e,r,s;const a=[t[3]||{}];var o=t[0][2];function n(t){let e={};for(let r=0;r{O(t,1)})),k()}o?(e=new o(n()),v(e.$$.fragment),j(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else o&&e.$set(i)},i(t){s||(e&&j(e.$$.fragment,t),s=!0)},o(t){e&&L(e.$$.fragment,t),s=!1},d(t){t&&f(r),e&&O(e,t)}}}function M(t){let e,r,s=t[0][2]&&K(t);return{c(){s&&s.c(),e=w()},l(t){s&&s.l(t),e=w()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][2]?s?(s.p(t,r),1&r&&j(s,1)):(s=K(t),s.c(),j(s,1),s.m(e.parentNode,e)):s&&(I(),L(s,1,1,(()=>{s=null})),k())},i(t){r||(j(s),r=!0)},o(t){L(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function W(t){let e,r,s=t[0][1]&&B(t);return{c(){s&&s.c(),e=w()},l(t){s&&s.l(t),e=w()},m(t,a){s&&s.m(t,a),m(t,e,a),r=!0},p(t,r){t[0][1]?s?(s.p(t,r),1&r&&j(s,1)):(s=B(t),s.c(),j(s,1),s.m(e.parentNode,e)):s&&(I(),L(s,1,1,(()=>{s=null})),k())},i(t){r||(j(s),r=!0)},o(t){L(s),r=!1},d(t){s&&s.d(t),t&&f(e)}}}function Y(t){let e,r=t[5]&&z(t);return{c(){e=h("div"),r&&r.c(),this.h()},l(t){e=d(t,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,class:!0});var s=p(e);r&&r.l(s),s.forEach(f),this.h()},h(){g(e,"id","svelte-announcer"),g(e,"aria-live","assertive"),g(e,"aria-atomic","true"),g(e,"class","svelte-1pdgbjn")},m(t,s){m(t,e,s),r&&r.m(e,null)},p(t,s){t[5]?r?r.p(t,s):(r=z(t),r.c(),r.m(e,null)):r&&(r.d(1),r=null)},d(t){t&&f(e),r&&r.d()}}}function z(t){let e;return{c(){e=_(t[6])},l(r){e=y(r,t[6])},m(t,r){m(t,e,r)},p(t,r){64&r&&b(e,t[6])},d(t){t&&f(e)}}}function G(t){let e,r,s,a;const o=[t[1]||{}];var n=t[0][0];function i(t){let e={$$slots:{default:[W]},$$scope:{ctx:t}};for(let r=0;r{O(t,1)})),k()}n?(e=new n(i(t)),v(e.$$.fragment),j(e.$$.fragment,1),q(e,r.parentNode,r)):e=null}else n&&e.$set(c);t[4]?l?l.p(t,a):(l=Y(t),l.c(),l.m(s.parentNode,s)):l&&(l.d(1),l=null)},i(t){a||(e&&j(e.$$.fragment,t),a=!0)},o(t){e&&L(e.$$.fragment,t),a=!1},d(t){e&&O(e,t),t&&f(r),l&&l.d(t),t&&f(s)}}}function J(t,e,r){let{stores:s}=e,{page:a}=e,{components:o}=e,{props_0:n=null}=e,{props_1:i=null}=e,{props_2:l=null}=e;U("__svelte__",s),A(s.page.notify);let c=!1,u=!1,h=null;return P((()=>{const t=s.page.subscribe((()=>{c&&(r(5,u=!0),r(6,h=document.title||"untitled page"))}));return r(4,c=!0),t})),t.$$set=t=>{"stores"in t&&r(7,s=t.stores),"page"in t&&r(8,a=t.page),"components"in t&&r(0,o=t.components),"props_0"in t&&r(1,n=t.props_0),"props_1"in t&&r(2,i=t.props_1),"props_2"in t&&r(3,l=t.props_2)},t.$$.update=()=>{384&t.$$.dirty&&s.page.set(a)},[o,n,i,l,c,u,h,s,a]}class X extends l{constructor(t){super(),c(this,t,J,G,u,{stores:7,page:8,components:0,props_0:1,props_1:2,props_2:3})}}const F=[()=>C((()=>import("./pages/__layout.svelte-809d1245.js")),["/mermaid-live-editor/_app/pages/__layout.svelte-809d1245.js","/mermaid-live-editor/_app/assets/pages/__layout.svelte-adbca494.css","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/paths-45dac81d.js"]),()=>C((()=>import("./error.svelte-690d0ef1.js")),["/mermaid-live-editor/_app/error.svelte-690d0ef1.js","/mermaid-live-editor/_app/chunks/vendor-8b597521.js"]),()=>C((()=>import("./pages/index.svelte-c7dd545d.js")),["/mermaid-live-editor/_app/pages/index.svelte-c7dd545d.js","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/singletons-bb9012b7.js","/mermaid-live-editor/_app/chunks/paths-45dac81d.js"]),()=>C((()=>import("./pages/edit.svelte-7b949399.js")),["/mermaid-live-editor/_app/pages/edit.svelte-7b949399.js","/mermaid-live-editor/_app/assets/pages/edit.svelte-05f3059c.css","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/util-b71e0722.js","/mermaid-live-editor/_app/assets/util-53f38408.css","/mermaid-live-editor/_app/chunks/preload-helper-9f12a5fd.js","/mermaid-live-editor/_app/chunks/paths-45dac81d.js"]),()=>C((()=>import("./pages/view.svelte-4d357761.js")),["/mermaid-live-editor/_app/pages/view.svelte-4d357761.js","/mermaid-live-editor/_app/chunks/vendor-8b597521.js","/mermaid-live-editor/_app/chunks/util-b71e0722.js","/mermaid-live-editor/_app/assets/util-53f38408.css","/mermaid-live-editor/_app/chunks/preload-helper-9f12a5fd.js"])],H=[[/^\/$/,[F[0],F[2]],[F[1]]],[/^\/manifest\.json$/],[/^\/edit\/?$/,[F[0],F[3]],[F[1]]],[/^\/view\/?$/,[F[0],F[4]],[F[1]]]],Q=[F[0](),F[1]()];function Z(){return{x:pageXOffset,y:pageYOffset}}function tt(t){for(;t&&"A"!==t.nodeName.toUpperCase();)t=t.parentNode;return t}class et{constructor({base:t,routes:e,trailing_slash:r}){this.base=t,this.routes=e,this.trailing_slash=r}init(t){let s;this.renderer=t,t.router=this,this.enabled=!0,"scrollRestoration"in history&&(history.scrollRestoration="manual"),addEventListener("beforeunload",(()=>{history.scrollRestoration="auto"})),addEventListener("load",(()=>{history.scrollRestoration="manual"})),addEventListener("scroll",(()=>{clearTimeout(s),s=setTimeout((()=>{const t=(s=i({},history.state||{}),a={"sveltekit:scroll":Z()},e(s,r(a)));var s,a;history.replaceState(t,document.title,window.location.href)}),50)}));const a=t=>{const e=tt(t.target);e&&e.href&&e.hasAttribute("sveltekit:prefetch")&&this.prefetch(new URL(e.href))};let o;addEventListener("touchstart",a),addEventListener("mousemove",(t=>{clearTimeout(o),o=setTimeout((()=>{a(t)}),20)})),addEventListener("click",(t=>{var e;if(!this.enabled)return;if(t.button||1!==t.which)return;if(t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;if(t.defaultPrevented)return;const r=tt(t.target);if(!r)return;if(!r.href)return;const s="object"==typeof r.href&&"SVGAnimatedString"===r.href.constructor.name,a=String(s?r.href.baseVal:r.href);if(a===location.href)return void(location.hash||t.preventDefault());const o=null==(e=r.getAttribute("rel"))?void 0:e.split(/\s+/);if(r.hasAttribute("download")||o&&o.includes("external"))return;if(s?r.target.baseVal:r.target)return;const n=new URL(a);if(!this.owns(n))return;const i=r.hasAttribute("sveltekit:noscroll");history.pushState({},"",n.href),this._navigate(n,i?Z():null,[],n.hash),t.preventDefault()})),addEventListener("popstate",(t=>{if(t.state&&this.enabled){const e=new URL(location.href);this._navigate(e,t.state["sveltekit:scroll"],[])}})),document.body.setAttribute("tabindex","-1"),history.replaceState(history.state||{},"",location.href)}owns(t){return t.origin===location.origin&&t.pathname.startsWith(this.base)}parse(t){if(this.owns(t)){const e=decodeURIComponent(t.pathname.slice(this.base.length)||"/"),r=this.routes.filter((([t])=>t.test(e))),s=new URLSearchParams(t.search);return{id:`${e}?${s}`,routes:r,path:e,query:s}}}async goto(t,{noscroll:e=!1,replaceState:r=!1}={},s){const a=new URL(t,function(t){let e=t.baseURI;if(!e){const r=t.getElementsByTagName("base");e=r.length?r[0].href:t.URL}return e}(document));return this.enabled&&this.owns(a)?(history[r?"replaceState":"pushState"]({},"",t),this._navigate(a,e?Z():null,s,a.hash)):(location.href=a.href,new Promise((()=>{})))}enable(){this.enabled=!0}disable(){this.enabled=!1}async prefetch(t){const e=this.parse(t);if(!e)throw new Error("Attempted to prefetch a URL that does not belong to this app");return this.renderer.load(e)}async _navigate(t,e,r,s){const a=this.parse(t);if(!a)throw new Error("Attempted to navigate to a URL that does not belong to this app");if("/"!==a.path){const t=a.path.endsWith("/");(t&&"never"===this.trailing_slash||!t&&"always"===this.trailing_slash&&!a.path.split("/").pop().includes("."))&&(a.path=t?a.path.slice(0,-1):a.path+"/",history.replaceState({},"",`${a.path}${location.search}`))}this.renderer.notify({path:a.path,query:a.query}),await this.renderer.update(a,r,!1),document.body.focus();const o=s&&document.getElementById(s.slice(1));e?scrollTo(e.x,e.y):o?scrollTo(0,o.getBoundingClientRect().top+scrollY):scrollTo(0,0)}}function rt(t){const e=N(t);let r=!0;return{notify:function(){r=!0,e.update((t=>t))},set:function(t){r=!1,e.set(t)},subscribe:function(t){let s;return e.subscribe((e=>{(void 0===s||r&&e!==s)&&t(s=e)}))}}}function st(t,e){let r=`script[type="svelte-data"][url="${"string"==typeof t?t:t.url}"]`;e&&"string"==typeof e.body&&(r+=`[body="${function(t){let e=5381,r=t.length;if("string"==typeof t)for(;r;)e=33*e^t.charCodeAt(--r);else for(;r;)e=33*e^t[--r];return(e>>>0).toString(36)}(e.body)}"]`);const n=document.querySelector(r);if(n){const t=JSON.parse(n.textContent),{body:e}=t,r=((t,e)=>{var r={};for(var n in t)a.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&s)for(var n of s(t))e.indexOf(n)<0&&o.call(t,n)&&(r[n]=t[n]);return r})(t,["body"]);return Promise.resolve(new Response(e,r))}return fetch(t,e)}class at{constructor({Root:t,fallback:e,target:r,session:s,host:a}){this.Root=t,this.fallback=e,this.host=a,this.router=null,this.target=r,this.started=!1,this.session_id=1,this.invalid=new Set,this.invalidating=null,this.current={page:null,session_id:null,branch:[]},this.cache=new Map,this.loading={id:null,promise:null},this.stores={page:rt({}),navigating:N(null),session:N(s)},this.$session=null,this.root=null;let o=!1;this.stores.session.subscribe((async t=>{if(this.$session=t,!o)return;this.session_id+=1;const e=this.router.parse(new URL(location.href));this.update(e,[],!0)})),o=!0}async start({status:t,error:e,nodes:r,page:s}){const a=[];let o,n,l,c={};try{for(let o=0;o10||e.includes(t.path)))return void(this.router?this.router.goto(a.redirect,{replaceState:!0},[...e,t.path]):location.href=new URL(a.redirect,location.href).href);a=await this._load_error({status:500,error:new Error("Redirect loop"),path:t.path,query:t.query})}a.reload?location.reload():this.started?(this.current=a.state,this.root.$set(a.props),this.stores.navigating.set(null),await 0):this._init(a),dispatchEvent(new CustomEvent("sveltekit:navigation-end")),this.loading.promise=null,this.loading.id=null;const o=a.state.branch[a.state.branch.length-1];o&&!1===o.module.router?this.router.disable():this.router.enable()}load(t){return this.loading.promise=this._get_navigation_result(t,!1),this.loading.id=t.id,this.loading.promise}invalidate(t){return this.invalid.add(t),this.invalidating||(this.invalidating=Promise.resolve().then((async()=>{const t=this.router.parse(new URL(location.href));await this.update(t,[],!0),this.invalidating=null}))),this.invalidating}_init(t){this.current=t.state;const e=document.querySelector("style[data-svelte]");e&&e.remove(),this.root=new this.Root({target:this.target,props:i({stores:this.stores},t.props),hydrate:!0}),this.started=!0}async _get_navigation_result(t,e){if(this.loading.id===t.id)return this.loading.promise;for(let r=0;rt())),a+=1}const o=await this._load({route:s,path:t.path,query:t.query},e);if(o)return o}return await this._load_error({status:404,error:new Error(`Not found: ${t.path}`),path:t.path,query:t.query})}async _get_navigation_result_from_branch({page:t,branch:e}){const r=e.filter(Boolean),s={state:{page:t,branch:e,session_id:this.session_id},props:{components:r.map((t=>t.module.default))}};for(let n=0;n{this.cache.get(e)===s&&this.cache.delete(e),i(),clearTimeout(n)},n=setTimeout(a,1e3*o),i=this.stores.session.subscribe((()=>{r&&a()}));r=!0,this.cache.set(e,s)}return s}async _load_node({status:t,error:e,module:r,page:s,context:a}){const o={module:r,uses:{params:new Set,path:!1,query:!1,session:!1,context:!1,dependencies:[]},loaded:null,context:a},n={};for(const i in s.params)Object.defineProperty(n,i,{get:()=>(o.uses.params.add(i),s.params[i]),enumerable:!0});const l=this.$session;if(r.load){const{started:c}=this,u={page:{host:s.host,params:n,get path(){return o.uses.path=!0,s.path},get query(){return o.uses.query=!0,s.query}},get session(){return o.uses.session=!0,l},get context(){return o.uses.context=!0,i({},a)},fetch(t,e){const r="string"==typeof t?t:t.url,{href:a}=new URL(r,new URL(s.path,document.baseURI));return o.uses.dependencies.push(a),c?fetch(t,e):st(t,e)}};e&&(u.status=t,u.error=e);const h=await r.load.call(null,u);if(!h)return;o.loaded=function(t){if(t.error){const e="string"==typeof t.error?new Error(t.error):t.error,r=t.status;return e instanceof Error?!r||r<400||r>599?(console.warn('"error" returned from load() without a valid status code — defaulting to 500'),{status:500,error:e}):{status:r,error:e}:{status:500,error:new Error(`"error" property returned from load() must be a string or instance of Error, received type "${typeof e}"`)}}if(t.redirect){if(!t.status||3!==Math.floor(t.status/100))return{status:500,error:new Error('"redirect" property returned from load() must be accompanied by a 3xx status code')};if("string"!=typeof t.redirect)return{status:500,error:new Error('"redirect" property returned from load() must be a string')}}return t}(h),o.loaded.context&&(o.context=o.loaded.context)}return o}async _load({route:t,path:e,query:r},s){const a=`${e}?${r}`;if(!s&&this.cache.has(a))return this.cache.get(a);const[o,n,l,c]=t,u=c?c(o.exec(e)):{},h=this.current.page&&{path:e!==this.current.page.path,params:Object.keys(u).filter((t=>this.current.page.params[t]!==u[t])),query:r.toString()!==this.current.page.query.toString(),session:this.session_id!==this.current.session_id},d={host:this.host,path:e,query:r,params:u},p=[];let f={},g=!1,m=200,_=null;n.forEach((t=>t()));t:for(let b=0;br.uses.params.has(t)))||h.query&&r.uses.query||h.session&&r.uses.session||r.uses.dependencies.some((t=>this.invalid.has(t)))||g&&r.uses.context){t=await this._load_node({module:e,page:d,context:f});const r=b===n.length-1;if(t&&t.loaded){if(t.loaded.error&&(m=t.loaded.status,_=t.loaded.error),t.loaded.redirect)return{redirect:t.loaded.redirect};t.loaded.context&&(g=!0)}else if(r&&e.load)return}else t=r}catch(y){m=500,_=y}if(_){for(;b--;)if(l[b]){let t,e,r=b;for(;!(e=p[r]);)r-=1;try{if(t=await this._load_node({status:m,error:_,module:await l[b](),page:d,context:e.context}),t.loaded.error)continue;p.push(t);break t}catch(y){continue}}return await this._load_error({status:m,error:_,path:e,query:r})}t&&t.loaded&&t.loaded.context&&(f=i(i({},f),t.loaded.context)),p.push(t)}return await this._get_navigation_result_from_branch({page:d,branch:p})}async _load_error({status:t,error:e,path:r,query:s}){const a={host:this.host,path:r,query:s,params:{}},o=await this._load_node({module:await this.fallback[0],page:a,context:{}}),n=[o,await this._load_node({status:t,error:e,module:await this.fallback[1],page:a,context:o&&o.loaded&&o.loaded.context})];return await this._get_navigation_result_from_branch({page:a,branch:n})}}async function ot({paths:t,target:e,session:r,host:s,route:a,spa:o,trailing_slash:n,hydrate:i}){const l=a&&new et({base:t.base,routes:H,trailing_slash:n}),c=new at({Root:X,fallback:Q,target:e,session:r,host:s});D(l),V(t),i&&await c.start(i),a&&l.init(c),o&&l.goto(location.href,{replaceState:!0},[]),dispatchEvent(new CustomEvent("sveltekit:start"))}export{ot as start}; diff --git a/bin/beta-release b/bin/beta-release deleted file mode 100755 index 0cfc6af3..00000000 --- a/bin/beta-release +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# Clone mermaid-js/docs parallel with the mermaid live editor. - -# git clone git@github.com:mermaid-js/docs.git -# git clone https://github.com/mermaid-js/docs.git -set -e -rm -rf docs -yarn release -pushd . -if [ ! -d ../docs ]; then - echo "Clone https://github.com/mermaid-js/docs to parent folder before continuing." - exit -fi -rm -rf ../docs/mermaid-live-editor-beta/* -cp -r docs/* ../docs/mermaid-live-editor-beta -cd ../docs -git add . -git commit -m "Beta updated with latest changes" -git push -popd diff --git a/bin/fix-path b/bin/fix-path deleted file mode 100755 index 6c0fdcc3..00000000 --- a/bin/fix-path +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -pushd ../docs -# find ./ -type f -exec sed -i 's/service-worker.js/mermaid-live-editor\/service-worker.js/g' {} \; -find ./ -type f -exec sed -i 's/manifest.json/\/mermaid-live-editor\/manifest.json/g' {} \; -find ./ -type f -exec sed -i 's/favicon.png/\/mermaid-live-editor\/favicon.png/g' {} \; -popd \ No newline at end of file diff --git a/cypress.json b/cypress.json deleted file mode 100644 index 70b8e6bd..00000000 --- a/cypress.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "projectId": "2ckppp", - "$schema": "https://on.cypress.io/cypress.schema.json", - "baseUrl": "http://localhost:3000", - "pluginsFile": "./cypress/plugins/index.cjs", - "viewportWidth": 1440, - "viewportHeight": 768, - "snapshotFileName": "./cypress/snapshots.js", - "defaultCommandTimeout": 16000, - "requestTimeout": 16000 -} diff --git a/cypress/.eslintrc b/cypress/.eslintrc deleted file mode 100644 index 2fc83573..00000000 --- a/cypress/.eslintrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "plugins": ["cypress", "mocha"], - "extends": ["plugin:cypress/recommended", "plugin:mocha/recommended"], - "rules": { - "jest/expect-expect": "off", - "mocha/no-mocha-arrows": "off" - }, - "env": { - "cypress/globals": true, - "mocha": true - } -} diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json deleted file mode 100644 index 0ff2d645..00000000 --- a/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} diff --git a/cypress/integration/actions.spec.ts b/cypress/integration/actions.spec.ts deleted file mode 100644 index 6a2a8268..00000000 --- a/cypress/integration/actions.spec.ts +++ /dev/null @@ -1,20 +0,0 @@ -describe('Check actions', () => { - // eslint-disable-next-line mocha/no-hooks-for-single-case - beforeEach(() => { - cy.clearLocalStorage(); - cy.visit('/edit'); - cy.contains('Actions').click(); - }); - it('should update markdown code', () => { - cy.get('#markdown') - .invoke('val') - .then((oldText) => { - cy.get('#editor').click('bottom').type('{enter}C --> HistoryTest'); - cy.get('#markdown') - .invoke('val') - .then((newText) => { - expect(oldText).to.not.eq(newText); - }); - }); - }); -}); diff --git a/cypress/integration/diagramUpdate.spec.ts b/cypress/integration/diagramUpdate.spec.ts deleted file mode 100644 index 0edcf569..00000000 --- a/cypress/integration/diagramUpdate.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -describe('Auto sync tests', () => { - beforeEach(() => { - cy.clearLocalStorage(); - cy.visit('/'); - }); - it('should dim diagram when code is edited', () => { - cy.contains('Auto sync').click(); - cy.get('#view').should('not.have.class', 'outOfSync'); - cy.get('#editor').type(' C --> Test'); - cy.get('#view').should('have.class', 'outOfSync'); - cy.getLocalStorage('codeStore').snapshot(); - }); - - it('should show/hide sync button with auto sync', () => { - cy.get('[data-cy=sync]').should('not.exist'); - cy.contains('Auto sync').click(); - cy.get('[data-cy=sync]').should('exist'); - cy.get('#autoSync').check(); - cy.get('[data-cy=sync]').should('not.exist'); - }); - it('should not dim diagram when code is in sync', () => { - cy.contains('Auto sync').click(); - cy.get('#view').should('not.have.class', 'outOfSync'); - cy.get('#editor').type(' C --> Test'); - cy.get('#view').should('have.class', 'outOfSync'); - cy.get('[data-cy=sync]').click(); - cy.get('#view').should('not.have.class', 'outOfSync'); - cy.get('#autoSync').check(); - cy.get('#editor').type('ing'); - cy.get('#view').should('not.have.class', 'outOfSync'); - cy.getLocalStorage('codeStore').snapshot(); - }); -}); diff --git a/cypress/integration/history.spec.ts b/cypress/integration/history.spec.ts deleted file mode 100644 index 5bdedef0..00000000 --- a/cypress/integration/history.spec.ts +++ /dev/null @@ -1,60 +0,0 @@ -describe('Save History', () => { - beforeEach(() => { - cy.clearLocalStorage(); - cy.visit('/edit'); - }); - it('should save when clicked', () => { - cy.get('#historyList').find('li').should('have.length', 0); - cy.get('#historyList').contains('No items in History'); - cy.get('#saveHistory').click(); - cy.get('#historyList').find('No items in History').should('not.exist'); - cy.get('#historyList').find('li').should('have.length', 1); - cy.get('#saveHistory').click(); - cy.on('window:alert', (str) => { - expect(str).to.equal('State already saved.'); - }); - cy.on('window:confirm', () => true); - cy.get('#editor').type(' C --> HistoryTest'); - cy.get('#saveHistory').click(); - cy.get('#historyList').find('li').should('have.length', 2); - }); - - it('should be able to restore and delete', () => { - cy.get('#saveHistory').click(); - cy.get('#editor').type(' C --> HistoryTest'); - cy.get('#historyList').find('No items in History').should('not.exist'); - cy.get('#historyList').find('li').should('have.length', 1); - cy.contains('HistoryTest'); - cy.contains('Restore').click(); - cy.contains('HistoryTest').should('not.exist'); - cy.contains('Delete').click(); - cy.get('#historyList').find('li').should('have.length', 0); - cy.get('#historyList').contains('No items in History'); - cy.get('#saveHistory').click(); - cy.get('#editor').type(' C --> HistoryTest'); - cy.get('#saveHistory').click(); - cy.get('#editor').type('ing'); - cy.get('#clearHistory').click(); - cy.on('window:alert', (str) => { - expect(str).to.equal('Clear all saved items?'); - }); - cy.on('window:confirm', () => true); - cy.get('#historyList').contains('No items in History'); - }); - - it('should auto save history', () => { - cy.clock(); - cy.get('#editor').type(' C --> HistoryTest'); - cy.tick(70000); - cy.contains('Timeline').click(); - cy.get('#historyList').find('li').should('have.length', 1); - cy.get('#editor').type('ing'); - cy.tick(70000); - cy.get('#historyList').find('li').should('have.length', 2); - for (let i = 0; i < 31; i++) { - cy.get('#editor').type('.'); - cy.tick(70000); - } - cy.get('#historyList').find('li').should('have.length', 30); - }); -}); diff --git a/cypress/integration/loadSite.spec.ts b/cypress/integration/loadSite.spec.ts deleted file mode 100644 index 0c58d373..00000000 --- a/cypress/integration/loadSite.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -describe('Site Loads', () => { - beforeEach(() => { - cy.clearLocalStorage(); - }); - it('Check Home page load', () => { - cy.visit('/'); - cy.url().should('include', '/edit'); - cy.contains('History').click(); - cy.getLocalStorage('codeStore').snapshot(); - }); - - it('Check Redirect from old URL', () => { - cy.visit( - '/#/edit/eyJjb2RlIjoiZ3JhcGggVERcbiAgICBBW0NocmlzdG1hc10gLS0-fEdldCBtb25leXwgQihHbyBzaG9wcGluZylcbiAgICBCIC0tPiBDe0xldCBtZSB0aGlua31cbiAgICBDIC0tPnxPbmV8IERbTGFwdG9wXVxuICAgIEMgLS0-fFR3b3wgRVtpUGhvbmVdXG4gICAgQyAtLT58VGhyZWV8IEZbZmE6ZmEtY2FyIENhcl0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9LCJ1cGRhdGVFZGl0b3IiOmZhbHNlfQ' - ); - cy.url().should( - 'include', - '/edit/eyJjb2RlIjoiZ3JhcGggVERcbiAgICBBW0NocmlzdG1hc10gLS0-fEdldCBtb25leXwgQihHbyBzaG9wcGluZylcbiAgICBCIC0tPiBDe0xldCBtZSB0aGlua31cbiAgICBDIC0tPnxPbmV8IERbTGFwdG9wXVxuICAgIEMgLS0-fFR3b3wgRVtpUGhvbmVdXG4gICAgQyAtLT58VGhyZWV8IEZbZmE6ZmEtY2FyIENhcl0iLCJtZXJtYWlkIjp7InRoZW1lIjoiZGVmYXVsdCJ9LCJ1cGRhdGVFZGl0b3IiOmZhbHNlfQ' - ); - - cy.contains('History').click(); - cy.getLocalStorage('codeStore').snapshot(); - }); - - it('should load sample diagrams when clicked', () => { - cy.contains('Sample Diagrams').click(); - cy.contains('Pie Chart').click(); - cy.contains('pie title Pets adopted by volunteers'); - cy.contains('Class Diagram').click(); - cy.contains('classDiagram'); - }); -}); diff --git a/cypress/plugins/index.cjs b/cypress/plugins/index.cjs deleted file mode 100644 index f7ffbe14..00000000 --- a/cypress/plugins/index.cjs +++ /dev/null @@ -1,31 +0,0 @@ -/// -// *********************************************************** -// This example plugins/index.js can be used to load plugins -// -// You can change the location of this file or turn off loading -// the plugins file with the 'pluginsFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/plugins-guide -// *********************************************************** - -// This function is called when a project is opened or re-opened (e.g. due to -// the project's config changing) - -/** - * @type {Cypress.PluginConfig} - */ -// eslint-disable-next-line no-unused-vars -import * as fs from 'fs'; - -module.exports = (on, config) => { - on('task', { - readFileMaybe(filename) { - if (fs.existsSync(filename)) { - return fs.readFileSync(filename, 'utf8'); - } - - return null; - } - }); -}; diff --git a/cypress/snapshots.js b/cypress/snapshots.js deleted file mode 100644 index f94d5e4a..00000000 --- a/cypress/snapshots.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = { - "Site Loads": { - "Check Home page load": { - "1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n \",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":true,\"autoSync\":true,\"updateDiagram\":true}" - }, - "Check Redirect from old URL": { - "1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}" - } - }, - "__version": "7.3.0", - "Auto sync tests": { - "should dim diagram when code is edited": { - "1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Test\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":false,\"updateDiagram\":false}" - }, - "should not dim diagram when code is in sync": { - "1": "{\"code\":\"graph TD\\n A[Christmas] -->|Get money| B(Go shopping)\\n B --> C{Let me think}\\n C -->|One| D[Laptop]\\n C -->|Two| E[iPhone]\\n C -->|Three| F[fa:fa-car Car]\\n C --> Testing\",\"mermaid\":\"{\\n \\\"theme\\\": \\\"default\\\"\\n}\",\"updateEditor\":false,\"autoSync\":true,\"updateDiagram\":false}" - } - } -} diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts deleted file mode 100644 index fe4e2603..00000000 --- a/cypress/support/commands.ts +++ /dev/null @@ -1,38 +0,0 @@ -// *********************************************** -// This example commands.js shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -import { register } from '@cypress/snapshot'; -// eslint-disable-next-line @typescript-eslint/no-unsafe-call -register(); -declare global { - // eslint-disable-next-line @typescript-eslint/no-namespace - namespace Cypress { - interface Chainable { - snapshot(): void; - } - } -} - -import 'cypress-localstorage-commands'; diff --git a/cypress/support/index.js b/cypress/support/index.js deleted file mode 100644 index 01ff920f..00000000 --- a/cypress/support/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands'; - -// Alternatively you can use CommonJS syntax: -// require('./commands') -const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/; -Cypress.on('uncaught:exception', (err) => { - /* returning false here prevents Cypress from failing the test */ - if (resizeObserverLoopErrRe.test(err.message)) { - return false; - } -}); diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json deleted file mode 100644 index 77501744..00000000 --- a/cypress/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "compilerOptions": { - "allowJs": true, - "types": ["cypress", "cypress-localstorage-commands"] - }, - "include": ["**/*.ts"] -} diff --git a/docs/.nojekyll b/docs/.nojekyll deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/_app/pages/edit.svelte-da6fda5c.js b/docs/_app/pages/edit.svelte-da6fda5c.js deleted file mode 100644 index 26a63519..00000000 --- a/docs/_app/pages/edit.svelte-da6fda5c.js +++ /dev/null @@ -1 +0,0 @@ -var e;import{S as t,i as a,s as n,e as s,c as i,a as r,d as o,b as l,f as c,G as h,H as d,I as u,z as f,J as m,K as g,k as p,t as v,n as $,g as w,F as b,L as x,M as E,N as y,O as k,P as I,Q as D,h as C,R as O,T,U as S,v as A,B as V,r as N,u as M,V as _,D as R,E as L,j as P,m as B,o as U,W as G,w as H,X as j,Y,Z as z,_ as J,$ as q,a0 as F,a1 as K,a2 as W,a3 as Z,C as X,a4 as Q,a5 as ee,a6 as te,l as ae,a7 as ne,a8 as se}from"../chunks/vendor-8b597521.js";import{c as ie,a as re,u as oe,g as le,V as ce,b as he,e as de,i as ue,s as fe,d as me}from"../chunks/util-b71e0722.js";import{b as ge}from"../chunks/paths-45dac81d.js";import"../chunks/preload-helper-9f12a5fd.js";function pe(e){let t;return{c(){t=s("div"),this.h()},l(e){t=i(e,"DIV",{id:!0,class:!0}),r(t).forEach(o),this.h()},h(){l(t,"id","editor"),l(t,"class","overflow-hidden")},m(a,n){c(a,t,n),e[9](t)},p:h,i:h,o:h,d(a){a&&o(t),e[9](null)}}}function ve(e,t,a){let n;d(e,ie,(e=>a(8,n=e)));var s=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(s,i){function r(e){try{l(n.next(e))}catch(t){i(t)}}function o(e){try{l(n.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,o)}l((n=n.apply(e,t||[])).next())}))};let i,r,o=null,{text:l}=t,{language:c}=t,{editorOptions:h={value:l,language:c,scrollBeyondLastLine:!1,minimap:{enabled:!1},theme:"myCoolTheme",overviewRulerLanes:0}}=t,{errorMarkers:g=[]}=t,p=l;const v=u();return f((()=>s(void 0,void 0,void 0,(function*(){var e;a(6,r=monaco),(e=r).languages.register({id:"mermaid"}),e.languages.setMonarchTokensProvider("mermaid",{typeKeywords:["graph","stateDiagram","sequenceDiagram","classDiagram","pie","erDiagram","flowchart","gantt","gitGraph","journey"],keywords:["patricipant","as"],arrows:["---","===","--\x3e","==>","->>","->"],tokenizer:{root:[[/[{}]/,"delimiter.bracket"],[/[a-z_$][\w$]*/,{cases:{"@typeKeywords":"keyword","@keywords":"keyword"}}],[/[-=>ox]+/,{cases:{"@arrows":"transition"}}],[/[[{(}]+.+?[)\]}]+/,"string"],[/".*"/,"string"]]},whitespace:[[/[ \t\r\n]+/,"white"],[/%%.*$/,"comment"]]}),e.editor.defineTheme("myCoolTheme",{base:"vs",inherit:!1,rules:[{token:"keyword",foreground:"880000",fontStyle:"bold"},{token:"custom-error",foreground:"ff0000",fontStyle:"bold"},{token:"string",foreground:"AA8500"},{token:"transition",foreground:"008800",fontStyle:"bold"},{token:"delimiter.bracket",foreground:"000000",fontStyle:"bold"}]}),e.languages.registerCompletionItemProvider("mermaid",{provideCompletionItems:()=>({suggestions:[{label:"simpleText",kind:e.languages.CompletionItemKind.Text,insertText:"simpleText"},{label:"testing",kind:e.languages.CompletionItemKind.Keyword,insertText:"testing(${1:condition})",insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet},{label:"ifelse",kind:e.languages.CompletionItemKind.Snippet,insertText:["if (${1:condition}) {","\t$0","} else {","\t","}"].join("\n"),insertTextRules:e.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"If-Else Statement"}]})}),a(5,i=r.editor.create(o,h)),i.onDidChangeModelContent((()=>{a(1,l=i.getValue()),v("update",{text:l})}));return new ResizeObserver((e=>{i.layout({height:e[0].contentRect.height,width:e[0].contentRect.width})})).observe(o.parentElement),()=>{i.dispose()}})))),e.$$set=e=>{"text"in e&&a(1,l=e.text),"language"in e&&a(2,c=e.language),"editorOptions"in e&&a(3,h=e.editorOptions),"errorMarkers"in e&&a(4,g=e.errorMarkers)},e.$$.update=()=>{100&e.$$.dirty&&(null==r||r.editor.setModelLanguage(i.getModel(),c)),498&e.$$.dirty&&(l!==p&&(n.updateEditor&&(null==i||i.setValue(l)),a(7,p=l)),null==r||r.editor.setModelMarkers(i.getModel(),"test",g))},[o,l,c,h,g,i,r,p,n,function(e){m[e?"unshift":"push"]((()=>{o=e,a(0,o)}))}]}class $e extends t{constructor(e){super(),a(this,e,ve,pe,n,{text:1,language:2,editorOptions:3,errorMarkers:4})}}function we(e,t,a){const n=e.slice();return n[1]=t[a].title,n[2]=t[a].href,n[3]=t[a].icon,n}function be(e){let t,a,n,d,u,f=e[1]+"",m=e[3]&&function(e){let t;return{c(){t=s("i"),this.h()},l(e){t=i(e,"I",{class:!0}),r(t).forEach(o),this.h()},h(){l(t,"class",e[3])},m(e,a){c(e,t,a)},p:h,d(e){e&&o(t)}}}(e);return{c(){t=s("li"),a=s("a"),m&&m.c(),n=p(),d=v(f),u=p(),this.h()},l(e){t=i(e,"LI",{});var s=r(t);a=i(s,"A",{class:!0,target:!0,href:!0});var l=r(a);m&&m.l(l),n=$(l),d=w(l,f),l.forEach(o),u=$(s),s.forEach(o),this.h()},h(){l(a,"class","nav-btn"),l(a,"target","_blank"),l(a,"href",e[2])},m(e,s){c(e,t,s),b(t,a),m&&m.m(a,null),b(a,n),b(a,d),b(t,u)},p(e,t){e[3]&&m.p(e,t)},d(e){e&&o(t),m&&m.d()}}}function xe(e){let t,a,n,d,u,f,m,y,k,I,D,C,O,T,S,A,V,N,M,_,R=e[0],L=[];for(let s=0;s{a||(a=T(t,S,{},!0)),a.run(1)})),n=!0)},o(e){a||(a=T(t,S,{},!1)),a.run(0),n=!1},d(e){e&&o(t),E(d,e),e&&a&&a.end()}}}function Ce(e){let t,a,n,h,d,u,f,m,g,x,E=e[10].title+"";function y(){return e[7](e[10])}return{c(){t=s("li"),a=s("div"),n=s("i"),d=p(),u=v(E),m=p(),this.h()},l(e){t=i(e,"LI",{class:!0});var s=r(t);a=i(s,"DIV",{class:!0});var l=r(a);n=i(l,"I",{class:!0}),r(n).forEach(o),d=$(l),u=w(l,E),l.forEach(o),m=$(s),s.forEach(o),this.h()},h(){l(n,"class",h=k(e[10].icon)+" svelte-1qkpo3v"),l(a,"class",f="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t block leading-normal "+(e[4]===e[10].id?"text-indigo-500 bg-white border-white":"text-white bg-indigo-500 border-indigo-500 hover:bg-indigo-600")),l(t,"class","mr-2 last:mr-0 w-28 h-6 flex-auto text-center")},m(e,s){c(e,t,s),b(t,a),b(a,n),b(a,d),b(a,u),b(t,m),g||(x=I(a,"click",D(y)),g=!0)},p(t,s){e=t,4&s&&h!==(h=k(e[10].icon)+" svelte-1qkpo3v")&&l(n,"class",h),4&s&&E!==(E=e[10].title+"")&&C(u,E),20&s&&f!==(f="text cursor-pointer font-semibold min-w-16 w-auto px-2 py-1 -mb-4 rounded-t block leading-normal "+(e[4]===e[10].id?"text-indigo-500 bg-white border-white":"text-white bg-indigo-500 border-indigo-500 hover:bg-indigo-600"))&&l(a,"class",f)},d(e){e&&o(t),g=!1,x()}}}function Oe(e){let t,a,n,h,d,u,f,m,g=e[1]&&Ie(e),x=e[0]&&e[2]&&De(e);return{c(){t=s("div"),a=s("span"),g&&g.c(),n=p(),h=v(e[3]),d=p(),x&&x.c(),this.h()},l(s){t=i(s,"DIV",{class:!0});var l=r(t);a=i(l,"SPAN",{class:!0});var c=r(a);g&&g.l(c),n=$(c),h=w(c,e[3]),c.forEach(o),d=$(l),x&&x.l(l),l.forEach(o),this.h()},h(){l(a,"class","text-white mr-2 font-semibold"),l(t,"class","flex cursor-default")},m(s,i){c(s,t,i),b(t,a),g&&g.m(a,null),b(a,n),b(a,h),b(t,d),x&&x.m(t,null),u=!0,f||(m=I(a,"click",D(e[6])),f=!0)},p(e,[s]){e[1]?g?g.p(e,s):(g=Ie(e),g.c(),g.m(a,n)):g&&(g.d(1),g=null),(!u||8&s)&&C(h,e[3]),e[0]&&e[2]?x?(x.p(e,s),5&s&&A(x,1)):(x=De(e),x.c(),A(x,1),x.m(t,null)):x&&(V(),N(x,1,1,(()=>{x=null})),M())},i(e){u||(A(x),u=!0)},o(e){N(x),u=!1},d(e){e&&o(t),g&&g.d(),x&&x.d(),f=!1,m()}}}function Te(e,t,a){var n;let{isCloseable:s=!0}=t,{tabs:i=[]}=t,{title:r}=t,{isOpen:o=!1}=t,l=null===(n=i[0])||void 0===n?void 0:n.id;const c=u(),h=e=>{a(4,l=e.id),c("select",e)};return e.$$set=e=>{"isCloseable"in e&&a(1,s=e.isCloseable),"tabs"in e&&a(2,i=e.tabs),"title"in e&&a(3,r=e.title),"isOpen"in e&&a(0,o=e.isOpen)},[o,s,i,r,l,h,()=>a(0,o=!o),e=>h(e)]}class Se extends t{constructor(e){super(),a(this,e,Te,Oe,n,{isCloseable:1,tabs:2,title:3,isOpen:0})}}const Ae=e=>({}),Ve=e=>({});function Ne(e){let t,a,n;const h=e[5].default,d=R(h,e,e[4],null);return{c(){t=s("div"),d&&d.c(),this.h()},l(e){t=i(e,"DIV",{class:!0});var a=r(t);d&&d.l(a),a.forEach(o),this.h()},h(){l(t,"class","flex-grow overflow-auto")},m(e,a){c(e,t,a),d&&d.m(t,null),n=!0},p(e,t){d&&d.p&&(!n||16&t)&&L(d,h,e,e[4],t,null,null)},i(e){n||(A(d,e),O((()=>{a||(a=T(t,j,{},!0)),a.run(1)})),n=!0)},o(e){N(d,e),a||(a=T(t,j,{},!1)),a.run(0),n=!1},d(e){e&&o(t),d&&d.d(e),e&&a&&a.end()}}}function Me(e){let t,a,n,h,d,u,f,g,v,w,x;function E(t){e[6](t)}let y={tabs:e[2],title:e[3],isCloseable:e[1]};void 0!==e[0]&&(y.isOpen=e[0]),h=new Se({props:y}),m.push((()=>_(h,"isOpen",E))),h.$on("select",e[7]);const k=e[5].actions,D=R(k,e,e[4],Ve);let C=e[0]&&Ne(e);return{c(){t=s("div"),a=s("div"),n=s("div"),P(h.$$.fragment),u=p(),f=s("div"),D&&D.c(),g=p(),C&&C.c(),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=r(t);a=i(s,"DIV",{class:!0});var l=r(a);n=i(l,"DIV",{class:!0});var c=r(n);B(h.$$.fragment,c),u=$(c),f=i(c,"DIV",{class:!0});var d=r(f);D&&D.l(d),d.forEach(o),c.forEach(o),l.forEach(o),g=$(s),C&&C.l(s),s.forEach(o),this.h()},h(){l(f,"class","flex gap-x-4 items-center text-white"),l(n,"class","flex justify-between"),l(a,"class","bg-indigo-400 border-gray-400 p-2 flex-none"),l(t,"class","bg-white rounded overflow-hidden shadow m-2 flex-grow flex flex-col")},m(s,i){c(s,t,i),b(t,a),b(a,n),U(h,n,null),b(n,u),b(n,f),D&&D.m(f,null),b(t,g),C&&C.m(t,null),v=!0,w||(x=I(a,"click",e[8]),w=!0)},p(e,[a]){const n={};4&a&&(n.tabs=e[2]),8&a&&(n.title=e[3]),2&a&&(n.isCloseable=e[1]),!d&&1&a&&(d=!0,n.isOpen=e[0],G((()=>d=!1))),h.$set(n),D&&D.p&&(!v||16&a)&&L(D,k,e,e[4],a,Ae,Ve),e[0]?C?(C.p(e,a),1&a&&A(C,1)):(C=Ne(e),C.c(),A(C,1),C.m(t,null)):C&&(V(),N(C,1,1,(()=>{C=null})),M())},i(e){v||(A(h.$$.fragment,e),A(D,e),A(C),v=!0)},o(e){N(h.$$.fragment,e),N(D,e),N(C),v=!1},d(e){e&&o(t),H(h),D&&D.d(e),C&&C.d(),w=!1,x()}}}function _e(e,t,a){let{$$slots:n={},$$scope:s}=t,{isCloseable:i=!0}=t,{isOpen:r=!0}=t,{tabs:o=[]}=t,{title:l}=t;return e.$$set=e=>{"isCloseable"in e&&a(1,i=e.isCloseable),"isOpen"in e&&a(0,r=e.isOpen),"tabs"in e&&a(2,o=e.tabs),"title"in e&&a(3,l=e.title),"$$scope"in e&&a(4,s=e.$$scope)},e.$$.update=()=>{3&e.$$.dirty&&a(0,r=!i||r)},[r,i,o,l,s,n,function(e){r=e,a(0,r),a(1,i)},function(t){Y(e,t)},()=>a(0,r=!r)]}class Re extends t{constructor(e){super(),a(this,e,_e,Me,n,{isCloseable:1,isOpen:0,tabs:2,title:3})}}function Le(e,t,a){const n=e.slice();return n[3]=t[a],n}function Pe(e){let t,a,n,h,d=e[3]+"";function u(){return e[2](e[3])}return{c(){t=s("button"),a=v(d),this.h()},l(e){t=i(e,"BUTTON",{class:!0});var n=r(t);a=w(n,d),n.forEach(o),this.h()},h(){l(t,"class","action-btn")},m(e,s){c(e,t,s),b(t,a),n||(h=I(t,"click",u),n=!0)},p(t,a){e=t},d(e){e&&o(t),n=!1,h()}}}function Be(e){let t,a=Object.keys(e[0]),n=[];for(let s=0;s>+John: Hello John, how are you?\n Alice->>+John: John, can you hear me?\n John--\x3e>-Alice: Hi Alice, I can hear you!\n John--\x3e>-Alice: I feel great!\n ","Class Diagram":"classDiagram\n Animal <|-- Duck\n Animal <|-- Fish\n Animal <|-- Zebra\n Animal : +int age\n Animal : +String gender\n Animal: +isMammal()\n Animal: +mate()\n class Duck{\n +String beakColor\n +swim()\n +quack()\n }\n class Fish{\n -int sizeInFeet\n -canEat()\n }\n class Zebra{\n +bool is_wild\n +run()\n }\n ","State Diagram":"stateDiagram-v2\n [*] --\x3e Still\n Still --\x3e [*]\n Still --\x3e Moving\n Moving --\x3e Still\n Moving --\x3e Crash\n Crash --\x3e [*]\n ","Gantt Chart":"gantt\n title A Gantt Diagram\n dateFormat YYYY-MM-DD\n section Section\n A task :a1, 2014-01-01, 30d\n Another task :after a1 , 20d\n section Another\n Task in sec :2014-01-12 , 12d\n another task : 24d\n ","Pie Chart":'pie title Pets adopted by volunteers\n "Dogs" : 386\n "Cats" : 85\n "Rats" : 15\n ',"ER Diagram":'erDiagram\n CUSTOMER }|..|{ DELIVERY-ADDRESS : has\n CUSTOMER ||--o{ ORDER : places\n CUSTOMER ||--o{ INVOICE : "liable for"\n DELIVERY-ADDRESS ||--o{ ORDER : receives\n INVOICE ||--|{ ORDER : covers\n ORDER ||--|{ ORDER-ITEM : includes\n PRODUCT-CATEGORY ||--|{ PRODUCT : contains\n PRODUCT ||--o{ ORDER-ITEM : "ordered in"\n ',"Git Graph":'gitGraph:\noptions\n{\n "nodeSpacing": 150,\n "nodeRadius": 10\n}\nend\ncommit\nbranch newbranch\ncheckout newbranch\ncommit\ncommit\ncheckout master\ncommit\ncommit\nmerge newbranch\n\n ',"User Journey":" journey\n title My working day\n section Go to work\n Make tea: 5: Me\n Go upstairs: 3: Me\n Do work: 1: Me, Cat\n section Go home\n Go downstairs: 5: Me\n Sit down: 3: Me\n "},a=e=>{oe(t[e],!0,!0)};return[t,a,e=>a(e)]}class He extends t{constructor(e){super(),a(this,e,Ge,Ue,n,{})}}function je(e){let t,a,n;return{c(){t=s("input"),this.h()},l(e){t=i(e,"INPUT",{id:!0,type:!0,min:!0,max:!0}),this.h()},h(){l(t,"id","height"),l(t,"type","number"),l(t,"min","3"),l(t,"max","10000")},m(s,i){c(s,t,i),J(t,e[4]),a||(n=I(t,"input",e[14]),a=!0)},p(e,a){16&a&&q(t.value)!==e[4]&&J(t,e[4])},d(e){e&&o(t),a=!1,n()}}}function Ye(e){let t,a,n,d,u,f,m,g,x,E,y,k,D,C,O,T,S,A,V,N,M,_,R,L,P,B,U,G,H,j,Y,z,J,q,K,W,Z,X,Q,ee,te,ae,ne,se,ie,re=e[5](),oe=re&&function(e){let t,a,n,d,u;return{c(){t=s("button"),a=s("i"),n=v(" Copy Image to clipboard"),this.h()},l(e){t=i(e,"BUTTON",{class:!0});var s=r(t);a=i(s,"I",{class:!0}),r(a).forEach(o),n=w(s," Copy Image to clipboard"),s.forEach(o),this.h()},h(){l(a,"class","far fa-copy"),l(t,"class","action-btn w-full")},m(s,i){c(s,t,i),b(t,a),b(t,n),d||(u=I(t,"click",e[6]),d=!0)},p:h,d(e){e&&o(t),d=!1,u()}}}(e),le="auto"!==e[3]&&je(e);return{c(){t=s("div"),oe&&oe.c(),a=p(),n=s("button"),d=s("i"),u=v(" PNG"),f=p(),m=s("button"),g=s("i"),x=v(" SVG"),E=p(),y=s("button"),k=s("a"),D=s("i"),C=v(" PNG"),O=p(),T=s("button"),S=s("a"),A=s("i"),V=v(" SVG"),N=p(),M=s("div"),_=v("PNG size\n\t\t\t"),R=s("input"),L=p(),P=s("label"),B=v("Auto"),U=p(),G=s("input"),H=p(),j=s("label"),Y=v("Width"),z=p(),J=s("input"),q=p(),K=s("label"),W=v("Height"),Z=p(),le&&le.c(),X=p(),Q=s("div"),ee=s("label"),te=v("Copy Markdown"),ae=p(),ne=s("input"),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=r(t);oe&&oe.l(s),a=$(s),n=i(s,"BUTTON",{class:!0});var l=r(n);d=i(l,"I",{class:!0}),r(d).forEach(o),u=w(l," PNG"),l.forEach(o),f=$(s),m=i(s,"BUTTON",{class:!0});var c=r(m);g=i(c,"I",{class:!0}),r(g).forEach(o),x=w(c," SVG"),c.forEach(o),E=$(s),y=i(s,"BUTTON",{class:!0});var h=r(y);k=i(h,"A",{target:!0,href:!0});var p=r(k);D=i(p,"I",{class:!0}),r(D).forEach(o),C=w(p," PNG"),p.forEach(o),h.forEach(o),O=$(s),T=i(s,"BUTTON",{class:!0});var v=r(T);S=i(v,"A",{target:!0,href:!0});var b=r(S);A=i(b,"I",{class:!0}),r(A).forEach(o),V=w(b," SVG"),b.forEach(o),v.forEach(o),N=$(s),M=i(s,"DIV",{class:!0});var I=r(M);_=w(I,"PNG size\n\t\t\t"),R=i(I,"INPUT",{type:!0,value:!0,id:!0}),L=$(I),P=i(I,"LABEL",{for:!0});var F=r(P);B=w(F,"Auto"),F.forEach(o),U=$(I),G=i(I,"INPUT",{type:!0,value:!0,id:!0}),H=$(I),j=i(I,"LABEL",{for:!0});var se=r(j);Y=w(se,"Width"),se.forEach(o),z=$(I),J=i(I,"INPUT",{type:!0,value:!0,id:!0}),q=$(I),K=i(I,"LABEL",{for:!0});var ie=r(K);W=w(ie,"Height"),ie.forEach(o),Z=$(I),le&&le.l(I),I.forEach(o),X=$(s),Q=i(s,"DIV",{class:!0});var re=r(Q);ee=i(re,"LABEL",{for:!0});var ce=r(ee);te=w(ce,"Copy Markdown"),ce.forEach(o),ae=$(re),ne=i(re,"INPUT",{class:!0,id:!0,type:!0,value:!0}),re.forEach(o),s.forEach(o),this.h()},h(){l(d,"class","fas fa-download"),l(n,"class","action-btn flex-auto"),l(g,"class","fas fa-download"),l(m,"class","action-btn flex-auto"),l(D,"class","fas fa-external-link-alt"),l(k,"target","_blank"),l(k,"href",e[0]),l(y,"class","action-btn flex-auto"),l(A,"class","fas fa-external-link-alt"),l(S,"target","_blank"),l(S,"href",e[1]),l(T,"class","action-btn flex-auto"),l(R,"type","radio"),R.__value="auto",R.value=R.__value,l(R,"id","autosize"),e[11][0].push(R),l(P,"for","autosize"),l(G,"type","radio"),G.__value="width",G.value=G.__value,l(G,"id","width-active"),e[11][0].push(G),l(j,"for","width"),l(J,"type","radio"),J.__value="height",J.value=J.__value,l(J,"id","height-active"),e[11][0].push(J),l(K,"for","height"),l(M,"class","flex gap-2 items-center"),l(ee,"for","markdown"),l(ne,"class","flex-1"),l(ne,"id","markdown"),l(ne,"type","text"),ne.value=e[2],l(Q,"class","w-full flex gap-2 items-center"),l(t,"class","flex flex-wrap gap-2 m-2")},m(s,i){c(s,t,i),oe&&oe.m(t,null),b(t,a),b(t,n),b(n,d),b(n,u),b(t,f),b(t,m),b(m,g),b(m,x),b(t,E),b(t,y),b(y,k),b(k,D),b(k,C),b(t,O),b(t,T),b(T,S),b(S,A),b(S,V),b(t,N),b(t,M),b(M,_),b(M,R),R.checked=R.__value===e[3],b(M,L),b(M,P),b(P,B),b(M,U),b(M,G),G.checked=G.__value===e[3],b(M,H),b(M,j),b(j,Y),b(M,z),b(M,J),J.checked=J.__value===e[3],b(M,q),b(M,K),b(K,W),b(M,Z),le&&le.m(M,null),b(t,X),b(t,Q),b(Q,ee),b(ee,te),b(Q,ae),b(Q,ne),se||(ie=[I(n,"click",e[7]),I(m,"click",e[8]),I(R,"change",e[10]),I(G,"change",e[12]),I(J,"change",e[13]),I(ne,"click",e[9])],se=!0)},p(e,t){re&&oe.p(e,t),1&t&&l(k,"href",e[0]),2&t&&l(S,"href",e[1]),8&t&&(R.checked=R.__value===e[3]),8&t&&(G.checked=G.__value===e[3]),8&t&&(J.checked=J.__value===e[3]),"auto"!==e[3]?le?le.p(e,t):(le=je(e),le.c(),le.m(M,null)):le&&(le.d(1),le=null),4&t&&ne.value!==e[2]&&(ne.value=e[2])},d(a){a&&o(t),oe&&oe.d(),e[11][0].splice(e[11][0].indexOf(R),1),e[11][0].splice(e[11][0].indexOf(G),1),e[11][0].splice(e[11][0].indexOf(J),1),le&&le.d(),se=!1,F(ie)}}}function ze(e){let t,a;return t=new Re({props:{title:"Actions",isOpen:!1,$$slots:{default:[Ye]},$$scope:{ctx:e}}}),{c(){P(t.$$.fragment)},l(e){B(t.$$.fragment,e)},m(e,n){U(t,e,n),a=!0},p(e,[a]){const n={};1048607&a&&(n.$$scope={dirty:a,ctx:e}),t.$set(n)},i(e){a||(A(t.$$.fragment,e),a=!0)},o(e){N(t.$$.fragment,e),a=!1},d(e){H(t,e)}}}function Je(e,t,a){const n=(e,t,a)=>{null==e||e.setAttribute("height",`${a}px`),null==e||e.setAttribute("width",`${t}px`),e||(e=document.querySelector("#container svg"));const n=e.outerHTML.replaceAll("
","
");return z(n)},s=(e,t)=>{const a=document.createElement("canvas"),s=document.querySelector("#container svg"),i=s.getBoundingClientRect();if(a.width=i.width,a.height=i.height,"width"===d){const e=i.height/i.width;a.width=u,a.height=u*e}else if("height"===d){const e=i.width/i.height;a.width=u*e,a.height=u}const r=a.getContext("2d");r.fillStyle="white",r.fillRect(0,0,a.width,a.height);const o=new Image;o.onload=t(r,o),o.src=`data:image/svg+xml;base64,${n(s,a.width,a.height)}`,e.stopPropagation(),e.preventDefault()},i=(e,t)=>{const a=document.createElement("a");a.download=e,a.href=t,a.click(),a.remove()},r=(e,t)=>()=>{const{canvas:a}=e;e.drawImage(t,0,0,a.width,a.height),i(`mermaid-diagram-${K().format("YYYYMMDDHHmmss")}.png`,a.toDataURL("image/png").replace("image/png","image/octet-stream"))},o=(e,t)=>()=>{const{canvas:a}=e;e.drawImage(t,0,0,a.width,a.height),a.toBlob((e=>{try{navigator.clipboard.write([new ClipboardItem({[e.type]:e})])}catch(t){console.error(t)}}))};let l,c,h,d="auto",u=1080;ie.subscribe((e=>{const t=JSON.parse(JSON.stringify(e));"string"==typeof t.mermaid&&(t.mermaid=JSON.parse(t.mermaid));const n=z(JSON.stringify(t),!0);a(0,l=`https://mermaid.ink/img/${n}`),a(1,c=`https://mermaid.ink/svg/${n}`),a(2,h=`[![](${l})](${window.location.protocol}//${window.location.host}${window.location.pathname}#${window.location.hash})`)}));return[l,c,h,d,u,()=>Object.prototype.hasOwnProperty.call(window,"ClipboardItem"),e=>{s(e,o)},e=>{s(e,r)},()=>{i(`mermaid-diagram-${K().format("YYYYMMDDHHmmss")}.svg`,`data:image/svg+xml;base64,${n()}`)},e=>{e.target.select(),document.execCommand("Copy")},function(){d=this.__value,a(3,d)},[[]],function(){d=this.__value,a(3,d)},function(){d=this.__value,a(3,d)},function(){u=q(this.value),a(4,u)}]}class qe extends t{constructor(e){super(),a(this,e,Je,ze,n,{})}}const Fe=W(X(!0),Z(),"autoHistoryMode"),Ke=W(X([]),Z(),"autoHistoryStore"),We=W(X([]),Z(),"manualHistoryStore"),Ze=Q([Fe,Ke,We],(([e,t,a],n)=>{n(e?t:a)}));function Xe(e,t,a){const n=e.slice();return n[14]=t[a].state,n[15]=t[a].time,n[16]=t[a].name,n}function Qe(e){let t,a,n,d,u,f;return{c(){t=s("div"),a=v("No items in History"),n=s("br"),d=v("\n\t\t\t\tClick the Save button to save current state and restore it later."),u=s("br"),f=v("\n\t\t\t\tTimeline will automatically be saved every minute."),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=r(t);a=w(s,"No items in History"),n=i(s,"BR",{}),d=w(s,"\n\t\t\t\tClick the Save button to save current state and restore it later."),u=i(s,"BR",{}),f=w(s,"\n\t\t\t\tTimeline will automatically be saved every minute."),s.forEach(o),this.h()},h(){l(t,"class","m-2 text-gray-600")},m(e,s){c(e,t,s),b(t,a),b(t,n),b(t,d),b(t,u),b(t,f)},p:h,d(e){e&&o(t)}}}function et(e){let t,a=e[1],n=[];for(let s=0;s0?et:Qe}let n=a(e),h=n(e);return{c(){t=s("ul"),h.c(),this.h()},l(e){t=i(e,"UL",{class:!0,id:!0});var a=r(t);h.l(a),a.forEach(o),this.h()},h(){l(t,"class","p-2 space-y-2 overflow-auto h-56"),l(t,"id","historyList")},m(e,a){c(e,t,a),h.m(t,null)},p(e,s){n===(n=a(e))&&h?h.p(e,s):(h.d(1),h=n(e),h&&(h.c(),h.m(t,null)))},d(e){e&&o(t),h.d()}}}function nt(e){let t,a,n,d,u,f,m,g;return{c(){t=s("div"),a=s("button"),n=s("i"),d=p(),u=s("button"),f=s("i"),this.h()},l(e){t=i(e,"DIV",{slot:!0});var s=r(t);a=i(s,"BUTTON",{id:!0,class:!0,title:!0});var l=r(a);n=i(l,"I",{class:!0}),r(n).forEach(o),l.forEach(o),d=$(s),u=i(s,"BUTTON",{id:!0,class:!0,title:!0});var c=r(u);f=i(c,"I",{class:!0}),r(f).forEach(o),c.forEach(o),s.forEach(o),this.h()},h(){l(n,"class","far fa-save"),l(a,"id","saveHistory"),l(a,"class","btn"),l(a,"title","Save current state"),l(f,"class","fas fa-trash-alt"),l(u,"id","clearHistory"),l(u,"class","btn text-red-400"),l(u,"title","Delete all saved states"),l(t,"slot","actions")},m(s,i){c(s,t,i),b(t,a),b(a,n),b(t,d),b(t,u),b(u,f),m||(g=[I(a,"click",D(e[8])),I(u,"click",D(e[9]))],m=!0)},p:h,d(e){e&&o(t),m=!1,F(g)}}}function st(e){let t,a,n;function s(t){e[12](t)}let i={tabs:e[3],title:"History",$$slots:{actions:[nt],default:[at]},$$scope:{ctx:e}};return void 0!==e[0]&&(i.isOpen=e[0]),t=new Re({props:i}),m.push((()=>_(t,"isOpen",s))),t.$on("select",e[2]),{c(){P(t.$$.fragment)},l(e){B(t.$$.fragment,e)},m(e,a){U(t,e,a),n=!0},p(e,[n]){const s={};524290&n&&(s.$$scope={dirty:n,ctx:e}),!a&&1&n&&(a=!0,s.isOpen=e[0],G((()=>a=!1))),t.$set(s)},i(e){n||(A(t.$$.fragment,e),n=!0)},o(e){N(t.$$.fragment,e),n=!1},d(e){H(t,e)}}}function it(e,t,a){let n,s;d(e,ie,(e=>a(13,n=e))),d(e,Ze,(e=>a(1,s=e)));const i=(e=!1)=>{const t=le();var a;(e=>{const t=te(e?Ke:We);return t.length>0?JSON.stringify(t[0].state):""})(e)!==t?((a={state:n,time:Date.now(),auto:e}).name=ee(2),a.auto?Ke.update((e=>(30===e.length&&e.pop(),[a,...e]))):We.update((e=>[a,...e]))):e||alert("State already saved.")},r=e=>{var t;(e||confirm("Clear all saved items?"))&&(t=e,(te(Fe)?Ke:We).update((e=>e.filter((e=>t&&e.time!=t)))))},o=e=>{ie.set(Object.assign(Object.assign({},e),{updateEditor:!0,updateDiagram:!0}))};f((()=>{Fe.set(!1),setInterval((()=>{i(!0)}),6e4)}));let l=!0;return[l,s,e=>{Fe.set("timeline"===e.detail.id)},[{id:"saved",title:"Saved",icon:"far fa-bookmark"},{id:"timeline",title:"Timeline",icon:"fas fa-history"}],i,r,o,e=>{const t=new Date(e);return`${new Date(t).toLocaleString()} (${K(t).fromNow()})`},()=>i(),()=>r(),e=>o(e),e=>r(e),function(e){l=e,a(0,l)}]}class rt extends t{constructor(e){super(),a(this,e,it,st,n,{})}}function ot(e){let t,a,n;function s(t){e[10](t)}let i={language:e[2],errorMarkers:e[3]};return void 0!==e[1]&&(i.text=e[1]),t=new $e({props:i}),m.push((()=>_(t,"text",s))),t.$on("update",e[6]),{c(){P(t.$$.fragment)},l(e){B(t.$$.fragment,e)},m(e,a){U(t,e,a),n=!0},p(e,n){const s={};4&n&&(s.language=e[2]),8&n&&(s.errorMarkers=e[3]),!a&&2&n&&(a=!0,s.text=e[1],G((()=>a=!1))),t.$set(s)},i(e){n||(A(t.$$.fragment,e),n=!0)},o(e){N(t.$$.fragment,e),n=!1},d(e){H(t,e)}}}function lt(e){let t,a,n,d;return{c(){t=s("button"),a=s("i"),this.h()},l(e){t=i(e,"BUTTON",{class:!0,title:!0,"data-cy":!0});var n=r(t);a=i(n,"I",{class:!0}),r(a).forEach(o),n.forEach(o),this.h()},h(){l(a,"class","fas fa-sync"),l(t,"class","bg-indigo-500 hover:bg-indigo-700 rounded px-4 mx-2"),l(t,"title","Sync Diagram"),l(t,"data-cy","sync")},m(e,s){c(e,t,s),b(t,a),n||(d=I(t,"click",fe),n=!0)},p:h,d(e){e&&o(t),n=!1,d()}}}function ct(e){let t,a,n,h,d,u,f,m=!e[0].autoSync&<();return{c(){t=s("div"),m&&m.c(),a=p(),n=s("label"),h=s("input"),d=v("\n\t\t\t\t\t\tAuto sync"),this.h()},l(e){t=i(e,"DIV",{slot:!0});var s=r(t);m&&m.l(s),a=$(s),n=i(s,"LABEL",{for:!0,style:!0});var l=r(n);h=i(l,"INPUT",{type:!0,id:!0}),d=w(l,"\n\t\t\t\t\t\tAuto sync"),l.forEach(o),s.forEach(o),this.h()},h(){l(h,"type","checkbox"),l(h,"id","autoSync"),l(n,"for","autoSync"),ne(n,"white-space","nowrap"),ne(n,"overflow","hidden"),ne(n,"text-overflow","ellipsis"),l(t,"slot","actions")},m(s,i){c(s,t,i),m&&m.m(t,null),b(t,a),b(t,n),b(n,h),h.checked=e[0].autoSync,b(n,d),u||(f=I(h,"change",e[9]),u=!0)},p(e,n){e[0].autoSync?m&&(m.d(1),m=null):m?m.p(e,n):(m=lt(),m.c(),m.m(t,a)),1&n&&(h.checked=e[0].autoSync)},d(e){e&&o(t),m&&m.d(),u=!1,f()}}}function ht(e){let t,a,n;return a=new ce({}),{c(){t=s("div"),P(a.$$.fragment),this.h()},l(e){t=i(e,"DIV",{class:!0});var n=r(t);B(a.$$.fragment,n),n.forEach(o),this.h()},h(){l(t,"class","flex-1 overflow-auto")},m(e,s){c(e,t,s),U(a,t,null),n=!0},i(e){n||(A(a.$$.fragment,e),n=!0)},o(e){N(a.$$.fragment,e),n=!1},d(e){e&&o(t),H(a)}}}function dt(e){let t,a,n,d,u;return{c(){t=s("button"),a=s("i"),n=v(" View"),this.h()},l(e){t=i(e,"BUTTON",{slot:!0,class:!0,title:!0});var s=r(t);a=i(s,"I",{class:!0}),r(a).forEach(o),n=w(s," View"),s.forEach(o),this.h()},h(){l(a,"class","far fa-eye"),l(t,"slot","actions"),l(t,"class","btn"),l(t,"title","View diagram in new page")},m(s,i){c(s,t,i),b(t,a),b(t,n),d||(u=I(t,"click",D(e[11])),d=!0)},p:h,d(e){e&&o(t),d=!1,u()}}}function ut(e){let t,a,n,h,d,u,f,m,g,x,E,y,k,I,D,C,O,T,S,V,M,_;return a=new ye({}),u=new Re({props:{tabs:e[5],isCloseable:!1,title:"Mermaid",$$slots:{actions:[ct],default:[ot]},$$scope:{ctx:e}}}),u.$on("select",e[4]),g=new He({}),E=new rt({}),k=new qe({}),T=new Re({props:{title:"Diagram",isCloseable:!1,$$slots:{actions:[dt],default:[ht]},$$scope:{ctx:e}}}),{c(){t=s("div"),P(a.$$.fragment),n=p(),h=s("div"),d=s("div"),P(u.$$.fragment),f=p(),m=s("div"),P(g.$$.fragment),x=p(),P(E.$$.fragment),y=p(),P(k.$$.fragment),I=p(),D=s("div"),C=p(),O=s("div"),P(T.$$.fragment),S=p(),V=s("div"),M=v("Code editing not supported on mobile. Please use a desktop browser."),this.h()},l(e){t=i(e,"DIV",{class:!0});var s=r(t);B(a.$$.fragment,s),n=$(s),h=i(s,"DIV",{class:!0});var l=r(h);d=i(l,"DIV",{class:!0,id:!0,style:!0});var c=r(d);B(u.$$.fragment,c),f=$(c),m=i(c,"DIV",{class:!0});var p=r(m);B(g.$$.fragment,p),x=$(p),B(E.$$.fragment,p),y=$(p),B(k.$$.fragment,p),p.forEach(o),c.forEach(o),I=$(l),D=i(l,"DIV",{id:!0,class:!0}),r(D).forEach(o),C=$(l),O=i(l,"DIV",{class:!0});var v=r(O);B(T.$$.fragment,v),S=$(v),V=i(v,"DIV",{class:!0});var b=r(V);M=w(b,"Code editing not supported on mobile. Please use a desktop browser."),b.forEach(o),v.forEach(o),l.forEach(o),s.forEach(o),this.h()},h(){l(m,"class","-mt-2"),l(d,"class","hidden md:flex flex-col"),l(d,"id","editorPane"),ne(d,"width","40%"),l(D,"id","resizeHandler"),l(D,"class","svelte-ub8fux"),l(V,"class","md:hidden bg-white rounded shadow p-2 mx-2"),l(O,"class","flex-1 flex flex-col overflow-hidden"),l(h,"class","flex-1 flex overflow-hidden"),l(t,"class","h-full flex flex-col overflow-hidden bg-gray-100")},m(e,s){c(e,t,s),U(a,t,null),b(t,n),b(t,h),b(h,d),U(u,d,null),b(d,f),b(d,m),U(g,m,null),b(m,x),U(E,m,null),b(m,y),U(k,m,null),b(h,I),b(h,D),b(h,C),b(h,O),U(T,O,null),b(O,S),b(O,V),b(V,M),_=!0},p(e,[t]){const a={};262159&t&&(a.$$scope={dirty:t,ctx:e}),u.$set(a);const n={};262144&t&&(n.$$scope={dirty:t,ctx:e}),T.$set(n)},i(e){_||(A(a.$$.fragment,e),A(u.$$.fragment,e),A(g.$$.fragment,e),A(E.$$.fragment,e),A(k.$$.fragment,e),A(T.$$.fragment,e),_=!0)},o(e){N(a.$$.fragment,e),N(u.$$.fragment,e),N(g.$$.fragment,e),N(E.$$.fragment,e),N(k.$$.fragment,e),N(T.$$.fragment,e),_=!1},d(e){e&&o(t),H(a),H(u),H(g),H(E),H(k),H(T)}}}function ft(e,t,a){let n,s;d(e,ie,(e=>a(0,n=e))),d(e,he,(e=>a(12,s=e)));var i=this&&this.__awaiter||function(e,t,a,n){return new(a||(a=Promise))((function(s,i){function r(e){try{l(n.next(e))}catch(t){i(t)}}function o(e){try{l(n.throw(e))}catch(t){i(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(r,o)}l((n=n.apply(e,t||[])).next())}))};const r=window.mermaid;let o="code";const l={code:"mermaid",config:"json"};let c="",h="mermaid",u=[];ie.subscribe((e=>{e.updateEditor&&a(1,c="code"===o?e.code:e.mermaid)}));const m=()=>{window.open(`${ge}/view#${s}`,"_blank").focus()};f((()=>i(void 0,void 0,void 0,(function*(){yield ue();const e=document.getElementById("resizeHandler"),t=document.getElementById("editorPane"),a=e=>{const a=e.pageX-t.getBoundingClientRect().left;a>50&&(t.style.width=`${a}px`)},n=()=>{window.removeEventListener("mousemove",a)};e.addEventListener("mousedown",(e=>{e.preventDefault(),window.addEventListener("mousemove",a),window.addEventListener("mouseup",n)}))}))));return e.$$.update=()=>{256&e.$$.dirty&&a(2,h=l[o]),257&e.$$.dirty&&a(1,c="code"===o?n.code:n.mermaid)},[n,c,h,u,e=>{se(ie,n.updateEditor=!0,n),a(8,o=e.detail.id)},[{id:"code",title:"Code",icon:"fas fa-code"},{id:"config",title:"Config",icon:"fas fa-cogs"}],e=>{try{"code"===o?(n=e.detail.text,r.parse(n),oe(n,!1)):(t=e.detail.text,JSON.parse(t),me(t,!1)),de.set(void 0),a(3,u=[])}catch(s){if(de.set(s),s.hash){const e={severity:8,startLineNumber:s.hash.loc.first_line,startColumn:s.hash.loc.first_column,endLineNumber:s.hash.loc.last_line,endColumn:s.hash.loc.last_column+1,message:s.str};u.push(e),a(3,u=u.filter((t=>t.startLineNumber>=e.startLineNumber&&t.startColumn>=e.startColumn)))}console.error(s)}var t,n},m,o,function(){n.autoSync=this.checked,ie.set(n)},function(e){c=e,a(1,c),a(8,o),a(0,n)},()=>m()]}export default class extends t{constructor(e){super(),a(this,e,ft,ut,n,{})}} diff --git a/docs/view/index.html b/edit/index.html similarity index 97% rename from docs/view/index.html rename to edit/index.html index 18885ade..8cc9cb02 100644 --- a/docs/view/index.html +++ b/edit/index.html @@ -59,7 +59,7 @@ - + @@ -67,7 +67,7 @@ - - - - - - - %svelte.head% - - -
%svelte.body%
- - diff --git a/src/app.postcss b/src/app.postcss deleted file mode 100644 index ce6711bb..00000000 --- a/src/app.postcss +++ /dev/null @@ -1,14 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; - -.nav-btn { - @apply lg:p-2 py-3 px-0 block border-b-2 border-transparent hover:border-white; -} - -.btn { - @apply bg-indigo-500 hover:bg-indigo-700 rounded px-4 shadow; -} -.action-btn { - @apply rounded p-2 bg-indigo-400 shadow flex-auto text-white hover:bg-indigo-500; -} diff --git a/src/global.d.ts b/src/global.d.ts deleted file mode 100644 index 63908c66..00000000 --- a/src/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/src/lib/components/actions.svelte b/src/lib/components/actions.svelte deleted file mode 100644 index a119c4d5..00000000 --- a/src/lib/components/actions.svelte +++ /dev/null @@ -1,167 +0,0 @@ - - - -
- {#if isClipboardAvailable()} - - {/if} - - - - - -
- PNG size - - - - - - - {#if imagemodeselected !== 'auto'} - - {/if} -
- -
- - -
-
-
diff --git a/src/lib/components/card/card.svelte b/src/lib/components/card/card.svelte deleted file mode 100644 index 91e80024..00000000 --- a/src/lib/components/card/card.svelte +++ /dev/null @@ -1,26 +0,0 @@ - - -
-
(isOpen = !isOpen)}> -
- -
- -
-
-
- {#if isOpen} -
- -
- {/if} -
diff --git a/src/lib/components/card/tabs.svelte b/src/lib/components/card/tabs.svelte deleted file mode 100644 index fc11b338..00000000 --- a/src/lib/components/card/tabs.svelte +++ /dev/null @@ -1,51 +0,0 @@ - - -
- (isOpen = !isOpen)}> - {#if isCloseable} - - {/if} - {title} - {#if isOpen && tabs} -
    - {#each tabs as tab} -
  • -
    toggleTabs(tab)}> - - {tab.title} -
    -
  • - {/each} -
- {/if} -
- - diff --git a/src/lib/components/editor/editor.svelte b/src/lib/components/editor/editor.svelte deleted file mode 100644 index 3b562c27..00000000 --- a/src/lib/components/editor/editor.svelte +++ /dev/null @@ -1,76 +0,0 @@ - - -
diff --git a/src/lib/components/editor/util.ts b/src/lib/components/editor/util.ts deleted file mode 100644 index 6fcfbde9..00000000 --- a/src/lib/components/editor/util.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ -/* eslint-disable @typescript-eslint/no-unsafe-call */ -/* eslint-disable @typescript-eslint/no-unsafe-member-access */ -// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types -export const initEditor = (monacoEditor): void => { - monacoEditor.languages.register({ id: 'mermaid' }); - - // Register a tokens provider for the language - monacoEditor.languages.setMonarchTokensProvider('mermaid', { - typeKeywords: [ - 'graph', - 'stateDiagram', - 'sequenceDiagram', - 'classDiagram', - 'pie', - 'erDiagram', - 'flowchart', - 'gantt', - 'gitGraph', - 'journey' - ], - keywords: ['patricipant', 'as'], - arrows: ['---', '===', '-->', '==>', '->>', '->'], - tokenizer: { - root: [ - [/[{}]/, 'delimiter.bracket'], - [/[a-z_$][\w$]*/, { cases: { '@typeKeywords': 'keyword', '@keywords': 'keyword' } }], - [/[-=>ox]+/, { cases: { '@arrows': 'transition' } }], - [/[[{(}]+.+?[)\]}]+/, 'string'], - [/".*"/, 'string'] - ] - }, - whitespace: [ - [/[ \t\r\n]+/, 'white'], - [/%%.*$/, 'comment'] - ] - }); - - monacoEditor.editor.defineTheme('myCoolTheme', { - base: 'vs', - inherit: false, - rules: [ - { token: 'keyword', foreground: '880000', fontStyle: 'bold' }, - { token: 'custom-error', foreground: 'ff0000', fontStyle: 'bold' }, - { token: 'string', foreground: 'AA8500' }, - { token: 'transition', foreground: '008800', fontStyle: 'bold' }, - { token: 'delimiter.bracket', foreground: '000000', fontStyle: 'bold' } - ] - }); - - // Register a completion item provider for the new language - monacoEditor.languages.registerCompletionItemProvider('mermaid', { - provideCompletionItems: () => { - const suggestions = [ - { - label: 'simpleText', - kind: monacoEditor.languages.CompletionItemKind.Text, - insertText: 'simpleText' - }, - { - label: 'testing', - kind: monacoEditor.languages.CompletionItemKind.Keyword, - insertText: 'testing(${1:condition})', - insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet - }, - { - label: 'ifelse', - kind: monacoEditor.languages.CompletionItemKind.Snippet, - insertText: ['if (${1:condition}) {', '\t$0', '} else {', '\t', '}'].join('\n'), - insertTextRules: monacoEditor.languages.CompletionItemInsertTextRule.InsertAsSnippet, - documentation: 'If-Else Statement' - } - ]; - return { suggestions: suggestions }; - } - }); -}; diff --git a/src/lib/components/history/history.svelte b/src/lib/components/history/history.svelte deleted file mode 100644 index 1010d40d..00000000 --- a/src/lib/components/history/history.svelte +++ /dev/null @@ -1,117 +0,0 @@ - - - -
- - -
-
    - {#if $historyStore.length > 0} - {#each $historyStore as { state, time, name }} -
  • -
    -
    -
    - {name} - {relativeTime(time)} -
    -
    -
    - - -
    -
    -
  • - {/each} - {:else} -
    - No items in History
    - Click the Save button to save current state and restore it later.
    - Timeline will automatically be saved every minute. -
    - {/if} -
-
diff --git a/src/lib/components/history/history.ts b/src/lib/components/history/history.ts deleted file mode 100644 index 4b7677a6..00000000 --- a/src/lib/components/history/history.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { derived, Readable, Writable, writable, get } from 'svelte/store'; -import { persist, localStorage } from '@macfja/svelte-persistent-store'; -import { generateSlug } from 'random-word-slugs'; -import type { HistoryEntry } from '../../types'; - -const MAX_AUTO_HISTORY_LENGTH = 30; - -export const autoHistoryMode: Writable = persist( - writable(true), - localStorage(), - 'autoHistoryMode' -); - -const autoHistoryStore: Writable = persist( - writable([]), - localStorage(), - 'autoHistoryStore' -); - -const manualHistoryStore: Writable = persist( - writable([]), - localStorage(), - 'manualHistoryStore' -); - -export const historyStore: Readable = derived( - [autoHistoryMode, autoHistoryStore, manualHistoryStore], - ([autoMode, autoHistories, manualHistories], set) => { - set(autoMode ? autoHistories : manualHistories); - } -); - -export const addHistoryEntry = (entry: HistoryEntry): void => { - entry.name = generateSlug(2); - - if (!entry.auto) { - manualHistoryStore.update((entries) => [entry, ...entries]); - return; - } - autoHistoryStore.update((entries) => { - if (entries.length === MAX_AUTO_HISTORY_LENGTH) { - entries.pop(); - } - return [entry, ...entries]; - }); -}; - -export const clearHistoryData = (time?: number): void => { - (get(autoHistoryMode) ? autoHistoryStore : manualHistoryStore).update((entries) => - entries.filter((entry) => time && entry.time != time) - ); -}; - -export const getPreviousState = (auto: boolean): string => { - const entries = get(auto ? autoHistoryStore : manualHistoryStore); - if (entries.length > 0) { - return JSON.stringify(entries[0].state); - } - return ''; -}; diff --git a/src/lib/components/navbar.svelte b/src/lib/components/navbar.svelte deleted file mode 100644 index 3f0e93a0..00000000 --- a/src/lib/components/navbar.svelte +++ /dev/null @@ -1,80 +0,0 @@ - - - - -
- - - - - - -
- - diff --git a/src/lib/components/preset.svelte b/src/lib/components/preset.svelte deleted file mode 100644 index efeca6f4..00000000 --- a/src/lib/components/preset.svelte +++ /dev/null @@ -1,114 +0,0 @@ - - - -
- {#each Object.keys(samples) as sample} - - {/each} -
-
diff --git a/src/lib/components/view.svelte b/src/lib/components/view.svelte deleted file mode 100644 index 718a158f..00000000 --- a/src/lib/components/view.svelte +++ /dev/null @@ -1,68 +0,0 @@ - - -
-
-
- - diff --git a/src/lib/types.d.ts b/src/lib/types.d.ts deleted file mode 100644 index 3f121d93..00000000 --- a/src/lib/types.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Can be made globally available by placing this - * inside `global.d.ts` and removing `export` keyword - */ -export interface Locals { - userid: string; -} - -export interface EditorUpdateEvent { - text: string; -} -export interface EditorEvents { - update: EditorUpdateEvent; -} - -export interface TabEvents { - select: Tab; -} - -export interface Tab { - id: string; - title: string; - icon: string; -} - -export interface State { - code: string; - mermaid: string; - updateEditor: boolean; - updateDiagram: boolean; - autoSync: boolean; -} - -export interface HistoryEntry { - state: State; - time: number; - name?: string; - auto: boolean; -} diff --git a/src/lib/util/error.ts b/src/lib/util/error.ts deleted file mode 100644 index 43829bf6..00000000 --- a/src/lib/util/error.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { writable } from 'svelte/store'; - -export const errorStore = writable(undefined); diff --git a/src/lib/util/notify.ts b/src/lib/util/notify.ts deleted file mode 100644 index b9c54a27..00000000 --- a/src/lib/util/notify.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const notify = (message: string): void => { - alert(message); -}; - -export const prompt = (message: string): boolean => { - return confirm(message); -}; diff --git a/src/lib/util/state.ts b/src/lib/util/state.ts deleted file mode 100644 index ebb839d5..00000000 --- a/src/lib/util/state.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { writable, get, derived } from 'svelte/store'; -import { toBase64, fromBase64 } from 'js-base64'; -import { persist, localStorage } from '@macfja/svelte-persistent-store'; -import type { State } from '$lib/types'; -import { saveStatistcs } from './stats'; - -const defaultState: State = { - code: `graph TD - A[Christmas] -->|Get money| B(Go shopping) - B --> C{Let me think} - C -->|One| D[Laptop] - C -->|Two| E[iPhone] - C -->|Three| F[fa:fa-car Car] - `, - mermaid: JSON.stringify( - { - theme: 'default' - }, - null, - 2 - ), - updateEditor: false, - autoSync: true, - updateDiagram: true -}; - -export const codeStore = persist(writable(defaultState), localStorage(), 'codeStore'); -export const base64State = derived([codeStore], ([code], set) => { - set(toBase64(JSON.stringify(code), true)); -}); - -export const loadState = (data: string): void => { - let state: State; - try { - const stateStr = fromBase64(data); - console.log(`Tring to load state: ${stateStr}`); - state = JSON.parse(stateStr); - if (typeof state.mermaid !== 'string') { - state.mermaid = JSON.stringify(state.mermaid, null, 2); - } - } catch (e) { - if (data) { - console.error('Init error', e); - } - state = get(codeStore); - console.log(state); - } - updateCodeStore({ ...state, updateEditor: true }); -}; - -export const updateCodeStore = (newState: State): void => { - codeStore.update((state) => { - return { ...state, ...newState }; - }); -}; - -let prompted = false; -export const updateCode = (code: string, updateEditor: boolean, updateDiagram = false): void => { - saveStatistcs(code); - const lines = (code.match(/\n/g) || '').length + 1; - - if (lines > 50 && !prompted && get(codeStore).autoSync) { - const turnOff = confirm( - 'Long diagram deteced. Turn off Auto Sync? Click the sync logo to manually sync.' - ); - prompted = true; - if (turnOff) { - updateCodeStore({ - autoSync: false - } as State); - } - } - - codeStore.update((state) => { - return { ...state, code, updateEditor, updateDiagram }; - }); -}; - -export const updateConfig = (config: string, updateEditor: boolean): void => { - codeStore.update((state) => { - return { ...state, mermaid: config, updateEditor }; - }); -}; - -export const initURLSubscription = (): void => { - base64State.subscribe((state: string) => { - history.replaceState(undefined, undefined, `#${state}`); - }); -}; - -export const getStateString = (): string => { - return JSON.stringify(get(codeStore)); -}; diff --git a/src/lib/util/stats.ts b/src/lib/util/stats.ts deleted file mode 100644 index 0a8ae69e..00000000 --- a/src/lib/util/stats.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { browser } from '$app/env'; -import type { AnalyticsInstance } from 'analytics'; - -export let analytics: AnalyticsInstance; - -export const initAnalytics = async (): Promise => { - if (browser && !analytics) { - try { - const { Analytics } = await import('analytics'); - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - const googleAnalytics = await import('@analytics/google-analytics'); - analytics = Analytics({ - app: 'mermaid-live-editor', - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - plugins: [ - // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access - googleAnalytics.init({ - trackingId: 'UA-153180559-1' - }) - ] - }); - } catch { - console.info('Analytics blocked ;)'); - } - } -}; - -const detectType = (text: string): string => { - return text - .replace(/^\s*%%.*\n/g, '\n') - .trimStart() - .split(' ')[0]; -}; - -// manual debounce -let timeout; -export const saveStatistcs = (graph: string): void => { - if (analytics) { - clearTimeout(timeout); - // Only save statistcs after a 5 sec delay - timeout = setTimeout(function () { - const graphType = detectType(graph); - console.debug('ga:', 'send', 'event', 'render', graphType); - void analytics.track('render', { - graphType - }); - }, 5000); - } -}; diff --git a/src/lib/util/util.ts b/src/lib/util/util.ts deleted file mode 100644 index 482dab1c..00000000 --- a/src/lib/util/util.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { State } from '$lib/types'; -import { initURLSubscription, loadState, updateCodeStore } from './state'; -import { analytics, initAnalytics } from './stats'; - -export const loadStateFromURL = (): void => { - loadState(window.location.hash.slice(1)); -}; - -export const syncDiagram = (): void => { - updateCodeStore({ - updateDiagram: true - } as State); -}; - -export const initHandler = async (): Promise => { - loadStateFromURL(); - syncDiagram(); - initURLSubscription(); - await initAnalytics(); - analytics?.page(); -}; diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte deleted file mode 100644 index f17b2f6e..00000000 --- a/src/routes/__layout.svelte +++ /dev/null @@ -1,25 +0,0 @@ - - -
- -
diff --git a/src/routes/edit.svelte b/src/routes/edit.svelte deleted file mode 100644 index 8f065c10..00000000 --- a/src/routes/edit.svelte +++ /dev/null @@ -1,202 +0,0 @@ - - -
- -
- -
-
- - - -
- -
-
-
- Code editing not supported on mobile. Please use a desktop browser. -
-
-
-
- - diff --git a/src/routes/index.svelte b/src/routes/index.svelte deleted file mode 100644 index ca9daa13..00000000 --- a/src/routes/index.svelte +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/src/routes/manifest.json.ts b/src/routes/manifest.json.ts deleted file mode 100644 index f8e5f95e..00000000 --- a/src/routes/manifest.json.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { base } from '$app/paths'; -export const get = (): { body: unknown } => { - return { - body: { - short_name: 'Mermaid', - name: 'Mermaid Live Editor', - icons: [ - { - src: `${base}/icon-192.png`, - type: 'image/png', - sizes: '192x192' - }, - { - src: `${base}/icon-512.png`, - type: 'image/png', - sizes: '512x512' - } - ], - start_url: `${base}/edit/`, - background_color: '#6366F1', - display: 'standalone', - scope: `${base}/edit/`, - theme_color: '#6366F1', - description: 'FlowChart & Diagrams Editor.', - orientation: 'landscape' - } - }; -}; diff --git a/src/routes/view.svelte b/src/routes/view.svelte deleted file mode 100644 index 216251f0..00000000 --- a/src/routes/view.svelte +++ /dev/null @@ -1,8 +0,0 @@ - - - diff --git a/static/.nojekyll b/static/.nojekyll deleted file mode 100644 index e69de29b..00000000 diff --git a/static/favicon.png b/static/favicon.png deleted file mode 100644 index 5a015fd6..00000000 Binary files a/static/favicon.png and /dev/null differ diff --git a/static/icon-192.png b/static/icon-192.png deleted file mode 100644 index f7e1344f..00000000 Binary files a/static/icon-192.png and /dev/null differ diff --git a/static/icon-512.png b/static/icon-512.png deleted file mode 100644 index 3a204f57..00000000 Binary files a/static/icon-512.png and /dev/null differ diff --git a/static/robots.txt b/static/robots.txt deleted file mode 100644 index e9e57dc4..00000000 --- a/static/robots.txt +++ /dev/null @@ -1,3 +0,0 @@ -# https://www.robotstxt.org/robotstxt.html -User-agent: * -Disallow: diff --git a/static/service-worker.js b/static/service-worker.js deleted file mode 100644 index 38c2987d..00000000 --- a/static/service-worker.js +++ /dev/null @@ -1,2 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-empty-function -self.addEventListener('fetch', (e) => {}); diff --git a/svelte.config.js b/svelte.config.js deleted file mode 100644 index 64da24ed..00000000 --- a/svelte.config.js +++ /dev/null @@ -1,30 +0,0 @@ -import preprocess from 'svelte-preprocess'; -import adapter from '@sveltejs/adapter-static'; - -/** @type {import('@sveltejs/kit').Config} */ -const config = { - // Consult https://github.com/sveltejs/svelte-preprocess - // for more information about preprocessors - preprocess: [ - preprocess({ - postcss: true - }) - ], - - kit: { - adapter: adapter({ - pages: `docs${process.env['BETA'] ? '/beta' : ''}` - }), - paths: process.env['DEPLOY'] - ? { - base: `${process.env['BETA'] ? '/beta' : ''}/mermaid-live-editor` - } - : {}, - ssr: false, - // hydrate the
element in src/app.html - target: '#svelte', - trailingSlash: 'ignore' - } -}; - -export default config; diff --git a/tailwind.config.cjs b/tailwind.config.cjs deleted file mode 100644 index 88ad83f5..00000000 --- a/tailwind.config.cjs +++ /dev/null @@ -1,25 +0,0 @@ -const { tailwindExtractor } = require('tailwindcss/lib/lib/purgeUnusedStyles'); - -module.exports = { - mode: 'aot', - purge: { - content: ['./src/**/*.{html,js,svelte,ts}'], - options: { - defaultExtractor: (content) => [ - // If this stops working, please open an issue at https://github.com/svelte-add/tailwindcss/issues rather than bothering Tailwind Labs about it - ...tailwindExtractor(content), - // Match Svelte class: directives (https://github.com/tailwindlabs/tailwindcss/discussions/1731) - ...[...content.matchAll(/(?:class:)*([\w\d-/:%.]+)/gm)].map( - ([_match, group, ..._rest]) => group - ) - ] - }, - safelist: [/^svelte-[\d\w]+$/] - }, - theme: { - extend: {} - }, - variants: { - extend: {} - } -}; diff --git a/tsconfig.json b/tsconfig.json deleted file mode 100644 index 975f193c..00000000 --- a/tsconfig.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "compilerOptions": { - "moduleResolution": "node", - "module": "es2020", - "lib": ["es2020", "ESNext"], - "target": "es2019", - /** - svelte-preprocess cannot figure out whether you have a value or a type, so tell TypeScript - to enforce using \`import type\` instead of \`import\` for Types. - */ - "importsNotUsedAsValues": "error", - "isolatedModules": true, - "resolveJsonModule": true, - /** - To have warnings/errors of the Svelte compiler at the correct position, - enable source maps by default. - */ - "sourceMap": true, - "esModuleInterop": true, - "skipLibCheck": true, - "forceConsistentCasingInFileNames": true, - "baseUrl": ".", - "allowJs": true, - "checkJs": true, - "paths": { - "$lib/*": ["src/lib/*"] - } - }, - "include": [ - "src/**/*.d.ts", - "src/**/*.js", - "src/**/*.ts", - "src/**/*.svelte", - "cypress/**/*.ts", - "cypress/**/*.js", - "static/**/*.js" - ] -} diff --git a/docs/edit/index.html b/view/index.html similarity index 97% rename from docs/edit/index.html rename to view/index.html index 18885ade..8cc9cb02 100644 --- a/docs/edit/index.html +++ b/view/index.html @@ -59,7 +59,7 @@ - + @@ -67,7 +67,7 @@