Changeset 3792829
- Timestamp:
- 11/09/2026 04:00:01 PM (19 hours ago)
- Location:
- funnelfork
- Files:
-
- 9 added
- 34 edited
- 1 copied
-
assets/screenshot-10.png (added)
-
assets/screenshot-11.png (added)
-
assets/screenshot-12.png (added)
-
assets/screenshot-8.png (added)
-
assets/screenshot-9.png (added)
-
tags/1.1.0 (copied) (copied from funnelfork/trunk )
-
tags/1.1.0/build/editor-rtl.css (modified) (1 diff)
-
tags/1.1.0/build/editor.asset.php (modified) (1 diff)
-
tags/1.1.0/build/editor.css (modified) (1 diff)
-
tags/1.1.0/build/editor.js (modified) (1 diff)
-
tags/1.1.0/build/runner.asset.php (modified) (1 diff)
-
tags/1.1.0/build/runner.js (modified) (1 diff)
-
tags/1.1.0/funnelfork.php (modified) (4 diffs)
-
tags/1.1.0/includes/class-stats.php (added)
-
tags/1.1.0/includes/freemius.php (modified) (1 diff)
-
tags/1.1.0/languages/funnelfork.pot (modified) (29 diffs)
-
tags/1.1.0/package.json (modified) (1 diff)
-
tags/1.1.0/readme.txt (modified) (8 diffs)
-
tags/1.1.0/src/editor/App.js (modified) (1 diff)
-
tags/1.1.0/src/editor/components/FlowEdge.js (modified) (3 diffs)
-
tags/1.1.0/src/editor/components/Inspector.js (modified) (3 diffs)
-
tags/1.1.0/src/editor/components/Stats.js (added)
-
tags/1.1.0/src/editor/components/nodes.js (modified) (4 diffs)
-
tags/1.1.0/src/editor/editor.scss (modified) (2 diffs)
-
tags/1.1.0/src/runner/index.js (modified) (4 diffs)
-
trunk/build/editor-rtl.css (modified) (1 diff)
-
trunk/build/editor.asset.php (modified) (1 diff)
-
trunk/build/editor.css (modified) (1 diff)
-
trunk/build/editor.js (modified) (1 diff)
-
trunk/build/runner.asset.php (modified) (1 diff)
-
trunk/build/runner.js (modified) (1 diff)
-
trunk/funnelfork.php (modified) (4 diffs)
-
trunk/includes/class-stats.php (added)
-
trunk/includes/freemius.php (modified) (1 diff)
-
trunk/languages/funnelfork.pot (modified) (29 diffs)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.txt (modified) (8 diffs)
-
trunk/src/editor/App.js (modified) (1 diff)
-
trunk/src/editor/components/FlowEdge.js (modified) (3 diffs)
-
trunk/src/editor/components/Inspector.js (modified) (3 diffs)
-
trunk/src/editor/components/Stats.js (added)
-
trunk/src/editor/components/nodes.js (modified) (4 diffs)
-
trunk/src/editor/editor.scss (modified) (2 diffs)
-
trunk/src/runner/index.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
funnelfork/tags/1.1.0/build/editor-rtl.css
r3763298 r3792829 1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-right:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-left:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-left:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-right:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);right:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;left:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-right:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 12px 8px 18px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:right}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-right:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-left:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:right;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0; max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:right}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-right:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-left:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-left:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-right:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);right:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;left:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-right:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 12px 8px 18px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:right}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-right:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-left:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:right;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0;flex-shrink:0;max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:right}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}.fs-edge-label{pointer-events:all;position:absolute}.fs-stats__tiles{display:grid;gap:8px;grid-template-columns:repeat(2,1fr)}.fs-stats__tile{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:flex;flex-direction:column;padding:10px 12px}.fs-stats__value{color:var(--ff-ink);font-family:var(--ff-font-display);font-size:22px;font-weight:600;line-height:1.2}.fs-stats__label{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:11px;letter-spacing:.06em;text-transform:uppercase}.fs-stats__chart{margin:0}.fs-stats__chart svg{display:block;height:auto;width:100%}.fs-stats__bar.is-views{fill:var(--ff-teal-soft)}.fs-stats__bar.is-completes{fill:var(--ff-teal)}.fs-stats__legend{color:var(--ff-ink-muted);display:flex;font-size:12px;gap:12px;margin-top:4px}.fs-stats__legend span:before{border-radius:2px;content:"";display:inline-block;height:10px;margin-left:4px;vertical-align:-1px;width:10px}.fs-stats__legend .is-views:before{background:var(--ff-teal-soft);border:1px solid var(--ff-wire)}.fs-stats__legend .is-completes:before{background:var(--ff-teal)}.fs-stats .components-notice,.fs-stats .fs-inspector__heading{margin:0}.fs-stats-pro{background:var(--ff-amber-soft);border:1px solid var(--ff-amber);border-radius:var(--ff-radius-m);margin:0;padding:14px}.fs-stats-pro__title{align-items:center;color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:15px;gap:6px;margin:0 0 6px}.fs-stats-pro__lock{fill:var(--ff-amber-ink);height:16px;width:16px}.fs-stats-pro__lead{color:var(--ff-ink);margin:0 0 10px}.fs-stats-pro__subtitle{font-size:13px;margin:12px 0 6px}.fs-stats-pro__list{list-style:none;margin:0 0 8px;padding:0}.fs-stats-pro__list li{align-items:center;display:grid;font-size:12px;gap:8px;grid-template-columns:minmax(0,1fr) 70px 34px;margin-bottom:6px}.fs-stats-pro__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fs-stats-pro__bar{background:#fff;border-radius:4px;height:8px;overflow:hidden}.fs-stats-pro__bar span{background:var(--ff-amber);display:block;filter:blur(1px);height:100%}.fs-stats-pro__num{color:var(--ff-amber-ink);filter:blur(3px);-webkit-user-select:none;user-select:none}.fs-stats-pro__features{font-size:12px;list-style:disc;margin:10px 1.2em 12px 0;padding:0} -
funnelfork/tags/1.1.0/build/editor.asset.php
r3763298 r3792829 10 10 'wp-i18n' 11 11 ), 12 'version' => ' 01bed0e067fc1e200d25'12 'version' => '7379d5a77a3faf3e040a' 13 13 ); -
funnelfork/tags/1.1.0/build/editor.css
r3763298 r3792829 1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-left:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-right:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-right:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-left:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);left:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(-50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;right:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-left:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 18px 8px 12px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:left}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-left:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-right:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:left;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0; max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:left}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-left:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-right:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-right:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-left:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);left:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(-50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;right:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-left:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 18px 8px 12px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:left}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-left:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-right:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:left;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0;flex-shrink:0;max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:left}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}.fs-edge-label{pointer-events:all;position:absolute}.fs-stats__tiles{display:grid;gap:8px;grid-template-columns:repeat(2,1fr)}.fs-stats__tile{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:flex;flex-direction:column;padding:10px 12px}.fs-stats__value{color:var(--ff-ink);font-family:var(--ff-font-display);font-size:22px;font-weight:600;line-height:1.2}.fs-stats__label{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:11px;letter-spacing:.06em;text-transform:uppercase}.fs-stats__chart{margin:0}.fs-stats__chart svg{display:block;height:auto;width:100%}.fs-stats__bar.is-views{fill:var(--ff-teal-soft)}.fs-stats__bar.is-completes{fill:var(--ff-teal)}.fs-stats__legend{color:var(--ff-ink-muted);display:flex;font-size:12px;gap:12px;margin-top:4px}.fs-stats__legend span:before{border-radius:2px;content:"";display:inline-block;height:10px;margin-right:4px;vertical-align:-1px;width:10px}.fs-stats__legend .is-views:before{background:var(--ff-teal-soft);border:1px solid var(--ff-wire)}.fs-stats__legend .is-completes:before{background:var(--ff-teal)}.fs-stats .components-notice,.fs-stats .fs-inspector__heading{margin:0}.fs-stats-pro{background:var(--ff-amber-soft);border:1px solid var(--ff-amber);border-radius:var(--ff-radius-m);margin:0;padding:14px}.fs-stats-pro__title{align-items:center;color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:15px;gap:6px;margin:0 0 6px}.fs-stats-pro__lock{fill:var(--ff-amber-ink);height:16px;width:16px}.fs-stats-pro__lead{color:var(--ff-ink);margin:0 0 10px}.fs-stats-pro__subtitle{font-size:13px;margin:12px 0 6px}.fs-stats-pro__list{list-style:none;margin:0 0 8px;padding:0}.fs-stats-pro__list li{align-items:center;display:grid;font-size:12px;gap:8px;grid-template-columns:minmax(0,1fr) 70px 34px;margin-bottom:6px}.fs-stats-pro__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fs-stats-pro__bar{background:#fff;border-radius:4px;height:8px;overflow:hidden}.fs-stats-pro__bar span{background:var(--ff-amber);display:block;filter:blur(1px);height:100%}.fs-stats-pro__num{color:var(--ff-amber-ink);filter:blur(3px);-webkit-user-select:none;user-select:none}.fs-stats-pro__features{font-size:12px;list-style:disc;margin:10px 0 12px 1.2em;padding:0} -
funnelfork/tags/1.1.0/build/editor.js
r3763298 r3792829 1 (()=>{"use strict";var e={ 46(e,t,n){var o=n.cw((e,t)=>{var n=a(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useState,i=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),o=r({inst:{value:n,getSnapshot:t}}),a=o[0].inst,d=o[1];return s(function(){a.value=n,a.getSnapshot=t,c(a)&&d({inst:a})},[e,n,t]),i(function(){return c(a)&&d({inst:a}),e(function(){c(a)&&d({inst:a})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:d}),r=n.cw((e,t)=>{var n=a(),o=i(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,l=n.useRef,c=n.useEffect,d=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,o,i){var a=l(null);if(null===a.current){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=d(function(){function e(e){if(!l){if(l=!0,s=e,e=o(e),void 0!==i&&f.hasValue){var t=f.value;if(i(t,e))return a=t}return a=e}if(t=a,r(s,e))return t;var n=o(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,o,i]);var h=s(e,a[0],a[1]);return c(function(){f.hasValue=!0,f.value=h},[h]),u(h),h}}),i=n.cw(e=>{e.exports=o()}),s=n.cw(e=>{e.exports=r()}),a=n.cw(e=>{e.exports=window.React});const l=window.wp.element,c=window.ReactJSXRuntime;function d(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=d(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}a();var u={value:()=>{}};function f(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new h(o)}function h(e){this._=e}function p(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function g(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=u,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}h.prototype=f.prototype={constructor:h,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=g(r[n],e.name,t);else if(null==t)for(n in r)r[n]=g(r[n],e.name,null);return this}for(;++s<a;)if((n=(e=i[s]).type)&&(n=p(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new h(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};const m=f;function y(){}function x(e){return null==e?y:function(){return this.querySelector(e)}}function v(e){"function"!=typeof e&&(e=x(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s,a=t[r],l=a.length,c=o[r]=new Array(l),d=0;d<l;++d)(i=a[d])&&(s=e.call(i,i.__data__,d,a))&&("__data__"in i&&(s.__data__=i.__data__),c[d]=s);return new at(o,this._parents)}function w(){return[]}function b(e){return null==e?w:function(){return this.querySelectorAll(e)}}function _(e){e="function"==typeof e?function(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}(e):b(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s,a=t[i],l=a.length,c=0;c<l;++c)(s=a[c])&&(o.push(e.call(s,s.__data__,c,a)),r.push(s));return new at(o,r)}function S(e){return function(){return this.matches(e)}}function k(e){return function(t){return t.matches(e)}}n.dn(x),n.dn(v),n.dn(b),n.dn(_),n.dn(S),n.dn(E);var C=Array.prototype.find;function N(){return this.firstElementChild}function E(e){return this.select(null==e?N:function(e){return function(){return C.call(this.children,e)}}("function"==typeof e?e:k(e)))}n.dn(j);var M=Array.prototype.filter;function P(){return Array.from(this.children)}function j(e){return this.selectAll(null==e?P:function(e){return function(){return M.call(this.children,e)}}("function"==typeof e?e:k(e)))}function D(e){"function"!=typeof e&&(e=S(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new at(o,this._parents)}function I(e){return new Array(e.length)}function O(){return new at(this._enter||this._groups.map(I),this._parents)}function z(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function A(e){return function(){return e}}function R(e,t,n,o,r,i){for(var s,a=0,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],o[a]=s):n[a]=new z(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function L(e,t,n,o,r,i,s){var a,l,c,d=new Map,u=t.length,f=i.length,h=new Array(u);for(a=0;a<u;++a)(l=t[a])&&(h[a]=c=s.call(l,l.__data__,a,t)+"",d.has(c)?r[a]=l:d.set(c,l));for(a=0;a<f;++a)c=s.call(e,i[a],a,i)+"",(l=d.get(c))?(o[a]=l,l.__data__=i[a],d.delete(c)):n[a]=new z(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&d.get(h[a])===l&&(r[a]=l)}function T(e){return e.__data__}function B(e,t){if(!arguments.length)return Array.from(this,T);var n=t?L:R,o=this._parents,r=this._groups;"function"!=typeof e&&(e=A(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],u=r[c],f=u.length,h=$(e.call(d,d&&d.__data__,c,o)),p=h.length,g=a[c]=new Array(p),m=s[c]=new Array(p);n(d,u,g,m,l[c]=new Array(f),h,t);for(var y,x,v=0,w=0;v<p;++v)if(y=g[v]){for(v>=w&&(w=v+1);!(x=m[w])&&++w<p;);y._next=x||null}}return(s=new at(s,o))._enter=a,s._exit=l,s}function $(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function V(){return new at(this._exit||this._groups.map(I),this._parents)}function H(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r}function Z(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c,d=n[l],u=o[l],f=d.length,h=a[l]=new Array(f),p=0;p<f;++p)(c=d[p]||u[p])&&(h[p]=c);for(;l<r;++l)a[l]=n[l];return new at(a,this._parents)}function Y(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,s=r[i];--i>=0;)(o=r[i])&&(s&&4^o.compareDocumentPosition(s)&&s.parentNode.insertBefore(o,s),s=o);return this}function X(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=F);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s,a=n[i],l=a.length,c=r[i]=new Array(l),d=0;d<l;++d)(s=a[d])&&(c[d]=s);c.sort(t)}return new at(r,this._parents).order()}function F(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function q(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function K(){return Array.from(this)}function W(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function G(){let e=0;for(const t of this)++e;return e}function U(){return!this.node()}function Q(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],s=0,a=i.length;s<a;++s)(r=i[s])&&e.call(r,r.__data__,s,i);return this}n.dn(D),n.dn(I),n.dn(O),z.prototype={constructor:z,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},n.dn(A),n.dn(B),n.dn(V),n.dn(H),n.dn(Z),n.dn(Y),n.dn(X),n.dn(q),n.dn(K),n.dn(W),n.dn(G),n.dn(U),n.dn(Q);var J="http://www.w3.org/1999/xhtml";const ee={svg:"http://www.w3.org/2000/svg",xhtml:J,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function te(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ee.hasOwnProperty(t)?{space:ee[t],local:e}:e}function ne(e){return function(){this.removeAttribute(e)}}function oe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function re(e,t){return function(){this.setAttribute(e,t)}}function ie(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function se(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function ae(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function le(e,t){var n=te(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?oe:ne:"function"==typeof t?n.local?ae:se:n.local?ie:re)(n,t))}function ce(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function de(e){return function(){this.style.removeProperty(e)}}function ue(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fe(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function he(e,t,n){return arguments.length>1?this.each((null==t?de:"function"==typeof t?fe:ue)(e,t,n??"")):pe(this.node(),e)}function pe(e,t){return e.style.getPropertyValue(t)||ce(e).getComputedStyle(e,null).getPropertyValue(t)}function ge(e){return function(){delete this[e]}}function me(e,t){return function(){this[e]=t}}function ye(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function xe(e,t){return arguments.length>1?this.each((null==t?ge:"function"==typeof t?ye:me)(e,t)):this.node()[e]}function ve(e){return e.trim().split(/^|\s+/)}function we(e){return e.classList||new be(e)}function be(e){this._node=e,this._names=ve(e.getAttribute("class")||"")}function _e(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Se(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ke(e){return function(){_e(this,e)}}function Ce(e){return function(){Se(this,e)}}function Ne(e,t){return function(){(t.apply(this,arguments)?_e:Se)(this,e)}}function Ee(e,t){var n=ve(e+"");if(arguments.length<2){for(var o=we(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?Ne:t?ke:Ce)(n,t))}function Me(){this.textContent=""}function Pe(e){return function(){this.textContent=e}}function je(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function De(e){return arguments.length?this.each(null==e?Me:("function"==typeof e?je:Pe)(e)):this.node().textContent}function Ie(){this.innerHTML=""}function Oe(e){return function(){this.innerHTML=e}}function ze(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ae(e){return arguments.length?this.each(null==e?Ie:("function"==typeof e?ze:Oe)(e)):this.node().innerHTML}function Re(){this.nextSibling&&this.parentNode.appendChild(this)}function Le(){return this.each(Re)}function Te(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Be(){return this.each(Te)}function $e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===J&&t.documentElement.namespaceURI===J?t.createElement(e):t.createElementNS(n,e)}}function Ve(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function He(e){var t=te(e);return(t.local?Ve:$e)(t)}function Ze(e){var t="function"==typeof e?e:He(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ye(){return null}function Xe(e,t){var n="function"==typeof e?e:He(e),o=null==t?Ye:"function"==typeof t?t:x(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Fe(){var e=this.parentNode;e&&e.removeChild(this)}function qe(){return this.each(Fe)}function Ke(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function We(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ge(e){return this.select(e?We:Ke)}function Ue(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qe(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function Je(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function et(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),s=i.length;if(!(arguments.length<2)){for(a=t?Je:Qe,o=0;o<s;++o)this.each(a(i[o],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,d=a.length;c<d;++c)for(o=0,l=a[c];o<s;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value}function tt(e,t,n){var o=ce(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function nt(e,t){return function(){return tt(this,e,t)}}function ot(e,t){return function(){return tt(this,e,t.apply(this,arguments))}}function rt(e,t){return this.each(("function"==typeof t?ot:nt)(e,t))}function*it(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,s=r.length;i<s;++i)(o=r[i])&&(yield o)}n.dn(te),n.dn(le),n.dn(ce),n.dn(he),n.dn(xe),n.dn(Ee),be.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}},n.dn(De),n.dn(Ae),n.dn(Le),n.dn(Be),n.dn(He),n.dn(Ze),n.dn(Xe),n.dn(qe),n.dn(Ge),n.dn(Ue),n.dn(et),n.dn(rt),n.dn(it);var st=[null];function at(e,t){this._groups=e,this._parents=t}function lt(){return new at([[document.documentElement]],st)}at.prototype=lt.prototype={constructor:at,select:v,selectAll:_,selectChild:E,selectChildren:j,filter:D,data:B,enter:O,exit:V,join:H,merge:Z,selection:function(){return this},order:Y,sort:X,call:q,nodes:K,node:W,size:G,empty:U,each:Q,attr:le,style:he,property:xe,classed:Ee,text:De,html:Ae,raise:Le,lower:Be,append:Ze,insert:Xe,remove:qe,clone:Ge,datum:Ue,on:et,dispatch:rt,[Symbol.iterator]:it};const ct=lt;function dt(e){return"string"==typeof e?new at([[document.querySelector(e)]],[document.documentElement]):new at([[e]],st)}function ut(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ft(e,t){if(e=ut(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}n.dn(dt),n.dn(ut),n.dn(ft),n.dn(mt);const ht={passive:!1},pt={capture:!0,passive:!1};function gt(e){e.stopImmediatePropagation()}function mt(e){e.preventDefault(),e.stopImmediatePropagation()}function yt(e){var t=e.document.documentElement,n=dt(e).on("dragstart.drag",mt,pt);"onselectstart"in t?n.on("selectstart.drag",mt,pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xt(e,t){var n=e.document.documentElement,o=dt(e).on("dragstart.drag",null);t&&(o.on("click.drag",mt,pt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}n.dn(yt);const vt=e=>()=>e;function wt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function bt(e){return!e.ctrlKey&&!e.button}function _t(){return this.parentNode}function St(e,t){return t??{x:e.x,y:e.y}}function kt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ct(){var e,t,n,o,r=bt,i=_t,s=St,a=kt,l={},c=m("start","drag","end"),d=0,u=0;function f(e){e.on("mousedown.drag",h).filter(a).on("touchstart.drag",y).on("touchmove.drag",x,ht).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(s,a){if(!o&&r.call(this,s,a)){var l=w(this,i.call(this,s,a),s,a,"mouse");l&&(dt(s.view).on("mousemove.drag",p,pt).on("mouseup.drag",g,pt),yt(s.view),gt(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(o){if(mt(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>u}l.mouse("drag",o)}function g(e){dt(e.view).on("mousemove.drag mouseup.drag",null),xt(e.view,n),mt(e),l.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,a=i.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=w(this,a,e,t,s[n].identifier,s[n]))&&(gt(e),o("start",e,s[n]))}}function x(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(mt(e),n("drag",e,o[t]))}function v(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=l[r[t].identifier])&&(gt(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var a,u,h,p=c.copy(),g=ft(i||n,t);if(null!=(h=s.call(e,new wt("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return a=h.x-g[0]||0,u=h.y-g[1]||0,function n(i,s,c){var m,y=g;switch(i){case"start":l[r]=n,m=d++;break;case"end":delete l[r],--d;case"drag":g=ft(c||s,t),m=d}p.call(i,e,new wt(i,{sourceEvent:s,subject:h,target:f,identifier:r,active:m,x:g[0]+a,y:g[1]+u,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:vt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:vt(e),f):i},f.subject=function(e){return arguments.length?(s="function"==typeof e?e:vt(e),f):s},f.touchable=function(e){return arguments.length?(a="function"==typeof e?e:vt(!!e),f):a},f.on=function(){var e=c.on.apply(c,arguments);return e===c?f:e},f.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,f):Math.sqrt(u)},f}function Nt(e){return((e=Math.exp(e))+1/e)/2}n.dn(vt),wt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},n.dn(Ct);const Et=function e(t,n,o){function r(e,r){var i,s,a=e[0],l=e[1],c=e[2],d=r[0],u=r[1],f=r[2],h=d-a,p=u-l,g=h*h+p*p;if(g<1e-12)s=Math.log(f/c)/t,i=function(e){return[a+e*h,l+e*p,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(g),y=(f*f-c*c+o*g)/(2*c*n*m),x=(f*f-c*c-o*g)/(2*f*n*m),v=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(x*x+1)-x);s=(w-v)/t,i=function(e){var o,r=e*s,i=Nt(v),d=c/(n*m)*(i*(o=t*r+v,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(v));return[a+d*h,l+d*p,c*i/Nt(t*r+v)]}}return i.duration=1e3*s*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4);var Mt,Pt,jt=0,Dt=0,It=0,Ot=0,zt=0,At=0,Rt="object"==typeof performance&&performance.now?performance:Date,Lt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tt(){return zt||(Lt(Bt),zt=Rt.now()+At)}function Bt(){zt=0}function $t(){this._call=this._time=this._next=null}function Vt(e,t,n){var o=new $t;return o.restart(e,t,n),o}function Ht(){zt=(Ot=Rt.now())+At,jt=Dt=0;try{!function(){Tt(),++jt;for(var e,t=Mt;t;)(e=zt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--jt}()}finally{jt=0,function(){for(var e,t,n=Mt,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Mt=t);Pt=e,Yt(o)}(),zt=0}}function Zt(){var e=Rt.now(),t=e-Ot;t>1e3&&(At-=t,Ot=e)}function Yt(e){jt||(Dt&&(Dt=clearTimeout(Dt)),e-zt>24?(e<1/0&&(Dt=setTimeout(Ht,e-Rt.now()-At)),It&&(It=clearInterval(It))):(It||(Ot=Rt.now(),It=setInterval(Zt,1e3)),jt=1,Lt(Ht)))}function Xt(e,t,n){var o=new $t;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}$t.prototype=Vt.prototype={constructor:$t,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Tt():+n)+(null==t?0:+t),this._next||Pt===this||(Pt?Pt._next=this:Mt=this,Pt=this),this._call=e,this._time=n,Yt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yt())}},n.dn(Xt),n.dn(Kt);var Ft=m("start","end","cancel","interrupt"),qt=[];function Kt(e,t,n,o,r,i){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(l){var c,d,u,f;if(1!==n.state)return a();for(c in r)if((f=r[c]).name===n.name){if(3===f.state)return Xt(i);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[c])}if(Xt(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++d]=f);o.length=d+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(a),n.state=5,1),i=-1,s=o.length;++i<s;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Vt(function(e){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=e&&i(e-n.delay)},0,n.time)}(e,n,{name:t,index:o,group:r,on:Ft,tween:qt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Wt(e,t){var n=Ut(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Gt(e,t){var n=Ut(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Ut(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Qt(e,t){var n,o,r,i=e.__transition,s=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):s=!1;s&&delete e.__transition}}function Jt(e){return this.each(function(){Qt(this,e)})}function en(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}n.dn(Qt),n.dn(Jt),n.dn(en),n.dn(rn);var tn,nn=180/Math.PI,on={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rn(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*nn,skewX:Math.atan(l)*nn,scaleX:s,scaleY:a}}function sn(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,s){var a=[],l=[];return i=e(i),s=e(s),function(e,o,r,i,s,a){if(e!==r||o!==i){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:en(e,r)},{i:l-2,x:en(o,i)})}else(r||i)&&s.push("translate("+r+t+i+n)}(i.translateX,i.translateY,s.translateX,s.translateY,a,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:en(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,s.rotate,a,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:en(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,s.skewX,a,l),function(e,t,n,o,i,s){if(e!==n||t!==o){var a=i.push(r(i)+"scale(",null,",",null,")");s.push({i:a-4,x:en(e,n)},{i:a-2,x:en(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,s.scaleX,s.scaleY,a,l),i=s=null,function(e){for(var t,n=-1,o=l.length;++n<o;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var an=sn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?on:rn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),ln=sn(function(e){return null==e?on:(tn||(tn=document.createElementNS("http://www.w3.org/2000/svg","g")),tn.setAttribute("transform",e),(e=tn.transform.baseVal.consolidate())?rn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):on)},", ",")",")");function cn(e,t){var n,o;return function(){var r=Gt(this,e),i=r.tween;if(i!==n)for(var s=0,a=(o=n=i).length;s<a;++s)if(o[s].name===t){(o=o.slice()).splice(s,1);break}r.tween=o}}function dn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Gt(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function un(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=Ut(this.node(),n).tween,i=0,s=r.length;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?cn:dn)(n,e,t))}function fn(e,t,n){var o=e._id;return e.each(function(){var e=Gt(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Ut(e,o).value[t]}}function hn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pn(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function gn(){}n.dn(un),n.dn(hn);var mn=.7,yn=1/mn,xn="\\s*([+-]?\\d+)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bn=/^#([0-9a-f]{3,8})$/,Sn=new RegExp(`^rgb\\(${xn},${xn},${xn}\\)$`),kn=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),Cn=new RegExp(`^rgba\\(${xn},${xn},${xn},${vn}\\)$`),Nn=new RegExp(`^rgba\\(${wn},${wn},${wn},${vn}\\)$`),En=new RegExp(`^hsl\\(${vn},${wn},${wn}\\)$`),Mn=new RegExp(`^hsla\\(${vn},${wn},${wn},${vn}\\)$`),Pn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function jn(){return this.rgb().formatHex()}function Dn(){return this.rgb().formatRgb()}function In(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=bn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?On(t):3===n?new Rn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?zn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?zn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Sn.exec(e))?new Rn(t[1],t[2],t[3],1):(t=kn.exec(e))?new Rn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Cn.exec(e))?zn(t[1],t[2],t[3],t[4]):(t=Nn.exec(e))?zn(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=En.exec(e))?Hn(t[1],t[2]/100,t[3]/100,1):(t=Mn.exec(e))?Hn(t[1],t[2]/100,t[3]/100,t[4]):Pn.hasOwnProperty(e)?On(Pn[e]):"transparent"===e?new Rn(NaN,NaN,NaN,0):null}function On(e){return new Rn(e>>16&255,e>>8&255,255&e,1)}function zn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Rn(e,t,n,o)}function An(e,t,n,o){return 1===arguments.length?((r=e)instanceof gn||(r=In(r)),r?new Rn((r=r.rgb()).r,r.g,r.b,r.opacity):new Rn):new Rn(e,t,n,o??1);var r}function Rn(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Ln(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}`}function Tn(){const e=Bn(this.opacity);return`${1===e?"rgb(":"rgba("}${$n(this.r)}, ${$n(this.g)}, ${$n(this.b)}${1===e?")":`, ${e})`}`}function Bn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vn(e){return((e=$n(e))<16?"0":"")+e.toString(16)}function Hn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Yn(e,t,n,o)}function Zn(e){if(e instanceof Yn)return new Yn(e.h,e.s,e.l,e.opacity);if(e instanceof gn||(e=In(e)),!e)return new Yn;if(e instanceof Yn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(s=t===i?(n-o)/a+6*(n<o):n===i?(o-t)/a+2:(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Yn(s,a,l,e.opacity)}function Yn(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function Xn(e){return(e=(e||0)%360)<0?e+360:e}function Fn(e){return Math.max(0,Math.min(1,e||0))}function qn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Kn(e,t,n,o,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*n+(1+3*e+3*i-3*s)*o+s*r)/6}function Wn(e){var t=e.length-1;return function(n){var o=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[o],i=e[o+1],s=o>0?e[o-1]:2*r-i,a=o<t-1?e[o+2]:2*i-r;return Kn((n-o/t)*t,s,r,i,a)}}function Gn(e){var t=e.length;return function(n){var o=Math.floor(((n%=1)<0?++n:n)*t),r=e[(o+t-1)%t],i=e[o%t],s=e[(o+1)%t],a=e[(o+2)%t];return Kn((n-o/t)*t,r,i,s,a)}}hn(gn,In,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:jn,formatHex:jn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Zn(this).formatHsl()},formatRgb:Dn,toString:Dn}),hn(Rn,An,pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rn($n(this.r),$n(this.g),$n(this.b),Bn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ln,formatHex:Ln,formatHex8:function(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}${Vn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Tn,toString:Tn})),hn(Yn,function(e,t,n,o){return 1===arguments.length?Zn(e):new Yn(e,t,n,o??1)},pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Yn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Yn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new Rn(qn(e>=240?e-240:e+120,r,o),qn(e,r,o),qn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Yn(Xn(this.h),Fn(this.s),Fn(this.l),Bn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Bn(this.opacity);return`${1===e?"hsl(":"hsla("}${Xn(this.h)}, ${100*Fn(this.s)}%, ${100*Fn(this.l)}%${1===e?")":`, ${e})`}`}})),n.dn(Wn),n.dn(Gn);const Un=e=>()=>e;function Qn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Un(isNaN(e)?t:e)}n.dn(Un);const Jn=function e(t){var n=function(e){return 1===(e=+e)?Qn:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):Un(isNaN(t)?n:t)}}(t);function o(e,t){var o=n((e=An(e)).r,(t=An(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),s=Qn(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=s(t),e+""}}return o.gamma=e,o}(1);function eo(e){return function(t){var n,o,r=t.length,i=new Array(r),s=new Array(r),a=new Array(r);for(n=0;n<r;++n)o=An(t[n]),i[n]=o.r||0,s[n]=o.g||0,a[n]=o.b||0;return i=e(i),s=e(s),a=e(a),o.opacity=1,function(e){return o.r=i(e),o.g=s(e),o.b=a(e),o+""}}}eo(Wn),eo(Gn),n.dn(oo);var to=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,no=new RegExp(to.source,"g");function oo(e,t){var n,o,r,i=to.lastIndex=no.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=to.exec(e))&&(o=no.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:en(n,o)})),i=no.lastIndex;return i<t.length&&(r=t.slice(i),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)a[(n=l[o]).i]=n.x(e);return a.join("")})}function ro(e,t){var n;return("number"==typeof t?en:t instanceof In?Jn:(n=In(t))?(t=n,Jn):oo)(e,t)}function io(e){return function(){this.removeAttribute(e)}}function so(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ao(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function lo(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function co(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttribute(e)}}function uo(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttributeNS(e.space,e.local)}}function fo(e,t){var n=te(e),o="transform"===n?ln:ro;return this.attrTween(e,"function"==typeof t?(n.local?uo:co)(n,o,fn(this,"attr."+e,t)):null==t?(n.local?so:io)(n):(n.local?lo:ao)(n,o,t))}function ho(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function po(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function go(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=te(e);return this.tween(n,(o.local?ho:po)(o,t))}function mo(e,t){return function(){Wt(this,e).delay=+t.apply(this,arguments)}}function yo(e,t){return t=+t,function(){Wt(this,e).delay=t}}function xo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?mo:yo)(t,e)):Ut(this.node(),t).delay}function vo(e,t){return function(){Gt(this,e).duration=+t.apply(this,arguments)}}function wo(e,t){return t=+t,function(){Gt(this,e).duration=t}}function bo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?vo:wo)(t,e)):Ut(this.node(),t).duration}function _o(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Gt(this,e).ease=t}}(t,e)):Ut(this.node(),t).ease}function So(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Gt(this,e).ease=n}}(this._id,e))}function ko(e){"function"!=typeof e&&(e=S(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new $o(o,this._parents,this._name,this._id)}function Co(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l,c=t[a],d=n[a],u=c.length,f=s[a]=new Array(u),h=0;h<u;++h)(l=c[h]||d[h])&&(f[h]=l);for(;a<o;++a)s[a]=t[a];return new $o(s,this._parents,this._name,this._id)}function No(e,t){var n=this._id;return arguments.length<2?Ut(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Wt:Gt;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}(n,e,t))}function Eo(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))}function Mo(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a,l,c=o[s],d=c.length,u=i[s]=new Array(d),f=0;f<d;++f)(a=c[f])&&(l=e.call(a,a.__data__,f,c))&&("__data__"in a&&(l.__data__=a.__data__),u[f]=l,Kt(u[f],t,n,f,u,Ut(a,n)));return new $o(i,this._parents,t,n)}function Po(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=b(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l,c=o[a],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var f,h=e.call(l,l.__data__,u,c),p=Ut(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&Kt(f,t,n,g,h,p);i.push(h),s.push(l)}return new $o(i,s,t,n)}n.dn(ro),n.dn(fo),n.dn(go),n.dn(xo),n.dn(bo),n.dn(_o),n.dn(So),n.dn(ko),n.dn(Co),n.dn(No),n.dn(Eo),n.dn(Mo),n.dn(Po),n.dn(Do);var jo=ct.prototype.constructor;function Do(){return new jo(this._groups,this._parents)}function Io(e){return function(){this.style.removeProperty(e)}}function Oo(e,t,n){var o="transform"==(e+="")?an:ro;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=pe(this,e),s=(this.style.removeProperty(e),pe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}(e,o)).on("end.style."+e,Io(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var s=pe(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=pe(this,e)),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}(e,o,fn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,s="style."+t,a="end."+s;return function(){var l=Gt(this,e),c=l.on,d=null==l.value[s]?i||(i=Io(t)):void 0;c===n&&r===d||(o=(n=c).copy()).on(a,r=d),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var s=pe(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}(e,o,t),n).on("end.style."+e,null)}function zo(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,n??""))}function Ao(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(fn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))}function Ro(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))}function Lo(){for(var e=this._name,t=this._id,n=Vo(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)if(s=a[c]){var d=Ut(s,t);Kt(s,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new $o(o,this._parents,e,n)}function To(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){0===--r&&i()}};n.each(function(){var n=Gt(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t}),0===r&&i()})}n.dn(Oo),n.dn(zo),n.dn(Ao),n.dn(Ro),n.dn(Lo),n.dn(To);var Bo=0;function $o(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vo(){return++Bo}var Ho=ct.prototype;$o.prototype=function(e){return ct().transition(e)}.prototype={constructor:$o,select:Mo,selectAll:Po,selectChild:Ho.selectChild,selectChildren:Ho.selectChildren,filter:ko,merge:Co,selection:Do,transition:Lo,call:Ho.call,nodes:Ho.nodes,node:Ho.node,size:Ho.size,empty:Ho.empty,each:Ho.each,on:No,attr:fo,attrTween:go,style:Oo,styleTween:zo,text:Ao,textTween:Ro,remove:Eo,tween:un,delay:xo,duration:bo,ease:_o,easeVarying:So,end:To,[Symbol.iterator]:Ho[Symbol.iterator]},n.dn(Xo);var Zo={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Yo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Xo(e){var t,n;e instanceof $o?(t=e._id,e=e._name):(t=Vo(),(n=Zo).time=Tt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)(s=a[c])&&Kt(s,e,t,c,a,n||Yo(s,t));return new $o(o,this._parents,e,t)}ct.prototype.interrupt=Jt,ct.prototype.transition=Xo;const Fo=e=>()=>e;function qo(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ko(e,t,n){this.k=e,this.x=t,this.y=n}n.dn(Fo),Ko.prototype={constructor:Ko,scale:function(e){return 1===e?this:new Ko(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Ko(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Wo=new Ko(1,0,0);function Go(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Wo;return e.__zoom}function Uo(e){e.stopImmediatePropagation()}function Qo(e){e.preventDefault(),e.stopImmediatePropagation()}function Jo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function er(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function tr(){return this.__zoom||Wo}function nr(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function or(){return navigator.maxTouchPoints||"ontouchstart"in this}function rr(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ir(){var e,t,n,o=Jo,r=er,i=rr,s=nr,a=or,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Et,f=m("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",tr).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",C).filter(a).on("touchstart.zoom",N).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Ko(t,e.x,e.y)}function x(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Ko(e.k,o,r)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){b(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,s=b(e,i).event(o),a=r.apply(e,i),l=null==n?v(a):"function"==typeof n?n.apply(e,i):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),d=e.__zoom,f="function"==typeof t?t.apply(e,i):t,h=u(d.invert(l).concat(c/d.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=c/t[2];e=new Ko(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new _(e,t)}function _(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function S(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,a=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,s.apply(this,arguments)))),d=ft(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=r.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(r.k===a)return;n.mouse=[d,r.invert(d)],Qt(this),n.start()}Qo(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(x(y(r,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function k(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=b(this,t,!0).event(e),a=dt(e.view).on("mousemove.zoom",function(e){if(Qo(e),!s.moved){var t=e.clientX-d,n=e.clientY-u;s.moved=t*t+n*n>h}s.event(e).zoom("mouse",i(x(s.that.__zoom,s.mouse[0]=ft(e,r),s.mouse[1]),s.extent,c))},!0).on("mouseup.zoom",function(e){a.on("mousemove.zoom mouseup.zoom",null),xt(e.view,s.moved),Qo(e),s.event(e).end()},!0),l=ft(e,r),d=e.clientX,u=e.clientY;yt(e.view),Uo(e),s.mouse=[l,this.__zoom.invert(l)],Qt(this),s.start()}}function C(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=ft(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=i(x(y(n,l),s,a),r.apply(this,t),c);Qo(e),d>0?dt(this).transition().duration(d).call(w,u,s,e):dt(this).call(g.transform,u,s,e)}}function N(n,...r){if(o.apply(this,arguments)){var i,s,a,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(Uo(n),s=0;s<d;++s)l=[l=ft(a=c[s],this),this.__zoom.invert(l),a.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,i=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(u.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),Qt(this),u.start())}}function E(e,...t){if(this.__zooming){var n,o,r,s,a=b(this,t).event(e),l=e.changedTouches,d=l.length;for(Qo(e),n=0;n<d;++n)r=ft(o=l[n],this),a.touch0&&a.touch0[2]===o.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===o.identifier&&(a.touch1[0]=r);if(o=a.that.__zoom,a.touch1){var u=a.touch0[0],f=a.touch0[1],h=a.touch1[0],p=a.touch1[1],g=(g=h[0]-u[0])*g+(g=h[1]-u[1])*g,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;o=y(o,Math.sqrt(g/m)),r=[(u[0]+h[0])/2,(u[1]+h[1])/2],s=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],s=a.touch0[1]}a.zoom("touch",i(x(o,r,s),a.extent,c))}}function M(e,...o){if(this.__zooming){var r,i,s=b(this,o).event(e),a=e.changedTouches,l=a.length;for(Uo(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=a[r],s.touch0&&s.touch0[2]===i.identifier?delete s.touch0:s.touch1&&s.touch1[2]===i.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(i=ft(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=dt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",tr),e!==r?w(e,t,n,o):r.interrupt().each(function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,o){g.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},g.scaleTo=function(e,t,n,o){g.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,a=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return i(x(y(o,l),s,a),e,c)},n,o)},g.translateBy=function(e,t,n,o){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)},null,o)},g.translateTo=function(e,t,n,o,s){g.transform(e,function(){var e=r.apply(this,arguments),s=this.__zoom,a=null==o?v(e):"function"==typeof o?o.apply(this,arguments):o;return i(Wo.translate(a[0],a[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},o,s)},_.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=dt(this.that).datum();f.call(e,this.that,new qo(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:f}),t)}},g.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:Fo(+e),g):s},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Fo(!!e),g):o},g.touchable=function(e){return arguments.length?(a="function"==typeof e?e:Fo(!!e),g):a},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Fo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):r},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(d=+e,g):d},g.interpolate=function(e){return arguments.length?(u=e,g):u},g.on=function(){var e=f.on.apply(f,arguments);return e===f?g:e},g.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,g):Math.sqrt(h)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}function sr(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),s=new Array(o);for(n=0;n<r;++n)i[n]=dr(e[n],t[n]);for(;n<o;++n)s[n]=t[n];return function(e){for(n=0;n<r;++n)s[n]=i[n](e);return s}}function ar(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function lr(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=dr(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}function cr(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function dr(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?Un(t):("number"===r?en:"string"===r?(n=In(t))?(t=n,Jn):oo:t instanceof In?Jn:t instanceof Date?ar:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?sr:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?lr:en:cr))(e,t)}Go.prototype=Ko.prototype,n.dn(Qo),n.dn(ir),n.dn(function(e,t){return((void 0)(t)?void 0:sr)(e,t)}),n.dn(ar),n.dn(lr),n.dn(cr),n.dn(dr);const ur=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],fr=["Enter"," ","Escape"],hr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var pr,gr,mr;!function(e){e.Strict="strict",e.Loose="loose"}(pr||(pr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(gr||(gr={})),function(e){e.Partial="partial",e.Full="full"}(mr||(mr={}));const yr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xr,vr,wr;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(xr||(xr={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(vr||(vr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(wr||(wr={}));const br={[wr.Left]:wr.Right,[wr.Right]:wr.Left,[wr.Top]:wr.Bottom,[wr.Bottom]:wr.Top},_r=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,Sr=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),kr=(e,t=[0,0])=>{const{width:n,height:o}=Gr(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Cr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=Or(n,Lr(e)),o=!0)}),o?Ar(n):{x:0,y:0,width:0,height:0}},Nr=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,c=t.width/r,d=t.height/r,u=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(s&&!n||o)continue;const r=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:h,y:p}=t.internals.positionAbsolute,g=Br(a,l,c,d,h,p,r,f),m=r*f,y=i&&g>0;(!t.internals.handleBounds||y||g>=m||t.dragging)&&u.push(t)}return u};function Er({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let u=s.extent||r;if("parent"!==s.extent||s.expandParent)a&&Wr(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);else if(a){const{width:e,height:t}=Gr(a);e&&t&&(u=[[l,c],[l+e,c+t]])}else i?.("005","Only child nodes can use a parent extent.");const f=Wr(u)?Pr(t,u,s.measured):t;return void 0!==s.measured.width&&void 0!==s.measured.height||i?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:f.x-l+(s.measured.width??0)*d[0],y:f.y-c+(s.measured.height??0)*d[1]},positionAbsolute:f}}const Mr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pr=(e={x:0,y:0},t,n)=>({x:Mr(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Mr(e.y,t[0][1],t[1][1]-(n?.height??0))});function jr(e,t,n){const{width:o,height:r}=Gr(n),{x:i,y:s}=n.internals.positionAbsolute;return Pr(e,[[i,s],[i+o,s+r]],t)}const Dr=(e,t,n)=>e<t?Mr(Math.abs(e-t),1,t)/t:e>n?-Mr(Math.abs(e-n),1,t)/t:0,Ir=(e,t,n=15,o=40)=>[Dr(e.x,o,t.width-o)*n,Dr(e.y,o,t.height-o)*n],Or=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),zr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Ar=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Rr=(e,t=[0,0])=>{const{x:n,y:o}=Sr(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Lr=(e,t=[0,0])=>{const{x:n,y:o}=Sr(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Tr=(e,t)=>Ar(Or(zr(e),zr(t))),Br=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),c=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*c)},$r=(e,t)=>Br(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vr=e=>Hr(e.width)&&Hr(e.height)&&Hr(e.x)&&Hr(e.y),Hr=e=>!isNaN(e)&&isFinite(e),Zr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Yr=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Zr(a,s):a},Xr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Fr(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const qr=(e,t,n,o,r,i)=>{const s=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Fr(e,n),r=Fr(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Fr(e.top??e.y??0,n),r=Fr(e.bottom??e.y??0,n),i=Fr(e.left??e.x??0,t),s=Fr(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=Mr(c,o,r),u=t/2-(e.x+e.width/2)*d,f=n/2-(e.y+e.height/2)*d,h=function(e,t,n,o,r,i){const{x:s,y:a}=Xr(e,[t,n,o]),{x:l,y:c}=Xr({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}(e,u,f,d,t,n),p=Math.min(h.left-s.left,0),g=Math.min(h.top-s.top,0);return{x:u-p+Math.min(h.right-s.right,0),y:f-g+Math.min(h.bottom-s.bottom,0),zoom:d}},Kr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Wr(e){return null!=e&&"parent"!==e}function Gr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ur(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Qr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const e=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Jr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ei(e){return{...hr,...e||{}}}function ti(e){return null===e?null:e?"valid":"invalid"}function ni(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=li(e),a=Yr({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Zr(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const oi=e=>({width:e.offsetWidth,height:e.offsetHeight}),ri=e=>e?.getRootNode?.()||window?.document,ii=["INPUT","SELECT","TEXTAREA"];function si(e){const t=e.composedPath?.()?.[0]||e.target;return 1===t?.nodeType&&(ii.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}const ai=e=>"clientX"in e,li=(e,t)=>{const n=ai(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ci=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...oi(t)}}):null};function di({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*i+.375*a+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ui(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function fi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case wr.Left:return[t-ui(t-o,i),n];case wr.Right:return[t+ui(o-t,i),n];case wr.Top:return[t,n-ui(n-r,i)];case wr.Bottom:return[t,n+ui(r-n,i)]}}function hi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,curvature:s=.25}){const[a,l]=fi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=fi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,h,p]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,u,f,h,p]}function pi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[i,o<t?o+s:o-s,r,s]}function gi({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Or(Lr(e),Lr(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $r(s,Ar(i))>0}const mi=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function yi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=pi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const xi={[wr.Left]:{x:-1,y:0},[wr.Right]:{x:1,y:0},[wr.Top]:{x:0,y:-1},[wr.Bottom]:{x:0,y:1}},vi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wi(e,t,n,o){const r=Math.min(vi(e,t)/2,vi(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s)return`L ${i+r*(e.x<n.x?-1:1)},${s}Q ${i},${s} ${i},${s+r*(e.y<n.y?1:-1)}`;const a=e.x<n.x?1:-1;return`L ${i},${s+r*(e.y<n.y?-1:1)}Q ${i},${s} ${i+r*a},${s}`}function bi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:d=.5}){const[u,f,h,p,g]=function({source:e,sourcePosition:t=wr.Bottom,target:n,targetPosition:o=wr.Top,center:r,offset:i,stepPosition:s}){const a=xi[t],l=xi[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},u=(({source:e,sourcePosition:t=wr.Bottom,target:n})=>t===wr.Left||t===wr.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:d}),f=0!==u.x?"x":"y",h=u[f];let p,g,m=[];const y={x:0,y:0},x={x:0,y:0},[,,v,w]=pi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){"x"===f?(p=r.x??c.x+(d.x-c.x)*s,g=r.y??(c.y+d.y)/2):(p=r.x??(c.x+d.x)/2,g=r.y??c.y+(d.y-c.y)*s);const e=[{x:p,y:c.y},{x:p,y:d.y}],t=[{x:c.x,y:g},{x:d.x,y:g}];m=a[f]===h?"x"===f?e:t:"x"===f?t:e}else{const r=[{x:c.x,y:d.y}],s=[{x:d.x,y:c.y}];if(m="x"===f?a.x===h?s:r:a.y===h?r:s,t===o){const t=Math.abs(e[f]-n[f]);if(t<=i){const o=Math.min(i-1,i-t);a[f]===h?y[f]=(c[f]>e[f]?-1:1)*o:x[f]=(d[f]>n[f]?-1:1)*o}}if(t!==o){const e="x"===f?"y":"x",t=a[f]===l[e],n=c[e]>d[e],o=c[e]<d[e];(1===a[f]&&(!t&&n||t&&o)||1!==a[f]&&(!t&&o||t&&n))&&(m="x"===f?r:s)}const u={x:c.x+y.x,y:c.y+y.y},v={x:d.x+x.x,y:d.y+x.y};Math.max(Math.abs(u.x-m[0].x),Math.abs(v.x-m[0].x))>=Math.max(Math.abs(u.y-m[0].y),Math.abs(v.y-m[0].y))?(p=(u.x+v.x)/2,g=m[0].y):(p=m[0].x,g=(u.y+v.y)/2)}const b={x:c.x+y.x,y:c.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...b.x!==m[0].x||b.y!==m[0].y?[b]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],p,g,v,w]}({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});let m=`M${u[0].x} ${u[0].y}`;for(let e=1;e<u.length-1;e++)m+=wi(u[e-1],u[e],u[e+1],s);return m+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[m,f,h,p,g]}function _i(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Si(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function ki(e,t,n=wr.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Gr(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case wr.Top:return{x:r+s/2,y:i};case wr.Right:return{x:r+s,y:i+a/2};case wr.Bottom:return{x:r+s/2,y:i+a};case wr.Left:return{x:r,y:i+a/2}}}function Ci(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Ni(e,t){return e?"string"==typeof e?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`:""}const Ei={nodeOrigin:[0,0],nodeExtent:ur,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Mi={...Ei,checkEquality:!0};function Pi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function ji(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const t of e.handles){const r={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};"source"===t.type?n.push(r):"target"===t.type&&o.push(r)}return{source:n,target:o}}function Di(e){return"manual"===e}function Ii(e,t,n,o={}){const r=Pi(Mi,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Di(r.zIndexMode)?1e3:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const d of e){let e=s.get(d.id);if(r.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{const n=kr(d,r.nodeOrigin),o=Wr(d.extent)?d.extent:r.nodeExtent,i=Pr(n,o,Gr(d));e={...r.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:i,handleBounds:ji(d,e),z:zi(d,a,r.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),d.parentId&&Oi(e,t,n,o,i),c||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function Oi(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Pi(Ei,o),c=e.parentId,d=t.get(c);if(!d)return void console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),r&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===l&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+10*r.i),r&&void 0!==d.internals.rootParentIndex&&(r.i=d.internals.rootParentIndex);const u=i&&!Di(l)?1e3:0,{x:f,y:h,z:p}=function(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Gr(e),c=kr(e,n),d=Wr(e.extent)?Pr(c,e.extent,l):c;let u=Pr({x:s+d.x,y:a+d.y},o,l);"parent"===e.extent&&(u=jr(u,l,t));const f=zi(e,r,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}(e,d,s,a,u,l),{positionAbsolute:g}=e.internals,m=f!==g.x||h!==g.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:f,y:h}:g,z:p}})}function zi(e,t,n){const o=Hr(e.zIndex)?e.zIndex:0;return Di(n)?o:o+(e.selected?t:0)}function Ai(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Rr(e),r=Tr(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},s)=>{const a=i.internals.positionAbsolute,l=Gr(i),c=i.origin??o,d=t.x<a.x?Math.round(Math.abs(a.x-t.x)):0,u=t.y<a.y?Math.round(Math.abs(a.y-t.y)):0,f=Math.max(l.width,Math.round(t.width)),h=Math.max(l.height,Math.round(t.height)),p=(f-l.width)*c[0],g=(h-l.height)*c[1];(d>0||u>0||p||g)&&(r.push({id:s,type:"position",position:{x:i.position.x-d+p,y:i.position.y-u+g}}),n.get(s)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+u}})})),(l.width<t.width||l.height<t.height||d||u)&&r.push({id:s,type:"dimensions",setAttributes:!0,dimensions:{width:f+(d?c[0]*d-p:0),height:h+(u?c[1]*u-g:0)}})}),r}function Ri(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const a=o.get(s)||new Map;o.set(s,a.set(n,t))}}function Li(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:s=null}=o,a={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:s},l=`${n}-${i}--${r}-${s}`;Ri("source",a,`${r}-${s}--${n}-${i}`,e,n,i),Ri("target",a,l,e,r,s),t.set(o.id,o)}}function Ti(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Ti(n,t))}function Bi(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function $i({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Vi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a="strict"===r?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(e=>e.id===n):a?.[0])??null;return l&&i?{...l,...ki(s,l,l.position,!0)}:l}function Hi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Zi=()=>!0;function Yi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Zi,nodeLookup:d}){const u="target"===i,f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=li(e),g=s.elementFromPoint(h,p),m=g?.classList.contains(`${a}-flow__handle`)?g:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Hi(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),s=m.classList.contains("connectable"),a=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:u?t:o,sourceHandle:u?i:r,target:u?o:t,targetHandle:u?r:i};y.connection=l;const f=s&&a&&(n===pr.Strict?u&&"source"===e||!u&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=Vi(t,e,i,d,n,!0)}return y}const Xi={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:m,isValidConnection:y=Zi,onReconnectEnd:x,updateConnection:v,getTransform:w,getFromHandle:b,autoPanSpeed:_,dragThreshold:S=1,handleDomNode:k}){const C=ri(e.target);let N,E=0;const{x:M,y:P}=li(e),j=Hi(i,k),D=a?.getBoundingClientRect();let I=!1;if(!D||!j)return;const O=Vi(r,j,o,l,t);if(!O)return;let z=li(e,D),A=!1,R=null,L=!1,T=null;function B(){if(!d||!D)return;const[e,t]=Ir(z,D,_);f({x:e,y:t}),E=requestAnimationFrame(B)}const $={...O,nodeId:r,type:j,position:O.position},V=l.get(r);let H={inProgress:!0,isValid:null,from:ki(V,$,wr.Left,!0),fromHandle:$,fromPosition:$.position,fromNode:V,to:z,toHandle:null,toPosition:br[$.position],toNode:null,pointer:z};function Z(){I=!0,v(H),p?.(e,{nodeId:r,handleId:o,handleType:j})}function Y(e){if(!I){const{x:t,y:n}=li(e),o=t-M,r=n-P;if(!(o*o+r*r>S*S))return;Z()}if(!b()||!$)return void X(e);const i=w();z=li(e,D),N=function(e,t,n,o){let r=[],i=1/0;const s=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())$r(r,Rr(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of s){const s=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const a of s){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:s,y:l}=ki(n,a,a.position,!0),c=Math.sqrt(Math.pow(s-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...a,x:s,y:l}],i=c):c===i&&r.push({...a,x:s,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}(Yr(z,i,!1,[1,1]),n,l,$),A||(B(),A=!0);const a=Yi(e,{handle:N,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:y,doc:C,lib:c,flowId:u,nodeLookup:l});T=a.handleDomNode,R=a.connection,L=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!N,a.isValid);const d=l.get(r),f=d?ki(d,$,wr.Left,!0):H.from,h={...H,from:f,isValid:L,to:a.toHandle&&L?Xr({x:a.toHandle.x,y:a.toHandle.y},i):z,toHandle:a.toHandle,toPosition:L&&a.toHandle?a.toHandle.position:br[$.position],toNode:a.toHandle?l.get(a.toHandle.nodeId):null,pointer:z};v(h),H=h}function X(e){if(!("touches"in e&&e.touches.length>0)){if(I){(N||T)&&R&&L&&g?.(R);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&x?.(e,o)}h(),cancelAnimationFrame(E),A=!1,L=!1,R=null,T=null,C.removeEventListener("mousemove",Y),C.removeEventListener("mouseup",X),C.removeEventListener("touchmove",Y),C.removeEventListener("touchend",X)}}0===S&&Z(),C.addEventListener("mousemove",Y),C.addEventListener("mouseup",X),C.addEventListener("touchmove",Y),C.addEventListener("touchend",X)},isValid:Yi},Fi=e=>({x:e.x,y:e.y,zoom:e.k}),qi=({x:e,y:t,zoom:n})=>Wo.translate(e,t).scale(n),Ki=(e,t)=>e.target.closest(`.${t}`),Wi=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Gi=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ui=(e,t=0,n=Gi,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Qi=e=>{const t=e.ctrlKey&&Kr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Ji({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let u=[[0,0],[d.width,d.height]];const f="undefined"!=typeof ResizeObserver?new ResizeObserver(e=>{const t=e[0];t&&(u=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);const h=ir().extent(()=>u).scaleExtent([t,n]).translateExtent(o),p=dt(e).call(h);v({x:r.x,y:r.y,zoom:Mr(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);const g=p.on("wheel.zoom"),m=p.on("dblclick.zoom");async function y(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).transform(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})}function x(){h.on("zoom",null)}async function v(e,t,n){const o=qi(e),r=h?.constrain()(o,t,n);return r&&await y(r),r}return h.wheelDelta(Qi),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:d,panOnScrollMode:u,panOnScrollSpeed:f,preventScrolling:y,zoomOnPinch:v,zoomOnScroll:w,zoomOnDoubleClick:b,panActivationKeyPressed:_=!1,zoomActivationKeyPressed:S,lib:k,onTransformChange:C,connectionInProgress:N,paneClickDistance:E,selectionOnDrag:M}){o&&!c.isZoomingOrPanning&&x();const P=r&&!S&&!o;h.clickDistance(M?1/0:!Hr(E)||E<0?0:E);const j=P?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(Ki(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const e=ft(d),t=Qi(d),r=u*Math.pow(2,t);return void o.scaleTo(n,r,e,d)}const f=1===d.deltaMode?20:1;let h=r===gr.Vertical?0:d.deltaX*f,p=r===gr.Horizontal?0:d.deltaY*f;!Kr()&&d.shiftKey&&r!==gr.Vertical&&(h=d.deltaY*f,p=0),o.translateBy(n,-h/u*i,-p/u*i,{internal:!0});const g=Fi(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,g):(e.isPanScrolling=!0,a?.(d,g)),e.panScrollTimeout=setTimeout(()=>{c?.(d,g),e.isPanScrolling=!1},150)}}({zoomPanValues:c,noWheelClassName:e,d3Selection:p,d3Zoom:h,panOnScrollMode:u,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,s=!t&&i&&!o.ctrlKey,a=Ki(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:y,d3ZoomHandler:g});p.on("wheel.zoom",j,{passive:!1});const D=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Fi(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});h.on("start",D);const I=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Wi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Fi(i.transform))}}({zoomPanValues:c,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:C});h.on("zoom",I);const O=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Wi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const t=Fi(s.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:d,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:a,onDraggingChange:l});h.on("end",O);const z=function({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return f=>{const h=t||n,p=o&&f.ctrlKey,g="wheel"===f.type;if(1===f.button&&"mousedown"===f.type&&(Ki(f,`${d}-flow__node`)||Ki(f,`${d}-flow__edge`)||Ki(f,`${d}-flow__selection`)||Ki(f,`${d}-flow__nodesselection`)))return!0;if(!(r||h||i||s||o))return!1;if(a)return!1;if(u&&!g)return!1;if(Ki(f,l)&&g)return!1;if(Ki(f,c)&&(!g||i&&g&&!t))return!1;if(!o&&f.ctrlKey&&g)return!1;if(!o&&"touchstart"===f.type&&f.touches?.length>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&g)return!1;if(!r&&("mousedown"===f.type||"touchstart"===f.type))return!1;if(Array.isArray(r)&&!r.includes(f.button)&&"mousedown"===f.type)return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g||e)&&m}}({panActivationKeyPressed:_,zoomActivationKeyPressed:S,panOnDrag:d,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:k,connectionInProgress:N});h.filter(z),b?p.on("dblclick.zoom",m):p.on("dblclick.zoom",null)},destroy:x,setViewport:async function(e,t){const n=qi(e);return await y(n,t),n},setViewportConstrained:v,getViewport:function(){const e=p?Go(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleTo(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleBy(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){h?.scaleExtent(e)},setTranslateExtent:function(e){h?.translateExtent(e)},syncViewport:function(e){if(p){const t=qi(e),n=p.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||h?.transform(p,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Hr(e)||e<0?0:e;h?.clickDistance(t)}}}var es;function ts(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function ns(e,t){return Math.max(0,t-e)}function os(e,t){return Math.max(0,e-t)}function rs(e,t,n){return Math.max(0,t-e,e-n)}function is(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(es||(es={}));const ss={width:0,height:0,x:0,y:0},as={...ss,pointerX:0,pointerY:0,aspectRatio:1};function ls(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}s();const cs=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},s=t=e(o,r,i);return i},{useDebugValue:ds}=a(),{useSyncExternalStoreWithSelector:us}=s(),fs=e=>e;function hs(e,t=fs,n){const o=us(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ds(o),o}const ps=(e,t)=>{const n=(e=>e?cs(e):cs)(e),o=(e,o=t)=>hs(n,e,o);return Object.assign(o,n),o};function gs(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ms=window.ReactDOM,ys=(0,a().createContext)(null),xs=ys.Provider,vs=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function ws(e,t){const n=(0,a().useContext)(ys);if(null===n)throw new Error(vs);return hs(n,e,t)}function bs(){const e=(0,a().useContext)(ys);if(null===e)throw new Error(vs);return(0,a().useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const _s={display:"none"},Ss={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ks="react-flow__node-desc",Cs="react-flow__edge-desc",Ns=e=>e.ariaLiveMessage,Es=e=>e.ariaLabelConfig;function Ms({rfId:e}){const t=ws(Ns);return(0,c.jsx)("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ss,children:t})}function Ps({rfId:e,disableKeyboardA11y:t}){const n=ws(Es);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{id:`${ks}-${e}`,style:_s,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,c.jsx)("div",{id:`${Cs}-${e}`,style:_s,children:n["edge.a11yDescription.default"]}),!t&&(0,c.jsx)(Ms,{rfId:e})]})}const js=(0,a().forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return(0,c.jsx)("div",{className:d(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});js.displayName="Panel";const Ds="https://reactflow.dev?utm_source=attribution";function Is({proOptions:e,position:t="bottom-right"}){return(0,a().useEffect)(()=>{},[]),e?.hideAttribution?null:(0,c.jsx)(js,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ds}`,children:(0,c.jsx)("a",{href:Ds,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Os=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},zs=e=>e.id;function As(e,t){return gs(e.selectedNodes.map(zs),t.selectedNodes.map(zs))&&gs(e.selectedEdges.map(zs),t.selectedEdges.map(zs))}function Rs({onSelectionChange:e}){const t=bs(),{selectedNodes:n,selectedEdges:o}=ws(Os,As);return(0,a().useEffect)(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(e=>e(r))},[n,o,e]),null}const Ls=e=>!!e.onSelectionChangeHandlers;function Ts({onSelectionChange:e}){const t=ws(Ls);return e||t?(0,c.jsx)(Rs,{onSelectionChange:e}):null}const Bs=[0,0],$s={x:0,y:0,zoom:1},Vs=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],Hs=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Zs={translateExtent:ur,nodeOrigin:Bs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ys(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c}=ws(Hs,gs),d=bs();(0,a().useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Zs,l()}),[]);const u=(0,a().useRef)(Zs);return(0,a().useEffect)(()=>{for(const a of Vs){const l=e[a];l!==u.current[a]&&void 0!==e[a]&&("nodes"===a?t(l):"edges"===a?n(l):"minZoom"===a?o(l):"maxZoom"===a?r(l):"translateExtent"===a?i(l):"nodeExtent"===a?s(l):"ariaLabelConfig"===a?d.setState({ariaLabelConfig:ei(l)}):"fitView"===a?d.setState({fitViewQueued:l}):"fitViewOptions"===a?d.setState({fitViewOptions:l}):d.setState({[a]:l}))}u.current=e},Vs.map(t=>e[t])),null}function Xs(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Fs="undefined"!=typeof document?document:null;function qs(e=null,t={target:Fs,actInsideInputWithModifier:!0}){const[n,o]=(0,a().useState)(!1),r=(0,a().useRef)(!1),i=(0,a().useRef)(new Set([])),[s,l]=(0,a().useMemo)(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace(/\+/g,"\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return(0,a().useEffect)(()=>{const n=t?.target??Fs,a=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{if(r.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!r.current||r.current&&!a)&&si(e))return!1;const n=Ws(e.code,l);if(i.current.add(e[n]),Ks(s,i.current,!1)){const n=e.composedPath?.()?.[0]||e.target,i="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!r.current&&i||e.preventDefault(),o(!0)}},c=e=>{const t=Ws(e.code,l);Ks(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),r.current=!1},d=()=>{i.current.clear(),o(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function Ks(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ws(e,t){return t.includes(e)?"code":"key"}function Gs(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)Us(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function Us(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured={...e.dimensions},e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function Qs(e,t){return Gs(e,t)}function Js(e,t){return Gs(e,t)}function ea(e,t){return{id:e,type:"select",selected:t}}function ta(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ea(i.id,e)))}return o}function na({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t)void 0===o.get(e)&&n.push({id:e,type:"remove"});return n}function oa(e){return{id:e.id,type:"remove"}}const ra=(e,t)=>{};const ia=e=>(e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function sa(e){return(0,a().forwardRef)(e)}const aa="undefined"!=typeof window?a().useLayoutEffect:a().useEffect;function la(e){const[t,n]=(0,a().useState)(BigInt(0)),[o]=(0,a().useState)(()=>function(){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n(e=>e+BigInt(1))}}}());return aa(()=>{const t=o.get();t.length&&(e(t),o.reset())},[t]),o}const ca=(0,a().createContext)(null);function da({children:e}){const t=bs(),n=(0,a().useCallback)(e=>{const{nodes:n=[],setNodes:o,hasDefaultNodes:r,onNodesChange:i,nodeLookup:s,fitViewQueued:a,onNodesChangeMiddlewareMap:l}=t.getState();let c=n;for(const t of e)c="function"==typeof t?t(c):t;let d=na({items:c,lookup:s});for(const e of l.values())d=e(d);r&&o(c),d.length>0?i?.(d):a&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:n,setNodes:o}=t.getState();e&&o(n)})},[]),o=la(n),r=la((0,a().useCallback)(e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:s}=t.getState();let a=n;for(const t of e)a="function"==typeof t?t(a):t;r?o(a):i&&i(na({items:a,lookup:s}))},[])),i=(0,a().useMemo)(()=>({nodeQueue:o,edgeQueue:r}),[]);return(0,c.jsx)(ca.Provider,{value:i,children:e})}const ua=e=>!!e.panZoom;function fa(){const e=(()=>{const e=bs();return(0,a().useMemo)(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{const{panZoom:o}=e.getState();return!!o&&o.scaleTo(t,n)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return!!s&&(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),!0)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=qr(t,o,r,i,s,n?.padding??.1);return!!a&&(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},d=n.snapGrid??r,u=n.snapToGrid??i;return Yr(c,o,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Xr(t,n);return{x:s.x+r,y:s.y+i}}}),[])})(),t=bs(),n=function(){const e=(0,a().useContext)(ca);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),o=ws(ua),r=(0,a().useMemo)(()=>{const e=e=>t.getState().nodeLookup.get(e),o=e=>{n.nodeQueue.push(e)},r=e=>{n.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=ia(e)?e:n.get(e.id),i=r.parentId?Qr(r.position,r.measured,r.parentId,n,o):r.position,s={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Rr(s)},s=(e,t,n={replace:!1})=>{o(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&ia(e)?e:{...o,...e}}return o}))},a=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&_r(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:o,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,s]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:s}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:s,triggerNodeChanges:a,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:d}=t.getState(),{nodes:u,edges:f}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),s=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&s.find(t=>t.id===e.parentId);(t||n)&&s.push(e)}const a=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(s,l),d=c;for(const e of l)a.has(e.id)&&!d.find(t=>t.id===e.id)&&d.push(e);if(!r)return{edges:d,nodes:s};const u=await r({nodes:s,edges:d});return"boolean"==typeof u?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:d}),h=f.length>0,p=u.length>0;if(h){const e=f.map(oa);s?.(f),l(e)}if(p){const e=u.map(oa);i?.(u),a(e)}return(p||h)&&c?.({nodes:u,edges:f}),{deletedNodes:u,deletedEdges:f}},getIntersectingNodes:(e,n=!0,o)=>{const r=Vr(e),s=r?e:i(e),a=void 0!==o;return s?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Rr(a?o:i),c=$r(l,s);return n&&c>0||c>=l.width*l.height||c>=s.width*s.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Vr(e)?e:i(e);if(!o)return!1;const r=$r(o,t);return n&&r>0||r>=t.width*t.height||r>=o.width*o.height},updateNode:s,updateNodeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:a,updateEdgeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};let n=!1;const o=e.reduce((e,o)=>{const r="string"==typeof o;let i=t.nodeLookup||r?void 0:o;return t.nodeLookup&&(i=r?t.nodeLookup.get(o):Sr(o)?o:t.nodeLookup.get(o.id)),i?(n=!0,Or(e,Lr(i,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Ar(o):{x:0,y:0,width:0,height:0}})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const o=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:o}),n.nodeQueue.push(e=>[...e]),o.promise}}},[]);return(0,a().useMemo)(()=>({...r,...e,viewportInitialized:o}),[o])}const ha=e=>e.selected,pa="undefined"!=typeof window?window:void 0,ga={position:"absolute",width:"100%",height:"100%",top:0,left:0},ma=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ya({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panActivationKeyPressed:r,panOnScrollSpeed:i=.5,panOnScrollMode:s=gr.Free,zoomOnDoubleClick:l=!0,panOnDrag:d=!0,defaultViewport:u,translateExtent:f,minZoom:h,maxZoom:p,zoomActivationKeyCode:g,preventScrolling:m=!0,children:y,noWheelClassName:x,noPanClassName:v,onViewportChange:w,isControlledViewport:b,paneClickDistance:_,selectionOnDrag:S}){const k=bs(),C=(0,a().useRef)(null),{userSelectionActive:N,lib:E,connectionInProgress:M}=ws(ma,gs),P=qs(g),j=(0,a().useRef)();!function(e){const t=bs();(0,a().useEffect)(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const n=oi(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004","The parent container needs a width and a height to render the graph."),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(C);const D=(0,a().useCallback)(e=>{w?.({x:e[0],y:e[1],zoom:e[2]}),b||k.setState({transform:e})},[w,b]);return(0,a().useEffect)(()=>{if(C.current){j.current=Ji({domNode:C.current,minZoom:h,maxZoom:p,translateExtent:f,viewport:u,onDraggingChange:e=>k.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=k.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=k.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=k.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=j.current.getViewport();return k.setState({panZoom:j.current,transform:[e,t,n],domNode:C.current.closest(".react-flow")}),()=>{j.current?.destroy()}}},[]),(0,a().useEffect)(()=>{j.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panActivationKeyPressed:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:d,zoomActivationKeyPressed:P,preventScrolling:m,noPanClassName:v,userSelectionActive:N,noWheelClassName:x,lib:E,onTransformChange:D,connectionInProgress:M,selectionOnDrag:S,paneClickDistance:_})},[e,t,n,o,r,i,s,l,d,P,m,v,N,x,E,D,M,S,_]),(0,c.jsx)("div",{className:"react-flow__renderer",ref:C,style:ga,children:y})}const xa=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function va(){const{userSelectionActive:e,userSelectionRect:t}=ws(xa,gs);return e&&t?(0,c.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const wa=(e,t)=>n=>{n.target===t.current&&e?.(n)},ba=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function _a({isSelecting:e,selectionKeyPressed:t,selectionMode:n=mr.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:g,onPaneMouseMove:m,onPaneMouseLeave:y,children:x}){const v=(0,a().useRef)(0),w=bs(),{userSelectionActive:b,elementsSelectable:_,dragging:S,panBy:k,autoPanSpeed:C}=ws(ba,gs),N=_&&(e||b),E=(0,a().useRef)(null),M=(0,a().useRef)(),P=(0,a().useRef)(new Set),j=(0,a().useRef)(new Set),D=(0,a().useRef)(!1),I=(0,a().useRef)(!1),O=(0,a().useRef)({x:0,y:0}),z=(0,a().useRef)(!1),A=e=>{if(I.current||D.current||w.getState().connection.inProgress)return I.current=!1,void(D.current=!1);f?.(e),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=p?e=>p(e):void 0;function L(e,t){const{userSelectionRect:o}=w.getState();if(!o)return;const{transform:r,nodeLookup:i,edgeLookup:s,connectionLookup:a,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:d}=w.getState(),u={x:o.startX,y:o.startY},{x:f,y:h}=Xr(u,r),p={startX:u.x,startY:u.y,x:e<f?e:f,y:t<h?t:h,width:Math.abs(e-f),height:Math.abs(t-h)},g=P.current,m=j.current;P.current=new Set(Nr(i,p,r,n===mr.Partial,!0).map(e=>e.id)),j.current=new Set;const y=d?.selectable??!0;for(const e of P.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=s.get(e);t&&(t.selectable??y)&&j.current.add(e)}}Jr(g,P.current)||l(ta(i,P.current,!0)),Jr(m,j.current)||c(ta(s,j.current)),w.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}function T(){if(!r||!M.current)return;const[e,t]=Ir(O.current,M.current,C);k({x:e,y:t}).then(e=>{if(!I.current||!e)return void(v.current=requestAnimationFrame(T));const{x:t,y:n}=O.current;L(t,n),v.current=requestAnimationFrame(T)})}const B=()=>{cancelAnimationFrame(v.current),v.current=0,z.current=!1};(0,a().useEffect)(()=>()=>B(),[]);const $=!0===o||Array.isArray(o)&&o.includes(0);return(0,c.jsxs)("div",{className:d(["react-flow__pane",{draggable:$,dragging:S,selection:e}]),onClick:N?void 0:wa(A,E),onContextMenu:wa(e=>{Array.isArray(o)&&o?.includes(2)?e.preventDefault():h?.(e)},E),onWheel:wa(R,E),onPointerEnter:N?void 0:g,onPointerMove:N?e=>{const{userSelectionRect:n,transform:o,resetSelectedElements:r}=w.getState();if(!M.current||!n)return;const{x:s,y:a}=li(e.nativeEvent,M.current);O.current={x:s,y:a};const c=Xr({x:n.startX,y:n.startY},o);if(!I.current){const n=t?0:i;if(Math.hypot(s-c.x,a-c.y)<=n)return;r(),l?.(e)}I.current=!0,z.current||(T(),z.current=!0),L(s,a)}:m,onPointerUp:e=>{N?0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===E.current&&w.getState().userSelectionRect&&A?.(e),w.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(u?.(e),w.setState({nodesSelectionActive:P.current.size>0})),B()):e.target===E.current&&w.getState().connection.inProgress&&(D.current=!0)},onPointerCancel:N?e=>{e.target?.releasePointerCapture?.(e.pointerId),B()}:void 0,onPointerDownCapture:N?n=>{if("touch"===n.pointerType&&!1!==o&&!t)return;const{domNode:r,transform:i}=w.getState();if(M.current=r?.getBoundingClientRect(),!M.current)return;const a=n.target===E.current;if(!a&&n.target.closest(".nokey")||!e||!(s&&a||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),I.current=!1;const{x:l,y:c}=li(n.nativeEvent,M.current),d=Yr({x:l,y:c},i);w.setState({userSelectionRect:{width:0,height:0,startX:d.x,startY:d.y,x:l,y:c}}),a||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:N?e=>{I.current&&(e.stopPropagation(),I.current=!1)}:void 0,onPointerLeave:y,ref:E,style:ga,children:[x,(0,c.jsx)(va,{})]})}function Sa({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",(e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`)(e))}function ka({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const l=bs(),[c,d]=(0,a().useState)(!1),u=(0,a().useRef)();return(0,a().useEffect)(()=>{if(!t)return u.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},d=null,u=!1,f=null,h=!1,p=!1,g=null;return{update:function({noDragClassName:m,handleSelector:y,domNode:x,isSelectable:v,nodeId:w,nodeClickDistance:b=0}){function _({x:e,y:n}){const{nodeLookup:r,nodeExtent:s,snapGrid:l,snapToGrid:c,nodeOrigin:d,onNodeDrag:u,onSelectionDrag:f,onError:h,updateNodePositions:m}=t();i={x:e,y:n};let y=!1;const x=a.size>1,v=x&&s?zr(Cr(a)):null,b=x&&c?function({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Zr(i,t);return{x:s.x-i.x,y:s.y-i.y}}({dragItems:a,snapGrid:l,x:e,y:n}):null;for(const[t,o]of a){if(!r.has(t))continue;let i={x:e-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:Zr(i,l));let a=null;if(x&&s&&!o.extent&&v){const{positionAbsolute:e}=o.internals,t=e.x-v.x+s[0][0],n=e.x+o.measured.width-v.x2+s[1][0];a=[[t,e.y-v.y+s[0][1]],[n,e.y+o.measured.height-v.y2+s[1][1]]]}const{position:u,positionAbsolute:f}=Er({nodeId:t,nextPosition:i,nodeLookup:r,nodeExtent:a||s,nodeOrigin:d,onError:h});y=y||o.position.x!==u.x||o.position.y!==u.y,o.position=u,o.internals.positionAbsolute=f}if(p=p||y,y&&(m(a,!0),g&&(o||u||!w&&f))){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});o?.(g,a,e,t),u?.(g,e,t),w||f?.(g,t)}}async function S(){if(!d)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(s);const[a,u]=Ir(c,d,o);0===a&&0===u||(i.x=(i.x??0)-a/e[2],i.y=(i.y??0)-u/e[2],await n({x:a,y:u})&&_(i)),s=requestAnimationFrame(S)}function k(o){const{nodeLookup:r,multiSelectionActive:s,nodesDraggable:l,transform:c,snapGrid:f,snapToGrid:h,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();u=!0,p&&v||s||!w||r.get(w)?.selected||y(),v&&p&&w&&e?.(w);const x=ni(o.sourceEvent,{transform:c,snapGrid:f,snapToGrid:h,containerBounds:d});if(i=x,a=function(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ti(s,e))&&(s.draggable||t&&void 0===s.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,x,w),a.size>0&&(n||g||!w&&m)){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});n?.(o.sourceEvent,a,e,t),g?.(o.sourceEvent,e,t),w||m?.(o.sourceEvent,t)}}f=dt(x);const C=Ct().clickDistance(b).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:s,snapToGrid:a}=t();d=n?.getBoundingClientRect()||null,h=!1,p=!1,g=e.sourceEvent,0===o&&k(e);const l=ni(e.sourceEvent,{transform:r,snapGrid:s,snapToGrid:a,containerBounds:d});i=l,c=li(e.sourceEvent,d)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:s,nodeDragThreshold:f,nodeLookup:p}=t(),m=ni(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:s,containerBounds:d});if(g=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||w&&!p.has(w))&&(h=!0),!h){if(!l&&n&&u&&(l=!0,S()),!u){const t=li(e.sourceEvent,d),n=t.x-c.x,o=t.y-c.y;Math.sqrt(n*n+o*o)>f&&k(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&a&&u&&(c=li(e.sourceEvent,d),_(m))}}).on("end",e=>{if(u&&!h){if(l=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:s}=t();if(p&&(o(a,!1),p=!1),r||i||!w&&s){const[t,o]=$i({nodeId:w,dragItems:a,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,a,t,o),i?.(e.sourceEvent,t,o),w||s?.(e.sourceEvent,o)}}}else h&&a.size>0&&t().updateNodePositions(a,!1)}).filter(e=>{const t=e.target;return!e.button&&(!m||!Bi(t,`.${m}`,x))&&(!y||Bi(t,y,x))});f.call(C)},destroy:function(){f?.on(".drag",null)}}}({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Sa({id:t,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,l,e]),(0,a().useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s})},[n,o,t,i,e,r,s]),c}function Ca(){const e=bs(),t=(0,a().useCallback)(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:s,updateNodePositions:a,nodeLookup:l,nodeOrigin:c}=e.getState(),d=new Map,u=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),f=o?r[0]:5,h=o?r[1]:5,p=t.direction.x*f*t.factor,g=t.direction.y*h*t.factor;for(const[,e]of l){if(!u(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};o&&(t=Zr(t,r));const{position:i,positionAbsolute:a}=Er({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:s});e.position=i,e.internals.positionAbsolute=a,d.set(e.id,e)}a(d)},[]);return t}const Na=(0,a().createContext)(null),Ea=Na.Provider;Na.Consumer;const Ma=()=>(0,a().useContext)(Na),Pa=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ja=(0,a().createContext)(null);function Da({children:e}){const t=ws(Pa,gs);return(0,c.jsx)(ja.Provider,{value:t,children:e})}const Ia={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Oa=(0,a().memo)(sa(function({type:e="source",position:t=wr.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:u,className:f,onMouseDown:h,onTouchStart:p,...g},m){const y=s||null,x="target"===e,v=bs(),w=Ma(),{connectOnClick:b,noPanClassName:_,rfId:S}=function(){const e=(0,a().useContext)(ja);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:k,connectingTo:C,clickConnecting:N,isPossibleEndHandle:E,connectionInProcess:M,clickConnectionInProcess:P,valid:j}=ws(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s;if(!a&&!r)return Ia;const d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:d,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===pr.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&c}})(w,y,e),gs);w||v.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");const D=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=v.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t,onError:n}=v.getState();t(function(e,t,n={}){return((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;const o=n.getEdgeId||mi;let r;return r=_r(e)?{...e}:{...e,id:o(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(r,t)?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r))})(e,t,{...n,onError:n.onError??ra})}(r,e,{onError:n}))}n?.(r),l?.(r)},I=e=>{if(!w)return;const t=ai(e.nativeEvent);if(r&&(t&&0===e.button||!t)){const t=v.getState();Xi.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:x,handleId:y,nodeId:w,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>v.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:D,isValidConnection:n||((...e)=>v.getState().isValidConnection?.(...e)??!0),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?h?.(e):p?.(e)};return(0,c.jsx)("div",{"data-handleid":y,"data-nodeid":w,"data-handlepos":t,"data-id":`${S}-${w}-${y}-${e}`,className:d(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,f,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:i,clickconnecting:N,connectingfrom:k,connectingto:C,valid:j,connectionindicator:o&&(!M||E)&&(M||P?i:r)}]),onMouseDown:I,onTouchStart:I,onClick:b?t=>{const{onClickConnectStart:o,onClickConnectEnd:i,connectionClickStartHandle:s,connectionMode:a,isValidConnection:l,lib:c,rfId:d,nodeLookup:u,connection:f}=v.getState();if(!w||!s&&!r)return;if(!s)return o?.(t.nativeEvent,{nodeId:w,handleId:y,handleType:e}),void v.setState({connectionClickStartHandle:{nodeId:w,type:e,id:y}});const h=ri(t.target),p=n||l,{connection:g,isValid:m}=Xi.isValid(t.nativeEvent,{handle:{nodeId:w,id:y,type:e},connectionMode:a,fromNodeId:s.nodeId,fromHandleId:s.id||null,fromType:s.type,isValidConnection:p,flowId:d,doc:h,lib:c,nodeLookup:u});m&&g&&D(g);const x=structuredClone(f);delete x.inProgress,x.toPosition=x.toHandle?x.toHandle.position:null,i?.(t,x),v.setState({connectionClickStartHandle:null})}:void 0,ref:m,...g,children:u})})),za={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Aa={input:function({data:e,isConnectable:t,sourcePosition:n=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[e?.label,(0,c.jsx)(Oa,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=wr.Top,sourcePosition:o=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label,(0,c.jsx)(Oa,{type:"source",position:o,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=wr.Top}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},Ra=e=>{const{width:t,height:n,x:o,y:r}=Cr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Hr(t)?t:null,height:Hr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function La({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=bs(),{width:r,height:i,transformString:s,userSelectionActive:l}=ws(Ra,gs),u=Ca(),f=(0,a().useRef)(null);(0,a().useEffect)(()=>{n||f.current?.focus({preventScroll:!0})},[n]);const h=!l&&null!==r&&null!==i;if(ka({nodeRef:f,disabled:!h}),!h)return null;const p=e?t=>{const n=o.getState().nodes.filter(e=>e.selected);e(t,n)}:void 0;return(0,c.jsx)("div",{className:d(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:(0,c.jsx)("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(za,e.key)&&(e.preventDefault(),u({direction:za[e.key],factor:e.shiftKey?4:1}))},style:{width:r,height:i}})})}const Ta="undefined"!=typeof window?window:void 0,Ba=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function $a({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:x,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:N,autoPanOnSelection:E,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,preventScrolling:I,onSelectionContextMenu:O,noWheelClassName:z,noPanClassName:A,disableKeyboardA11y:R,onViewportChange:L,isControlledViewport:T}){const{nodesSelectionActive:B,userSelectionActive:$}=ws(Ba,gs),V=qs(u,{target:Ta}),H=qs(y,{target:Ta}),Z=H||N,Y=H||_,X=f&&!0!==Z,F=V||$||X;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=bs(),{deleteElements:o}=fa(),r=qs(e,{actInsideInputWithModifier:!1}),i=qs(t,{target:pa});(0,a().useEffect)(()=>{if(r){const{edges:e,nodes:t}=n.getState();o({nodes:t.filter(ha),edges:e.filter(ha)}),n.setState({nodesSelectionActive:!1})}},[r]),(0,a().useEffect)(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:d,multiSelectionKeyCode:m}),(0,c.jsx)(ya,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:Y,panActivationKeyPressed:H,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:!V&&Z,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,zoomActivationKeyCode:x,preventScrolling:I,noWheelClassName:z,noPanClassName:A,onViewportChange:L,isControlledViewport:T,paneClickDistance:l,selectionOnDrag:X,children:(0,c.jsxs)(_a,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:Z,autoPanOnSelection:E,isSelecting:!!F,selectionMode:h,selectionKeyPressed:V,paneClickDistance:l,selectionOnDrag:X,children:[e,B&&(0,c.jsx)(La,{onSelectionContextMenu:O,noPanClassName:A,disableKeyboardA11y:R})]})})}$a.displayName="FlowRenderer";const Va=(0,a().memo)($a);const Ha=e=>e.updateNodeInternals;var Za=(0,a().memo)(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:f,nodesFocusable:h,resizeObserver:p,noDragClassName:g,noPanClassName:m,disableKeyboardA11y:y,rfId:x,nodeTypes:v,nodeClickDistance:w,onError:b}){const{node:_,internals:S,isParent:k}=ws(t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}},gs);let C=_.type||"default",N=v?.[C]||Aa[C];void 0===N&&(b?.("003",(e=>`Node type "${e}" not found. Using fallback type "default".`)(C)),C="default",N=v?.default||Aa.default);const E=!!(_.draggable||l&&void 0===_.draggable),M=!!(_.selectable||u&&void 0===_.selectable),P=!!(_.connectable||f&&void 0===_.connectable),j=!!(_.focusable||h&&void 0===_.focusable),D=bs(),I=Ur(_),O=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=bs(),i=(0,a().useRef)(null),s=(0,a().useRef)(null),l=(0,a().useRef)(e.sourcePosition),c=(0,a().useRef)(e.targetPosition),d=(0,a().useRef)(t),u=n&&!!e.internals.handleBounds;return(0,a().useEffect)(()=>{!i.current||e.hidden||u&&s.current===i.current||(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),(0,a().useEffect)(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),(0,a().useEffect)(()=>{if(i.current){const n=d.current!==t,o=l.current!==e.sourcePosition,s=c.current!==e.targetPosition;(n||o||s)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:_,nodeType:C,hasDimensions:I,resizeObserver:p}),z=ka({nodeRef:O,disabled:_.hidden||!E,noDragClassName:g,handleSelector:_.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:w}),A=Ca();if(_.hidden)return null;const R=Gr(_),L=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(_),T=M||E||t||n||o||r,B=n?e=>n(e,{...S.userNode}):void 0,$=o?e=>o(e,{...S.userNode}):void 0,V=r?e=>r(e,{...S.userNode}):void 0,H=i?e=>i(e,{...S.userNode}):void 0,Z=s?e=>s(e,{...S.userNode}):void 0;return(0,c.jsx)("div",{className:d(["react-flow__node",`react-flow__node-${C}`,{[m]:E},_.className,{selected:_.selected,selectable:M,parent:k,draggable:E,dragging:z}]),ref:O,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:I?"visible":"hidden",..._.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:$,onMouseLeave:V,onContextMenu:H,onClick:n=>{const{selectNodesOnDrag:o,nodeDragThreshold:r}=D.getState();M&&(!o||!E||r>0)&&Sa({id:e,store:D,nodeRef:O}),t&&t(n,{...S.userNode})},onDoubleClick:Z,onKeyDown:j?t=>{if(!si(t.nativeEvent)&&!y)if(fr.includes(t.key)&&M){const n="Escape"===t.key;Sa({id:e,store:D,unselect:n,nodeRef:O})}else if(E&&_.selected&&Object.prototype.hasOwnProperty.call(za,t.key)){t.preventDefault();const{ariaLabelConfig:e}=D.getState();D.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),A({direction:za[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:j?0:void 0,onFocus:j?()=>{if(y||!O.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=D.getState();r&&(Nr(new Map([[e,_]]),{x:0,y:0,width:n,height:o},t,!0).length>0||i(_.position.x+R.width/2,_.position.y+R.height/2,{zoom:t[2]}))}:void 0,role:_.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${ks}-${x}`,"aria-label":_.ariaLabel,..._.domAttributes,children:(0,c.jsx)(Ea,{value:e,children:(0,c.jsx)(N,{id:e,data:_.data,type:C,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:_.selected??!1,selectable:M,draggable:E,deletable:_.deletable??!0,isConnectable:P,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:z,dragHandle:_.dragHandle,zIndex:S.z,parentId:_.parentId,...R})})})});const Ya=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Xa(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=ws(Ya,gs),i=function(e){const t=ws((0,a().useCallback)((e=>t=>e?Nr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),gs);return t}(e.onlyRenderVisibleElements),s=function(){const e=ws(Ha),[t]=(0,a().useState)(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,a().useEffect)(()=>()=>{t?.disconnect()},[t]),t}();return(0,c.jsx)("div",{className:"react-flow__nodes",style:ga,children:i.map(i=>(0,c.jsx)(Za,{id:i,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:r},i))})}Xa.displayName="NodeRenderer";const Fa=(0,a().memo)(Xa),qa={[vr.Arrow]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return(0,c.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[vr.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,c.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},Ka=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const d=function(e){const t=bs();return(0,a().useMemo)(()=>Object.prototype.hasOwnProperty.call(qa,e)?qa[e]:(t.getState().onError?.("009",(e=>`Marker type "${e}" doesn't exist.`)(e)),null),[e])}(t);return d?(0,c.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:(0,c.jsx)(d,{color:n,strokeWidth:s})}):null},Wa=({defaultColor:e,rfId:t})=>{const n=ws(e=>e.edges),o=ws(e=>e.defaultEdgeOptions),r=(0,a().useMemo)(()=>{const r=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,s)=>([s.markerStart||o,s.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=Ni(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd});return r},[n,o,t,e]);return r.length?(0,c.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,c.jsx)("defs",{children:r.map(e=>(0,c.jsx)(Ka,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Wa.displayName="MarkerDefinitions";var Ga=(0,a().memo)(Wa);function Ua({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:f,...h}){const[p,g]=(0,a().useState)({x:1,y:0,width:0,height:0}),m=d(["react-flow__edge-textwrapper",f]),y=(0,a().useRef)(null);return(0,a().useEffect)(()=>{if(y.current){const e=y.current.getBBox();g({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,c.jsxs)("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:m,visibility:p.width?"visible":"hidden",...h,children:[r&&(0,c.jsx)("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),(0,c.jsx)("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:y,style:o,children:n}),u]}):null}Ua.displayName="EdgeText";const Qa=(0,a().memo)(Ua);function Ja({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:u=20,...f}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("path",{...f,d:e,fill:"none",className:d(["react-flow__edge-path",f.className])}),u?(0,c.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,o&&Hr(t)&&Hr(n)?(0,c.jsx)(Qa,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function el({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===wr.Left||e===wr.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function tl({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top}){const[s,a]=el({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=el({pos:i,x1:o,y1:r,x2:e,y2:t}),[d,u,f,h]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,d,u,f,h]}function nl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})=>{const[v,w,b]=tl({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),_=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:_,path:v,labelX:w,labelY:b,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})})}const ol=nl({isInternal:!1}),rl=nl({isInternal:!0});function il(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,sourcePosition:p=wr.Bottom,targetPosition:g=wr.Top,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=bi({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:g,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),S=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:S,path:w,labelX:b,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:y,interactionWidth:v})})}ol.displayName="SimpleBezierEdge",rl.displayName="SimpleBezierEdgeInternal";const sl=il({isInternal:!1}),al=il({isInternal:!0});function ll(e){return(0,a().memo)(({id:t,...n})=>{const o=e.isInternal?void 0:t;return(0,c.jsx)(sl,{...n,id:o,pathOptions:(0,a().useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}sl.displayName="SmoothStepEdge",al.displayName="SmoothStepEdgeInternal";const cl=ll({isInternal:!1}),dl=ll({isInternal:!0});function ul(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})=>{const[y,x,v]=yi({sourceX:n,sourceY:o,targetX:r,targetY:i}),w=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:w,path:y,labelX:x,labelY:v,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})})}cl.displayName="StepEdge",dl.displayName="StepEdgeInternal";const fl=ul({isInternal:!1}),hl=ul({isInternal:!0});function pl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=wr.Bottom,targetPosition:a=wr.Top,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=hi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:x?.curvature}),S=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:S,path:w,labelX:b,labelY:_,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})})}fl.displayName="StraightEdge",hl.displayName="StraightEdgeInternal";const gl=pl({isInternal:!1}),ml=pl({isInternal:!0});gl.displayName="BezierEdge",ml.displayName="BezierEdgeInternal";const yl={default:ml,straight:hl,step:dl,smoothstep:al,simplebezier:rl},xl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},vl=(e,t,n)=>n===wr.Left?e-t:n===wr.Right?e+t:e,wl=(e,t,n)=>n===wr.Top?e-t:n===wr.Bottom?e+t:e,bl="react-flow__edgeupdater";function _l({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return(0,c.jsx)("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:d([bl,`${bl}-${a}`]),cx:vl(t,o,e),cy:wl(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Sl({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:d,onReconnectStart:u,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=bs(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:o,domNode:r,connectionMode:i,connectionRadius:s,lib:a,onConnectStart:l,cancelConnection:c,nodeLookup:p,rfId:m,panBy:y,updateConnection:x}=g.getState(),v="target"===t.type;Xi.onPointerDown(e.nativeEvent,{autoPanOnConnect:o,connectionMode:i,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:p,isTarget:v,edgeUpdaterType:t.type,lib:a,flowId:m,cancelConnection:c,panBy:y,isValidConnection:(...e)=>g.getState().isValidConnection?.(...e)??!0,onConnect:e=>d?.(n,e),onConnectStart:(o,r)=>{h(!0),u?.(e,n,t.type),l?.(o,r)},onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),onReconnectEnd:(e,o)=>{h(!1),f?.(e,n,t.type,o)},updateConnection:x,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},y=()=>p(!0),x=()=>p(!1);return(0,c.jsxs)(c.Fragment,{children:[(!0===e||"source"===e)&&(0,c.jsx)(_l,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:e=>m(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:x,type:"source"}),(!0===e||"target"===e)&&(0,c.jsx)(_l,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:e=>m(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:x,type:"target"})]})}var kl=(0,a().memo)(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,rfId:y,edgeTypes:x,noPanClassName:v,onError:w,disableKeyboardA11y:b}){let _=ws(t=>t.edgeLookup.get(e));const S=ws(e=>e.defaultEdgeOptions);_=S?{...S,..._}:_;let k=_.type||"default",C=x?.[k]||yl[k];void 0===C&&(w?.("011",(e=>`Edge type "${e}" not found. Using fallback type "default".`)(k)),k="default",C=x?.default||yl.default);const N=!!(_.focusable||t&&void 0===_.focusable),E=void 0!==p&&(_.reconnectable||n&&void 0===_.reconnectable),M=!!(_.selectable||o&&void 0===_.selectable),P=(0,a().useRef)(null),[j,D]=(0,a().useState)(!1),[I,O]=(0,a().useState)(!1),z=bs(),{zIndex:A=_.zIndex,sourceX:R,sourceY:L,targetX:T,targetY:B,sourcePosition:$,targetPosition:V}=ws((0,a().useCallback)(t=>{const n=t.nodeLookup.get(_.source),o=t.nodeLookup.get(_.target);if(!n||!o)return xl;const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;const o=t.internals.handleBounds||Si(t.handles),r=n.internals.handleBounds||Si(n.handles),i=Ci(o?.source??[],e.sourceHandle),s=Ci(e.connectionMode===pr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`)(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||wr.Bottom,l=s?.position||wr.Top,c=ki(t,i,a),d=ki(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}({id:e,sourceNode:n,targetNode:o,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:t.connectionMode,onError:w}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){return"manual"===i?o:(r&&n?o+1e3:o)+Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0)}({selected:_.selected,zIndex:_.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...r||xl,zIndex:i}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex,w]),gs),H=(0,a().useMemo)(()=>_.markerStart?`url('#${Ni(_.markerStart,y)}')`:void 0,[_.markerStart,y]),Z=(0,a().useMemo)(()=>_.markerEnd?`url('#${Ni(_.markerEnd,y)}')`:void 0,[_.markerEnd,y]);if(_.hidden||null===R||null===L||null===T||null===B)return null;const Y=i?e=>{i(e,{..._})}:void 0,X=s?e=>{s(e,{..._})}:void 0,F=l?e=>{l(e,{..._})}:void 0,q=u?e=>{u(e,{..._})}:void 0,K=f?e=>{f(e,{..._})}:void 0;return(0,c.jsx)("svg",{style:{zIndex:A},children:(0,c.jsxs)("g",{className:d(["react-flow__edge",`react-flow__edge-${k}`,_.className,v,{selected:_.selected,animated:_.animated,inactive:!M&&!r,updating:j,selectable:M}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:o,multiSelectionActive:i}=z.getState();M&&(z.setState({nodesSelectionActive:!1}),_.selected&&i?(o({nodes:[],edges:[_]}),P.current?.blur()):n([e])),r&&r(t,_)},onDoubleClick:Y,onContextMenu:X,onMouseEnter:F,onMouseMove:q,onMouseLeave:K,onKeyDown:N?t=>{if(!b&&fr.includes(t.key)&&M){const{unselectNodesAndEdges:n,addSelectedEdges:o}=z.getState();"Escape"===t.key?(P.current?.blur(),n({edges:[_]})):o([e])}}:void 0,tabIndex:N?0:void 0,role:_.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===_.ariaLabel?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":N?`${Cs}-${y}`:void 0,ref:P,..._.domAttributes,children:[!I&&(0,c.jsx)(C,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:M,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:R,sourceY:L,targetX:T,targetY:B,sourcePosition:$,targetPosition:V,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:H,markerEnd:Z,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),E&&(0,c.jsx)(Sl,{edge:_,isReconnectable:E,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,sourceX:R,sourceY:L,targetX:T,targetY:B,sourcePosition:$,targetPosition:V,setUpdateHover:D,setReconnecting:O})]})})});const Cl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Nl({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,onError:b}=ws(Cl,gs),_=(S=t,ws((0,a().useCallback)(e=>{if(!S)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&gi({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[S]),gs));var S;return(0,c.jsxs)("div",{className:"react-flow__edges",children:[(0,c.jsx)(Ga,{defaultColor:e,rfId:n}),_.map(e=>(0,c.jsx)(kl,{id:e,edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:d,onMouseLeave:u,onClick:f,reconnectRadius:h,onDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:o,disableKeyboardA11y:y},e))]})}Nl.displayName="EdgeRenderer";const El=(0,a().memo)(Nl),Ml=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Pl({children:e}){const t=bs(),n=(0,a().useRef)(null),[o]=(0,a().useState)(()=>t.getState().transform);return aa(()=>{let e=null;const o=()=>{const o=t.getState().transform;e&&o[0]===e[0]&&o[1]===e[1]&&o[2]===e[2]||(e=o,n.current&&(n.current.style.transform=Ml(o)))};return o(),t.subscribe(o)},[t]),(0,c.jsx)("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Ml(o)},children:e})}const jl=e=>e.panZoom?.syncViewport;function Dl(e){return e.connection.inProgress?{...e.connection,to:Yr(e.connection.to,e.transform)}:{...e.connection}}const Il=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ol({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=ws(Il,gs);return i&&r&&l?(0,c.jsx)("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:(0,c.jsx)("g",{className:d(["react-flow__connection",ti(a)]),children:(0,c.jsx)(zl,{style:t,type:n,CustomComponent:o,isValid:a})})}):null}const zl=({style:e,type:t=xr.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:d,toNode:u,toHandle:f,toPosition:h,pointer:p}=ws(function(e){return e?t=>{const n=Dl(t);return e(n)}:Dl}(g),gs);var g;if(!r)return;if(n)return(0,c.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:l,toPosition:h,connectionStatus:ti(o),toNode:u,toHandle:f,pointer:p});let m="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:d.x,targetY:d.y,targetPosition:h};switch(t){case xr.Bezier:[m]=hi(y);break;case xr.SimpleBezier:[m]=tl(y);break;case xr.Step:[m]=bi({...y,borderRadius:0});break;case xr.SmoothStep:[m]=bi(y);break;default:[m]=yi(y)}return(0,c.jsx)("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};zl.displayName="ConnectionLine";const Al={};function Rl(e=Al){(0,a().useRef)(e),bs(),(0,a().useEffect)(()=>{},[e])}function Ll({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:p,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:v,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,deleteKeyCode:N,onlyRenderVisibleElements:E,elementsSelectable:M,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,preventScrolling:O,defaultMarkerColor:z,zoomOnScroll:A,zoomOnPinch:R,panOnScroll:L,panOnScrollSpeed:T,panOnScrollMode:B,zoomOnDoubleClick:$,panOnDrag:V,autoPanOnSelection:H,onPaneClick:Z,onPaneMouseEnter:Y,onPaneMouseMove:X,onPaneMouseLeave:F,onPaneScroll:q,onPaneContextMenu:K,paneClickDistance:W,nodeClickDistance:G,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,viewport:ue,onViewportChange:fe,nodesDraggable:he}){return Rl(e),Rl(t),bs(),(0,a().useRef)(!1),(0,a().useEffect)(()=>{},[]),function(e){const t=fa(),n=(0,a().useRef)(!1);(0,a().useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(n),function(e){const t=ws(jl),n=bs();(0,a().useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(ue),(0,c.jsx)(Va,{onPaneClick:Z,onPaneMouseEnter:Y,onPaneMouseMove:X,onPaneMouseLeave:F,onPaneContextMenu:K,onPaneScroll:q,paneClickDistance:W,deleteKeyCode:N,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,elementsSelectable:M,zoomOnScroll:A,zoomOnPinch:R,zoomOnDoubleClick:$,panOnScroll:L,panOnScrollSpeed:T,panOnScrollMode:B,panOnDrag:V,autoPanOnSelection:H,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,onSelectionContextMenu:h,preventScrolling:O,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,onViewportChange:fe,isControlledViewport:!!ue,children:(0,c.jsxs)(Pl,{children:[(0,c.jsx)(El,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,onlyRenderVisibleElements:E,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,defaultMarkerColor:z,noPanClassName:ae,disableKeyboardA11y:le,rfId:de}),(0,c.jsx)(Ol,{style:y,type:m,component:x,containerStyle:v}),(0,c.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,c.jsx)(Fa,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:G,onlyRenderVisibleElements:E,noPanClassName:ae,noDragClassName:ie,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,nodesDraggable:he}),(0,c.jsx)("div",{className:"react-flow__viewport-portal"})]})})}Ll.displayName="GraphView";const Tl=(0,a().memo)(Ll),Bl=(e,t)=>{},$l=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,p=new Map,g=new Map,m=new Map,y=o??t??[],x=n??e??[],v=d??[0,0],w=u??ur;Li(g,m,y);const{nodesInitialized:b}=Ii(x,h,p,{nodeOrigin:v,nodeExtent:w,zIndexMode:f});let _=[0,0,1];if(s&&r&&i){const e=Cr(h,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=qr(e,r,i,l,c,a?.padding??.1);_=[t,n,o]}return{rfId:"1",width:r??0,height:i??0,transform:_,nodes:x,nodesInitialized:b,nodeLookup:h,parentLookup:p,edges:y,edgeLookup:m,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:ur,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:pr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...yr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Bl,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:hr,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},Vl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>{return h=(h,p)=>{async function g(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:s,maxZoom:a}=p();t&&(await async function({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(0===e.size)return!0;const a=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let r;if(t?.includeHiddenNodes){const{width:t,height:n}=Gr(e);r=t>0&&n>0}else r=Boolean(e.measured.width&&e.measured.height&&!e.hidden);!r||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,s),l=Cr(a),c=qr(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}({nodes:e,width:r,height:i,panZoom:t,minZoom:s,maxZoom:a},n),o?.resolve(!0),h({fitViewResolver:null}))}return{...$l({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,fitViewQueued:s,zIndexMode:a,nodesSelectionActive:l}=p(),{nodesInitialized:c,hasSelectedNodes:d}=Ii(e,t,n,{nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:a}),u=l&&d;s&&c?(g(),h({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):h({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=p();Li(t,n,e),h({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=p();t(e),h({hasDefaultNodes:!0})}if(t){const{setEdges:e}=p();e(t),h({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:s,debug:a,fitViewQueued:l,zIndexMode:c}=p(),{changes:d,updatedInternals:u}=function(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),l=!0;continue}const a=oi(o.nodeElement),d=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(d||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),p=Wr(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;if(e.parentId&&"parent"===e.extent){const n=t.get(e.parentId);n&&(g=jr(g,a,n))}else p&&(g=Pr(g,p,a));const m={...e,measured:a,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:ci("source",o.nodeElement,h,u,e.id),target:ci("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,m),e.parentId&&Oi(m,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,d&&(c.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Rr(m,r)}))}}if(f.length>0){const e=Ai(f,t,n,r);c.push(...e)}return{changes:c,updatedInternals:l}}(e,n,o,r,i,s,c);u&&(function(e,t,n){const o=Pi(Ei,n);for(const n of e.values())if(n.parentId)Oi(n,e,t,o);else{const e=kr(n,o.nodeOrigin),t=Wr(n.extent)?n.extent:o.nodeExtent,r=Pr(e,t,Gr(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:s,zIndexMode:c}),l?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),d?.length>0&&(a&&console.log("React Flow: trigger node changes",d),t?.(d)))},updateNodePositions:(e,t=!1)=>{const n=[];let o=[];const{nodeLookup:r,triggerNodeChanges:i,connection:s,updateConnection:a,onNodesChangeMiddlewareMap:l}=p();for(const[i,l]of e){const e=r.get(i),c=!!(e?.expandParent&&e?.parentId&&l?.position),d={id:i,type:"position",position:c?{x:Math.max(0,l.position.x),y:Math.max(0,l.position.y)}:l.position,dragging:t};if(e&&s.inProgress&&s.fromNode.id===e.id){const t=ki(e,s.fromHandle,wr.Left,!0);a({...s,from:t})}c&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...l.internals.positionAbsolute,width:l.measured.width??0,height:l.measured.height??0}}),o.push(d)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),i=Ai(n,r,e,t);o.push(...i)}for(const e of l.values())o=e(o);i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=p();e?.length&&(r&&n(Qs(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=p();e?.length&&(r&&n(Js(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?r(e.map(e=>ea(e,!0))):(r(ta(o,new Set([...e]),!0)),i(ta(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?i(e.map(e=>ea(e,!0))):(i(ta(n,new Set([...e]))),r(ta(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:s}=p(),a=e||o,l=t||n,c=[];for(const e of a){if(!e.selected)continue;const t=r.get(e.id);t&&(t.selected=!1),c.push(ea(e.id,!1))}const d=[];for(const e of l)e.selected&&d.push(ea(e.id,!1));i(c),s(d)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),h({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),h({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),h({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=p();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]),s=e.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]);n(i),o(s)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:s,zIndexMode:a}=p();e[0][0]===s[0][0]&&e[0][1]===s[0][1]&&e[1][0]===s[1][0]&&e[1][1]===s[1][1]||(Ii(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1,zIndexMode:a}),h({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=p();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:s}=p();if(!s)return!1;const a=void 0!==n?.zoom?n.zoom:i;return await s.setViewport({x:o/2-e*a,y:r/2-t*a,zoom:a},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{h({connection:{...yr}})},updateConnection:e=>{h({connection:e})},reset:()=>h({...$l()})}},p=Object.is,h?ps(h,p):ps;var h,p};function Hl({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:d,fitView:u,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:g}){const[m]=(0,a().useState)(()=>Vl({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:u,minZoom:s,maxZoom:l,fitViewOptions:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}));return(0,c.jsx)(xs,{value:m,children:(0,c.jsx)(da,{children:(0,c.jsx)(Da,{children:g})})})}function Zl({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:l,fitViewOptions:d,minZoom:u,maxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g}){return(0,a().useContext)(ys)?(0,c.jsx)(c.Fragment,{children:e}):(0,c.jsx)(Hl,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:d,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g,children:e})}const Yl={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Xl=sa(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:f,onMove:h,onMoveStart:p,onMoveEnd:g,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onSelectionChange:I,onSelectionDragStart:O,onSelectionDrag:z,onSelectionDragStop:A,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:T,onBeforeDelete:B,connectionMode:$,connectionLineType:V=xr.Bezier,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:Y,deleteKeyCode:X="Backspace",selectionKeyCode:F="Shift",selectionOnDrag:q=!1,selectionMode:K=mr.Full,panActivationKeyCode:W="Space",multiSelectionKeyCode:G=(Kr()?"Meta":"Control"),zoomActivationKeyCode:U=(Kr()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:se=Bs,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:de=$s,minZoom:ue=.5,maxZoom:fe=2,translateExtent:he=ur,preventScrolling:pe=!0,nodeExtent:ge,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:xe=!0,panOnScroll:ve=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=gr.Free,zoomOnDoubleClick:_e=!0,panOnDrag:Se=!0,onPaneClick:ke,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je=1,nodeClickDistance:De=0,children:Ie,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:$e,reconnectRadius:Ve=10,onNodesChange:He,onEdgesChange:Ze,noDragClassName:Ye="nodrag",noWheelClassName:Xe="nowheel",noPanClassName:Fe="nopan",fitView:qe,fitViewOptions:Ke,connectOnClick:We,attributionPosition:Ge,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je=!0,elevateEdgesOnSelect:et=!1,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanOnSelection:rt=!0,autoPanSpeed:it,connectionRadius:st,isValidConnection:at,onError:lt,style:ct,id:dt,nodeDragThreshold:ut,connectionDragThreshold:ft,viewport:ht,onViewportChange:pt,width:gt,height:mt,colorMode:yt="light",debug:xt,onScroll:vt,ariaLabelConfig:wt,zIndexMode:bt="basic",..._t},St){const kt=dt||"1",Ct=function(e){const[t,n]=(0,a().useState)("system"===e?null:e);return(0,a().useEffect)(()=>{if("system"!==e)return void n(e);const t=Xs(),o=()=>n(t?.matches?"dark":"light");return o(),t?.addEventListener("change",o),()=>{t?.removeEventListener("change",o)}},[e]),null!==t?t:Xs()?.matches?"dark":"light"}(yt),Nt=(0,a().useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return(0,c.jsx)("div",{"data-testid":"rf__wrapper",..._t,onScroll:Nt,style:{...ct,...Yl},ref:St,className:d(["react-flow",r,Ct]),id:dt,role:"application",children:(0,c.jsxs)(Zl,{nodes:e,edges:t,width:gt,height:mt,fitView:qe,fitViewOptions:Ke,minZoom:ue,maxZoom:fe,nodeOrigin:se,nodeExtent:ge,zIndexMode:bt,children:[(0,c.jsx)(Ys,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:ue,maxZoom:fe,nodeExtent:ge,onNodesChange:He,onEdgesChange:Ze,snapToGrid:Q,snapGrid:J,connectionMode:$,translateExtent:he,connectOnClick:We,defaultEdgeOptions:Qe,fitView:qe,fitViewOptions:Ke,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onSelectionDrag:z,onSelectionDragStart:O,onSelectionDragStop:A,onMove:h,onMoveStart:p,onMoveEnd:g,noPanClassName:Fe,nodeOrigin:se,rfId:kt,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:it,onError:lt,connectionRadius:st,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:ft,onBeforeDelete:B,debug:xt,ariaLabelConfig:wt,zIndexMode:bt}),(0,c.jsx)(Tl,{onInit:f,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:s,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:Y,selectionKeyCode:F,selectionOnDrag:q,selectionMode:K,deleteKeyCode:X,multiSelectionKeyCode:G,panActivationKeyCode:W,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:de,translateExtent:he,minZoom:ue,maxZoom:fe,preventScrolling:pe,zoomOnScroll:ye,zoomOnPinch:xe,zoomOnDoubleClick:_e,panOnScroll:ve,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:Se,autoPanOnSelection:rt,onPaneClick:ke,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je,nodeClickDistance:De,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:T,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:$e,reconnectRadius:Ve,defaultMarkerColor:me,noDragClassName:Ye,noWheelClassName:Xe,noPanClassName:Fe,rfId:kt,disableKeyboardA11y:tt,nodeExtent:ge,viewport:ht,onViewportChange:pt,nodesDraggable:ne}),(0,c.jsx)(Ts,{onSelectionChange:I}),Ie,(0,c.jsx)(Is,{proOptions:Ue,position:Ge}),(0,c.jsx)(Ps,{rfId:kt,disableKeyboardA11y:tt})]})})});const Fl=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function ql({children:e}){const t=ws(Fl);return t?(0,ms.createPortal)(e,t):null}function Kl({dimensions:e,lineWidth:t,variant:n,className:o}){return(0,c.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:d(["react-flow__background-pattern",n,o])})}function Wl({radius:e,className:t}){return(0,c.jsx)("circle",{cx:e,cy:e,r:e,className:d(["react-flow__background-pattern","dots",t])})}var Gl;!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Gl||(Gl={}));const Ul={[Gl.Dots]:1,[Gl.Lines]:1,[Gl.Cross]:6},Ql=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Jl({id:e,variant:t=Gl.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:l,style:u,className:f,patternClassName:h}){const p=(0,a().useRef)(null),{transform:g,patternId:m}=ws(Ql,gs),y=o||Ul[t],x=t===Gl.Dots,v=t===Gl.Cross,w=Array.isArray(n)?n:[n,n],b=[w[0]*g[2]||1,w[1]*g[2]||1],_=y*g[2],S=Array.isArray(i)?i:[i,i],k=v?[_,_]:b,C=[S[0]*g[2]+k[0]/2,S[1]*g[2]+k[1]/2],N=`${m}${e||""}`;return(0,c.jsxs)("svg",{className:d(["react-flow__background",f]),style:{...u,...ga,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:p,"data-testid":"rf__background",children:[(0,c.jsx)("pattern",{id:N,x:g[0]%b[0],y:g[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:x?(0,c.jsx)(Wl,{radius:_/2,className:h}):(0,c.jsx)(Kl,{dimensions:k,lineWidth:r,variant:t,className:h})}),(0,c.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}Jl.displayName="Background";const ec=(0,a().memo)(Jl);function tc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,c.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function nc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,c.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function oc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,c.jsx)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function rc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ic(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sc({children:e,className:t,...n}){return(0,c.jsx)("button",{type:"button",className:d(["react-flow__controls-button",t]),...n,children:e})}const ac=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function lc({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:u,children:f,position:h="bottom-left",orientation:p="vertical","aria-label":g}){const m=bs(),{isInteractive:y,minZoomReached:x,maxZoomReached:v,ariaLabelConfig:w}=ws(ac,gs),{zoomIn:b,zoomOut:_,fitView:S}=fa(),k="horizontal"===p?"horizontal":"vertical";return(0,c.jsxs)(js,{className:d(["react-flow__controls",k,u]),position:h,style:e,"data-testid":"rf__controls","aria-label":g??w["controls.ariaLabel"],children:[t&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(sc,{onClick:()=>{b(),i?.()},className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:v,children:(0,c.jsx)(tc,{})}),(0,c.jsx)(sc,{onClick:()=>{_(),s?.()},className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:x,children:(0,c.jsx)(nc,{})})]}),n&&(0,c.jsx)(sc,{className:"react-flow__controls-fitview",onClick:()=>{S(r),a?.()},title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:(0,c.jsx)(oc,{})}),o&&(0,c.jsx)(sc,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),l?.(!y)},title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:y?(0,c.jsx)(ic,{}):(0,c.jsx)(rc,{})}),f]})}lc.displayName="Controls";const cc=(0,a().memo)(lc),dc=(0,a().memo)(function({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:u,borderRadius:f,shapeRendering:h,selected:p,onClick:g}){const{background:m,backgroundColor:y}=i||{},x=s||m||y;return(0,c.jsx)("rect",{className:d(["react-flow__minimap-node",{selected:p},u]),x:t,y:n,rx:f,ry:f,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:l},shapeRendering:h,onClick:g?t=>g(t,e):void 0})}),uc=e=>e.nodes.map(e=>e.id),fc=e=>e instanceof Function?e:()=>e,hc=(0,a().memo)(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:d,x:u,y:f,width:h,height:p}=ws(t=>{const n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};const o=n.internals.userNode,{x:r,y:i}=n.internals.positionAbsolute,{width:s,height:a}=Gr(o);return{node:o,x:r,y:i,width:s,height:a}},gs);return d&&!d.hidden&&Ur(d)?(0,c.jsx)(a,{x:u,y:f,width:h,height:p,style:d.style,selected:!!d.selected,className:o(d),color:t(d),borderRadius:r,strokeColor:n(d),strokeWidth:i,shapeRendering:s,onClick:l,id:d.id}):null});var pc=(0,a().memo)(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=dc,onClick:s}){const a=ws(uc,gs),l=fc(t),d=fc(e),u=fc(n),f="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,c.jsx)(c.Fragment,{children:a.map(e=>(0,c.jsx)(hc,{id:e,nodeColorFunc:l,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:f},e))})});const gc=e=>!e.hidden,mc=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};let n=!1;for(const t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?Tr(Cr(e.nodeLookup,{filter:gc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},yc=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,xc=(e,t)=>yc(e.viewBB,t.viewBB)&&yc(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function vc({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:f,maskStrokeColor:h,maskStrokeWidth:p,position:g="bottom-right",onClick:m,onNodeClick:y,pannable:x=!1,zoomable:v=!1,ariaLabel:w,inversePan:b,zoomStep:_=1,offsetScale:S=5}){const k=bs(),C=(0,a().useRef)(null),{boundingRect:N,panZoom:E,viewBB:M,rfId:P,translateExtent:j,flowWidth:D,flowHeight:I,ariaLabelConfig:O}=ws(mc,xc),z=e?.width??200,A=e?.height??150,R=N.width/z,L=N.height/A,T=Math.max(R,L),B=T*z,$=T*A,V=S*T,H=N.x-(B-N.width)/2-V,Z=N.y-($-N.height)/2-V,Y=B+2*V,X=$+2*V,F=`react-flow__minimap-desc-${P}`,q=(0,a().useRef)(0),K=(0,a().useRef)();q.current=T,(0,a().useEffect)(()=>{const e=k.getState().panZoom;if(C.current&&e)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=dt(e);return{update:function({translateExtent:e,width:i,height:s,zoomStep:a=1,pannable:l=!0,zoomable:c=!0,inversePan:d=!1}){let u=[0,0];const f=ir().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(u=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const a=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-u[0],l[1]-u[1]];u=l;const f=o()*Math.max(a[2],Math.log(a[2]))*(d?-1:1),h={x:a[0]-c[0]*f,y:a[1]-c[1]*f},p=[[0,0],[i,s]];t.setViewportConstrained({x:h.x,y:h.y,zoom:a[2]},p,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const o=n(),r=e.sourceEvent.ctrlKey&&Kr()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*a,s=o[2]*Math.pow(2,i*r);t.scaleTo(s)}:null);r.call(f,{})},destroy:function(){r.on("zoom",null)},pointer:ft}}({domNode:C.current,panZoom:e,getTransform:()=>k.getState().transform,getViewScale:()=>q.current}),()=>{K.current?.destroy()}},[E]),(0,a().useEffect)(()=>{K.current?.update({translateExtent:j,width:D,height:I,inversePan:b,pannable:x,zoomStep:_,zoomable:v})},[x,v,b,_,j,D,I]);const W=m?e=>{const[t,n]=K.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,G=(0,a().useCallback)((e,t)=>{const n=k.getState().nodeLookup.get(t).internals.userNode;y?.(e,n)},[y]),U=y?G:void 0,Q=w??O["minimap.ariaLabel"];return(0,c.jsx)(js,{position:g,style:{...e,"--xy-minimap-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof p?p*T:void 0,"--xy-minimap-node-background-color-props":"string"==typeof o?o:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof s?s:void 0},className:d(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,c.jsxs)("svg",{width:z,height:A,viewBox:`${H} ${Z} ${Y} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":F,ref:C,onClick:W,children:[Q&&(0,c.jsx)("title",{id:F,children:Q}),(0,c.jsx)(pc,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:l}),(0,c.jsx)("path",{className:"react-flow__minimap-mask",d:`M${H-V},${Z-V}h${Y+2*V}v${X+2*V}h${-Y-2*V}z\n M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vc.displayName="MiniMap";const wc=(0,a().memo)(vc),bc={[es.Line]:"right",[es.Handle]:"bottom-right"};(0,a().memo)(function({nodeId:e,position:t,variant:n=es.Handle,className:o,style:r,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:m=!0,shouldResize:y,onResizeStart:x,onResize:v,onResizeEnd:w}){const b=Ma(),_="string"==typeof e?e:b,S=bs(),k=(0,a().useRef)(null),C=n===es.Handle,N=ws((0,a().useCallback)((E=C&&m,e=>E?`${Math.max(1/e.transform[2],1)}`:void 0),[C,m]),gs);var E;const M=(0,a().useRef)(null),P=t??bc[n];(0,a().useEffect)(()=>{if(k.current&&_)return M.current||(M.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=dt(e);let s={controlDirection:ts("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:l,resizeDirection:c,onResizeStart:d,onResize:u,onResizeEnd:f,shouldResize:h}){let p,g={...ss},m={...as};s={boundaries:a,resizeDirection:c,keepAspectRatio:l,controlDirection:ts(e)};let y,x,v,w=null,b=[];const _=Ct().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:s,nodeOrigin:a,paneDomNode:l}=n();if(p=o.get(t),!p)return;w=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:u}=ni(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:s,containerBounds:w});g={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},m={...g,pointerX:c,pointerY:u,aspectRatio:g.width/g.height},y=void 0,x=Wr(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(y=o.get(p.parentId)),y&&"parent"===p.extent&&(x=[[0,0],[y.measured.width,y.measured.height]]),b=[],v=void 0;for(const[e,n]of o)if(n.parentId===t&&(b.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ls(n,p,n.origin??a);v=v?[[Math.min(e[0][0],v[0][0]),Math.min(e[0][1],v[0][1])],[Math.max(e[1][0],v[1][0]),Math.max(e[1][1],v[1][1])]]:e}d?.(e,{...g})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:a}=n(),l=ni(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!p)return;const{x:d,y:f,width:_,height:S}=g,k={},C=p.origin??a,{width:N,height:E,x:M,y:P}=function(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:x}=o,{x:v,y:w,width:b,height:_,aspectRatio:S}=e;let k=Math.floor(d?h-e.pointerX:0),C=Math.floor(u?p-e.pointerY:0);const N=b+(l?-k:k),E=_+(c?-C:C),M=-i[0]*b,P=-i[1]*_;let j=rs(N,g,m),D=rs(E,y,x);if(s){let e=0,t=0;l&&k<0?e=ns(v+k+M,s[0][0]):!l&&k>0&&(e=os(v+N+M,s[1][0])),c&&C<0?t=ns(w+C+P,s[0][1]):!c&&C>0&&(t=os(w+E+P,s[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(a){let e=0,t=0;l&&k>0?e=os(v+k,a[0][0]):!l&&k<0&&(e=ns(v+N,a[1][0])),c&&C>0?t=os(w+C,a[0][1]):!c&&C<0&&(t=ns(w+E,a[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(r){if(d){const e=rs(N/S,y,x)*S;if(j=Math.max(j,e),s){let e=0;e=!l&&!c||l&&!c&&f?os(w+P+N/S,s[1][1])*S:ns(w+P+(l?k:-k)/S,s[0][1])*S,j=Math.max(j,e)}if(a){let e=0;e=!l&&!c||l&&!c&&f?ns(w+N/S,a[1][1])*S:os(w+(l?k:-k)/S,a[0][1])*S,j=Math.max(j,e)}}if(u){const e=rs(E*S,g,m)/S;if(D=Math.max(D,e),s){let e=0;e=!l&&!c||c&&!l&&f?os(v+E*S+M,s[1][0])/S:ns(v+(c?C:-C)*S+M,s[0][0])/S,D=Math.max(D,e)}if(a){let e=0;e=!l&&!c||c&&!l&&f?ns(v+E*S,a[1][0])/S:os(v+(c?C:-C)*S,a[0][0])/S,D=Math.max(D,e)}}}C+=C<0?D:-D,k+=k<0?j:-j,r&&(f?N>E*S?C=(is(l,c)?-k:k)/S:k=(is(l,c)?-C:C)*S:d?(C=k/S,c=l):(k=C*S,l=c));const I=l?v+k:v,O=c?w+C:w;return{width:b+(l?-k:k),height:_+(c?-C:C),x:i[0]*k*(l?-1:1)+I,y:i[1]*C*(c?-1:1)+O}}(m,s.controlDirection,l,s.boundaries,s.keepAspectRatio,C,x,v),j=N!==_,D=E!==S,I=M!==d&&j,O=P!==f&&D;if(!(I||O||j||D))return;const z={prevValues:{...g},startX:m.x,startY:m.y,childNodes:b.map(e=>({...e,position:{...e.position}}))};if((I||O||1===C[0]||1===C[1])&&(k.x=I?M:g.x,k.y=O?P:g.y,g.x=k.x,g.y=k.y,b.length>0)){const e=M-d,t=P-f;for(const n of b)n.position={x:n.position.x-e+C[0]*(N-_),y:n.position.y-t+C[1]*(E-S)},c.push(n)}if((j||D)&&(k.width=!j||s.resizeDirection&&"horizontal"!==s.resizeDirection?g.width:N,k.height=!D||s.resizeDirection&&"vertical"!==s.resizeDirection?g.height:E,g.width=k.width,g.height=k.height),y&&p.expandParent){const e=C[0]*(k.width??0);k.x&&k.x<e&&(g.x=e,m.x=m.x-(k.x-e));const t=C[1]*(k.height??0);k.y&&k.y<t&&(g.y=t,m.y=m.y-(k.y-t))}const A=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=-1*l[0]),a&&i&&(l[1]=-1*l[1]),l}({width:g.width,prevWidth:_,height:g.height,prevHeight:S,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),R={...g,direction:A},L=h?.(e,R);if(!1===L)return g=z.prevValues,m.x=z.startX,m.y=z.startY,void b.forEach((e,t)=>{e.position=z.childNodes[t].position});u?.(e,R),o(k,c)}).on("end",e=>{f?.(e,{...g}),r?.({...g})});i.call(_)},destroy:function(){i.on(".drag",null)}}}({domNode:k.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=S.getState(),s=[],a={x:e.x,y:e.y},l=o.get(_);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,d=Ai([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Qr({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);s.push(...d),a.x=e.x?Math.max(t[0]*n,e.x):void 0,a.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==a.x&&void 0!==a.y){const e={id:_,type:"position",position:{...a}};s.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:_,type:"dimensions",resizing:!0,setAttributes:!g||("horizontal"===g?"width":"height"),dimensions:{width:e.width,height:e.height}};s.push(t)}for(const e of t){const t={...e,type:"position"};s.push(t)}n(s)},onEnd:({width:e,height:t})=>{const n={id:_,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};S.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:l,minHeight:u,maxWidth:f,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:x,onResize:v,onResizeEnd:w,shouldResize:y}),()=>{M.current?.destroy()}},[P,l,u,f,h,p,x,v,w,y]);const j=P.split("-");return(0,c.jsx)("div",{className:d(["react-flow__resize-control","nodrag",...j,n,o]),ref:k,style:{...r,scale:N,...s&&{[C?"backgroundColor":"borderColor"]:s}},children:i})});const _c=window.wp.i18n,Sc=window.wp.apiFetch;var kc=n.n(Sc);const Cc=window.wp.components,Nc=window.funnelforkEditor||{};function Ec(e){return`${e}_${Math.random().toString(36).slice(2,8)}`}const Mc=["#1e1e1e","#3858e9","#f0b849","#4ab866","#cc1818","#e26f56","#33b3db","#9b51e0","#e64ca2","#738a94"];function Pc(){return(Nc.yesnoAnswers||[{id:"yes",text:(0,_c.__)("Yes","funnelfork"),labels:[]},{id:"no",text:(0,_c.__)("No","funnelfork"),labels:[]}]).map(e=>({...e,labels:[],points:0}))}function jc(e){return"start"===e.type?["next"]:"question"===e.type?e.data.answers.map(e=>e.id):[]}function Dc(e,t,n){if(t===n)return!0;const o=[n],r=new Set;for(;o.length;){const n=o.pop();if(n===t)return!0;r.has(n)||(r.add(n),e.forEach(e=>e.source===n&&o.push(e.target)))}return!1}function Ic(e){return e?"start"===e.type?(0,_c.__)("Start","funnelfork"):"end"===e.type?e.data.title||(0,_c.__)("(untitled result)","funnelfork"):e.data.question||(0,_c.__)("(empty question)","funnelfork"):""}function Oc(e){return e.find(e=>"end"===e.type&&e.data.isDefault)||e.find(e=>"end"===e.type)}function zc(e){return e.filter(e=>"question"===e.type).sort((e,t)=>e.position.x-t.position.x||e.position.y-t.position.y).map(e=>e.id)}function Ac(e,t,n,o=zc(e)){if("score"===t){const t=o[o.indexOf(n)+1];if(t)return e.find(e=>e.id===t)}return Oc(e)}function Rc(e){return null!=e&&""!==e}function Lc(e){return Rc(e.scoreMin)||Rc(e.scoreMax)}function Tc(e){const t=Rc(e.scoreMin)?Number(e.scoreMin):null,n=Rc(e.scoreMax)?Number(e.scoreMax):null;return null!==t&&null!==n?t===n?(0,_c.sprintf)(/* translators: %d: score. */ /* translators: %d: score. */1 (()=>{"use strict";var e={730(e,t,n){var o=n.cw((e,t)=>{var n=a(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useState,i=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),o=r({inst:{value:n,getSnapshot:t}}),a=o[0].inst,d=o[1];return s(function(){a.value=n,a.getSnapshot=t,c(a)&&d({inst:a})},[e,n,t]),i(function(){return c(a)&&d({inst:a}),e(function(){c(a)&&d({inst:a})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:d}),r=n.cw((e,t)=>{var n=a(),o=i(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,l=n.useRef,c=n.useEffect,d=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,o,i){var a=l(null);if(null===a.current){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=d(function(){function e(e){if(!l){if(l=!0,s=e,e=o(e),void 0!==i&&f.hasValue){var t=f.value;if(i(t,e))return a=t}return a=e}if(t=a,r(s,e))return t;var n=o(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,o,i]);var h=s(e,a[0],a[1]);return c(function(){f.hasValue=!0,f.value=h},[h]),u(h),h}}),i=n.cw(e=>{e.exports=o()}),s=n.cw(e=>{e.exports=r()}),a=n.cw(e=>{e.exports=window.React});const l=window.wp.element,c=window.ReactJSXRuntime;function d(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=d(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}a();var u={value:()=>{}};function f(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new h(o)}function h(e){this._=e}function p(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function g(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=u,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}h.prototype=f.prototype={constructor:h,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=g(r[n],e.name,t);else if(null==t)for(n in r)r[n]=g(r[n],e.name,null);return this}for(;++s<a;)if((n=(e=i[s]).type)&&(n=p(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new h(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};const m=f;function y(){}function x(e){return null==e?y:function(){return this.querySelector(e)}}function v(e){"function"!=typeof e&&(e=x(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s,a=t[r],l=a.length,c=o[r]=new Array(l),d=0;d<l;++d)(i=a[d])&&(s=e.call(i,i.__data__,d,a))&&("__data__"in i&&(s.__data__=i.__data__),c[d]=s);return new at(o,this._parents)}function w(){return[]}function b(e){return null==e?w:function(){return this.querySelectorAll(e)}}function _(e){e="function"==typeof e?function(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}(e):b(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s,a=t[i],l=a.length,c=0;c<l;++c)(s=a[c])&&(o.push(e.call(s,s.__data__,c,a)),r.push(s));return new at(o,r)}function k(e){return function(){return this.matches(e)}}function S(e){return function(t){return t.matches(e)}}n.dn(x),n.dn(v),n.dn(b),n.dn(_),n.dn(k),n.dn(E);var C=Array.prototype.find;function N(){return this.firstElementChild}function E(e){return this.select(null==e?N:function(e){return function(){return C.call(this.children,e)}}("function"==typeof e?e:S(e)))}n.dn(j);var M=Array.prototype.filter;function P(){return Array.from(this.children)}function j(e){return this.selectAll(null==e?P:function(e){return function(){return M.call(this.children,e)}}("function"==typeof e?e:S(e)))}function D(e){"function"!=typeof e&&(e=k(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new at(o,this._parents)}function I(e){return new Array(e.length)}function O(){return new at(this._enter||this._groups.map(I),this._parents)}function z(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function A(e){return function(){return e}}function R(e,t,n,o,r,i){for(var s,a=0,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],o[a]=s):n[a]=new z(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function L(e,t,n,o,r,i,s){var a,l,c,d=new Map,u=t.length,f=i.length,h=new Array(u);for(a=0;a<u;++a)(l=t[a])&&(h[a]=c=s.call(l,l.__data__,a,t)+"",d.has(c)?r[a]=l:d.set(c,l));for(a=0;a<f;++a)c=s.call(e,i[a],a,i)+"",(l=d.get(c))?(o[a]=l,l.__data__=i[a],d.delete(c)):n[a]=new z(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&d.get(h[a])===l&&(r[a]=l)}function B(e){return e.__data__}function T(e,t){if(!arguments.length)return Array.from(this,B);var n=t?L:R,o=this._parents,r=this._groups;"function"!=typeof e&&(e=A(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],u=r[c],f=u.length,h=$(e.call(d,d&&d.__data__,c,o)),p=h.length,g=a[c]=new Array(p),m=s[c]=new Array(p);n(d,u,g,m,l[c]=new Array(f),h,t);for(var y,x,v=0,w=0;v<p;++v)if(y=g[v]){for(v>=w&&(w=v+1);!(x=m[w])&&++w<p;);y._next=x||null}}return(s=new at(s,o))._enter=a,s._exit=l,s}function $(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function V(){return new at(this._exit||this._groups.map(I),this._parents)}function H(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r}function Z(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c,d=n[l],u=o[l],f=d.length,h=a[l]=new Array(f),p=0;p<f;++p)(c=d[p]||u[p])&&(h[p]=c);for(;l<r;++l)a[l]=n[l];return new at(a,this._parents)}function F(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,s=r[i];--i>=0;)(o=r[i])&&(s&&4^o.compareDocumentPosition(s)&&s.parentNode.insertBefore(o,s),s=o);return this}function Y(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=X);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s,a=n[i],l=a.length,c=r[i]=new Array(l),d=0;d<l;++d)(s=a[d])&&(c[d]=s);c.sort(t)}return new at(r,this._parents).order()}function X(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function q(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function W(){return Array.from(this)}function K(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function G(){let e=0;for(const t of this)++e;return e}function U(){return!this.node()}function Q(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],s=0,a=i.length;s<a;++s)(r=i[s])&&e.call(r,r.__data__,s,i);return this}n.dn(D),n.dn(I),n.dn(O),z.prototype={constructor:z,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},n.dn(A),n.dn(T),n.dn(V),n.dn(H),n.dn(Z),n.dn(F),n.dn(Y),n.dn(q),n.dn(W),n.dn(K),n.dn(G),n.dn(U),n.dn(Q);var J="http://www.w3.org/1999/xhtml";const ee={svg:"http://www.w3.org/2000/svg",xhtml:J,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function te(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ee.hasOwnProperty(t)?{space:ee[t],local:e}:e}function ne(e){return function(){this.removeAttribute(e)}}function oe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function re(e,t){return function(){this.setAttribute(e,t)}}function ie(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function se(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function ae(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function le(e,t){var n=te(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?oe:ne:"function"==typeof t?n.local?ae:se:n.local?ie:re)(n,t))}function ce(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function de(e){return function(){this.style.removeProperty(e)}}function ue(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fe(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function he(e,t,n){return arguments.length>1?this.each((null==t?de:"function"==typeof t?fe:ue)(e,t,n??"")):pe(this.node(),e)}function pe(e,t){return e.style.getPropertyValue(t)||ce(e).getComputedStyle(e,null).getPropertyValue(t)}function ge(e){return function(){delete this[e]}}function me(e,t){return function(){this[e]=t}}function ye(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function xe(e,t){return arguments.length>1?this.each((null==t?ge:"function"==typeof t?ye:me)(e,t)):this.node()[e]}function ve(e){return e.trim().split(/^|\s+/)}function we(e){return e.classList||new be(e)}function be(e){this._node=e,this._names=ve(e.getAttribute("class")||"")}function _e(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ke(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Se(e){return function(){_e(this,e)}}function Ce(e){return function(){ke(this,e)}}function Ne(e,t){return function(){(t.apply(this,arguments)?_e:ke)(this,e)}}function Ee(e,t){var n=ve(e+"");if(arguments.length<2){for(var o=we(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?Ne:t?Se:Ce)(n,t))}function Me(){this.textContent=""}function Pe(e){return function(){this.textContent=e}}function je(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function De(e){return arguments.length?this.each(null==e?Me:("function"==typeof e?je:Pe)(e)):this.node().textContent}function Ie(){this.innerHTML=""}function Oe(e){return function(){this.innerHTML=e}}function ze(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ae(e){return arguments.length?this.each(null==e?Ie:("function"==typeof e?ze:Oe)(e)):this.node().innerHTML}function Re(){this.nextSibling&&this.parentNode.appendChild(this)}function Le(){return this.each(Re)}function Be(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Te(){return this.each(Be)}function $e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===J&&t.documentElement.namespaceURI===J?t.createElement(e):t.createElementNS(n,e)}}function Ve(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function He(e){var t=te(e);return(t.local?Ve:$e)(t)}function Ze(e){var t="function"==typeof e?e:He(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Fe(){return null}function Ye(e,t){var n="function"==typeof e?e:He(e),o=null==t?Fe:"function"==typeof t?t:x(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Xe(){var e=this.parentNode;e&&e.removeChild(this)}function qe(){return this.each(Xe)}function We(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ke(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ge(e){return this.select(e?Ke:We)}function Ue(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qe(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function Je(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function et(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),s=i.length;if(!(arguments.length<2)){for(a=t?Je:Qe,o=0;o<s;++o)this.each(a(i[o],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,d=a.length;c<d;++c)for(o=0,l=a[c];o<s;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value}function tt(e,t,n){var o=ce(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function nt(e,t){return function(){return tt(this,e,t)}}function ot(e,t){return function(){return tt(this,e,t.apply(this,arguments))}}function rt(e,t){return this.each(("function"==typeof t?ot:nt)(e,t))}function*it(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,s=r.length;i<s;++i)(o=r[i])&&(yield o)}n.dn(te),n.dn(le),n.dn(ce),n.dn(he),n.dn(xe),n.dn(Ee),be.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}},n.dn(De),n.dn(Ae),n.dn(Le),n.dn(Te),n.dn(He),n.dn(Ze),n.dn(Ye),n.dn(qe),n.dn(Ge),n.dn(Ue),n.dn(et),n.dn(rt),n.dn(it);var st=[null];function at(e,t){this._groups=e,this._parents=t}function lt(){return new at([[document.documentElement]],st)}at.prototype=lt.prototype={constructor:at,select:v,selectAll:_,selectChild:E,selectChildren:j,filter:D,data:T,enter:O,exit:V,join:H,merge:Z,selection:function(){return this},order:F,sort:Y,call:q,nodes:W,node:K,size:G,empty:U,each:Q,attr:le,style:he,property:xe,classed:Ee,text:De,html:Ae,raise:Le,lower:Te,append:Ze,insert:Ye,remove:qe,clone:Ge,datum:Ue,on:et,dispatch:rt,[Symbol.iterator]:it};const ct=lt;function dt(e){return"string"==typeof e?new at([[document.querySelector(e)]],[document.documentElement]):new at([[e]],st)}function ut(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ft(e,t){if(e=ut(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}n.dn(dt),n.dn(ut),n.dn(ft),n.dn(mt);const ht={passive:!1},pt={capture:!0,passive:!1};function gt(e){e.stopImmediatePropagation()}function mt(e){e.preventDefault(),e.stopImmediatePropagation()}function yt(e){var t=e.document.documentElement,n=dt(e).on("dragstart.drag",mt,pt);"onselectstart"in t?n.on("selectstart.drag",mt,pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xt(e,t){var n=e.document.documentElement,o=dt(e).on("dragstart.drag",null);t&&(o.on("click.drag",mt,pt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}n.dn(yt);const vt=e=>()=>e;function wt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function bt(e){return!e.ctrlKey&&!e.button}function _t(){return this.parentNode}function kt(e,t){return t??{x:e.x,y:e.y}}function St(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ct(){var e,t,n,o,r=bt,i=_t,s=kt,a=St,l={},c=m("start","drag","end"),d=0,u=0;function f(e){e.on("mousedown.drag",h).filter(a).on("touchstart.drag",y).on("touchmove.drag",x,ht).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(s,a){if(!o&&r.call(this,s,a)){var l=w(this,i.call(this,s,a),s,a,"mouse");l&&(dt(s.view).on("mousemove.drag",p,pt).on("mouseup.drag",g,pt),yt(s.view),gt(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(o){if(mt(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>u}l.mouse("drag",o)}function g(e){dt(e.view).on("mousemove.drag mouseup.drag",null),xt(e.view,n),mt(e),l.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,a=i.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=w(this,a,e,t,s[n].identifier,s[n]))&&(gt(e),o("start",e,s[n]))}}function x(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(mt(e),n("drag",e,o[t]))}function v(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=l[r[t].identifier])&&(gt(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var a,u,h,p=c.copy(),g=ft(i||n,t);if(null!=(h=s.call(e,new wt("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return a=h.x-g[0]||0,u=h.y-g[1]||0,function n(i,s,c){var m,y=g;switch(i){case"start":l[r]=n,m=d++;break;case"end":delete l[r],--d;case"drag":g=ft(c||s,t),m=d}p.call(i,e,new wt(i,{sourceEvent:s,subject:h,target:f,identifier:r,active:m,x:g[0]+a,y:g[1]+u,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:vt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:vt(e),f):i},f.subject=function(e){return arguments.length?(s="function"==typeof e?e:vt(e),f):s},f.touchable=function(e){return arguments.length?(a="function"==typeof e?e:vt(!!e),f):a},f.on=function(){var e=c.on.apply(c,arguments);return e===c?f:e},f.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,f):Math.sqrt(u)},f}function Nt(e){return((e=Math.exp(e))+1/e)/2}n.dn(vt),wt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},n.dn(Ct);const Et=function e(t,n,o){function r(e,r){var i,s,a=e[0],l=e[1],c=e[2],d=r[0],u=r[1],f=r[2],h=d-a,p=u-l,g=h*h+p*p;if(g<1e-12)s=Math.log(f/c)/t,i=function(e){return[a+e*h,l+e*p,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(g),y=(f*f-c*c+o*g)/(2*c*n*m),x=(f*f-c*c-o*g)/(2*f*n*m),v=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(x*x+1)-x);s=(w-v)/t,i=function(e){var o,r=e*s,i=Nt(v),d=c/(n*m)*(i*(o=t*r+v,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(v));return[a+d*h,l+d*p,c*i/Nt(t*r+v)]}}return i.duration=1e3*s*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4);var Mt,Pt,jt=0,Dt=0,It=0,Ot=0,zt=0,At=0,Rt="object"==typeof performance&&performance.now?performance:Date,Lt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bt(){return zt||(Lt(Tt),zt=Rt.now()+At)}function Tt(){zt=0}function $t(){this._call=this._time=this._next=null}function Vt(e,t,n){var o=new $t;return o.restart(e,t,n),o}function Ht(){zt=(Ot=Rt.now())+At,jt=Dt=0;try{!function(){Bt(),++jt;for(var e,t=Mt;t;)(e=zt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--jt}()}finally{jt=0,function(){for(var e,t,n=Mt,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Mt=t);Pt=e,Ft(o)}(),zt=0}}function Zt(){var e=Rt.now(),t=e-Ot;t>1e3&&(At-=t,Ot=e)}function Ft(e){jt||(Dt&&(Dt=clearTimeout(Dt)),e-zt>24?(e<1/0&&(Dt=setTimeout(Ht,e-Rt.now()-At)),It&&(It=clearInterval(It))):(It||(Ot=Rt.now(),It=setInterval(Zt,1e3)),jt=1,Lt(Ht)))}function Yt(e,t,n){var o=new $t;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}$t.prototype=Vt.prototype={constructor:$t,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Bt():+n)+(null==t?0:+t),this._next||Pt===this||(Pt?Pt._next=this:Mt=this,Pt=this),this._call=e,this._time=n,Ft()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ft())}},n.dn(Yt),n.dn(Wt);var Xt=m("start","end","cancel","interrupt"),qt=[];function Wt(e,t,n,o,r,i){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(l){var c,d,u,f;if(1!==n.state)return a();for(c in r)if((f=r[c]).name===n.name){if(3===f.state)return Yt(i);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[c])}if(Yt(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++d]=f);o.length=d+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(a),n.state=5,1),i=-1,s=o.length;++i<s;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Vt(function(e){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=e&&i(e-n.delay)},0,n.time)}(e,n,{name:t,index:o,group:r,on:Xt,tween:qt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Kt(e,t){var n=Ut(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Gt(e,t){var n=Ut(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Ut(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Qt(e,t){var n,o,r,i=e.__transition,s=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):s=!1;s&&delete e.__transition}}function Jt(e){return this.each(function(){Qt(this,e)})}function en(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}n.dn(Qt),n.dn(Jt),n.dn(en),n.dn(rn);var tn,nn=180/Math.PI,on={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rn(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*nn,skewX:Math.atan(l)*nn,scaleX:s,scaleY:a}}function sn(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,s){var a=[],l=[];return i=e(i),s=e(s),function(e,o,r,i,s,a){if(e!==r||o!==i){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:en(e,r)},{i:l-2,x:en(o,i)})}else(r||i)&&s.push("translate("+r+t+i+n)}(i.translateX,i.translateY,s.translateX,s.translateY,a,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:en(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,s.rotate,a,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:en(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,s.skewX,a,l),function(e,t,n,o,i,s){if(e!==n||t!==o){var a=i.push(r(i)+"scale(",null,",",null,")");s.push({i:a-4,x:en(e,n)},{i:a-2,x:en(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,s.scaleX,s.scaleY,a,l),i=s=null,function(e){for(var t,n=-1,o=l.length;++n<o;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var an=sn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?on:rn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),ln=sn(function(e){return null==e?on:(tn||(tn=document.createElementNS("http://www.w3.org/2000/svg","g")),tn.setAttribute("transform",e),(e=tn.transform.baseVal.consolidate())?rn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):on)},", ",")",")");function cn(e,t){var n,o;return function(){var r=Gt(this,e),i=r.tween;if(i!==n)for(var s=0,a=(o=n=i).length;s<a;++s)if(o[s].name===t){(o=o.slice()).splice(s,1);break}r.tween=o}}function dn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Gt(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function un(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=Ut(this.node(),n).tween,i=0,s=r.length;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?cn:dn)(n,e,t))}function fn(e,t,n){var o=e._id;return e.each(function(){var e=Gt(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Ut(e,o).value[t]}}function hn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pn(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function gn(){}n.dn(un),n.dn(hn);var mn=.7,yn=1/mn,xn="\\s*([+-]?\\d+)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bn=/^#([0-9a-f]{3,8})$/,kn=new RegExp(`^rgb\\(${xn},${xn},${xn}\\)$`),Sn=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),Cn=new RegExp(`^rgba\\(${xn},${xn},${xn},${vn}\\)$`),Nn=new RegExp(`^rgba\\(${wn},${wn},${wn},${vn}\\)$`),En=new RegExp(`^hsl\\(${vn},${wn},${wn}\\)$`),Mn=new RegExp(`^hsla\\(${vn},${wn},${wn},${vn}\\)$`),Pn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function jn(){return this.rgb().formatHex()}function Dn(){return this.rgb().formatRgb()}function In(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=bn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?On(t):3===n?new Rn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?zn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?zn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=kn.exec(e))?new Rn(t[1],t[2],t[3],1):(t=Sn.exec(e))?new Rn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Cn.exec(e))?zn(t[1],t[2],t[3],t[4]):(t=Nn.exec(e))?zn(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=En.exec(e))?Hn(t[1],t[2]/100,t[3]/100,1):(t=Mn.exec(e))?Hn(t[1],t[2]/100,t[3]/100,t[4]):Pn.hasOwnProperty(e)?On(Pn[e]):"transparent"===e?new Rn(NaN,NaN,NaN,0):null}function On(e){return new Rn(e>>16&255,e>>8&255,255&e,1)}function zn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Rn(e,t,n,o)}function An(e,t,n,o){return 1===arguments.length?((r=e)instanceof gn||(r=In(r)),r?new Rn((r=r.rgb()).r,r.g,r.b,r.opacity):new Rn):new Rn(e,t,n,o??1);var r}function Rn(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Ln(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}`}function Bn(){const e=Tn(this.opacity);return`${1===e?"rgb(":"rgba("}${$n(this.r)}, ${$n(this.g)}, ${$n(this.b)}${1===e?")":`, ${e})`}`}function Tn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vn(e){return((e=$n(e))<16?"0":"")+e.toString(16)}function Hn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Fn(e,t,n,o)}function Zn(e){if(e instanceof Fn)return new Fn(e.h,e.s,e.l,e.opacity);if(e instanceof gn||(e=In(e)),!e)return new Fn;if(e instanceof Fn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(s=t===i?(n-o)/a+6*(n<o):n===i?(o-t)/a+2:(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Fn(s,a,l,e.opacity)}function Fn(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function Yn(e){return(e=(e||0)%360)<0?e+360:e}function Xn(e){return Math.max(0,Math.min(1,e||0))}function qn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Wn(e,t,n,o,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*n+(1+3*e+3*i-3*s)*o+s*r)/6}function Kn(e){var t=e.length-1;return function(n){var o=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[o],i=e[o+1],s=o>0?e[o-1]:2*r-i,a=o<t-1?e[o+2]:2*i-r;return Wn((n-o/t)*t,s,r,i,a)}}function Gn(e){var t=e.length;return function(n){var o=Math.floor(((n%=1)<0?++n:n)*t),r=e[(o+t-1)%t],i=e[o%t],s=e[(o+1)%t],a=e[(o+2)%t];return Wn((n-o/t)*t,r,i,s,a)}}hn(gn,In,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:jn,formatHex:jn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Zn(this).formatHsl()},formatRgb:Dn,toString:Dn}),hn(Rn,An,pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rn($n(this.r),$n(this.g),$n(this.b),Tn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ln,formatHex:Ln,formatHex8:function(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}${Vn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Bn,toString:Bn})),hn(Fn,function(e,t,n,o){return 1===arguments.length?Zn(e):new Fn(e,t,n,o??1)},pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Fn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Fn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new Rn(qn(e>=240?e-240:e+120,r,o),qn(e,r,o),qn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Fn(Yn(this.h),Xn(this.s),Xn(this.l),Tn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Tn(this.opacity);return`${1===e?"hsl(":"hsla("}${Yn(this.h)}, ${100*Xn(this.s)}%, ${100*Xn(this.l)}%${1===e?")":`, ${e})`}`}})),n.dn(Kn),n.dn(Gn);const Un=e=>()=>e;function Qn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Un(isNaN(e)?t:e)}n.dn(Un);const Jn=function e(t){var n=function(e){return 1===(e=+e)?Qn:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):Un(isNaN(t)?n:t)}}(t);function o(e,t){var o=n((e=An(e)).r,(t=An(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),s=Qn(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=s(t),e+""}}return o.gamma=e,o}(1);function eo(e){return function(t){var n,o,r=t.length,i=new Array(r),s=new Array(r),a=new Array(r);for(n=0;n<r;++n)o=An(t[n]),i[n]=o.r||0,s[n]=o.g||0,a[n]=o.b||0;return i=e(i),s=e(s),a=e(a),o.opacity=1,function(e){return o.r=i(e),o.g=s(e),o.b=a(e),o+""}}}eo(Kn),eo(Gn),n.dn(oo);var to=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,no=new RegExp(to.source,"g");function oo(e,t){var n,o,r,i=to.lastIndex=no.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=to.exec(e))&&(o=no.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:en(n,o)})),i=no.lastIndex;return i<t.length&&(r=t.slice(i),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)a[(n=l[o]).i]=n.x(e);return a.join("")})}function ro(e,t){var n;return("number"==typeof t?en:t instanceof In?Jn:(n=In(t))?(t=n,Jn):oo)(e,t)}function io(e){return function(){this.removeAttribute(e)}}function so(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ao(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function lo(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function co(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttribute(e)}}function uo(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttributeNS(e.space,e.local)}}function fo(e,t){var n=te(e),o="transform"===n?ln:ro;return this.attrTween(e,"function"==typeof t?(n.local?uo:co)(n,o,fn(this,"attr."+e,t)):null==t?(n.local?so:io)(n):(n.local?lo:ao)(n,o,t))}function ho(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function po(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function go(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=te(e);return this.tween(n,(o.local?ho:po)(o,t))}function mo(e,t){return function(){Kt(this,e).delay=+t.apply(this,arguments)}}function yo(e,t){return t=+t,function(){Kt(this,e).delay=t}}function xo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?mo:yo)(t,e)):Ut(this.node(),t).delay}function vo(e,t){return function(){Gt(this,e).duration=+t.apply(this,arguments)}}function wo(e,t){return t=+t,function(){Gt(this,e).duration=t}}function bo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?vo:wo)(t,e)):Ut(this.node(),t).duration}function _o(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Gt(this,e).ease=t}}(t,e)):Ut(this.node(),t).ease}function ko(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Gt(this,e).ease=n}}(this._id,e))}function So(e){"function"!=typeof e&&(e=k(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new $o(o,this._parents,this._name,this._id)}function Co(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l,c=t[a],d=n[a],u=c.length,f=s[a]=new Array(u),h=0;h<u;++h)(l=c[h]||d[h])&&(f[h]=l);for(;a<o;++a)s[a]=t[a];return new $o(s,this._parents,this._name,this._id)}function No(e,t){var n=this._id;return arguments.length<2?Ut(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Kt:Gt;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}(n,e,t))}function Eo(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))}function Mo(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a,l,c=o[s],d=c.length,u=i[s]=new Array(d),f=0;f<d;++f)(a=c[f])&&(l=e.call(a,a.__data__,f,c))&&("__data__"in a&&(l.__data__=a.__data__),u[f]=l,Wt(u[f],t,n,f,u,Ut(a,n)));return new $o(i,this._parents,t,n)}function Po(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=b(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l,c=o[a],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var f,h=e.call(l,l.__data__,u,c),p=Ut(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&Wt(f,t,n,g,h,p);i.push(h),s.push(l)}return new $o(i,s,t,n)}n.dn(ro),n.dn(fo),n.dn(go),n.dn(xo),n.dn(bo),n.dn(_o),n.dn(ko),n.dn(So),n.dn(Co),n.dn(No),n.dn(Eo),n.dn(Mo),n.dn(Po),n.dn(Do);var jo=ct.prototype.constructor;function Do(){return new jo(this._groups,this._parents)}function Io(e){return function(){this.style.removeProperty(e)}}function Oo(e,t,n){var o="transform"==(e+="")?an:ro;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=pe(this,e),s=(this.style.removeProperty(e),pe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}(e,o)).on("end.style."+e,Io(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var s=pe(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=pe(this,e)),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}(e,o,fn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,s="style."+t,a="end."+s;return function(){var l=Gt(this,e),c=l.on,d=null==l.value[s]?i||(i=Io(t)):void 0;c===n&&r===d||(o=(n=c).copy()).on(a,r=d),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var s=pe(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}(e,o,t),n).on("end.style."+e,null)}function zo(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,n??""))}function Ao(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(fn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))}function Ro(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))}function Lo(){for(var e=this._name,t=this._id,n=Vo(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)if(s=a[c]){var d=Ut(s,t);Wt(s,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new $o(o,this._parents,e,n)}function Bo(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){0===--r&&i()}};n.each(function(){var n=Gt(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t}),0===r&&i()})}n.dn(Oo),n.dn(zo),n.dn(Ao),n.dn(Ro),n.dn(Lo),n.dn(Bo);var To=0;function $o(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vo(){return++To}var Ho=ct.prototype;$o.prototype=function(e){return ct().transition(e)}.prototype={constructor:$o,select:Mo,selectAll:Po,selectChild:Ho.selectChild,selectChildren:Ho.selectChildren,filter:So,merge:Co,selection:Do,transition:Lo,call:Ho.call,nodes:Ho.nodes,node:Ho.node,size:Ho.size,empty:Ho.empty,each:Ho.each,on:No,attr:fo,attrTween:go,style:Oo,styleTween:zo,text:Ao,textTween:Ro,remove:Eo,tween:un,delay:xo,duration:bo,ease:_o,easeVarying:ko,end:Bo,[Symbol.iterator]:Ho[Symbol.iterator]},n.dn(Yo);var Zo={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Fo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Yo(e){var t,n;e instanceof $o?(t=e._id,e=e._name):(t=Vo(),(n=Zo).time=Bt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)(s=a[c])&&Wt(s,e,t,c,a,n||Fo(s,t));return new $o(o,this._parents,e,t)}ct.prototype.interrupt=Jt,ct.prototype.transition=Yo;const Xo=e=>()=>e;function qo(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Wo(e,t,n){this.k=e,this.x=t,this.y=n}n.dn(Xo),Wo.prototype={constructor:Wo,scale:function(e){return 1===e?this:new Wo(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Wo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ko=new Wo(1,0,0);function Go(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ko;return e.__zoom}function Uo(e){e.stopImmediatePropagation()}function Qo(e){e.preventDefault(),e.stopImmediatePropagation()}function Jo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function er(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function tr(){return this.__zoom||Ko}function nr(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function or(){return navigator.maxTouchPoints||"ontouchstart"in this}function rr(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ir(){var e,t,n,o=Jo,r=er,i=rr,s=nr,a=or,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Et,f=m("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",tr).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",C).filter(a).on("touchstart.zoom",N).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Wo(t,e.x,e.y)}function x(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Wo(e.k,o,r)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){b(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,s=b(e,i).event(o),a=r.apply(e,i),l=null==n?v(a):"function"==typeof n?n.apply(e,i):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),d=e.__zoom,f="function"==typeof t?t.apply(e,i):t,h=u(d.invert(l).concat(c/d.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=c/t[2];e=new Wo(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new _(e,t)}function _(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,a=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,s.apply(this,arguments)))),d=ft(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=r.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(r.k===a)return;n.mouse=[d,r.invert(d)],Qt(this),n.start()}Qo(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(x(y(r,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function S(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=b(this,t,!0).event(e),a=dt(e.view).on("mousemove.zoom",function(e){if(Qo(e),!s.moved){var t=e.clientX-d,n=e.clientY-u;s.moved=t*t+n*n>h}s.event(e).zoom("mouse",i(x(s.that.__zoom,s.mouse[0]=ft(e,r),s.mouse[1]),s.extent,c))},!0).on("mouseup.zoom",function(e){a.on("mousemove.zoom mouseup.zoom",null),xt(e.view,s.moved),Qo(e),s.event(e).end()},!0),l=ft(e,r),d=e.clientX,u=e.clientY;yt(e.view),Uo(e),s.mouse=[l,this.__zoom.invert(l)],Qt(this),s.start()}}function C(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=ft(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=i(x(y(n,l),s,a),r.apply(this,t),c);Qo(e),d>0?dt(this).transition().duration(d).call(w,u,s,e):dt(this).call(g.transform,u,s,e)}}function N(n,...r){if(o.apply(this,arguments)){var i,s,a,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(Uo(n),s=0;s<d;++s)l=[l=ft(a=c[s],this),this.__zoom.invert(l),a.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,i=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(u.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),Qt(this),u.start())}}function E(e,...t){if(this.__zooming){var n,o,r,s,a=b(this,t).event(e),l=e.changedTouches,d=l.length;for(Qo(e),n=0;n<d;++n)r=ft(o=l[n],this),a.touch0&&a.touch0[2]===o.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===o.identifier&&(a.touch1[0]=r);if(o=a.that.__zoom,a.touch1){var u=a.touch0[0],f=a.touch0[1],h=a.touch1[0],p=a.touch1[1],g=(g=h[0]-u[0])*g+(g=h[1]-u[1])*g,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;o=y(o,Math.sqrt(g/m)),r=[(u[0]+h[0])/2,(u[1]+h[1])/2],s=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],s=a.touch0[1]}a.zoom("touch",i(x(o,r,s),a.extent,c))}}function M(e,...o){if(this.__zooming){var r,i,s=b(this,o).event(e),a=e.changedTouches,l=a.length;for(Uo(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=a[r],s.touch0&&s.touch0[2]===i.identifier?delete s.touch0:s.touch1&&s.touch1[2]===i.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(i=ft(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=dt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",tr),e!==r?w(e,t,n,o):r.interrupt().each(function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,o){g.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},g.scaleTo=function(e,t,n,o){g.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,a=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return i(x(y(o,l),s,a),e,c)},n,o)},g.translateBy=function(e,t,n,o){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)},null,o)},g.translateTo=function(e,t,n,o,s){g.transform(e,function(){var e=r.apply(this,arguments),s=this.__zoom,a=null==o?v(e):"function"==typeof o?o.apply(this,arguments):o;return i(Ko.translate(a[0],a[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},o,s)},_.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=dt(this.that).datum();f.call(e,this.that,new qo(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:f}),t)}},g.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:Xo(+e),g):s},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Xo(!!e),g):o},g.touchable=function(e){return arguments.length?(a="function"==typeof e?e:Xo(!!e),g):a},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Xo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):r},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(d=+e,g):d},g.interpolate=function(e){return arguments.length?(u=e,g):u},g.on=function(){var e=f.on.apply(f,arguments);return e===f?g:e},g.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,g):Math.sqrt(h)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}function sr(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),s=new Array(o);for(n=0;n<r;++n)i[n]=dr(e[n],t[n]);for(;n<o;++n)s[n]=t[n];return function(e){for(n=0;n<r;++n)s[n]=i[n](e);return s}}function ar(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function lr(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=dr(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}function cr(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function dr(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?Un(t):("number"===r?en:"string"===r?(n=In(t))?(t=n,Jn):oo:t instanceof In?Jn:t instanceof Date?ar:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?sr:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?lr:en:cr))(e,t)}Go.prototype=Wo.prototype,n.dn(Qo),n.dn(ir),n.dn(function(e,t){return((void 0)(t)?void 0:sr)(e,t)}),n.dn(ar),n.dn(lr),n.dn(cr),n.dn(dr);const ur=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],fr=["Enter"," ","Escape"],hr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var pr,gr,mr;!function(e){e.Strict="strict",e.Loose="loose"}(pr||(pr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(gr||(gr={})),function(e){e.Partial="partial",e.Full="full"}(mr||(mr={}));const yr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xr,vr,wr;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(xr||(xr={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(vr||(vr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(wr||(wr={}));const br={[wr.Left]:wr.Right,[wr.Right]:wr.Left,[wr.Top]:wr.Bottom,[wr.Bottom]:wr.Top},_r=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,kr=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Sr=(e,t=[0,0])=>{const{width:n,height:o}=Gr(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Cr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=Or(n,Lr(e)),o=!0)}),o?Ar(n):{x:0,y:0,width:0,height:0}},Nr=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,c=t.width/r,d=t.height/r,u=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(s&&!n||o)continue;const r=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:h,y:p}=t.internals.positionAbsolute,g=Tr(a,l,c,d,h,p,r,f),m=r*f,y=i&&g>0;(!t.internals.handleBounds||y||g>=m||t.dragging)&&u.push(t)}return u};function Er({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let u=s.extent||r;if("parent"!==s.extent||s.expandParent)a&&Kr(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);else if(a){const{width:e,height:t}=Gr(a);e&&t&&(u=[[l,c],[l+e,c+t]])}else i?.("005","Only child nodes can use a parent extent.");const f=Kr(u)?Pr(t,u,s.measured):t;return void 0!==s.measured.width&&void 0!==s.measured.height||i?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:f.x-l+(s.measured.width??0)*d[0],y:f.y-c+(s.measured.height??0)*d[1]},positionAbsolute:f}}const Mr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pr=(e={x:0,y:0},t,n)=>({x:Mr(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Mr(e.y,t[0][1],t[1][1]-(n?.height??0))});function jr(e,t,n){const{width:o,height:r}=Gr(n),{x:i,y:s}=n.internals.positionAbsolute;return Pr(e,[[i,s],[i+o,s+r]],t)}const Dr=(e,t,n)=>e<t?Mr(Math.abs(e-t),1,t)/t:e>n?-Mr(Math.abs(e-n),1,t)/t:0,Ir=(e,t,n=15,o=40)=>[Dr(e.x,o,t.width-o)*n,Dr(e.y,o,t.height-o)*n],Or=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),zr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Ar=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Rr=(e,t=[0,0])=>{const{x:n,y:o}=kr(e)?e.internals.positionAbsolute:Sr(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Lr=(e,t=[0,0])=>{const{x:n,y:o}=kr(e)?e.internals.positionAbsolute:Sr(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Br=(e,t)=>Ar(Or(zr(e),zr(t))),Tr=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),c=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*c)},$r=(e,t)=>Tr(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vr=e=>Hr(e.width)&&Hr(e.height)&&Hr(e.x)&&Hr(e.y),Hr=e=>!isNaN(e)&&isFinite(e),Zr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Fr=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Zr(a,s):a},Yr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xr(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const qr=(e,t,n,o,r,i)=>{const s=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Xr(e,n),r=Xr(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Xr(e.top??e.y??0,n),r=Xr(e.bottom??e.y??0,n),i=Xr(e.left??e.x??0,t),s=Xr(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=Mr(c,o,r),u=t/2-(e.x+e.width/2)*d,f=n/2-(e.y+e.height/2)*d,h=function(e,t,n,o,r,i){const{x:s,y:a}=Yr(e,[t,n,o]),{x:l,y:c}=Yr({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}(e,u,f,d,t,n),p=Math.min(h.left-s.left,0),g=Math.min(h.top-s.top,0);return{x:u-p+Math.min(h.right-s.right,0),y:f-g+Math.min(h.bottom-s.bottom,0),zoom:d}},Wr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Kr(e){return null!=e&&"parent"!==e}function Gr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ur(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Qr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const e=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Jr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ei(e){return{...hr,...e||{}}}function ti(e){return null===e?null:e?"valid":"invalid"}function ni(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=li(e),a=Fr({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Zr(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const oi=e=>({width:e.offsetWidth,height:e.offsetHeight}),ri=e=>e?.getRootNode?.()||window?.document,ii=["INPUT","SELECT","TEXTAREA"];function si(e){const t=e.composedPath?.()?.[0]||e.target;return 1===t?.nodeType&&(ii.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}const ai=e=>"clientX"in e,li=(e,t)=>{const n=ai(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ci=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...oi(t)}}):null};function di({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*i+.375*a+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ui(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function fi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case wr.Left:return[t-ui(t-o,i),n];case wr.Right:return[t+ui(o-t,i),n];case wr.Top:return[t,n-ui(n-r,i)];case wr.Bottom:return[t,n+ui(r-n,i)]}}function hi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,curvature:s=.25}){const[a,l]=fi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=fi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,h,p]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,u,f,h,p]}function pi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[i,o<t?o+s:o-s,r,s]}function gi({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Or(Lr(e),Lr(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $r(s,Ar(i))>0}const mi=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function yi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=pi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const xi={[wr.Left]:{x:-1,y:0},[wr.Right]:{x:1,y:0},[wr.Top]:{x:0,y:-1},[wr.Bottom]:{x:0,y:1}},vi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wi(e,t,n,o){const r=Math.min(vi(e,t)/2,vi(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s)return`L ${i+r*(e.x<n.x?-1:1)},${s}Q ${i},${s} ${i},${s+r*(e.y<n.y?1:-1)}`;const a=e.x<n.x?1:-1;return`L ${i},${s+r*(e.y<n.y?-1:1)}Q ${i},${s} ${i+r*a},${s}`}function bi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:d=.5}){const[u,f,h,p,g]=function({source:e,sourcePosition:t=wr.Bottom,target:n,targetPosition:o=wr.Top,center:r,offset:i,stepPosition:s}){const a=xi[t],l=xi[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},u=(({source:e,sourcePosition:t=wr.Bottom,target:n})=>t===wr.Left||t===wr.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:d}),f=0!==u.x?"x":"y",h=u[f];let p,g,m=[];const y={x:0,y:0},x={x:0,y:0},[,,v,w]=pi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){"x"===f?(p=r.x??c.x+(d.x-c.x)*s,g=r.y??(c.y+d.y)/2):(p=r.x??(c.x+d.x)/2,g=r.y??c.y+(d.y-c.y)*s);const e=[{x:p,y:c.y},{x:p,y:d.y}],t=[{x:c.x,y:g},{x:d.x,y:g}];m=a[f]===h?"x"===f?e:t:"x"===f?t:e}else{const r=[{x:c.x,y:d.y}],s=[{x:d.x,y:c.y}];if(m="x"===f?a.x===h?s:r:a.y===h?r:s,t===o){const t=Math.abs(e[f]-n[f]);if(t<=i){const o=Math.min(i-1,i-t);a[f]===h?y[f]=(c[f]>e[f]?-1:1)*o:x[f]=(d[f]>n[f]?-1:1)*o}}if(t!==o){const e="x"===f?"y":"x",t=a[f]===l[e],n=c[e]>d[e],o=c[e]<d[e];(1===a[f]&&(!t&&n||t&&o)||1!==a[f]&&(!t&&o||t&&n))&&(m="x"===f?r:s)}const u={x:c.x+y.x,y:c.y+y.y},v={x:d.x+x.x,y:d.y+x.y};Math.max(Math.abs(u.x-m[0].x),Math.abs(v.x-m[0].x))>=Math.max(Math.abs(u.y-m[0].y),Math.abs(v.y-m[0].y))?(p=(u.x+v.x)/2,g=m[0].y):(p=m[0].x,g=(u.y+v.y)/2)}const b={x:c.x+y.x,y:c.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...b.x!==m[0].x||b.y!==m[0].y?[b]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],p,g,v,w]}({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});let m=`M${u[0].x} ${u[0].y}`;for(let e=1;e<u.length-1;e++)m+=wi(u[e-1],u[e],u[e+1],s);return m+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[m,f,h,p,g]}function _i(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ki(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function Si(e,t,n=wr.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Gr(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case wr.Top:return{x:r+s/2,y:i};case wr.Right:return{x:r+s,y:i+a/2};case wr.Bottom:return{x:r+s/2,y:i+a};case wr.Left:return{x:r,y:i+a/2}}}function Ci(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Ni(e,t){return e?"string"==typeof e?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`:""}const Ei={nodeOrigin:[0,0],nodeExtent:ur,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Mi={...Ei,checkEquality:!0};function Pi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function ji(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const t of e.handles){const r={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};"source"===t.type?n.push(r):"target"===t.type&&o.push(r)}return{source:n,target:o}}function Di(e){return"manual"===e}function Ii(e,t,n,o={}){const r=Pi(Mi,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Di(r.zIndexMode)?1e3:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const d of e){let e=s.get(d.id);if(r.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{const n=Sr(d,r.nodeOrigin),o=Kr(d.extent)?d.extent:r.nodeExtent,i=Pr(n,o,Gr(d));e={...r.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:i,handleBounds:ji(d,e),z:zi(d,a,r.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),d.parentId&&Oi(e,t,n,o,i),c||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function Oi(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Pi(Ei,o),c=e.parentId,d=t.get(c);if(!d)return void console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),r&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===l&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+10*r.i),r&&void 0!==d.internals.rootParentIndex&&(r.i=d.internals.rootParentIndex);const u=i&&!Di(l)?1e3:0,{x:f,y:h,z:p}=function(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Gr(e),c=Sr(e,n),d=Kr(e.extent)?Pr(c,e.extent,l):c;let u=Pr({x:s+d.x,y:a+d.y},o,l);"parent"===e.extent&&(u=jr(u,l,t));const f=zi(e,r,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}(e,d,s,a,u,l),{positionAbsolute:g}=e.internals,m=f!==g.x||h!==g.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:f,y:h}:g,z:p}})}function zi(e,t,n){const o=Hr(e.zIndex)?e.zIndex:0;return Di(n)?o:o+(e.selected?t:0)}function Ai(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Rr(e),r=Br(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},s)=>{const a=i.internals.positionAbsolute,l=Gr(i),c=i.origin??o,d=t.x<a.x?Math.round(Math.abs(a.x-t.x)):0,u=t.y<a.y?Math.round(Math.abs(a.y-t.y)):0,f=Math.max(l.width,Math.round(t.width)),h=Math.max(l.height,Math.round(t.height)),p=(f-l.width)*c[0],g=(h-l.height)*c[1];(d>0||u>0||p||g)&&(r.push({id:s,type:"position",position:{x:i.position.x-d+p,y:i.position.y-u+g}}),n.get(s)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+u}})})),(l.width<t.width||l.height<t.height||d||u)&&r.push({id:s,type:"dimensions",setAttributes:!0,dimensions:{width:f+(d?c[0]*d-p:0),height:h+(u?c[1]*u-g:0)}})}),r}function Ri(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const a=o.get(s)||new Map;o.set(s,a.set(n,t))}}function Li(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:s=null}=o,a={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:s},l=`${n}-${i}--${r}-${s}`;Ri("source",a,`${r}-${s}--${n}-${i}`,e,n,i),Ri("target",a,l,e,r,s),t.set(o.id,o)}}function Bi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Bi(n,t))}function Ti(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function $i({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Vi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a="strict"===r?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(e=>e.id===n):a?.[0])??null;return l&&i?{...l,...Si(s,l,l.position,!0)}:l}function Hi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Zi=()=>!0;function Fi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Zi,nodeLookup:d}){const u="target"===i,f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=li(e),g=s.elementFromPoint(h,p),m=g?.classList.contains(`${a}-flow__handle`)?g:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Hi(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),s=m.classList.contains("connectable"),a=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:u?t:o,sourceHandle:u?i:r,target:u?o:t,targetHandle:u?r:i};y.connection=l;const f=s&&a&&(n===pr.Strict?u&&"source"===e||!u&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=Vi(t,e,i,d,n,!0)}return y}const Yi={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:m,isValidConnection:y=Zi,onReconnectEnd:x,updateConnection:v,getTransform:w,getFromHandle:b,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:S}){const C=ri(e.target);let N,E=0;const{x:M,y:P}=li(e),j=Hi(i,S),D=a?.getBoundingClientRect();let I=!1;if(!D||!j)return;const O=Vi(r,j,o,l,t);if(!O)return;let z=li(e,D),A=!1,R=null,L=!1,B=null;function T(){if(!d||!D)return;const[e,t]=Ir(z,D,_);f({x:e,y:t}),E=requestAnimationFrame(T)}const $={...O,nodeId:r,type:j,position:O.position},V=l.get(r);let H={inProgress:!0,isValid:null,from:Si(V,$,wr.Left,!0),fromHandle:$,fromPosition:$.position,fromNode:V,to:z,toHandle:null,toPosition:br[$.position],toNode:null,pointer:z};function Z(){I=!0,v(H),p?.(e,{nodeId:r,handleId:o,handleType:j})}function F(e){if(!I){const{x:t,y:n}=li(e),o=t-M,r=n-P;if(!(o*o+r*r>k*k))return;Z()}if(!b()||!$)return void Y(e);const i=w();z=li(e,D),N=function(e,t,n,o){let r=[],i=1/0;const s=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())$r(r,Rr(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of s){const s=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const a of s){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:s,y:l}=Si(n,a,a.position,!0),c=Math.sqrt(Math.pow(s-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...a,x:s,y:l}],i=c):c===i&&r.push({...a,x:s,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}(Fr(z,i,!1,[1,1]),n,l,$),A||(T(),A=!0);const a=Fi(e,{handle:N,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:y,doc:C,lib:c,flowId:u,nodeLookup:l});B=a.handleDomNode,R=a.connection,L=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!N,a.isValid);const d=l.get(r),f=d?Si(d,$,wr.Left,!0):H.from,h={...H,from:f,isValid:L,to:a.toHandle&&L?Yr({x:a.toHandle.x,y:a.toHandle.y},i):z,toHandle:a.toHandle,toPosition:L&&a.toHandle?a.toHandle.position:br[$.position],toNode:a.toHandle?l.get(a.toHandle.nodeId):null,pointer:z};v(h),H=h}function Y(e){if(!("touches"in e&&e.touches.length>0)){if(I){(N||B)&&R&&L&&g?.(R);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&x?.(e,o)}h(),cancelAnimationFrame(E),A=!1,L=!1,R=null,B=null,C.removeEventListener("mousemove",F),C.removeEventListener("mouseup",Y),C.removeEventListener("touchmove",F),C.removeEventListener("touchend",Y)}}0===k&&Z(),C.addEventListener("mousemove",F),C.addEventListener("mouseup",Y),C.addEventListener("touchmove",F),C.addEventListener("touchend",Y)},isValid:Fi},Xi=e=>({x:e.x,y:e.y,zoom:e.k}),qi=({x:e,y:t,zoom:n})=>Ko.translate(e,t).scale(n),Wi=(e,t)=>e.target.closest(`.${t}`),Ki=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Gi=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ui=(e,t=0,n=Gi,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Qi=e=>{const t=e.ctrlKey&&Wr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Ji({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let u=[[0,0],[d.width,d.height]];const f="undefined"!=typeof ResizeObserver?new ResizeObserver(e=>{const t=e[0];t&&(u=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);const h=ir().extent(()=>u).scaleExtent([t,n]).translateExtent(o),p=dt(e).call(h);v({x:r.x,y:r.y,zoom:Mr(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);const g=p.on("wheel.zoom"),m=p.on("dblclick.zoom");async function y(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).transform(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})}function x(){h.on("zoom",null)}async function v(e,t,n){const o=qi(e),r=h?.constrain()(o,t,n);return r&&await y(r),r}return h.wheelDelta(Qi),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:d,panOnScrollMode:u,panOnScrollSpeed:f,preventScrolling:y,zoomOnPinch:v,zoomOnScroll:w,zoomOnDoubleClick:b,panActivationKeyPressed:_=!1,zoomActivationKeyPressed:k,lib:S,onTransformChange:C,connectionInProgress:N,paneClickDistance:E,selectionOnDrag:M}){o&&!c.isZoomingOrPanning&&x();const P=r&&!k&&!o;h.clickDistance(M?1/0:!Hr(E)||E<0?0:E);const j=P?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(Wi(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const e=ft(d),t=Qi(d),r=u*Math.pow(2,t);return void o.scaleTo(n,r,e,d)}const f=1===d.deltaMode?20:1;let h=r===gr.Vertical?0:d.deltaX*f,p=r===gr.Horizontal?0:d.deltaY*f;!Wr()&&d.shiftKey&&r!==gr.Vertical&&(h=d.deltaY*f,p=0),o.translateBy(n,-h/u*i,-p/u*i,{internal:!0});const g=Xi(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,g):(e.isPanScrolling=!0,a?.(d,g)),e.panScrollTimeout=setTimeout(()=>{c?.(d,g),e.isPanScrolling=!1},150)}}({zoomPanValues:c,noWheelClassName:e,d3Selection:p,d3Zoom:h,panOnScrollMode:u,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,s=!t&&i&&!o.ctrlKey,a=Wi(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:y,d3ZoomHandler:g});p.on("wheel.zoom",j,{passive:!1});const D=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Xi(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});h.on("start",D);const I=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Ki(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Xi(i.transform))}}({zoomPanValues:c,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:C});h.on("zoom",I);const O=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ki(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const t=Xi(s.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:d,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:a,onDraggingChange:l});h.on("end",O);const z=function({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return f=>{const h=t||n,p=o&&f.ctrlKey,g="wheel"===f.type;if(1===f.button&&"mousedown"===f.type&&(Wi(f,`${d}-flow__node`)||Wi(f,`${d}-flow__edge`)||Wi(f,`${d}-flow__selection`)||Wi(f,`${d}-flow__nodesselection`)))return!0;if(!(r||h||i||s||o))return!1;if(a)return!1;if(u&&!g)return!1;if(Wi(f,l)&&g)return!1;if(Wi(f,c)&&(!g||i&&g&&!t))return!1;if(!o&&f.ctrlKey&&g)return!1;if(!o&&"touchstart"===f.type&&f.touches?.length>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&g)return!1;if(!r&&("mousedown"===f.type||"touchstart"===f.type))return!1;if(Array.isArray(r)&&!r.includes(f.button)&&"mousedown"===f.type)return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g||e)&&m}}({panActivationKeyPressed:_,zoomActivationKeyPressed:k,panOnDrag:d,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:S,connectionInProgress:N});h.filter(z),b?p.on("dblclick.zoom",m):p.on("dblclick.zoom",null)},destroy:x,setViewport:async function(e,t){const n=qi(e);return await y(n,t),n},setViewportConstrained:v,getViewport:function(){const e=p?Go(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleTo(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleBy(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){h?.scaleExtent(e)},setTranslateExtent:function(e){h?.translateExtent(e)},syncViewport:function(e){if(p){const t=qi(e),n=p.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||h?.transform(p,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Hr(e)||e<0?0:e;h?.clickDistance(t)}}}var es;function ts(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function ns(e,t){return Math.max(0,t-e)}function os(e,t){return Math.max(0,e-t)}function rs(e,t,n){return Math.max(0,t-e,e-n)}function is(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(es||(es={}));const ss={width:0,height:0,x:0,y:0},as={...ss,pointerX:0,pointerY:0,aspectRatio:1};function ls(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}s();const cs=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},s=t=e(o,r,i);return i},{useDebugValue:ds}=a(),{useSyncExternalStoreWithSelector:us}=s(),fs=e=>e;function hs(e,t=fs,n){const o=us(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ds(o),o}const ps=(e,t)=>{const n=(e=>e?cs(e):cs)(e),o=(e,o=t)=>hs(n,e,o);return Object.assign(o,n),o};function gs(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ms=window.ReactDOM,ys=(0,a().createContext)(null),xs=ys.Provider,vs=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function ws(e,t){const n=(0,a().useContext)(ys);if(null===n)throw new Error(vs);return hs(n,e,t)}function bs(){const e=(0,a().useContext)(ys);if(null===e)throw new Error(vs);return(0,a().useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const _s={display:"none"},ks={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ss="react-flow__node-desc",Cs="react-flow__edge-desc",Ns=e=>e.ariaLiveMessage,Es=e=>e.ariaLabelConfig;function Ms({rfId:e}){const t=ws(Ns);return(0,c.jsx)("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ks,children:t})}function Ps({rfId:e,disableKeyboardA11y:t}){const n=ws(Es);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{id:`${Ss}-${e}`,style:_s,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,c.jsx)("div",{id:`${Cs}-${e}`,style:_s,children:n["edge.a11yDescription.default"]}),!t&&(0,c.jsx)(Ms,{rfId:e})]})}const js=(0,a().forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return(0,c.jsx)("div",{className:d(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});js.displayName="Panel";const Ds="https://reactflow.dev?utm_source=attribution";function Is({proOptions:e,position:t="bottom-right"}){return(0,a().useEffect)(()=>{},[]),e?.hideAttribution?null:(0,c.jsx)(js,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ds}`,children:(0,c.jsx)("a",{href:Ds,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Os=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},zs=e=>e.id;function As(e,t){return gs(e.selectedNodes.map(zs),t.selectedNodes.map(zs))&&gs(e.selectedEdges.map(zs),t.selectedEdges.map(zs))}function Rs({onSelectionChange:e}){const t=bs(),{selectedNodes:n,selectedEdges:o}=ws(Os,As);return(0,a().useEffect)(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(e=>e(r))},[n,o,e]),null}const Ls=e=>!!e.onSelectionChangeHandlers;function Bs({onSelectionChange:e}){const t=ws(Ls);return e||t?(0,c.jsx)(Rs,{onSelectionChange:e}):null}const Ts=[0,0],$s={x:0,y:0,zoom:1},Vs=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],Hs=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Zs={translateExtent:ur,nodeOrigin:Ts,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Fs(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c}=ws(Hs,gs),d=bs();(0,a().useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Zs,l()}),[]);const u=(0,a().useRef)(Zs);return(0,a().useEffect)(()=>{for(const a of Vs){const l=e[a];l!==u.current[a]&&void 0!==e[a]&&("nodes"===a?t(l):"edges"===a?n(l):"minZoom"===a?o(l):"maxZoom"===a?r(l):"translateExtent"===a?i(l):"nodeExtent"===a?s(l):"ariaLabelConfig"===a?d.setState({ariaLabelConfig:ei(l)}):"fitView"===a?d.setState({fitViewQueued:l}):"fitViewOptions"===a?d.setState({fitViewOptions:l}):d.setState({[a]:l}))}u.current=e},Vs.map(t=>e[t])),null}function Ys(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Xs="undefined"!=typeof document?document:null;function qs(e=null,t={target:Xs,actInsideInputWithModifier:!0}){const[n,o]=(0,a().useState)(!1),r=(0,a().useRef)(!1),i=(0,a().useRef)(new Set([])),[s,l]=(0,a().useMemo)(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace(/\+/g,"\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return(0,a().useEffect)(()=>{const n=t?.target??Xs,a=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{if(r.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!r.current||r.current&&!a)&&si(e))return!1;const n=Ks(e.code,l);if(i.current.add(e[n]),Ws(s,i.current,!1)){const n=e.composedPath?.()?.[0]||e.target,i="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!r.current&&i||e.preventDefault(),o(!0)}},c=e=>{const t=Ks(e.code,l);Ws(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),r.current=!1},d=()=>{i.current.clear(),o(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function Ws(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ks(e,t){return t.includes(e)?"code":"key"}function Gs(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)Us(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function Us(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured={...e.dimensions},e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function Qs(e,t){return Gs(e,t)}function Js(e,t){return Gs(e,t)}function ea(e,t){return{id:e,type:"select",selected:t}}function ta(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ea(i.id,e)))}return o}function na({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t)void 0===o.get(e)&&n.push({id:e,type:"remove"});return n}function oa(e){return{id:e.id,type:"remove"}}const ra=(e,t)=>{};const ia=e=>(e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function sa(e){return(0,a().forwardRef)(e)}const aa="undefined"!=typeof window?a().useLayoutEffect:a().useEffect;function la(e){const[t,n]=(0,a().useState)(BigInt(0)),[o]=(0,a().useState)(()=>function(){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n(e=>e+BigInt(1))}}}());return aa(()=>{const t=o.get();t.length&&(e(t),o.reset())},[t]),o}const ca=(0,a().createContext)(null);function da({children:e}){const t=bs(),n=(0,a().useCallback)(e=>{const{nodes:n=[],setNodes:o,hasDefaultNodes:r,onNodesChange:i,nodeLookup:s,fitViewQueued:a,onNodesChangeMiddlewareMap:l}=t.getState();let c=n;for(const t of e)c="function"==typeof t?t(c):t;let d=na({items:c,lookup:s});for(const e of l.values())d=e(d);r&&o(c),d.length>0?i?.(d):a&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:n,setNodes:o}=t.getState();e&&o(n)})},[]),o=la(n),r=la((0,a().useCallback)(e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:s}=t.getState();let a=n;for(const t of e)a="function"==typeof t?t(a):t;r?o(a):i&&i(na({items:a,lookup:s}))},[])),i=(0,a().useMemo)(()=>({nodeQueue:o,edgeQueue:r}),[]);return(0,c.jsx)(ca.Provider,{value:i,children:e})}const ua=e=>!!e.panZoom;function fa(){const e=(()=>{const e=bs();return(0,a().useMemo)(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{const{panZoom:o}=e.getState();return!!o&&o.scaleTo(t,n)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return!!s&&(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),!0)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=qr(t,o,r,i,s,n?.padding??.1);return!!a&&(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},d=n.snapGrid??r,u=n.snapToGrid??i;return Fr(c,o,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Yr(t,n);return{x:s.x+r,y:s.y+i}}}),[])})(),t=bs(),n=function(){const e=(0,a().useContext)(ca);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),o=ws(ua),r=(0,a().useMemo)(()=>{const e=e=>t.getState().nodeLookup.get(e),o=e=>{n.nodeQueue.push(e)},r=e=>{n.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=ia(e)?e:n.get(e.id),i=r.parentId?Qr(r.position,r.measured,r.parentId,n,o):r.position,s={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Rr(s)},s=(e,t,n={replace:!1})=>{o(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&ia(e)?e:{...o,...e}}return o}))},a=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&_r(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:o,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,s]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:s}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:s,triggerNodeChanges:a,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:d}=t.getState(),{nodes:u,edges:f}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),s=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&s.find(t=>t.id===e.parentId);(t||n)&&s.push(e)}const a=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(s,l),d=c;for(const e of l)a.has(e.id)&&!d.find(t=>t.id===e.id)&&d.push(e);if(!r)return{edges:d,nodes:s};const u=await r({nodes:s,edges:d});return"boolean"==typeof u?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:d}),h=f.length>0,p=u.length>0;if(h){const e=f.map(oa);s?.(f),l(e)}if(p){const e=u.map(oa);i?.(u),a(e)}return(p||h)&&c?.({nodes:u,edges:f}),{deletedNodes:u,deletedEdges:f}},getIntersectingNodes:(e,n=!0,o)=>{const r=Vr(e),s=r?e:i(e),a=void 0!==o;return s?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Rr(a?o:i),c=$r(l,s);return n&&c>0||c>=l.width*l.height||c>=s.width*s.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Vr(e)?e:i(e);if(!o)return!1;const r=$r(o,t);return n&&r>0||r>=t.width*t.height||r>=o.width*o.height},updateNode:s,updateNodeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:a,updateEdgeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};let n=!1;const o=e.reduce((e,o)=>{const r="string"==typeof o;let i=t.nodeLookup||r?void 0:o;return t.nodeLookup&&(i=r?t.nodeLookup.get(o):kr(o)?o:t.nodeLookup.get(o.id)),i?(n=!0,Or(e,Lr(i,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Ar(o):{x:0,y:0,width:0,height:0}})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const o=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:o}),n.nodeQueue.push(e=>[...e]),o.promise}}},[]);return(0,a().useMemo)(()=>({...r,...e,viewportInitialized:o}),[o])}const ha=e=>e.selected,pa="undefined"!=typeof window?window:void 0,ga={position:"absolute",width:"100%",height:"100%",top:0,left:0},ma=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ya({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panActivationKeyPressed:r,panOnScrollSpeed:i=.5,panOnScrollMode:s=gr.Free,zoomOnDoubleClick:l=!0,panOnDrag:d=!0,defaultViewport:u,translateExtent:f,minZoom:h,maxZoom:p,zoomActivationKeyCode:g,preventScrolling:m=!0,children:y,noWheelClassName:x,noPanClassName:v,onViewportChange:w,isControlledViewport:b,paneClickDistance:_,selectionOnDrag:k}){const S=bs(),C=(0,a().useRef)(null),{userSelectionActive:N,lib:E,connectionInProgress:M}=ws(ma,gs),P=qs(g),j=(0,a().useRef)();!function(e){const t=bs();(0,a().useEffect)(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const n=oi(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004","The parent container needs a width and a height to render the graph."),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(C);const D=(0,a().useCallback)(e=>{w?.({x:e[0],y:e[1],zoom:e[2]}),b||S.setState({transform:e})},[w,b]);return(0,a().useEffect)(()=>{if(C.current){j.current=Ji({domNode:C.current,minZoom:h,maxZoom:p,translateExtent:f,viewport:u,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=S.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=S.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=S.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=j.current.getViewport();return S.setState({panZoom:j.current,transform:[e,t,n],domNode:C.current.closest(".react-flow")}),()=>{j.current?.destroy()}}},[]),(0,a().useEffect)(()=>{j.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panActivationKeyPressed:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:d,zoomActivationKeyPressed:P,preventScrolling:m,noPanClassName:v,userSelectionActive:N,noWheelClassName:x,lib:E,onTransformChange:D,connectionInProgress:M,selectionOnDrag:k,paneClickDistance:_})},[e,t,n,o,r,i,s,l,d,P,m,v,N,x,E,D,M,k,_]),(0,c.jsx)("div",{className:"react-flow__renderer",ref:C,style:ga,children:y})}const xa=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function va(){const{userSelectionActive:e,userSelectionRect:t}=ws(xa,gs);return e&&t?(0,c.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const wa=(e,t)=>n=>{n.target===t.current&&e?.(n)},ba=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function _a({isSelecting:e,selectionKeyPressed:t,selectionMode:n=mr.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:g,onPaneMouseMove:m,onPaneMouseLeave:y,children:x}){const v=(0,a().useRef)(0),w=bs(),{userSelectionActive:b,elementsSelectable:_,dragging:k,panBy:S,autoPanSpeed:C}=ws(ba,gs),N=_&&(e||b),E=(0,a().useRef)(null),M=(0,a().useRef)(),P=(0,a().useRef)(new Set),j=(0,a().useRef)(new Set),D=(0,a().useRef)(!1),I=(0,a().useRef)(!1),O=(0,a().useRef)({x:0,y:0}),z=(0,a().useRef)(!1),A=e=>{if(I.current||D.current||w.getState().connection.inProgress)return I.current=!1,void(D.current=!1);f?.(e),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=p?e=>p(e):void 0;function L(e,t){const{userSelectionRect:o}=w.getState();if(!o)return;const{transform:r,nodeLookup:i,edgeLookup:s,connectionLookup:a,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:d}=w.getState(),u={x:o.startX,y:o.startY},{x:f,y:h}=Yr(u,r),p={startX:u.x,startY:u.y,x:e<f?e:f,y:t<h?t:h,width:Math.abs(e-f),height:Math.abs(t-h)},g=P.current,m=j.current;P.current=new Set(Nr(i,p,r,n===mr.Partial,!0).map(e=>e.id)),j.current=new Set;const y=d?.selectable??!0;for(const e of P.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=s.get(e);t&&(t.selectable??y)&&j.current.add(e)}}Jr(g,P.current)||l(ta(i,P.current,!0)),Jr(m,j.current)||c(ta(s,j.current)),w.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}function B(){if(!r||!M.current)return;const[e,t]=Ir(O.current,M.current,C);S({x:e,y:t}).then(e=>{if(!I.current||!e)return void(v.current=requestAnimationFrame(B));const{x:t,y:n}=O.current;L(t,n),v.current=requestAnimationFrame(B)})}const T=()=>{cancelAnimationFrame(v.current),v.current=0,z.current=!1};(0,a().useEffect)(()=>()=>T(),[]);const $=!0===o||Array.isArray(o)&&o.includes(0);return(0,c.jsxs)("div",{className:d(["react-flow__pane",{draggable:$,dragging:k,selection:e}]),onClick:N?void 0:wa(A,E),onContextMenu:wa(e=>{Array.isArray(o)&&o?.includes(2)?e.preventDefault():h?.(e)},E),onWheel:wa(R,E),onPointerEnter:N?void 0:g,onPointerMove:N?e=>{const{userSelectionRect:n,transform:o,resetSelectedElements:r}=w.getState();if(!M.current||!n)return;const{x:s,y:a}=li(e.nativeEvent,M.current);O.current={x:s,y:a};const c=Yr({x:n.startX,y:n.startY},o);if(!I.current){const n=t?0:i;if(Math.hypot(s-c.x,a-c.y)<=n)return;r(),l?.(e)}I.current=!0,z.current||(B(),z.current=!0),L(s,a)}:m,onPointerUp:e=>{N?0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===E.current&&w.getState().userSelectionRect&&A?.(e),w.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(u?.(e),w.setState({nodesSelectionActive:P.current.size>0})),T()):e.target===E.current&&w.getState().connection.inProgress&&(D.current=!0)},onPointerCancel:N?e=>{e.target?.releasePointerCapture?.(e.pointerId),T()}:void 0,onPointerDownCapture:N?n=>{if("touch"===n.pointerType&&!1!==o&&!t)return;const{domNode:r,transform:i}=w.getState();if(M.current=r?.getBoundingClientRect(),!M.current)return;const a=n.target===E.current;if(!a&&n.target.closest(".nokey")||!e||!(s&&a||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),I.current=!1;const{x:l,y:c}=li(n.nativeEvent,M.current),d=Fr({x:l,y:c},i);w.setState({userSelectionRect:{width:0,height:0,startX:d.x,startY:d.y,x:l,y:c}}),a||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:N?e=>{I.current&&(e.stopPropagation(),I.current=!1)}:void 0,onPointerLeave:y,ref:E,style:ga,children:[x,(0,c.jsx)(va,{})]})}function ka({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",(e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`)(e))}function Sa({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const l=bs(),[c,d]=(0,a().useState)(!1),u=(0,a().useRef)();return(0,a().useEffect)(()=>{if(!t)return u.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},d=null,u=!1,f=null,h=!1,p=!1,g=null;return{update:function({noDragClassName:m,handleSelector:y,domNode:x,isSelectable:v,nodeId:w,nodeClickDistance:b=0}){function _({x:e,y:n}){const{nodeLookup:r,nodeExtent:s,snapGrid:l,snapToGrid:c,nodeOrigin:d,onNodeDrag:u,onSelectionDrag:f,onError:h,updateNodePositions:m}=t();i={x:e,y:n};let y=!1;const x=a.size>1,v=x&&s?zr(Cr(a)):null,b=x&&c?function({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Zr(i,t);return{x:s.x-i.x,y:s.y-i.y}}({dragItems:a,snapGrid:l,x:e,y:n}):null;for(const[t,o]of a){if(!r.has(t))continue;let i={x:e-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:Zr(i,l));let a=null;if(x&&s&&!o.extent&&v){const{positionAbsolute:e}=o.internals,t=e.x-v.x+s[0][0],n=e.x+o.measured.width-v.x2+s[1][0];a=[[t,e.y-v.y+s[0][1]],[n,e.y+o.measured.height-v.y2+s[1][1]]]}const{position:u,positionAbsolute:f}=Er({nodeId:t,nextPosition:i,nodeLookup:r,nodeExtent:a||s,nodeOrigin:d,onError:h});y=y||o.position.x!==u.x||o.position.y!==u.y,o.position=u,o.internals.positionAbsolute=f}if(p=p||y,y&&(m(a,!0),g&&(o||u||!w&&f))){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});o?.(g,a,e,t),u?.(g,e,t),w||f?.(g,t)}}async function k(){if(!d)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(s);const[a,u]=Ir(c,d,o);0===a&&0===u||(i.x=(i.x??0)-a/e[2],i.y=(i.y??0)-u/e[2],await n({x:a,y:u})&&_(i)),s=requestAnimationFrame(k)}function S(o){const{nodeLookup:r,multiSelectionActive:s,nodesDraggable:l,transform:c,snapGrid:f,snapToGrid:h,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();u=!0,p&&v||s||!w||r.get(w)?.selected||y(),v&&p&&w&&e?.(w);const x=ni(o.sourceEvent,{transform:c,snapGrid:f,snapToGrid:h,containerBounds:d});if(i=x,a=function(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Bi(s,e))&&(s.draggable||t&&void 0===s.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,x,w),a.size>0&&(n||g||!w&&m)){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});n?.(o.sourceEvent,a,e,t),g?.(o.sourceEvent,e,t),w||m?.(o.sourceEvent,t)}}f=dt(x);const C=Ct().clickDistance(b).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:s,snapToGrid:a}=t();d=n?.getBoundingClientRect()||null,h=!1,p=!1,g=e.sourceEvent,0===o&&S(e);const l=ni(e.sourceEvent,{transform:r,snapGrid:s,snapToGrid:a,containerBounds:d});i=l,c=li(e.sourceEvent,d)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:s,nodeDragThreshold:f,nodeLookup:p}=t(),m=ni(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:s,containerBounds:d});if(g=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||w&&!p.has(w))&&(h=!0),!h){if(!l&&n&&u&&(l=!0,k()),!u){const t=li(e.sourceEvent,d),n=t.x-c.x,o=t.y-c.y;Math.sqrt(n*n+o*o)>f&&S(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&a&&u&&(c=li(e.sourceEvent,d),_(m))}}).on("end",e=>{if(u&&!h){if(l=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:s}=t();if(p&&(o(a,!1),p=!1),r||i||!w&&s){const[t,o]=$i({nodeId:w,dragItems:a,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,a,t,o),i?.(e.sourceEvent,t,o),w||s?.(e.sourceEvent,o)}}}else h&&a.size>0&&t().updateNodePositions(a,!1)}).filter(e=>{const t=e.target;return!e.button&&(!m||!Ti(t,`.${m}`,x))&&(!y||Ti(t,y,x))});f.call(C)},destroy:function(){f?.on(".drag",null)}}}({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{ka({id:t,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,l,e]),(0,a().useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s})},[n,o,t,i,e,r,s]),c}function Ca(){const e=bs(),t=(0,a().useCallback)(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:s,updateNodePositions:a,nodeLookup:l,nodeOrigin:c}=e.getState(),d=new Map,u=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),f=o?r[0]:5,h=o?r[1]:5,p=t.direction.x*f*t.factor,g=t.direction.y*h*t.factor;for(const[,e]of l){if(!u(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};o&&(t=Zr(t,r));const{position:i,positionAbsolute:a}=Er({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:s});e.position=i,e.internals.positionAbsolute=a,d.set(e.id,e)}a(d)},[]);return t}const Na=(0,a().createContext)(null),Ea=Na.Provider;Na.Consumer;const Ma=()=>(0,a().useContext)(Na),Pa=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ja=(0,a().createContext)(null);function Da({children:e}){const t=ws(Pa,gs);return(0,c.jsx)(ja.Provider,{value:t,children:e})}const Ia={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Oa=(0,a().memo)(sa(function({type:e="source",position:t=wr.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:u,className:f,onMouseDown:h,onTouchStart:p,...g},m){const y=s||null,x="target"===e,v=bs(),w=Ma(),{connectOnClick:b,noPanClassName:_,rfId:k}=function(){const e=(0,a().useContext)(ja);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:S,connectingTo:C,clickConnecting:N,isPossibleEndHandle:E,connectionInProcess:M,clickConnectionInProcess:P,valid:j}=ws(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s;if(!a&&!r)return Ia;const d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:d,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===pr.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&c}})(w,y,e),gs);w||v.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");const D=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=v.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t,onError:n}=v.getState();t(function(e,t,n={}){return((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;const o=n.getEdgeId||mi;let r;return r=_r(e)?{...e}:{...e,id:o(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(r,t)?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r))})(e,t,{...n,onError:n.onError??ra})}(r,e,{onError:n}))}n?.(r),l?.(r)},I=e=>{if(!w)return;const t=ai(e.nativeEvent);if(r&&(t&&0===e.button||!t)){const t=v.getState();Yi.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:x,handleId:y,nodeId:w,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>v.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:D,isValidConnection:n||((...e)=>v.getState().isValidConnection?.(...e)??!0),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?h?.(e):p?.(e)};return(0,c.jsx)("div",{"data-handleid":y,"data-nodeid":w,"data-handlepos":t,"data-id":`${k}-${w}-${y}-${e}`,className:d(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,f,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:i,clickconnecting:N,connectingfrom:S,connectingto:C,valid:j,connectionindicator:o&&(!M||E)&&(M||P?i:r)}]),onMouseDown:I,onTouchStart:I,onClick:b?t=>{const{onClickConnectStart:o,onClickConnectEnd:i,connectionClickStartHandle:s,connectionMode:a,isValidConnection:l,lib:c,rfId:d,nodeLookup:u,connection:f}=v.getState();if(!w||!s&&!r)return;if(!s)return o?.(t.nativeEvent,{nodeId:w,handleId:y,handleType:e}),void v.setState({connectionClickStartHandle:{nodeId:w,type:e,id:y}});const h=ri(t.target),p=n||l,{connection:g,isValid:m}=Yi.isValid(t.nativeEvent,{handle:{nodeId:w,id:y,type:e},connectionMode:a,fromNodeId:s.nodeId,fromHandleId:s.id||null,fromType:s.type,isValidConnection:p,flowId:d,doc:h,lib:c,nodeLookup:u});m&&g&&D(g);const x=structuredClone(f);delete x.inProgress,x.toPosition=x.toHandle?x.toHandle.position:null,i?.(t,x),v.setState({connectionClickStartHandle:null})}:void 0,ref:m,...g,children:u})})),za={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Aa={input:function({data:e,isConnectable:t,sourcePosition:n=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[e?.label,(0,c.jsx)(Oa,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=wr.Top,sourcePosition:o=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label,(0,c.jsx)(Oa,{type:"source",position:o,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=wr.Top}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},Ra=e=>{const{width:t,height:n,x:o,y:r}=Cr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Hr(t)?t:null,height:Hr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function La({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=bs(),{width:r,height:i,transformString:s,userSelectionActive:l}=ws(Ra,gs),u=Ca(),f=(0,a().useRef)(null);(0,a().useEffect)(()=>{n||f.current?.focus({preventScroll:!0})},[n]);const h=!l&&null!==r&&null!==i;if(Sa({nodeRef:f,disabled:!h}),!h)return null;const p=e?t=>{const n=o.getState().nodes.filter(e=>e.selected);e(t,n)}:void 0;return(0,c.jsx)("div",{className:d(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:(0,c.jsx)("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(za,e.key)&&(e.preventDefault(),u({direction:za[e.key],factor:e.shiftKey?4:1}))},style:{width:r,height:i}})})}const Ba="undefined"!=typeof window?window:void 0,Ta=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function $a({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:x,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:N,autoPanOnSelection:E,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,preventScrolling:I,onSelectionContextMenu:O,noWheelClassName:z,noPanClassName:A,disableKeyboardA11y:R,onViewportChange:L,isControlledViewport:B}){const{nodesSelectionActive:T,userSelectionActive:$}=ws(Ta,gs),V=qs(u,{target:Ba}),H=qs(y,{target:Ba}),Z=H||N,F=H||_,Y=f&&!0!==Z,X=V||$||Y;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=bs(),{deleteElements:o}=fa(),r=qs(e,{actInsideInputWithModifier:!1}),i=qs(t,{target:pa});(0,a().useEffect)(()=>{if(r){const{edges:e,nodes:t}=n.getState();o({nodes:t.filter(ha),edges:e.filter(ha)}),n.setState({nodesSelectionActive:!1})}},[r]),(0,a().useEffect)(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:d,multiSelectionKeyCode:m}),(0,c.jsx)(ya,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:F,panActivationKeyPressed:H,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!V&&Z,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,zoomActivationKeyCode:x,preventScrolling:I,noWheelClassName:z,noPanClassName:A,onViewportChange:L,isControlledViewport:B,paneClickDistance:l,selectionOnDrag:Y,children:(0,c.jsxs)(_a,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:Z,autoPanOnSelection:E,isSelecting:!!X,selectionMode:h,selectionKeyPressed:V,paneClickDistance:l,selectionOnDrag:Y,children:[e,T&&(0,c.jsx)(La,{onSelectionContextMenu:O,noPanClassName:A,disableKeyboardA11y:R})]})})}$a.displayName="FlowRenderer";const Va=(0,a().memo)($a);const Ha=e=>e.updateNodeInternals;var Za=(0,a().memo)(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:f,nodesFocusable:h,resizeObserver:p,noDragClassName:g,noPanClassName:m,disableKeyboardA11y:y,rfId:x,nodeTypes:v,nodeClickDistance:w,onError:b}){const{node:_,internals:k,isParent:S}=ws(t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}},gs);let C=_.type||"default",N=v?.[C]||Aa[C];void 0===N&&(b?.("003",(e=>`Node type "${e}" not found. Using fallback type "default".`)(C)),C="default",N=v?.default||Aa.default);const E=!!(_.draggable||l&&void 0===_.draggable),M=!!(_.selectable||u&&void 0===_.selectable),P=!!(_.connectable||f&&void 0===_.connectable),j=!!(_.focusable||h&&void 0===_.focusable),D=bs(),I=Ur(_),O=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=bs(),i=(0,a().useRef)(null),s=(0,a().useRef)(null),l=(0,a().useRef)(e.sourcePosition),c=(0,a().useRef)(e.targetPosition),d=(0,a().useRef)(t),u=n&&!!e.internals.handleBounds;return(0,a().useEffect)(()=>{!i.current||e.hidden||u&&s.current===i.current||(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),(0,a().useEffect)(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),(0,a().useEffect)(()=>{if(i.current){const n=d.current!==t,o=l.current!==e.sourcePosition,s=c.current!==e.targetPosition;(n||o||s)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:_,nodeType:C,hasDimensions:I,resizeObserver:p}),z=Sa({nodeRef:O,disabled:_.hidden||!E,noDragClassName:g,handleSelector:_.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:w}),A=Ca();if(_.hidden)return null;const R=Gr(_),L=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(_),B=M||E||t||n||o||r,T=n?e=>n(e,{...k.userNode}):void 0,$=o?e=>o(e,{...k.userNode}):void 0,V=r?e=>r(e,{...k.userNode}):void 0,H=i?e=>i(e,{...k.userNode}):void 0,Z=s?e=>s(e,{...k.userNode}):void 0;return(0,c.jsx)("div",{className:d(["react-flow__node",`react-flow__node-${C}`,{[m]:E},_.className,{selected:_.selected,selectable:M,parent:S,draggable:E,dragging:z}]),ref:O,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:I?"visible":"hidden",..._.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:$,onMouseLeave:V,onContextMenu:H,onClick:n=>{const{selectNodesOnDrag:o,nodeDragThreshold:r}=D.getState();M&&(!o||!E||r>0)&&ka({id:e,store:D,nodeRef:O}),t&&t(n,{...k.userNode})},onDoubleClick:Z,onKeyDown:j?t=>{if(!si(t.nativeEvent)&&!y)if(fr.includes(t.key)&&M){const n="Escape"===t.key;ka({id:e,store:D,unselect:n,nodeRef:O})}else if(E&&_.selected&&Object.prototype.hasOwnProperty.call(za,t.key)){t.preventDefault();const{ariaLabelConfig:e}=D.getState();D.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),A({direction:za[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:j?0:void 0,onFocus:j?()=>{if(y||!O.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=D.getState();r&&(Nr(new Map([[e,_]]),{x:0,y:0,width:n,height:o},t,!0).length>0||i(_.position.x+R.width/2,_.position.y+R.height/2,{zoom:t[2]}))}:void 0,role:_.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${Ss}-${x}`,"aria-label":_.ariaLabel,..._.domAttributes,children:(0,c.jsx)(Ea,{value:e,children:(0,c.jsx)(N,{id:e,data:_.data,type:C,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:_.selected??!1,selectable:M,draggable:E,deletable:_.deletable??!0,isConnectable:P,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:z,dragHandle:_.dragHandle,zIndex:k.z,parentId:_.parentId,...R})})})});const Fa=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ya(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=ws(Fa,gs),i=function(e){const t=ws((0,a().useCallback)((e=>t=>e?Nr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),gs);return t}(e.onlyRenderVisibleElements),s=function(){const e=ws(Ha),[t]=(0,a().useState)(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,a().useEffect)(()=>()=>{t?.disconnect()},[t]),t}();return(0,c.jsx)("div",{className:"react-flow__nodes",style:ga,children:i.map(i=>(0,c.jsx)(Za,{id:i,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:r},i))})}Ya.displayName="NodeRenderer";const Xa=(0,a().memo)(Ya),qa={[vr.Arrow]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return(0,c.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[vr.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,c.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},Wa=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const d=function(e){const t=bs();return(0,a().useMemo)(()=>Object.prototype.hasOwnProperty.call(qa,e)?qa[e]:(t.getState().onError?.("009",(e=>`Marker type "${e}" doesn't exist.`)(e)),null),[e])}(t);return d?(0,c.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:(0,c.jsx)(d,{color:n,strokeWidth:s})}):null},Ka=({defaultColor:e,rfId:t})=>{const n=ws(e=>e.edges),o=ws(e=>e.defaultEdgeOptions),r=(0,a().useMemo)(()=>{const r=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,s)=>([s.markerStart||o,s.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=Ni(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd});return r},[n,o,t,e]);return r.length?(0,c.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,c.jsx)("defs",{children:r.map(e=>(0,c.jsx)(Wa,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Ka.displayName="MarkerDefinitions";var Ga=(0,a().memo)(Ka);function Ua({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:f,...h}){const[p,g]=(0,a().useState)({x:1,y:0,width:0,height:0}),m=d(["react-flow__edge-textwrapper",f]),y=(0,a().useRef)(null);return(0,a().useEffect)(()=>{if(y.current){const e=y.current.getBBox();g({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,c.jsxs)("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:m,visibility:p.width?"visible":"hidden",...h,children:[r&&(0,c.jsx)("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),(0,c.jsx)("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:y,style:o,children:n}),u]}):null}Ua.displayName="EdgeText";const Qa=(0,a().memo)(Ua);function Ja({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:u=20,...f}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("path",{...f,d:e,fill:"none",className:d(["react-flow__edge-path",f.className])}),u?(0,c.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,o&&Hr(t)&&Hr(n)?(0,c.jsx)(Qa,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function el({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===wr.Left||e===wr.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function tl({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top}){const[s,a]=el({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=el({pos:i,x1:o,y1:r,x2:e,y2:t}),[d,u,f,h]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,d,u,f,h]}function nl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})=>{const[v,w,b]=tl({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),_=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:_,path:v,labelX:w,labelY:b,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})})}const ol=nl({isInternal:!1}),rl=nl({isInternal:!0});function il(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,sourcePosition:p=wr.Bottom,targetPosition:g=wr.Top,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=bi({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:g,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),k=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:k,path:w,labelX:b,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:y,interactionWidth:v})})}ol.displayName="SimpleBezierEdge",rl.displayName="SimpleBezierEdgeInternal";const sl=il({isInternal:!1}),al=il({isInternal:!0});function ll(e){return(0,a().memo)(({id:t,...n})=>{const o=e.isInternal?void 0:t;return(0,c.jsx)(sl,{...n,id:o,pathOptions:(0,a().useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}sl.displayName="SmoothStepEdge",al.displayName="SmoothStepEdgeInternal";const cl=ll({isInternal:!1}),dl=ll({isInternal:!0});function ul(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})=>{const[y,x,v]=yi({sourceX:n,sourceY:o,targetX:r,targetY:i}),w=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:w,path:y,labelX:x,labelY:v,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})})}cl.displayName="StepEdge",dl.displayName="StepEdgeInternal";const fl=ul({isInternal:!1}),hl=ul({isInternal:!0});function pl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=wr.Bottom,targetPosition:a=wr.Top,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=hi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:x?.curvature}),k=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:k,path:w,labelX:b,labelY:_,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})})}fl.displayName="StraightEdge",hl.displayName="StraightEdgeInternal";const gl=pl({isInternal:!1}),ml=pl({isInternal:!0});gl.displayName="BezierEdge",ml.displayName="BezierEdgeInternal";const yl={default:ml,straight:hl,step:dl,smoothstep:al,simplebezier:rl},xl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},vl=(e,t,n)=>n===wr.Left?e-t:n===wr.Right?e+t:e,wl=(e,t,n)=>n===wr.Top?e-t:n===wr.Bottom?e+t:e,bl="react-flow__edgeupdater";function _l({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return(0,c.jsx)("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:d([bl,`${bl}-${a}`]),cx:vl(t,o,e),cy:wl(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function kl({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:d,onReconnectStart:u,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=bs(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:o,domNode:r,connectionMode:i,connectionRadius:s,lib:a,onConnectStart:l,cancelConnection:c,nodeLookup:p,rfId:m,panBy:y,updateConnection:x}=g.getState(),v="target"===t.type;Yi.onPointerDown(e.nativeEvent,{autoPanOnConnect:o,connectionMode:i,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:p,isTarget:v,edgeUpdaterType:t.type,lib:a,flowId:m,cancelConnection:c,panBy:y,isValidConnection:(...e)=>g.getState().isValidConnection?.(...e)??!0,onConnect:e=>d?.(n,e),onConnectStart:(o,r)=>{h(!0),u?.(e,n,t.type),l?.(o,r)},onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),onReconnectEnd:(e,o)=>{h(!1),f?.(e,n,t.type,o)},updateConnection:x,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},y=()=>p(!0),x=()=>p(!1);return(0,c.jsxs)(c.Fragment,{children:[(!0===e||"source"===e)&&(0,c.jsx)(_l,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:e=>m(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:x,type:"source"}),(!0===e||"target"===e)&&(0,c.jsx)(_l,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:e=>m(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:x,type:"target"})]})}var Sl=(0,a().memo)(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,rfId:y,edgeTypes:x,noPanClassName:v,onError:w,disableKeyboardA11y:b}){let _=ws(t=>t.edgeLookup.get(e));const k=ws(e=>e.defaultEdgeOptions);_=k?{...k,..._}:_;let S=_.type||"default",C=x?.[S]||yl[S];void 0===C&&(w?.("011",(e=>`Edge type "${e}" not found. Using fallback type "default".`)(S)),S="default",C=x?.default||yl.default);const N=!!(_.focusable||t&&void 0===_.focusable),E=void 0!==p&&(_.reconnectable||n&&void 0===_.reconnectable),M=!!(_.selectable||o&&void 0===_.selectable),P=(0,a().useRef)(null),[j,D]=(0,a().useState)(!1),[I,O]=(0,a().useState)(!1),z=bs(),{zIndex:A=_.zIndex,sourceX:R,sourceY:L,targetX:B,targetY:T,sourcePosition:$,targetPosition:V}=ws((0,a().useCallback)(t=>{const n=t.nodeLookup.get(_.source),o=t.nodeLookup.get(_.target);if(!n||!o)return xl;const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;const o=t.internals.handleBounds||ki(t.handles),r=n.internals.handleBounds||ki(n.handles),i=Ci(o?.source??[],e.sourceHandle),s=Ci(e.connectionMode===pr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`)(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||wr.Bottom,l=s?.position||wr.Top,c=Si(t,i,a),d=Si(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}({id:e,sourceNode:n,targetNode:o,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:t.connectionMode,onError:w}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){return"manual"===i?o:(r&&n?o+1e3:o)+Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0)}({selected:_.selected,zIndex:_.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...r||xl,zIndex:i}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex,w]),gs),H=(0,a().useMemo)(()=>_.markerStart?`url('#${Ni(_.markerStart,y)}')`:void 0,[_.markerStart,y]),Z=(0,a().useMemo)(()=>_.markerEnd?`url('#${Ni(_.markerEnd,y)}')`:void 0,[_.markerEnd,y]);if(_.hidden||null===R||null===L||null===B||null===T)return null;const F=i?e=>{i(e,{..._})}:void 0,Y=s?e=>{s(e,{..._})}:void 0,X=l?e=>{l(e,{..._})}:void 0,q=u?e=>{u(e,{..._})}:void 0,W=f?e=>{f(e,{..._})}:void 0;return(0,c.jsx)("svg",{style:{zIndex:A},children:(0,c.jsxs)("g",{className:d(["react-flow__edge",`react-flow__edge-${S}`,_.className,v,{selected:_.selected,animated:_.animated,inactive:!M&&!r,updating:j,selectable:M}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:o,multiSelectionActive:i}=z.getState();M&&(z.setState({nodesSelectionActive:!1}),_.selected&&i?(o({nodes:[],edges:[_]}),P.current?.blur()):n([e])),r&&r(t,_)},onDoubleClick:F,onContextMenu:Y,onMouseEnter:X,onMouseMove:q,onMouseLeave:W,onKeyDown:N?t=>{if(!b&&fr.includes(t.key)&&M){const{unselectNodesAndEdges:n,addSelectedEdges:o}=z.getState();"Escape"===t.key?(P.current?.blur(),n({edges:[_]})):o([e])}}:void 0,tabIndex:N?0:void 0,role:_.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===_.ariaLabel?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":N?`${Cs}-${y}`:void 0,ref:P,..._.domAttributes,children:[!I&&(0,c.jsx)(C,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:M,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:R,sourceY:L,targetX:B,targetY:T,sourcePosition:$,targetPosition:V,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:H,markerEnd:Z,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),E&&(0,c.jsx)(kl,{edge:_,isReconnectable:E,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,sourceX:R,sourceY:L,targetX:B,targetY:T,sourcePosition:$,targetPosition:V,setUpdateHover:D,setReconnecting:O})]})})});const Cl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Nl({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,onError:b}=ws(Cl,gs),_=(k=t,ws((0,a().useCallback)(e=>{if(!k)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&gi({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[k]),gs));var k;return(0,c.jsxs)("div",{className:"react-flow__edges",children:[(0,c.jsx)(Ga,{defaultColor:e,rfId:n}),_.map(e=>(0,c.jsx)(Sl,{id:e,edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:d,onMouseLeave:u,onClick:f,reconnectRadius:h,onDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:o,disableKeyboardA11y:y},e))]})}Nl.displayName="EdgeRenderer";const El=(0,a().memo)(Nl),Ml=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Pl({children:e}){const t=bs(),n=(0,a().useRef)(null),[o]=(0,a().useState)(()=>t.getState().transform);return aa(()=>{let e=null;const o=()=>{const o=t.getState().transform;e&&o[0]===e[0]&&o[1]===e[1]&&o[2]===e[2]||(e=o,n.current&&(n.current.style.transform=Ml(o)))};return o(),t.subscribe(o)},[t]),(0,c.jsx)("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Ml(o)},children:e})}const jl=e=>e.panZoom?.syncViewport;function Dl(e){return e.connection.inProgress?{...e.connection,to:Fr(e.connection.to,e.transform)}:{...e.connection}}const Il=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ol({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=ws(Il,gs);return i&&r&&l?(0,c.jsx)("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:(0,c.jsx)("g",{className:d(["react-flow__connection",ti(a)]),children:(0,c.jsx)(zl,{style:t,type:n,CustomComponent:o,isValid:a})})}):null}const zl=({style:e,type:t=xr.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:d,toNode:u,toHandle:f,toPosition:h,pointer:p}=ws(function(e){return e?t=>{const n=Dl(t);return e(n)}:Dl}(g),gs);var g;if(!r)return;if(n)return(0,c.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:l,toPosition:h,connectionStatus:ti(o),toNode:u,toHandle:f,pointer:p});let m="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:d.x,targetY:d.y,targetPosition:h};switch(t){case xr.Bezier:[m]=hi(y);break;case xr.SimpleBezier:[m]=tl(y);break;case xr.Step:[m]=bi({...y,borderRadius:0});break;case xr.SmoothStep:[m]=bi(y);break;default:[m]=yi(y)}return(0,c.jsx)("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};zl.displayName="ConnectionLine";const Al={};function Rl(e=Al){(0,a().useRef)(e),bs(),(0,a().useEffect)(()=>{},[e])}function Ll({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:p,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:v,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:N,onlyRenderVisibleElements:E,elementsSelectable:M,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,preventScrolling:O,defaultMarkerColor:z,zoomOnScroll:A,zoomOnPinch:R,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,zoomOnDoubleClick:$,panOnDrag:V,autoPanOnSelection:H,onPaneClick:Z,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneScroll:q,onPaneContextMenu:W,paneClickDistance:K,nodeClickDistance:G,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,viewport:ue,onViewportChange:fe,nodesDraggable:he}){return Rl(e),Rl(t),bs(),(0,a().useRef)(!1),(0,a().useEffect)(()=>{},[]),function(e){const t=fa(),n=(0,a().useRef)(!1);(0,a().useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(n),function(e){const t=ws(jl),n=bs();(0,a().useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(ue),(0,c.jsx)(Va,{onPaneClick:Z,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneContextMenu:W,onPaneScroll:q,paneClickDistance:K,deleteKeyCode:N,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:M,zoomOnScroll:A,zoomOnPinch:R,zoomOnDoubleClick:$,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,panOnDrag:V,autoPanOnSelection:H,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,onSelectionContextMenu:h,preventScrolling:O,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,onViewportChange:fe,isControlledViewport:!!ue,children:(0,c.jsxs)(Pl,{children:[(0,c.jsx)(El,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,onlyRenderVisibleElements:E,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,defaultMarkerColor:z,noPanClassName:ae,disableKeyboardA11y:le,rfId:de}),(0,c.jsx)(Ol,{style:y,type:m,component:x,containerStyle:v}),(0,c.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,c.jsx)(Xa,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:G,onlyRenderVisibleElements:E,noPanClassName:ae,noDragClassName:ie,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,nodesDraggable:he}),(0,c.jsx)("div",{className:"react-flow__viewport-portal"})]})})}Ll.displayName="GraphView";const Bl=(0,a().memo)(Ll),Tl=(e,t)=>{},$l=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,p=new Map,g=new Map,m=new Map,y=o??t??[],x=n??e??[],v=d??[0,0],w=u??ur;Li(g,m,y);const{nodesInitialized:b}=Ii(x,h,p,{nodeOrigin:v,nodeExtent:w,zIndexMode:f});let _=[0,0,1];if(s&&r&&i){const e=Cr(h,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=qr(e,r,i,l,c,a?.padding??.1);_=[t,n,o]}return{rfId:"1",width:r??0,height:i??0,transform:_,nodes:x,nodesInitialized:b,nodeLookup:h,parentLookup:p,edges:y,edgeLookup:m,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:ur,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:pr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...yr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Tl,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:hr,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},Vl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>{return h=(h,p)=>{async function g(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:s,maxZoom:a}=p();t&&(await async function({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(0===e.size)return!0;const a=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let r;if(t?.includeHiddenNodes){const{width:t,height:n}=Gr(e);r=t>0&&n>0}else r=Boolean(e.measured.width&&e.measured.height&&!e.hidden);!r||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,s),l=Cr(a),c=qr(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}({nodes:e,width:r,height:i,panZoom:t,minZoom:s,maxZoom:a},n),o?.resolve(!0),h({fitViewResolver:null}))}return{...$l({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,fitViewQueued:s,zIndexMode:a,nodesSelectionActive:l}=p(),{nodesInitialized:c,hasSelectedNodes:d}=Ii(e,t,n,{nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:a}),u=l&&d;s&&c?(g(),h({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):h({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=p();Li(t,n,e),h({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=p();t(e),h({hasDefaultNodes:!0})}if(t){const{setEdges:e}=p();e(t),h({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:s,debug:a,fitViewQueued:l,zIndexMode:c}=p(),{changes:d,updatedInternals:u}=function(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),l=!0;continue}const a=oi(o.nodeElement),d=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(d||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),p=Kr(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;if(e.parentId&&"parent"===e.extent){const n=t.get(e.parentId);n&&(g=jr(g,a,n))}else p&&(g=Pr(g,p,a));const m={...e,measured:a,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:ci("source",o.nodeElement,h,u,e.id),target:ci("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,m),e.parentId&&Oi(m,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,d&&(c.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Rr(m,r)}))}}if(f.length>0){const e=Ai(f,t,n,r);c.push(...e)}return{changes:c,updatedInternals:l}}(e,n,o,r,i,s,c);u&&(function(e,t,n){const o=Pi(Ei,n);for(const n of e.values())if(n.parentId)Oi(n,e,t,o);else{const e=Sr(n,o.nodeOrigin),t=Kr(n.extent)?n.extent:o.nodeExtent,r=Pr(e,t,Gr(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:s,zIndexMode:c}),l?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),d?.length>0&&(a&&console.log("React Flow: trigger node changes",d),t?.(d)))},updateNodePositions:(e,t=!1)=>{const n=[];let o=[];const{nodeLookup:r,triggerNodeChanges:i,connection:s,updateConnection:a,onNodesChangeMiddlewareMap:l}=p();for(const[i,l]of e){const e=r.get(i),c=!!(e?.expandParent&&e?.parentId&&l?.position),d={id:i,type:"position",position:c?{x:Math.max(0,l.position.x),y:Math.max(0,l.position.y)}:l.position,dragging:t};if(e&&s.inProgress&&s.fromNode.id===e.id){const t=Si(e,s.fromHandle,wr.Left,!0);a({...s,from:t})}c&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...l.internals.positionAbsolute,width:l.measured.width??0,height:l.measured.height??0}}),o.push(d)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),i=Ai(n,r,e,t);o.push(...i)}for(const e of l.values())o=e(o);i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=p();e?.length&&(r&&n(Qs(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=p();e?.length&&(r&&n(Js(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?r(e.map(e=>ea(e,!0))):(r(ta(o,new Set([...e]),!0)),i(ta(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?i(e.map(e=>ea(e,!0))):(i(ta(n,new Set([...e]))),r(ta(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:s}=p(),a=e||o,l=t||n,c=[];for(const e of a){if(!e.selected)continue;const t=r.get(e.id);t&&(t.selected=!1),c.push(ea(e.id,!1))}const d=[];for(const e of l)e.selected&&d.push(ea(e.id,!1));i(c),s(d)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),h({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),h({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),h({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=p();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]),s=e.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]);n(i),o(s)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:s,zIndexMode:a}=p();e[0][0]===s[0][0]&&e[0][1]===s[0][1]&&e[1][0]===s[1][0]&&e[1][1]===s[1][1]||(Ii(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1,zIndexMode:a}),h({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=p();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:s}=p();if(!s)return!1;const a=void 0!==n?.zoom?n.zoom:i;return await s.setViewport({x:o/2-e*a,y:r/2-t*a,zoom:a},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{h({connection:{...yr}})},updateConnection:e=>{h({connection:e})},reset:()=>h({...$l()})}},p=Object.is,h?ps(h,p):ps;var h,p};function Hl({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:d,fitView:u,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:g}){const[m]=(0,a().useState)(()=>Vl({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:u,minZoom:s,maxZoom:l,fitViewOptions:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}));return(0,c.jsx)(xs,{value:m,children:(0,c.jsx)(da,{children:(0,c.jsx)(Da,{children:g})})})}function Zl({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:l,fitViewOptions:d,minZoom:u,maxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g}){return(0,a().useContext)(ys)?(0,c.jsx)(c.Fragment,{children:e}):(0,c.jsx)(Hl,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:d,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g,children:e})}const Fl={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Yl=sa(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:f,onMove:h,onMoveStart:p,onMoveEnd:g,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onSelectionChange:I,onSelectionDragStart:O,onSelectionDrag:z,onSelectionDragStop:A,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:B,onBeforeDelete:T,connectionMode:$,connectionLineType:V=xr.Bezier,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:F,deleteKeyCode:Y="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:q=!1,selectionMode:W=mr.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:G=(Wr()?"Meta":"Control"),zoomActivationKeyCode:U=(Wr()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:se=Ts,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:de=$s,minZoom:ue=.5,maxZoom:fe=2,translateExtent:he=ur,preventScrolling:pe=!0,nodeExtent:ge,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:xe=!0,panOnScroll:ve=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=gr.Free,zoomOnDoubleClick:_e=!0,panOnDrag:ke=!0,onPaneClick:Se,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je=1,nodeClickDistance:De=0,children:Ie,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:$e,reconnectRadius:Ve=10,onNodesChange:He,onEdgesChange:Ze,noDragClassName:Fe="nodrag",noWheelClassName:Ye="nowheel",noPanClassName:Xe="nopan",fitView:qe,fitViewOptions:We,connectOnClick:Ke,attributionPosition:Ge,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je=!0,elevateEdgesOnSelect:et=!1,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanOnSelection:rt=!0,autoPanSpeed:it,connectionRadius:st,isValidConnection:at,onError:lt,style:ct,id:dt,nodeDragThreshold:ut,connectionDragThreshold:ft,viewport:ht,onViewportChange:pt,width:gt,height:mt,colorMode:yt="light",debug:xt,onScroll:vt,ariaLabelConfig:wt,zIndexMode:bt="basic",..._t},kt){const St=dt||"1",Ct=function(e){const[t,n]=(0,a().useState)("system"===e?null:e);return(0,a().useEffect)(()=>{if("system"!==e)return void n(e);const t=Ys(),o=()=>n(t?.matches?"dark":"light");return o(),t?.addEventListener("change",o),()=>{t?.removeEventListener("change",o)}},[e]),null!==t?t:Ys()?.matches?"dark":"light"}(yt),Nt=(0,a().useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return(0,c.jsx)("div",{"data-testid":"rf__wrapper",..._t,onScroll:Nt,style:{...ct,...Fl},ref:kt,className:d(["react-flow",r,Ct]),id:dt,role:"application",children:(0,c.jsxs)(Zl,{nodes:e,edges:t,width:gt,height:mt,fitView:qe,fitViewOptions:We,minZoom:ue,maxZoom:fe,nodeOrigin:se,nodeExtent:ge,zIndexMode:bt,children:[(0,c.jsx)(Fs,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:ue,maxZoom:fe,nodeExtent:ge,onNodesChange:He,onEdgesChange:Ze,snapToGrid:Q,snapGrid:J,connectionMode:$,translateExtent:he,connectOnClick:Ke,defaultEdgeOptions:Qe,fitView:qe,fitViewOptions:We,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onSelectionDrag:z,onSelectionDragStart:O,onSelectionDragStop:A,onMove:h,onMoveStart:p,onMoveEnd:g,noPanClassName:Xe,nodeOrigin:se,rfId:St,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:it,onError:lt,connectionRadius:st,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:ft,onBeforeDelete:T,debug:xt,ariaLabelConfig:wt,zIndexMode:bt}),(0,c.jsx)(Bl,{onInit:f,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:s,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:F,selectionKeyCode:X,selectionOnDrag:q,selectionMode:W,deleteKeyCode:Y,multiSelectionKeyCode:G,panActivationKeyCode:K,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:de,translateExtent:he,minZoom:ue,maxZoom:fe,preventScrolling:pe,zoomOnScroll:ye,zoomOnPinch:xe,zoomOnDoubleClick:_e,panOnScroll:ve,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:ke,autoPanOnSelection:rt,onPaneClick:Se,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je,nodeClickDistance:De,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:B,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:$e,reconnectRadius:Ve,defaultMarkerColor:me,noDragClassName:Fe,noWheelClassName:Ye,noPanClassName:Xe,rfId:St,disableKeyboardA11y:tt,nodeExtent:ge,viewport:ht,onViewportChange:pt,nodesDraggable:ne}),(0,c.jsx)(Bs,{onSelectionChange:I}),Ie,(0,c.jsx)(Is,{proOptions:Ue,position:Ge}),(0,c.jsx)(Ps,{rfId:St,disableKeyboardA11y:tt})]})})});const Xl=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function ql({children:e}){const t=ws(Xl);return t?(0,ms.createPortal)(e,t):null}function Wl({dimensions:e,lineWidth:t,variant:n,className:o}){return(0,c.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:d(["react-flow__background-pattern",n,o])})}function Kl({radius:e,className:t}){return(0,c.jsx)("circle",{cx:e,cy:e,r:e,className:d(["react-flow__background-pattern","dots",t])})}var Gl;!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Gl||(Gl={}));const Ul={[Gl.Dots]:1,[Gl.Lines]:1,[Gl.Cross]:6},Ql=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Jl({id:e,variant:t=Gl.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:l,style:u,className:f,patternClassName:h}){const p=(0,a().useRef)(null),{transform:g,patternId:m}=ws(Ql,gs),y=o||Ul[t],x=t===Gl.Dots,v=t===Gl.Cross,w=Array.isArray(n)?n:[n,n],b=[w[0]*g[2]||1,w[1]*g[2]||1],_=y*g[2],k=Array.isArray(i)?i:[i,i],S=v?[_,_]:b,C=[k[0]*g[2]+S[0]/2,k[1]*g[2]+S[1]/2],N=`${m}${e||""}`;return(0,c.jsxs)("svg",{className:d(["react-flow__background",f]),style:{...u,...ga,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:p,"data-testid":"rf__background",children:[(0,c.jsx)("pattern",{id:N,x:g[0]%b[0],y:g[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:x?(0,c.jsx)(Kl,{radius:_/2,className:h}):(0,c.jsx)(Wl,{dimensions:S,lineWidth:r,variant:t,className:h})}),(0,c.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}Jl.displayName="Background";const ec=(0,a().memo)(Jl);function tc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,c.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function nc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,c.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function oc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,c.jsx)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function rc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ic(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sc({children:e,className:t,...n}){return(0,c.jsx)("button",{type:"button",className:d(["react-flow__controls-button",t]),...n,children:e})}const ac=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function lc({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:u,children:f,position:h="bottom-left",orientation:p="vertical","aria-label":g}){const m=bs(),{isInteractive:y,minZoomReached:x,maxZoomReached:v,ariaLabelConfig:w}=ws(ac,gs),{zoomIn:b,zoomOut:_,fitView:k}=fa(),S="horizontal"===p?"horizontal":"vertical";return(0,c.jsxs)(js,{className:d(["react-flow__controls",S,u]),position:h,style:e,"data-testid":"rf__controls","aria-label":g??w["controls.ariaLabel"],children:[t&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(sc,{onClick:()=>{b(),i?.()},className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:v,children:(0,c.jsx)(tc,{})}),(0,c.jsx)(sc,{onClick:()=>{_(),s?.()},className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:x,children:(0,c.jsx)(nc,{})})]}),n&&(0,c.jsx)(sc,{className:"react-flow__controls-fitview",onClick:()=>{k(r),a?.()},title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:(0,c.jsx)(oc,{})}),o&&(0,c.jsx)(sc,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),l?.(!y)},title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:y?(0,c.jsx)(ic,{}):(0,c.jsx)(rc,{})}),f]})}lc.displayName="Controls";const cc=(0,a().memo)(lc),dc=(0,a().memo)(function({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:u,borderRadius:f,shapeRendering:h,selected:p,onClick:g}){const{background:m,backgroundColor:y}=i||{},x=s||m||y;return(0,c.jsx)("rect",{className:d(["react-flow__minimap-node",{selected:p},u]),x:t,y:n,rx:f,ry:f,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:l},shapeRendering:h,onClick:g?t=>g(t,e):void 0})}),uc=e=>e.nodes.map(e=>e.id),fc=e=>e instanceof Function?e:()=>e,hc=(0,a().memo)(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:d,x:u,y:f,width:h,height:p}=ws(t=>{const n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};const o=n.internals.userNode,{x:r,y:i}=n.internals.positionAbsolute,{width:s,height:a}=Gr(o);return{node:o,x:r,y:i,width:s,height:a}},gs);return d&&!d.hidden&&Ur(d)?(0,c.jsx)(a,{x:u,y:f,width:h,height:p,style:d.style,selected:!!d.selected,className:o(d),color:t(d),borderRadius:r,strokeColor:n(d),strokeWidth:i,shapeRendering:s,onClick:l,id:d.id}):null});var pc=(0,a().memo)(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=dc,onClick:s}){const a=ws(uc,gs),l=fc(t),d=fc(e),u=fc(n),f="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,c.jsx)(c.Fragment,{children:a.map(e=>(0,c.jsx)(hc,{id:e,nodeColorFunc:l,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:f},e))})});const gc=e=>!e.hidden,mc=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};let n=!1;for(const t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?Br(Cr(e.nodeLookup,{filter:gc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},yc=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,xc=(e,t)=>yc(e.viewBB,t.viewBB)&&yc(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function vc({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:f,maskStrokeColor:h,maskStrokeWidth:p,position:g="bottom-right",onClick:m,onNodeClick:y,pannable:x=!1,zoomable:v=!1,ariaLabel:w,inversePan:b,zoomStep:_=1,offsetScale:k=5}){const S=bs(),C=(0,a().useRef)(null),{boundingRect:N,panZoom:E,viewBB:M,rfId:P,translateExtent:j,flowWidth:D,flowHeight:I,ariaLabelConfig:O}=ws(mc,xc),z=e?.width??200,A=e?.height??150,R=N.width/z,L=N.height/A,B=Math.max(R,L),T=B*z,$=B*A,V=k*B,H=N.x-(T-N.width)/2-V,Z=N.y-($-N.height)/2-V,F=T+2*V,Y=$+2*V,X=`react-flow__minimap-desc-${P}`,q=(0,a().useRef)(0),W=(0,a().useRef)();q.current=B,(0,a().useEffect)(()=>{const e=S.getState().panZoom;if(C.current&&e)return W.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=dt(e);return{update:function({translateExtent:e,width:i,height:s,zoomStep:a=1,pannable:l=!0,zoomable:c=!0,inversePan:d=!1}){let u=[0,0];const f=ir().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(u=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const a=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-u[0],l[1]-u[1]];u=l;const f=o()*Math.max(a[2],Math.log(a[2]))*(d?-1:1),h={x:a[0]-c[0]*f,y:a[1]-c[1]*f},p=[[0,0],[i,s]];t.setViewportConstrained({x:h.x,y:h.y,zoom:a[2]},p,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const o=n(),r=e.sourceEvent.ctrlKey&&Wr()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*a,s=o[2]*Math.pow(2,i*r);t.scaleTo(s)}:null);r.call(f,{})},destroy:function(){r.on("zoom",null)},pointer:ft}}({domNode:C.current,panZoom:e,getTransform:()=>S.getState().transform,getViewScale:()=>q.current}),()=>{W.current?.destroy()}},[E]),(0,a().useEffect)(()=>{W.current?.update({translateExtent:j,width:D,height:I,inversePan:b,pannable:x,zoomStep:_,zoomable:v})},[x,v,b,_,j,D,I]);const K=m?e=>{const[t,n]=W.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,G=(0,a().useCallback)((e,t)=>{const n=S.getState().nodeLookup.get(t).internals.userNode;y?.(e,n)},[y]),U=y?G:void 0,Q=w??O["minimap.ariaLabel"];return(0,c.jsx)(js,{position:g,style:{...e,"--xy-minimap-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof p?p*B:void 0,"--xy-minimap-node-background-color-props":"string"==typeof o?o:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof s?s:void 0},className:d(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,c.jsxs)("svg",{width:z,height:A,viewBox:`${H} ${Z} ${F} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:C,onClick:K,children:[Q&&(0,c.jsx)("title",{id:X,children:Q}),(0,c.jsx)(pc,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:l}),(0,c.jsx)("path",{className:"react-flow__minimap-mask",d:`M${H-V},${Z-V}h${F+2*V}v${Y+2*V}h${-F-2*V}z\n M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vc.displayName="MiniMap";const wc=(0,a().memo)(vc),bc={[es.Line]:"right",[es.Handle]:"bottom-right"};(0,a().memo)(function({nodeId:e,position:t,variant:n=es.Handle,className:o,style:r,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:m=!0,shouldResize:y,onResizeStart:x,onResize:v,onResizeEnd:w}){const b=Ma(),_="string"==typeof e?e:b,k=bs(),S=(0,a().useRef)(null),C=n===es.Handle,N=ws((0,a().useCallback)((E=C&&m,e=>E?`${Math.max(1/e.transform[2],1)}`:void 0),[C,m]),gs);var E;const M=(0,a().useRef)(null),P=t??bc[n];(0,a().useEffect)(()=>{if(S.current&&_)return M.current||(M.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=dt(e);let s={controlDirection:ts("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:l,resizeDirection:c,onResizeStart:d,onResize:u,onResizeEnd:f,shouldResize:h}){let p,g={...ss},m={...as};s={boundaries:a,resizeDirection:c,keepAspectRatio:l,controlDirection:ts(e)};let y,x,v,w=null,b=[];const _=Ct().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:s,nodeOrigin:a,paneDomNode:l}=n();if(p=o.get(t),!p)return;w=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:u}=ni(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:s,containerBounds:w});g={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},m={...g,pointerX:c,pointerY:u,aspectRatio:g.width/g.height},y=void 0,x=Kr(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(y=o.get(p.parentId)),y&&"parent"===p.extent&&(x=[[0,0],[y.measured.width,y.measured.height]]),b=[],v=void 0;for(const[e,n]of o)if(n.parentId===t&&(b.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ls(n,p,n.origin??a);v=v?[[Math.min(e[0][0],v[0][0]),Math.min(e[0][1],v[0][1])],[Math.max(e[1][0],v[1][0]),Math.max(e[1][1],v[1][1])]]:e}d?.(e,{...g})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:a}=n(),l=ni(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!p)return;const{x:d,y:f,width:_,height:k}=g,S={},C=p.origin??a,{width:N,height:E,x:M,y:P}=function(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:x}=o,{x:v,y:w,width:b,height:_,aspectRatio:k}=e;let S=Math.floor(d?h-e.pointerX:0),C=Math.floor(u?p-e.pointerY:0);const N=b+(l?-S:S),E=_+(c?-C:C),M=-i[0]*b,P=-i[1]*_;let j=rs(N,g,m),D=rs(E,y,x);if(s){let e=0,t=0;l&&S<0?e=ns(v+S+M,s[0][0]):!l&&S>0&&(e=os(v+N+M,s[1][0])),c&&C<0?t=ns(w+C+P,s[0][1]):!c&&C>0&&(t=os(w+E+P,s[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(a){let e=0,t=0;l&&S>0?e=os(v+S,a[0][0]):!l&&S<0&&(e=ns(v+N,a[1][0])),c&&C>0?t=os(w+C,a[0][1]):!c&&C<0&&(t=ns(w+E,a[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(r){if(d){const e=rs(N/k,y,x)*k;if(j=Math.max(j,e),s){let e=0;e=!l&&!c||l&&!c&&f?os(w+P+N/k,s[1][1])*k:ns(w+P+(l?S:-S)/k,s[0][1])*k,j=Math.max(j,e)}if(a){let e=0;e=!l&&!c||l&&!c&&f?ns(w+N/k,a[1][1])*k:os(w+(l?S:-S)/k,a[0][1])*k,j=Math.max(j,e)}}if(u){const e=rs(E*k,g,m)/k;if(D=Math.max(D,e),s){let e=0;e=!l&&!c||c&&!l&&f?os(v+E*k+M,s[1][0])/k:ns(v+(c?C:-C)*k+M,s[0][0])/k,D=Math.max(D,e)}if(a){let e=0;e=!l&&!c||c&&!l&&f?ns(v+E*k,a[1][0])/k:os(v+(c?C:-C)*k,a[0][0])/k,D=Math.max(D,e)}}}C+=C<0?D:-D,S+=S<0?j:-j,r&&(f?N>E*k?C=(is(l,c)?-S:S)/k:S=(is(l,c)?-C:C)*k:d?(C=S/k,c=l):(S=C*k,l=c));const I=l?v+S:v,O=c?w+C:w;return{width:b+(l?-S:S),height:_+(c?-C:C),x:i[0]*S*(l?-1:1)+I,y:i[1]*C*(c?-1:1)+O}}(m,s.controlDirection,l,s.boundaries,s.keepAspectRatio,C,x,v),j=N!==_,D=E!==k,I=M!==d&&j,O=P!==f&&D;if(!(I||O||j||D))return;const z={prevValues:{...g},startX:m.x,startY:m.y,childNodes:b.map(e=>({...e,position:{...e.position}}))};if((I||O||1===C[0]||1===C[1])&&(S.x=I?M:g.x,S.y=O?P:g.y,g.x=S.x,g.y=S.y,b.length>0)){const e=M-d,t=P-f;for(const n of b)n.position={x:n.position.x-e+C[0]*(N-_),y:n.position.y-t+C[1]*(E-k)},c.push(n)}if((j||D)&&(S.width=!j||s.resizeDirection&&"horizontal"!==s.resizeDirection?g.width:N,S.height=!D||s.resizeDirection&&"vertical"!==s.resizeDirection?g.height:E,g.width=S.width,g.height=S.height),y&&p.expandParent){const e=C[0]*(S.width??0);S.x&&S.x<e&&(g.x=e,m.x=m.x-(S.x-e));const t=C[1]*(S.height??0);S.y&&S.y<t&&(g.y=t,m.y=m.y-(S.y-t))}const A=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=-1*l[0]),a&&i&&(l[1]=-1*l[1]),l}({width:g.width,prevWidth:_,height:g.height,prevHeight:k,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),R={...g,direction:A},L=h?.(e,R);if(!1===L)return g=z.prevValues,m.x=z.startX,m.y=z.startY,void b.forEach((e,t)=>{e.position=z.childNodes[t].position});u?.(e,R),o(S,c)}).on("end",e=>{f?.(e,{...g}),r?.({...g})});i.call(_)},destroy:function(){i.on(".drag",null)}}}({domNode:S.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=k.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=k.getState(),s=[],a={x:e.x,y:e.y},l=o.get(_);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,d=Ai([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Qr({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);s.push(...d),a.x=e.x?Math.max(t[0]*n,e.x):void 0,a.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==a.x&&void 0!==a.y){const e={id:_,type:"position",position:{...a}};s.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:_,type:"dimensions",resizing:!0,setAttributes:!g||("horizontal"===g?"width":"height"),dimensions:{width:e.width,height:e.height}};s.push(t)}for(const e of t){const t={...e,type:"position"};s.push(t)}n(s)},onEnd:({width:e,height:t})=>{const n={id:_,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};k.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:l,minHeight:u,maxWidth:f,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:x,onResize:v,onResizeEnd:w,shouldResize:y}),()=>{M.current?.destroy()}},[P,l,u,f,h,p,x,v,w,y]);const j=P.split("-");return(0,c.jsx)("div",{className:d(["react-flow__resize-control","nodrag",...j,n,o]),ref:S,style:{...r,scale:N,...s&&{[C?"backgroundColor":"borderColor"]:s}},children:i})});const _c=window.wp.i18n,kc=window.wp.apiFetch;var Sc=n.n(kc);const Cc=window.wp.components,Nc=window.wp.hooks,Ec=window.funnelforkEditor||{};function Mc(e){return`${e}_${Math.random().toString(36).slice(2,8)}`}const Pc=["#1e1e1e","#3858e9","#f0b849","#4ab866","#cc1818","#e26f56","#33b3db","#9b51e0","#e64ca2","#738a94"];function jc(){return(Ec.yesnoAnswers||[{id:"yes",text:(0,_c.__)("Yes","funnelfork"),labels:[]},{id:"no",text:(0,_c.__)("No","funnelfork"),labels:[]}]).map(e=>({...e,labels:[],points:0}))}function Dc(e){return"start"===e.type?["next"]:"question"===e.type?e.data.answers.map(e=>e.id):[]}function Ic(e,t,n){if(t===n)return!0;const o=[n],r=new Set;for(;o.length;){const n=o.pop();if(n===t)return!0;r.has(n)||(r.add(n),e.forEach(e=>e.source===n&&o.push(e.target)))}return!1}function Oc(e){return e?"start"===e.type?(0,_c.__)("Start","funnelfork"):"end"===e.type?e.data.title||(0,_c.__)("(untitled result)","funnelfork"):e.data.question||(0,_c.__)("(empty question)","funnelfork"):""}function zc(e){return e.find(e=>"end"===e.type&&e.data.isDefault)||e.find(e=>"end"===e.type)}function Ac(e){return e.filter(e=>"question"===e.type).sort((e,t)=>e.position.x-t.position.x||e.position.y-t.position.y).map(e=>e.id)}function Rc(e,t,n,o=Ac(e)){if("score"===t){const t=o[o.indexOf(n)+1];if(t)return e.find(e=>e.id===t)}return zc(e)}function Lc(e){return null!=e&&""!==e}function Bc(e){return Lc(e.scoreMin)||Lc(e.scoreMax)}function Tc(e){const t=Lc(e.scoreMin)?Number(e.scoreMin):null,n=Lc(e.scoreMax)?Number(e.scoreMax):null;return null!==t&&null!==n?t===n?(0,_c.sprintf)(/* translators: %d: score. */ /* translators: %d: score. */ 2 2 (0,_c.__)("Score %d","funnelfork"),t):(0,_c.sprintf)(/* translators: 1: lowest score, 2: highest score. */ /* translators: 1: lowest score, 2: highest score. */ 3 3 (0,_c.__)("Score %1$d – %2$d","funnelfork"),t,n):null!==t?(0,_c.sprintf)(/* translators: %d: lowest score. */ /* translators: %d: lowest score. */ 4 4 (0,_c.__)("Score %d or more","funnelfork"),t):null!==n?(0,_c.sprintf)(/* translators: %d: highest score. */ /* translators: %d: highest score. */ 5 (0,_c.__)("Score %d or less","funnelfork"),n):(0,_c.__)("No score range","funnelfork")}function Bc(e){return e.filter(e=>"question"===e.type&&e.data.answers.length).reduce((e,t)=>{const n=t.data.answers.map(e=>Number(e.points)||0);return{min:e.min+Math.min(...n),max:e.max+Math.max(...n)}},{min:0,max:0})}function $c({nodes:e,edges:t,labels:n,settings:o}){return{version:1,settings:o,labels:n,nodes:e.map(({id:e,type:t,position:n,data:o})=>({id:e,type:t,position:n,data:o})),edges:t.map(({id:e,source:t,sourceHandle:n,target:o})=>({id:e,source:t,sourceHandle:n,target:o}))}}function Vc(e){return{nodes:e.nodes.map(e=>({...e,deletable:"start"!==e.type})),edges:e.edges.map(e=>({...e,type:"flow"})),labels:e.labels,settings:e.settings}}const Hc=(0,l.createContext)({labels:[],edges:[],defaultEndId:null,issuesByNode:{},mode:"flow",order:[]});function Zc({nodeId:e}){const{issuesByNode:t}=(0,l.useContext)(Hc),n=(t[e]||[]).filter(e=>"info"!==e.level);if(!n.length)return null;const o=n.some(e=>"error"===e.level)?"error":"warning";return(0,c.jsx)("span",{className:`fs-node__issue is-${o}`,title:n.map(e=>e.message).join("\n"),children:"!"})}function Yc({ids:e}){const{labels:t}=(0,l.useContext)(Hc),n=t.filter(t=>e.includes(t.id));return n.length?(0,c.jsx)("span",{className:"fs-dots",children:n.map(e=>(0,c.jsx)("span",{className:"fs-dot",style:{background:e.color},title:e.name},e.id))}):null}const Xc={start:function({data:e,selected:t}){return(0,c.jsxs)("div",{className:"fs-node fs-node--start"+(t?" is-selected":""),children:[(0,c.jsx)("div",{className:"fs-node__kind",children:(0,_c.__)("Start","funnelfork")}),(0,c.jsx)("div",{className:"fs-node__title",children:e.title||(0,_c.__)("Start","funnelfork")}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:"next",className:"fs-handle"})]})},question:function({id:e,data:t,selected:n}){const{edges:o,defaultEndId:r,mode:i,order:s}=(0,l.useContext)(Hc),a="yesno"===t.answerType,d="score"===i,u=s.indexOf(e),f=d?s[u+1]:null;return(0,c.jsxs)("div",{className:"fs-node fs-node--question"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Zc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[d&&u>=0&&(0,c.jsx)("span",{className:"fs-node__number",title:(0,_c.__)("Position in the question order","funnelfork"),children:u+1}),a?(0,_c.__)("Yes / no","funnelfork"):(0,_c.__)("Multiple choice","funnelfork")]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.question||(0,c.jsx)("em",{children:(0,_c.__)("Type your question…","funnelfork")})}),(0,c.jsx)("ul",{className:"fs-answers",children:t.answers.map(t=>{const n=o.some(n=>n.source===e&&n.sourceHandle===t.id);return(0,c.jsxs)("li",{className:"fs-answer"+(n?"":" is-open"),children:[(0,c.jsx)(Yc,{ids:t.labels}),(0,c.jsx)("span",{className:"fs-answer__text",children:t.text||(0,c.jsx)("em",{children:(0,_c.__)("(empty)","funnelfork")})}),d&&(0,c.jsxs)("span",{className:"fs-points"+(Number(t.points)?"":" is-zero"),title:(0,_c.__)("Points","funnelfork"),children:[Number(t.points)>0?"+":"",Number(t.points)||0]}),!n&&f&&(0,c.jsx)("span",{className:"fs-answer__fallback is-next",title:(0,_c.__)("No line: goes to the next question","funnelfork"),children:"↓"}),!n&&!f&&r&&(0,c.jsx)("span",{className:"fs-answer__fallback",title:d?(0,_c.__)("No line: the scan ends and the score picks the result","funnelfork"):(0,_c.__)("No line: goes to the default result","funnelfork"),children:"⚑"}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:t.id,className:"fs-handle"})]},t.id)})})]})},end:function({id:e,data:t,selected:n}){const{edges:o,mode:r}=(0,l.useContext)(Hc),i=o.filter(t=>t.target===e).length;let s;return"score"===r?(s=Tc(t),t.isDefault&&(s+=" · "+(0,_c.__)("also receives scores without a range","funnelfork"))):s=t.isDefault?(0,_c.__)("also receives all answers without a line","funnelfork"):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 6 (0,_c._n)("%d incoming line","%d incoming lines",i,"funnelfork"),i),(0,c.jsxs)("div",{className:"fs-node fs-node--end"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Zc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[(0,c.jsx)("span",{"aria-hidden":"true",children:"⚑ "}),(0,_c.__)("Result","funnelfork"),t.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")})]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.title||(0,c.jsx)("em",{children:(0,_c.__)("(untitled result)","funnelfork")})}),(0,c.jsxs)("div",{className:"fs-node__meta",children:[t.cta?.type&&"text"!==t.cta.type&&(Nc.endpointTypes||[]).includes(t.cta.type)?t.cta.type:(0,_c.__)("Text","funnelfork")," · ",s]})]})}},Fc=window.wp.hooks;function qc(){return Nc.proPageUrl?(0,c.jsx)("a",{href:Nc.proPageUrl,children:(0,_c.__)("Learn more","funnelfork")}):null}function Kc({value:e,onChange:t,optional:n=!1,...o}){return(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",step:1,value:e??"",onChange:e=>{if(""===e||"-"===e)return void t(n?null:0);const o=Math.round(Number(e));Number.isFinite(o)&&t(o)},...o})}function Wc({labels:e,value:t,onChange:n}){return e.length?(0,c.jsx)("div",{className:"fs-label-picker",children:e.map(e=>{const o=t.includes(e.id);return(0,c.jsx)("button",{type:"button",className:"fs-chip"+(o?" is-active":""),style:o?{background:e.color,borderColor:e.color}:{borderColor:e.color},"aria-pressed":o,onClick:()=>n(o?t.filter(t=>t!==e.id):[...t,e.id]),children:e.name||(0,_c.__)("(unnamed)","funnelfork")},e.id)})}):null}function Gc({node:e,handle:t,nodes:n,edges:o,onConnect:r,mode:i}){const s=o.find(n=>n.source===e.id&&n.sourceHandle===t),a=[{value:"",label:"score"===i?(0,_c.__)("— Next question —","funnelfork"):(0,_c.__)("— Default result —","funnelfork")},...n.filter(t=>"start"!==t.type&&t.id!==e.id).map(e=>({value:e.id,label:("end"===e.type?"⚑ ":"? ")+Ic(e)}))];return(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Leads to","funnelfork"),value:s?s.target:"",options:a,onChange:n=>r(e.id,t,n||null)})}function Uc({node:e,update:t,settings:n}){const o=e.data;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show an intro screen","funnelfork"),help:(0,_c.__)("Off: visitors start directly with the first question.","funnelfork"),checked:o.showIntro,onChange:e=>t({showIntro:e})}),o.showIntro&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:o.title,onChange:e=>t({title:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Introduction","funnelfork"),value:o.intro,onChange:e=>t({intro:e})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Button text","funnelfork"),value:o.buttonText,onChange:e=>t({buttonText:e})})]}),(0,Fc.applyFilters)("funnelfork.editor.startFields",null,{node:e,update:t,settings:n})]})}function Qc({node:e,update:t,labels:n,nodes:o,edges:r,onConnect:i,settings:s}){const a=e.data,l="score"===s.mode?"score":"flow",d=(e,n)=>t({answers:a.answers.map((t,o)=>o===e?{...t,...n}:t)}),u=(e,n)=>{const o=[...a.answers],[r]=o.splice(e,1);o.splice(e+n,0,r),t({answers:o})};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Question","funnelfork"),value:a.question,onChange:e=>t({question:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Explanation (optional)","funnelfork"),value:a.description,onChange:e=>t({description:e}),rows:2}),(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Answer type","funnelfork"),selected:a.answerType,options:[{label:(0,_c.__)("Yes / no","funnelfork"),value:"yesno"},{label:(0,_c.__)("Multiple choice (one answer)","funnelfork"),value:"choice"}],onChange:e=>{e!==a.answerType&&t({answerType:e,answers:"yesno"===e?Pc():a.answers.map(e=>({...e,id:"yes"===e.id||"no"===e.id?Ec("a"):e.id}))})}}),(0,Fc.applyFilters)("funnelfork.editor.questionFields",null,{node:e,update:t,settings:s}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Answers","funnelfork")}),a.answers.map((f,h)=>(0,c.jsxs)("div",{className:"fs-answer-edit",children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.sprintf)(/* translators: %d: answer number. */ /* translators: %d: answer number. */ 7 (0,_c.__)("Answer %d","funnelfork"),h+1),value:f.text,onChange:e=>d(h,{text:e})}),"score"===l&&(0,c.jsx)(Kc,{label:(0,_c.__)("Points","funnelfork"),value:f.points??0,onChange:e=>d(h,{points:e})}),(0,c.jsx)(Gc,{node:e,handle:f.id,nodes:o,edges:r,onConnect:i,mode:l}),(0,c.jsx)(Wc,{labels:n,value:f.labels,onChange:e=>d(h,{labels:e})}),(0,Fc.applyFilters)("funnelfork.editor.answerFields",null,{node:e,answer:f,index:h,settings:s,updateAnswer:e=>d(h,e)}),"choice"===a.answerType&&(0,c.jsxs)("div",{className:"fs-answer-edit__actions",children:[(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-up-alt2",label:(0,_c.__)("Move up","funnelfork"),disabled:0===h,onClick:()=>u(h,-1)}),(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-down-alt2",label:(0,_c.__)("Move down","funnelfork"),disabled:h===a.answers.length-1,onClick:()=>u(h,1)}),(0,c.jsx)(Cc.Button,{size:"small",isDestructive:!0,icon:"trash",label:(0,_c.__)("Remove answer","funnelfork"),disabled:a.answers.length<=2,onClick:()=>t({answers:a.answers.filter((e,t)=>t!==h)})})]})]},f.id)),"choice"===a.answerType&&(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t({answers:[...a.answers,{id:Ec("a"),text:(0,_c.sprintf)(/* translators: %d: option number. */ /* translators: %d: option number. */ 8 (0,_c.__)("Option %d","funnelfork"),a.answers.length+1),labels:[],points:0}]}),children:(0,_c.__)("Add answer","funnelfork")}),!n.length&&(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Tip: create labels in the "Labels" tab and attach them to answers to build personal advice.',"funnelfork")})]})}function Jc({node:e,nodes:t,update:n,setDefault:o,settings:r}){const i=e.data,s="score"===r.mode,a=s?Bc(t):null,l=Nc.endpointTypes||["text"],d={text:(0,_c.__)("Text","funnelfork"),gravityforms:(0,_c.__)("Gravity Forms form","funnelfork"),shortcode:(0,_c.__)("Shortcode","funnelfork")};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:i.title,onChange:e=>n({title:e})}),s&&(0,c.jsxs)("fieldset",{className:"fs-range",children:[(0,c.jsx)("legend",{className:"fs-inspector__heading",children:(0,_c.__)("Score range","funnelfork")}),(0,c.jsxs)("div",{className:"fs-range__fields",children:[(0,c.jsx)(Kc,{optional:!0,label:(0,_c.__)("From","funnelfork"),placeholder:(0,_c.__)("no minimum","funnelfork"),value:i.scoreMin,onChange:e=>n({scoreMin:e})}),(0,c.jsx)(Kc,{optional:!0,label:(0,_c.__)("To","funnelfork"),placeholder:(0,_c.__)("no maximum","funnelfork"),value:i.scoreMax,onChange:e=>n({scoreMax:e})})]}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.sprintf)(/* translators: 1: lowest possible score, 2: highest possible score. */ /* translators: 1: lowest possible score, 2: highest possible score. */ 9 (0,_c.__)("Visitors with a total score in this range (both included) get this result. Possible scores: %1$d to %2$d.","funnelfork"),a.min,a.max)}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the score","funnelfork"),checked:!1!==i.showScore,onChange:e=>n({showScore:e})})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Text","funnelfork"),help:(0,_c.__)("Basic HTML is allowed.","funnelfork"),value:i.content,rows:6,onChange:e=>n({content:e})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Call to action","funnelfork"),value:l.includes(i.cta?.type)?i.cta.type:"text",options:l.map(e=>({value:e,label:d[e]||e})),onChange:e=>n({cta:{...i.cta,type:e}})}),(0,Fc.applyFilters)("funnelfork.editor.endpointFields",null,{node:e,cta:i.cta||{type:"text"},updateCta:e=>n({cta:{...i.cta,...e}})}),!Nc.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("Show a Gravity Forms form or any shortcode on a result with FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(qc,{})]}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show collected labels (advice)","funnelfork"),checked:i.showLabels,onChange:e=>n({showLabels:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the given answers","funnelfork"),checked:i.showAnswers,onChange:e=>n({showAnswers:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Default result","funnelfork"),help:s?(0,_c.__)("Shown when the score matches no range. There is always exactly one default result.","funnelfork"):(0,_c.__)("Answers without a line lead here. There is always exactly one default result.","funnelfork"),checked:i.isDefault,disabled:i.isDefault,onChange:()=>o(e.id)})]})}function ed(e){const{node:t,deleteNode:n,duplicateNode:o}=e;return t?(0,c.jsxs)("div",{className:"fs-inspector__section",children:["start"===t.type&&(0,c.jsx)(Uc,{...e}),"question"===t.type&&(0,c.jsx)(Qc,{...e}),"end"===t.type&&(0,c.jsx)(Jc,{...e}),"start"!==t.type&&(0,c.jsxs)("div",{className:"fs-inspector__footer",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"admin-page",onClick:()=>o(t.id),children:(0,_c.__)("Duplicate","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",isDestructive:!0,icon:"trash",onClick:()=>n(t.id),children:(0,_c.__)("Delete","funnelfork")})]})]}):(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Select a question or result on the canvas to edit it.","funnelfork")})})}function td({nodes:e,edges:t,focusNode:n,addNode:o,settings:r}){const i=e.filter(e=>"end"===e.type),s="score"===r.mode;return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Every result is an endpoint of the quickscan. Click one to show it on the canvas.","funnelfork")}),(0,c.jsx)("ul",{className:"fs-endpoint-list",children:i.map(e=>{const o=t.filter(t=>t.target===e.id).length;return(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",onClick:()=>n(e.id),children:[(0,c.jsxs)("span",{className:"fs-endpoint-list__title",children:["⚑ ",Ic(e)]}),(0,c.jsxs)("span",{className:"fs-endpoint-list__meta",children:[e.data.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")}),s?Tc(e.data):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 10 (0,_c._n)("%d incoming line","%d incoming lines",o,"funnelfork"),o)]})]})},e.id)})}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>o("end"),children:(0,_c.__)("Add result","funnelfork")})]})}function nd({labels:e,setLabels:t,nodes:n}){const o=e=>n.reduce((t,n)=>t+("question"===n.type?n.data.answers.filter(t=>t.labels.includes(e)).length:0),0),r=(n,o)=>t(e.map(e=>e.id===n?{...e,...o}:e));return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Labels are collected along the way. Attach them to answers (for example a product or a piece of advice) and show them on the result.","funnelfork")}),e.map(n=>(0,c.jsxs)("div",{className:"fs-label-edit",children:[(0,c.jsxs)("div",{className:"fs-label-edit__row",children:[(0,c.jsx)("input",{type:"color",value:n.color,"aria-label":(0,_c.__)("Colour","funnelfork"),onChange:e=>r(n.id,{color:e.target.value})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,hideLabelFromVision:!0,label:(0,_c.__)("Name","funnelfork"),placeholder:(0,_c.__)("Name","funnelfork"),value:n.name,onChange:e=>r(n.id,{name:e})}),(0,c.jsx)(Cc.Button,{icon:"trash",isDestructive:!0,label:(0,_c.__)("Delete label","funnelfork"),onClick:()=>t(e.filter(e=>e.id!==n.id))})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,_c.__)("Description","funnelfork"),placeholder:(0,_c.__)("Description shown on the result (optional)","funnelfork"),rows:2,value:n.description,onChange:e=>r(n.id,{description:e})}),(0,c.jsx)("span",{className:"fs-help",children:(0,_c.sprintf)(/* translators: %d: number of answers. */ /* translators: %d: number of answers. */ 11 (0,_c._n)("Used by %d answer","Used by %d answers",o(n.id),"funnelfork"),o(n.id))})]},n.id)),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t([...e,{id:Ec("l"),name:"",color:Mc[e.length%Mc.length],description:""}]),children:(0,_c.__)("Add label","funnelfork")})]})}function od({settings:e,setSettings:t}){const n=Nc.transitions||["slide"],o=Nc.transitionLabels||{},r=Nc.modes||["flow","score"],i={flow:(0,_c.__)("Flow: lines decide the result","funnelfork"),score:(0,_c.__)("Score: the total score decides the result","funnelfork")};return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Type of quickscan","funnelfork"),selected:e.mode||"flow",options:r.map(e=>({value:e,label:i[e]||e})),onChange:n=>t({...e,mode:n}),help:"score"===e.mode?(0,_c.__)("Every answer gets points and every result a score range. Lines are optional: an answer without a line goes to the next question (left to right on the canvas).","funnelfork"):(0,_c.__)("Every answer leads along a line to a next question or a result. Answers without a line go to the default result.","funnelfork")}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show progress bar","funnelfork"),checked:e.showProgress,onChange:n=>t({...e,showProgress:n})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show back button","funnelfork"),checked:e.showBack,onChange:n=>t({...e,showBack:n})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Transition between questions","funnelfork"),value:n.includes(e.transition)?e.transition:"slide",options:n.map(e=>({value:e,label:o[e]||e})),onChange:n=>t({...e,transition:n})}),(0,Fc.applyFilters)("funnelfork.editor.settingsFields",null,{settings:e,updateSettings:n=>t({...e,...n})}),!Nc.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("More transitions and your own styling are available in FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(qc,{})]}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Embed","funnelfork")}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Use the "FunnelFork quickscan" block, or paste this shortcode:',"funnelfork")}),(0,c.jsx)("code",{className:"fs-shortcode",children:Nc.shortcode})]})}function rd({issues:e,focusNode:t}){return e.length?(0,c.jsx)("div",{className:"fs-issues",children:e.map((e,n)=>(0,c.jsx)(Cc.Notice,{status:"info"===e.level?"info":e.level,isDismissible:!1,children:(0,c.jsx)("button",{type:"button",className:"fs-issues__link",onClick:()=>t(e.nodeId),children:e.message})},n))}):null}function id(e){const{tab:t,setTab:n,issues:o,focusNode:r,labels:i}=e,s=[{name:"selected",title:(0,_c.__)("Step","funnelfork")},{name:"endpoints",title:(0,_c.sprintf)(/* translators: %d: number of results. */ /* translators: %d: number of results. */ 12 (0,_c.__)("Results (%d)","funnelfork"),e.nodes.filter(e=>"end"===e.type).length)},{name:"labels",title:(0,_c.sprintf)(/* translators: %d: number of labels. */ /* translators: %d: number of labels. */(0,_c.__)("Labels (%d)","funnelfork"),i.length)},{name:"settings",title:(0,_c.__)("Settings","funnelfork")}];return(0,c.jsxs)("aside",{className:"fs-inspector",children:[(0,c.jsx)(Cc.TabPanel,{className:"fs-inspector__tabs",tabs:s,initialTabName:t,onSelect:n,children:t=>(0,c.jsxs)(c.Fragment,{children:["selected"===t.name&&(0,c.jsx)(ed,{...e}),"endpoints"===t.name&&(0,c.jsx)(td,{...e}),"labels"===t.name&&(0,c.jsx)(nd,{...e}),"settings"===t.name&&(0,c.jsx)(od,{...e})]})},t),o.length>0&&(0,c.jsxs)("details",{className:"fs-issues-wrap",open:o.some(e=>"info"!==e.level),children:[(0,c.jsx)("summary",{children:(0,_c.sprintf)(/* translators: %d: number of notes. */ /* translators: %d: number of notes. */ 13 (0,_c._n)("%d note about this flow","%d notes about this flow",o.length,"funnelfork"),o.length)}),(0,c.jsx)(rd,{issues:o,focusNode:r})]})]})}const sd={flow:function({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s,markerEnd:a,selected:l}){const{deleteElements:d}=fa(),[u,f,h]=hi({sourceX:t,sourceY:n,sourcePosition:i,targetX:o,targetY:r,targetPosition:s});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Ja,{id:e,path:u,markerEnd:a,className:l?"is-selected":""}),l&&(0,c.jsx)(ql,{children:(0,c.jsx)("button",{type:"button",className:"fs-edge-delete nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${f}px, ${h}px)`},onClick:()=>d({edges:[{id:e}]}),"aria-label":(0,_c.__)("Remove line","funnelfork"),title:(0,_c.__)("Remove line","funnelfork"),children:"×"})})]})}},ad={type:vr.ArrowClosed,width:18,height:18,color:"#748c85"},ld={start:"#10201f",question:"#0d7a69",end:"#f2a93b"};function cd(){return(0,c.jsxs)("div",{className:"fs-topbar__logo",children:[(0,c.jsxs)("svg",{viewBox:"0 0 48 48","aria-hidden":"true",focusable:"false",children:[(0,c.jsx)("path",{d:"M14 40V17q0-7 7-7h11M14 25h10",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,c.jsx)("circle",{cx:"36",cy:"10",r:"5",fill:"#f2a93b"}),(0,c.jsx)("circle",{cx:"29",cy:"25",r:"5",fill:"#0d7a69"}),(0,c.jsx)("circle",{cx:"14",cy:"40",r:"4",fill:"currentColor"})]}),(0,c.jsxs)("span",{children:["funnel",(0,c.jsx)("b",{children:"fork"})]})]})}function dd(e,t,n){return{id:Ec("e"),source:e,sourceHandle:t,target:n,type:"flow",markerEnd:ad}}function ud(){const e=`/funnelfork/v1/scans/${Nc.scanId}`,{screenToFlowPosition:t,fitView:n,deleteElements:o}=fa(),r=(0,l.useRef)(null),[i,s]=(0,l.useState)(!0),[d,u]=(0,l.useState)(""),[f,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(""),[m,y]=(0,l.useState)("draft"),[x,v,w]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Qs(e,t)),[]);return[e,t,n]}(),[b,_,S]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Js(e,t)),[]);return[e,t,n]}(),[k,C]=(0,l.useState)([]),[N,E]=(0,l.useState)({}),[M,P]=(0,l.useState)(!1),[j,D]=(0,l.useState)(!1),[I,O]=(0,l.useState)("selected"),[z,A]=(0,l.useState)(null),R="score"===N.mode?"score":"flow";(0,l.useEffect)(()=>{kc()({path:e}).then(e=>{const t=Vc(e.graph);g(e.title),y(e.status),v(t.nodes),_(t.edges.map(e=>({...e,markerEnd:ad}))),C(t.labels),E(t.settings),s(!1)}).catch(e=>{u(e.message||(0,_c.__)("The quickscan could not be loaded.","funnelfork")),s(!1)})},[e,v,_]),(0,l.useEffect)(()=>{const e=e=>{M&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[M]);const L=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type&&"dimensions"!==e.type)&&P(!0),w(e)},[w]),T=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type)&&P(!0),S(e)},[S]),B=(0,l.useCallback)((e,t)=>{if(v(n=>n.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n)),t.answers){const n=t.answers.map(e=>e.id);_(t=>t.filter(t=>t.source!==e||n.includes(t.sourceHandle)))}P(!0)},[v,_]),$=(0,l.useCallback)((e,t,n)=>{const o=b.filter(n=>!(n.source===e&&n.sourceHandle===t));n&&Dc(o,e,n)?h({status:"warning",text:(0,_c.__)("That line would create a loop, so it was not added.","funnelfork")}):(_(n?[...o,dd(e,t,n)]:o),P(!0))},[b,_]),V=(0,l.useCallback)(e=>{const t=x.find(t=>t.id===e.target);return!(!t||"start"===t.type)&&!Dc(b.filter(t=>!(t.source===e.source&&t.sourceHandle===e.sourceHandle)),e.source,e.target)},[x,b]),H=(0,l.useCallback)(e=>{v(t=>t.map(t=>({...t,selected:t.id===e}))),_(e=>e.map(e=>e.selected?{...e,selected:!1}:e)),O("selected")},[v,_]),Z=(e,n=null,o=null)=>{const i=function(e,t){return"end"===e?{id:Ec("end"),type:"end",position:t,data:{title:(0,_c.__)("New result","funnelfork"),content:"",showLabels:!0,showAnswers:!1,isDefault:!1,scoreMin:null,scoreMax:null,showScore:!0,cta:{type:"text"}}}:{id:Ec("q"),type:"question",position:t,data:{question:"",description:"",answerType:e,answers:"yesno"===e?Pc():[{id:Ec("a"),text:(0,_c.__)("Option 1","funnelfork"),labels:[],points:0},{id:Ec("a"),text:(0,_c.__)("Option 2","funnelfork"),labels:[],points:0}]}}}(e,n||(()=>{const e=r.current.getBoundingClientRect(),n=t({x:e.left+e.width/2,y:e.top+e.height/2});return{x:n.x-130+(40*Math.random()-20),y:n.y-60+(40*Math.random()-20)}})());v(e=>[...e.map(e=>({...e,selected:!1})),{...i,selected:!0}]),o&&$(o.source,o.handle,i.id),O("selected"),P(!0)},Y=(0,l.useCallback)((e,n)=>{if(n.isValid||!n.fromHandle||"source"!==n.fromHandle.type)return;if(!e.target?.classList?.contains("react-flow__pane"))return;const o="changedTouches"in e?e.changedTouches[0]:e,i=r.current.getBoundingClientRect();A({left:o.clientX-i.left,top:o.clientY-i.top,position:t({x:o.clientX,y:o.clientY-30}),from:{source:n.fromNode.id,handle:n.fromHandle.id}})},[t]),X=(0,l.useCallback)(e=>{e.some(e=>"end"===e.type&&e.data.isDefault)&&v(e=>{const t=e.find(e=>"end"===e.type);return e.map(e=>e===t?{...e,data:{...e.data,isDefault:!0}}:e)})},[v]),F=(0,l.useCallback)(async(t=m)=>{D(!0);try{const n=await kc()({path:e,method:"POST",data:{title:p,status:t,graph:$c({nodes:x,edges:b,labels:k,settings:N})}}),o=Vc(n.graph),r=Object.fromEntries(o.nodes.map(e=>[e.id,e]));v(e=>e.filter(e=>r[e.id]).map(e=>({...e,data:r[e.id].data})));const i=new Set(b.filter(e=>e.selected).map(e=>e.id));return _(o.edges.map(e=>({...e,markerEnd:ad,selected:i.has(e.id)}))),E(o.settings),y(n.status),g(n.title),P(!1),h({status:"success",text:"publish"===t&&"publish"!==m?(0,_c.__)("Quickscan saved and published.","funnelfork"):(0,_c.__)("Quickscan saved.","funnelfork")}),!0}catch(e){return h({status:"error",text:e.message||(0,_c.__)("Saving failed.","funnelfork")}),!1}finally{D(!1)}},[e,p,m,x,b,k,N,v,_]);(0,l.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),F())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F]),(0,l.useEffect)(()=>{if(!f||"error"===f.status)return;const e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[f]);const q=(0,l.useMemo)(()=>function(e,t,n="flow"){const o="score"===n?function(e){const t=[],n=Oc(e),o=[];e.filter(e=>"end"===e.type).forEach(e=>{if(!Lc(e.data))return void(e.data.isDefault||t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 14 (0,_c.__)('"%s" has no score range, so it is never shown.',"funnelfork"),Ic(e))}));const n=Rc(e.data.scoreMin)?Number(e.data.scoreMin):-1/0,r=Rc(e.data.scoreMax)?Number(e.data.scoreMax):1/0;n>r?t.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 15 (0,_c.__)('The minimum score of "%s" is higher than its maximum.',"funnelfork"),Ic(e))}):(o.forEach(o=>{n<=o.max&&o.min<=r&&t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: 1: result title, 2: other result title. */ /* translators: 1: result title, 2: other result title. */ 16 (0,_c.__)('The score ranges of "%1$s" and "%2$s" overlap; "%1$s" wins.',"funnelfork"),Ic(o.node),Ic(e))})}),o.push({node:e,min:n,max:r}))});const r=e.filter(e=>"question"===e.type);r.length&&r.every(e=>e.data.answers.every(e=>!Number(e.points)))&&t.push({nodeId:r[0].id,level:"warning",message:(0,_c.__)("No answer has points yet. Select a question to give its answers points.","funnelfork")});const i=Bc(e),s=[];let a=i.min;return[...o].sort((e,t)=>e.min-t.min).forEach(e=>{e.min>a&&a<=i.max&&s.push([a,Math.min(e.min-1,i.max)]),a=Math.max(a,e.max+1)}),a<=i.max&&s.push([a,i.max]),s.length&&n&&t.push({nodeId:n.id,level:Lc(n.data)?"warning":"info",message:(0,_c.sprintf)(/* translators: 1: list of scores, 2: result title. */ /* translators: 1: list of scores, 2: result title. */ 17 (0,_c.__)('Score %1$s matches no range and goes to the default result "%2$s".',"funnelfork"),s.map(([e,t])=>e===t?`${e}`:`${e}–${t}`).join(", "),Ic(n))}),t}(e):[],r=new Set,i=e.find(e=>"start"===e.type),s=Oc(e),a=zc(e),l=i?[i.id]:[];for(;l.length;){const o=l.pop();if(r.has(o))continue;r.add(o);const i=e.find(e=>e.id===o);i&&(jc(i).forEach(r=>{const i=t.find(e=>e.source===o&&e.sourceHandle===r),s=i?i.target:Ac(e,n,o,a)?.id;s&&l.push(s)}),"score"===n&&"question"===i.type&&e.forEach(e=>"end"===e.type&&l.push(e.id)))}return e.forEach(e=>{if("question"===e.type){e.data.question.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.__)("A question has no text.","funnelfork")}),e.data.answers.length<2&&o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 18 (0,_c.__)('"%s" needs at least two answers.',"funnelfork"),Ic(e))}),e.data.answers.forEach(t=>{t.text.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 19 (0,_c.__)('"%s" has an answer without text.',"funnelfork"),Ic(e))})});const r=e.data.answers.filter(n=>!t.some(t=>t.source===e.id&&t.sourceHandle===n.id));r.length&&"score"!==n&&o.push({nodeId:e.id,level:"info",message:(0,_c.sprintf)(/* translators: 1: number of answers, 2: question text, 3: endpoint title. */ /* translators: 1: number of answers, 2: question text, 3: endpoint title. */ 20 (0,_c.__)('%1$d answer(s) of "%2$s" have no line and go to the default result "%3$s".',"funnelfork"),r.length,Ic(e),Ic(s))})}"start"===e.type||r.has(e.id)||o.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: question or result title. */ /* translators: %s: question or result title. */ 21 (0,_c.__)('"%s" cannot be reached from the start.',"funnelfork"),Ic(e))})}),o}(x,b,R),[x,b,R]),K=(0,l.useMemo)(()=>{const e={};return q.forEach(t=>e[t.nodeId]=[...e[t.nodeId]||[],t]),e},[q]),W=Oc(x)?.id||null,G="score"===R?zc(x).join(","):"",U=(0,l.useMemo)(()=>({labels:k,edges:b,defaultEndId:W,issuesByNode:K,mode:R,order:G?G.split(","):[]}),[k,b,W,K,R,G]),Q=x.filter(e=>e.selected),J=1===Q.length?Q[0]:null;if(i)return(0,c.jsx)("div",{className:"fs-editor fs-editor--loading",children:(0,c.jsx)(Cc.Spinner,{})});if(d)return(0,c.jsx)("div",{className:"fs-editor fs-editor--error",children:(0,c.jsx)(Cc.Notice,{status:"error",isDismissible:!1,children:d})});const ee=q.filter(e=>"error"===e.level).length;let te=(0,_c.__)("All changes saved","funnelfork");return j?te=(0,_c.__)("Saving…","funnelfork"):M&&(te=(0,_c.__)("Unsaved changes","funnelfork")),(0,c.jsx)(Hc.Provider,{value:U,children:(0,c.jsxs)("div",{className:"fs-editor",children:[(0,c.jsxs)("header",{className:"fs-topbar",children:[(0,c.jsx)("a",{className:"fs-topbar__back",href:Nc.listUrl,"aria-label":(0,_c.__)("Back to all quickscans","funnelfork"),title:(0,_c.__)("Back to all quickscans","funnelfork"),children:"←"}),(0,c.jsx)(cd,{}),(0,c.jsx)("input",{className:"fs-topbar__title",value:p,"aria-label":(0,_c.__)("Quickscan title","funnelfork"),placeholder:(0,_c.__)("Quickscan title","funnelfork"),onChange:e=>{g(e.target.value),P(!0)}}),(0,c.jsx)("span",{className:`fs-status is-${m}`,children:"publish"===m?(0,_c.__)("Published","funnelfork"):(0,_c.__)("Draft","funnelfork")}),(0,c.jsx)("span",{className:"fs-topbar__state",children:te}),(0,c.jsxs)("div",{className:"fs-topbar__actions",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",onClick:async()=>{const e=window.open("","_blank");!M||await F()?e&&(e.location=Nc.previewUrl):e&&e.close()},disabled:j,children:(0,_c.__)("Preview","funnelfork")}),"publish"===m?(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>F("draft"),disabled:j,children:(0,_c.__)("Switch to draft","funnelfork")}):(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>F("publish"),disabled:j||ee>0,title:ee>0?(0,_c.__)("Fix the errors in the flow first.","funnelfork"):void 0,children:(0,_c.__)("Publish","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"primary",onClick:()=>F(),isBusy:j,disabled:j||!M&&!j,children:(0,_c.__)("Save","funnelfork")})]})]}),f&&(0,c.jsx)("div",{className:"fs-editor-notice",children:(0,c.jsx)(Cc.Notice,{status:f.status,onRemove:()=>h(null),children:f.text})}),(0,c.jsxs)("div",{className:"fs-body",children:[(0,c.jsxs)("div",{className:"fs-canvas",ref:r,children:[(0,c.jsxs)(Xl,{nodes:x,edges:b,nodeTypes:Xc,edgeTypes:sd,onNodesChange:L,onEdgesChange:T,onNodesDelete:X,onConnect:e=>$(e.source,e.sourceHandle,e.target),onConnectEnd:Y,isValidConnection:V,onNodeClick:()=>O("selected"),onPaneClick:()=>A(null),deleteKeyCode:["Backspace","Delete"],fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.15,children:[(0,c.jsx)(ec,{gap:24,size:1.5,color:"#c6d4cf"}),(0,c.jsx)(cc,{showInteractive:!1}),(0,c.jsx)(wc,{pannable:!0,zoomable:!0,nodeColor:e=>ld[e.type]}),(0,c.jsxs)(js,{position:"top-left",className:"fs-toolbar",children:[(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("yesno"),children:(0,_c.__)("Yes/no question","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("choice"),children:(0,_c.__)("Multiple choice","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"flag",onClick:()=>Z("end"),children:(0,_c.__)("Result","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"layout",onClick:()=>{v(e=>function(e,t,n="flow"){const o={},r=e.find(e=>"start"===e.type),i=zc(e),s=(r,a)=>{if(void 0!==o[r]&&o[r]>=a)return;o[r]=a;const l=e.find(e=>e.id===r);l&&(o=>jc(o).map(r=>{const s=t.find(e=>e.source===o.id&&e.sourceHandle===r);return s?s.target:Ac(e,n,o.id,i)?.id}).filter(Boolean))(l).forEach(e=>s(e,a+1))};r&&s(r.id,0);const a=Math.max(0,...Object.values(o));e.forEach(e=>{"end"===e.type?o[e.id]=a:void 0===o[e.id]&&(o[e.id]=a+1)});const l={};e.forEach(e=>{(l[o[e.id]]=l[o[e.id]]||[]).push(e)});const c={};return Object.entries(l).forEach(([e,t])=>{let n=0;t.forEach(t=>{c[t.id]={x:340*Number(e),y:n},n+=(t.measured?.height||160)+48})}),e.map(e=>({...e,position:c[e.id]}))}(e,b,R)),P(!0),window.requestAnimationFrame(()=>n({duration:400}))},children:(0,_c.__)("Tidy up","funnelfork")})]}),(0,c.jsx)(js,{position:"bottom-center",className:"fs-hint",children:(0,_c.__)("Drag from an answer (●) to a question or result to draw a line. Drop on an empty spot to create a new step.","funnelfork")})]}),z&&(0,c.jsxs)("div",{className:"fs-drop-menu",style:{left:z.left,top:z.top},role:"menu",children:[(0,c.jsx)("span",{className:"fs-drop-menu__title",children:(0,_c.__)("Add here:","funnelfork")}),[["yesno",(0,_c.__)("Yes/no question","funnelfork")],["choice",(0,_c.__)("Multiple choice","funnelfork")],["end",(0,_c.__)("Result","funnelfork")]].map(([e,t])=>(0,c.jsx)("button",{type:"button",role:"menuitem",onClick:()=>{Z(e,z.position,z.from),A(null)},children:t},e)),(0,c.jsx)("button",{type:"button",className:"is-cancel",onClick:()=>A(null),children:(0,_c.__)("Cancel","funnelfork")})]})]}),(0,c.jsx)(id,{node:J,nodes:x,edges:b,labels:k,settings:N,issues:q,tab:I,setTab:O,setLabels:e=>{C(e);const t=e.map(e=>e.id);v(e=>e.map(e=>"question"===e.type&&e.data.answers.some(e=>e.labels.some(e=>!t.includes(e)))?{...e,data:{...e.data,answers:e.data.answers.map(e=>({...e,labels:e.labels.filter(e=>t.includes(e))}))}}:e)),P(!0)},setSettings:e=>{E(e),P(!0)},update:e=>J&&B(J.id,e),onConnect:$,setDefault:e=>{v(t=>t.map(t=>"end"===t.type?{...t,data:{...t.data,isDefault:t.id===e}}:t)),P(!0)},deleteNode:e=>{const t=x.find(t=>t.id===e);"end"!==t?.type||1!==x.filter(e=>"end"===e.type).length?o({nodes:[{id:e}]}):h({status:"warning",text:(0,_c.__)("A quickscan needs at least one result.","funnelfork")})},duplicateNode:e=>{const t=x.find(t=>t.id===e);if(!t)return;const n=structuredClone({id:t.id,type:t.type,position:t.position,data:t.data});n.id=Ec("end"===t.type?"end":"q"),n.position={x:t.position.x+40,y:t.position.y+40},"question"===n.type&&"choice"===n.data.answerType&&(n.data.answers=n.data.answers.map(e=>({...e,id:Ec("a")}))),"end"===n.type&&(n.data.isDefault=!1),v(e=>[...e.map(e=>({...e,selected:!1})),{...n,deletable:!0,selected:!0}]),P(!0)},focusNode:e=>{H(e),window.requestAnimationFrame(()=>n({nodes:[{id:e}],duration:400,maxZoom:1.1}))},addNode:Z})]})]})})}const fd=document.getElementById("funnelfork-editor-root");fd&&(0,l.createRoot)(fd).render((0,c.jsx)(Hl,{children:(0,c.jsx)(ud,{})}))}};const t={};function n(o){const r=t[o];if(void 0!==r)return r.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.m=e,(()=>{const e=[];n.O=(t,o,r)=>{if(!o){for(var i=0;i<e.length;i++){let[o,r]=e[i],a=!0;for(var s=0;s<o.length;s++)n.O.j(o[s])?o.splice(s--,1):a=!1;if(a){e.splice(i--,1);const n=r();void 0!==n&&(t=n)}}return t}e.push([o,r])}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.hasOwn(e,t),n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={8:0,117:0};n.O.j=t=>0===e[t];const t=(t,o)=>{let[r,i,s]=o;var a,l,c=0;if(r.some(t=>0!==e[t])){for(a in i)n.o(i,a)&&(n.m[a]=i[a]);if(s)var d=s(n)}for(t&&t(o);c<r.length;c++)l=r[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(d)},o=globalThis.webpackChunkfunnelfork||=[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();let o=n.O(void 0,[117],()=>n(46));o=n.O(o)})(); 5 (0,_c.__)("Score %d or less","funnelfork"),n):(0,_c.__)("No score range","funnelfork")}function $c(e){return e.filter(e=>"question"===e.type&&e.data.answers.length).reduce((e,t)=>{const n=t.data.answers.map(e=>Number(e.points)||0);return{min:e.min+Math.min(...n),max:e.max+Math.max(...n)}},{min:0,max:0})}function Vc({nodes:e,edges:t,labels:n,settings:o}){return{version:1,settings:o,labels:n,nodes:e.map(({id:e,type:t,position:n,data:o})=>({id:e,type:t,position:n,data:o})),edges:t.map(({id:e,source:t,sourceHandle:n,target:o})=>({id:e,source:t,sourceHandle:n,target:o}))}}function Hc(e){return{nodes:e.nodes.map(e=>({...e,deletable:"start"!==e.type})),edges:e.edges.map(e=>({...e,type:"flow"})),labels:e.labels,settings:e.settings}}function Zc({filter:e,args:t}){return(0,Nc.applyFilters)(e,null,t)}const Fc=(0,l.createContext)({labels:[],edges:[],defaultEndId:null,issuesByNode:{},mode:"flow",order:[]});function Yc({nodeId:e}){const{issuesByNode:t}=(0,l.useContext)(Fc),n=(t[e]||[]).filter(e=>"info"!==e.level);if(!n.length)return null;const o=n.some(e=>"error"===e.level)?"error":"warning";return(0,c.jsx)("span",{className:`fs-node__issue is-${o}`,title:n.map(e=>e.message).join("\n"),children:"!"})}function Xc({ids:e}){const{labels:t}=(0,l.useContext)(Fc),n=t.filter(t=>e.includes(t.id));return n.length?(0,c.jsx)("span",{className:"fs-dots",children:n.map(e=>(0,c.jsx)("span",{className:"fs-dot",style:{background:e.color},title:e.name},e.id))}):null}const qc={start:function({data:e,selected:t}){return(0,c.jsxs)("div",{className:"fs-node fs-node--start"+(t?" is-selected":""),children:[(0,c.jsx)("div",{className:"fs-node__kind",children:(0,_c.__)("Start","funnelfork")}),(0,c.jsx)("div",{className:"fs-node__title",children:e.title||(0,_c.__)("Start","funnelfork")}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:"next",className:"fs-handle"})]})},question:function({id:e,data:t,selected:n}){const{edges:o,defaultEndId:r,mode:i,order:s}=(0,l.useContext)(Fc),a="yesno"===t.answerType,d="score"===i,u=s.indexOf(e),f=d?s[u+1]:null;return(0,c.jsxs)("div",{className:"fs-node fs-node--question"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Yc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[d&&u>=0&&(0,c.jsx)("span",{className:"fs-node__number",title:(0,_c.__)("Position in the question order","funnelfork"),children:u+1}),a?(0,_c.__)("Yes / no","funnelfork"):(0,_c.__)("Multiple choice","funnelfork")]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.question||(0,c.jsx)("em",{children:(0,_c.__)("Type your question…","funnelfork")})}),(0,c.jsx)(Zc,{filter:"funnelfork.editor.nodeBadge",args:{id:e,type:"question"}}),(0,c.jsx)("ul",{className:"fs-answers",children:t.answers.map(t=>{const n=o.some(n=>n.source===e&&n.sourceHandle===t.id);return(0,c.jsxs)("li",{className:"fs-answer"+(n?"":" is-open"),children:[(0,c.jsx)(Xc,{ids:t.labels}),(0,c.jsx)(Zc,{filter:"funnelfork.editor.answerBadge",args:{nodeId:e,answerId:t.id}}),(0,c.jsx)("span",{className:"fs-answer__text",children:t.text||(0,c.jsx)("em",{children:(0,_c.__)("(empty)","funnelfork")})}),d&&(0,c.jsxs)("span",{className:"fs-points"+(Number(t.points)?"":" is-zero"),title:(0,_c.__)("Points","funnelfork"),children:[Number(t.points)>0?"+":"",Number(t.points)||0]}),!n&&f&&(0,c.jsx)("span",{className:"fs-answer__fallback is-next",title:(0,_c.__)("No line: goes to the next question","funnelfork"),children:"↓"}),!n&&!f&&r&&(0,c.jsx)("span",{className:"fs-answer__fallback",title:d?(0,_c.__)("No line: the scan ends and the score picks the result","funnelfork"):(0,_c.__)("No line: goes to the default result","funnelfork"),children:"⚑"}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:t.id,className:"fs-handle"})]},t.id)})})]})},end:function({id:e,data:t,selected:n}){const{edges:o,mode:r}=(0,l.useContext)(Fc),i=o.filter(t=>t.target===e).length;let s;return"score"===r?(s=Tc(t),t.isDefault&&(s+=" · "+(0,_c.__)("also receives scores without a range","funnelfork"))):s=t.isDefault?(0,_c.__)("also receives all answers without a line","funnelfork"):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 6 (0,_c._n)("%d incoming line","%d incoming lines",i,"funnelfork"),i),(0,c.jsxs)("div",{className:"fs-node fs-node--end"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Yc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[(0,c.jsx)("span",{"aria-hidden":"true",children:"⚑ "}),(0,_c.__)("Result","funnelfork"),t.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")})]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.title||(0,c.jsx)("em",{children:(0,_c.__)("(untitled result)","funnelfork")})}),(0,c.jsx)(Zc,{filter:"funnelfork.editor.nodeBadge",args:{id:e,type:"end"}}),(0,c.jsxs)("div",{className:"fs-node__meta",children:[t.cta?.type&&"text"!==t.cta.type&&(Ec.endpointTypes||[]).includes(t.cta.type)?t.cta.type:(0,_c.__)("Text","funnelfork")," · ",s]})]})}},Wc=e=>Number(e).toLocaleString(document.documentElement.lang||void 0);function Kc({label:e,value:t}){return(0,c.jsxs)("div",{className:"fs-stats__tile",children:[(0,c.jsx)("span",{className:"fs-stats__value",children:t}),(0,c.jsx)("span",{className:"fs-stats__label",children:e})]})}function Gc({daily:e}){const t=Math.max(1,...e.map(e=>e.views)),n=280/e.length,o=Math.max(2,n-2);return(0,c.jsxs)("figure",{className:"fs-stats__chart",children:[(0,c.jsx)("svg",{viewBox:"0 0 280 64",role:"img","aria-label":(0,_c.__)("Views and completions per day","funnelfork"),children:e.map((e,r)=>{const i=e.views/t*64,s=e.completes/t*64;return(0,c.jsxs)("g",{children:[(0,c.jsx)("title",{children:(0,_c.sprintf)(/* translators: 1: date, 2: views, 3: completions. */ /* translators: 1: date, 2: views, 3: completions. */ 7 (0,_c.__)("%1$s: %2$d views, %3$d completed","funnelfork"),e.day,e.views,e.completes)}),(0,c.jsx)("rect",{className:"fs-stats__bar is-views",x:r*n,y:64-i,width:o,height:i}),(0,c.jsx)("rect",{className:"fs-stats__bar is-completes",x:r*n,y:64-s,width:o,height:s})]},e.day)})}),(0,c.jsxs)("figcaption",{className:"fs-stats__legend",children:[(0,c.jsx)("span",{className:"is-views",children:(0,_c.__)("Views","funnelfork")}),(0,c.jsx)("span",{className:"is-completes",children:(0,_c.__)("Completed","funnelfork")})]})]})}function Uc({nodes:e,basic:t}){const n=e.filter(e=>"question"===e.type).slice(0,4),o=e.filter(e=>"end"===e.type).slice(0,3),{starts:r,rate:i}=t.totals,s=null===i?null:100-i,a=[92,71,55,38];return(0,c.jsxs)("section",{className:"fs-stats-pro","aria-labelledby":"fs-stats-pro-title",children:[(0,c.jsxs)("h3",{id:"fs-stats-pro-title",className:"fs-stats-pro__title",children:[(0,c.jsx)("svg",{className:"fs-stats-pro__lock",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,c.jsx)("path",{d:"M17 10h-1V7a4 4 0 0 0-8 0v3H7a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1Zm-7-3a2 2 0 0 1 4 0v3h-4V7Z"})}),(0,_c.__)("Where do visitors leave?","funnelfork")]}),(0,c.jsx)("p",{className:"fs-stats-pro__lead",children:null!==s&&r>0?(0,_c.sprintf)(/* translators: %d: percentage of visitors who do not finish. */ /* translators: %d: percentage of visitors who do not finish. */ 8 (0,_c.__)("%d%% of your visitors do not finish this quickscan. FunnelFork Pro shows at which question they leave, right on the lines of your flow.","funnelfork"),s):(0,_c.__)("FunnelFork Pro shows at which question visitors leave, right on the lines of your flow.","funnelfork")}),n.length>0&&(0,c.jsx)("ul",{className:"fs-stats-pro__list","aria-hidden":"true",children:n.map((e,t)=>(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"fs-stats-pro__name",children:Oc(e)}),(0,c.jsx)("span",{className:"fs-stats-pro__bar",children:(0,c.jsx)("span",{style:{width:`${a[t]}%`}})}),(0,c.jsx)("span",{className:"fs-stats-pro__num",children:"00%"})]},e.id))}),o.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("h4",{className:"fs-stats-pro__subtitle",children:(0,_c.__)("Which result do visitors get?","funnelfork")}),(0,c.jsx)("ul",{className:"fs-stats-pro__list","aria-hidden":"true",children:o.map((e,t)=>(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"fs-stats-pro__name",children:Oc(e)}),(0,c.jsx)("span",{className:"fs-stats-pro__bar",children:(0,c.jsx)("span",{style:{width:`${a[t+1]}%`}})}),(0,c.jsx)("span",{className:"fs-stats-pro__num",children:"00%"})]},e.id))})]}),(0,c.jsxs)("ul",{className:"fs-stats-pro__features",children:[(0,c.jsx)("li",{children:(0,_c.__)("Drop-off per question on the canvas","funnelfork")}),(0,c.jsx)("li",{children:(0,_c.__)("How often every answer, result and label is chosen","funnelfork")}),(0,c.jsx)("li",{children:(0,_c.__)("Leads, product clicks and add to cart","funnelfork")}),(0,c.jsx)("li",{children:(0,_c.__)("Any period, compared with the period before, and CSV export","funnelfork")})]}),Ec.proPageUrl&&(0,c.jsx)(Cc.Button,{variant:"primary",href:Ec.proPageUrl,children:(0,_c.__)("See FunnelFork Pro","funnelfork")})]})}function Qc({nodes:e,edges:t,labels:n,settings:o}){const[r,i]=(0,l.useState)(null),[s,a]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{Ec.scanId&&Sc()({path:`/funnelfork/v1/stats/${Ec.scanId}?days=30`}).then(i).catch(()=>a(!0))},[]),s)return(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)(Cc.Notice,{status:"error",isDismissible:!1,children:(0,_c.__)("The statistics could not be loaded.","funnelfork")})});if(!r)return(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)(Cc.Spinner,{})});const{views:d,starts:u,completes:f,rate:h}=r.totals,p=(0,Nc.applyFilters)("funnelfork.editor.statsPanel",null,{scanId:Ec.scanId,nodes:e,edges:t,labels:n,settings:o,basic:r});return(0,c.jsxs)("div",{className:"fs-inspector__section fs-stats",children:[(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.sprintf)(/* translators: %d: number of days. */ /* translators: %d: number of days. */ 9 (0,_c.__)("Last %d days","funnelfork"),30)}),(0,c.jsxs)("div",{className:"fs-stats__tiles",children:[(0,c.jsx)(Kc,{label:(0,_c.__)("Views","funnelfork"),value:Wc(d)}),(0,c.jsx)(Kc,{label:(0,_c.__)("Started","funnelfork"),value:Wc(u)}),(0,c.jsx)(Kc,{label:(0,_c.__)("Completed","funnelfork"),value:Wc(f)}),(0,c.jsx)(Kc,{label:(0,_c.__)("Completion rate","funnelfork"),value:null===h?"–":`${h}%`})]}),d>0?(0,c.jsx)(Gc,{daily:r.daily}):(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("No visitors yet. Publish the quickscan and place it on a page; views, starts and completions appear here. Your own visits (while logged in) are not counted.","funnelfork")}),!Ec.isPremium&&f>=50&&(0,c.jsx)(Cc.Notice,{status:"info",isDismissible:!1,children:(0,_c.sprintf)(/* translators: %s: number of completions. */ /* translators: %s: number of completions. */ 10 (0,_c._n)("Your quickscan was completed %s time. Want to know what people answer? Save every response with FunnelFork Pro.","Your quickscan was completed %s times. Want to know what people answer? Save every response with FunnelFork Pro.",f,"funnelfork"),Wc(f))}),p,!p&&!Ec.isPremium&&(0,c.jsx)(Uc,{nodes:e,basic:r}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Counted anonymously: no IP addresses, cookies or answers. Bots and logged-in editors are not counted.","funnelfork")})]})}function Jc(){return Ec.proPageUrl?(0,c.jsx)("a",{href:Ec.proPageUrl,children:(0,_c.__)("Learn more","funnelfork")}):null}function ed({value:e,onChange:t,optional:n=!1,...o}){return(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",step:1,value:e??"",onChange:e=>{if(""===e||"-"===e)return void t(n?null:0);const o=Math.round(Number(e));Number.isFinite(o)&&t(o)},...o})}function td({labels:e,value:t,onChange:n}){return e.length?(0,c.jsx)("div",{className:"fs-label-picker",children:e.map(e=>{const o=t.includes(e.id);return(0,c.jsx)("button",{type:"button",className:"fs-chip"+(o?" is-active":""),style:o?{background:e.color,borderColor:e.color}:{borderColor:e.color},"aria-pressed":o,onClick:()=>n(o?t.filter(t=>t!==e.id):[...t,e.id]),children:e.name||(0,_c.__)("(unnamed)","funnelfork")},e.id)})}):null}function nd({node:e,handle:t,nodes:n,edges:o,onConnect:r,mode:i}){const s=o.find(n=>n.source===e.id&&n.sourceHandle===t),a=[{value:"",label:"score"===i?(0,_c.__)("— Next question —","funnelfork"):(0,_c.__)("— Default result —","funnelfork")},...n.filter(t=>"start"!==t.type&&t.id!==e.id).map(e=>({value:e.id,label:("end"===e.type?"⚑ ":"? ")+Oc(e)}))];return(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Leads to","funnelfork"),value:s?s.target:"",options:a,onChange:n=>r(e.id,t,n||null)})}function od({node:e,update:t,settings:n}){const o=e.data;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show an intro screen","funnelfork"),help:(0,_c.__)("Off: visitors start directly with the first question.","funnelfork"),checked:o.showIntro,onChange:e=>t({showIntro:e})}),o.showIntro&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:o.title,onChange:e=>t({title:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Introduction","funnelfork"),value:o.intro,onChange:e=>t({intro:e})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Button text","funnelfork"),value:o.buttonText,onChange:e=>t({buttonText:e})})]}),(0,Nc.applyFilters)("funnelfork.editor.startFields",null,{node:e,update:t,settings:n})]})}function rd({node:e,update:t,labels:n,nodes:o,edges:r,onConnect:i,settings:s}){const a=e.data,l="score"===s.mode?"score":"flow",d=(e,n)=>t({answers:a.answers.map((t,o)=>o===e?{...t,...n}:t)}),u=(e,n)=>{const o=[...a.answers],[r]=o.splice(e,1);o.splice(e+n,0,r),t({answers:o})};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Question","funnelfork"),value:a.question,onChange:e=>t({question:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Explanation (optional)","funnelfork"),value:a.description,onChange:e=>t({description:e}),rows:2}),(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Answer type","funnelfork"),selected:a.answerType,options:[{label:(0,_c.__)("Yes / no","funnelfork"),value:"yesno"},{label:(0,_c.__)("Multiple choice (one answer)","funnelfork"),value:"choice"}],onChange:e=>{e!==a.answerType&&t({answerType:e,answers:"yesno"===e?jc():a.answers.map(e=>({...e,id:"yes"===e.id||"no"===e.id?Mc("a"):e.id}))})}}),(0,Nc.applyFilters)("funnelfork.editor.questionFields",null,{node:e,update:t,settings:s}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Answers","funnelfork")}),a.answers.map((f,h)=>(0,c.jsxs)("div",{className:"fs-answer-edit",children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.sprintf)(/* translators: %d: answer number. */ /* translators: %d: answer number. */ 11 (0,_c.__)("Answer %d","funnelfork"),h+1),value:f.text,onChange:e=>d(h,{text:e})}),"score"===l&&(0,c.jsx)(ed,{label:(0,_c.__)("Points","funnelfork"),value:f.points??0,onChange:e=>d(h,{points:e})}),(0,c.jsx)(nd,{node:e,handle:f.id,nodes:o,edges:r,onConnect:i,mode:l}),(0,c.jsx)(td,{labels:n,value:f.labels,onChange:e=>d(h,{labels:e})}),(0,Nc.applyFilters)("funnelfork.editor.answerFields",null,{node:e,answer:f,index:h,settings:s,updateAnswer:e=>d(h,e)}),"choice"===a.answerType&&(0,c.jsxs)("div",{className:"fs-answer-edit__actions",children:[(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-up-alt2",label:(0,_c.__)("Move up","funnelfork"),disabled:0===h,onClick:()=>u(h,-1)}),(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-down-alt2",label:(0,_c.__)("Move down","funnelfork"),disabled:h===a.answers.length-1,onClick:()=>u(h,1)}),(0,c.jsx)(Cc.Button,{size:"small",isDestructive:!0,icon:"trash",label:(0,_c.__)("Remove answer","funnelfork"),disabled:a.answers.length<=2,onClick:()=>t({answers:a.answers.filter((e,t)=>t!==h)})})]})]},f.id)),"choice"===a.answerType&&(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t({answers:[...a.answers,{id:Mc("a"),text:(0,_c.sprintf)(/* translators: %d: option number. */ /* translators: %d: option number. */ 12 (0,_c.__)("Option %d","funnelfork"),a.answers.length+1),labels:[],points:0}]}),children:(0,_c.__)("Add answer","funnelfork")}),!n.length&&(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Tip: create labels in the "Labels" tab and attach them to answers to build personal advice.',"funnelfork")})]})}function id({node:e,nodes:t,update:n,setDefault:o,settings:r}){const i=e.data,s="score"===r.mode,a=s?$c(t):null,l=Ec.endpointTypes||["text"],d={text:(0,_c.__)("Text","funnelfork"),gravityforms:(0,_c.__)("Gravity Forms form","funnelfork"),shortcode:(0,_c.__)("Shortcode","funnelfork")};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:i.title,onChange:e=>n({title:e})}),s&&(0,c.jsxs)("fieldset",{className:"fs-range",children:[(0,c.jsx)("legend",{className:"fs-inspector__heading",children:(0,_c.__)("Score range","funnelfork")}),(0,c.jsxs)("div",{className:"fs-range__fields",children:[(0,c.jsx)(ed,{optional:!0,label:(0,_c.__)("From","funnelfork"),placeholder:(0,_c.__)("no minimum","funnelfork"),value:i.scoreMin,onChange:e=>n({scoreMin:e})}),(0,c.jsx)(ed,{optional:!0,label:(0,_c.__)("To","funnelfork"),placeholder:(0,_c.__)("no maximum","funnelfork"),value:i.scoreMax,onChange:e=>n({scoreMax:e})})]}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.sprintf)(/* translators: 1: lowest possible score, 2: highest possible score. */ /* translators: 1: lowest possible score, 2: highest possible score. */ 13 (0,_c.__)("Visitors with a total score in this range (both included) get this result. Possible scores: %1$d to %2$d.","funnelfork"),a.min,a.max)}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the score","funnelfork"),checked:!1!==i.showScore,onChange:e=>n({showScore:e})})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Text","funnelfork"),help:(0,_c.__)("Basic HTML is allowed.","funnelfork"),value:i.content,rows:6,onChange:e=>n({content:e})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Call to action","funnelfork"),value:l.includes(i.cta?.type)?i.cta.type:"text",options:l.map(e=>({value:e,label:d[e]||e})),onChange:e=>n({cta:{...i.cta,type:e}})}),(0,Nc.applyFilters)("funnelfork.editor.endpointFields",null,{node:e,cta:i.cta||{type:"text"},updateCta:e=>n({cta:{...i.cta,...e}})}),!Ec.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("Show a Gravity Forms form or any shortcode on a result with FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(Jc,{})]}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show collected labels (advice)","funnelfork"),checked:i.showLabels,onChange:e=>n({showLabels:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the given answers","funnelfork"),checked:i.showAnswers,onChange:e=>n({showAnswers:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Default result","funnelfork"),help:s?(0,_c.__)("Shown when the score matches no range. There is always exactly one default result.","funnelfork"):(0,_c.__)("Answers without a line lead here. There is always exactly one default result.","funnelfork"),checked:i.isDefault,disabled:i.isDefault,onChange:()=>o(e.id)})]})}function sd(e){const{node:t,deleteNode:n,duplicateNode:o}=e;return t?(0,c.jsxs)("div",{className:"fs-inspector__section",children:["start"===t.type&&(0,c.jsx)(od,{...e}),"question"===t.type&&(0,c.jsx)(rd,{...e}),"end"===t.type&&(0,c.jsx)(id,{...e}),"start"!==t.type&&(0,c.jsxs)("div",{className:"fs-inspector__footer",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"admin-page",onClick:()=>o(t.id),children:(0,_c.__)("Duplicate","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",isDestructive:!0,icon:"trash",onClick:()=>n(t.id),children:(0,_c.__)("Delete","funnelfork")})]})]}):(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Select a question or result on the canvas to edit it.","funnelfork")})})}function ad({nodes:e,edges:t,focusNode:n,addNode:o,settings:r}){const i=e.filter(e=>"end"===e.type),s="score"===r.mode;return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Every result is an endpoint of the quickscan. Click one to show it on the canvas.","funnelfork")}),(0,c.jsx)("ul",{className:"fs-endpoint-list",children:i.map(e=>{const o=t.filter(t=>t.target===e.id).length;return(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",onClick:()=>n(e.id),children:[(0,c.jsxs)("span",{className:"fs-endpoint-list__title",children:["⚑ ",Oc(e)]}),(0,c.jsxs)("span",{className:"fs-endpoint-list__meta",children:[e.data.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")}),s?Tc(e.data):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 14 (0,_c._n)("%d incoming line","%d incoming lines",o,"funnelfork"),o)]})]})},e.id)})}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>o("end"),children:(0,_c.__)("Add result","funnelfork")})]})}function ld({labels:e,setLabels:t,nodes:n}){const o=e=>n.reduce((t,n)=>t+("question"===n.type?n.data.answers.filter(t=>t.labels.includes(e)).length:0),0),r=(n,o)=>t(e.map(e=>e.id===n?{...e,...o}:e));return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Labels are collected along the way. Attach them to answers (for example a product or a piece of advice) and show them on the result.","funnelfork")}),e.map(n=>(0,c.jsxs)("div",{className:"fs-label-edit",children:[(0,c.jsxs)("div",{className:"fs-label-edit__row",children:[(0,c.jsx)("input",{type:"color",value:n.color,"aria-label":(0,_c.__)("Colour","funnelfork"),onChange:e=>r(n.id,{color:e.target.value})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,hideLabelFromVision:!0,label:(0,_c.__)("Name","funnelfork"),placeholder:(0,_c.__)("Name","funnelfork"),value:n.name,onChange:e=>r(n.id,{name:e})}),(0,c.jsx)(Cc.Button,{icon:"trash",isDestructive:!0,label:(0,_c.__)("Delete label","funnelfork"),onClick:()=>t(e.filter(e=>e.id!==n.id))})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,_c.__)("Description","funnelfork"),placeholder:(0,_c.__)("Description shown on the result (optional)","funnelfork"),rows:2,value:n.description,onChange:e=>r(n.id,{description:e})}),(0,c.jsx)("span",{className:"fs-help",children:(0,_c.sprintf)(/* translators: %d: number of answers. */ /* translators: %d: number of answers. */ 15 (0,_c._n)("Used by %d answer","Used by %d answers",o(n.id),"funnelfork"),o(n.id))})]},n.id)),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t([...e,{id:Mc("l"),name:"",color:Pc[e.length%Pc.length],description:""}]),children:(0,_c.__)("Add label","funnelfork")})]})}function cd({settings:e,setSettings:t}){const n=Ec.transitions||["slide"],o=Ec.transitionLabels||{},r=Ec.modes||["flow","score"],i={flow:(0,_c.__)("Flow: lines decide the result","funnelfork"),score:(0,_c.__)("Score: the total score decides the result","funnelfork")};return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Type of quickscan","funnelfork"),selected:e.mode||"flow",options:r.map(e=>({value:e,label:i[e]||e})),onChange:n=>t({...e,mode:n}),help:"score"===e.mode?(0,_c.__)("Every answer gets points and every result a score range. Lines are optional: an answer without a line goes to the next question (left to right on the canvas).","funnelfork"):(0,_c.__)("Every answer leads along a line to a next question or a result. Answers without a line go to the default result.","funnelfork")}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show progress bar","funnelfork"),checked:e.showProgress,onChange:n=>t({...e,showProgress:n})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show back button","funnelfork"),checked:e.showBack,onChange:n=>t({...e,showBack:n})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Transition between questions","funnelfork"),value:n.includes(e.transition)?e.transition:"slide",options:n.map(e=>({value:e,label:o[e]||e})),onChange:n=>t({...e,transition:n})}),(0,Nc.applyFilters)("funnelfork.editor.settingsFields",null,{settings:e,updateSettings:n=>t({...e,...n})}),!Ec.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("More transitions and your own styling are available in FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(Jc,{})]}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Embed","funnelfork")}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Use the "FunnelFork quickscan" block, or paste this shortcode:',"funnelfork")}),(0,c.jsx)("code",{className:"fs-shortcode",children:Ec.shortcode})]})}function dd({issues:e,focusNode:t}){return e.length?(0,c.jsx)("div",{className:"fs-issues",children:e.map((e,n)=>(0,c.jsx)(Cc.Notice,{status:"info"===e.level?"info":e.level,isDismissible:!1,children:(0,c.jsx)("button",{type:"button",className:"fs-issues__link",onClick:()=>t(e.nodeId),children:e.message})},n))}):null}function ud(e){const{tab:t,setTab:n,issues:o,focusNode:r,labels:i}=e,s=[{name:"selected",title:(0,_c.__)("Step","funnelfork")},{name:"endpoints",title:(0,_c.sprintf)(/* translators: %d: number of results. */ /* translators: %d: number of results. */ 16 (0,_c.__)("Results (%d)","funnelfork"),e.nodes.filter(e=>"end"===e.type).length)},{name:"labels",title:(0,_c.sprintf)(/* translators: %d: number of labels. */ /* translators: %d: number of labels. */(0,_c.__)("Labels (%d)","funnelfork"),i.length)},{name:"settings",title:(0,_c.__)("Settings","funnelfork")},{name:"stats",title:(0,_c.__)("Statistics","funnelfork")}];return(0,c.jsxs)("aside",{className:"fs-inspector",children:[(0,c.jsx)(Cc.TabPanel,{className:"fs-inspector__tabs",tabs:s,initialTabName:t,onSelect:n,children:t=>(0,c.jsxs)(c.Fragment,{children:["selected"===t.name&&(0,c.jsx)(sd,{...e}),"endpoints"===t.name&&(0,c.jsx)(ad,{...e}),"labels"===t.name&&(0,c.jsx)(ld,{...e}),"stats"===t.name&&(0,c.jsx)(Qc,{...e}),"settings"===t.name&&(0,c.jsx)(cd,{...e})]})},t),o.length>0&&(0,c.jsxs)("details",{className:"fs-issues-wrap",open:o.some(e=>"info"!==e.level),children:[(0,c.jsx)("summary",{children:(0,_c.sprintf)(/* translators: %d: number of notes. */ /* translators: %d: number of notes. */ 17 (0,_c._n)("%d note about this flow","%d notes about this flow",o.length,"funnelfork"),o.length)}),(0,c.jsx)(dd,{issues:o,focusNode:r})]})]})}const fd={flow:function({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s,markerEnd:a,selected:l,source:d,sourceHandleId:u,target:f}){const{deleteElements:h}=fa(),[p,g,m]=hi({sourceX:t,sourceY:n,sourcePosition:i,targetX:o,targetY:r,targetPosition:s}),y=(0,Nc.applyFilters)("funnelfork.editor.edgeLabel",null,{id:e,source:d,sourceHandle:u,target:f});return(0,c.jsxs)(c.Fragment,{children:[y&&!l&&(0,c.jsx)(ql,{children:(0,c.jsx)("div",{className:"fs-edge-label nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${g}px, ${m}px)`},children:y})}),(0,c.jsx)(Ja,{id:e,path:p,markerEnd:a,className:l?"is-selected":""}),l&&(0,c.jsx)(ql,{children:(0,c.jsx)("button",{type:"button",className:"fs-edge-delete nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${g}px, ${m}px)`},onClick:()=>h({edges:[{id:e}]}),"aria-label":(0,_c.__)("Remove line","funnelfork"),title:(0,_c.__)("Remove line","funnelfork"),children:"×"})})]})}},hd={type:vr.ArrowClosed,width:18,height:18,color:"#748c85"},pd={start:"#10201f",question:"#0d7a69",end:"#f2a93b"};function gd(){return(0,c.jsxs)("div",{className:"fs-topbar__logo",children:[(0,c.jsxs)("svg",{viewBox:"0 0 48 48","aria-hidden":"true",focusable:"false",children:[(0,c.jsx)("path",{d:"M14 40V17q0-7 7-7h11M14 25h10",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,c.jsx)("circle",{cx:"36",cy:"10",r:"5",fill:"#f2a93b"}),(0,c.jsx)("circle",{cx:"29",cy:"25",r:"5",fill:"#0d7a69"}),(0,c.jsx)("circle",{cx:"14",cy:"40",r:"4",fill:"currentColor"})]}),(0,c.jsxs)("span",{children:["funnel",(0,c.jsx)("b",{children:"fork"})]})]})}function md(e,t,n){return{id:Mc("e"),source:e,sourceHandle:t,target:n,type:"flow",markerEnd:hd}}function yd(){const e=`/funnelfork/v1/scans/${Ec.scanId}`,{screenToFlowPosition:t,fitView:n,deleteElements:o}=fa(),r=(0,l.useRef)(null),[i,s]=(0,l.useState)(!0),[d,u]=(0,l.useState)(""),[f,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(""),[m,y]=(0,l.useState)("draft"),[x,v,w]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Qs(e,t)),[]);return[e,t,n]}(),[b,_,k]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Js(e,t)),[]);return[e,t,n]}(),[S,C]=(0,l.useState)([]),[N,E]=(0,l.useState)({}),[M,P]=(0,l.useState)(!1),[j,D]=(0,l.useState)(!1),[I,O]=(0,l.useState)("selected"),[z,A]=(0,l.useState)(null),R="score"===N.mode?"score":"flow";(0,l.useEffect)(()=>{Sc()({path:e}).then(e=>{const t=Hc(e.graph);g(e.title),y(e.status),v(t.nodes),_(t.edges.map(e=>({...e,markerEnd:hd}))),C(t.labels),E(t.settings),s(!1)}).catch(e=>{u(e.message||(0,_c.__)("The quickscan could not be loaded.","funnelfork")),s(!1)})},[e,v,_]),(0,l.useEffect)(()=>{const e=e=>{M&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[M]);const L=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type&&"dimensions"!==e.type)&&P(!0),w(e)},[w]),B=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type)&&P(!0),k(e)},[k]),T=(0,l.useCallback)((e,t)=>{if(v(n=>n.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n)),t.answers){const n=t.answers.map(e=>e.id);_(t=>t.filter(t=>t.source!==e||n.includes(t.sourceHandle)))}P(!0)},[v,_]),$=(0,l.useCallback)((e,t,n)=>{const o=b.filter(n=>!(n.source===e&&n.sourceHandle===t));n&&Ic(o,e,n)?h({status:"warning",text:(0,_c.__)("That line would create a loop, so it was not added.","funnelfork")}):(_(n?[...o,md(e,t,n)]:o),P(!0))},[b,_]),V=(0,l.useCallback)(e=>{const t=x.find(t=>t.id===e.target);return!(!t||"start"===t.type)&&!Ic(b.filter(t=>!(t.source===e.source&&t.sourceHandle===e.sourceHandle)),e.source,e.target)},[x,b]),H=(0,l.useCallback)(e=>{v(t=>t.map(t=>({...t,selected:t.id===e}))),_(e=>e.map(e=>e.selected?{...e,selected:!1}:e)),O("selected")},[v,_]),Z=(e,n=null,o=null)=>{const i=function(e,t){return"end"===e?{id:Mc("end"),type:"end",position:t,data:{title:(0,_c.__)("New result","funnelfork"),content:"",showLabels:!0,showAnswers:!1,isDefault:!1,scoreMin:null,scoreMax:null,showScore:!0,cta:{type:"text"}}}:{id:Mc("q"),type:"question",position:t,data:{question:"",description:"",answerType:e,answers:"yesno"===e?jc():[{id:Mc("a"),text:(0,_c.__)("Option 1","funnelfork"),labels:[],points:0},{id:Mc("a"),text:(0,_c.__)("Option 2","funnelfork"),labels:[],points:0}]}}}(e,n||(()=>{const e=r.current.getBoundingClientRect(),n=t({x:e.left+e.width/2,y:e.top+e.height/2});return{x:n.x-130+(40*Math.random()-20),y:n.y-60+(40*Math.random()-20)}})());v(e=>[...e.map(e=>({...e,selected:!1})),{...i,selected:!0}]),o&&$(o.source,o.handle,i.id),O("selected"),P(!0)},F=(0,l.useCallback)((e,n)=>{if(n.isValid||!n.fromHandle||"source"!==n.fromHandle.type)return;if(!e.target?.classList?.contains("react-flow__pane"))return;const o="changedTouches"in e?e.changedTouches[0]:e,i=r.current.getBoundingClientRect();A({left:o.clientX-i.left,top:o.clientY-i.top,position:t({x:o.clientX,y:o.clientY-30}),from:{source:n.fromNode.id,handle:n.fromHandle.id}})},[t]),Y=(0,l.useCallback)(e=>{e.some(e=>"end"===e.type&&e.data.isDefault)&&v(e=>{const t=e.find(e=>"end"===e.type);return e.map(e=>e===t?{...e,data:{...e.data,isDefault:!0}}:e)})},[v]),X=(0,l.useCallback)(async(t=m)=>{D(!0);try{const n=await Sc()({path:e,method:"POST",data:{title:p,status:t,graph:Vc({nodes:x,edges:b,labels:S,settings:N})}}),o=Hc(n.graph),r=Object.fromEntries(o.nodes.map(e=>[e.id,e]));v(e=>e.filter(e=>r[e.id]).map(e=>({...e,data:r[e.id].data})));const i=new Set(b.filter(e=>e.selected).map(e=>e.id));return _(o.edges.map(e=>({...e,markerEnd:hd,selected:i.has(e.id)}))),E(o.settings),y(n.status),g(n.title),P(!1),h({status:"success",text:"publish"===t&&"publish"!==m?(0,_c.__)("Quickscan saved and published.","funnelfork"):(0,_c.__)("Quickscan saved.","funnelfork")}),!0}catch(e){return h({status:"error",text:e.message||(0,_c.__)("Saving failed.","funnelfork")}),!1}finally{D(!1)}},[e,p,m,x,b,S,N,v,_]);(0,l.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),X())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[X]),(0,l.useEffect)(()=>{if(!f||"error"===f.status)return;const e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[f]);const q=(0,l.useMemo)(()=>function(e,t,n="flow"){const o="score"===n?function(e){const t=[],n=zc(e),o=[];e.filter(e=>"end"===e.type).forEach(e=>{if(!Bc(e.data))return void(e.data.isDefault||t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 18 (0,_c.__)('"%s" has no score range, so it is never shown.',"funnelfork"),Oc(e))}));const n=Lc(e.data.scoreMin)?Number(e.data.scoreMin):-1/0,r=Lc(e.data.scoreMax)?Number(e.data.scoreMax):1/0;n>r?t.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 19 (0,_c.__)('The minimum score of "%s" is higher than its maximum.',"funnelfork"),Oc(e))}):(o.forEach(o=>{n<=o.max&&o.min<=r&&t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: 1: result title, 2: other result title. */ /* translators: 1: result title, 2: other result title. */ 20 (0,_c.__)('The score ranges of "%1$s" and "%2$s" overlap; "%1$s" wins.',"funnelfork"),Oc(o.node),Oc(e))})}),o.push({node:e,min:n,max:r}))});const r=e.filter(e=>"question"===e.type);r.length&&r.every(e=>e.data.answers.every(e=>!Number(e.points)))&&t.push({nodeId:r[0].id,level:"warning",message:(0,_c.__)("No answer has points yet. Select a question to give its answers points.","funnelfork")});const i=$c(e),s=[];let a=i.min;return[...o].sort((e,t)=>e.min-t.min).forEach(e=>{e.min>a&&a<=i.max&&s.push([a,Math.min(e.min-1,i.max)]),a=Math.max(a,e.max+1)}),a<=i.max&&s.push([a,i.max]),s.length&&n&&t.push({nodeId:n.id,level:Bc(n.data)?"warning":"info",message:(0,_c.sprintf)(/* translators: 1: list of scores, 2: result title. */ /* translators: 1: list of scores, 2: result title. */ 21 (0,_c.__)('Score %1$s matches no range and goes to the default result "%2$s".',"funnelfork"),s.map(([e,t])=>e===t?`${e}`:`${e}–${t}`).join(", "),Oc(n))}),t}(e):[],r=new Set,i=e.find(e=>"start"===e.type),s=zc(e),a=Ac(e),l=i?[i.id]:[];for(;l.length;){const o=l.pop();if(r.has(o))continue;r.add(o);const i=e.find(e=>e.id===o);i&&(Dc(i).forEach(r=>{const i=t.find(e=>e.source===o&&e.sourceHandle===r),s=i?i.target:Rc(e,n,o,a)?.id;s&&l.push(s)}),"score"===n&&"question"===i.type&&e.forEach(e=>"end"===e.type&&l.push(e.id)))}return e.forEach(e=>{if("question"===e.type){e.data.question.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.__)("A question has no text.","funnelfork")}),e.data.answers.length<2&&o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 22 (0,_c.__)('"%s" needs at least two answers.',"funnelfork"),Oc(e))}),e.data.answers.forEach(t=>{t.text.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 23 (0,_c.__)('"%s" has an answer without text.',"funnelfork"),Oc(e))})});const r=e.data.answers.filter(n=>!t.some(t=>t.source===e.id&&t.sourceHandle===n.id));r.length&&"score"!==n&&o.push({nodeId:e.id,level:"info",message:(0,_c.sprintf)(/* translators: 1: number of answers, 2: question text, 3: endpoint title. */ /* translators: 1: number of answers, 2: question text, 3: endpoint title. */ 24 (0,_c.__)('%1$d answer(s) of "%2$s" have no line and go to the default result "%3$s".',"funnelfork"),r.length,Oc(e),Oc(s))})}"start"===e.type||r.has(e.id)||o.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: question or result title. */ /* translators: %s: question or result title. */ 25 (0,_c.__)('"%s" cannot be reached from the start.',"funnelfork"),Oc(e))})}),o}(x,b,R),[x,b,R]),W=(0,l.useMemo)(()=>{const e={};return q.forEach(t=>e[t.nodeId]=[...e[t.nodeId]||[],t]),e},[q]),K=zc(x)?.id||null,G="score"===R?Ac(x).join(","):"",U=(0,l.useMemo)(()=>({labels:S,edges:b,defaultEndId:K,issuesByNode:W,mode:R,order:G?G.split(","):[]}),[S,b,K,W,R,G]),Q=x.filter(e=>e.selected),J=1===Q.length?Q[0]:null;if(i)return(0,c.jsx)("div",{className:"fs-editor fs-editor--loading",children:(0,c.jsx)(Cc.Spinner,{})});if(d)return(0,c.jsx)("div",{className:"fs-editor fs-editor--error",children:(0,c.jsx)(Cc.Notice,{status:"error",isDismissible:!1,children:d})});const ee=q.filter(e=>"error"===e.level).length;let te=(0,_c.__)("All changes saved","funnelfork");return j?te=(0,_c.__)("Saving…","funnelfork"):M&&(te=(0,_c.__)("Unsaved changes","funnelfork")),(0,c.jsx)(Fc.Provider,{value:U,children:(0,c.jsxs)("div",{className:"fs-editor",children:[(0,c.jsxs)("header",{className:"fs-topbar",children:[(0,c.jsx)("a",{className:"fs-topbar__back",href:Ec.listUrl,"aria-label":(0,_c.__)("Back to all quickscans","funnelfork"),title:(0,_c.__)("Back to all quickscans","funnelfork"),children:"←"}),(0,c.jsx)(gd,{}),(0,c.jsx)("input",{className:"fs-topbar__title",value:p,"aria-label":(0,_c.__)("Quickscan title","funnelfork"),placeholder:(0,_c.__)("Quickscan title","funnelfork"),onChange:e=>{g(e.target.value),P(!0)}}),(0,c.jsx)("span",{className:`fs-status is-${m}`,children:"publish"===m?(0,_c.__)("Published","funnelfork"):(0,_c.__)("Draft","funnelfork")}),(0,c.jsx)("span",{className:"fs-topbar__state",children:te}),(0,c.jsxs)("div",{className:"fs-topbar__actions",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",onClick:async()=>{const e=window.open("","_blank");!M||await X()?e&&(e.location=Ec.previewUrl):e&&e.close()},disabled:j,children:(0,_c.__)("Preview","funnelfork")}),"publish"===m?(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>X("draft"),disabled:j,children:(0,_c.__)("Switch to draft","funnelfork")}):(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>X("publish"),disabled:j||ee>0,title:ee>0?(0,_c.__)("Fix the errors in the flow first.","funnelfork"):void 0,children:(0,_c.__)("Publish","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"primary",onClick:()=>X(),isBusy:j,disabled:j||!M&&!j,children:(0,_c.__)("Save","funnelfork")})]})]}),f&&(0,c.jsx)("div",{className:"fs-editor-notice",children:(0,c.jsx)(Cc.Notice,{status:f.status,onRemove:()=>h(null),children:f.text})}),(0,c.jsxs)("div",{className:"fs-body",children:[(0,c.jsxs)("div",{className:"fs-canvas",ref:r,children:[(0,c.jsxs)(Yl,{nodes:x,edges:b,nodeTypes:qc,edgeTypes:fd,onNodesChange:L,onEdgesChange:B,onNodesDelete:Y,onConnect:e=>$(e.source,e.sourceHandle,e.target),onConnectEnd:F,isValidConnection:V,onNodeClick:()=>O("selected"),onPaneClick:()=>A(null),deleteKeyCode:["Backspace","Delete"],fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.15,children:[(0,c.jsx)(ec,{gap:24,size:1.5,color:"#c6d4cf"}),(0,c.jsx)(cc,{showInteractive:!1}),(0,c.jsx)(wc,{pannable:!0,zoomable:!0,nodeColor:e=>pd[e.type]}),(0,c.jsxs)(js,{position:"top-left",className:"fs-toolbar",children:[(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("yesno"),children:(0,_c.__)("Yes/no question","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("choice"),children:(0,_c.__)("Multiple choice","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"flag",onClick:()=>Z("end"),children:(0,_c.__)("Result","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"layout",onClick:()=>{v(e=>function(e,t,n="flow"){const o={},r=e.find(e=>"start"===e.type),i=Ac(e),s=(r,a)=>{if(void 0!==o[r]&&o[r]>=a)return;o[r]=a;const l=e.find(e=>e.id===r);l&&(o=>Dc(o).map(r=>{const s=t.find(e=>e.source===o.id&&e.sourceHandle===r);return s?s.target:Rc(e,n,o.id,i)?.id}).filter(Boolean))(l).forEach(e=>s(e,a+1))};r&&s(r.id,0);const a=Math.max(0,...Object.values(o));e.forEach(e=>{"end"===e.type?o[e.id]=a:void 0===o[e.id]&&(o[e.id]=a+1)});const l={};e.forEach(e=>{(l[o[e.id]]=l[o[e.id]]||[]).push(e)});const c={};return Object.entries(l).forEach(([e,t])=>{let n=0;t.forEach(t=>{c[t.id]={x:340*Number(e),y:n},n+=(t.measured?.height||160)+48})}),e.map(e=>({...e,position:c[e.id]}))}(e,b,R)),P(!0),window.requestAnimationFrame(()=>n({duration:400}))},children:(0,_c.__)("Tidy up","funnelfork")})]}),(0,c.jsx)(js,{position:"bottom-center",className:"fs-hint",children:(0,_c.__)("Drag from an answer (●) to a question or result to draw a line. Drop on an empty spot to create a new step.","funnelfork")})]}),z&&(0,c.jsxs)("div",{className:"fs-drop-menu",style:{left:z.left,top:z.top},role:"menu",children:[(0,c.jsx)("span",{className:"fs-drop-menu__title",children:(0,_c.__)("Add here:","funnelfork")}),[["yesno",(0,_c.__)("Yes/no question","funnelfork")],["choice",(0,_c.__)("Multiple choice","funnelfork")],["end",(0,_c.__)("Result","funnelfork")]].map(([e,t])=>(0,c.jsx)("button",{type:"button",role:"menuitem",onClick:()=>{Z(e,z.position,z.from),A(null)},children:t},e)),(0,c.jsx)("button",{type:"button",className:"is-cancel",onClick:()=>A(null),children:(0,_c.__)("Cancel","funnelfork")})]})]}),(0,c.jsx)(ud,{node:J,nodes:x,edges:b,labels:S,settings:N,issues:q,tab:I,setTab:O,setLabels:e=>{C(e);const t=e.map(e=>e.id);v(e=>e.map(e=>"question"===e.type&&e.data.answers.some(e=>e.labels.some(e=>!t.includes(e)))?{...e,data:{...e.data,answers:e.data.answers.map(e=>({...e,labels:e.labels.filter(e=>t.includes(e))}))}}:e)),P(!0)},setSettings:e=>{E(e),P(!0)},update:e=>J&&T(J.id,e),onConnect:$,setDefault:e=>{v(t=>t.map(t=>"end"===t.type?{...t,data:{...t.data,isDefault:t.id===e}}:t)),P(!0)},deleteNode:e=>{const t=x.find(t=>t.id===e);"end"!==t?.type||1!==x.filter(e=>"end"===e.type).length?o({nodes:[{id:e}]}):h({status:"warning",text:(0,_c.__)("A quickscan needs at least one result.","funnelfork")})},duplicateNode:e=>{const t=x.find(t=>t.id===e);if(!t)return;const n=structuredClone({id:t.id,type:t.type,position:t.position,data:t.data});n.id=Mc("end"===t.type?"end":"q"),n.position={x:t.position.x+40,y:t.position.y+40},"question"===n.type&&"choice"===n.data.answerType&&(n.data.answers=n.data.answers.map(e=>({...e,id:Mc("a")}))),"end"===n.type&&(n.data.isDefault=!1),v(e=>[...e.map(e=>({...e,selected:!1})),{...n,deletable:!0,selected:!0}]),P(!0)},focusNode:e=>{H(e),window.requestAnimationFrame(()=>n({nodes:[{id:e}],duration:400,maxZoom:1.1}))},addNode:Z})]})]})})}const xd=document.getElementById("funnelfork-editor-root");xd&&(0,l.createRoot)(xd).render((0,c.jsx)(Hl,{children:(0,c.jsx)(yd,{})}))}};const t={};function n(o){const r=t[o];if(void 0!==r)return r.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.m=e,(()=>{const e=[];n.O=(t,o,r)=>{if(!o){for(var i=0;i<e.length;i++){let[o,r]=e[i],a=!0;for(var s=0;s<o.length;s++)n.O.j(o[s])?o.splice(s--,1):a=!1;if(a){e.splice(i--,1);const n=r();void 0!==n&&(t=n)}}return t}e.push([o,r])}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.hasOwn(e,t),n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={8:0,117:0};n.O.j=t=>0===e[t];const t=(t,o)=>{let[r,i,s]=o;var a,l,c=0;if(r.some(t=>0!==e[t])){for(a in i)n.o(i,a)&&(n.m[a]=i[a]);if(s)var d=s(n)}for(t&&t(o);c<r.length;c++)l=r[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(d)},o=globalThis.webpackChunkfunnelfork||=[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();let o=n.O(void 0,[117],()=>n(730));o=n.O(o)})(); -
funnelfork/tags/1.1.0/build/runner.asset.php
r3763298 r3792829 3 3 4 4 ), 5 'version' => ' 5ccd18a9029cabcf9d3d'5 'version' => 'b754e60e0473a8684f3f' 6 6 ); -
funnelfork/tags/1.1.0/build/runner.js
r3763298 r3792829 1 (()=>{"use strict";const t=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function e(t,e,s){const n=document.createElement(t);return e&&(n.className=e),null!=s&&(n.textContent=s),n}const s={slide:function({from:t,to:e,direction:s,viewport:n,done:i}){const r="back"===s?-1:1;e.style.transform=`translateX(${100*r}%)`;const o=e.offsetHeight;window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{n.style.height=`${o}px`,t.style.transform=`translateX(${100*-r}%)`,t.style.opacity="0",e.style.transform="translateX(0)"})}),e.addEventListener("transitionend",t=>t.target===e&&"transform"===t.propertyName&&i()),setTimeout(i,700)}};class n{constructor(t){this.root=t,this.data=JSON.parse(t.querySelector(".funnelfork__data").textContent),this.i18n=this.data.i18n,this.history=[],this.current=null,this.busy=!1,this.depthCache={},this.mode="score"===this.data.settings.mode?"score":"flow",this.order=this.data.order||[];const e=Object.entries(this.data.nodes).filter(([,t])=>"end"===t.type);this.defaultEnd=(e.find(([,t])=>t.data.isDefault)||e[0]||[])[0],this.startId=Object.keys(this.data.nodes).find(t=>"start"===this.data.nodes[t].type),this.build(),this.s howFirst("none")}build(){const{settings:t}=this.data;this.header=e("div","funnelfork__header"),this.backButton=e("button","funnelfork__back",this.i18n.back),this.backButton.type="button",this.backButton.addEventListener("click",()=>this.back()),t.showBack&&this.header.append(this.backButton),this.progress=e("div","funnelfork__progress"),this.progress.setAttribute("role","progressbar"),this.progress.setAttribute("aria-label",this.i18n.progress),this.progress.setAttribute("aria-valuemin","0"),this.progress.setAttribute("aria-valuemax","100"),this.progressBar=e("div","funnelfork__progress-bar"),this.progress.append(this.progressBar),t.showProgress&&this.header.append(this.progress),this.viewport=e("div","funnelfork__viewport"),this.live=e("div","funnelfork__sr"),this.live.setAttribute("aria-live","polite"),this.root.append(this.header,this.viewport,this.live),this.root.classList.add("is-ready")}showFirst(t){this.data.nodes[this.startId]?.data.showIntro?this.go(this.startId,t):this.begin(t)}begin(t){const e=this.step(this.startId,"next");let s=!1;this.emit("beforestart",{resume:()=>{s||(s=!0,this.go(e,"none"===t?"forward":t))}},!0).defaultPrevented||(s=!0,this.go(e,t))}show(t,s="forward"){const n=t.classList.contains("funnelfork__slide")?t:e("section","funnelfork__slide funnelfork__slide--custom");n!==t&&n.append(t),this.header.hidden=!0,this.transition(n,s)}visited(){return new Set(this.history.map(t=>t.nodeId))}next(t,e,s=this.visited()){const n=this.data.edges[`${t}|${e}`];if("score"!==this.mode)return n||this.defaultEnd;if(n&&!s.has(n))return n;const i=this.order.indexOf(t);return this.order.find((e,n)=>n>i&&e!==t&&!s.has(e))||this.defaultEnd}step(t,e){const s=this.next(t,e);return"score"===this.mode&&"end"===this.data.nodes[s]?.type?this.scoreEnd():s}score(){return this.answers().reduce((t,e)=>t+e.points,0)}scoreEnd(){const t=this.score(),e=Object.entries(this.data.nodes).find(([,e])=>{if("end"!==e.type)return!1;const s=e.data.scoreMin??null,n=e.data.scoreMax??null;return(null!==s||null!==n)&&(null===s||t>=s)&&(null===n||t<=n)});return e?e[0]:this.defaultEnd}remaining(t){if("score"===this.mode)return this.remainingScore(t,this.visited(),new Map);if(void 0!==this.depthCache[t])return this.depthCache[t];const e=this.data.nodes[t];let s=0;return"question"===e?.type?s=1+Math.max(0,...e.data.answers.map(e=>this.remaining(this.next(t,e.id)))):"start"===e?.type&&(s=this.remaining(this.next(t,"next"))),this.depthCache[t]=s,s}remainingScore(t,e,s){const n=this.data.nodes[t];if("question"!==n?.type)return 0;const i=`${t}|${[...e].sort().join(",")}`;if(!s.has(i)){const r=new Set(e).add(t),o=new Set(n.data.answers.map(e=>this.next(t,e.id,r)));s.set(i,1+Math.max(0,...[...o].map(t=>this.remainingScore(t,r,s))))}return s.get(i)}answer(t,e){this.busy||(this.history.push({nodeId:t,answerId:e}),this.emit("answer",{questionId:t,answerId:e}),this.go(this.step(t,e),"forward"))}back(){if(this.busy)return;const t=this.history.pop();t?this.go(t.nodeId,"back",t.answerId):this.current!==this.startId&&this.data.nodes[this.startId]?.data.showIntro&&this.go(this.startId,"back")}restart(){this.history=[],this.showFirst("back")}answers(){return this.history.map(({nodeId:t,answerId:e})=>{const s=this.data.nodes[t].data,n=s.answers.find(t=>t.id===e)||{};return{questionId:t,question:s.question,answerId:e,answer:n.text,labels:n.labels||[],points:Number(n.points)||0}})}collectedLabels(){const t=new Set(this.answers().flatMap(t=>t.labels));return this.data.labels.filter(e=>t.has(e.id))}emit(t,e={},s=!1){const n=new CustomEvent(`funnelfork:${t}`,{bubbles:!0,cancelable:s,detail:{scanId:this.data.id,scan:this,...e}});return this.root.dispatchEvent(n),n}go(t,e,s=null){const n=this.data.nodes[t];if(!n)return;let i;this.current=t,i="start"===n.type?this.renderStart(n):"question"===n.type?this.renderQuestion(t,n,s):this.renderEnd(t,n),this.emit("render",{nodeId:t,type:n.type,slide:i}),this.updateHeader(n),this.transition(i,e),this.emit("step",{nodeId:t,type:n.type}),"end"===n.type&&this.emit("complete",{endpointId:t,answers:this.answers(),labels:this.collectedLabels(),mode:this.mode,score:this.score()})}updateHeader(t){const e=this.history.length;let s=0;"end"===t.type?s=100:"question"===t.type&&(s=Math.round(e/(e+this.remaining(this.current))*100)),this.progressBar.style.width=`${s}%`,this.progress.setAttribute("aria-valuenow",String(s));const n=this.history.length>0||"start"!==t.type&&this.data.nodes[this.startId]?.data.showIntro;this.backButton.hidden=!n||"end"===t.type,this.header.hidden="start"===t.type}renderStart(t){const s=e("section","funnelfork__slide funnelfork__slide--start"),n=e("h2","funnelfork__title",t.data.title);if(n.tabIndex=-1,s.append(n),t.data.intro){const n=e("div","funnelfork__intro");n.innerHTML=t.data.intro,s.append(n)}const i=e("button","funnelfork__start wp-element-button",t.data.buttonText||this.i18n.start);return i.type="button",i.addEventListener("click",()=>this.begin("forward")),s.append(i),s}renderQuestion(t,s,n){const{data:i}=s,r=e("section",`funnelfork__slide funnelfork__slide--question is-${i.answerType}`),o=`funnelfork-${this.data.id}-${t}`;r.append(e("p","funnelfork__eyebrow",this.i18n.questionN.replace("%d",this.history.length+1)));const a=e("h2","funnelfork__title",i.question);a.id=o,a.tabIndex=-1,r.append(a),i.description&&r.append(e("p","funnelfork__description",i.description));const d=e("div","funnelfork__answers");return d.setAttribute("role","group"),d.setAttribute("aria-labelledby",o),i.answers.forEach(s=>{const i=e("button","funnelfork__answer");i.type="button",i.dataset.answerId=s.id,i.append(e("span","funnelfork__answer-text",s.text)),s.id===n&&(i.classList.add("is-selected"),i.setAttribute("aria-pressed","true")),i.addEventListener("click",()=>{i.classList.add("is-selected"),this.answer(t,s.id)}),d.append(i)}),r.append(d),r}renderEnd(t,s){const{data:n}=s,i=e("section","funnelfork__slide funnelfork__slide--end"),r=e("h2","funnelfork__title",n.title);r.tabIndex=-1,i.append(r),"score"===this.mode&&!1!==n.showScore&&i.append(e("p","funnelfork__score",this.i18n.yourScore.replace("%d",this.score())));const o=this.root.querySelector(`template[data-funnelfork-end="${CSS.escape(t)}"]`);o&&i.append(o.content.cloneNode(!0));const a=this.collectedLabels();if(n.showLabels&&a.length){const t=e("div","funnelfork__advice");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAdvice));const s=e("ul","funnelfork__labels");a.forEach(t=>{const n=e("li","funnelfork__label"),i=e("span","funnelfork__label-dot");i.style.background=t.color,n.append(i);const r=e("div","funnelfork__label-body");r.append(e("strong","funnelfork__label-name",t.name)),t.description&&r.append(e("p","funnelfork__label-description",t.description)),n.append(r),s.append(n)}),t.append(s),i.append(t)}if(n.showAnswers&&this.history.length){const t=e("div","funnelfork__summary");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAnswers));const s=e("dl","funnelfork__summary-list");this.answers().forEach(t=>{s.append(e("dt","",t.question),e("dd","",t.answer))}),t.append(s),i.append(t)}const d=e("button","funnelfork__restart",this.i18n.restart);return d.type="button",d.addEventListener("click",()=>this.restart()),i.append(d),i}transition(e,n){const i=this.viewport.querySelector(".funnelfork__slide.is-current");e.classList.add("is-current");const r=()=>{"none"!==n&&(e.querySelector(".funnelfork__title")?.focus({preventScroll:!0}),this.live.textContent=e.querySelector(".funnelfork__title")?.textContent||"",this.root.getBoundingClientRect().top<0&&this.root.scrollIntoView({behavior:t?"auto":"smooth",block:"start"}))};if(!i||"none"===n||t)return i?.remove(),this.viewport.append(e),void r();this.busy=!0,this.viewport.style.height=`${i.offsetHeight}px`,e.classList.add("is-entering"),this.viewport.append(e);let o=!1;const a=()=>{o||(o=!0,i.remove(),e.getAnimations?.().forEach(t=>{try{t.finish()}catch{t.cancel()}}),e.classList.remove("is-entering"),e.style.transform="",e.style.opacity="",this.viewport.style.height="",this.busy=!1,r())},d=s[this.data.settings.transition]||s.slide;try{d({from:i,to:e,direction:n,viewport:this.viewport,done:a})}catch(t){console.error("FunnelFork transition:",t),a()}setTimeout(a,1e3)}}function i(t=document){t.querySelectorAll(".funnelfork[data-funnelfork]:not(.is-ready)").forEach(t=>{try{t.funnelfork=new n(t)}catch(t){console.error("FunnelFork:",t)}})}window.FunnelFork={init:i,Scan:n,registerTransition:function(t,e){"function"==typeof e&&(s[t]=e)}},"complete"===document.readyState?i():(document.addEventListener("DOMContentLoaded",()=>i()),window.addEventListener("load",()=>i()))})();1 (()=>{"use strict";const t=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function e(t,e,s){const n=document.createElement(t);return e&&(n.className=e),null!=s&&(n.textContent=s),n}const s={slide:function({from:t,to:e,direction:s,viewport:n,done:i}){const r="back"===s?-1:1;e.style.transform=`translateX(${100*r}%)`;const o=e.offsetHeight;window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{n.style.height=`${o}px`,t.style.transform=`translateX(${100*-r}%)`,t.style.opacity="0",e.style.transform="translateX(0)"})}),e.addEventListener("transitionend",t=>t.target===e&&"transform"===t.propertyName&&i()),setTimeout(i,700)}};class n{constructor(t){this.root=t,this.data=JSON.parse(t.querySelector(".funnelfork__data").textContent),this.i18n=this.data.i18n,this.history=[],this.current=null,this.busy=!1,this.depthCache={},this.mode="score"===this.data.settings.mode?"score":"flow",this.order=this.data.order||[];const e=Object.entries(this.data.nodes).filter(([,t])=>"end"===t.type);this.defaultEnd=(e.find(([,t])=>t.data.isDefault)||e[0]||[])[0],this.startId=Object.keys(this.data.nodes).find(t=>"start"===this.data.nodes[t].type),this.build(),this.started=!1,this.watchView(),this.showFirst("none")}track(t){const e=this.data.track;if(!e)return;if("view"===t){if(this.viewed)return;this.viewed=!0}else this.viewed||this.track("view");const s=JSON.stringify({scanId:this.data.id,event:t});try{if(navigator.sendBeacon?.(e,new Blob([s],{type:"application/json"})))return}catch{}window.fetch(e,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:s}).catch(()=>{})}watchView(){if(!this.data.track)return;if(!("IntersectionObserver"in window))return void this.track("view");const t=new window.IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&(t.disconnect(),this.track("view"))},{threshold:.5});t.observe(this.root)}build(){const{settings:t}=this.data;this.header=e("div","funnelfork__header"),this.backButton=e("button","funnelfork__back",this.i18n.back),this.backButton.type="button",this.backButton.addEventListener("click",()=>this.back()),t.showBack&&this.header.append(this.backButton),this.progress=e("div","funnelfork__progress"),this.progress.setAttribute("role","progressbar"),this.progress.setAttribute("aria-label",this.i18n.progress),this.progress.setAttribute("aria-valuemin","0"),this.progress.setAttribute("aria-valuemax","100"),this.progressBar=e("div","funnelfork__progress-bar"),this.progress.append(this.progressBar),t.showProgress&&this.header.append(this.progress),this.viewport=e("div","funnelfork__viewport"),this.live=e("div","funnelfork__sr"),this.live.setAttribute("aria-live","polite"),this.root.append(this.header,this.viewport,this.live),this.root.classList.add("is-ready")}showFirst(t){this.data.nodes[this.startId]?.data.showIntro?this.go(this.startId,t):this.begin(t)}begin(t){const e=this.step(this.startId,"next");let s=!1;this.emit("beforestart",{resume:()=>{s||(s=!0,this.go(e,"none"===t?"forward":t))}},!0).defaultPrevented||(s=!0,this.go(e,t))}show(t,s="forward"){const n=t.classList.contains("funnelfork__slide")?t:e("section","funnelfork__slide funnelfork__slide--custom");n!==t&&n.append(t),this.header.hidden=!0,this.transition(n,s)}visited(){return new Set(this.history.map(t=>t.nodeId))}next(t,e,s=this.visited()){const n=this.data.edges[`${t}|${e}`];if("score"!==this.mode)return n||this.defaultEnd;if(n&&!s.has(n))return n;const i=this.order.indexOf(t);return this.order.find((e,n)=>n>i&&e!==t&&!s.has(e))||this.defaultEnd}step(t,e){const s=this.next(t,e);return"score"===this.mode&&"end"===this.data.nodes[s]?.type?this.scoreEnd():s}score(){return this.answers().reduce((t,e)=>t+e.points,0)}scoreEnd(){const t=this.score(),e=Object.entries(this.data.nodes).find(([,e])=>{if("end"!==e.type)return!1;const s=e.data.scoreMin??null,n=e.data.scoreMax??null;return(null!==s||null!==n)&&(null===s||t>=s)&&(null===n||t<=n)});return e?e[0]:this.defaultEnd}remaining(t){if("score"===this.mode)return this.remainingScore(t,this.visited(),new Map);if(void 0!==this.depthCache[t])return this.depthCache[t];const e=this.data.nodes[t];let s=0;return"question"===e?.type?s=1+Math.max(0,...e.data.answers.map(e=>this.remaining(this.next(t,e.id)))):"start"===e?.type&&(s=this.remaining(this.next(t,"next"))),this.depthCache[t]=s,s}remainingScore(t,e,s){const n=this.data.nodes[t];if("question"!==n?.type)return 0;const i=`${t}|${[...e].sort().join(",")}`;if(!s.has(i)){const r=new Set(e).add(t),o=new Set(n.data.answers.map(e=>this.next(t,e.id,r)));s.set(i,1+Math.max(0,...[...o].map(t=>this.remainingScore(t,r,s))))}return s.get(i)}answer(t,e){this.busy||(this.history.push({nodeId:t,answerId:e}),this.emit("answer",{questionId:t,answerId:e}),this.goForward(this.step(t,e)))}goForward(t){if("end"!==this.data.nodes[t]?.type)return void this.go(t,"forward");let e=!1;const s=()=>{e||(e=!0,this.go(t,"forward"))};this.emit("beforecomplete",{endpointId:t,answers:this.answers(),labels:this.collectedLabels(),mode:this.mode,score:this.score(),resume:s},!0).defaultPrevented||s()}back(){if(this.busy)return;const t=this.history.pop();t?this.go(t.nodeId,"back",t.answerId):this.current!==this.startId&&this.data.nodes[this.startId]?.data.showIntro&&this.go(this.startId,"back")}restart(){this.history=[],this.showFirst("back")}answers(){return this.history.map(({nodeId:t,answerId:e})=>{const s=this.data.nodes[t].data,n=s.answers.find(t=>t.id===e)||{};return{questionId:t,question:s.question,answerId:e,answer:n.text,labels:n.labels||[],points:Number(n.points)||0}})}collectedLabels(){const t=new Set(this.answers().flatMap(t=>t.labels));return this.data.labels.filter(e=>t.has(e.id))}emit(t,e={},s=!1){const n=new CustomEvent(`funnelfork:${t}`,{bubbles:!0,cancelable:s,detail:{scanId:this.data.id,scan:this,...e}});return this.root.dispatchEvent(n),n}go(t,e,s=null){const n=this.data.nodes[t];if(!n)return;let i;this.current=t,i="start"===n.type?this.renderStart(n):"question"===n.type?this.renderQuestion(t,n,s):this.renderEnd(t,n),this.emit("render",{nodeId:t,type:n.type,slide:i}),this.updateHeader(n),this.transition(i,e),this.emit("step",{nodeId:t,type:n.type}),"question"!==n.type||this.started||(this.started=!0,this.track("start")),"end"===n.type&&(this.track("complete"),this.started=!1,this.emit("complete",{endpointId:t,answers:this.answers(),labels:this.collectedLabels(),mode:this.mode,score:this.score()}))}updateHeader(t){const e=this.history.length;let s=0;"end"===t.type?s=100:"question"===t.type&&(s=Math.round(e/(e+this.remaining(this.current))*100)),this.progressBar.style.width=`${s}%`,this.progress.setAttribute("aria-valuenow",String(s));const n=this.history.length>0||"start"!==t.type&&this.data.nodes[this.startId]?.data.showIntro;this.backButton.hidden=!n||"end"===t.type,this.header.hidden="start"===t.type}renderStart(t){const s=e("section","funnelfork__slide funnelfork__slide--start"),n=e("h2","funnelfork__title",t.data.title);if(n.tabIndex=-1,s.append(n),t.data.intro){const n=e("div","funnelfork__intro");n.innerHTML=t.data.intro,s.append(n)}const i=e("button","funnelfork__start wp-element-button",t.data.buttonText||this.i18n.start);return i.type="button",i.addEventListener("click",()=>this.begin("forward")),s.append(i),s}renderQuestion(t,s,n){const{data:i}=s,r=e("section",`funnelfork__slide funnelfork__slide--question is-${i.answerType}`),o=`funnelfork-${this.data.id}-${t}`;r.append(e("p","funnelfork__eyebrow",this.i18n.questionN.replace("%d",this.history.length+1)));const a=e("h2","funnelfork__title",i.question);a.id=o,a.tabIndex=-1,r.append(a),i.description&&r.append(e("p","funnelfork__description",i.description));const d=e("div","funnelfork__answers");return d.setAttribute("role","group"),d.setAttribute("aria-labelledby",o),i.answers.forEach(s=>{const i=e("button","funnelfork__answer");i.type="button",i.dataset.answerId=s.id,i.append(e("span","funnelfork__answer-text",s.text)),s.id===n&&(i.classList.add("is-selected"),i.setAttribute("aria-pressed","true")),i.addEventListener("click",()=>{i.classList.add("is-selected"),this.answer(t,s.id)}),d.append(i)}),r.append(d),r}renderEnd(t,s){const{data:n}=s,i=e("section","funnelfork__slide funnelfork__slide--end"),r=e("h2","funnelfork__title",n.title);r.tabIndex=-1,i.append(r),"score"===this.mode&&!1!==n.showScore&&i.append(e("p","funnelfork__score",this.i18n.yourScore.replace("%d",this.score())));const o=this.root.querySelector(`template[data-funnelfork-end="${CSS.escape(t)}"]`);o&&i.append(o.content.cloneNode(!0));const a=this.collectedLabels();if(n.showLabels&&a.length){const t=e("div","funnelfork__advice");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAdvice));const s=e("ul","funnelfork__labels");a.forEach(t=>{const n=e("li","funnelfork__label"),i=e("span","funnelfork__label-dot");i.style.background=t.color,n.append(i);const r=e("div","funnelfork__label-body");r.append(e("strong","funnelfork__label-name",t.name)),t.description&&r.append(e("p","funnelfork__label-description",t.description)),n.append(r),s.append(n)}),t.append(s),i.append(t)}if(n.showAnswers&&this.history.length){const t=e("div","funnelfork__summary");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAnswers));const s=e("dl","funnelfork__summary-list");this.answers().forEach(t=>{s.append(e("dt","",t.question),e("dd","",t.answer))}),t.append(s),i.append(t)}const d=e("button","funnelfork__restart",this.i18n.restart);return d.type="button",d.addEventListener("click",()=>this.restart()),i.append(d),i}transition(e,n){const i=this.viewport.querySelector(".funnelfork__slide.is-current");e.classList.add("is-current");const r=()=>{"none"!==n&&(e.querySelector(".funnelfork__title")?.focus({preventScroll:!0}),this.live.textContent=e.querySelector(".funnelfork__title")?.textContent||"",this.root.getBoundingClientRect().top<0&&this.root.scrollIntoView({behavior:t?"auto":"smooth",block:"start"}))};if(!i||"none"===n||t)return i?.remove(),this.viewport.append(e),void r();this.busy=!0,this.viewport.style.height=`${i.offsetHeight}px`,e.classList.add("is-entering"),this.viewport.append(e);let o=!1;const a=()=>{o||(o=!0,i.remove(),e.getAnimations?.().forEach(t=>{try{t.finish()}catch{t.cancel()}}),e.classList.remove("is-entering"),e.style.transform="",e.style.opacity="",this.viewport.style.height="",this.busy=!1,r())},d=s[this.data.settings.transition]||s.slide;try{d({from:i,to:e,direction:n,viewport:this.viewport,done:a})}catch(t){console.error("FunnelFork transition:",t),a()}setTimeout(a,1e3)}}function i(t=document){t.querySelectorAll(".funnelfork[data-funnelfork]:not(.is-ready)").forEach(t=>{try{t.funnelfork=new n(t)}catch(t){console.error("FunnelFork:",t)}})}window.FunnelFork={init:i,Scan:n,registerTransition:function(t,e){"function"==typeof e&&(s[t]=e)}},"complete"===document.readyState?i():(document.addEventListener("DOMContentLoaded",()=>i()),window.addEventListener("load",()=>i()))})(); -
funnelfork/tags/1.1.0/funnelfork.php
r3764618 r3792829 4 4 * Plugin URI: https://funnelfork.com/ 5 5 * Description: Drag & drop quiz builder: draw product recommendation quizzes, decision trees and assessments as a flowchart, and turn visitors into leads. 6 * Version: 1. 0.26 * Version: 1.1.0 7 7 * Requires at least: 6.7 8 8 * Requires PHP: 8.1 … … 19 19 defined( 'ABSPATH' ) || exit; 20 20 21 define( 'FUNNELFORK_VERSION', '1. 0.2' );21 define( 'FUNNELFORK_VERSION', '1.1.0' ); 22 22 define( 'FUNNELFORK_FILE', __FILE__ ); 23 23 define( 'FUNNELFORK_DIR', plugin_dir_path( __FILE__ ) ); … … 33 33 require_once FUNNELFORK_DIR . 'includes/class-upgrade.php'; 34 34 require_once FUNNELFORK_DIR . 'includes/class-review.php'; 35 require_once FUNNELFORK_DIR . 'includes/class-stats.php'; 35 36 require_once FUNNELFORK_DIR . 'includes/freemius.php'; 36 37 … … 45 46 FunnelFork\Upgrade::init(); 46 47 FunnelFork\Review::init(); 48 FunnelFork\Stats::init(); 47 49 48 50 /** -
funnelfork/tags/1.1.0/includes/freemius.php
r3763298 r3792829 107 107 ); 108 108 109 // Freemius builds the trial texts in the FunnelFork Pro dialog from English pieces ("14 days", 110 // "/ year"), which ends up as "Start mijn gratis 14 days". Whole sentences of our own instead. 111 add_action( 112 'admin_init', 113 static function () { 114 $texts = array( 115 'start-free-x' => __( 'Start 14-day free trial', 'funnelfork' ), 116 'no-commitment-x' => __( 'Card required. Cancel before day 14 and you pay nothing.', 'funnelfork' ), 117 'after-x-pay-as-little-y' => __( 'After 14 days your yearly license starts.', 'funnelfork' ), 118 ); 119 // The dialog uses the add-on's slug in Freemius. 120 foreach ( array( 'funnelfork', 'funnelfork-pro' ) as $slug ) { 121 fs_override_i18n( $texts, $slug ); 122 } 123 } 124 ); 109 // Deleting the plugin removes the statistics table (scans stay, as posts of the site). 110 $funnelfork_fs->add_action( 'after_uninstall', array( 'FunnelFork\Stats', 'uninstall' ) ); 125 111 126 112 do_action( 'funnelfork_fs_loaded' ); -
funnelfork/tags/1.1.0/languages/funnelfork.pot
r3764618 r3792829 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: FunnelFork – Visual Quiz Builder for Product Recommendations & Decision Trees 1. 0.2\n"5 "Project-Id-Version: FunnelFork – Visual Quiz Builder for Product Recommendations & Decision Trees 1.1.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/funnelfork\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2026-1 0-25T12:50:48+00:00\n"12 "POT-Creation-Date: 2026-11-09T15:48:38+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2.1 1.0\n"14 "X-Generator: WP-CLI 2.12.0\n" 15 15 "X-Domain: funnelfork\n" 16 16 … … 56 56 #: includes/class-admin.php:171 57 57 #: includes/class-rest.php:75 58 #: includes/class-stats.php:372 58 59 msgid "Quickscan not found." 59 60 msgstr "" … … 69 70 70 71 #: includes/class-admin.php:261 71 #: build/editor.js:8 72 #: src/editor/components/Inspector.js:411 72 #: build/editor.js:12 73 73 msgid "Shortcode" 74 74 msgstr "" … … 83 83 84 84 #: includes/class-admin.php:305 85 #: build/editor.js:21 86 #: src/editor/App.js:636 85 #: build/editor.js:25 87 86 msgid "Preview" 88 87 msgstr "" … … 111 110 #. translators: %d: question number. 112 111 #: includes/class-frontend.php:177 112 #, php-format 113 113 msgid "Question %d" 114 114 msgstr "" … … 124 124 #. translators: %d: total score. 125 125 #: includes/class-frontend.php:181 126 #, php-format 126 127 msgid "Your score: %d" 127 128 msgstr "" … … 131 132 #: build/editor.js:1 132 133 #: build/editor.js:5 133 #: src/editor/components/nodes.js:68134 #: src/editor/components/nodes.js:70135 #: src/editor/utils.js:151136 134 msgid "Start" 137 135 msgstr "" … … 171 169 #: includes/class-graph.php:169 172 170 #: build/editor.js:1 173 #: src/editor/utils.js:36174 171 msgid "Yes" 175 172 msgstr "" … … 177 174 #: includes/class-graph.php:175 178 175 #: build/editor.js:1 179 #: src/editor/utils.js:37180 176 msgid "No" 181 177 msgstr "" … … 186 182 187 183 #: includes/class-post-type.php:36 184 #: includes/class-stats.php:472 188 185 #: build/block/index.js:1 189 #: src/block/index.js:54190 #: src/block/index.js:66191 186 msgid "Quickscan" 192 187 msgstr "" … … 227 222 #. translators: %s: first name of the user. 228 223 #: includes/class-review.php:151 224 #, php-format 229 225 msgid "Hi %s, congratulations on publishing your first quickscan. I hope it helps your visitors find the right answer." 230 226 msgstr "" … … 258 254 #. translators: %s: link to the support forum. 259 255 #: includes/class-review.php:170 256 #, php-format 260 257 msgid "Ran into a problem? %s and we will help you out." 261 258 msgstr "" … … 267 264 #: includes/class-review.php:190 268 265 msgid "Sorry, you are not allowed to do that." 266 msgstr "" 267 268 #. translators: %d: number of days. 269 #: includes/class-stats.php:395 270 #, php-format 271 msgid "Views (%d days)" 272 msgstr "" 273 274 #: includes/class-stats.php:396 275 #: includes/class-stats.php:457 276 #: build/editor.js:7 277 #: build/editor.js:9 278 msgid "Completed" 279 msgstr "" 280 281 #: includes/class-stats.php:397 282 #: includes/class-stats.php:458 283 #: includes/class-stats.php:474 284 #: build/editor.js:9 285 msgid "Completion rate" 286 msgstr "" 287 288 #. translators: %d: number of days. 289 #: includes/class-stats.php:437 290 #, php-format 291 msgid "FunnelFork – last %d days" 292 msgstr "" 293 294 #: includes/class-stats.php:455 295 #: includes/class-stats.php:473 296 #: build/editor.js:7 297 #: build/editor.js:9 298 msgid "Views" 299 msgstr "" 300 301 #: includes/class-stats.php:456 302 #: build/editor.js:9 303 msgid "Started" 304 msgstr "" 305 306 #: includes/class-stats.php:487 307 msgid "No visitors yet. Place a quickscan on a page with the block or the shortcode, and the numbers appear here." 308 msgstr "" 309 310 #. translators: %d: percentage of visitors who do not finish. 311 #: includes/class-stats.php:495 312 #, php-format 313 msgid "%d%% of the visitors who start do not finish. FunnelFork Pro shows at which question they leave." 314 msgstr "" 315 316 #: includes/class-stats.php:500 317 #: build/editor.js:10 318 msgid "Learn more" 319 msgstr "" 320 321 #: includes/class-stats.php:514 322 msgid "When you view or do a quickscan, we count this anonymously: per quickscan and per day only the number of views, starts and completions. No IP address, cookie or answer is stored for these statistics." 269 323 msgstr "" 270 324 … … 419 473 msgstr "" 420 474 421 #: includes/freemius.php:115422 msgid "Start 14-day free trial"423 msgstr ""424 425 #: includes/freemius.php:116426 msgid "Card required. Cancel before day 14 and you pay nothing."427 msgstr ""428 429 #: includes/freemius.php:117430 msgid "After 14 days your yearly license starts."431 msgstr ""432 433 475 #: build/block/index.js:1 434 #: src/block/index.js:38435 476 msgid "— Choose a quickscan —" 436 477 msgstr "" 437 478 438 479 #: build/block/index.js:1 439 #: src/block/index.js:42440 480 msgid "(no title)" 441 481 msgstr "" 442 482 443 483 #: build/block/index.js:1 444 #: src/block/index.js:44445 484 msgid "draft" 446 485 msgstr "" 447 486 448 487 #: build/block/index.js:1 449 #: src/block/index.js:72450 488 msgid "FunnelFork quickscan" 451 489 msgstr "" 452 490 453 491 #: build/block/index.js:1 454 #: src/block/index.js:76455 492 msgid "Choose which quickscan to show here." 456 493 msgstr "" 457 494 458 495 #: build/block/index.js:1 459 #: src/block/index.js:87460 496 msgid "Edit this quickscan" 461 497 msgstr "" … … 463 499 #: build/editor.js:1 464 500 #: build/editor.js:6 465 #: src/editor/components/nodes.js:240466 #: src/editor/utils.js:154467 501 msgid "(untitled result)" 468 502 msgstr "" 469 503 470 504 #: build/editor.js:1 471 #: src/editor/utils.js:156472 505 msgid "(empty question)" 473 506 msgstr "" … … 475 508 #. translators: %d: score. 476 509 #: build/editor.js:2 477 # : src/editor/utils.js:239510 #, js-format 478 511 msgid "Score %d" 479 512 msgstr "" … … 481 514 #. translators: 1: lowest score, 2: highest score. 482 515 #: build/editor.js:3 483 # : src/editor/utils.js:244516 #, js-format 484 517 msgid "Score %1$d – %2$d" 485 518 msgstr "" … … 487 520 #. translators: %d: lowest score. 488 521 #: build/editor.js:4 489 # : src/editor/utils.js:252522 #, js-format 490 523 msgid "Score %d or more" 491 524 msgstr "" … … 493 526 #. translators: %d: highest score. 494 527 #: build/editor.js:5 495 # : src/editor/utils.js:259528 #, js-format 496 529 msgid "Score %d or less" 497 530 msgstr "" 498 531 499 532 #: build/editor.js:5 500 #: src/editor/utils.js:263501 533 msgid "No score range" 502 534 msgstr "" 503 535 504 536 #: build/editor.js:5 505 #: src/editor/components/nodes.js:103506 537 msgid "Position in the question order" 507 538 msgstr "" 508 539 509 540 #: build/editor.js:5 510 #: build/editor.js:6 511 #: src/editor/components/Inspector.js:268 512 #: src/editor/components/nodes.js:112 541 #: build/editor.js:10 513 542 msgid "Yes / no" 514 543 msgstr "" 515 544 516 545 #: build/editor.js:5 517 #: build/editor.js:21 518 #: src/editor/App.js:727 519 #: src/editor/App.js:771 520 #: src/editor/components/nodes.js:113 546 #: build/editor.js:25 521 547 msgid "Multiple choice" 522 548 msgstr "" 523 549 524 550 #: build/editor.js:5 525 #: src/editor/components/nodes.js:117526 551 msgid "Type your question…" 527 552 msgstr "" 528 553 529 554 #: build/editor.js:5 530 #: src/editor/components/nodes.js:133531 555 msgid "(empty)" 532 556 msgstr "" 533 557 534 558 #: build/editor.js:5 535 #: build/editor.js:7 536 #: src/editor/components/Inspector.js:303 537 #: src/editor/components/nodes.js:143 559 #: build/editor.js:11 538 560 msgid "Points" 539 561 msgstr "" 540 562 541 563 #: build/editor.js:5 542 #: src/editor/components/nodes.js:152543 564 msgid "No line: goes to the next question" 544 565 msgstr "" 545 566 546 567 #: build/editor.js:5 547 #: src/editor/components/nodes.js:165548 568 msgid "No line: the scan ends and the score picks the result" 549 569 msgstr "" 550 570 551 571 #: build/editor.js:5 552 #: src/editor/components/nodes.js:169553 572 msgid "No line: goes to the default result" 554 573 msgstr "" 555 574 556 575 #: build/editor.js:5 557 #: src/editor/components/nodes.js:202558 576 msgid "also receives scores without a range" 559 577 msgstr "" 560 578 561 579 #: build/editor.js:5 562 #: src/editor/components/nodes.js:205563 580 msgid "also receives all answers without a line" 564 581 msgstr "" … … 566 583 #. translators: %d: number of incoming lines. 567 584 #: build/editor.js:6 568 #: build/editor.js:10 569 #: src/editor/components/Inspector.js:608 570 #: src/editor/components/nodes.js:209 585 #: build/editor.js:14 586 #, js-format 571 587 msgid "%d incoming line" 572 588 msgid_plural "%d incoming lines" … … 575 591 576 592 #: build/editor.js:6 577 #: build/editor.js:21 578 #: src/editor/App.js:734 579 #: src/editor/App.js:773 580 #: src/editor/components/nodes.js:231 593 #: build/editor.js:25 581 594 msgid "Result" 582 595 msgstr "" 583 596 584 597 #: build/editor.js:6 598 #: build/editor.js:13 599 msgid "Default" 600 msgstr "" 601 602 #: build/editor.js:6 603 #: build/editor.js:12 604 #: build/editor.js:13 605 msgid "Text" 606 msgstr "" 607 608 #: build/editor.js:6 609 msgid "Views and completions per day" 610 msgstr "" 611 612 #. translators: 1: date, 2: views, 3: completions. 613 #: build/editor.js:7 614 #, js-format 615 msgid "%1$s: %2$d views, %3$d completed" 616 msgstr "" 617 618 #: build/editor.js:7 619 msgid "Where do visitors leave?" 620 msgstr "" 621 622 #. translators: %d: percentage of visitors who do not finish. 623 #: build/editor.js:8 624 #, js-format 625 msgid "%d%% of your visitors do not finish this quickscan. FunnelFork Pro shows at which question they leave, right on the lines of your flow." 626 msgstr "" 627 628 #: build/editor.js:8 629 msgid "FunnelFork Pro shows at which question visitors leave, right on the lines of your flow." 630 msgstr "" 631 632 #: build/editor.js:8 633 msgid "Which result do visitors get?" 634 msgstr "" 635 636 #: build/editor.js:8 637 msgid "Drop-off per question on the canvas" 638 msgstr "" 639 640 #: build/editor.js:8 641 msgid "How often every answer, result and label is chosen" 642 msgstr "" 643 644 #: build/editor.js:8 645 msgid "Leads, product clicks and add to cart" 646 msgstr "" 647 648 #: build/editor.js:8 649 msgid "Any period, compared with the period before, and CSV export" 650 msgstr "" 651 652 #: build/editor.js:8 653 msgid "See FunnelFork Pro" 654 msgstr "" 655 656 #: build/editor.js:8 657 msgid "The statistics could not be loaded." 658 msgstr "" 659 660 #. translators: %d: number of days. 585 661 #: build/editor.js:9 586 #: src/editor/components/Inspector.js:601 587 #: src/editor/components/nodes.js:234 588 msgid "Default" 589 msgstr "" 590 591 #: build/editor.js:6 592 #: build/editor.js:8 662 #, js-format 663 msgid "Last %d days" 664 msgstr "" 665 593 666 #: build/editor.js:9 594 #: src/editor/components/Inspector.js:409 595 #: src/editor/components/Inspector.js:465 596 #: src/editor/components/nodes.js:248 597 msgid "Text" 598 msgstr "" 599 600 #: build/editor.js:6 601 #: src/editor/components/Inspector.js:34 602 msgid "Learn more" 603 msgstr "" 604 605 #: build/editor.js:6 606 #: src/editor/components/Inspector.js:105 667 msgid "No visitors yet. Publish the quickscan and place it on a page; views, starts and completions appear here. Your own visits (while logged in) are not counted." 668 msgstr "" 669 670 #. translators: %s: number of completions. 671 #: build/editor.js:10 672 #, js-format 673 msgid "Your quickscan was completed %s time. Want to know what people answer? Save every response with FunnelFork Pro." 674 msgid_plural "Your quickscan was completed %s times. Want to know what people answer? Save every response with FunnelFork Pro." 675 msgstr[0] "" 676 msgstr[1] "" 677 678 #: build/editor.js:10 679 msgid "Counted anonymously: no IP addresses, cookies or answers. Bots and logged-in editors are not counted." 680 msgstr "" 681 682 #: build/editor.js:10 607 683 msgid "(unnamed)" 608 684 msgstr "" 609 685 610 #: build/editor.js:6 611 #: src/editor/components/Inspector.js:132 686 #: build/editor.js:10 612 687 msgid "— Next question —" 613 688 msgstr "" 614 689 615 #: build/editor.js:6 616 #: src/editor/components/Inspector.js:133 690 #: build/editor.js:10 617 691 msgid "— Default result —" 618 692 msgstr "" 619 693 620 #: build/editor.js:6 621 #: src/editor/components/Inspector.js:146 694 #: build/editor.js:10 622 695 msgid "Leads to" 623 696 msgstr "" 624 697 625 #: build/editor.js:6 626 #: src/editor/components/Inspector.js:162 698 #: build/editor.js:10 627 699 msgid "Show an intro screen" 628 700 msgstr "" 629 701 630 #: build/editor.js:6 631 #: src/editor/components/Inspector.js:163 702 #: build/editor.js:10 632 703 msgid "Off: visitors start directly with the first question." 633 704 msgstr "" 634 705 635 #: build/editor.js:6 636 #: build/editor.js:8 637 #: src/editor/components/Inspector.js:175 638 #: src/editor/components/Inspector.js:419 706 #: build/editor.js:10 707 #: build/editor.js:12 639 708 msgid "Title" 640 709 msgstr "" 641 710 642 #: build/editor.js:6 643 #: src/editor/components/Inspector.js:181 711 #: build/editor.js:10 644 712 msgid "Introduction" 645 713 msgstr "" 646 714 647 #: build/editor.js:6 648 #: src/editor/components/Inspector.js:188 715 #: build/editor.js:10 649 716 msgid "Button text" 650 717 msgstr "" 651 718 652 #: build/editor.js:6 653 #: src/editor/components/Inspector.js:253 719 #: build/editor.js:10 654 720 msgid "Question" 655 721 msgstr "" 656 722 657 #: build/editor.js:6 658 #: src/editor/components/Inspector.js:259 723 #: build/editor.js:10 659 724 msgid "Explanation (optional)" 660 725 msgstr "" 661 726 662 #: build/editor.js:6 663 #: src/editor/components/Inspector.js:265 727 #: build/editor.js:10 664 728 msgid "Answer type" 665 729 msgstr "" 666 730 667 #: build/editor.js:6 668 #: src/editor/components/Inspector.js:270 731 #: build/editor.js:10 669 732 msgid "Multiple choice (one answer)" 670 733 msgstr "" 671 734 672 #: build/editor.js:6 673 #: src/editor/components/Inspector.js:286 735 #: build/editor.js:10 674 736 msgid "Answers" 675 737 msgstr "" 676 738 677 739 #. translators: %d: answer number. 678 #: build/editor.js: 7679 # : src/editor/components/Inspector.js:295740 #: build/editor.js:11 741 #, js-format 680 742 msgid "Answer %d" 681 743 msgstr "" 682 744 683 #: build/editor.js:7 684 #: src/editor/components/Inspector.js:337 745 #: build/editor.js:11 685 746 msgid "Move up" 686 747 msgstr "" 687 748 688 #: build/editor.js:7 689 #: src/editor/components/Inspector.js:344 749 #: build/editor.js:11 690 750 msgid "Move down" 691 751 msgstr "" 692 752 693 #: build/editor.js:7 694 #: src/editor/components/Inspector.js:352 753 #: build/editor.js:11 695 754 msgid "Remove answer" 696 755 msgstr "" 697 756 698 757 #. translators: %d: option number. 699 #: build/editor.js: 8700 # : src/editor/components/Inspector.js:378758 #: build/editor.js:12 759 #, js-format 701 760 msgid "Option %d" 702 761 msgstr "" 703 762 704 #: build/editor.js:8 705 #: src/editor/components/Inspector.js:388 763 #: build/editor.js:12 706 764 msgid "Add answer" 707 765 msgstr "" 708 766 709 #: build/editor.js:8 710 #: src/editor/components/Inspector.js:393 767 #: build/editor.js:12 711 768 msgid "Tip: create labels in the \"Labels\" tab and attach them to answers to build personal advice." 712 769 msgstr "" 713 770 714 #: build/editor.js:8 715 #: src/editor/components/Inspector.js:410 771 #: build/editor.js:12 716 772 msgid "Gravity Forms form" 717 773 msgstr "" 718 774 719 #: build/editor.js:8 720 #: src/editor/components/Inspector.js:426 775 #: build/editor.js:12 721 776 msgid "Score range" 722 777 msgstr "" 723 778 724 #: build/editor.js:8 725 #: src/editor/components/Inspector.js:431 779 #: build/editor.js:12 726 780 msgid "From" 727 781 msgstr "" 728 782 729 #: build/editor.js:8 730 #: src/editor/components/Inspector.js:432 783 #: build/editor.js:12 731 784 msgid "no minimum" 732 785 msgstr "" 733 786 734 #: build/editor.js:8 735 #: src/editor/components/Inspector.js:438 787 #: build/editor.js:12 736 788 msgid "To" 737 789 msgstr "" 738 790 739 #: build/editor.js:8 740 #: src/editor/components/Inspector.js:439 791 #: build/editor.js:12 741 792 msgid "no maximum" 742 793 msgstr "" 743 794 744 795 #. translators: 1: lowest possible score, 2: highest possible score. 745 #: build/editor.js: 9746 # : src/editor/components/Inspector.js:447796 #: build/editor.js:13 797 #, js-format 747 798 msgid "Visitors with a total score in this range (both included) get this result. Possible scores: %1$d to %2$d." 748 799 msgstr "" 749 800 750 #: build/editor.js:9 751 #: src/editor/components/Inspector.js:457 801 #: build/editor.js:13 752 802 msgid "Show the score" 753 803 msgstr "" 754 804 755 #: build/editor.js:9 756 #: src/editor/components/Inspector.js:466 805 #: build/editor.js:13 757 806 msgid "Basic HTML is allowed." 758 807 msgstr "" 759 808 760 #: build/editor.js:9 761 #: src/editor/components/Inspector.js:474 809 #: build/editor.js:13 762 810 msgid "Call to action" 763 811 msgstr "" 764 812 765 #: build/editor.js:9 766 #: src/editor/components/Inspector.js:490 813 #: build/editor.js:13 767 814 msgid "Show a Gravity Forms form or any shortcode on a result with FunnelFork Pro." 768 815 msgstr "" 769 816 770 #: build/editor.js:9 771 #: src/editor/components/Inspector.js:499 817 #: build/editor.js:13 772 818 msgid "Show collected labels (advice)" 773 819 msgstr "" 774 820 775 #: build/editor.js:9 776 #: src/editor/components/Inspector.js:505 821 #: build/editor.js:13 777 822 msgid "Show the given answers" 778 823 msgstr "" 779 824 780 #: build/editor.js:9 781 #: src/editor/components/Inspector.js:511 825 #: build/editor.js:13 782 826 msgid "Default result" 783 827 msgstr "" 784 828 785 #: build/editor.js:9 786 #: src/editor/components/Inspector.js:514 829 #: build/editor.js:13 787 830 msgid "Shown when the score matches no range. There is always exactly one default result." 788 831 msgstr "" 789 832 790 #: build/editor.js:9 791 #: src/editor/components/Inspector.js:518 833 #: build/editor.js:13 792 834 msgid "Answers without a line lead here. There is always exactly one default result." 793 835 msgstr "" 794 836 795 #: build/editor.js:9 796 #: src/editor/components/Inspector.js:557 837 #: build/editor.js:13 797 838 msgid "Duplicate" 798 839 msgstr "" 799 840 800 #: build/editor.js:9 801 #: src/editor/components/Inspector.js:565 841 #: build/editor.js:13 802 842 msgid "Delete" 803 843 msgstr "" 804 844 805 #: build/editor.js:9 806 #: src/editor/components/Inspector.js:537 845 #: build/editor.js:13 807 846 msgid "Select a question or result on the canvas to edit it." 808 847 msgstr "" 809 848 810 #: build/editor.js:9 811 #: src/editor/components/Inspector.js:579 849 #: build/editor.js:13 812 850 msgid "Every result is an endpoint of the quickscan. Click one to show it on the canvas." 813 851 msgstr "" 814 852 815 #: build/editor.js:10 816 #: src/editor/components/Inspector.js:627 853 #: build/editor.js:14 817 854 msgid "Add result" 818 855 msgstr "" 819 856 820 #: build/editor.js:10 821 #: src/editor/components/Inspector.js:653 857 #: build/editor.js:14 822 858 msgid "Labels are collected along the way. Attach them to answers (for example a product or a piece of advice) and show them on the result." 823 859 msgstr "" 824 860 825 #: build/editor.js:10 826 #: src/editor/components/Inspector.js:664 861 #: build/editor.js:14 827 862 msgid "Colour" 828 863 msgstr "" 829 864 830 #: build/editor.js:10 831 #: src/editor/components/Inspector.js:673 832 #: src/editor/components/Inspector.js:674 865 #: build/editor.js:14 833 866 msgid "Name" 834 867 msgstr "" 835 868 836 #: build/editor.js:10 837 #: src/editor/components/Inspector.js:683 869 #: build/editor.js:14 838 870 msgid "Delete label" 839 871 msgstr "" 840 872 841 #: build/editor.js:10 842 #: src/editor/components/Inspector.js:694 873 #: build/editor.js:14 843 874 msgid "Description" 844 875 msgstr "" 845 876 846 #: build/editor.js:10 847 #: src/editor/components/Inspector.js:695 877 #: build/editor.js:14 848 878 msgid "Description shown on the result (optional)" 849 879 msgstr "" 850 880 851 881 #. translators: %d: number of answers. 852 #: build/editor.js:1 1853 # : src/editor/components/Inspector.js:708882 #: build/editor.js:15 883 #, js-format 854 884 msgid "Used by %d answer" 855 885 msgid_plural "Used by %d answers" … … 857 887 msgstr[1] "" 858 888 859 #: build/editor.js:11 860 #: src/editor/components/Inspector.js:736 889 #: build/editor.js:15 861 890 msgid "Add label" 862 891 msgstr "" 863 892 864 #: build/editor.js:11 865 #: src/editor/components/Inspector.js:747 893 #: build/editor.js:15 866 894 msgid "Flow: lines decide the result" 867 895 msgstr "" 868 896 869 #: build/editor.js:11 870 #: src/editor/components/Inspector.js:748 897 #: build/editor.js:15 871 898 msgid "Score: the total score decides the result" 872 899 msgstr "" 873 900 874 #: build/editor.js:11 875 #: src/editor/components/Inspector.js:753 901 #: build/editor.js:15 876 902 msgid "Type of quickscan" 877 903 msgstr "" 878 904 879 #: build/editor.js:11 880 #: src/editor/components/Inspector.js:762 905 #: build/editor.js:15 881 906 msgid "Every answer gets points and every result a score range. Lines are optional: an answer without a line goes to the next question (left to right on the canvas)." 882 907 msgstr "" 883 908 884 #: build/editor.js:11 885 #: src/editor/components/Inspector.js:766 909 #: build/editor.js:15 886 910 msgid "Every answer leads along a line to a next question or a result. Answers without a line go to the default result." 887 911 msgstr "" 888 912 889 #: build/editor.js:11 890 #: src/editor/components/Inspector.js:774 913 #: build/editor.js:15 891 914 msgid "Show progress bar" 892 915 msgstr "" 893 916 894 #: build/editor.js:11 895 #: src/editor/components/Inspector.js:782 917 #: build/editor.js:15 896 918 msgid "Show back button" 897 919 msgstr "" 898 920 899 #: build/editor.js:11 900 #: src/editor/components/Inspector.js:791 921 #: build/editor.js:15 901 922 msgid "Transition between questions" 902 923 msgstr "" 903 924 904 #: build/editor.js:11 905 #: src/editor/components/Inspector.js:812 925 #: build/editor.js:15 906 926 msgid "More transitions and your own styling are available in FunnelFork Pro." 907 927 msgstr "" 908 928 909 #: build/editor.js:11 910 #: src/editor/components/Inspector.js:821 929 #: build/editor.js:15 911 930 msgid "Embed" 912 931 msgstr "" 913 932 914 #: build/editor.js:11 915 #: src/editor/components/Inspector.js:824 933 #: build/editor.js:15 916 934 msgid "Use the \"FunnelFork quickscan\" block, or paste this shortcode:" 917 935 msgstr "" 918 936 919 #: build/editor.js:11 920 #: src/editor/components/Inspector.js:863 937 #: build/editor.js:15 921 938 msgid "Step" 922 939 msgstr "" 923 940 924 941 #. translators: %d: number of results. 925 #: build/editor.js:1 2926 # : src/editor/components/Inspector.js:868942 #: build/editor.js:16 943 #, js-format 927 944 msgid "Results (%d)" 928 945 msgstr "" 929 946 930 947 #. translators: %d: number of labels. 931 #: build/editor.js:1 2932 # : src/editor/components/Inspector.js:875948 #: build/editor.js:16 949 #, js-format 933 950 msgid "Labels (%d)" 934 951 msgstr "" 935 952 936 #: build/editor.js:12 937 #: src/editor/components/Inspector.js:882 953 #: build/editor.js:16 938 954 msgid "Settings" 939 955 msgstr "" 940 956 957 #: build/editor.js:16 958 msgid "Statistics" 959 msgstr "" 960 941 961 #. translators: %d: number of notes. 942 #: build/editor.js:1 3943 # : src/editor/components/Inspector.js:919962 #: build/editor.js:17 963 #, js-format 944 964 msgid "%d note about this flow" 945 965 msgid_plural "%d notes about this flow" … … 947 967 msgstr[1] "" 948 968 949 #: build/editor.js:13 950 #: src/editor/components/FlowEdge.js:52 951 #: src/editor/components/FlowEdge.js:53 969 #: build/editor.js:17 952 970 msgid "Remove line" 953 971 msgstr "" 954 972 955 #: build/editor.js:13 956 #: src/editor/App.js:131 973 #: build/editor.js:17 957 974 msgid "The quickscan could not be loaded." 958 975 msgstr "" 959 976 960 #: build/editor.js:13 961 #: src/editor/App.js:241 977 #: build/editor.js:17 962 978 msgid "That line would create a loop, so it was not added." 963 979 msgstr "" 964 980 965 #: build/editor.js:13 966 #: src/editor/utils.js:55 981 #: build/editor.js:17 967 982 msgid "New result" 968 983 msgstr "" 969 984 970 #: build/editor.js:13 971 #: src/editor/utils.js:82 985 #: build/editor.js:17 972 986 msgid "Option 1" 973 987 msgstr "" 974 988 975 #: build/editor.js:13 976 #: src/editor/utils.js:88 989 #: build/editor.js:17 977 990 msgid "Option 2" 978 991 msgstr "" 979 992 980 #: build/editor.js:13 981 #: src/editor/App.js:477 993 #: build/editor.js:17 982 994 msgid "Quickscan saved and published." 983 995 msgstr "" 984 996 985 #: build/editor.js:13 986 #: src/editor/App.js:481 997 #: build/editor.js:17 987 998 msgid "Quickscan saved." 988 999 msgstr "" 989 1000 990 #: build/editor.js:13 991 #: src/editor/App.js:487 1001 #: build/editor.js:17 992 1002 msgid "Saving failed." 993 1003 msgstr "" 994 1004 995 1005 #. translators: %s: result title. 996 #: build/editor.js:1 4997 # : src/editor/utils.js:3111006 #: build/editor.js:18 1007 #, js-format 998 1008 msgid "\"%s\" has no score range, so it is never shown." 999 1009 msgstr "" 1000 1010 1001 1011 #. translators: %s: result title. 1002 #: build/editor.js:1 51003 # : src/editor/utils.js:3331012 #: build/editor.js:19 1013 #, js-format 1004 1014 msgid "The minimum score of \"%s\" is higher than its maximum." 1005 1015 msgstr "" 1006 1016 1007 1017 #. translators: 1: result title, 2: other result title. 1008 #: build/editor.js: 161009 # : src/editor/utils.js:3491018 #: build/editor.js:20 1019 #, js-format 1010 1020 msgid "The score ranges of \"%1$s\" and \"%2$s\" overlap; \"%1$s\" wins." 1011 1021 msgstr "" 1012 1022 1013 #: build/editor.js:16 1014 #: src/editor/utils.js:372 1023 #: build/editor.js:20 1015 1024 msgid "No answer has points yet. Select a question to give its answers points." 1016 1025 msgstr "" 1017 1026 1018 1027 #. translators: 1: list of scores, 2: result title. 1019 #: build/editor.js: 171020 # : src/editor/utils.js:4001028 #: build/editor.js:21 1029 #, js-format 1021 1030 msgid "Score %1$s matches no range and goes to the default result \"%2$s\"." 1022 1031 msgstr "" 1023 1032 1024 #: build/editor.js:17 1025 #: src/editor/utils.js:467 1033 #: build/editor.js:21 1026 1034 msgid "A question has no text." 1027 1035 msgstr "" 1028 1036 1029 1037 #. translators: %s: question text. 1030 #: build/editor.js: 181031 # : src/editor/utils.js:4761038 #: build/editor.js:22 1039 #, js-format 1032 1040 msgid "\"%s\" needs at least two answers." 1033 1041 msgstr "" 1034 1042 1035 1043 #. translators: %s: question text. 1036 #: build/editor.js: 191037 # : src/editor/utils.js:4881044 #: build/editor.js:23 1045 #, js-format 1038 1046 msgid "\"%s\" has an answer without text." 1039 1047 msgstr "" 1040 1048 1041 1049 #. translators: 1: number of answers, 2: question text, 3: endpoint title. 1042 #: build/editor.js:2 01043 # : src/editor/utils.js:5091050 #: build/editor.js:24 1051 #, js-format 1044 1052 msgid "%1$d answer(s) of \"%2$s\" have no line and go to the default result \"%3$s\"." 1045 1053 msgstr "" 1046 1054 1047 1055 #. translators: %s: question or result title. 1048 #: build/editor.js:2 11049 # : src/editor/utils.js:5261056 #: build/editor.js:25 1057 #, js-format 1050 1058 msgid "\"%s\" cannot be reached from the start." 1051 1059 msgstr "" 1052 1060 1053 #: build/editor.js:21 1054 #: src/editor/App.js:591 1061 #: build/editor.js:25 1055 1062 msgid "All changes saved" 1056 1063 msgstr "" 1057 1064 1058 #: build/editor.js:21 1059 #: src/editor/App.js:593 1065 #: build/editor.js:25 1060 1066 msgid "Saving…" 1061 1067 msgstr "" 1062 1068 1063 #: build/editor.js:21 1064 #: src/editor/App.js:595 1069 #: build/editor.js:25 1065 1070 msgid "Unsaved changes" 1066 1071 msgstr "" 1067 1072 1068 #: build/editor.js:21 1069 #: src/editor/App.js:605 1070 #: src/editor/App.js:609 1073 #: build/editor.js:25 1071 1074 msgid "Back to all quickscans" 1072 1075 msgstr "" 1073 1076 1074 #: build/editor.js:21 1075 #: src/editor/App.js:617 1076 #: src/editor/App.js:618 1077 #: build/editor.js:25 1077 1078 msgid "Quickscan title" 1078 1079 msgstr "" 1079 1080 1080 #: build/editor.js:21 1081 #: src/editor/App.js:626 1081 #: build/editor.js:25 1082 1082 msgid "Published" 1083 1083 msgstr "" 1084 1084 1085 #: build/editor.js:21 1086 #: src/editor/App.js:627 1085 #: build/editor.js:25 1087 1086 msgid "Draft" 1088 1087 msgstr "" 1089 1088 1090 #: build/editor.js:21 1091 #: src/editor/App.js:644 1089 #: build/editor.js:25 1092 1090 msgid "Switch to draft" 1093 1091 msgstr "" 1094 1092 1095 #: build/editor.js:21 1096 #: src/editor/App.js:653 1093 #: build/editor.js:25 1097 1094 msgid "Fix the errors in the flow first." 1098 1095 msgstr "" 1099 1096 1100 #: build/editor.js:21 1101 #: src/editor/App.js:660 1097 #: build/editor.js:25 1102 1098 msgid "Publish" 1103 1099 msgstr "" 1104 1100 1105 #: build/editor.js:21 1106 #: src/editor/App.js:669 1101 #: build/editor.js:25 1107 1102 msgid "Save" 1108 1103 msgstr "" 1109 1104 1110 #: build/editor.js:21 1111 #: src/editor/App.js:720 1112 #: src/editor/App.js:767 1105 #: build/editor.js:25 1113 1106 msgid "Yes/no question" 1114 1107 msgstr "" 1115 1108 1116 #: build/editor.js:21 1117 #: src/editor/App.js:741 1109 #: build/editor.js:25 1118 1110 msgid "Tidy up" 1119 1111 msgstr "" 1120 1112 1121 #: build/editor.js:21 1122 #: src/editor/App.js:745 1113 #: build/editor.js:25 1123 1114 msgid "Drag from an answer (●) to a question or result to draw a line. Drop on an empty spot to create a new step." 1124 1115 msgstr "" 1125 1116 1126 #: build/editor.js:21 1127 #: src/editor/App.js:762 1117 #: build/editor.js:25 1128 1118 msgid "Add here:" 1129 1119 msgstr "" 1130 1120 1131 #: build/editor.js:21 1132 #: src/editor/App.js:796 1121 #: build/editor.js:25 1133 1122 msgid "Cancel" 1134 1123 msgstr "" 1135 1124 1136 #: build/editor.js:21 1137 #: src/editor/App.js:383 1125 #: build/editor.js:25 1138 1126 msgid "A quickscan needs at least one result." 1139 1127 msgstr "" 1140 1128 1141 1129 #: build/block/block.json 1142 #: src/block/block.json1143 1130 msgctxt "block title" 1144 1131 msgid "FunnelFork quickscan" … … 1146 1133 1147 1134 #: build/block/block.json 1148 #: src/block/block.json1149 1135 msgctxt "block description" 1150 1136 msgid "Shows one of your FunnelFork quickscans." … … 1152 1138 1153 1139 #: build/block/block.json 1154 #: src/block/block.json1155 1140 msgctxt "block keyword" 1156 1141 msgid "quickscan" … … 1158 1143 1159 1144 #: build/block/block.json 1160 #: src/block/block.json1161 1145 msgctxt "block keyword" 1162 1146 msgid "quiz" … … 1164 1148 1165 1149 #: build/block/block.json 1166 #: src/block/block.json1167 1150 msgctxt "block keyword" 1168 1151 msgid "survey" … … 1170 1153 1171 1154 #: build/block/block.json 1172 #: src/block/block.json1173 1155 msgctxt "block keyword" 1174 1156 msgid "flow" -
funnelfork/tags/1.1.0/package.json
r3764618 r3792829 1 1 { 2 2 "name": "funnelfork", 3 "version": "1. 0.2",3 "version": "1.1.0", 4 4 "private": true, 5 5 "description": "FunnelFork – Visual Quiz Builder for Product Recommendations & Decision Trees", -
funnelfork/tags/1.1.0/readme.txt
r3781455 r3792829 5 5 Tested up to: 7.1 6 6 Requires PHP: 8.1 7 Stable tag: 1. 0.27 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Drag & drop quiz builder: draw product recommendation quizzes , decision trees and assessments as a flowchart. Works with WooCommerce.11 Drag & drop quiz builder: draw product recommendation quizzes for WooCommerce, decision trees and assessments as a flowchart. With free statistics. 12 12 13 13 == Description == 14 14 15 FunnelFork lets you build a quiz or quickscan like you draw a flowchart. Add questions, connect each answer to the next question or to a result, and FunnelFork guides your visitors through it, one question per page. No code, no form builder logic to puzzle out: you see the whole funnel on one canvas.15 **Build a quiz like you draw a flowchart.** FunnelFork is a visual quiz builder for WordPress: add questions, connect every answer to the next question or to a result, and see your whole funnel on one canvas. No conditional logic rules to puzzle out, no dead ends: every visitor reaches a result. 16 16 17 **What you can build** 17 Use it for a **product recommendation quiz** in your WooCommerce store, a **decision tree**, an **assessment or scorecard**, a **lead generation quiz** or a **product finder**. Your visitors answer one question per screen and end on a personal result, with advice that fits their answers. 18 18 19 * **Product recommendation quiz for WooCommerce** – "Which product fits me?" Send every shopper to the product that matches their answers, in your WooCommerce store or any other shop. 19 Try it right away with the **Live Preview** button on this page: a ready-made coffee quiz in WordPress Playground, nothing to install. More examples are on [funnelfork.com](https://funnelfork.com/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 20 21 ### What you can build 22 23 * **Product recommendation quiz for WooCommerce** – "Which product fits me?" Send every shopper to the product, category or package that matches their answers. 20 24 * **Assessment or scorecard** – "How ready is your business for…?" Give every answer points and show a result per score range. 21 * **Lead magnet** – a quiz or self-test that visitors actually finish, with a lead form before the first questionin FunnelFork Pro.25 * **Lead generation quiz and lead magnet** – a quiz or self-test that visitors actually finish, with a lead form in FunnelFork Pro. 22 26 * **Price indication or cost estimate** – "What would your new website cost?" Lead visitors to the price range or package that fits. 23 27 * **Decision tree or eligibility check** – "Do I qualify?", "Which option do I need?", troubleshooting and support flows. … … 25 29 * **Advice tool or product finder** – collect labels along the way and show personal advice on the result. 26 30 27 **Features** 31 ### Why FunnelFork 28 32 29 * Visual editor: drag questions and results on a canvas and draw the answer logic with lines. Loops are impossible, so every visitor reaches a result. 30 * Two kinds of quickscans: 33 * **You see the logic.** Every answer is a line on the canvas. You see at a glance where each visitor ends up, and the editor warns you about empty questions, steps nobody can reach and overlapping score ranges. 34 * **Flow mode and score mode, both free.** Let the lines decide the result, like a decision tree, or give every answer points and pick the result by score range. 35 * **No limits.** Unlimited quizzes, questions, results and visitors, also in the free version. 36 * **Fast.** The front end is plain JavaScript without dependencies, and it only loads on pages that show a quiz. It works with page caching. 37 * **Privacy-friendly.** The free plugin stores nothing a visitor answers and sends nothing to external services. The statistics are anonymous counters, without cookies or IP addresses. 38 * **Looks like your site.** Quizzes take over the colours, fonts and buttons of your theme. 39 * **Accessible.** Keyboard-friendly, respects "reduced motion", moves the focus to every new step and announces it to screen readers. 40 41 ### Features 42 43 * Visual drag & drop editor: place questions and results on a canvas and draw the answer logic with lines. Loops are impossible, so every visitor reaches a result. 44 * Two kinds of quizzes: 31 45 * **Flow mode** – the lines decide the result, like a decision tree. 32 46 * **Score mode** – every answer has points and every result a score range (for example 0–10, 11–20, 21 or more). Ideal for assessments and "how do you score?" quizzes. 33 * Unlimited quickscans, questions and results.34 47 * Yes/no questions and multiple choice questions, each with an optional explanation. 35 * Multiple results (endpoints), clearly marked, with one default result for answers without a line or a score outside every range.48 * Multiple results, clearly marked, with one default result for answers without a line or a score outside every range. 36 49 * Labels: attach labels (for example products or pieces of advice) to answers and show the collected labels as personal advice on the result. 37 50 * Optionally show the given answers and the score on the result. 38 51 * An optional start screen, then one question per page that slides smoothly into view, with a back button and a progress bar. 39 * Inherits the colours, fonts and buttons of your theme. 40 * Accessible: respects "reduced motion", moves the focus to every new step and announces it to screen readers. 41 * Block and shortcode: `[funnelfork id="123"]`, so it works in every page builder. 42 * Works with WooCommerce: link every result to a product or category. With FunnelFork Pro you show the WooCommerce product itself on the result, with its price and Add to cart button. 52 * **Statistics:** views, starts, completions and the completion rate of every quiz over the last 30 days, in the overview, in a dashboard widget and in the editor, with a chart per day. Bots and logged-in editors are not counted. 53 * Block and shortcode `[funnelfork id="123"]`, so it works in the block editor and in every page builder (Elementor, Bricks, Divi, Beaver Builder and others). 54 * Works with WooCommerce: link every result to a product or category. 43 55 * Translation-ready. Translations are delivered through [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/funnelfork/). 44 * For developers: JavaScript events (`funnelfork:step`, `funnelfork:answer`, `funnelfork:complete`) for analytics, PHP and JS hooks, and `--funnelfork-*` CSS custom properties.56 * For developers: JavaScript events (`funnelfork:step`, `funnelfork:answer`, `funnelfork:complete`) for your own analytics, PHP and JS hooks, and `--funnelfork-*` CSS custom properties. 45 57 46 **FunnelFork Pro** turns your quickscans into a lead machine: a lead form before the scan, saving responses with CSV export, an email or webhook (Zapier, Make, n8n) for every lead and result, a Gravity Forms form or any shortcode on a result (such as a WooCommerce product with its cart button), images and icons for answers, more transitions and your own styling. [Compare Free and Pro](https://funnelfork.com/pricing/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 58 ### FunnelFork Pro 59 60 Want to know **where visitors leave**, turn them into leads or sell more? [FunnelFork Pro](https://funnelfork.com/pricing/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork) is an add-on with a yearly license and no limit on responses: 61 62 * **WooCommerce product picker** – show the right products on every result as cards with price and an Add to cart button, each with a short "why it fits". 63 * **Funnel statistics** – drop-off per question right on the canvas, how often every answer, result and label is chosen, leads, product clicks and add to cart, for any period and compared with the period before, with CSV export. 64 * **Lead form** before the first question or just before the result, protected against spam bots, and every response saved with CSV export. 65 * **Result by email** to the visitor, with the advice, the score and the recommended products. 66 * **Notifications** by email and **webhook** (Zapier, Make, n8n or your CRM) for every lead and result. 67 * **Redirect** from a result to any page, optionally with the result in the URL. 68 * **GA4, Google Tag Manager and Meta Pixel events** with one switch. 69 * A Gravity Forms form or any shortcode on a result, images and icons for answers, more transitions and your own styling. 70 71 Every Pro license comes with a 30-day money-back guarantee. [Compare Free and Pro](https://funnelfork.com/pricing/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 47 72 48 73 == Installation == 49 74 50 1. Upload the plugin and activate it. 51 2. Go to FunnelFork → Add quickscan. 52 3. Build your flow, press Publish and place the "FunnelFork quickscan" block or the shortcode on a page. 75 1. Go to Plugins → Add New, search for "FunnelFork" and click Install and Activate. Or upload the plugin zip under Plugins → Add New → Upload Plugin. 76 2. Go to FunnelFork → Add quickscan and give your quiz a title. 77 3. Add questions and results, draw a line from every answer to the next step, and press Publish. 78 4. Place the "FunnelFork quickscan" block or the shortcode `[funnelfork id="123"]` on a page. 79 5. Follow the views and completions in the Statistics tab of the editor. 53 80 54 81 == Frequently Asked Questions == 55 82 83 = How do I create a product recommendation quiz in WordPress? = 84 85 Make a result for every product, category or package, add the questions that tell them apart, and draw each answer to the result it points to. With labels you can also collect several products or tips along the way and show them together on the result. Place the quiz with the block or the shortcode, and you are done. 86 87 = Does it work with WooCommerce? = 88 89 Yes. Link every result to the WooCommerce product or category that fits. With FunnelFork Pro you pick the products per result (or a whole category), and shoppers see them as cards with the price and an Add to cart button, right in the quiz. See the [WooCommerce product quiz guide](https://funnelfork.com/blog/woocommerce-product-quiz/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 90 91 = What is the difference between flow mode and score mode? = 92 93 In flow mode the lines decide where a visitor ends up, like a decision tree. In score mode every answer gives points and the total score picks the result; lines are optional and only set the order of the questions. 94 56 95 = What happens with an answer that has no line? = 57 96 58 It leads to the default result. Every qui ckscan has exactly one default result, marked in the editor.97 It leads to the default result. Every quiz has exactly one default result, marked in the editor. In score mode an answer without a line goes to the next question. 59 98 60 99 = Can a flow loop back to an earlier question? = … … 62 101 No. Loops are prevented so that every visitor always reaches a result. 63 102 64 = What is the difference between flow mode and score mode? =103 = Are there limits on quizzes, questions or responses? = 65 104 66 In flow mode the lines decide where a visitor ends up. In score mode every answer gives points and the total score picks the result; lines are optional and only set the order of the questions.105 No. You can make as many quizzes, questions and results as you like, and there is no limit on visitors or responses, in the free version and in Pro. 67 106 68 = Can I build a product recommendation quiz? =107 = Can I see how my quiz performs? = 69 108 70 Yes. Make a result per product or package and draw the answers that fit it to that result. With labels you can also collect several products or tips along the way and show them together on the result. 71 72 = Does it work with WooCommerce? = 73 74 Yes. Build a product quiz and link every result to the WooCommerce product or category that fits. With FunnelFork Pro you can place any shortcode under a result, for example `[product_page id="123"]` or `[add_to_cart id="123"]`, so the shopper sees the product with its price and cart button right on the result. See the [WooCommerce product quiz guide](https://funnelfork.com/blog/woocommerce-product-quiz/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 109 Yes. The free plugin counts views, starts and completions per quiz and shows the completion rate for the last 30 days. FunnelFork Pro adds funnel statistics: at which question visitors leave, which answers and results they get, leads, product clicks and add to cart, for any period. 75 110 76 111 = Can I collect email addresses or leads? = 77 112 78 The free plugin does not collect personal data. FunnelFork Pro adds a lead form before the first question (name, email, phone), saves every response with CSV export, and sends an email or a webhook (Zapier, Make, n8n) for every lead and result. You can also show a Gravity Forms form on a result. 113 The free plugin does not collect personal data. FunnelFork Pro adds a lead form (name, email, phone, optional consent) before the first question or just before the result, saves every response with CSV export, emails the result to the visitor, and sends an email or a webhook (Zapier, Make, n8n) for every lead and result. 114 115 = Can I send visitors to a page or product after the quiz? = 116 117 In the free plugin you link to a page or product in the text of a result. FunnelFork Pro can redirect visitors from a result straight to any URL, optionally with the result, score and labels in the URL. 118 119 = Does it work with Google Analytics, Tag Manager or the Meta Pixel? = 120 121 Yes. Developers can use the JavaScript events of the free plugin. FunnelFork Pro sends ready-made events (quiz_start, question_view, quiz_complete, generate_lead and add_to_cart) to GA4, Google Tag Manager and the Meta Pixel with one switch, without personal data. 79 122 80 123 = Is it a survey or a form builder? = … … 82 125 FunnelFork is made for guided flows: every visitor answers one question at a time and ends on a personal result. For long surveys with many open questions a form plugin is a better fit; for quizzes, assessments, product finders and decision trees FunnelFork is. 83 126 84 = Does it work with my page builder? =127 = Does it work with my theme and page builder? = 85 128 86 Yes. Use the "FunnelFork quickscan" block in the block editor, or the shortcode `[funnelfork id="123"]` in any page builder (Elementor, Bricks, Divi and so on). 129 Yes. The quiz takes over the colours, fonts and buttons of your theme. Use the "FunnelFork quickscan" block in the block editor, or the shortcode `[funnelfork id="123"]` in any page builder (Elementor, Bricks, Divi and so on). 130 131 = Does it slow down my site? = 132 133 No. The front-end script has no dependencies and only loads on pages that show a quiz, and it works with page caching. 87 134 88 135 = Does FunnelFork store personal data? = 89 136 90 The free plugin does not store or send anything a visitor answers. Saving responses and lead forms are part of FunnelFork Pro, which works with the WordPress privacy export and erase tools. 137 The free plugin does not store or send anything a visitor answers. The statistics are anonymous counters per quiz per day (views, starts, completions), without cookies or IP addresses. Saving responses and lead forms are part of FunnelFork Pro, which works with the WordPress privacy export and erase tools and never stores IP addresses. 138 139 = Is FunnelFork translated? = 140 141 The plugin is translation-ready, and translations are delivered through [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/funnelfork/). Your own questions and results are in the language you write them in. 91 142 92 143 = Can developers react to answers? = 93 144 94 Yes. The `.funnelfork` element fires the `funnelfork:step`, `funnelfork:answer` and `funnelfork:complete` events, for example for Google Analytics or Google Tag Manager. The complete event contains the answers, the collected labels, the score and the endpoint.145 Yes. The `.funnelfork` element fires the `funnelfork:step`, `funnelfork:answer` and `funnelfork:complete` events, for example for your own tracking. The complete event contains the answers, the collected labels, the score and the result. 95 146 96 147 = Where is the source code of the JavaScript? = … … 100 151 == External services == 101 152 102 FunnelFork uses the [Freemius](https://freemius.com/) SDK for the optional opt-in and to offer FunnelFork Pro. Only when you click "Allow & Continue" are the admin's name and email, the site URL and the WordPress, PHP and plugin versions sent to Freemius; "Skip" sends nothing. The Add-ons screen loads FunnelFork Pro details from Freemius, and Pro purchases are handled by Freemius ([Terms](https://freemius.com/terms/), [Privacy Policy](https://freemius.com/privacy/)). Visitor answers a re never sent to an external service.153 FunnelFork uses the [Freemius](https://freemius.com/) SDK for the optional opt-in and to offer FunnelFork Pro. Only when you click "Allow & Continue" are the admin's name and email, the site URL and the WordPress, PHP and plugin versions sent to Freemius; "Skip" sends nothing. The Add-ons screen loads FunnelFork Pro details from Freemius, and Pro purchases are handled by Freemius ([Terms](https://freemius.com/terms/), [Privacy Policy](https://freemius.com/privacy/)). Visitor answers and statistics are never sent to an external service; they stay on your own site. 103 154 104 155 == Screenshots == … … 111 162 6. Score mode: every answer gets points and every result a score range. 112 163 7. The result with the score and personal advice from the labels collected along the way. 164 8. Free statistics: views, starts, completions and the completion rate of every quiz, with a chart per day. 165 9. Funnel statistics: see at which question visitors leave, right on the canvas (FunnelFork Pro). 166 10. WooCommerce product picker: recommended products with price and an Add to cart button on the result (FunnelFork Pro). 167 11. A lead form after the last question, just before the result (FunnelFork Pro). 168 12. The result by email to the visitor, with the recommended products (FunnelFork Pro). 113 169 114 170 == Changelog == 171 172 = 1.1.0 = 173 * New: statistics. Views, starts, completions and the completion rate per quiz for the last 30 days, in the overview, in a dashboard widget and in the new Statistics tab of the editor. Anonymous counters per day; bots and logged-in editors are not counted. 174 * New for developers: the `funnelfork:beforecomplete` event to hold the quiz before a result, and editor filters for the Statistics tab and the canvas. 115 175 116 176 = 1.0.2 = … … 118 178 * Updated short description and tags. 119 179 * Live Preview: try FunnelFork with a ready-made coffee quiz in WordPress Playground, straight from this page. 180 * A friendly request to review FunnelFork, shown once your first quickscan is published. 120 181 121 182 = 1.0.1 = … … 124 185 = 1.0.0 = 125 186 * First release. 187 188 == Upgrade Notice == 189 190 = 1.1.0 = 191 Free statistics: see views, starts and completions of every quiz. Update FunnelFork Pro to 1.2 as well for the funnel statistics and the lead form before the result. -
funnelfork/tags/1.1.0/src/editor/App.js
r3763298 r3792829 705 705 minZoom={ 0.15 } 706 706 > 707 <Background gap={ 24 } size={ 1.5 } color="#c6d4cf" /> 707 <Background 708 gap={ 24 } 709 size={ 1.5 } 710 color="#c6d4cf" 711 /> 708 712 <Controls showInteractive={ false } /> 709 713 <MiniMap -
funnelfork/tags/1.1.0/src/editor/components/FlowEdge.js
r3763298 r3792829 3 3 */ 4 4 import { __ } from '@wordpress/i18n'; 5 import { applyFilters } from '@wordpress/hooks'; 5 6 import { 6 7 BaseEdge, … … 20 21 markerEnd, 21 22 selected, 23 source, 24 sourceHandleId, 25 target, 22 26 } ) { 23 27 const { deleteElements } = useReactFlow(); … … 31 35 } ); 32 36 37 // Room for add-ons on the line, for example statistics. 38 const extra = applyFilters( 'funnelfork.editor.edgeLabel', null, { 39 id, 40 source, 41 sourceHandle: sourceHandleId, 42 target, 43 } ); 44 33 45 return ( 34 46 <> 47 { extra && ! selected && ( 48 <EdgeLabelRenderer> 49 <div 50 className="fs-edge-label nodrag nopan" 51 style={ { 52 transform: `translate(-50%, -50%) translate(${ labelX }px, ${ labelY }px)`, 53 } } 54 > 55 { extra } 56 </div> 57 </EdgeLabelRenderer> 58 ) } 35 59 <BaseEdge 36 60 id={ id } -
funnelfork/tags/1.1.0/src/editor/components/Inspector.js
r3763298 r3792829 4 4 import { __, _n, sprintf } from '@wordpress/i18n'; 5 5 import { applyFilters } from '@wordpress/hooks'; 6 import StatsTab from './Stats'; 6 7 import { 7 8 Button, … … 881 882 }, 882 883 { name: 'settings', title: __( 'Settings', 'funnelfork' ) }, 884 { name: 'stats', title: __( 'Statistics', 'funnelfork' ) }, 883 885 ]; 884 886 … … 902 904 { current.name === 'labels' && ( 903 905 <LabelsTab { ...props } /> 906 ) } 907 { current.name === 'stats' && ( 908 <StatsTab { ...props } /> 904 909 ) } 905 910 { current.name === 'settings' && ( -
funnelfork/tags/1.1.0/src/editor/components/nodes.js
r3763298 r3792829 4 4 import { createContext, useContext } from '@wordpress/element'; 5 5 import { __, _n, sprintf } from '@wordpress/i18n'; 6 import { applyFilters } from '@wordpress/hooks'; 6 7 import { Handle, Position } from '@xyflow/react'; 8 9 /** 10 * Room for add-ons on a node (`funnelfork.editor.nodeBadge`, props 11 * { id, type }) or an answer (`funnelfork.editor.answerBadge`, props 12 * { nodeId, answerId }), for example statistics. 13 * 14 * @param {Object} props 15 * @param {string} props.filter Filter name. 16 * @param {Object} props.args Filter props. 17 */ 18 function AddonSlot( { filter, args } ) { 19 return applyFilters( filter, null, args ); 20 } 7 21 8 22 import { config, formatRange } from '../utils'; … … 118 132 ) } 119 133 </div> 134 <AddonSlot 135 filter="funnelfork.editor.nodeBadge" 136 args={ { id, type: 'question' } } 137 /> 120 138 <ul className="fs-answers"> 121 139 { data.answers.map( ( answer ) => { … … 129 147 > 130 148 <LabelDots ids={ answer.labels } /> 149 <AddonSlot 150 filter="funnelfork.editor.answerBadge" 151 args={ { nodeId: id, answerId: answer.id } } 152 /> 131 153 <span className="fs-answer__text"> 132 154 { answer.text || ( … … 241 263 ) } 242 264 </div> 265 <AddonSlot 266 filter="funnelfork.editor.nodeBadge" 267 args={ { id, type: 'end' } } 268 /> 243 269 <div className="fs-node__meta"> 244 270 { data.cta?.type && -
funnelfork/tags/1.1.0/src/editor/editor.scss
r3763298 r3792829 699 699 700 700 .fs-issues-wrap { 701 flex-shrink: 0; // Never squeezed by the tab content (it then showed a tiny scrollbar). 701 702 border-top: 1px solid var(--ff-wire); 702 703 padding: 10px 16px; … … 780 781 } 781 782 } 783 784 /* Statistics tab (components/Stats.js). */ 785 .fs-edge-label { 786 position: absolute; 787 pointer-events: all; 788 } 789 790 .fs-stats__tiles { 791 display: grid; 792 grid-template-columns: repeat(2, 1fr); 793 gap: 8px; 794 } 795 796 .fs-stats__tile { 797 display: flex; 798 flex-direction: column; 799 padding: 10px 12px; 800 border-radius: var(--ff-radius-s); 801 background: var(--ff-board-sunken); 802 } 803 804 .fs-stats__value { 805 font-family: var(--ff-font-display); 806 font-size: 22px; 807 font-weight: 600; 808 line-height: 1.2; 809 color: var(--ff-ink); 810 } 811 812 .fs-stats__label { 813 font-family: var(--ff-font-mono); 814 font-size: 11px; 815 letter-spacing: 0.06em; 816 text-transform: uppercase; 817 color: var(--ff-ink-muted); 818 } 819 820 .fs-stats__chart { 821 margin: 0; 822 823 svg { 824 display: block; 825 width: 100%; 826 height: auto; 827 } 828 } 829 830 .fs-stats__bar.is-views { 831 fill: var(--ff-teal-soft); 832 } 833 834 .fs-stats__bar.is-completes { 835 fill: var(--ff-teal); 836 } 837 838 .fs-stats__legend { 839 display: flex; 840 gap: 12px; 841 margin-top: 4px; 842 font-size: 12px; 843 color: var(--ff-ink-muted); 844 845 span::before { 846 content: ""; 847 display: inline-block; 848 width: 10px; 849 height: 10px; 850 margin-right: 4px; 851 border-radius: 2px; 852 vertical-align: -1px; 853 } 854 855 .is-views::before { 856 background: var(--ff-teal-soft); 857 border: 1px solid var(--ff-wire); 858 } 859 860 .is-completes::before { 861 background: var(--ff-teal); 862 } 863 } 864 865 .fs-stats .components-notice { 866 margin: 0; 867 } 868 869 .fs-stats .fs-inspector__heading { 870 margin: 0; 871 } 872 873 .fs-stats-pro { 874 margin: 0; 875 padding: 14px; 876 border: 1px solid var(--ff-amber); 877 border-radius: var(--ff-radius-m); 878 background: var(--ff-amber-soft); 879 } 880 881 .fs-stats-pro__title { 882 display: flex; 883 gap: 6px; 884 align-items: center; 885 margin: 0 0 6px; 886 font-family: var(--ff-font-display); 887 font-size: 15px; 888 color: var(--ff-ink); 889 } 890 891 .fs-stats-pro__lock { 892 width: 16px; 893 height: 16px; 894 fill: var(--ff-amber-ink); 895 } 896 897 .fs-stats-pro__lead { 898 margin: 0 0 10px; 899 color: var(--ff-ink); 900 } 901 902 .fs-stats-pro__subtitle { 903 margin: 12px 0 6px; 904 font-size: 13px; 905 } 906 907 .fs-stats-pro__list { 908 margin: 0 0 8px; 909 padding: 0; 910 list-style: none; 911 912 li { 913 display: grid; 914 grid-template-columns: minmax(0, 1fr) 70px 34px; 915 gap: 8px; 916 align-items: center; 917 margin-bottom: 6px; 918 font-size: 12px; 919 } 920 } 921 922 .fs-stats-pro__name { 923 overflow: hidden; 924 text-overflow: ellipsis; 925 white-space: nowrap; 926 } 927 928 .fs-stats-pro__bar { 929 height: 8px; 930 overflow: hidden; 931 border-radius: 4px; 932 background: #fff; 933 934 span { 935 display: block; 936 height: 100%; 937 background: var(--ff-amber); 938 filter: blur(1px); 939 } 940 } 941 942 .fs-stats-pro__num { 943 color: var(--ff-amber-ink); 944 filter: blur(3px); 945 user-select: none; 946 } 947 948 .fs-stats-pro__features { 949 margin: 10px 0 12px 1.2em; 950 padding: 0; 951 list-style: disc; 952 font-size: 12px; 953 } -
funnelfork/tags/1.1.0/src/runner/index.js
r3763298 r3792829 12 12 * funnelfork:beforestart: call event.preventDefault(), show an own step with 13 13 * detail.scan.show( element ) and continue with detail.resume(); 14 * - hold the scan the same way before a result with funnelfork:beforecomplete; 14 15 * - add transitions with FunnelFork.registerTransition( name, fn ). 15 16 * … … 113 114 114 115 this.build(); 116 this.started = false; 117 this.watchView(); 115 118 this.showFirst( 'none' ); 119 } 120 121 /* ---- Statistics (anonymous counters, see includes/class-stats.php) ---- */ 122 123 track( event ) { 124 const url = this.data.track; 125 if ( ! url ) { 126 return; 127 } 128 if ( event === 'view' ) { 129 if ( this.viewed ) { 130 return; 131 } 132 this.viewed = true; 133 } else if ( ! this.viewed ) { 134 this.track( 'view' ); // A start without a counted view (no IntersectionObserver callback yet). 135 } 136 const body = JSON.stringify( { scanId: this.data.id, event } ); 137 try { 138 if ( 139 navigator.sendBeacon?.( 140 url, 141 new Blob( [ body ], { type: 'application/json' } ) 142 ) 143 ) { 144 return; 145 } 146 } catch {} 147 window 148 .fetch( url, { 149 method: 'POST', 150 keepalive: true, 151 headers: { 'Content-Type': 'application/json' }, 152 body, 153 } ) 154 .catch( () => {} ); 155 } 156 157 /** Counts one view per page load, once the scan is (half) in view. */ 158 watchView() { 159 if ( ! this.data.track ) { 160 return; 161 } 162 if ( ! ( 'IntersectionObserver' in window ) ) { 163 this.track( 'view' ); 164 return; 165 } 166 const observer = new window.IntersectionObserver( 167 ( entries ) => { 168 if ( entries.some( ( e ) => e.isIntersecting ) ) { 169 observer.disconnect(); 170 this.track( 'view' ); 171 } 172 }, 173 { threshold: 0.5 } 174 ); 175 observer.observe( this.root ); 116 176 } 117 177 … … 336 396 this.history.push( { nodeId, answerId } ); 337 397 this.emit( 'answer', { questionId: nodeId, answerId } ); 338 this.go( this.step( nodeId, answerId ), 'forward' ); 398 this.goForward( this.step( nodeId, answerId ) ); 399 } 400 401 /** 402 * Goes to the next step. Before a result, an add-on can hold the scan on 403 * funnelfork:beforecomplete (for example for a form); it then shows an own 404 * step with scan.show() and continues with detail.resume(). 405 * @param {string} target Next node ID. 406 */ 407 goForward( target ) { 408 if ( this.data.nodes[ target ]?.type !== 'end' ) { 409 this.go( target, 'forward' ); 410 return; 411 } 412 let resumed = false; 413 const resume = () => { 414 if ( ! resumed ) { 415 resumed = true; 416 this.go( target, 'forward' ); 417 } 418 }; 419 const event = this.emit( 420 'beforecomplete', 421 { 422 endpointId: target, 423 answers: this.answers(), 424 labels: this.collectedLabels(), 425 mode: this.mode, 426 score: this.score(), 427 resume, 428 }, 429 true 430 ); 431 if ( ! event.defaultPrevented ) { 432 resume(); 433 } 339 434 } 340 435 … … 413 508 this.emit( 'step', { nodeId, type: node.type } ); 414 509 510 if ( node.type === 'question' && ! this.started ) { 511 this.started = true; 512 this.track( 'start' ); 513 } 415 514 if ( node.type === 'end' ) { 515 this.track( 'complete' ); 516 this.started = false; // "Start over" counts as a new start. 416 517 this.emit( 'complete', { 417 518 endpointId: nodeId, -
funnelfork/trunk/build/editor-rtl.css
r3763298 r3792829 1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-right:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-left:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-left:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-right:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);right:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;left:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-right:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 12px 8px 18px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:right}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-right:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-left:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:right;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0; max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:right}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-right:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-left:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-left:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-right:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);right:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;left:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-right:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 12px 8px 18px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:right}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-right:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-left:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:right;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0;flex-shrink:0;max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:right}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}.fs-edge-label{pointer-events:all;position:absolute}.fs-stats__tiles{display:grid;gap:8px;grid-template-columns:repeat(2,1fr)}.fs-stats__tile{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:flex;flex-direction:column;padding:10px 12px}.fs-stats__value{color:var(--ff-ink);font-family:var(--ff-font-display);font-size:22px;font-weight:600;line-height:1.2}.fs-stats__label{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:11px;letter-spacing:.06em;text-transform:uppercase}.fs-stats__chart{margin:0}.fs-stats__chart svg{display:block;height:auto;width:100%}.fs-stats__bar.is-views{fill:var(--ff-teal-soft)}.fs-stats__bar.is-completes{fill:var(--ff-teal)}.fs-stats__legend{color:var(--ff-ink-muted);display:flex;font-size:12px;gap:12px;margin-top:4px}.fs-stats__legend span:before{border-radius:2px;content:"";display:inline-block;height:10px;margin-left:4px;vertical-align:-1px;width:10px}.fs-stats__legend .is-views:before{background:var(--ff-teal-soft);border:1px solid var(--ff-wire)}.fs-stats__legend .is-completes:before{background:var(--ff-teal)}.fs-stats .components-notice,.fs-stats .fs-inspector__heading{margin:0}.fs-stats-pro{background:var(--ff-amber-soft);border:1px solid var(--ff-amber);border-radius:var(--ff-radius-m);margin:0;padding:14px}.fs-stats-pro__title{align-items:center;color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:15px;gap:6px;margin:0 0 6px}.fs-stats-pro__lock{fill:var(--ff-amber-ink);height:16px;width:16px}.fs-stats-pro__lead{color:var(--ff-ink);margin:0 0 10px}.fs-stats-pro__subtitle{font-size:13px;margin:12px 0 6px}.fs-stats-pro__list{list-style:none;margin:0 0 8px;padding:0}.fs-stats-pro__list li{align-items:center;display:grid;font-size:12px;gap:8px;grid-template-columns:minmax(0,1fr) 70px 34px;margin-bottom:6px}.fs-stats-pro__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fs-stats-pro__bar{background:#fff;border-radius:4px;height:8px;overflow:hidden}.fs-stats-pro__bar span{background:var(--ff-amber);display:block;filter:blur(1px);height:100%}.fs-stats-pro__num{color:var(--ff-amber-ink);filter:blur(3px);-webkit-user-select:none;user-select:none}.fs-stats-pro__features{font-size:12px;list-style:disc;margin:10px 1.2em 12px 0;padding:0} -
funnelfork/trunk/build/editor.asset.php
r3763298 r3792829 10 10 'wp-i18n' 11 11 ), 12 'version' => ' 01bed0e067fc1e200d25'12 'version' => '7379d5a77a3faf3e040a' 13 13 ); -
funnelfork/trunk/build/editor.css
r3763298 r3792829 1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-left:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-right:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-right:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-left:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);left:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(-50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;right:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-left:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 18px 8px 12px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:left}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-left:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-right:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:left;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0; max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:left}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}1 body.funnelfork-editor-screen{--ff-board:#f2f6f4;--ff-board-raised:#fff;--ff-board-sunken:#e7eeeb;--ff-wire:#c6d4cf;--ff-wire-strong:#748c85;--ff-ink:#10201f;--ff-ink-muted:#4d605c;--ff-teal:#0d7a69;--ff-teal-soft:#e3f4f0;--ff-on-teal:#fff;--ff-teal-bright:#5fd3be;--ff-amber:#f2a93b;--ff-amber-soft:#fcebcf;--ff-amber-ink:#8a5300;--ff-on-amber:#10201f;--ff-circuit:#10201f;--ff-on-circuit:#f2f6f4;--ff-on-circuit-muted:#a9bdb8;--ff-danger:#b42318;--ff-danger-soft:#fde7e4;--ff-radius-s:6px;--ff-radius-m:10px;--ff-radius-l:16px;--ff-shadow-node:0 1px 2px #10201f14,0 4px 12px #10201f12;--ff-shadow-pop:0 2px 4px #10201f14,0 12px 32px #10201f1f;--ff-font-display:"Bricolage Grotesque",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-body:"IBM Plex Sans",-apple-system,"Segoe UI",system-ui,sans-serif;--ff-font-mono:"IBM Plex Mono",ui-monospace,Consolas,monospace;--wp-admin-theme-color:#0d7a69;--wp-admin-theme-color--rgb:13,122,105;--wp-admin-theme-color-darker-10:#0a6658;--wp-admin-theme-color-darker-10--rgb:10,102,88;--wp-admin-theme-color-darker-20:#08544a;--wp-admin-theme-color-darker-20--rgb:8,84,74}body.funnelfork-editor-screen #wpbody-content{padding-bottom:0}body.funnelfork-editor-screen #wpbody-content>.notice,body.funnelfork-editor-screen #wpbody-content>.update-nag,body.funnelfork-editor-screen #wpfooter{display:none}body.funnelfork-editor-screen #wpbody-content>.fs-notice{display:none!important}body.funnelfork-editor-screen #wpcontent{padding-left:0}.funnelfork-editor-root{height:calc(100vh - 32px)}@media(max-width:782px){.funnelfork-editor-root{height:calc(100vh - 46px)}}.funnelfork-editor-loading{padding:24px}.fs-editor{background:var(--ff-board-raised);color:var(--ff-ink);display:flex;flex-direction:column;font-family:var(--ff-font-body);height:100%;position:relative}.fs-editor--error,.fs-editor--loading{align-items:center;justify-content:center}.fs-topbar{align-items:center;background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);display:flex;flex-shrink:0;gap:12px;height:60px;padding:0 16px}.fs-topbar__back{border-radius:var(--ff-radius-s);color:var(--ff-ink);display:grid;font-size:20px;height:36px;place-items:center;text-decoration:none;width:36px}.fs-topbar__back:hover{background:var(--ff-board);color:var(--ff-ink)}.fs-topbar__back:focus-visible{box-shadow:none;outline:2px solid var(--ff-teal);outline-offset:2px}.fs-topbar__logo{align-items:center;border-right:1px solid var(--ff-wire);color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:18px;font-weight:800;gap:6px;letter-spacing:-.03em;line-height:1;padding-right:12px;white-space:nowrap}.fs-topbar__logo svg{flex:none;height:26px;width:26px}.fs-topbar__logo b{color:var(--ff-teal);font-weight:inherit}@media(max-width:960px){.fs-topbar__logo span{display:none}}.fs-topbar__title{border:1px solid transparent!important;border-radius:var(--ff-radius-s)!important;box-shadow:none!important;color:var(--ff-ink);flex:1;font-family:var(--ff-font-display);font-size:17px;font-weight:700;letter-spacing:-.01em;max-width:420px;min-width:120px;padding:4px 8px}.fs-topbar__title:hover{border-color:var(--ff-wire)!important}.fs-topbar__title:focus{border-color:var(--ff-wire-strong)!important}.fs-topbar__state{color:var(--ff-ink-muted);font-size:12px;white-space:nowrap}.fs-topbar__actions{display:flex;gap:8px;margin-left:auto}.fs-editor .components-button{border-radius:var(--ff-radius-s);font-family:var(--ff-font-body);font-weight:600}.fs-status{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:3px 8px;text-transform:uppercase}.fs-status.is-publish{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-editor-notice{border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);left:50%;min-width:320px;overflow:hidden;position:absolute;top:68px;transform:translateX(-50%);z-index:20}.fs-editor-notice .components-notice{margin:0}.fs-body{display:flex;flex:1;min-height:0}.fs-canvas{background:var(--ff-board);flex:1;position:relative}.fs-canvas .react-flow{--xy-background-color:var(--ff-board);--xy-background-pattern-dots-color-default:var(--ff-wire);--xy-minimap-background-color-default:var(--ff-board-raised);--xy-minimap-mask-background-color-default:rgba(16,32,31,.08);--xy-controls-button-background-color-default:var(--ff-board-raised);--xy-controls-button-background-color-hover-default:var(--ff-board);--xy-controls-button-color-default:var(--ff-ink);--xy-controls-button-border-color-default:var(--ff-wire);--xy-edge-stroke-default:var(--ff-wire-strong);--xy-edge-stroke-selected-default:var(--ff-teal);--xy-connectionline-stroke-default:var(--ff-teal);font-family:var(--ff-font-body)}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap{overflow:hidden}.fs-canvas .react-flow__controls,.fs-canvas .react-flow__minimap,.fs-toolbar{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node)}.fs-toolbar{display:flex;flex-wrap:wrap;gap:6px;padding:6px}.fs-toolbar,.fs-toolbar .components-button.is-secondary{background:var(--ff-board-raised)}.fs-hint{background:hsla(0,0%,100%,.9);border:1px solid var(--ff-wire);border-radius:9999px;color:var(--ff-ink-muted);font-size:12px;padding:4px 12px}.fs-node{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-node);color:var(--ff-ink);font-size:13px;position:relative;transition:border-color .15s ease,box-shadow .15s ease;width:260px}.fs-node.is-selected{border-color:var(--ff-teal);box-shadow:0 0 0 1px var(--ff-teal),var(--ff-shadow-node)}.fs-node__kind{align-items:center;color:var(--ff-ink-muted);display:flex;font-family:var(--ff-font-mono);font-size:10px;font-weight:500;gap:6px;letter-spacing:.08em;padding:12px 12px 0;text-transform:uppercase}.fs-node__title{font-family:var(--ff-font-body);font-size:14px;font-weight:600;line-height:1.35;padding:4px 12px 12px;word-break:break-word}.fs-node__title em{color:var(--ff-ink-muted);font-weight:400}.fs-node__meta{color:var(--ff-ink-muted);font-size:11px;padding:0 12px 12px}.fs-node__issue{border:2px solid var(--ff-board-raised);border-radius:50%;box-sizing:content-box;color:#fff;display:grid;font-size:12px;font-weight:700;height:18px;place-items:center;position:absolute;right:-9px;top:-9px;width:18px}.fs-node__issue.is-error{background:var(--ff-danger)}.fs-node__issue.is-warning{background:var(--ff-amber);color:var(--ff-on-amber)}.fs-node--start{background:var(--ff-circuit);border-color:var(--ff-circuit);color:var(--ff-on-circuit);width:200px}.fs-node--start .fs-node__kind{color:var(--ff-on-circuit-muted)}.fs-node--start.is-selected{box-shadow:0 0 0 2px var(--ff-board),0 0 0 4px var(--ff-teal)}.fs-node--end{border-color:var(--ff-amber)}.fs-node--end .fs-node__kind{color:var(--ff-amber-ink);font-weight:600}.fs-node--end.is-selected{border-color:var(--ff-teal)}.fs-badge{background:var(--ff-teal-soft);border-radius:var(--ff-radius-s);color:var(--ff-teal);font-size:9px;margin-left:auto;padding:1px 6px;text-transform:uppercase}.fs-answers{border-top:1px solid var(--ff-wire);list-style:none;margin:0;padding:0}.fs-answer{align-items:center;border-bottom:1px solid var(--ff-board-sunken);display:flex;gap:6px;margin:0;padding:8px 18px 8px 12px;position:relative}.fs-answer:last-child{border-bottom:0}.fs-answer__text{flex:1}.fs-answer__fallback,.fs-answer__text em{color:var(--ff-ink-muted)}.fs-answer__fallback{font-size:11px}.fs-answer.is-open .fs-handle{background:var(--ff-board-raised)}.fs-dots{display:inline-flex;gap:2px}.fs-dot{border-radius:50%;box-shadow:0 0 0 1px rgba(16,32,31,.15);display:inline-block;height:9px;width:9px}.react-flow .fs-handle{background:var(--ff-amber);border:2px solid var(--ff-board-raised);box-shadow:0 0 0 1px var(--ff-wire-strong);height:12px;width:12px}.react-flow .fs-handle--target{background:var(--ff-board-raised);border:2px solid var(--ff-wire-strong);border-radius:4px;box-shadow:none;height:24px;width:10px}.react-flow .fs-node--start .fs-handle{border-color:var(--ff-circuit);box-shadow:0 0 0 1px var(--ff-on-circuit-muted)}.react-flow__edge-path{stroke:var(--ff-wire-strong);stroke-width:2}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:hover .react-flow__edge-path{stroke:var(--ff-teal);stroke-width:2.5}.fs-edge-delete{background:var(--ff-danger);border:2px solid var(--ff-board-raised);border-radius:50%;box-shadow:var(--ff-shadow-node);color:#fff;cursor:pointer;font-size:14px;height:22px;line-height:1;pointer-events:all;position:absolute;width:22px}.fs-drop-menu{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);box-shadow:var(--ff-shadow-pop);display:flex;flex-direction:column;min-width:170px;padding:6px;position:absolute;z-index:10}.fs-drop-menu__title{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-weight:500;letter-spacing:.08em;padding:6px 8px;text-transform:uppercase}.fs-drop-menu button{background:none;border:0;border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;font:inherit;padding:8px;text-align:left}.fs-drop-menu button:focus,.fs-drop-menu button:hover{background:var(--ff-teal-soft);color:var(--ff-teal)}.fs-drop-menu button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:-2px}.fs-drop-menu button.is-cancel{color:var(--ff-ink-muted);font-size:12px}.fs-inspector{background:var(--ff-board-raised);border-left:1px solid var(--ff-wire);display:flex;flex-direction:column;flex-shrink:0;overflow-y:auto;width:360px}.fs-inspector__tabs{flex:1}.fs-inspector__tabs .components-tab-panel__tabs{background:var(--ff-board-raised);border-bottom:1px solid var(--ff-wire);position:sticky;top:0;z-index:1}.fs-inspector__tabs .components-tab-panel__tabs-item{font-size:12px;font-weight:600;padding:0 10px}.fs-inspector__section{display:flex;flex-direction:column;gap:14px;padding:16px}.fs-inspector__heading{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:10px;font-size:11px;font-weight:500;letter-spacing:.08em;margin:8px 0 0;text-transform:uppercase}.fs-inspector__footer{border-top:1px solid var(--ff-wire);display:flex;justify-content:space-between;padding-top:12px}.fs-help{color:var(--ff-ink-muted);font-size:12px;margin:0}.fs-help--pro:before{background:var(--ff-circuit);border-radius:4px;color:var(--ff-teal-bright);content:"PRO";font-family:var(--ff-font-mono);font-size:9px;font-weight:500;letter-spacing:.08em;margin-right:6px;padding:1px 5px}.fs-answer-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:8px;padding:12px}.fs-answer-edit__actions{display:flex;justify-content:flex-end}.fs-label-picker{display:flex;flex-wrap:wrap;gap:4px}.fs-chip{background:var(--ff-board-raised);border:1px solid;border-radius:9999px;cursor:pointer;font-size:12px;padding:2px 10px}.fs-chip.is-active{color:#fff;text-shadow:0 0 2px rgba(0,0,0,.4)}.fs-label-edit{border:1px solid var(--ff-wire);border-radius:var(--ff-radius-m);display:flex;flex-direction:column;gap:6px;padding:12px}.fs-label-edit__row{align-items:center;display:flex;gap:6px}.fs-label-edit__row>.components-base-control{flex:1}.fs-label-edit__row input[type=color]{border:1px solid var(--ff-wire-strong);border-radius:var(--ff-radius-s);height:36px;padding:2px;width:36px}.fs-endpoint-list{display:flex;flex-direction:column;gap:6px;list-style:none;margin:0;padding:0}.fs-endpoint-list button{background:var(--ff-board-raised);border:1px solid var(--ff-wire);border-radius:var(--ff-radius-s);color:var(--ff-ink);cursor:pointer;display:flex;flex-direction:column;font:inherit;gap:4px;padding:8px 10px;text-align:left;width:100%}.fs-endpoint-list button:hover{border-color:var(--ff-amber)}.fs-endpoint-list button:focus-visible{outline:2px solid var(--ff-teal);outline-offset:2px}.fs-endpoint-list__title{font-weight:600}.fs-endpoint-list__meta{color:var(--ff-ink-muted);font-size:11px}.fs-shortcode{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:block;font-family:var(--ff-font-mono);padding:8px;-webkit-user-select:all;user-select:all}.fs-issues-wrap{background:var(--ff-board-raised);border-top:1px solid var(--ff-wire);bottom:0;flex-shrink:0;max-height:40%;overflow-y:auto;padding:10px 16px;position:sticky}.fs-issues-wrap summary{cursor:pointer;font-size:12px;font-weight:600}.fs-issues{display:flex;flex-direction:column;gap:6px;margin-top:8px}.fs-issues .components-notice{font-size:12px;margin:0}.fs-issues__link{background:none;border:0;color:inherit;cursor:pointer;font:inherit;padding:0;text-align:left}.fs-node__number{background:var(--ff-teal);border-radius:var(--ff-radius-s);color:var(--ff-on-teal);font-weight:500;letter-spacing:0;min-width:16px;padding:1px 5px;text-align:center}.fs-points{background:var(--ff-amber);border-radius:9999px;color:var(--ff-on-amber);font-family:var(--ff-font-mono);font-size:11px;font-weight:500;padding:0 7px}.fs-points.is-zero{background:var(--ff-board-sunken);color:var(--ff-ink-muted)}.fs-answer__fallback.is-next{color:var(--ff-teal)}.fs-range{border:0;display:flex;flex-direction:column;gap:12px;margin:0;padding:0}.fs-range__fields{display:grid;gap:8px;grid-template-columns:1fr 1fr}.fs-range .fs-help{margin:0}.fs-edge-label{pointer-events:all;position:absolute}.fs-stats__tiles{display:grid;gap:8px;grid-template-columns:repeat(2,1fr)}.fs-stats__tile{background:var(--ff-board-sunken);border-radius:var(--ff-radius-s);display:flex;flex-direction:column;padding:10px 12px}.fs-stats__value{color:var(--ff-ink);font-family:var(--ff-font-display);font-size:22px;font-weight:600;line-height:1.2}.fs-stats__label{color:var(--ff-ink-muted);font-family:var(--ff-font-mono);font-size:11px;letter-spacing:.06em;text-transform:uppercase}.fs-stats__chart{margin:0}.fs-stats__chart svg{display:block;height:auto;width:100%}.fs-stats__bar.is-views{fill:var(--ff-teal-soft)}.fs-stats__bar.is-completes{fill:var(--ff-teal)}.fs-stats__legend{color:var(--ff-ink-muted);display:flex;font-size:12px;gap:12px;margin-top:4px}.fs-stats__legend span:before{border-radius:2px;content:"";display:inline-block;height:10px;margin-right:4px;vertical-align:-1px;width:10px}.fs-stats__legend .is-views:before{background:var(--ff-teal-soft);border:1px solid var(--ff-wire)}.fs-stats__legend .is-completes:before{background:var(--ff-teal)}.fs-stats .components-notice,.fs-stats .fs-inspector__heading{margin:0}.fs-stats-pro{background:var(--ff-amber-soft);border:1px solid var(--ff-amber);border-radius:var(--ff-radius-m);margin:0;padding:14px}.fs-stats-pro__title{align-items:center;color:var(--ff-ink);display:flex;font-family:var(--ff-font-display);font-size:15px;gap:6px;margin:0 0 6px}.fs-stats-pro__lock{fill:var(--ff-amber-ink);height:16px;width:16px}.fs-stats-pro__lead{color:var(--ff-ink);margin:0 0 10px}.fs-stats-pro__subtitle{font-size:13px;margin:12px 0 6px}.fs-stats-pro__list{list-style:none;margin:0 0 8px;padding:0}.fs-stats-pro__list li{align-items:center;display:grid;font-size:12px;gap:8px;grid-template-columns:minmax(0,1fr) 70px 34px;margin-bottom:6px}.fs-stats-pro__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.fs-stats-pro__bar{background:#fff;border-radius:4px;height:8px;overflow:hidden}.fs-stats-pro__bar span{background:var(--ff-amber);display:block;filter:blur(1px);height:100%}.fs-stats-pro__num{color:var(--ff-amber-ink);filter:blur(3px);-webkit-user-select:none;user-select:none}.fs-stats-pro__features{font-size:12px;list-style:disc;margin:10px 0 12px 1.2em;padding:0} -
funnelfork/trunk/build/editor.js
r3763298 r3792829 1 (()=>{"use strict";var e={ 46(e,t,n){var o=n.cw((e,t)=>{var n=a(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useState,i=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),o=r({inst:{value:n,getSnapshot:t}}),a=o[0].inst,d=o[1];return s(function(){a.value=n,a.getSnapshot=t,c(a)&&d({inst:a})},[e,n,t]),i(function(){return c(a)&&d({inst:a}),e(function(){c(a)&&d({inst:a})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:d}),r=n.cw((e,t)=>{var n=a(),o=i(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,l=n.useRef,c=n.useEffect,d=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,o,i){var a=l(null);if(null===a.current){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=d(function(){function e(e){if(!l){if(l=!0,s=e,e=o(e),void 0!==i&&f.hasValue){var t=f.value;if(i(t,e))return a=t}return a=e}if(t=a,r(s,e))return t;var n=o(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,o,i]);var h=s(e,a[0],a[1]);return c(function(){f.hasValue=!0,f.value=h},[h]),u(h),h}}),i=n.cw(e=>{e.exports=o()}),s=n.cw(e=>{e.exports=r()}),a=n.cw(e=>{e.exports=window.React});const l=window.wp.element,c=window.ReactJSXRuntime;function d(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=d(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}a();var u={value:()=>{}};function f(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new h(o)}function h(e){this._=e}function p(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function g(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=u,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}h.prototype=f.prototype={constructor:h,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=g(r[n],e.name,t);else if(null==t)for(n in r)r[n]=g(r[n],e.name,null);return this}for(;++s<a;)if((n=(e=i[s]).type)&&(n=p(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new h(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};const m=f;function y(){}function x(e){return null==e?y:function(){return this.querySelector(e)}}function v(e){"function"!=typeof e&&(e=x(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s,a=t[r],l=a.length,c=o[r]=new Array(l),d=0;d<l;++d)(i=a[d])&&(s=e.call(i,i.__data__,d,a))&&("__data__"in i&&(s.__data__=i.__data__),c[d]=s);return new at(o,this._parents)}function w(){return[]}function b(e){return null==e?w:function(){return this.querySelectorAll(e)}}function _(e){e="function"==typeof e?function(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}(e):b(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s,a=t[i],l=a.length,c=0;c<l;++c)(s=a[c])&&(o.push(e.call(s,s.__data__,c,a)),r.push(s));return new at(o,r)}function S(e){return function(){return this.matches(e)}}function k(e){return function(t){return t.matches(e)}}n.dn(x),n.dn(v),n.dn(b),n.dn(_),n.dn(S),n.dn(E);var C=Array.prototype.find;function N(){return this.firstElementChild}function E(e){return this.select(null==e?N:function(e){return function(){return C.call(this.children,e)}}("function"==typeof e?e:k(e)))}n.dn(j);var M=Array.prototype.filter;function P(){return Array.from(this.children)}function j(e){return this.selectAll(null==e?P:function(e){return function(){return M.call(this.children,e)}}("function"==typeof e?e:k(e)))}function D(e){"function"!=typeof e&&(e=S(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new at(o,this._parents)}function I(e){return new Array(e.length)}function O(){return new at(this._enter||this._groups.map(I),this._parents)}function z(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function A(e){return function(){return e}}function R(e,t,n,o,r,i){for(var s,a=0,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],o[a]=s):n[a]=new z(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function L(e,t,n,o,r,i,s){var a,l,c,d=new Map,u=t.length,f=i.length,h=new Array(u);for(a=0;a<u;++a)(l=t[a])&&(h[a]=c=s.call(l,l.__data__,a,t)+"",d.has(c)?r[a]=l:d.set(c,l));for(a=0;a<f;++a)c=s.call(e,i[a],a,i)+"",(l=d.get(c))?(o[a]=l,l.__data__=i[a],d.delete(c)):n[a]=new z(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&d.get(h[a])===l&&(r[a]=l)}function T(e){return e.__data__}function B(e,t){if(!arguments.length)return Array.from(this,T);var n=t?L:R,o=this._parents,r=this._groups;"function"!=typeof e&&(e=A(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],u=r[c],f=u.length,h=$(e.call(d,d&&d.__data__,c,o)),p=h.length,g=a[c]=new Array(p),m=s[c]=new Array(p);n(d,u,g,m,l[c]=new Array(f),h,t);for(var y,x,v=0,w=0;v<p;++v)if(y=g[v]){for(v>=w&&(w=v+1);!(x=m[w])&&++w<p;);y._next=x||null}}return(s=new at(s,o))._enter=a,s._exit=l,s}function $(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function V(){return new at(this._exit||this._groups.map(I),this._parents)}function H(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r}function Z(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c,d=n[l],u=o[l],f=d.length,h=a[l]=new Array(f),p=0;p<f;++p)(c=d[p]||u[p])&&(h[p]=c);for(;l<r;++l)a[l]=n[l];return new at(a,this._parents)}function Y(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,s=r[i];--i>=0;)(o=r[i])&&(s&&4^o.compareDocumentPosition(s)&&s.parentNode.insertBefore(o,s),s=o);return this}function X(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=F);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s,a=n[i],l=a.length,c=r[i]=new Array(l),d=0;d<l;++d)(s=a[d])&&(c[d]=s);c.sort(t)}return new at(r,this._parents).order()}function F(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function q(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function K(){return Array.from(this)}function W(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function G(){let e=0;for(const t of this)++e;return e}function U(){return!this.node()}function Q(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],s=0,a=i.length;s<a;++s)(r=i[s])&&e.call(r,r.__data__,s,i);return this}n.dn(D),n.dn(I),n.dn(O),z.prototype={constructor:z,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},n.dn(A),n.dn(B),n.dn(V),n.dn(H),n.dn(Z),n.dn(Y),n.dn(X),n.dn(q),n.dn(K),n.dn(W),n.dn(G),n.dn(U),n.dn(Q);var J="http://www.w3.org/1999/xhtml";const ee={svg:"http://www.w3.org/2000/svg",xhtml:J,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function te(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ee.hasOwnProperty(t)?{space:ee[t],local:e}:e}function ne(e){return function(){this.removeAttribute(e)}}function oe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function re(e,t){return function(){this.setAttribute(e,t)}}function ie(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function se(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function ae(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function le(e,t){var n=te(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?oe:ne:"function"==typeof t?n.local?ae:se:n.local?ie:re)(n,t))}function ce(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function de(e){return function(){this.style.removeProperty(e)}}function ue(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fe(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function he(e,t,n){return arguments.length>1?this.each((null==t?de:"function"==typeof t?fe:ue)(e,t,n??"")):pe(this.node(),e)}function pe(e,t){return e.style.getPropertyValue(t)||ce(e).getComputedStyle(e,null).getPropertyValue(t)}function ge(e){return function(){delete this[e]}}function me(e,t){return function(){this[e]=t}}function ye(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function xe(e,t){return arguments.length>1?this.each((null==t?ge:"function"==typeof t?ye:me)(e,t)):this.node()[e]}function ve(e){return e.trim().split(/^|\s+/)}function we(e){return e.classList||new be(e)}function be(e){this._node=e,this._names=ve(e.getAttribute("class")||"")}function _e(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Se(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ke(e){return function(){_e(this,e)}}function Ce(e){return function(){Se(this,e)}}function Ne(e,t){return function(){(t.apply(this,arguments)?_e:Se)(this,e)}}function Ee(e,t){var n=ve(e+"");if(arguments.length<2){for(var o=we(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?Ne:t?ke:Ce)(n,t))}function Me(){this.textContent=""}function Pe(e){return function(){this.textContent=e}}function je(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function De(e){return arguments.length?this.each(null==e?Me:("function"==typeof e?je:Pe)(e)):this.node().textContent}function Ie(){this.innerHTML=""}function Oe(e){return function(){this.innerHTML=e}}function ze(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ae(e){return arguments.length?this.each(null==e?Ie:("function"==typeof e?ze:Oe)(e)):this.node().innerHTML}function Re(){this.nextSibling&&this.parentNode.appendChild(this)}function Le(){return this.each(Re)}function Te(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Be(){return this.each(Te)}function $e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===J&&t.documentElement.namespaceURI===J?t.createElement(e):t.createElementNS(n,e)}}function Ve(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function He(e){var t=te(e);return(t.local?Ve:$e)(t)}function Ze(e){var t="function"==typeof e?e:He(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ye(){return null}function Xe(e,t){var n="function"==typeof e?e:He(e),o=null==t?Ye:"function"==typeof t?t:x(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Fe(){var e=this.parentNode;e&&e.removeChild(this)}function qe(){return this.each(Fe)}function Ke(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function We(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ge(e){return this.select(e?We:Ke)}function Ue(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qe(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function Je(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function et(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),s=i.length;if(!(arguments.length<2)){for(a=t?Je:Qe,o=0;o<s;++o)this.each(a(i[o],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,d=a.length;c<d;++c)for(o=0,l=a[c];o<s;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value}function tt(e,t,n){var o=ce(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function nt(e,t){return function(){return tt(this,e,t)}}function ot(e,t){return function(){return tt(this,e,t.apply(this,arguments))}}function rt(e,t){return this.each(("function"==typeof t?ot:nt)(e,t))}function*it(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,s=r.length;i<s;++i)(o=r[i])&&(yield o)}n.dn(te),n.dn(le),n.dn(ce),n.dn(he),n.dn(xe),n.dn(Ee),be.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}},n.dn(De),n.dn(Ae),n.dn(Le),n.dn(Be),n.dn(He),n.dn(Ze),n.dn(Xe),n.dn(qe),n.dn(Ge),n.dn(Ue),n.dn(et),n.dn(rt),n.dn(it);var st=[null];function at(e,t){this._groups=e,this._parents=t}function lt(){return new at([[document.documentElement]],st)}at.prototype=lt.prototype={constructor:at,select:v,selectAll:_,selectChild:E,selectChildren:j,filter:D,data:B,enter:O,exit:V,join:H,merge:Z,selection:function(){return this},order:Y,sort:X,call:q,nodes:K,node:W,size:G,empty:U,each:Q,attr:le,style:he,property:xe,classed:Ee,text:De,html:Ae,raise:Le,lower:Be,append:Ze,insert:Xe,remove:qe,clone:Ge,datum:Ue,on:et,dispatch:rt,[Symbol.iterator]:it};const ct=lt;function dt(e){return"string"==typeof e?new at([[document.querySelector(e)]],[document.documentElement]):new at([[e]],st)}function ut(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ft(e,t){if(e=ut(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}n.dn(dt),n.dn(ut),n.dn(ft),n.dn(mt);const ht={passive:!1},pt={capture:!0,passive:!1};function gt(e){e.stopImmediatePropagation()}function mt(e){e.preventDefault(),e.stopImmediatePropagation()}function yt(e){var t=e.document.documentElement,n=dt(e).on("dragstart.drag",mt,pt);"onselectstart"in t?n.on("selectstart.drag",mt,pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xt(e,t){var n=e.document.documentElement,o=dt(e).on("dragstart.drag",null);t&&(o.on("click.drag",mt,pt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}n.dn(yt);const vt=e=>()=>e;function wt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function bt(e){return!e.ctrlKey&&!e.button}function _t(){return this.parentNode}function St(e,t){return t??{x:e.x,y:e.y}}function kt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ct(){var e,t,n,o,r=bt,i=_t,s=St,a=kt,l={},c=m("start","drag","end"),d=0,u=0;function f(e){e.on("mousedown.drag",h).filter(a).on("touchstart.drag",y).on("touchmove.drag",x,ht).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(s,a){if(!o&&r.call(this,s,a)){var l=w(this,i.call(this,s,a),s,a,"mouse");l&&(dt(s.view).on("mousemove.drag",p,pt).on("mouseup.drag",g,pt),yt(s.view),gt(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(o){if(mt(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>u}l.mouse("drag",o)}function g(e){dt(e.view).on("mousemove.drag mouseup.drag",null),xt(e.view,n),mt(e),l.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,a=i.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=w(this,a,e,t,s[n].identifier,s[n]))&&(gt(e),o("start",e,s[n]))}}function x(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(mt(e),n("drag",e,o[t]))}function v(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=l[r[t].identifier])&&(gt(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var a,u,h,p=c.copy(),g=ft(i||n,t);if(null!=(h=s.call(e,new wt("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return a=h.x-g[0]||0,u=h.y-g[1]||0,function n(i,s,c){var m,y=g;switch(i){case"start":l[r]=n,m=d++;break;case"end":delete l[r],--d;case"drag":g=ft(c||s,t),m=d}p.call(i,e,new wt(i,{sourceEvent:s,subject:h,target:f,identifier:r,active:m,x:g[0]+a,y:g[1]+u,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:vt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:vt(e),f):i},f.subject=function(e){return arguments.length?(s="function"==typeof e?e:vt(e),f):s},f.touchable=function(e){return arguments.length?(a="function"==typeof e?e:vt(!!e),f):a},f.on=function(){var e=c.on.apply(c,arguments);return e===c?f:e},f.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,f):Math.sqrt(u)},f}function Nt(e){return((e=Math.exp(e))+1/e)/2}n.dn(vt),wt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},n.dn(Ct);const Et=function e(t,n,o){function r(e,r){var i,s,a=e[0],l=e[1],c=e[2],d=r[0],u=r[1],f=r[2],h=d-a,p=u-l,g=h*h+p*p;if(g<1e-12)s=Math.log(f/c)/t,i=function(e){return[a+e*h,l+e*p,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(g),y=(f*f-c*c+o*g)/(2*c*n*m),x=(f*f-c*c-o*g)/(2*f*n*m),v=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(x*x+1)-x);s=(w-v)/t,i=function(e){var o,r=e*s,i=Nt(v),d=c/(n*m)*(i*(o=t*r+v,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(v));return[a+d*h,l+d*p,c*i/Nt(t*r+v)]}}return i.duration=1e3*s*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4);var Mt,Pt,jt=0,Dt=0,It=0,Ot=0,zt=0,At=0,Rt="object"==typeof performance&&performance.now?performance:Date,Lt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Tt(){return zt||(Lt(Bt),zt=Rt.now()+At)}function Bt(){zt=0}function $t(){this._call=this._time=this._next=null}function Vt(e,t,n){var o=new $t;return o.restart(e,t,n),o}function Ht(){zt=(Ot=Rt.now())+At,jt=Dt=0;try{!function(){Tt(),++jt;for(var e,t=Mt;t;)(e=zt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--jt}()}finally{jt=0,function(){for(var e,t,n=Mt,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Mt=t);Pt=e,Yt(o)}(),zt=0}}function Zt(){var e=Rt.now(),t=e-Ot;t>1e3&&(At-=t,Ot=e)}function Yt(e){jt||(Dt&&(Dt=clearTimeout(Dt)),e-zt>24?(e<1/0&&(Dt=setTimeout(Ht,e-Rt.now()-At)),It&&(It=clearInterval(It))):(It||(Ot=Rt.now(),It=setInterval(Zt,1e3)),jt=1,Lt(Ht)))}function Xt(e,t,n){var o=new $t;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}$t.prototype=Vt.prototype={constructor:$t,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Tt():+n)+(null==t?0:+t),this._next||Pt===this||(Pt?Pt._next=this:Mt=this,Pt=this),this._call=e,this._time=n,Yt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yt())}},n.dn(Xt),n.dn(Kt);var Ft=m("start","end","cancel","interrupt"),qt=[];function Kt(e,t,n,o,r,i){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(l){var c,d,u,f;if(1!==n.state)return a();for(c in r)if((f=r[c]).name===n.name){if(3===f.state)return Xt(i);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[c])}if(Xt(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++d]=f);o.length=d+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(a),n.state=5,1),i=-1,s=o.length;++i<s;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Vt(function(e){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=e&&i(e-n.delay)},0,n.time)}(e,n,{name:t,index:o,group:r,on:Ft,tween:qt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Wt(e,t){var n=Ut(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Gt(e,t){var n=Ut(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Ut(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Qt(e,t){var n,o,r,i=e.__transition,s=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):s=!1;s&&delete e.__transition}}function Jt(e){return this.each(function(){Qt(this,e)})}function en(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}n.dn(Qt),n.dn(Jt),n.dn(en),n.dn(rn);var tn,nn=180/Math.PI,on={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rn(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*nn,skewX:Math.atan(l)*nn,scaleX:s,scaleY:a}}function sn(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,s){var a=[],l=[];return i=e(i),s=e(s),function(e,o,r,i,s,a){if(e!==r||o!==i){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:en(e,r)},{i:l-2,x:en(o,i)})}else(r||i)&&s.push("translate("+r+t+i+n)}(i.translateX,i.translateY,s.translateX,s.translateY,a,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:en(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,s.rotate,a,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:en(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,s.skewX,a,l),function(e,t,n,o,i,s){if(e!==n||t!==o){var a=i.push(r(i)+"scale(",null,",",null,")");s.push({i:a-4,x:en(e,n)},{i:a-2,x:en(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,s.scaleX,s.scaleY,a,l),i=s=null,function(e){for(var t,n=-1,o=l.length;++n<o;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var an=sn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?on:rn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),ln=sn(function(e){return null==e?on:(tn||(tn=document.createElementNS("http://www.w3.org/2000/svg","g")),tn.setAttribute("transform",e),(e=tn.transform.baseVal.consolidate())?rn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):on)},", ",")",")");function cn(e,t){var n,o;return function(){var r=Gt(this,e),i=r.tween;if(i!==n)for(var s=0,a=(o=n=i).length;s<a;++s)if(o[s].name===t){(o=o.slice()).splice(s,1);break}r.tween=o}}function dn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Gt(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function un(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=Ut(this.node(),n).tween,i=0,s=r.length;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?cn:dn)(n,e,t))}function fn(e,t,n){var o=e._id;return e.each(function(){var e=Gt(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Ut(e,o).value[t]}}function hn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pn(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function gn(){}n.dn(un),n.dn(hn);var mn=.7,yn=1/mn,xn="\\s*([+-]?\\d+)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bn=/^#([0-9a-f]{3,8})$/,Sn=new RegExp(`^rgb\\(${xn},${xn},${xn}\\)$`),kn=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),Cn=new RegExp(`^rgba\\(${xn},${xn},${xn},${vn}\\)$`),Nn=new RegExp(`^rgba\\(${wn},${wn},${wn},${vn}\\)$`),En=new RegExp(`^hsl\\(${vn},${wn},${wn}\\)$`),Mn=new RegExp(`^hsla\\(${vn},${wn},${wn},${vn}\\)$`),Pn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function jn(){return this.rgb().formatHex()}function Dn(){return this.rgb().formatRgb()}function In(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=bn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?On(t):3===n?new Rn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?zn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?zn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Sn.exec(e))?new Rn(t[1],t[2],t[3],1):(t=kn.exec(e))?new Rn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Cn.exec(e))?zn(t[1],t[2],t[3],t[4]):(t=Nn.exec(e))?zn(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=En.exec(e))?Hn(t[1],t[2]/100,t[3]/100,1):(t=Mn.exec(e))?Hn(t[1],t[2]/100,t[3]/100,t[4]):Pn.hasOwnProperty(e)?On(Pn[e]):"transparent"===e?new Rn(NaN,NaN,NaN,0):null}function On(e){return new Rn(e>>16&255,e>>8&255,255&e,1)}function zn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Rn(e,t,n,o)}function An(e,t,n,o){return 1===arguments.length?((r=e)instanceof gn||(r=In(r)),r?new Rn((r=r.rgb()).r,r.g,r.b,r.opacity):new Rn):new Rn(e,t,n,o??1);var r}function Rn(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Ln(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}`}function Tn(){const e=Bn(this.opacity);return`${1===e?"rgb(":"rgba("}${$n(this.r)}, ${$n(this.g)}, ${$n(this.b)}${1===e?")":`, ${e})`}`}function Bn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vn(e){return((e=$n(e))<16?"0":"")+e.toString(16)}function Hn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Yn(e,t,n,o)}function Zn(e){if(e instanceof Yn)return new Yn(e.h,e.s,e.l,e.opacity);if(e instanceof gn||(e=In(e)),!e)return new Yn;if(e instanceof Yn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(s=t===i?(n-o)/a+6*(n<o):n===i?(o-t)/a+2:(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Yn(s,a,l,e.opacity)}function Yn(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function Xn(e){return(e=(e||0)%360)<0?e+360:e}function Fn(e){return Math.max(0,Math.min(1,e||0))}function qn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Kn(e,t,n,o,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*n+(1+3*e+3*i-3*s)*o+s*r)/6}function Wn(e){var t=e.length-1;return function(n){var o=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[o],i=e[o+1],s=o>0?e[o-1]:2*r-i,a=o<t-1?e[o+2]:2*i-r;return Kn((n-o/t)*t,s,r,i,a)}}function Gn(e){var t=e.length;return function(n){var o=Math.floor(((n%=1)<0?++n:n)*t),r=e[(o+t-1)%t],i=e[o%t],s=e[(o+1)%t],a=e[(o+2)%t];return Kn((n-o/t)*t,r,i,s,a)}}hn(gn,In,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:jn,formatHex:jn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Zn(this).formatHsl()},formatRgb:Dn,toString:Dn}),hn(Rn,An,pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rn($n(this.r),$n(this.g),$n(this.b),Bn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ln,formatHex:Ln,formatHex8:function(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}${Vn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Tn,toString:Tn})),hn(Yn,function(e,t,n,o){return 1===arguments.length?Zn(e):new Yn(e,t,n,o??1)},pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Yn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Yn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new Rn(qn(e>=240?e-240:e+120,r,o),qn(e,r,o),qn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Yn(Xn(this.h),Fn(this.s),Fn(this.l),Bn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Bn(this.opacity);return`${1===e?"hsl(":"hsla("}${Xn(this.h)}, ${100*Fn(this.s)}%, ${100*Fn(this.l)}%${1===e?")":`, ${e})`}`}})),n.dn(Wn),n.dn(Gn);const Un=e=>()=>e;function Qn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Un(isNaN(e)?t:e)}n.dn(Un);const Jn=function e(t){var n=function(e){return 1===(e=+e)?Qn:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):Un(isNaN(t)?n:t)}}(t);function o(e,t){var o=n((e=An(e)).r,(t=An(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),s=Qn(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=s(t),e+""}}return o.gamma=e,o}(1);function eo(e){return function(t){var n,o,r=t.length,i=new Array(r),s=new Array(r),a=new Array(r);for(n=0;n<r;++n)o=An(t[n]),i[n]=o.r||0,s[n]=o.g||0,a[n]=o.b||0;return i=e(i),s=e(s),a=e(a),o.opacity=1,function(e){return o.r=i(e),o.g=s(e),o.b=a(e),o+""}}}eo(Wn),eo(Gn),n.dn(oo);var to=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,no=new RegExp(to.source,"g");function oo(e,t){var n,o,r,i=to.lastIndex=no.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=to.exec(e))&&(o=no.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:en(n,o)})),i=no.lastIndex;return i<t.length&&(r=t.slice(i),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)a[(n=l[o]).i]=n.x(e);return a.join("")})}function ro(e,t){var n;return("number"==typeof t?en:t instanceof In?Jn:(n=In(t))?(t=n,Jn):oo)(e,t)}function io(e){return function(){this.removeAttribute(e)}}function so(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ao(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function lo(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function co(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttribute(e)}}function uo(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttributeNS(e.space,e.local)}}function fo(e,t){var n=te(e),o="transform"===n?ln:ro;return this.attrTween(e,"function"==typeof t?(n.local?uo:co)(n,o,fn(this,"attr."+e,t)):null==t?(n.local?so:io)(n):(n.local?lo:ao)(n,o,t))}function ho(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function po(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function go(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=te(e);return this.tween(n,(o.local?ho:po)(o,t))}function mo(e,t){return function(){Wt(this,e).delay=+t.apply(this,arguments)}}function yo(e,t){return t=+t,function(){Wt(this,e).delay=t}}function xo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?mo:yo)(t,e)):Ut(this.node(),t).delay}function vo(e,t){return function(){Gt(this,e).duration=+t.apply(this,arguments)}}function wo(e,t){return t=+t,function(){Gt(this,e).duration=t}}function bo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?vo:wo)(t,e)):Ut(this.node(),t).duration}function _o(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Gt(this,e).ease=t}}(t,e)):Ut(this.node(),t).ease}function So(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Gt(this,e).ease=n}}(this._id,e))}function ko(e){"function"!=typeof e&&(e=S(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new $o(o,this._parents,this._name,this._id)}function Co(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l,c=t[a],d=n[a],u=c.length,f=s[a]=new Array(u),h=0;h<u;++h)(l=c[h]||d[h])&&(f[h]=l);for(;a<o;++a)s[a]=t[a];return new $o(s,this._parents,this._name,this._id)}function No(e,t){var n=this._id;return arguments.length<2?Ut(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Wt:Gt;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}(n,e,t))}function Eo(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))}function Mo(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a,l,c=o[s],d=c.length,u=i[s]=new Array(d),f=0;f<d;++f)(a=c[f])&&(l=e.call(a,a.__data__,f,c))&&("__data__"in a&&(l.__data__=a.__data__),u[f]=l,Kt(u[f],t,n,f,u,Ut(a,n)));return new $o(i,this._parents,t,n)}function Po(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=b(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l,c=o[a],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var f,h=e.call(l,l.__data__,u,c),p=Ut(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&Kt(f,t,n,g,h,p);i.push(h),s.push(l)}return new $o(i,s,t,n)}n.dn(ro),n.dn(fo),n.dn(go),n.dn(xo),n.dn(bo),n.dn(_o),n.dn(So),n.dn(ko),n.dn(Co),n.dn(No),n.dn(Eo),n.dn(Mo),n.dn(Po),n.dn(Do);var jo=ct.prototype.constructor;function Do(){return new jo(this._groups,this._parents)}function Io(e){return function(){this.style.removeProperty(e)}}function Oo(e,t,n){var o="transform"==(e+="")?an:ro;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=pe(this,e),s=(this.style.removeProperty(e),pe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}(e,o)).on("end.style."+e,Io(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var s=pe(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=pe(this,e)),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}(e,o,fn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,s="style."+t,a="end."+s;return function(){var l=Gt(this,e),c=l.on,d=null==l.value[s]?i||(i=Io(t)):void 0;c===n&&r===d||(o=(n=c).copy()).on(a,r=d),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var s=pe(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}(e,o,t),n).on("end.style."+e,null)}function zo(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,n??""))}function Ao(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(fn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))}function Ro(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))}function Lo(){for(var e=this._name,t=this._id,n=Vo(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)if(s=a[c]){var d=Ut(s,t);Kt(s,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new $o(o,this._parents,e,n)}function To(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){0===--r&&i()}};n.each(function(){var n=Gt(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t}),0===r&&i()})}n.dn(Oo),n.dn(zo),n.dn(Ao),n.dn(Ro),n.dn(Lo),n.dn(To);var Bo=0;function $o(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vo(){return++Bo}var Ho=ct.prototype;$o.prototype=function(e){return ct().transition(e)}.prototype={constructor:$o,select:Mo,selectAll:Po,selectChild:Ho.selectChild,selectChildren:Ho.selectChildren,filter:ko,merge:Co,selection:Do,transition:Lo,call:Ho.call,nodes:Ho.nodes,node:Ho.node,size:Ho.size,empty:Ho.empty,each:Ho.each,on:No,attr:fo,attrTween:go,style:Oo,styleTween:zo,text:Ao,textTween:Ro,remove:Eo,tween:un,delay:xo,duration:bo,ease:_o,easeVarying:So,end:To,[Symbol.iterator]:Ho[Symbol.iterator]},n.dn(Xo);var Zo={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Yo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Xo(e){var t,n;e instanceof $o?(t=e._id,e=e._name):(t=Vo(),(n=Zo).time=Tt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)(s=a[c])&&Kt(s,e,t,c,a,n||Yo(s,t));return new $o(o,this._parents,e,t)}ct.prototype.interrupt=Jt,ct.prototype.transition=Xo;const Fo=e=>()=>e;function qo(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ko(e,t,n){this.k=e,this.x=t,this.y=n}n.dn(Fo),Ko.prototype={constructor:Ko,scale:function(e){return 1===e?this:new Ko(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Ko(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Wo=new Ko(1,0,0);function Go(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Wo;return e.__zoom}function Uo(e){e.stopImmediatePropagation()}function Qo(e){e.preventDefault(),e.stopImmediatePropagation()}function Jo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function er(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function tr(){return this.__zoom||Wo}function nr(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function or(){return navigator.maxTouchPoints||"ontouchstart"in this}function rr(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ir(){var e,t,n,o=Jo,r=er,i=rr,s=nr,a=or,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Et,f=m("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",tr).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",C).filter(a).on("touchstart.zoom",N).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Ko(t,e.x,e.y)}function x(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Ko(e.k,o,r)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){b(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,s=b(e,i).event(o),a=r.apply(e,i),l=null==n?v(a):"function"==typeof n?n.apply(e,i):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),d=e.__zoom,f="function"==typeof t?t.apply(e,i):t,h=u(d.invert(l).concat(c/d.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=c/t[2];e=new Ko(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new _(e,t)}function _(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function S(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,a=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,s.apply(this,arguments)))),d=ft(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=r.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(r.k===a)return;n.mouse=[d,r.invert(d)],Qt(this),n.start()}Qo(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(x(y(r,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function k(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=b(this,t,!0).event(e),a=dt(e.view).on("mousemove.zoom",function(e){if(Qo(e),!s.moved){var t=e.clientX-d,n=e.clientY-u;s.moved=t*t+n*n>h}s.event(e).zoom("mouse",i(x(s.that.__zoom,s.mouse[0]=ft(e,r),s.mouse[1]),s.extent,c))},!0).on("mouseup.zoom",function(e){a.on("mousemove.zoom mouseup.zoom",null),xt(e.view,s.moved),Qo(e),s.event(e).end()},!0),l=ft(e,r),d=e.clientX,u=e.clientY;yt(e.view),Uo(e),s.mouse=[l,this.__zoom.invert(l)],Qt(this),s.start()}}function C(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=ft(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=i(x(y(n,l),s,a),r.apply(this,t),c);Qo(e),d>0?dt(this).transition().duration(d).call(w,u,s,e):dt(this).call(g.transform,u,s,e)}}function N(n,...r){if(o.apply(this,arguments)){var i,s,a,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(Uo(n),s=0;s<d;++s)l=[l=ft(a=c[s],this),this.__zoom.invert(l),a.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,i=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(u.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),Qt(this),u.start())}}function E(e,...t){if(this.__zooming){var n,o,r,s,a=b(this,t).event(e),l=e.changedTouches,d=l.length;for(Qo(e),n=0;n<d;++n)r=ft(o=l[n],this),a.touch0&&a.touch0[2]===o.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===o.identifier&&(a.touch1[0]=r);if(o=a.that.__zoom,a.touch1){var u=a.touch0[0],f=a.touch0[1],h=a.touch1[0],p=a.touch1[1],g=(g=h[0]-u[0])*g+(g=h[1]-u[1])*g,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;o=y(o,Math.sqrt(g/m)),r=[(u[0]+h[0])/2,(u[1]+h[1])/2],s=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],s=a.touch0[1]}a.zoom("touch",i(x(o,r,s),a.extent,c))}}function M(e,...o){if(this.__zooming){var r,i,s=b(this,o).event(e),a=e.changedTouches,l=a.length;for(Uo(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=a[r],s.touch0&&s.touch0[2]===i.identifier?delete s.touch0:s.touch1&&s.touch1[2]===i.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(i=ft(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=dt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",tr),e!==r?w(e,t,n,o):r.interrupt().each(function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,o){g.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},g.scaleTo=function(e,t,n,o){g.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,a=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return i(x(y(o,l),s,a),e,c)},n,o)},g.translateBy=function(e,t,n,o){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)},null,o)},g.translateTo=function(e,t,n,o,s){g.transform(e,function(){var e=r.apply(this,arguments),s=this.__zoom,a=null==o?v(e):"function"==typeof o?o.apply(this,arguments):o;return i(Wo.translate(a[0],a[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},o,s)},_.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=dt(this.that).datum();f.call(e,this.that,new qo(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:f}),t)}},g.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:Fo(+e),g):s},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Fo(!!e),g):o},g.touchable=function(e){return arguments.length?(a="function"==typeof e?e:Fo(!!e),g):a},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Fo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):r},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(d=+e,g):d},g.interpolate=function(e){return arguments.length?(u=e,g):u},g.on=function(){var e=f.on.apply(f,arguments);return e===f?g:e},g.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,g):Math.sqrt(h)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}function sr(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),s=new Array(o);for(n=0;n<r;++n)i[n]=dr(e[n],t[n]);for(;n<o;++n)s[n]=t[n];return function(e){for(n=0;n<r;++n)s[n]=i[n](e);return s}}function ar(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function lr(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=dr(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}function cr(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function dr(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?Un(t):("number"===r?en:"string"===r?(n=In(t))?(t=n,Jn):oo:t instanceof In?Jn:t instanceof Date?ar:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?sr:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?lr:en:cr))(e,t)}Go.prototype=Ko.prototype,n.dn(Qo),n.dn(ir),n.dn(function(e,t){return((void 0)(t)?void 0:sr)(e,t)}),n.dn(ar),n.dn(lr),n.dn(cr),n.dn(dr);const ur=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],fr=["Enter"," ","Escape"],hr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var pr,gr,mr;!function(e){e.Strict="strict",e.Loose="loose"}(pr||(pr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(gr||(gr={})),function(e){e.Partial="partial",e.Full="full"}(mr||(mr={}));const yr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xr,vr,wr;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(xr||(xr={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(vr||(vr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(wr||(wr={}));const br={[wr.Left]:wr.Right,[wr.Right]:wr.Left,[wr.Top]:wr.Bottom,[wr.Bottom]:wr.Top},_r=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,Sr=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),kr=(e,t=[0,0])=>{const{width:n,height:o}=Gr(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Cr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=Or(n,Lr(e)),o=!0)}),o?Ar(n):{x:0,y:0,width:0,height:0}},Nr=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,c=t.width/r,d=t.height/r,u=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(s&&!n||o)continue;const r=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:h,y:p}=t.internals.positionAbsolute,g=Br(a,l,c,d,h,p,r,f),m=r*f,y=i&&g>0;(!t.internals.handleBounds||y||g>=m||t.dragging)&&u.push(t)}return u};function Er({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let u=s.extent||r;if("parent"!==s.extent||s.expandParent)a&&Wr(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);else if(a){const{width:e,height:t}=Gr(a);e&&t&&(u=[[l,c],[l+e,c+t]])}else i?.("005","Only child nodes can use a parent extent.");const f=Wr(u)?Pr(t,u,s.measured):t;return void 0!==s.measured.width&&void 0!==s.measured.height||i?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:f.x-l+(s.measured.width??0)*d[0],y:f.y-c+(s.measured.height??0)*d[1]},positionAbsolute:f}}const Mr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pr=(e={x:0,y:0},t,n)=>({x:Mr(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Mr(e.y,t[0][1],t[1][1]-(n?.height??0))});function jr(e,t,n){const{width:o,height:r}=Gr(n),{x:i,y:s}=n.internals.positionAbsolute;return Pr(e,[[i,s],[i+o,s+r]],t)}const Dr=(e,t,n)=>e<t?Mr(Math.abs(e-t),1,t)/t:e>n?-Mr(Math.abs(e-n),1,t)/t:0,Ir=(e,t,n=15,o=40)=>[Dr(e.x,o,t.width-o)*n,Dr(e.y,o,t.height-o)*n],Or=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),zr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Ar=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Rr=(e,t=[0,0])=>{const{x:n,y:o}=Sr(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Lr=(e,t=[0,0])=>{const{x:n,y:o}=Sr(e)?e.internals.positionAbsolute:kr(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Tr=(e,t)=>Ar(Or(zr(e),zr(t))),Br=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),c=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*c)},$r=(e,t)=>Br(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vr=e=>Hr(e.width)&&Hr(e.height)&&Hr(e.x)&&Hr(e.y),Hr=e=>!isNaN(e)&&isFinite(e),Zr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Yr=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Zr(a,s):a},Xr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Fr(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const qr=(e,t,n,o,r,i)=>{const s=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Fr(e,n),r=Fr(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Fr(e.top??e.y??0,n),r=Fr(e.bottom??e.y??0,n),i=Fr(e.left??e.x??0,t),s=Fr(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=Mr(c,o,r),u=t/2-(e.x+e.width/2)*d,f=n/2-(e.y+e.height/2)*d,h=function(e,t,n,o,r,i){const{x:s,y:a}=Xr(e,[t,n,o]),{x:l,y:c}=Xr({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}(e,u,f,d,t,n),p=Math.min(h.left-s.left,0),g=Math.min(h.top-s.top,0);return{x:u-p+Math.min(h.right-s.right,0),y:f-g+Math.min(h.bottom-s.bottom,0),zoom:d}},Kr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Wr(e){return null!=e&&"parent"!==e}function Gr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ur(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Qr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const e=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Jr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ei(e){return{...hr,...e||{}}}function ti(e){return null===e?null:e?"valid":"invalid"}function ni(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=li(e),a=Yr({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Zr(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const oi=e=>({width:e.offsetWidth,height:e.offsetHeight}),ri=e=>e?.getRootNode?.()||window?.document,ii=["INPUT","SELECT","TEXTAREA"];function si(e){const t=e.composedPath?.()?.[0]||e.target;return 1===t?.nodeType&&(ii.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}const ai=e=>"clientX"in e,li=(e,t)=>{const n=ai(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ci=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...oi(t)}}):null};function di({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*i+.375*a+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ui(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function fi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case wr.Left:return[t-ui(t-o,i),n];case wr.Right:return[t+ui(o-t,i),n];case wr.Top:return[t,n-ui(n-r,i)];case wr.Bottom:return[t,n+ui(r-n,i)]}}function hi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,curvature:s=.25}){const[a,l]=fi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=fi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,h,p]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,u,f,h,p]}function pi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[i,o<t?o+s:o-s,r,s]}function gi({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Or(Lr(e),Lr(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $r(s,Ar(i))>0}const mi=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function yi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=pi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const xi={[wr.Left]:{x:-1,y:0},[wr.Right]:{x:1,y:0},[wr.Top]:{x:0,y:-1},[wr.Bottom]:{x:0,y:1}},vi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wi(e,t,n,o){const r=Math.min(vi(e,t)/2,vi(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s)return`L ${i+r*(e.x<n.x?-1:1)},${s}Q ${i},${s} ${i},${s+r*(e.y<n.y?1:-1)}`;const a=e.x<n.x?1:-1;return`L ${i},${s+r*(e.y<n.y?-1:1)}Q ${i},${s} ${i+r*a},${s}`}function bi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:d=.5}){const[u,f,h,p,g]=function({source:e,sourcePosition:t=wr.Bottom,target:n,targetPosition:o=wr.Top,center:r,offset:i,stepPosition:s}){const a=xi[t],l=xi[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},u=(({source:e,sourcePosition:t=wr.Bottom,target:n})=>t===wr.Left||t===wr.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:d}),f=0!==u.x?"x":"y",h=u[f];let p,g,m=[];const y={x:0,y:0},x={x:0,y:0},[,,v,w]=pi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){"x"===f?(p=r.x??c.x+(d.x-c.x)*s,g=r.y??(c.y+d.y)/2):(p=r.x??(c.x+d.x)/2,g=r.y??c.y+(d.y-c.y)*s);const e=[{x:p,y:c.y},{x:p,y:d.y}],t=[{x:c.x,y:g},{x:d.x,y:g}];m=a[f]===h?"x"===f?e:t:"x"===f?t:e}else{const r=[{x:c.x,y:d.y}],s=[{x:d.x,y:c.y}];if(m="x"===f?a.x===h?s:r:a.y===h?r:s,t===o){const t=Math.abs(e[f]-n[f]);if(t<=i){const o=Math.min(i-1,i-t);a[f]===h?y[f]=(c[f]>e[f]?-1:1)*o:x[f]=(d[f]>n[f]?-1:1)*o}}if(t!==o){const e="x"===f?"y":"x",t=a[f]===l[e],n=c[e]>d[e],o=c[e]<d[e];(1===a[f]&&(!t&&n||t&&o)||1!==a[f]&&(!t&&o||t&&n))&&(m="x"===f?r:s)}const u={x:c.x+y.x,y:c.y+y.y},v={x:d.x+x.x,y:d.y+x.y};Math.max(Math.abs(u.x-m[0].x),Math.abs(v.x-m[0].x))>=Math.max(Math.abs(u.y-m[0].y),Math.abs(v.y-m[0].y))?(p=(u.x+v.x)/2,g=m[0].y):(p=m[0].x,g=(u.y+v.y)/2)}const b={x:c.x+y.x,y:c.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...b.x!==m[0].x||b.y!==m[0].y?[b]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],p,g,v,w]}({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});let m=`M${u[0].x} ${u[0].y}`;for(let e=1;e<u.length-1;e++)m+=wi(u[e-1],u[e],u[e+1],s);return m+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[m,f,h,p,g]}function _i(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Si(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function ki(e,t,n=wr.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Gr(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case wr.Top:return{x:r+s/2,y:i};case wr.Right:return{x:r+s,y:i+a/2};case wr.Bottom:return{x:r+s/2,y:i+a};case wr.Left:return{x:r,y:i+a/2}}}function Ci(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Ni(e,t){return e?"string"==typeof e?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`:""}const Ei={nodeOrigin:[0,0],nodeExtent:ur,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Mi={...Ei,checkEquality:!0};function Pi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function ji(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const t of e.handles){const r={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};"source"===t.type?n.push(r):"target"===t.type&&o.push(r)}return{source:n,target:o}}function Di(e){return"manual"===e}function Ii(e,t,n,o={}){const r=Pi(Mi,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Di(r.zIndexMode)?1e3:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const d of e){let e=s.get(d.id);if(r.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{const n=kr(d,r.nodeOrigin),o=Wr(d.extent)?d.extent:r.nodeExtent,i=Pr(n,o,Gr(d));e={...r.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:i,handleBounds:ji(d,e),z:zi(d,a,r.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),d.parentId&&Oi(e,t,n,o,i),c||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function Oi(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Pi(Ei,o),c=e.parentId,d=t.get(c);if(!d)return void console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),r&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===l&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+10*r.i),r&&void 0!==d.internals.rootParentIndex&&(r.i=d.internals.rootParentIndex);const u=i&&!Di(l)?1e3:0,{x:f,y:h,z:p}=function(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Gr(e),c=kr(e,n),d=Wr(e.extent)?Pr(c,e.extent,l):c;let u=Pr({x:s+d.x,y:a+d.y},o,l);"parent"===e.extent&&(u=jr(u,l,t));const f=zi(e,r,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}(e,d,s,a,u,l),{positionAbsolute:g}=e.internals,m=f!==g.x||h!==g.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:f,y:h}:g,z:p}})}function zi(e,t,n){const o=Hr(e.zIndex)?e.zIndex:0;return Di(n)?o:o+(e.selected?t:0)}function Ai(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Rr(e),r=Tr(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},s)=>{const a=i.internals.positionAbsolute,l=Gr(i),c=i.origin??o,d=t.x<a.x?Math.round(Math.abs(a.x-t.x)):0,u=t.y<a.y?Math.round(Math.abs(a.y-t.y)):0,f=Math.max(l.width,Math.round(t.width)),h=Math.max(l.height,Math.round(t.height)),p=(f-l.width)*c[0],g=(h-l.height)*c[1];(d>0||u>0||p||g)&&(r.push({id:s,type:"position",position:{x:i.position.x-d+p,y:i.position.y-u+g}}),n.get(s)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+u}})})),(l.width<t.width||l.height<t.height||d||u)&&r.push({id:s,type:"dimensions",setAttributes:!0,dimensions:{width:f+(d?c[0]*d-p:0),height:h+(u?c[1]*u-g:0)}})}),r}function Ri(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const a=o.get(s)||new Map;o.set(s,a.set(n,t))}}function Li(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:s=null}=o,a={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:s},l=`${n}-${i}--${r}-${s}`;Ri("source",a,`${r}-${s}--${n}-${i}`,e,n,i),Ri("target",a,l,e,r,s),t.set(o.id,o)}}function Ti(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Ti(n,t))}function Bi(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function $i({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Vi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a="strict"===r?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(e=>e.id===n):a?.[0])??null;return l&&i?{...l,...ki(s,l,l.position,!0)}:l}function Hi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Zi=()=>!0;function Yi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Zi,nodeLookup:d}){const u="target"===i,f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=li(e),g=s.elementFromPoint(h,p),m=g?.classList.contains(`${a}-flow__handle`)?g:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Hi(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),s=m.classList.contains("connectable"),a=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:u?t:o,sourceHandle:u?i:r,target:u?o:t,targetHandle:u?r:i};y.connection=l;const f=s&&a&&(n===pr.Strict?u&&"source"===e||!u&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=Vi(t,e,i,d,n,!0)}return y}const Xi={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:m,isValidConnection:y=Zi,onReconnectEnd:x,updateConnection:v,getTransform:w,getFromHandle:b,autoPanSpeed:_,dragThreshold:S=1,handleDomNode:k}){const C=ri(e.target);let N,E=0;const{x:M,y:P}=li(e),j=Hi(i,k),D=a?.getBoundingClientRect();let I=!1;if(!D||!j)return;const O=Vi(r,j,o,l,t);if(!O)return;let z=li(e,D),A=!1,R=null,L=!1,T=null;function B(){if(!d||!D)return;const[e,t]=Ir(z,D,_);f({x:e,y:t}),E=requestAnimationFrame(B)}const $={...O,nodeId:r,type:j,position:O.position},V=l.get(r);let H={inProgress:!0,isValid:null,from:ki(V,$,wr.Left,!0),fromHandle:$,fromPosition:$.position,fromNode:V,to:z,toHandle:null,toPosition:br[$.position],toNode:null,pointer:z};function Z(){I=!0,v(H),p?.(e,{nodeId:r,handleId:o,handleType:j})}function Y(e){if(!I){const{x:t,y:n}=li(e),o=t-M,r=n-P;if(!(o*o+r*r>S*S))return;Z()}if(!b()||!$)return void X(e);const i=w();z=li(e,D),N=function(e,t,n,o){let r=[],i=1/0;const s=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())$r(r,Rr(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of s){const s=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const a of s){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:s,y:l}=ki(n,a,a.position,!0),c=Math.sqrt(Math.pow(s-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...a,x:s,y:l}],i=c):c===i&&r.push({...a,x:s,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}(Yr(z,i,!1,[1,1]),n,l,$),A||(B(),A=!0);const a=Yi(e,{handle:N,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:y,doc:C,lib:c,flowId:u,nodeLookup:l});T=a.handleDomNode,R=a.connection,L=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!N,a.isValid);const d=l.get(r),f=d?ki(d,$,wr.Left,!0):H.from,h={...H,from:f,isValid:L,to:a.toHandle&&L?Xr({x:a.toHandle.x,y:a.toHandle.y},i):z,toHandle:a.toHandle,toPosition:L&&a.toHandle?a.toHandle.position:br[$.position],toNode:a.toHandle?l.get(a.toHandle.nodeId):null,pointer:z};v(h),H=h}function X(e){if(!("touches"in e&&e.touches.length>0)){if(I){(N||T)&&R&&L&&g?.(R);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&x?.(e,o)}h(),cancelAnimationFrame(E),A=!1,L=!1,R=null,T=null,C.removeEventListener("mousemove",Y),C.removeEventListener("mouseup",X),C.removeEventListener("touchmove",Y),C.removeEventListener("touchend",X)}}0===S&&Z(),C.addEventListener("mousemove",Y),C.addEventListener("mouseup",X),C.addEventListener("touchmove",Y),C.addEventListener("touchend",X)},isValid:Yi},Fi=e=>({x:e.x,y:e.y,zoom:e.k}),qi=({x:e,y:t,zoom:n})=>Wo.translate(e,t).scale(n),Ki=(e,t)=>e.target.closest(`.${t}`),Wi=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Gi=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ui=(e,t=0,n=Gi,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Qi=e=>{const t=e.ctrlKey&&Kr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Ji({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let u=[[0,0],[d.width,d.height]];const f="undefined"!=typeof ResizeObserver?new ResizeObserver(e=>{const t=e[0];t&&(u=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);const h=ir().extent(()=>u).scaleExtent([t,n]).translateExtent(o),p=dt(e).call(h);v({x:r.x,y:r.y,zoom:Mr(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);const g=p.on("wheel.zoom"),m=p.on("dblclick.zoom");async function y(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).transform(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})}function x(){h.on("zoom",null)}async function v(e,t,n){const o=qi(e),r=h?.constrain()(o,t,n);return r&&await y(r),r}return h.wheelDelta(Qi),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:d,panOnScrollMode:u,panOnScrollSpeed:f,preventScrolling:y,zoomOnPinch:v,zoomOnScroll:w,zoomOnDoubleClick:b,panActivationKeyPressed:_=!1,zoomActivationKeyPressed:S,lib:k,onTransformChange:C,connectionInProgress:N,paneClickDistance:E,selectionOnDrag:M}){o&&!c.isZoomingOrPanning&&x();const P=r&&!S&&!o;h.clickDistance(M?1/0:!Hr(E)||E<0?0:E);const j=P?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(Ki(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const e=ft(d),t=Qi(d),r=u*Math.pow(2,t);return void o.scaleTo(n,r,e,d)}const f=1===d.deltaMode?20:1;let h=r===gr.Vertical?0:d.deltaX*f,p=r===gr.Horizontal?0:d.deltaY*f;!Kr()&&d.shiftKey&&r!==gr.Vertical&&(h=d.deltaY*f,p=0),o.translateBy(n,-h/u*i,-p/u*i,{internal:!0});const g=Fi(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,g):(e.isPanScrolling=!0,a?.(d,g)),e.panScrollTimeout=setTimeout(()=>{c?.(d,g),e.isPanScrolling=!1},150)}}({zoomPanValues:c,noWheelClassName:e,d3Selection:p,d3Zoom:h,panOnScrollMode:u,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,s=!t&&i&&!o.ctrlKey,a=Ki(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:y,d3ZoomHandler:g});p.on("wheel.zoom",j,{passive:!1});const D=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Fi(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});h.on("start",D);const I=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Wi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Fi(i.transform))}}({zoomPanValues:c,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:C});h.on("zoom",I);const O=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Wi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const t=Fi(s.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:d,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:a,onDraggingChange:l});h.on("end",O);const z=function({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return f=>{const h=t||n,p=o&&f.ctrlKey,g="wheel"===f.type;if(1===f.button&&"mousedown"===f.type&&(Ki(f,`${d}-flow__node`)||Ki(f,`${d}-flow__edge`)||Ki(f,`${d}-flow__selection`)||Ki(f,`${d}-flow__nodesselection`)))return!0;if(!(r||h||i||s||o))return!1;if(a)return!1;if(u&&!g)return!1;if(Ki(f,l)&&g)return!1;if(Ki(f,c)&&(!g||i&&g&&!t))return!1;if(!o&&f.ctrlKey&&g)return!1;if(!o&&"touchstart"===f.type&&f.touches?.length>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&g)return!1;if(!r&&("mousedown"===f.type||"touchstart"===f.type))return!1;if(Array.isArray(r)&&!r.includes(f.button)&&"mousedown"===f.type)return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g||e)&&m}}({panActivationKeyPressed:_,zoomActivationKeyPressed:S,panOnDrag:d,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:k,connectionInProgress:N});h.filter(z),b?p.on("dblclick.zoom",m):p.on("dblclick.zoom",null)},destroy:x,setViewport:async function(e,t){const n=qi(e);return await y(n,t),n},setViewportConstrained:v,getViewport:function(){const e=p?Go(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleTo(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleBy(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){h?.scaleExtent(e)},setTranslateExtent:function(e){h?.translateExtent(e)},syncViewport:function(e){if(p){const t=qi(e),n=p.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||h?.transform(p,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Hr(e)||e<0?0:e;h?.clickDistance(t)}}}var es;function ts(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function ns(e,t){return Math.max(0,t-e)}function os(e,t){return Math.max(0,e-t)}function rs(e,t,n){return Math.max(0,t-e,e-n)}function is(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(es||(es={}));const ss={width:0,height:0,x:0,y:0},as={...ss,pointerX:0,pointerY:0,aspectRatio:1};function ls(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}s();const cs=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},s=t=e(o,r,i);return i},{useDebugValue:ds}=a(),{useSyncExternalStoreWithSelector:us}=s(),fs=e=>e;function hs(e,t=fs,n){const o=us(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ds(o),o}const ps=(e,t)=>{const n=(e=>e?cs(e):cs)(e),o=(e,o=t)=>hs(n,e,o);return Object.assign(o,n),o};function gs(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ms=window.ReactDOM,ys=(0,a().createContext)(null),xs=ys.Provider,vs=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function ws(e,t){const n=(0,a().useContext)(ys);if(null===n)throw new Error(vs);return hs(n,e,t)}function bs(){const e=(0,a().useContext)(ys);if(null===e)throw new Error(vs);return(0,a().useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const _s={display:"none"},Ss={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},ks="react-flow__node-desc",Cs="react-flow__edge-desc",Ns=e=>e.ariaLiveMessage,Es=e=>e.ariaLabelConfig;function Ms({rfId:e}){const t=ws(Ns);return(0,c.jsx)("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Ss,children:t})}function Ps({rfId:e,disableKeyboardA11y:t}){const n=ws(Es);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{id:`${ks}-${e}`,style:_s,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,c.jsx)("div",{id:`${Cs}-${e}`,style:_s,children:n["edge.a11yDescription.default"]}),!t&&(0,c.jsx)(Ms,{rfId:e})]})}const js=(0,a().forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return(0,c.jsx)("div",{className:d(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});js.displayName="Panel";const Ds="https://reactflow.dev?utm_source=attribution";function Is({proOptions:e,position:t="bottom-right"}){return(0,a().useEffect)(()=>{},[]),e?.hideAttribution?null:(0,c.jsx)(js,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ds}`,children:(0,c.jsx)("a",{href:Ds,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Os=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},zs=e=>e.id;function As(e,t){return gs(e.selectedNodes.map(zs),t.selectedNodes.map(zs))&&gs(e.selectedEdges.map(zs),t.selectedEdges.map(zs))}function Rs({onSelectionChange:e}){const t=bs(),{selectedNodes:n,selectedEdges:o}=ws(Os,As);return(0,a().useEffect)(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(e=>e(r))},[n,o,e]),null}const Ls=e=>!!e.onSelectionChangeHandlers;function Ts({onSelectionChange:e}){const t=ws(Ls);return e||t?(0,c.jsx)(Rs,{onSelectionChange:e}):null}const Bs=[0,0],$s={x:0,y:0,zoom:1},Vs=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],Hs=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Zs={translateExtent:ur,nodeOrigin:Bs,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Ys(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c}=ws(Hs,gs),d=bs();(0,a().useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Zs,l()}),[]);const u=(0,a().useRef)(Zs);return(0,a().useEffect)(()=>{for(const a of Vs){const l=e[a];l!==u.current[a]&&void 0!==e[a]&&("nodes"===a?t(l):"edges"===a?n(l):"minZoom"===a?o(l):"maxZoom"===a?r(l):"translateExtent"===a?i(l):"nodeExtent"===a?s(l):"ariaLabelConfig"===a?d.setState({ariaLabelConfig:ei(l)}):"fitView"===a?d.setState({fitViewQueued:l}):"fitViewOptions"===a?d.setState({fitViewOptions:l}):d.setState({[a]:l}))}u.current=e},Vs.map(t=>e[t])),null}function Xs(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Fs="undefined"!=typeof document?document:null;function qs(e=null,t={target:Fs,actInsideInputWithModifier:!0}){const[n,o]=(0,a().useState)(!1),r=(0,a().useRef)(!1),i=(0,a().useRef)(new Set([])),[s,l]=(0,a().useMemo)(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace(/\+/g,"\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return(0,a().useEffect)(()=>{const n=t?.target??Fs,a=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{if(r.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!r.current||r.current&&!a)&&si(e))return!1;const n=Ws(e.code,l);if(i.current.add(e[n]),Ks(s,i.current,!1)){const n=e.composedPath?.()?.[0]||e.target,i="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!r.current&&i||e.preventDefault(),o(!0)}},c=e=>{const t=Ws(e.code,l);Ks(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),r.current=!1},d=()=>{i.current.clear(),o(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function Ks(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ws(e,t){return t.includes(e)?"code":"key"}function Gs(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)Us(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function Us(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured={...e.dimensions},e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function Qs(e,t){return Gs(e,t)}function Js(e,t){return Gs(e,t)}function ea(e,t){return{id:e,type:"select",selected:t}}function ta(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ea(i.id,e)))}return o}function na({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t)void 0===o.get(e)&&n.push({id:e,type:"remove"});return n}function oa(e){return{id:e.id,type:"remove"}}const ra=(e,t)=>{};const ia=e=>(e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function sa(e){return(0,a().forwardRef)(e)}const aa="undefined"!=typeof window?a().useLayoutEffect:a().useEffect;function la(e){const[t,n]=(0,a().useState)(BigInt(0)),[o]=(0,a().useState)(()=>function(){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n(e=>e+BigInt(1))}}}());return aa(()=>{const t=o.get();t.length&&(e(t),o.reset())},[t]),o}const ca=(0,a().createContext)(null);function da({children:e}){const t=bs(),n=(0,a().useCallback)(e=>{const{nodes:n=[],setNodes:o,hasDefaultNodes:r,onNodesChange:i,nodeLookup:s,fitViewQueued:a,onNodesChangeMiddlewareMap:l}=t.getState();let c=n;for(const t of e)c="function"==typeof t?t(c):t;let d=na({items:c,lookup:s});for(const e of l.values())d=e(d);r&&o(c),d.length>0?i?.(d):a&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:n,setNodes:o}=t.getState();e&&o(n)})},[]),o=la(n),r=la((0,a().useCallback)(e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:s}=t.getState();let a=n;for(const t of e)a="function"==typeof t?t(a):t;r?o(a):i&&i(na({items:a,lookup:s}))},[])),i=(0,a().useMemo)(()=>({nodeQueue:o,edgeQueue:r}),[]);return(0,c.jsx)(ca.Provider,{value:i,children:e})}const ua=e=>!!e.panZoom;function fa(){const e=(()=>{const e=bs();return(0,a().useMemo)(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{const{panZoom:o}=e.getState();return!!o&&o.scaleTo(t,n)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return!!s&&(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),!0)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=qr(t,o,r,i,s,n?.padding??.1);return!!a&&(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},d=n.snapGrid??r,u=n.snapToGrid??i;return Yr(c,o,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Xr(t,n);return{x:s.x+r,y:s.y+i}}}),[])})(),t=bs(),n=function(){const e=(0,a().useContext)(ca);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),o=ws(ua),r=(0,a().useMemo)(()=>{const e=e=>t.getState().nodeLookup.get(e),o=e=>{n.nodeQueue.push(e)},r=e=>{n.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=ia(e)?e:n.get(e.id),i=r.parentId?Qr(r.position,r.measured,r.parentId,n,o):r.position,s={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Rr(s)},s=(e,t,n={replace:!1})=>{o(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&ia(e)?e:{...o,...e}}return o}))},a=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&_r(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:o,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,s]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:s}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:s,triggerNodeChanges:a,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:d}=t.getState(),{nodes:u,edges:f}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),s=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&s.find(t=>t.id===e.parentId);(t||n)&&s.push(e)}const a=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(s,l),d=c;for(const e of l)a.has(e.id)&&!d.find(t=>t.id===e.id)&&d.push(e);if(!r)return{edges:d,nodes:s};const u=await r({nodes:s,edges:d});return"boolean"==typeof u?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:d}),h=f.length>0,p=u.length>0;if(h){const e=f.map(oa);s?.(f),l(e)}if(p){const e=u.map(oa);i?.(u),a(e)}return(p||h)&&c?.({nodes:u,edges:f}),{deletedNodes:u,deletedEdges:f}},getIntersectingNodes:(e,n=!0,o)=>{const r=Vr(e),s=r?e:i(e),a=void 0!==o;return s?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Rr(a?o:i),c=$r(l,s);return n&&c>0||c>=l.width*l.height||c>=s.width*s.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Vr(e)?e:i(e);if(!o)return!1;const r=$r(o,t);return n&&r>0||r>=t.width*t.height||r>=o.width*o.height},updateNode:s,updateNodeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:a,updateEdgeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};let n=!1;const o=e.reduce((e,o)=>{const r="string"==typeof o;let i=t.nodeLookup||r?void 0:o;return t.nodeLookup&&(i=r?t.nodeLookup.get(o):Sr(o)?o:t.nodeLookup.get(o.id)),i?(n=!0,Or(e,Lr(i,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Ar(o):{x:0,y:0,width:0,height:0}})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const o=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:o}),n.nodeQueue.push(e=>[...e]),o.promise}}},[]);return(0,a().useMemo)(()=>({...r,...e,viewportInitialized:o}),[o])}const ha=e=>e.selected,pa="undefined"!=typeof window?window:void 0,ga={position:"absolute",width:"100%",height:"100%",top:0,left:0},ma=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ya({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panActivationKeyPressed:r,panOnScrollSpeed:i=.5,panOnScrollMode:s=gr.Free,zoomOnDoubleClick:l=!0,panOnDrag:d=!0,defaultViewport:u,translateExtent:f,minZoom:h,maxZoom:p,zoomActivationKeyCode:g,preventScrolling:m=!0,children:y,noWheelClassName:x,noPanClassName:v,onViewportChange:w,isControlledViewport:b,paneClickDistance:_,selectionOnDrag:S}){const k=bs(),C=(0,a().useRef)(null),{userSelectionActive:N,lib:E,connectionInProgress:M}=ws(ma,gs),P=qs(g),j=(0,a().useRef)();!function(e){const t=bs();(0,a().useEffect)(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const n=oi(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004","The parent container needs a width and a height to render the graph."),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(C);const D=(0,a().useCallback)(e=>{w?.({x:e[0],y:e[1],zoom:e[2]}),b||k.setState({transform:e})},[w,b]);return(0,a().useEffect)(()=>{if(C.current){j.current=Ji({domNode:C.current,minZoom:h,maxZoom:p,translateExtent:f,viewport:u,onDraggingChange:e=>k.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=k.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=k.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=k.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=j.current.getViewport();return k.setState({panZoom:j.current,transform:[e,t,n],domNode:C.current.closest(".react-flow")}),()=>{j.current?.destroy()}}},[]),(0,a().useEffect)(()=>{j.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panActivationKeyPressed:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:d,zoomActivationKeyPressed:P,preventScrolling:m,noPanClassName:v,userSelectionActive:N,noWheelClassName:x,lib:E,onTransformChange:D,connectionInProgress:M,selectionOnDrag:S,paneClickDistance:_})},[e,t,n,o,r,i,s,l,d,P,m,v,N,x,E,D,M,S,_]),(0,c.jsx)("div",{className:"react-flow__renderer",ref:C,style:ga,children:y})}const xa=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function va(){const{userSelectionActive:e,userSelectionRect:t}=ws(xa,gs);return e&&t?(0,c.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const wa=(e,t)=>n=>{n.target===t.current&&e?.(n)},ba=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function _a({isSelecting:e,selectionKeyPressed:t,selectionMode:n=mr.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:g,onPaneMouseMove:m,onPaneMouseLeave:y,children:x}){const v=(0,a().useRef)(0),w=bs(),{userSelectionActive:b,elementsSelectable:_,dragging:S,panBy:k,autoPanSpeed:C}=ws(ba,gs),N=_&&(e||b),E=(0,a().useRef)(null),M=(0,a().useRef)(),P=(0,a().useRef)(new Set),j=(0,a().useRef)(new Set),D=(0,a().useRef)(!1),I=(0,a().useRef)(!1),O=(0,a().useRef)({x:0,y:0}),z=(0,a().useRef)(!1),A=e=>{if(I.current||D.current||w.getState().connection.inProgress)return I.current=!1,void(D.current=!1);f?.(e),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=p?e=>p(e):void 0;function L(e,t){const{userSelectionRect:o}=w.getState();if(!o)return;const{transform:r,nodeLookup:i,edgeLookup:s,connectionLookup:a,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:d}=w.getState(),u={x:o.startX,y:o.startY},{x:f,y:h}=Xr(u,r),p={startX:u.x,startY:u.y,x:e<f?e:f,y:t<h?t:h,width:Math.abs(e-f),height:Math.abs(t-h)},g=P.current,m=j.current;P.current=new Set(Nr(i,p,r,n===mr.Partial,!0).map(e=>e.id)),j.current=new Set;const y=d?.selectable??!0;for(const e of P.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=s.get(e);t&&(t.selectable??y)&&j.current.add(e)}}Jr(g,P.current)||l(ta(i,P.current,!0)),Jr(m,j.current)||c(ta(s,j.current)),w.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}function T(){if(!r||!M.current)return;const[e,t]=Ir(O.current,M.current,C);k({x:e,y:t}).then(e=>{if(!I.current||!e)return void(v.current=requestAnimationFrame(T));const{x:t,y:n}=O.current;L(t,n),v.current=requestAnimationFrame(T)})}const B=()=>{cancelAnimationFrame(v.current),v.current=0,z.current=!1};(0,a().useEffect)(()=>()=>B(),[]);const $=!0===o||Array.isArray(o)&&o.includes(0);return(0,c.jsxs)("div",{className:d(["react-flow__pane",{draggable:$,dragging:S,selection:e}]),onClick:N?void 0:wa(A,E),onContextMenu:wa(e=>{Array.isArray(o)&&o?.includes(2)?e.preventDefault():h?.(e)},E),onWheel:wa(R,E),onPointerEnter:N?void 0:g,onPointerMove:N?e=>{const{userSelectionRect:n,transform:o,resetSelectedElements:r}=w.getState();if(!M.current||!n)return;const{x:s,y:a}=li(e.nativeEvent,M.current);O.current={x:s,y:a};const c=Xr({x:n.startX,y:n.startY},o);if(!I.current){const n=t?0:i;if(Math.hypot(s-c.x,a-c.y)<=n)return;r(),l?.(e)}I.current=!0,z.current||(T(),z.current=!0),L(s,a)}:m,onPointerUp:e=>{N?0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===E.current&&w.getState().userSelectionRect&&A?.(e),w.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(u?.(e),w.setState({nodesSelectionActive:P.current.size>0})),B()):e.target===E.current&&w.getState().connection.inProgress&&(D.current=!0)},onPointerCancel:N?e=>{e.target?.releasePointerCapture?.(e.pointerId),B()}:void 0,onPointerDownCapture:N?n=>{if("touch"===n.pointerType&&!1!==o&&!t)return;const{domNode:r,transform:i}=w.getState();if(M.current=r?.getBoundingClientRect(),!M.current)return;const a=n.target===E.current;if(!a&&n.target.closest(".nokey")||!e||!(s&&a||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),I.current=!1;const{x:l,y:c}=li(n.nativeEvent,M.current),d=Yr({x:l,y:c},i);w.setState({userSelectionRect:{width:0,height:0,startX:d.x,startY:d.y,x:l,y:c}}),a||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:N?e=>{I.current&&(e.stopPropagation(),I.current=!1)}:void 0,onPointerLeave:y,ref:E,style:ga,children:[x,(0,c.jsx)(va,{})]})}function Sa({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",(e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`)(e))}function ka({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const l=bs(),[c,d]=(0,a().useState)(!1),u=(0,a().useRef)();return(0,a().useEffect)(()=>{if(!t)return u.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},d=null,u=!1,f=null,h=!1,p=!1,g=null;return{update:function({noDragClassName:m,handleSelector:y,domNode:x,isSelectable:v,nodeId:w,nodeClickDistance:b=0}){function _({x:e,y:n}){const{nodeLookup:r,nodeExtent:s,snapGrid:l,snapToGrid:c,nodeOrigin:d,onNodeDrag:u,onSelectionDrag:f,onError:h,updateNodePositions:m}=t();i={x:e,y:n};let y=!1;const x=a.size>1,v=x&&s?zr(Cr(a)):null,b=x&&c?function({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Zr(i,t);return{x:s.x-i.x,y:s.y-i.y}}({dragItems:a,snapGrid:l,x:e,y:n}):null;for(const[t,o]of a){if(!r.has(t))continue;let i={x:e-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:Zr(i,l));let a=null;if(x&&s&&!o.extent&&v){const{positionAbsolute:e}=o.internals,t=e.x-v.x+s[0][0],n=e.x+o.measured.width-v.x2+s[1][0];a=[[t,e.y-v.y+s[0][1]],[n,e.y+o.measured.height-v.y2+s[1][1]]]}const{position:u,positionAbsolute:f}=Er({nodeId:t,nextPosition:i,nodeLookup:r,nodeExtent:a||s,nodeOrigin:d,onError:h});y=y||o.position.x!==u.x||o.position.y!==u.y,o.position=u,o.internals.positionAbsolute=f}if(p=p||y,y&&(m(a,!0),g&&(o||u||!w&&f))){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});o?.(g,a,e,t),u?.(g,e,t),w||f?.(g,t)}}async function S(){if(!d)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(s);const[a,u]=Ir(c,d,o);0===a&&0===u||(i.x=(i.x??0)-a/e[2],i.y=(i.y??0)-u/e[2],await n({x:a,y:u})&&_(i)),s=requestAnimationFrame(S)}function k(o){const{nodeLookup:r,multiSelectionActive:s,nodesDraggable:l,transform:c,snapGrid:f,snapToGrid:h,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();u=!0,p&&v||s||!w||r.get(w)?.selected||y(),v&&p&&w&&e?.(w);const x=ni(o.sourceEvent,{transform:c,snapGrid:f,snapToGrid:h,containerBounds:d});if(i=x,a=function(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Ti(s,e))&&(s.draggable||t&&void 0===s.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,x,w),a.size>0&&(n||g||!w&&m)){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});n?.(o.sourceEvent,a,e,t),g?.(o.sourceEvent,e,t),w||m?.(o.sourceEvent,t)}}f=dt(x);const C=Ct().clickDistance(b).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:s,snapToGrid:a}=t();d=n?.getBoundingClientRect()||null,h=!1,p=!1,g=e.sourceEvent,0===o&&k(e);const l=ni(e.sourceEvent,{transform:r,snapGrid:s,snapToGrid:a,containerBounds:d});i=l,c=li(e.sourceEvent,d)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:s,nodeDragThreshold:f,nodeLookup:p}=t(),m=ni(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:s,containerBounds:d});if(g=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||w&&!p.has(w))&&(h=!0),!h){if(!l&&n&&u&&(l=!0,S()),!u){const t=li(e.sourceEvent,d),n=t.x-c.x,o=t.y-c.y;Math.sqrt(n*n+o*o)>f&&k(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&a&&u&&(c=li(e.sourceEvent,d),_(m))}}).on("end",e=>{if(u&&!h){if(l=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:s}=t();if(p&&(o(a,!1),p=!1),r||i||!w&&s){const[t,o]=$i({nodeId:w,dragItems:a,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,a,t,o),i?.(e.sourceEvent,t,o),w||s?.(e.sourceEvent,o)}}}else h&&a.size>0&&t().updateNodePositions(a,!1)}).filter(e=>{const t=e.target;return!e.button&&(!m||!Bi(t,`.${m}`,x))&&(!y||Bi(t,y,x))});f.call(C)},destroy:function(){f?.on(".drag",null)}}}({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Sa({id:t,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,l,e]),(0,a().useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s})},[n,o,t,i,e,r,s]),c}function Ca(){const e=bs(),t=(0,a().useCallback)(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:s,updateNodePositions:a,nodeLookup:l,nodeOrigin:c}=e.getState(),d=new Map,u=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),f=o?r[0]:5,h=o?r[1]:5,p=t.direction.x*f*t.factor,g=t.direction.y*h*t.factor;for(const[,e]of l){if(!u(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};o&&(t=Zr(t,r));const{position:i,positionAbsolute:a}=Er({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:s});e.position=i,e.internals.positionAbsolute=a,d.set(e.id,e)}a(d)},[]);return t}const Na=(0,a().createContext)(null),Ea=Na.Provider;Na.Consumer;const Ma=()=>(0,a().useContext)(Na),Pa=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ja=(0,a().createContext)(null);function Da({children:e}){const t=ws(Pa,gs);return(0,c.jsx)(ja.Provider,{value:t,children:e})}const Ia={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Oa=(0,a().memo)(sa(function({type:e="source",position:t=wr.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:u,className:f,onMouseDown:h,onTouchStart:p,...g},m){const y=s||null,x="target"===e,v=bs(),w=Ma(),{connectOnClick:b,noPanClassName:_,rfId:S}=function(){const e=(0,a().useContext)(ja);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:k,connectingTo:C,clickConnecting:N,isPossibleEndHandle:E,connectionInProcess:M,clickConnectionInProcess:P,valid:j}=ws(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s;if(!a&&!r)return Ia;const d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:d,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===pr.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&c}})(w,y,e),gs);w||v.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");const D=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=v.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t,onError:n}=v.getState();t(function(e,t,n={}){return((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;const o=n.getEdgeId||mi;let r;return r=_r(e)?{...e}:{...e,id:o(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(r,t)?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r))})(e,t,{...n,onError:n.onError??ra})}(r,e,{onError:n}))}n?.(r),l?.(r)},I=e=>{if(!w)return;const t=ai(e.nativeEvent);if(r&&(t&&0===e.button||!t)){const t=v.getState();Xi.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:x,handleId:y,nodeId:w,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>v.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:D,isValidConnection:n||((...e)=>v.getState().isValidConnection?.(...e)??!0),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?h?.(e):p?.(e)};return(0,c.jsx)("div",{"data-handleid":y,"data-nodeid":w,"data-handlepos":t,"data-id":`${S}-${w}-${y}-${e}`,className:d(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,f,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:i,clickconnecting:N,connectingfrom:k,connectingto:C,valid:j,connectionindicator:o&&(!M||E)&&(M||P?i:r)}]),onMouseDown:I,onTouchStart:I,onClick:b?t=>{const{onClickConnectStart:o,onClickConnectEnd:i,connectionClickStartHandle:s,connectionMode:a,isValidConnection:l,lib:c,rfId:d,nodeLookup:u,connection:f}=v.getState();if(!w||!s&&!r)return;if(!s)return o?.(t.nativeEvent,{nodeId:w,handleId:y,handleType:e}),void v.setState({connectionClickStartHandle:{nodeId:w,type:e,id:y}});const h=ri(t.target),p=n||l,{connection:g,isValid:m}=Xi.isValid(t.nativeEvent,{handle:{nodeId:w,id:y,type:e},connectionMode:a,fromNodeId:s.nodeId,fromHandleId:s.id||null,fromType:s.type,isValidConnection:p,flowId:d,doc:h,lib:c,nodeLookup:u});m&&g&&D(g);const x=structuredClone(f);delete x.inProgress,x.toPosition=x.toHandle?x.toHandle.position:null,i?.(t,x),v.setState({connectionClickStartHandle:null})}:void 0,ref:m,...g,children:u})})),za={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Aa={input:function({data:e,isConnectable:t,sourcePosition:n=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[e?.label,(0,c.jsx)(Oa,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=wr.Top,sourcePosition:o=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label,(0,c.jsx)(Oa,{type:"source",position:o,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=wr.Top}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},Ra=e=>{const{width:t,height:n,x:o,y:r}=Cr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Hr(t)?t:null,height:Hr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function La({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=bs(),{width:r,height:i,transformString:s,userSelectionActive:l}=ws(Ra,gs),u=Ca(),f=(0,a().useRef)(null);(0,a().useEffect)(()=>{n||f.current?.focus({preventScroll:!0})},[n]);const h=!l&&null!==r&&null!==i;if(ka({nodeRef:f,disabled:!h}),!h)return null;const p=e?t=>{const n=o.getState().nodes.filter(e=>e.selected);e(t,n)}:void 0;return(0,c.jsx)("div",{className:d(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:(0,c.jsx)("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(za,e.key)&&(e.preventDefault(),u({direction:za[e.key],factor:e.shiftKey?4:1}))},style:{width:r,height:i}})})}const Ta="undefined"!=typeof window?window:void 0,Ba=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function $a({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:x,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:N,autoPanOnSelection:E,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,preventScrolling:I,onSelectionContextMenu:O,noWheelClassName:z,noPanClassName:A,disableKeyboardA11y:R,onViewportChange:L,isControlledViewport:T}){const{nodesSelectionActive:B,userSelectionActive:$}=ws(Ba,gs),V=qs(u,{target:Ta}),H=qs(y,{target:Ta}),Z=H||N,Y=H||_,X=f&&!0!==Z,F=V||$||X;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=bs(),{deleteElements:o}=fa(),r=qs(e,{actInsideInputWithModifier:!1}),i=qs(t,{target:pa});(0,a().useEffect)(()=>{if(r){const{edges:e,nodes:t}=n.getState();o({nodes:t.filter(ha),edges:e.filter(ha)}),n.setState({nodesSelectionActive:!1})}},[r]),(0,a().useEffect)(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:d,multiSelectionKeyCode:m}),(0,c.jsx)(ya,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:Y,panActivationKeyPressed:H,panOnScrollSpeed:S,panOnScrollMode:k,zoomOnDoubleClick:C,panOnDrag:!V&&Z,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,zoomActivationKeyCode:x,preventScrolling:I,noWheelClassName:z,noPanClassName:A,onViewportChange:L,isControlledViewport:T,paneClickDistance:l,selectionOnDrag:X,children:(0,c.jsxs)(_a,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:Z,autoPanOnSelection:E,isSelecting:!!F,selectionMode:h,selectionKeyPressed:V,paneClickDistance:l,selectionOnDrag:X,children:[e,B&&(0,c.jsx)(La,{onSelectionContextMenu:O,noPanClassName:A,disableKeyboardA11y:R})]})})}$a.displayName="FlowRenderer";const Va=(0,a().memo)($a);const Ha=e=>e.updateNodeInternals;var Za=(0,a().memo)(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:f,nodesFocusable:h,resizeObserver:p,noDragClassName:g,noPanClassName:m,disableKeyboardA11y:y,rfId:x,nodeTypes:v,nodeClickDistance:w,onError:b}){const{node:_,internals:S,isParent:k}=ws(t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}},gs);let C=_.type||"default",N=v?.[C]||Aa[C];void 0===N&&(b?.("003",(e=>`Node type "${e}" not found. Using fallback type "default".`)(C)),C="default",N=v?.default||Aa.default);const E=!!(_.draggable||l&&void 0===_.draggable),M=!!(_.selectable||u&&void 0===_.selectable),P=!!(_.connectable||f&&void 0===_.connectable),j=!!(_.focusable||h&&void 0===_.focusable),D=bs(),I=Ur(_),O=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=bs(),i=(0,a().useRef)(null),s=(0,a().useRef)(null),l=(0,a().useRef)(e.sourcePosition),c=(0,a().useRef)(e.targetPosition),d=(0,a().useRef)(t),u=n&&!!e.internals.handleBounds;return(0,a().useEffect)(()=>{!i.current||e.hidden||u&&s.current===i.current||(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),(0,a().useEffect)(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),(0,a().useEffect)(()=>{if(i.current){const n=d.current!==t,o=l.current!==e.sourcePosition,s=c.current!==e.targetPosition;(n||o||s)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:_,nodeType:C,hasDimensions:I,resizeObserver:p}),z=ka({nodeRef:O,disabled:_.hidden||!E,noDragClassName:g,handleSelector:_.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:w}),A=Ca();if(_.hidden)return null;const R=Gr(_),L=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(_),T=M||E||t||n||o||r,B=n?e=>n(e,{...S.userNode}):void 0,$=o?e=>o(e,{...S.userNode}):void 0,V=r?e=>r(e,{...S.userNode}):void 0,H=i?e=>i(e,{...S.userNode}):void 0,Z=s?e=>s(e,{...S.userNode}):void 0;return(0,c.jsx)("div",{className:d(["react-flow__node",`react-flow__node-${C}`,{[m]:E},_.className,{selected:_.selected,selectable:M,parent:k,draggable:E,dragging:z}]),ref:O,style:{zIndex:S.z,transform:`translate(${S.positionAbsolute.x}px,${S.positionAbsolute.y}px)`,pointerEvents:T?"all":"none",visibility:I?"visible":"hidden",..._.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:B,onMouseMove:$,onMouseLeave:V,onContextMenu:H,onClick:n=>{const{selectNodesOnDrag:o,nodeDragThreshold:r}=D.getState();M&&(!o||!E||r>0)&&Sa({id:e,store:D,nodeRef:O}),t&&t(n,{...S.userNode})},onDoubleClick:Z,onKeyDown:j?t=>{if(!si(t.nativeEvent)&&!y)if(fr.includes(t.key)&&M){const n="Escape"===t.key;Sa({id:e,store:D,unselect:n,nodeRef:O})}else if(E&&_.selected&&Object.prototype.hasOwnProperty.call(za,t.key)){t.preventDefault();const{ariaLabelConfig:e}=D.getState();D.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~S.positionAbsolute.x,y:~~S.positionAbsolute.y})}),A({direction:za[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:j?0:void 0,onFocus:j?()=>{if(y||!O.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=D.getState();r&&(Nr(new Map([[e,_]]),{x:0,y:0,width:n,height:o},t,!0).length>0||i(_.position.x+R.width/2,_.position.y+R.height/2,{zoom:t[2]}))}:void 0,role:_.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${ks}-${x}`,"aria-label":_.ariaLabel,..._.domAttributes,children:(0,c.jsx)(Ea,{value:e,children:(0,c.jsx)(N,{id:e,data:_.data,type:C,positionAbsoluteX:S.positionAbsolute.x,positionAbsoluteY:S.positionAbsolute.y,selected:_.selected??!1,selectable:M,draggable:E,deletable:_.deletable??!0,isConnectable:P,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:z,dragHandle:_.dragHandle,zIndex:S.z,parentId:_.parentId,...R})})})});const Ya=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Xa(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=ws(Ya,gs),i=function(e){const t=ws((0,a().useCallback)((e=>t=>e?Nr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),gs);return t}(e.onlyRenderVisibleElements),s=function(){const e=ws(Ha),[t]=(0,a().useState)(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,a().useEffect)(()=>()=>{t?.disconnect()},[t]),t}();return(0,c.jsx)("div",{className:"react-flow__nodes",style:ga,children:i.map(i=>(0,c.jsx)(Za,{id:i,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:r},i))})}Xa.displayName="NodeRenderer";const Fa=(0,a().memo)(Xa),qa={[vr.Arrow]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return(0,c.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[vr.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,c.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},Ka=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const d=function(e){const t=bs();return(0,a().useMemo)(()=>Object.prototype.hasOwnProperty.call(qa,e)?qa[e]:(t.getState().onError?.("009",(e=>`Marker type "${e}" doesn't exist.`)(e)),null),[e])}(t);return d?(0,c.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:(0,c.jsx)(d,{color:n,strokeWidth:s})}):null},Wa=({defaultColor:e,rfId:t})=>{const n=ws(e=>e.edges),o=ws(e=>e.defaultEdgeOptions),r=(0,a().useMemo)(()=>{const r=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,s)=>([s.markerStart||o,s.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=Ni(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd});return r},[n,o,t,e]);return r.length?(0,c.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,c.jsx)("defs",{children:r.map(e=>(0,c.jsx)(Ka,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Wa.displayName="MarkerDefinitions";var Ga=(0,a().memo)(Wa);function Ua({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:f,...h}){const[p,g]=(0,a().useState)({x:1,y:0,width:0,height:0}),m=d(["react-flow__edge-textwrapper",f]),y=(0,a().useRef)(null);return(0,a().useEffect)(()=>{if(y.current){const e=y.current.getBBox();g({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,c.jsxs)("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:m,visibility:p.width?"visible":"hidden",...h,children:[r&&(0,c.jsx)("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),(0,c.jsx)("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:y,style:o,children:n}),u]}):null}Ua.displayName="EdgeText";const Qa=(0,a().memo)(Ua);function Ja({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:u=20,...f}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("path",{...f,d:e,fill:"none",className:d(["react-flow__edge-path",f.className])}),u?(0,c.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,o&&Hr(t)&&Hr(n)?(0,c.jsx)(Qa,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function el({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===wr.Left||e===wr.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function tl({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top}){const[s,a]=el({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=el({pos:i,x1:o,y1:r,x2:e,y2:t}),[d,u,f,h]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,d,u,f,h]}function nl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})=>{const[v,w,b]=tl({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),_=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:_,path:v,labelX:w,labelY:b,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})})}const ol=nl({isInternal:!1}),rl=nl({isInternal:!0});function il(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,sourcePosition:p=wr.Bottom,targetPosition:g=wr.Top,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=bi({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:g,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),S=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:S,path:w,labelX:b,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:y,interactionWidth:v})})}ol.displayName="SimpleBezierEdge",rl.displayName="SimpleBezierEdgeInternal";const sl=il({isInternal:!1}),al=il({isInternal:!0});function ll(e){return(0,a().memo)(({id:t,...n})=>{const o=e.isInternal?void 0:t;return(0,c.jsx)(sl,{...n,id:o,pathOptions:(0,a().useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}sl.displayName="SmoothStepEdge",al.displayName="SmoothStepEdgeInternal";const cl=ll({isInternal:!1}),dl=ll({isInternal:!0});function ul(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})=>{const[y,x,v]=yi({sourceX:n,sourceY:o,targetX:r,targetY:i}),w=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:w,path:y,labelX:x,labelY:v,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})})}cl.displayName="StepEdge",dl.displayName="StepEdgeInternal";const fl=ul({isInternal:!1}),hl=ul({isInternal:!0});function pl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=wr.Bottom,targetPosition:a=wr.Top,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=hi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:x?.curvature}),S=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:S,path:w,labelX:b,labelY:_,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})})}fl.displayName="StraightEdge",hl.displayName="StraightEdgeInternal";const gl=pl({isInternal:!1}),ml=pl({isInternal:!0});gl.displayName="BezierEdge",ml.displayName="BezierEdgeInternal";const yl={default:ml,straight:hl,step:dl,smoothstep:al,simplebezier:rl},xl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},vl=(e,t,n)=>n===wr.Left?e-t:n===wr.Right?e+t:e,wl=(e,t,n)=>n===wr.Top?e-t:n===wr.Bottom?e+t:e,bl="react-flow__edgeupdater";function _l({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return(0,c.jsx)("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:d([bl,`${bl}-${a}`]),cx:vl(t,o,e),cy:wl(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function Sl({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:d,onReconnectStart:u,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=bs(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:o,domNode:r,connectionMode:i,connectionRadius:s,lib:a,onConnectStart:l,cancelConnection:c,nodeLookup:p,rfId:m,panBy:y,updateConnection:x}=g.getState(),v="target"===t.type;Xi.onPointerDown(e.nativeEvent,{autoPanOnConnect:o,connectionMode:i,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:p,isTarget:v,edgeUpdaterType:t.type,lib:a,flowId:m,cancelConnection:c,panBy:y,isValidConnection:(...e)=>g.getState().isValidConnection?.(...e)??!0,onConnect:e=>d?.(n,e),onConnectStart:(o,r)=>{h(!0),u?.(e,n,t.type),l?.(o,r)},onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),onReconnectEnd:(e,o)=>{h(!1),f?.(e,n,t.type,o)},updateConnection:x,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},y=()=>p(!0),x=()=>p(!1);return(0,c.jsxs)(c.Fragment,{children:[(!0===e||"source"===e)&&(0,c.jsx)(_l,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:e=>m(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:x,type:"source"}),(!0===e||"target"===e)&&(0,c.jsx)(_l,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:e=>m(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:x,type:"target"})]})}var kl=(0,a().memo)(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,rfId:y,edgeTypes:x,noPanClassName:v,onError:w,disableKeyboardA11y:b}){let _=ws(t=>t.edgeLookup.get(e));const S=ws(e=>e.defaultEdgeOptions);_=S?{...S,..._}:_;let k=_.type||"default",C=x?.[k]||yl[k];void 0===C&&(w?.("011",(e=>`Edge type "${e}" not found. Using fallback type "default".`)(k)),k="default",C=x?.default||yl.default);const N=!!(_.focusable||t&&void 0===_.focusable),E=void 0!==p&&(_.reconnectable||n&&void 0===_.reconnectable),M=!!(_.selectable||o&&void 0===_.selectable),P=(0,a().useRef)(null),[j,D]=(0,a().useState)(!1),[I,O]=(0,a().useState)(!1),z=bs(),{zIndex:A=_.zIndex,sourceX:R,sourceY:L,targetX:T,targetY:B,sourcePosition:$,targetPosition:V}=ws((0,a().useCallback)(t=>{const n=t.nodeLookup.get(_.source),o=t.nodeLookup.get(_.target);if(!n||!o)return xl;const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;const o=t.internals.handleBounds||Si(t.handles),r=n.internals.handleBounds||Si(n.handles),i=Ci(o?.source??[],e.sourceHandle),s=Ci(e.connectionMode===pr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`)(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||wr.Bottom,l=s?.position||wr.Top,c=ki(t,i,a),d=ki(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}({id:e,sourceNode:n,targetNode:o,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:t.connectionMode,onError:w}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){return"manual"===i?o:(r&&n?o+1e3:o)+Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0)}({selected:_.selected,zIndex:_.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...r||xl,zIndex:i}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex,w]),gs),H=(0,a().useMemo)(()=>_.markerStart?`url('#${Ni(_.markerStart,y)}')`:void 0,[_.markerStart,y]),Z=(0,a().useMemo)(()=>_.markerEnd?`url('#${Ni(_.markerEnd,y)}')`:void 0,[_.markerEnd,y]);if(_.hidden||null===R||null===L||null===T||null===B)return null;const Y=i?e=>{i(e,{..._})}:void 0,X=s?e=>{s(e,{..._})}:void 0,F=l?e=>{l(e,{..._})}:void 0,q=u?e=>{u(e,{..._})}:void 0,K=f?e=>{f(e,{..._})}:void 0;return(0,c.jsx)("svg",{style:{zIndex:A},children:(0,c.jsxs)("g",{className:d(["react-flow__edge",`react-flow__edge-${k}`,_.className,v,{selected:_.selected,animated:_.animated,inactive:!M&&!r,updating:j,selectable:M}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:o,multiSelectionActive:i}=z.getState();M&&(z.setState({nodesSelectionActive:!1}),_.selected&&i?(o({nodes:[],edges:[_]}),P.current?.blur()):n([e])),r&&r(t,_)},onDoubleClick:Y,onContextMenu:X,onMouseEnter:F,onMouseMove:q,onMouseLeave:K,onKeyDown:N?t=>{if(!b&&fr.includes(t.key)&&M){const{unselectNodesAndEdges:n,addSelectedEdges:o}=z.getState();"Escape"===t.key?(P.current?.blur(),n({edges:[_]})):o([e])}}:void 0,tabIndex:N?0:void 0,role:_.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===_.ariaLabel?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":N?`${Cs}-${y}`:void 0,ref:P,..._.domAttributes,children:[!I&&(0,c.jsx)(C,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:M,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:R,sourceY:L,targetX:T,targetY:B,sourcePosition:$,targetPosition:V,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:H,markerEnd:Z,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),E&&(0,c.jsx)(Sl,{edge:_,isReconnectable:E,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,sourceX:R,sourceY:L,targetX:T,targetY:B,sourcePosition:$,targetPosition:V,setUpdateHover:D,setReconnecting:O})]})})});const Cl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Nl({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,onError:b}=ws(Cl,gs),_=(S=t,ws((0,a().useCallback)(e=>{if(!S)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&gi({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[S]),gs));var S;return(0,c.jsxs)("div",{className:"react-flow__edges",children:[(0,c.jsx)(Ga,{defaultColor:e,rfId:n}),_.map(e=>(0,c.jsx)(kl,{id:e,edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:d,onMouseLeave:u,onClick:f,reconnectRadius:h,onDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:o,disableKeyboardA11y:y},e))]})}Nl.displayName="EdgeRenderer";const El=(0,a().memo)(Nl),Ml=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Pl({children:e}){const t=bs(),n=(0,a().useRef)(null),[o]=(0,a().useState)(()=>t.getState().transform);return aa(()=>{let e=null;const o=()=>{const o=t.getState().transform;e&&o[0]===e[0]&&o[1]===e[1]&&o[2]===e[2]||(e=o,n.current&&(n.current.style.transform=Ml(o)))};return o(),t.subscribe(o)},[t]),(0,c.jsx)("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Ml(o)},children:e})}const jl=e=>e.panZoom?.syncViewport;function Dl(e){return e.connection.inProgress?{...e.connection,to:Yr(e.connection.to,e.transform)}:{...e.connection}}const Il=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ol({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=ws(Il,gs);return i&&r&&l?(0,c.jsx)("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:(0,c.jsx)("g",{className:d(["react-flow__connection",ti(a)]),children:(0,c.jsx)(zl,{style:t,type:n,CustomComponent:o,isValid:a})})}):null}const zl=({style:e,type:t=xr.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:d,toNode:u,toHandle:f,toPosition:h,pointer:p}=ws(function(e){return e?t=>{const n=Dl(t);return e(n)}:Dl}(g),gs);var g;if(!r)return;if(n)return(0,c.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:l,toPosition:h,connectionStatus:ti(o),toNode:u,toHandle:f,pointer:p});let m="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:d.x,targetY:d.y,targetPosition:h};switch(t){case xr.Bezier:[m]=hi(y);break;case xr.SimpleBezier:[m]=tl(y);break;case xr.Step:[m]=bi({...y,borderRadius:0});break;case xr.SmoothStep:[m]=bi(y);break;default:[m]=yi(y)}return(0,c.jsx)("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};zl.displayName="ConnectionLine";const Al={};function Rl(e=Al){(0,a().useRef)(e),bs(),(0,a().useEffect)(()=>{},[e])}function Ll({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:p,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:v,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,deleteKeyCode:N,onlyRenderVisibleElements:E,elementsSelectable:M,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,preventScrolling:O,defaultMarkerColor:z,zoomOnScroll:A,zoomOnPinch:R,panOnScroll:L,panOnScrollSpeed:T,panOnScrollMode:B,zoomOnDoubleClick:$,panOnDrag:V,autoPanOnSelection:H,onPaneClick:Z,onPaneMouseEnter:Y,onPaneMouseMove:X,onPaneMouseLeave:F,onPaneScroll:q,onPaneContextMenu:K,paneClickDistance:W,nodeClickDistance:G,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,viewport:ue,onViewportChange:fe,nodesDraggable:he}){return Rl(e),Rl(t),bs(),(0,a().useRef)(!1),(0,a().useEffect)(()=>{},[]),function(e){const t=fa(),n=(0,a().useRef)(!1);(0,a().useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(n),function(e){const t=ws(jl),n=bs();(0,a().useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(ue),(0,c.jsx)(Va,{onPaneClick:Z,onPaneMouseEnter:Y,onPaneMouseMove:X,onPaneMouseLeave:F,onPaneContextMenu:K,onPaneScroll:q,paneClickDistance:W,deleteKeyCode:N,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:C,elementsSelectable:M,zoomOnScroll:A,zoomOnPinch:R,zoomOnDoubleClick:$,panOnScroll:L,panOnScrollSpeed:T,panOnScrollMode:B,panOnDrag:V,autoPanOnSelection:H,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,onSelectionContextMenu:h,preventScrolling:O,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,onViewportChange:fe,isControlledViewport:!!ue,children:(0,c.jsxs)(Pl,{children:[(0,c.jsx)(El,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,onlyRenderVisibleElements:E,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,defaultMarkerColor:z,noPanClassName:ae,disableKeyboardA11y:le,rfId:de}),(0,c.jsx)(Ol,{style:y,type:m,component:x,containerStyle:v}),(0,c.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,c.jsx)(Fa,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:G,onlyRenderVisibleElements:E,noPanClassName:ae,noDragClassName:ie,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,nodesDraggable:he}),(0,c.jsx)("div",{className:"react-flow__viewport-portal"})]})})}Ll.displayName="GraphView";const Tl=(0,a().memo)(Ll),Bl=(e,t)=>{},$l=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,p=new Map,g=new Map,m=new Map,y=o??t??[],x=n??e??[],v=d??[0,0],w=u??ur;Li(g,m,y);const{nodesInitialized:b}=Ii(x,h,p,{nodeOrigin:v,nodeExtent:w,zIndexMode:f});let _=[0,0,1];if(s&&r&&i){const e=Cr(h,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=qr(e,r,i,l,c,a?.padding??.1);_=[t,n,o]}return{rfId:"1",width:r??0,height:i??0,transform:_,nodes:x,nodesInitialized:b,nodeLookup:h,parentLookup:p,edges:y,edgeLookup:m,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:ur,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:pr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...yr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Bl,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:hr,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},Vl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>{return h=(h,p)=>{async function g(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:s,maxZoom:a}=p();t&&(await async function({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(0===e.size)return!0;const a=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let r;if(t?.includeHiddenNodes){const{width:t,height:n}=Gr(e);r=t>0&&n>0}else r=Boolean(e.measured.width&&e.measured.height&&!e.hidden);!r||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,s),l=Cr(a),c=qr(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}({nodes:e,width:r,height:i,panZoom:t,minZoom:s,maxZoom:a},n),o?.resolve(!0),h({fitViewResolver:null}))}return{...$l({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,fitViewQueued:s,zIndexMode:a,nodesSelectionActive:l}=p(),{nodesInitialized:c,hasSelectedNodes:d}=Ii(e,t,n,{nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:a}),u=l&&d;s&&c?(g(),h({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):h({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=p();Li(t,n,e),h({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=p();t(e),h({hasDefaultNodes:!0})}if(t){const{setEdges:e}=p();e(t),h({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:s,debug:a,fitViewQueued:l,zIndexMode:c}=p(),{changes:d,updatedInternals:u}=function(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),l=!0;continue}const a=oi(o.nodeElement),d=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(d||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),p=Wr(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;if(e.parentId&&"parent"===e.extent){const n=t.get(e.parentId);n&&(g=jr(g,a,n))}else p&&(g=Pr(g,p,a));const m={...e,measured:a,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:ci("source",o.nodeElement,h,u,e.id),target:ci("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,m),e.parentId&&Oi(m,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,d&&(c.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Rr(m,r)}))}}if(f.length>0){const e=Ai(f,t,n,r);c.push(...e)}return{changes:c,updatedInternals:l}}(e,n,o,r,i,s,c);u&&(function(e,t,n){const o=Pi(Ei,n);for(const n of e.values())if(n.parentId)Oi(n,e,t,o);else{const e=kr(n,o.nodeOrigin),t=Wr(n.extent)?n.extent:o.nodeExtent,r=Pr(e,t,Gr(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:s,zIndexMode:c}),l?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),d?.length>0&&(a&&console.log("React Flow: trigger node changes",d),t?.(d)))},updateNodePositions:(e,t=!1)=>{const n=[];let o=[];const{nodeLookup:r,triggerNodeChanges:i,connection:s,updateConnection:a,onNodesChangeMiddlewareMap:l}=p();for(const[i,l]of e){const e=r.get(i),c=!!(e?.expandParent&&e?.parentId&&l?.position),d={id:i,type:"position",position:c?{x:Math.max(0,l.position.x),y:Math.max(0,l.position.y)}:l.position,dragging:t};if(e&&s.inProgress&&s.fromNode.id===e.id){const t=ki(e,s.fromHandle,wr.Left,!0);a({...s,from:t})}c&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...l.internals.positionAbsolute,width:l.measured.width??0,height:l.measured.height??0}}),o.push(d)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),i=Ai(n,r,e,t);o.push(...i)}for(const e of l.values())o=e(o);i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=p();e?.length&&(r&&n(Qs(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=p();e?.length&&(r&&n(Js(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?r(e.map(e=>ea(e,!0))):(r(ta(o,new Set([...e]),!0)),i(ta(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?i(e.map(e=>ea(e,!0))):(i(ta(n,new Set([...e]))),r(ta(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:s}=p(),a=e||o,l=t||n,c=[];for(const e of a){if(!e.selected)continue;const t=r.get(e.id);t&&(t.selected=!1),c.push(ea(e.id,!1))}const d=[];for(const e of l)e.selected&&d.push(ea(e.id,!1));i(c),s(d)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),h({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),h({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),h({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=p();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]),s=e.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]);n(i),o(s)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:s,zIndexMode:a}=p();e[0][0]===s[0][0]&&e[0][1]===s[0][1]&&e[1][0]===s[1][0]&&e[1][1]===s[1][1]||(Ii(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1,zIndexMode:a}),h({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=p();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:s}=p();if(!s)return!1;const a=void 0!==n?.zoom?n.zoom:i;return await s.setViewport({x:o/2-e*a,y:r/2-t*a,zoom:a},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{h({connection:{...yr}})},updateConnection:e=>{h({connection:e})},reset:()=>h({...$l()})}},p=Object.is,h?ps(h,p):ps;var h,p};function Hl({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:d,fitView:u,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:g}){const[m]=(0,a().useState)(()=>Vl({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:u,minZoom:s,maxZoom:l,fitViewOptions:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}));return(0,c.jsx)(xs,{value:m,children:(0,c.jsx)(da,{children:(0,c.jsx)(Da,{children:g})})})}function Zl({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:l,fitViewOptions:d,minZoom:u,maxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g}){return(0,a().useContext)(ys)?(0,c.jsx)(c.Fragment,{children:e}):(0,c.jsx)(Hl,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:d,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g,children:e})}const Yl={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Xl=sa(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:f,onMove:h,onMoveStart:p,onMoveEnd:g,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onSelectionChange:I,onSelectionDragStart:O,onSelectionDrag:z,onSelectionDragStop:A,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:T,onBeforeDelete:B,connectionMode:$,connectionLineType:V=xr.Bezier,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:Y,deleteKeyCode:X="Backspace",selectionKeyCode:F="Shift",selectionOnDrag:q=!1,selectionMode:K=mr.Full,panActivationKeyCode:W="Space",multiSelectionKeyCode:G=(Kr()?"Meta":"Control"),zoomActivationKeyCode:U=(Kr()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:se=Bs,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:de=$s,minZoom:ue=.5,maxZoom:fe=2,translateExtent:he=ur,preventScrolling:pe=!0,nodeExtent:ge,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:xe=!0,panOnScroll:ve=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=gr.Free,zoomOnDoubleClick:_e=!0,panOnDrag:Se=!0,onPaneClick:ke,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je=1,nodeClickDistance:De=0,children:Ie,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:$e,reconnectRadius:Ve=10,onNodesChange:He,onEdgesChange:Ze,noDragClassName:Ye="nodrag",noWheelClassName:Xe="nowheel",noPanClassName:Fe="nopan",fitView:qe,fitViewOptions:Ke,connectOnClick:We,attributionPosition:Ge,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je=!0,elevateEdgesOnSelect:et=!1,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanOnSelection:rt=!0,autoPanSpeed:it,connectionRadius:st,isValidConnection:at,onError:lt,style:ct,id:dt,nodeDragThreshold:ut,connectionDragThreshold:ft,viewport:ht,onViewportChange:pt,width:gt,height:mt,colorMode:yt="light",debug:xt,onScroll:vt,ariaLabelConfig:wt,zIndexMode:bt="basic",..._t},St){const kt=dt||"1",Ct=function(e){const[t,n]=(0,a().useState)("system"===e?null:e);return(0,a().useEffect)(()=>{if("system"!==e)return void n(e);const t=Xs(),o=()=>n(t?.matches?"dark":"light");return o(),t?.addEventListener("change",o),()=>{t?.removeEventListener("change",o)}},[e]),null!==t?t:Xs()?.matches?"dark":"light"}(yt),Nt=(0,a().useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return(0,c.jsx)("div",{"data-testid":"rf__wrapper",..._t,onScroll:Nt,style:{...ct,...Yl},ref:St,className:d(["react-flow",r,Ct]),id:dt,role:"application",children:(0,c.jsxs)(Zl,{nodes:e,edges:t,width:gt,height:mt,fitView:qe,fitViewOptions:Ke,minZoom:ue,maxZoom:fe,nodeOrigin:se,nodeExtent:ge,zIndexMode:bt,children:[(0,c.jsx)(Ys,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:ue,maxZoom:fe,nodeExtent:ge,onNodesChange:He,onEdgesChange:Ze,snapToGrid:Q,snapGrid:J,connectionMode:$,translateExtent:he,connectOnClick:We,defaultEdgeOptions:Qe,fitView:qe,fitViewOptions:Ke,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onSelectionDrag:z,onSelectionDragStart:O,onSelectionDragStop:A,onMove:h,onMoveStart:p,onMoveEnd:g,noPanClassName:Fe,nodeOrigin:se,rfId:kt,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:it,onError:lt,connectionRadius:st,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:ft,onBeforeDelete:B,debug:xt,ariaLabelConfig:wt,zIndexMode:bt}),(0,c.jsx)(Tl,{onInit:f,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:S,onNodeContextMenu:k,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:s,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:Y,selectionKeyCode:F,selectionOnDrag:q,selectionMode:K,deleteKeyCode:X,multiSelectionKeyCode:G,panActivationKeyCode:W,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:de,translateExtent:he,minZoom:ue,maxZoom:fe,preventScrolling:pe,zoomOnScroll:ye,zoomOnPinch:xe,zoomOnDoubleClick:_e,panOnScroll:ve,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:Se,autoPanOnSelection:rt,onPaneClick:ke,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je,nodeClickDistance:De,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:T,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Te,onEdgeMouseMove:Be,onEdgeMouseLeave:$e,reconnectRadius:Ve,defaultMarkerColor:me,noDragClassName:Ye,noWheelClassName:Xe,noPanClassName:Fe,rfId:kt,disableKeyboardA11y:tt,nodeExtent:ge,viewport:ht,onViewportChange:pt,nodesDraggable:ne}),(0,c.jsx)(Ts,{onSelectionChange:I}),Ie,(0,c.jsx)(Is,{proOptions:Ue,position:Ge}),(0,c.jsx)(Ps,{rfId:kt,disableKeyboardA11y:tt})]})})});const Fl=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function ql({children:e}){const t=ws(Fl);return t?(0,ms.createPortal)(e,t):null}function Kl({dimensions:e,lineWidth:t,variant:n,className:o}){return(0,c.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:d(["react-flow__background-pattern",n,o])})}function Wl({radius:e,className:t}){return(0,c.jsx)("circle",{cx:e,cy:e,r:e,className:d(["react-flow__background-pattern","dots",t])})}var Gl;!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Gl||(Gl={}));const Ul={[Gl.Dots]:1,[Gl.Lines]:1,[Gl.Cross]:6},Ql=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Jl({id:e,variant:t=Gl.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:l,style:u,className:f,patternClassName:h}){const p=(0,a().useRef)(null),{transform:g,patternId:m}=ws(Ql,gs),y=o||Ul[t],x=t===Gl.Dots,v=t===Gl.Cross,w=Array.isArray(n)?n:[n,n],b=[w[0]*g[2]||1,w[1]*g[2]||1],_=y*g[2],S=Array.isArray(i)?i:[i,i],k=v?[_,_]:b,C=[S[0]*g[2]+k[0]/2,S[1]*g[2]+k[1]/2],N=`${m}${e||""}`;return(0,c.jsxs)("svg",{className:d(["react-flow__background",f]),style:{...u,...ga,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:p,"data-testid":"rf__background",children:[(0,c.jsx)("pattern",{id:N,x:g[0]%b[0],y:g[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:x?(0,c.jsx)(Wl,{radius:_/2,className:h}):(0,c.jsx)(Kl,{dimensions:k,lineWidth:r,variant:t,className:h})}),(0,c.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}Jl.displayName="Background";const ec=(0,a().memo)(Jl);function tc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,c.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function nc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,c.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function oc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,c.jsx)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function rc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ic(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sc({children:e,className:t,...n}){return(0,c.jsx)("button",{type:"button",className:d(["react-flow__controls-button",t]),...n,children:e})}const ac=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function lc({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:u,children:f,position:h="bottom-left",orientation:p="vertical","aria-label":g}){const m=bs(),{isInteractive:y,minZoomReached:x,maxZoomReached:v,ariaLabelConfig:w}=ws(ac,gs),{zoomIn:b,zoomOut:_,fitView:S}=fa(),k="horizontal"===p?"horizontal":"vertical";return(0,c.jsxs)(js,{className:d(["react-flow__controls",k,u]),position:h,style:e,"data-testid":"rf__controls","aria-label":g??w["controls.ariaLabel"],children:[t&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(sc,{onClick:()=>{b(),i?.()},className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:v,children:(0,c.jsx)(tc,{})}),(0,c.jsx)(sc,{onClick:()=>{_(),s?.()},className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:x,children:(0,c.jsx)(nc,{})})]}),n&&(0,c.jsx)(sc,{className:"react-flow__controls-fitview",onClick:()=>{S(r),a?.()},title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:(0,c.jsx)(oc,{})}),o&&(0,c.jsx)(sc,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),l?.(!y)},title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:y?(0,c.jsx)(ic,{}):(0,c.jsx)(rc,{})}),f]})}lc.displayName="Controls";const cc=(0,a().memo)(lc),dc=(0,a().memo)(function({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:u,borderRadius:f,shapeRendering:h,selected:p,onClick:g}){const{background:m,backgroundColor:y}=i||{},x=s||m||y;return(0,c.jsx)("rect",{className:d(["react-flow__minimap-node",{selected:p},u]),x:t,y:n,rx:f,ry:f,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:l},shapeRendering:h,onClick:g?t=>g(t,e):void 0})}),uc=e=>e.nodes.map(e=>e.id),fc=e=>e instanceof Function?e:()=>e,hc=(0,a().memo)(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:d,x:u,y:f,width:h,height:p}=ws(t=>{const n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};const o=n.internals.userNode,{x:r,y:i}=n.internals.positionAbsolute,{width:s,height:a}=Gr(o);return{node:o,x:r,y:i,width:s,height:a}},gs);return d&&!d.hidden&&Ur(d)?(0,c.jsx)(a,{x:u,y:f,width:h,height:p,style:d.style,selected:!!d.selected,className:o(d),color:t(d),borderRadius:r,strokeColor:n(d),strokeWidth:i,shapeRendering:s,onClick:l,id:d.id}):null});var pc=(0,a().memo)(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=dc,onClick:s}){const a=ws(uc,gs),l=fc(t),d=fc(e),u=fc(n),f="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,c.jsx)(c.Fragment,{children:a.map(e=>(0,c.jsx)(hc,{id:e,nodeColorFunc:l,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:f},e))})});const gc=e=>!e.hidden,mc=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};let n=!1;for(const t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?Tr(Cr(e.nodeLookup,{filter:gc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},yc=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,xc=(e,t)=>yc(e.viewBB,t.viewBB)&&yc(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function vc({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:f,maskStrokeColor:h,maskStrokeWidth:p,position:g="bottom-right",onClick:m,onNodeClick:y,pannable:x=!1,zoomable:v=!1,ariaLabel:w,inversePan:b,zoomStep:_=1,offsetScale:S=5}){const k=bs(),C=(0,a().useRef)(null),{boundingRect:N,panZoom:E,viewBB:M,rfId:P,translateExtent:j,flowWidth:D,flowHeight:I,ariaLabelConfig:O}=ws(mc,xc),z=e?.width??200,A=e?.height??150,R=N.width/z,L=N.height/A,T=Math.max(R,L),B=T*z,$=T*A,V=S*T,H=N.x-(B-N.width)/2-V,Z=N.y-($-N.height)/2-V,Y=B+2*V,X=$+2*V,F=`react-flow__minimap-desc-${P}`,q=(0,a().useRef)(0),K=(0,a().useRef)();q.current=T,(0,a().useEffect)(()=>{const e=k.getState().panZoom;if(C.current&&e)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=dt(e);return{update:function({translateExtent:e,width:i,height:s,zoomStep:a=1,pannable:l=!0,zoomable:c=!0,inversePan:d=!1}){let u=[0,0];const f=ir().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(u=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const a=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-u[0],l[1]-u[1]];u=l;const f=o()*Math.max(a[2],Math.log(a[2]))*(d?-1:1),h={x:a[0]-c[0]*f,y:a[1]-c[1]*f},p=[[0,0],[i,s]];t.setViewportConstrained({x:h.x,y:h.y,zoom:a[2]},p,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const o=n(),r=e.sourceEvent.ctrlKey&&Kr()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*a,s=o[2]*Math.pow(2,i*r);t.scaleTo(s)}:null);r.call(f,{})},destroy:function(){r.on("zoom",null)},pointer:ft}}({domNode:C.current,panZoom:e,getTransform:()=>k.getState().transform,getViewScale:()=>q.current}),()=>{K.current?.destroy()}},[E]),(0,a().useEffect)(()=>{K.current?.update({translateExtent:j,width:D,height:I,inversePan:b,pannable:x,zoomStep:_,zoomable:v})},[x,v,b,_,j,D,I]);const W=m?e=>{const[t,n]=K.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,G=(0,a().useCallback)((e,t)=>{const n=k.getState().nodeLookup.get(t).internals.userNode;y?.(e,n)},[y]),U=y?G:void 0,Q=w??O["minimap.ariaLabel"];return(0,c.jsx)(js,{position:g,style:{...e,"--xy-minimap-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof p?p*T:void 0,"--xy-minimap-node-background-color-props":"string"==typeof o?o:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof s?s:void 0},className:d(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,c.jsxs)("svg",{width:z,height:A,viewBox:`${H} ${Z} ${Y} ${X}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":F,ref:C,onClick:W,children:[Q&&(0,c.jsx)("title",{id:F,children:Q}),(0,c.jsx)(pc,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:l}),(0,c.jsx)("path",{className:"react-flow__minimap-mask",d:`M${H-V},${Z-V}h${Y+2*V}v${X+2*V}h${-Y-2*V}z\n M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vc.displayName="MiniMap";const wc=(0,a().memo)(vc),bc={[es.Line]:"right",[es.Handle]:"bottom-right"};(0,a().memo)(function({nodeId:e,position:t,variant:n=es.Handle,className:o,style:r,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:m=!0,shouldResize:y,onResizeStart:x,onResize:v,onResizeEnd:w}){const b=Ma(),_="string"==typeof e?e:b,S=bs(),k=(0,a().useRef)(null),C=n===es.Handle,N=ws((0,a().useCallback)((E=C&&m,e=>E?`${Math.max(1/e.transform[2],1)}`:void 0),[C,m]),gs);var E;const M=(0,a().useRef)(null),P=t??bc[n];(0,a().useEffect)(()=>{if(k.current&&_)return M.current||(M.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=dt(e);let s={controlDirection:ts("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:l,resizeDirection:c,onResizeStart:d,onResize:u,onResizeEnd:f,shouldResize:h}){let p,g={...ss},m={...as};s={boundaries:a,resizeDirection:c,keepAspectRatio:l,controlDirection:ts(e)};let y,x,v,w=null,b=[];const _=Ct().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:s,nodeOrigin:a,paneDomNode:l}=n();if(p=o.get(t),!p)return;w=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:u}=ni(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:s,containerBounds:w});g={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},m={...g,pointerX:c,pointerY:u,aspectRatio:g.width/g.height},y=void 0,x=Wr(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(y=o.get(p.parentId)),y&&"parent"===p.extent&&(x=[[0,0],[y.measured.width,y.measured.height]]),b=[],v=void 0;for(const[e,n]of o)if(n.parentId===t&&(b.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ls(n,p,n.origin??a);v=v?[[Math.min(e[0][0],v[0][0]),Math.min(e[0][1],v[0][1])],[Math.max(e[1][0],v[1][0]),Math.max(e[1][1],v[1][1])]]:e}d?.(e,{...g})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:a}=n(),l=ni(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!p)return;const{x:d,y:f,width:_,height:S}=g,k={},C=p.origin??a,{width:N,height:E,x:M,y:P}=function(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:x}=o,{x:v,y:w,width:b,height:_,aspectRatio:S}=e;let k=Math.floor(d?h-e.pointerX:0),C=Math.floor(u?p-e.pointerY:0);const N=b+(l?-k:k),E=_+(c?-C:C),M=-i[0]*b,P=-i[1]*_;let j=rs(N,g,m),D=rs(E,y,x);if(s){let e=0,t=0;l&&k<0?e=ns(v+k+M,s[0][0]):!l&&k>0&&(e=os(v+N+M,s[1][0])),c&&C<0?t=ns(w+C+P,s[0][1]):!c&&C>0&&(t=os(w+E+P,s[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(a){let e=0,t=0;l&&k>0?e=os(v+k,a[0][0]):!l&&k<0&&(e=ns(v+N,a[1][0])),c&&C>0?t=os(w+C,a[0][1]):!c&&C<0&&(t=ns(w+E,a[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(r){if(d){const e=rs(N/S,y,x)*S;if(j=Math.max(j,e),s){let e=0;e=!l&&!c||l&&!c&&f?os(w+P+N/S,s[1][1])*S:ns(w+P+(l?k:-k)/S,s[0][1])*S,j=Math.max(j,e)}if(a){let e=0;e=!l&&!c||l&&!c&&f?ns(w+N/S,a[1][1])*S:os(w+(l?k:-k)/S,a[0][1])*S,j=Math.max(j,e)}}if(u){const e=rs(E*S,g,m)/S;if(D=Math.max(D,e),s){let e=0;e=!l&&!c||c&&!l&&f?os(v+E*S+M,s[1][0])/S:ns(v+(c?C:-C)*S+M,s[0][0])/S,D=Math.max(D,e)}if(a){let e=0;e=!l&&!c||c&&!l&&f?ns(v+E*S,a[1][0])/S:os(v+(c?C:-C)*S,a[0][0])/S,D=Math.max(D,e)}}}C+=C<0?D:-D,k+=k<0?j:-j,r&&(f?N>E*S?C=(is(l,c)?-k:k)/S:k=(is(l,c)?-C:C)*S:d?(C=k/S,c=l):(k=C*S,l=c));const I=l?v+k:v,O=c?w+C:w;return{width:b+(l?-k:k),height:_+(c?-C:C),x:i[0]*k*(l?-1:1)+I,y:i[1]*C*(c?-1:1)+O}}(m,s.controlDirection,l,s.boundaries,s.keepAspectRatio,C,x,v),j=N!==_,D=E!==S,I=M!==d&&j,O=P!==f&&D;if(!(I||O||j||D))return;const z={prevValues:{...g},startX:m.x,startY:m.y,childNodes:b.map(e=>({...e,position:{...e.position}}))};if((I||O||1===C[0]||1===C[1])&&(k.x=I?M:g.x,k.y=O?P:g.y,g.x=k.x,g.y=k.y,b.length>0)){const e=M-d,t=P-f;for(const n of b)n.position={x:n.position.x-e+C[0]*(N-_),y:n.position.y-t+C[1]*(E-S)},c.push(n)}if((j||D)&&(k.width=!j||s.resizeDirection&&"horizontal"!==s.resizeDirection?g.width:N,k.height=!D||s.resizeDirection&&"vertical"!==s.resizeDirection?g.height:E,g.width=k.width,g.height=k.height),y&&p.expandParent){const e=C[0]*(k.width??0);k.x&&k.x<e&&(g.x=e,m.x=m.x-(k.x-e));const t=C[1]*(k.height??0);k.y&&k.y<t&&(g.y=t,m.y=m.y-(k.y-t))}const A=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=-1*l[0]),a&&i&&(l[1]=-1*l[1]),l}({width:g.width,prevWidth:_,height:g.height,prevHeight:S,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),R={...g,direction:A},L=h?.(e,R);if(!1===L)return g=z.prevValues,m.x=z.startX,m.y=z.startY,void b.forEach((e,t)=>{e.position=z.childNodes[t].position});u?.(e,R),o(k,c)}).on("end",e=>{f?.(e,{...g}),r?.({...g})});i.call(_)},destroy:function(){i.on(".drag",null)}}}({domNode:k.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=S.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=S.getState(),s=[],a={x:e.x,y:e.y},l=o.get(_);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,d=Ai([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Qr({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);s.push(...d),a.x=e.x?Math.max(t[0]*n,e.x):void 0,a.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==a.x&&void 0!==a.y){const e={id:_,type:"position",position:{...a}};s.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:_,type:"dimensions",resizing:!0,setAttributes:!g||("horizontal"===g?"width":"height"),dimensions:{width:e.width,height:e.height}};s.push(t)}for(const e of t){const t={...e,type:"position"};s.push(t)}n(s)},onEnd:({width:e,height:t})=>{const n={id:_,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};S.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:l,minHeight:u,maxWidth:f,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:x,onResize:v,onResizeEnd:w,shouldResize:y}),()=>{M.current?.destroy()}},[P,l,u,f,h,p,x,v,w,y]);const j=P.split("-");return(0,c.jsx)("div",{className:d(["react-flow__resize-control","nodrag",...j,n,o]),ref:k,style:{...r,scale:N,...s&&{[C?"backgroundColor":"borderColor"]:s}},children:i})});const _c=window.wp.i18n,Sc=window.wp.apiFetch;var kc=n.n(Sc);const Cc=window.wp.components,Nc=window.funnelforkEditor||{};function Ec(e){return`${e}_${Math.random().toString(36).slice(2,8)}`}const Mc=["#1e1e1e","#3858e9","#f0b849","#4ab866","#cc1818","#e26f56","#33b3db","#9b51e0","#e64ca2","#738a94"];function Pc(){return(Nc.yesnoAnswers||[{id:"yes",text:(0,_c.__)("Yes","funnelfork"),labels:[]},{id:"no",text:(0,_c.__)("No","funnelfork"),labels:[]}]).map(e=>({...e,labels:[],points:0}))}function jc(e){return"start"===e.type?["next"]:"question"===e.type?e.data.answers.map(e=>e.id):[]}function Dc(e,t,n){if(t===n)return!0;const o=[n],r=new Set;for(;o.length;){const n=o.pop();if(n===t)return!0;r.has(n)||(r.add(n),e.forEach(e=>e.source===n&&o.push(e.target)))}return!1}function Ic(e){return e?"start"===e.type?(0,_c.__)("Start","funnelfork"):"end"===e.type?e.data.title||(0,_c.__)("(untitled result)","funnelfork"):e.data.question||(0,_c.__)("(empty question)","funnelfork"):""}function Oc(e){return e.find(e=>"end"===e.type&&e.data.isDefault)||e.find(e=>"end"===e.type)}function zc(e){return e.filter(e=>"question"===e.type).sort((e,t)=>e.position.x-t.position.x||e.position.y-t.position.y).map(e=>e.id)}function Ac(e,t,n,o=zc(e)){if("score"===t){const t=o[o.indexOf(n)+1];if(t)return e.find(e=>e.id===t)}return Oc(e)}function Rc(e){return null!=e&&""!==e}function Lc(e){return Rc(e.scoreMin)||Rc(e.scoreMax)}function Tc(e){const t=Rc(e.scoreMin)?Number(e.scoreMin):null,n=Rc(e.scoreMax)?Number(e.scoreMax):null;return null!==t&&null!==n?t===n?(0,_c.sprintf)(/* translators: %d: score. */ /* translators: %d: score. */1 (()=>{"use strict";var e={730(e,t,n){var o=n.cw((e,t)=>{var n=a(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useState,i=n.useEffect,s=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var d="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),o=r({inst:{value:n,getSnapshot:t}}),a=o[0].inst,d=o[1];return s(function(){a.value=n,a.getSnapshot=t,c(a)&&d({inst:a})},[e,n,t]),i(function(){return c(a)&&d({inst:a}),e(function(){c(a)&&d({inst:a})})},[e]),l(n),n};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:d}),r=n.cw((e,t)=>{var n=a(),o=i(),r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,l=n.useRef,c=n.useEffect,d=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,o,i){var a=l(null);if(null===a.current){var f={hasValue:!1,value:null};a.current=f}else f=a.current;a=d(function(){function e(e){if(!l){if(l=!0,s=e,e=o(e),void 0!==i&&f.hasValue){var t=f.value;if(i(t,e))return a=t}return a=e}if(t=a,r(s,e))return t;var n=o(e);return void 0!==i&&i(t,n)?(s=e,t):(s=e,a=n)}var s,a,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,n,o,i]);var h=s(e,a[0],a[1]);return c(function(){f.hasValue=!0,f.value=h},[h]),u(h),h}}),i=n.cw(e=>{e.exports=o()}),s=n.cw(e=>{e.exports=r()}),a=n.cw(e=>{e.exports=window.React});const l=window.wp.element,c=window.ReactJSXRuntime;function d(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=d(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}a();var u={value:()=>{}};function f(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new h(o)}function h(e){this._=e}function p(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function g(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=u,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}h.prototype=f.prototype={constructor:h,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),s=-1,a=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++s<a;)if(n=(e=i[s]).type)r[n]=g(r[n],e.name,t);else if(null==t)for(n in r)r[n]=g(r[n],e.name,null);return this}for(;++s<a;)if((n=(e=i[s]).type)&&(n=p(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new h(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};const m=f;function y(){}function x(e){return null==e?y:function(){return this.querySelector(e)}}function v(e){"function"!=typeof e&&(e=x(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s,a=t[r],l=a.length,c=o[r]=new Array(l),d=0;d<l;++d)(i=a[d])&&(s=e.call(i,i.__data__,d,a))&&("__data__"in i&&(s.__data__=i.__data__),c[d]=s);return new at(o,this._parents)}function w(){return[]}function b(e){return null==e?w:function(){return this.querySelectorAll(e)}}function _(e){e="function"==typeof e?function(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}(e):b(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s,a=t[i],l=a.length,c=0;c<l;++c)(s=a[c])&&(o.push(e.call(s,s.__data__,c,a)),r.push(s));return new at(o,r)}function k(e){return function(){return this.matches(e)}}function S(e){return function(t){return t.matches(e)}}n.dn(x),n.dn(v),n.dn(b),n.dn(_),n.dn(k),n.dn(E);var C=Array.prototype.find;function N(){return this.firstElementChild}function E(e){return this.select(null==e?N:function(e){return function(){return C.call(this.children,e)}}("function"==typeof e?e:S(e)))}n.dn(j);var M=Array.prototype.filter;function P(){return Array.from(this.children)}function j(e){return this.selectAll(null==e?P:function(e){return function(){return M.call(this.children,e)}}("function"==typeof e?e:S(e)))}function D(e){"function"!=typeof e&&(e=k(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new at(o,this._parents)}function I(e){return new Array(e.length)}function O(){return new at(this._enter||this._groups.map(I),this._parents)}function z(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function A(e){return function(){return e}}function R(e,t,n,o,r,i){for(var s,a=0,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],o[a]=s):n[a]=new z(e,i[a]);for(;a<l;++a)(s=t[a])&&(r[a]=s)}function L(e,t,n,o,r,i,s){var a,l,c,d=new Map,u=t.length,f=i.length,h=new Array(u);for(a=0;a<u;++a)(l=t[a])&&(h[a]=c=s.call(l,l.__data__,a,t)+"",d.has(c)?r[a]=l:d.set(c,l));for(a=0;a<f;++a)c=s.call(e,i[a],a,i)+"",(l=d.get(c))?(o[a]=l,l.__data__=i[a],d.delete(c)):n[a]=new z(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&d.get(h[a])===l&&(r[a]=l)}function B(e){return e.__data__}function T(e,t){if(!arguments.length)return Array.from(this,B);var n=t?L:R,o=this._parents,r=this._groups;"function"!=typeof e&&(e=A(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var d=o[c],u=r[c],f=u.length,h=$(e.call(d,d&&d.__data__,c,o)),p=h.length,g=a[c]=new Array(p),m=s[c]=new Array(p);n(d,u,g,m,l[c]=new Array(f),h,t);for(var y,x,v=0,w=0;v<p;++v)if(y=g[v]){for(v>=w&&(w=v+1);!(x=m[w])&&++w<p;);y._next=x||null}}return(s=new at(s,o))._enter=a,s._exit=l,s}function $(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function V(){return new at(this._exit||this._groups.map(I),this._parents)}function H(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r}function Z(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),l=0;l<s;++l)for(var c,d=n[l],u=o[l],f=d.length,h=a[l]=new Array(f),p=0;p<f;++p)(c=d[p]||u[p])&&(h[p]=c);for(;l<r;++l)a[l]=n[l];return new at(a,this._parents)}function F(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,s=r[i];--i>=0;)(o=r[i])&&(s&&4^o.compareDocumentPosition(s)&&s.parentNode.insertBefore(o,s),s=o);return this}function Y(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=X);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s,a=n[i],l=a.length,c=r[i]=new Array(l),d=0;d<l;++d)(s=a[d])&&(c[d]=s);c.sort(t)}return new at(r,this._parents).order()}function X(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function q(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function W(){return Array.from(this)}function K(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function G(){let e=0;for(const t of this)++e;return e}function U(){return!this.node()}function Q(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],s=0,a=i.length;s<a;++s)(r=i[s])&&e.call(r,r.__data__,s,i);return this}n.dn(D),n.dn(I),n.dn(O),z.prototype={constructor:z,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},n.dn(A),n.dn(T),n.dn(V),n.dn(H),n.dn(Z),n.dn(F),n.dn(Y),n.dn(q),n.dn(W),n.dn(K),n.dn(G),n.dn(U),n.dn(Q);var J="http://www.w3.org/1999/xhtml";const ee={svg:"http://www.w3.org/2000/svg",xhtml:J,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function te(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ee.hasOwnProperty(t)?{space:ee[t],local:e}:e}function ne(e){return function(){this.removeAttribute(e)}}function oe(e){return function(){this.removeAttributeNS(e.space,e.local)}}function re(e,t){return function(){this.setAttribute(e,t)}}function ie(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function se(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function ae(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function le(e,t){var n=te(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?oe:ne:"function"==typeof t?n.local?ae:se:n.local?ie:re)(n,t))}function ce(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function de(e){return function(){this.style.removeProperty(e)}}function ue(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fe(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function he(e,t,n){return arguments.length>1?this.each((null==t?de:"function"==typeof t?fe:ue)(e,t,n??"")):pe(this.node(),e)}function pe(e,t){return e.style.getPropertyValue(t)||ce(e).getComputedStyle(e,null).getPropertyValue(t)}function ge(e){return function(){delete this[e]}}function me(e,t){return function(){this[e]=t}}function ye(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function xe(e,t){return arguments.length>1?this.each((null==t?ge:"function"==typeof t?ye:me)(e,t)):this.node()[e]}function ve(e){return e.trim().split(/^|\s+/)}function we(e){return e.classList||new be(e)}function be(e){this._node=e,this._names=ve(e.getAttribute("class")||"")}function _e(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function ke(e,t){for(var n=we(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Se(e){return function(){_e(this,e)}}function Ce(e){return function(){ke(this,e)}}function Ne(e,t){return function(){(t.apply(this,arguments)?_e:ke)(this,e)}}function Ee(e,t){var n=ve(e+"");if(arguments.length<2){for(var o=we(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?Ne:t?Se:Ce)(n,t))}function Me(){this.textContent=""}function Pe(e){return function(){this.textContent=e}}function je(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function De(e){return arguments.length?this.each(null==e?Me:("function"==typeof e?je:Pe)(e)):this.node().textContent}function Ie(){this.innerHTML=""}function Oe(e){return function(){this.innerHTML=e}}function ze(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ae(e){return arguments.length?this.each(null==e?Ie:("function"==typeof e?ze:Oe)(e)):this.node().innerHTML}function Re(){this.nextSibling&&this.parentNode.appendChild(this)}function Le(){return this.each(Re)}function Be(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Te(){return this.each(Be)}function $e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===J&&t.documentElement.namespaceURI===J?t.createElement(e):t.createElementNS(n,e)}}function Ve(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function He(e){var t=te(e);return(t.local?Ve:$e)(t)}function Ze(e){var t="function"==typeof e?e:He(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Fe(){return null}function Ye(e,t){var n="function"==typeof e?e:He(e),o=null==t?Fe:"function"==typeof t?t:x(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Xe(){var e=this.parentNode;e&&e.removeChild(this)}function qe(){return this.each(Xe)}function We(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ke(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ge(e){return this.select(e?Ke:We)}function Ue(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Qe(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function Je(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function et(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),s=i.length;if(!(arguments.length<2)){for(a=t?Je:Qe,o=0;o<s;++o)this.each(a(i[o],t,n));return this}var a=this.node().__on;if(a)for(var l,c=0,d=a.length;c<d;++c)for(o=0,l=a[c];o<s;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value}function tt(e,t,n){var o=ce(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function nt(e,t){return function(){return tt(this,e,t)}}function ot(e,t){return function(){return tt(this,e,t.apply(this,arguments))}}function rt(e,t){return this.each(("function"==typeof t?ot:nt)(e,t))}function*it(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,s=r.length;i<s;++i)(o=r[i])&&(yield o)}n.dn(te),n.dn(le),n.dn(ce),n.dn(he),n.dn(xe),n.dn(Ee),be.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}},n.dn(De),n.dn(Ae),n.dn(Le),n.dn(Te),n.dn(He),n.dn(Ze),n.dn(Ye),n.dn(qe),n.dn(Ge),n.dn(Ue),n.dn(et),n.dn(rt),n.dn(it);var st=[null];function at(e,t){this._groups=e,this._parents=t}function lt(){return new at([[document.documentElement]],st)}at.prototype=lt.prototype={constructor:at,select:v,selectAll:_,selectChild:E,selectChildren:j,filter:D,data:T,enter:O,exit:V,join:H,merge:Z,selection:function(){return this},order:F,sort:Y,call:q,nodes:W,node:K,size:G,empty:U,each:Q,attr:le,style:he,property:xe,classed:Ee,text:De,html:Ae,raise:Le,lower:Te,append:Ze,insert:Ye,remove:qe,clone:Ge,datum:Ue,on:et,dispatch:rt,[Symbol.iterator]:it};const ct=lt;function dt(e){return"string"==typeof e?new at([[document.querySelector(e)]],[document.documentElement]):new at([[e]],st)}function ut(e){let t;for(;t=e.sourceEvent;)e=t;return e}function ft(e,t){if(e=ut(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}n.dn(dt),n.dn(ut),n.dn(ft),n.dn(mt);const ht={passive:!1},pt={capture:!0,passive:!1};function gt(e){e.stopImmediatePropagation()}function mt(e){e.preventDefault(),e.stopImmediatePropagation()}function yt(e){var t=e.document.documentElement,n=dt(e).on("dragstart.drag",mt,pt);"onselectstart"in t?n.on("selectstart.drag",mt,pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function xt(e,t){var n=e.document.documentElement,o=dt(e).on("dragstart.drag",null);t&&(o.on("click.drag",mt,pt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}n.dn(yt);const vt=e=>()=>e;function wt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:d}})}function bt(e){return!e.ctrlKey&&!e.button}function _t(){return this.parentNode}function kt(e,t){return t??{x:e.x,y:e.y}}function St(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ct(){var e,t,n,o,r=bt,i=_t,s=kt,a=St,l={},c=m("start","drag","end"),d=0,u=0;function f(e){e.on("mousedown.drag",h).filter(a).on("touchstart.drag",y).on("touchmove.drag",x,ht).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(s,a){if(!o&&r.call(this,s,a)){var l=w(this,i.call(this,s,a),s,a,"mouse");l&&(dt(s.view).on("mousemove.drag",p,pt).on("mouseup.drag",g,pt),yt(s.view),gt(s),n=!1,e=s.clientX,t=s.clientY,l("start",s))}}function p(o){if(mt(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>u}l.mouse("drag",o)}function g(e){dt(e.view).on("mousemove.drag mouseup.drag",null),xt(e.view,n),mt(e),l.mouse("end",e)}function y(e,t){if(r.call(this,e,t)){var n,o,s=e.changedTouches,a=i.call(this,e,t),l=s.length;for(n=0;n<l;++n)(o=w(this,a,e,t,s[n].identifier,s[n]))&&(gt(e),o("start",e,s[n]))}}function x(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(mt(e),n("drag",e,o[t]))}function v(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=l[r[t].identifier])&&(gt(e),n("end",e,r[t]))}function w(e,t,n,o,r,i){var a,u,h,p=c.copy(),g=ft(i||n,t);if(null!=(h=s.call(e,new wt("beforestart",{sourceEvent:n,target:f,identifier:r,active:d,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return a=h.x-g[0]||0,u=h.y-g[1]||0,function n(i,s,c){var m,y=g;switch(i){case"start":l[r]=n,m=d++;break;case"end":delete l[r],--d;case"drag":g=ft(c||s,t),m=d}p.call(i,e,new wt(i,{sourceEvent:s,subject:h,target:f,identifier:r,active:m,x:g[0]+a,y:g[1]+u,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:vt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:vt(e),f):i},f.subject=function(e){return arguments.length?(s="function"==typeof e?e:vt(e),f):s},f.touchable=function(e){return arguments.length?(a="function"==typeof e?e:vt(!!e),f):a},f.on=function(){var e=c.on.apply(c,arguments);return e===c?f:e},f.clickDistance=function(e){return arguments.length?(u=(e=+e)*e,f):Math.sqrt(u)},f}function Nt(e){return((e=Math.exp(e))+1/e)/2}n.dn(vt),wt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e},n.dn(Ct);const Et=function e(t,n,o){function r(e,r){var i,s,a=e[0],l=e[1],c=e[2],d=r[0],u=r[1],f=r[2],h=d-a,p=u-l,g=h*h+p*p;if(g<1e-12)s=Math.log(f/c)/t,i=function(e){return[a+e*h,l+e*p,c*Math.exp(t*e*s)]};else{var m=Math.sqrt(g),y=(f*f-c*c+o*g)/(2*c*n*m),x=(f*f-c*c-o*g)/(2*f*n*m),v=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(x*x+1)-x);s=(w-v)/t,i=function(e){var o,r=e*s,i=Nt(v),d=c/(n*m)*(i*(o=t*r+v,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(v));return[a+d*h,l+d*p,c*i/Nt(t*r+v)]}}return i.duration=1e3*s*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4);var Mt,Pt,jt=0,Dt=0,It=0,Ot=0,zt=0,At=0,Rt="object"==typeof performance&&performance.now?performance:Date,Lt="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bt(){return zt||(Lt(Tt),zt=Rt.now()+At)}function Tt(){zt=0}function $t(){this._call=this._time=this._next=null}function Vt(e,t,n){var o=new $t;return o.restart(e,t,n),o}function Ht(){zt=(Ot=Rt.now())+At,jt=Dt=0;try{!function(){Bt(),++jt;for(var e,t=Mt;t;)(e=zt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--jt}()}finally{jt=0,function(){for(var e,t,n=Mt,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Mt=t);Pt=e,Ft(o)}(),zt=0}}function Zt(){var e=Rt.now(),t=e-Ot;t>1e3&&(At-=t,Ot=e)}function Ft(e){jt||(Dt&&(Dt=clearTimeout(Dt)),e-zt>24?(e<1/0&&(Dt=setTimeout(Ht,e-Rt.now()-At)),It&&(It=clearInterval(It))):(It||(Ot=Rt.now(),It=setInterval(Zt,1e3)),jt=1,Lt(Ht)))}function Yt(e,t,n){var o=new $t;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}$t.prototype=Vt.prototype={constructor:$t,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Bt():+n)+(null==t?0:+t),this._next||Pt===this||(Pt?Pt._next=this:Mt=this,Pt=this),this._call=e,this._time=n,Ft()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ft())}},n.dn(Yt),n.dn(Wt);var Xt=m("start","end","cancel","interrupt"),qt=[];function Wt(e,t,n,o,r,i){var s=e.__transition;if(s){if(n in s)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(l){var c,d,u,f;if(1!==n.state)return a();for(c in r)if((f=r[c]).name===n.name){if(3===f.state)return Yt(i);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[c])}if(Yt(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(l))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(u=n.tween.length),c=0,d=-1;c<u;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++d]=f);o.length=d+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(a),n.state=5,1),i=-1,s=o.length;++i<s;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),a())}function a(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Vt(function(e){n.state=1,n.timer.restart(i,n.delay,n.time),n.delay<=e&&i(e-n.delay)},0,n.time)}(e,n,{name:t,index:o,group:r,on:Xt,tween:qt,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Kt(e,t){var n=Ut(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Gt(e,t){var n=Ut(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Ut(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Qt(e,t){var n,o,r,i=e.__transition,s=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):s=!1;s&&delete e.__transition}}function Jt(e){return this.each(function(){Qt(this,e)})}function en(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}n.dn(Qt),n.dn(Jt),n.dn(en),n.dn(rn);var tn,nn=180/Math.PI,on={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function rn(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*nn,skewX:Math.atan(l)*nn,scaleX:s,scaleY:a}}function sn(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,s){var a=[],l=[];return i=e(i),s=e(s),function(e,o,r,i,s,a){if(e!==r||o!==i){var l=s.push("translate(",null,t,null,n);a.push({i:l-4,x:en(e,r)},{i:l-2,x:en(o,i)})}else(r||i)&&s.push("translate("+r+t+i+n)}(i.translateX,i.translateY,s.translateX,s.translateY,a,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:en(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,s.rotate,a,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:en(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,s.skewX,a,l),function(e,t,n,o,i,s){if(e!==n||t!==o){var a=i.push(r(i)+"scale(",null,",",null,")");s.push({i:a-4,x:en(e,n)},{i:a-2,x:en(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,s.scaleX,s.scaleY,a,l),i=s=null,function(e){for(var t,n=-1,o=l.length;++n<o;)a[(t=l[n]).i]=t.x(e);return a.join("")}}}var an=sn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?on:rn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),ln=sn(function(e){return null==e?on:(tn||(tn=document.createElementNS("http://www.w3.org/2000/svg","g")),tn.setAttribute("transform",e),(e=tn.transform.baseVal.consolidate())?rn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):on)},", ",")",")");function cn(e,t){var n,o;return function(){var r=Gt(this,e),i=r.tween;if(i!==n)for(var s=0,a=(o=n=i).length;s<a;++s)if(o[s].name===t){(o=o.slice()).splice(s,1);break}r.tween=o}}function dn(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Gt(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function un(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=Ut(this.node(),n).tween,i=0,s=r.length;i<s;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?cn:dn)(n,e,t))}function fn(e,t,n){var o=e._id;return e.each(function(){var e=Gt(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Ut(e,o).value[t]}}function hn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pn(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function gn(){}n.dn(un),n.dn(hn);var mn=.7,yn=1/mn,xn="\\s*([+-]?\\d+)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",wn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",bn=/^#([0-9a-f]{3,8})$/,kn=new RegExp(`^rgb\\(${xn},${xn},${xn}\\)$`),Sn=new RegExp(`^rgb\\(${wn},${wn},${wn}\\)$`),Cn=new RegExp(`^rgba\\(${xn},${xn},${xn},${vn}\\)$`),Nn=new RegExp(`^rgba\\(${wn},${wn},${wn},${vn}\\)$`),En=new RegExp(`^hsl\\(${vn},${wn},${wn}\\)$`),Mn=new RegExp(`^hsla\\(${vn},${wn},${wn},${vn}\\)$`),Pn={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function jn(){return this.rgb().formatHex()}function Dn(){return this.rgb().formatRgb()}function In(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=bn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?On(t):3===n?new Rn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?zn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?zn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=kn.exec(e))?new Rn(t[1],t[2],t[3],1):(t=Sn.exec(e))?new Rn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Cn.exec(e))?zn(t[1],t[2],t[3],t[4]):(t=Nn.exec(e))?zn(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=En.exec(e))?Hn(t[1],t[2]/100,t[3]/100,1):(t=Mn.exec(e))?Hn(t[1],t[2]/100,t[3]/100,t[4]):Pn.hasOwnProperty(e)?On(Pn[e]):"transparent"===e?new Rn(NaN,NaN,NaN,0):null}function On(e){return new Rn(e>>16&255,e>>8&255,255&e,1)}function zn(e,t,n,o){return o<=0&&(e=t=n=NaN),new Rn(e,t,n,o)}function An(e,t,n,o){return 1===arguments.length?((r=e)instanceof gn||(r=In(r)),r?new Rn((r=r.rgb()).r,r.g,r.b,r.opacity):new Rn):new Rn(e,t,n,o??1);var r}function Rn(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Ln(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}`}function Bn(){const e=Tn(this.opacity);return`${1===e?"rgb(":"rgba("}${$n(this.r)}, ${$n(this.g)}, ${$n(this.b)}${1===e?")":`, ${e})`}`}function Tn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function $n(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Vn(e){return((e=$n(e))<16?"0":"")+e.toString(16)}function Hn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Fn(e,t,n,o)}function Zn(e){if(e instanceof Fn)return new Fn(e.h,e.s,e.l,e.opacity);if(e instanceof gn||(e=In(e)),!e)return new Fn;if(e instanceof Fn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,l=(i+r)/2;return a?(s=t===i?(n-o)/a+6*(n<o):n===i?(o-t)/a+2:(t-n)/a+4,a/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new Fn(s,a,l,e.opacity)}function Fn(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function Yn(e){return(e=(e||0)%360)<0?e+360:e}function Xn(e){return Math.max(0,Math.min(1,e||0))}function qn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}function Wn(e,t,n,o,r){var i=e*e,s=i*e;return((1-3*e+3*i-s)*t+(4-6*i+3*s)*n+(1+3*e+3*i-3*s)*o+s*r)/6}function Kn(e){var t=e.length-1;return function(n){var o=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),r=e[o],i=e[o+1],s=o>0?e[o-1]:2*r-i,a=o<t-1?e[o+2]:2*i-r;return Wn((n-o/t)*t,s,r,i,a)}}function Gn(e){var t=e.length;return function(n){var o=Math.floor(((n%=1)<0?++n:n)*t),r=e[(o+t-1)%t],i=e[o%t],s=e[(o+1)%t],a=e[(o+2)%t];return Wn((n-o/t)*t,r,i,s,a)}}hn(gn,In,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:jn,formatHex:jn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Zn(this).formatHsl()},formatRgb:Dn,toString:Dn}),hn(Rn,An,pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Rn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rn($n(this.r),$n(this.g),$n(this.b),Tn(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ln,formatHex:Ln,formatHex8:function(){return`#${Vn(this.r)}${Vn(this.g)}${Vn(this.b)}${Vn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Bn,toString:Bn})),hn(Fn,function(e,t,n,o){return 1===arguments.length?Zn(e):new Fn(e,t,n,o??1)},pn(gn,{brighter(e){return e=null==e?yn:Math.pow(yn,e),new Fn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?mn:Math.pow(mn,e),new Fn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new Rn(qn(e>=240?e-240:e+120,r,o),qn(e,r,o),qn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new Fn(Yn(this.h),Xn(this.s),Xn(this.l),Tn(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Tn(this.opacity);return`${1===e?"hsl(":"hsla("}${Yn(this.h)}, ${100*Xn(this.s)}%, ${100*Xn(this.l)}%${1===e?")":`, ${e})`}`}})),n.dn(Kn),n.dn(Gn);const Un=e=>()=>e;function Qn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Un(isNaN(e)?t:e)}n.dn(Un);const Jn=function e(t){var n=function(e){return 1===(e=+e)?Qn:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):Un(isNaN(t)?n:t)}}(t);function o(e,t){var o=n((e=An(e)).r,(t=An(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),s=Qn(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=s(t),e+""}}return o.gamma=e,o}(1);function eo(e){return function(t){var n,o,r=t.length,i=new Array(r),s=new Array(r),a=new Array(r);for(n=0;n<r;++n)o=An(t[n]),i[n]=o.r||0,s[n]=o.g||0,a[n]=o.b||0;return i=e(i),s=e(s),a=e(a),o.opacity=1,function(e){return o.r=i(e),o.g=s(e),o.b=a(e),o+""}}}eo(Kn),eo(Gn),n.dn(oo);var to=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,no=new RegExp(to.source,"g");function oo(e,t){var n,o,r,i=to.lastIndex=no.lastIndex=0,s=-1,a=[],l=[];for(e+="",t+="";(n=to.exec(e))&&(o=no.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),a[s]?a[s]+=r:a[++s]=r),(n=n[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,l.push({i:s,x:en(n,o)})),i=no.lastIndex;return i<t.length&&(r=t.slice(i),a[s]?a[s]+=r:a[++s]=r),a.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)a[(n=l[o]).i]=n.x(e);return a.join("")})}function ro(e,t){var n;return("number"==typeof t?en:t instanceof In?Jn:(n=In(t))?(t=n,Jn):oo)(e,t)}function io(e){return function(){this.removeAttribute(e)}}function so(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ao(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttribute(e);return s===i?null:s===o?r:r=t(o=s,n)}}function lo(e,t,n){var o,r,i=n+"";return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===o?r:r=t(o=s,n)}}function co(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttribute(e))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttribute(e)}}function uo(e,t,n){var o,r,i;return function(){var s,a,l=n(this);if(null!=l)return(s=this.getAttributeNS(e.space,e.local))===(a=l+"")?null:s===o&&a===r?i:(r=a,i=t(o=s,l));this.removeAttributeNS(e.space,e.local)}}function fo(e,t){var n=te(e),o="transform"===n?ln:ro;return this.attrTween(e,"function"==typeof t?(n.local?uo:co)(n,o,fn(this,"attr."+e,t)):null==t?(n.local?so:io)(n):(n.local?lo:ao)(n,o,t))}function ho(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function po(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function go(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=te(e);return this.tween(n,(o.local?ho:po)(o,t))}function mo(e,t){return function(){Kt(this,e).delay=+t.apply(this,arguments)}}function yo(e,t){return t=+t,function(){Kt(this,e).delay=t}}function xo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?mo:yo)(t,e)):Ut(this.node(),t).delay}function vo(e,t){return function(){Gt(this,e).duration=+t.apply(this,arguments)}}function wo(e,t){return t=+t,function(){Gt(this,e).duration=t}}function bo(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?vo:wo)(t,e)):Ut(this.node(),t).duration}function _o(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Gt(this,e).ease=t}}(t,e)):Ut(this.node(),t).ease}function ko(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Gt(this,e).ease=n}}(this._id,e))}function So(e){"function"!=typeof e&&(e=k(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,s=t[r],a=s.length,l=o[r]=[],c=0;c<a;++c)(i=s[c])&&e.call(i,i.__data__,c,s)&&l.push(i);return new $o(o,this._parents,this._name,this._id)}function Co(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var l,c=t[a],d=n[a],u=c.length,f=s[a]=new Array(u),h=0;h<u;++h)(l=c[h]||d[h])&&(f[h]=l);for(;a<o;++a)s[a]=t[a];return new $o(s,this._parents,this._name,this._id)}function No(e,t){var n=this._id;return arguments.length<2?Ut(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Kt:Gt;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}(n,e,t))}function Eo(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))}function Mo(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=x(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a,l,c=o[s],d=c.length,u=i[s]=new Array(d),f=0;f<d;++f)(a=c[f])&&(l=e.call(a,a.__data__,f,c))&&("__data__"in a&&(l.__data__=a.__data__),u[f]=l,Wt(u[f],t,n,f,u,Ut(a,n)));return new $o(i,this._parents,t,n)}function Po(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=b(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l,c=o[a],d=c.length,u=0;u<d;++u)if(l=c[u]){for(var f,h=e.call(l,l.__data__,u,c),p=Ut(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&Wt(f,t,n,g,h,p);i.push(h),s.push(l)}return new $o(i,s,t,n)}n.dn(ro),n.dn(fo),n.dn(go),n.dn(xo),n.dn(bo),n.dn(_o),n.dn(ko),n.dn(So),n.dn(Co),n.dn(No),n.dn(Eo),n.dn(Mo),n.dn(Po),n.dn(Do);var jo=ct.prototype.constructor;function Do(){return new jo(this._groups,this._parents)}function Io(e){return function(){this.style.removeProperty(e)}}function Oo(e,t,n){var o="transform"==(e+="")?an:ro;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=pe(this,e),s=(this.style.removeProperty(e),pe(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}(e,o)).on("end.style."+e,Io(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var s=pe(this,e),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(e),l=a=pe(this,e)),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}(e,o,fn(this,"style."+e,t))).each(function(e,t){var n,o,r,i,s="style."+t,a="end."+s;return function(){var l=Gt(this,e),c=l.on,d=null==l.value[s]?i||(i=Io(t)):void 0;c===n&&r===d||(o=(n=c).copy()).on(a,r=d),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var s=pe(this,e);return s===i?null:s===o?r:r=t(o=s,n)}}(e,o,t),n).on("end.style."+e,null)}function zo(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,n??""))}function Ao(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=t??""}}(fn(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))}function Ro(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))}function Lo(){for(var e=this._name,t=this._id,n=Vo(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)if(s=a[c]){var d=Ut(s,t);Wt(s,e,n,c,a,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new $o(o,this._parents,e,n)}function Bo(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){0===--r&&i()}};n.each(function(){var n=Gt(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),n.on=t}),0===r&&i()})}n.dn(Oo),n.dn(zo),n.dn(Ao),n.dn(Ro),n.dn(Lo),n.dn(Bo);var To=0;function $o(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Vo(){return++To}var Ho=ct.prototype;$o.prototype=function(e){return ct().transition(e)}.prototype={constructor:$o,select:Mo,selectAll:Po,selectChild:Ho.selectChild,selectChildren:Ho.selectChildren,filter:So,merge:Co,selection:Do,transition:Lo,call:Ho.call,nodes:Ho.nodes,node:Ho.node,size:Ho.size,empty:Ho.empty,each:Ho.each,on:No,attr:fo,attrTween:go,style:Oo,styleTween:zo,text:Ao,textTween:Ro,remove:Eo,tween:un,delay:xo,duration:bo,ease:_o,easeVarying:ko,end:Bo,[Symbol.iterator]:Ho[Symbol.iterator]},n.dn(Yo);var Zo={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Fo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Yo(e){var t,n;e instanceof $o?(t=e._id,e=e._name):(t=Vo(),(n=Zo).time=Bt(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s,a=o[i],l=a.length,c=0;c<l;++c)(s=a[c])&&Wt(s,e,t,c,a,n||Fo(s,t));return new $o(o,this._parents,e,t)}ct.prototype.interrupt=Jt,ct.prototype.transition=Yo;const Xo=e=>()=>e;function qo(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Wo(e,t,n){this.k=e,this.x=t,this.y=n}n.dn(Xo),Wo.prototype={constructor:Wo,scale:function(e){return 1===e?this:new Wo(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Wo(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Ko=new Wo(1,0,0);function Go(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Ko;return e.__zoom}function Uo(e){e.stopImmediatePropagation()}function Qo(e){e.preventDefault(),e.stopImmediatePropagation()}function Jo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function er(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).x,e.y],[e.x+e.width,e.y+e.height]]:[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]:[[0,0],[e.clientWidth,e.clientHeight]]}function tr(){return this.__zoom||Ko}function nr(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function or(){return navigator.maxTouchPoints||"ontouchstart"in this}function rr(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ir(){var e,t,n,o=Jo,r=er,i=rr,s=nr,a=or,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],d=250,u=Et,f=m("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",tr).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",S).on("dblclick.zoom",C).filter(a).on("touchstart.zoom",N).on("touchmove.zoom",E).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new Wo(t,e.x,e.y)}function x(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Wo(e.k,o,r)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){b(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,s=b(e,i).event(o),a=r.apply(e,i),l=null==n?v(a):"function"==typeof n?n.apply(e,i):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),d=e.__zoom,f="function"==typeof t?t.apply(e,i):t,h=u(d.invert(l).concat(c/d.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=c/t[2];e=new Wo(n,l[0]-t[0]*n,l[1]-t[1]*n)}s.zoom(null,e)}})}function b(e,t,n){return!n&&e.__zooming||new _(e,t)}function _(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function k(e,...t){if(o.apply(this,arguments)){var n=b(this,t).event(e),r=this.__zoom,a=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,s.apply(this,arguments)))),d=ft(e);if(n.wheel)n.mouse[0][0]===d[0]&&n.mouse[0][1]===d[1]||(n.mouse[1]=r.invert(n.mouse[0]=d)),clearTimeout(n.wheel);else{if(r.k===a)return;n.mouse=[d,r.invert(d)],Qt(this),n.start()}Qo(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(x(y(r,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function S(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,s=b(this,t,!0).event(e),a=dt(e.view).on("mousemove.zoom",function(e){if(Qo(e),!s.moved){var t=e.clientX-d,n=e.clientY-u;s.moved=t*t+n*n>h}s.event(e).zoom("mouse",i(x(s.that.__zoom,s.mouse[0]=ft(e,r),s.mouse[1]),s.extent,c))},!0).on("mouseup.zoom",function(e){a.on("mousemove.zoom mouseup.zoom",null),xt(e.view,s.moved),Qo(e),s.event(e).end()},!0),l=ft(e,r),d=e.clientX,u=e.clientY;yt(e.view),Uo(e),s.mouse=[l,this.__zoom.invert(l)],Qt(this),s.start()}}function C(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,s=ft(e.changedTouches?e.changedTouches[0]:e,this),a=n.invert(s),l=n.k*(e.shiftKey?.5:2),u=i(x(y(n,l),s,a),r.apply(this,t),c);Qo(e),d>0?dt(this).transition().duration(d).call(w,u,s,e):dt(this).call(g.transform,u,s,e)}}function N(n,...r){if(o.apply(this,arguments)){var i,s,a,l,c=n.touches,d=c.length,u=b(this,r,n.changedTouches.length===d).event(n);for(Uo(n),s=0;s<d;++s)l=[l=ft(a=c[s],this),this.__zoom.invert(l),a.identifier],u.touch0?u.touch1||u.touch0[2]===l[2]||(u.touch1=l,u.taps=0):(u.touch0=l,i=!0,u.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(u.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),Qt(this),u.start())}}function E(e,...t){if(this.__zooming){var n,o,r,s,a=b(this,t).event(e),l=e.changedTouches,d=l.length;for(Qo(e),n=0;n<d;++n)r=ft(o=l[n],this),a.touch0&&a.touch0[2]===o.identifier?a.touch0[0]=r:a.touch1&&a.touch1[2]===o.identifier&&(a.touch1[0]=r);if(o=a.that.__zoom,a.touch1){var u=a.touch0[0],f=a.touch0[1],h=a.touch1[0],p=a.touch1[1],g=(g=h[0]-u[0])*g+(g=h[1]-u[1])*g,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;o=y(o,Math.sqrt(g/m)),r=[(u[0]+h[0])/2,(u[1]+h[1])/2],s=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!a.touch0)return;r=a.touch0[0],s=a.touch0[1]}a.zoom("touch",i(x(o,r,s),a.extent,c))}}function M(e,...o){if(this.__zooming){var r,i,s=b(this,o).event(e),a=e.changedTouches,l=a.length;for(Uo(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=a[r],s.touch0&&s.touch0[2]===i.identifier?delete s.touch0:s.touch1&&s.touch1[2]===i.identifier&&delete s.touch1;if(s.touch1&&!s.touch0&&(s.touch0=s.touch1,delete s.touch1),s.touch0)s.touch0[1]=this.__zoom.invert(s.touch0[0]);else if(s.end(),2===s.taps&&(i=ft(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=dt(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",tr),e!==r?w(e,t,n,o):r.interrupt().each(function(){b(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,o){g.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},g.scaleTo=function(e,t,n,o){g.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,s=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,a=o.invert(s),l="function"==typeof t?t.apply(this,arguments):t;return i(x(y(o,l),s,a),e,c)},n,o)},g.translateBy=function(e,t,n,o){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)},null,o)},g.translateTo=function(e,t,n,o,s){g.transform(e,function(){var e=r.apply(this,arguments),s=this.__zoom,a=null==o?v(e):"function"==typeof o?o.apply(this,arguments):o;return i(Ko.translate(a[0],a[1]).scale(s.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},o,s)},_.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=dt(this.that).datum();f.call(e,this.that,new qo(e,{sourceEvent:this.sourceEvent,target:g,type:e,transform:this.that.__zoom,dispatch:f}),t)}},g.wheelDelta=function(e){return arguments.length?(s="function"==typeof e?e:Xo(+e),g):s},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Xo(!!e),g):o},g.touchable=function(e){return arguments.length?(a="function"==typeof e?e:Xo(!!e),g):a},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Xo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):r},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(d=+e,g):d},g.interpolate=function(e){return arguments.length?(u=e,g):u},g.on=function(){var e=f.on.apply(f,arguments);return e===f?g:e},g.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,g):Math.sqrt(h)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}function sr(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),s=new Array(o);for(n=0;n<r;++n)i[n]=dr(e[n],t[n]);for(;n<o;++n)s[n]=t[n];return function(e){for(n=0;n<r;++n)s[n]=i[n](e);return s}}function ar(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function lr(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=dr(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}function cr(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function dr(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?Un(t):("number"===r?en:"string"===r?(n=In(t))?(t=n,Jn):oo:t instanceof In?Jn:t instanceof Date?ar:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?sr:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?lr:en:cr))(e,t)}Go.prototype=Wo.prototype,n.dn(Qo),n.dn(ir),n.dn(function(e,t){return((void 0)(t)?void 0:sr)(e,t)}),n.dn(ar),n.dn(lr),n.dn(cr),n.dn(dr);const ur=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],fr=["Enter"," ","Escape"],hr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var pr,gr,mr;!function(e){e.Strict="strict",e.Loose="loose"}(pr||(pr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(gr||(gr={})),function(e){e.Partial="partial",e.Full="full"}(mr||(mr={}));const yr={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var xr,vr,wr;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(xr||(xr={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(vr||(vr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(wr||(wr={}));const br={[wr.Left]:wr.Right,[wr.Right]:wr.Left,[wr.Top]:wr.Bottom,[wr.Bottom]:wr.Top},_r=e=>!!e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e,kr=e=>!!e&&"object"==typeof e&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Sr=(e,t=[0,0])=>{const{width:n,height:o}=Gr(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Cr=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(e=>{(void 0===t.filter||t.filter(e))&&(n=Or(n,Lr(e)),o=!0)}),o?Ar(n):{x:0,y:0,width:0,height:0}},Nr=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,c=t.width/r,d=t.height/r,u=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(s&&!n||o)continue;const r=e.width??t.width??t.initialWidth??0,f=e.height??t.height??t.initialHeight??0,{x:h,y:p}=t.internals.positionAbsolute,g=Tr(a,l,c,d,h,p,r,f),m=r*f,y=i&&g>0;(!t.internals.handleBounds||y||g>=m||t.dragging)&&u.push(t)}return u};function Er({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??o;let u=s.extent||r;if("parent"!==s.extent||s.expandParent)a&&Kr(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);else if(a){const{width:e,height:t}=Gr(a);e&&t&&(u=[[l,c],[l+e,c+t]])}else i?.("005","Only child nodes can use a parent extent.");const f=Kr(u)?Pr(t,u,s.measured):t;return void 0!==s.measured.width&&void 0!==s.measured.height||i?.("015","It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."),{position:{x:f.x-l+(s.measured.width??0)*d[0],y:f.y-c+(s.measured.height??0)*d[1]},positionAbsolute:f}}const Mr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Pr=(e={x:0,y:0},t,n)=>({x:Mr(e.x,t[0][0],t[1][0]-(n?.width??0)),y:Mr(e.y,t[0][1],t[1][1]-(n?.height??0))});function jr(e,t,n){const{width:o,height:r}=Gr(n),{x:i,y:s}=n.internals.positionAbsolute;return Pr(e,[[i,s],[i+o,s+r]],t)}const Dr=(e,t,n)=>e<t?Mr(Math.abs(e-t),1,t)/t:e>n?-Mr(Math.abs(e-n),1,t)/t:0,Ir=(e,t,n=15,o=40)=>[Dr(e.x,o,t.width-o)*n,Dr(e.y,o,t.height-o)*n],Or=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),zr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Ar=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Rr=(e,t=[0,0])=>{const{x:n,y:o}=kr(e)?e.internals.positionAbsolute:Sr(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Lr=(e,t=[0,0])=>{const{x:n,y:o}=kr(e)?e.internals.positionAbsolute:Sr(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Br=(e,t)=>Ar(Or(zr(e),zr(t))),Tr=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),c=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*c)},$r=(e,t)=>Tr(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Vr=e=>Hr(e.width)&&Hr(e.height)&&Hr(e.x)&&Hr(e.y),Hr=e=>!isNaN(e)&&isFinite(e),Zr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Fr=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Zr(a,s):a},Yr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Xr(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const qr=(e,t,n,o,r,i)=>{const s=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Xr(e,n),r=Xr(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Xr(e.top??e.y??0,n),r=Xr(e.bottom??e.y??0,n),i=Xr(e.left??e.x??0,t),s=Xr(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),d=Mr(c,o,r),u=t/2-(e.x+e.width/2)*d,f=n/2-(e.y+e.height/2)*d,h=function(e,t,n,o,r,i){const{x:s,y:a}=Yr(e,[t,n,o]),{x:l,y:c}=Yr({x:e.x+e.width,y:e.y+e.height},[t,n,o]),d=r-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}(e,u,f,d,t,n),p=Math.min(h.left-s.left,0),g=Math.min(h.top-s.top,0);return{x:u-p+Math.min(h.right-s.right,0),y:f-g+Math.min(h.bottom-s.bottom,0),zoom:d}},Wr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Kr(e){return null!=e&&"parent"!==e}function Gr(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Ur(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Qr(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const e=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Jr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ei(e){return{...hr,...e||{}}}function ti(e){return null===e?null:e?"valid":"invalid"}function ni(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=li(e),a=Fr({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Zr(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const oi=e=>({width:e.offsetWidth,height:e.offsetHeight}),ri=e=>e?.getRootNode?.()||window?.document,ii=["INPUT","SELECT","TEXTAREA"];function si(e){const t=e.composedPath?.()?.[0]||e.target;return 1===t?.nodeType&&(ii.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey"))}const ai=e=>"clientX"in e,li=(e,t)=>{const n=ai(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},ci=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...oi(t)}}):null};function di({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=.125*e+.375*r+.375*s+.125*n,c=.125*t+.375*i+.375*a+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ui(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function fi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case wr.Left:return[t-ui(t-o,i),n];case wr.Right:return[t+ui(o-t,i),n];case wr.Top:return[t,n-ui(n-r,i)];case wr.Bottom:return[t,n+ui(r-n,i)]}}function hi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,curvature:s=.25}){const[a,l]=fi({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,d]=fi({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[u,f,h,p]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${e},${t} C${a},${l} ${c},${d} ${o},${r}`,u,f,h,p]}function pi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2;return[i,o<t?o+s:o-s,r,s]}function gi({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=Or(Lr(e),Lr(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return $r(s,Ar(i))>0}const mi=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function yi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=pi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const xi={[wr.Left]:{x:-1,y:0},[wr.Right]:{x:1,y:0},[wr.Top]:{x:0,y:-1},[wr.Bottom]:{x:0,y:1}},vi=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function wi(e,t,n,o){const r=Math.min(vi(e,t)/2,vi(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s)return`L ${i+r*(e.x<n.x?-1:1)},${s}Q ${i},${s} ${i},${s+r*(e.y<n.y?1:-1)}`;const a=e.x<n.x?1:-1;return`L ${i},${s+r*(e.y<n.y?-1:1)}Q ${i},${s} ${i+r*a},${s}`}function bi({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:d=.5}){const[u,f,h,p,g]=function({source:e,sourcePosition:t=wr.Bottom,target:n,targetPosition:o=wr.Top,center:r,offset:i,stepPosition:s}){const a=xi[t],l=xi[o],c={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+l.x*i,y:n.y+l.y*i},u=(({source:e,sourcePosition:t=wr.Bottom,target:n})=>t===wr.Left||t===wr.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:d}),f=0!==u.x?"x":"y",h=u[f];let p,g,m=[];const y={x:0,y:0},x={x:0,y:0},[,,v,w]=pi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*l[f]===-1){"x"===f?(p=r.x??c.x+(d.x-c.x)*s,g=r.y??(c.y+d.y)/2):(p=r.x??(c.x+d.x)/2,g=r.y??c.y+(d.y-c.y)*s);const e=[{x:p,y:c.y},{x:p,y:d.y}],t=[{x:c.x,y:g},{x:d.x,y:g}];m=a[f]===h?"x"===f?e:t:"x"===f?t:e}else{const r=[{x:c.x,y:d.y}],s=[{x:d.x,y:c.y}];if(m="x"===f?a.x===h?s:r:a.y===h?r:s,t===o){const t=Math.abs(e[f]-n[f]);if(t<=i){const o=Math.min(i-1,i-t);a[f]===h?y[f]=(c[f]>e[f]?-1:1)*o:x[f]=(d[f]>n[f]?-1:1)*o}}if(t!==o){const e="x"===f?"y":"x",t=a[f]===l[e],n=c[e]>d[e],o=c[e]<d[e];(1===a[f]&&(!t&&n||t&&o)||1!==a[f]&&(!t&&o||t&&n))&&(m="x"===f?r:s)}const u={x:c.x+y.x,y:c.y+y.y},v={x:d.x+x.x,y:d.y+x.y};Math.max(Math.abs(u.x-m[0].x),Math.abs(v.x-m[0].x))>=Math.max(Math.abs(u.y-m[0].y),Math.abs(v.y-m[0].y))?(p=(u.x+v.x)/2,g=m[0].y):(p=m[0].x,g=(u.y+v.y)/2)}const b={x:c.x+y.x,y:c.y+y.y},_={x:d.x+x.x,y:d.y+x.y};return[[e,...b.x!==m[0].x||b.y!==m[0].y?[b]:[],...m,..._.x!==m[m.length-1].x||_.y!==m[m.length-1].y?[_]:[],n],p,g,v,w]}({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:d});let m=`M${u[0].x} ${u[0].y}`;for(let e=1;e<u.length-1;e++)m+=wi(u[e-1],u[e],u[e+1],s);return m+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[m,f,h,p,g]}function _i(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ki(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function Si(e,t,n=wr.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Gr(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case wr.Top:return{x:r+s/2,y:i};case wr.Right:return{x:r+s,y:i+a/2};case wr.Bottom:return{x:r+s/2,y:i+a};case wr.Left:return{x:r,y:i+a/2}}}function Ci(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Ni(e,t){return e?"string"==typeof e?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`:""}const Ei={nodeOrigin:[0,0],nodeExtent:ur,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Mi={...Ei,checkEquality:!0};function Pi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function ji(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const t of e.handles){const r={id:t.id,width:t.width??1,height:t.height??1,nodeId:e.id,x:t.x,y:t.y,position:t.position,type:t.type};"source"===t.type?n.push(r):"target"===t.type&&o.push(r)}return{source:n,target:o}}function Di(e){return"manual"===e}function Ii(e,t,n,o={}){const r=Pi(Mi,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Di(r.zIndexMode)?1e3:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const d of e){let e=s.get(d.id);if(r.checkEquality&&d===e?.internals.userNode)t.set(d.id,e);else{const n=Sr(d,r.nodeOrigin),o=Kr(d.extent)?d.extent:r.nodeExtent,i=Pr(n,o,Gr(d));e={...r.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:i,handleBounds:ji(d,e),z:zi(d,a,r.zIndexMode),userNode:d}},t.set(d.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(l=!1),d.parentId&&Oi(e,t,n,o,i),c||=d.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function Oi(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Pi(Ei,o),c=e.parentId,d=t.get(c);if(!d)return void console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n),r&&!d.parentId&&void 0===d.internals.rootParentIndex&&"auto"===l&&(d.internals.rootParentIndex=++r.i,d.internals.z=d.internals.z+10*r.i),r&&void 0!==d.internals.rootParentIndex&&(r.i=d.internals.rootParentIndex);const u=i&&!Di(l)?1e3:0,{x:f,y:h,z:p}=function(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Gr(e),c=Sr(e,n),d=Kr(e.extent)?Pr(c,e.extent,l):c;let u=Pr({x:s+d.x,y:a+d.y},o,l);"parent"===e.extent&&(u=jr(u,l,t));const f=zi(e,r,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}(e,d,s,a,u,l),{positionAbsolute:g}=e.internals,m=f!==g.x||h!==g.y;(m||p!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:f,y:h}:g,z:p}})}function zi(e,t,n){const o=Hr(e.zIndex)?e.zIndex:0;return Di(n)?o:o+(e.selected?t:0)}function Ai(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Rr(e),r=Br(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},s)=>{const a=i.internals.positionAbsolute,l=Gr(i),c=i.origin??o,d=t.x<a.x?Math.round(Math.abs(a.x-t.x)):0,u=t.y<a.y?Math.round(Math.abs(a.y-t.y)):0,f=Math.max(l.width,Math.round(t.width)),h=Math.max(l.height,Math.round(t.height)),p=(f-l.width)*c[0],g=(h-l.height)*c[1];(d>0||u>0||p||g)&&(r.push({id:s,type:"position",position:{x:i.position.x-d+p,y:i.position.y-u+g}}),n.get(s)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+d,y:t.position.y+u}})})),(l.width<t.width||l.height<t.height||d||u)&&r.push({id:s,type:"dimensions",setAttributes:!0,dimensions:{width:f+(d?c[0]*d-p:0),height:h+(u?c[1]*u-g:0)}})}),r}function Ri(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const a=o.get(s)||new Map;o.set(s,a.set(n,t))}}function Li(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:s=null}=o,a={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:s},l=`${n}-${i}--${r}-${s}`;Ri("source",a,`${r}-${s}--${n}-${i}`,e,n,i),Ri("target",a,l,e,r,s),t.set(o.id,o)}}function Bi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Bi(n,t))}function Ti(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function $i({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Vi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a="strict"===r?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],l=(n?a?.find(e=>e.id===n):a?.[0])??null;return l&&i?{...l,...Si(s,l,l.position,!0)}:l}function Hi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Zi=()=>!0;function Fi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Zi,nodeLookup:d}){const u="target"===i,f=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=li(e),g=s.elementFromPoint(h,p),m=g?.classList.contains(`${a}-flow__handle`)?g:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Hi(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),s=m.classList.contains("connectable"),a=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:u?t:o,sourceHandle:u?i:r,target:u?o:t,targetHandle:u?r:i};y.connection=l;const f=s&&a&&(n===pr.Strict?u&&"source"===e||!u&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=Vi(t,e,i,d,n,!0)}return y}const Yi={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:m,isValidConnection:y=Zi,onReconnectEnd:x,updateConnection:v,getTransform:w,getFromHandle:b,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:S}){const C=ri(e.target);let N,E=0;const{x:M,y:P}=li(e),j=Hi(i,S),D=a?.getBoundingClientRect();let I=!1;if(!D||!j)return;const O=Vi(r,j,o,l,t);if(!O)return;let z=li(e,D),A=!1,R=null,L=!1,B=null;function T(){if(!d||!D)return;const[e,t]=Ir(z,D,_);f({x:e,y:t}),E=requestAnimationFrame(T)}const $={...O,nodeId:r,type:j,position:O.position},V=l.get(r);let H={inProgress:!0,isValid:null,from:Si(V,$,wr.Left,!0),fromHandle:$,fromPosition:$.position,fromNode:V,to:z,toHandle:null,toPosition:br[$.position],toNode:null,pointer:z};function Z(){I=!0,v(H),p?.(e,{nodeId:r,handleId:o,handleType:j})}function F(e){if(!I){const{x:t,y:n}=li(e),o=t-M,r=n-P;if(!(o*o+r*r>k*k))return;Z()}if(!b()||!$)return void Y(e);const i=w();z=li(e,D),N=function(e,t,n,o){let r=[],i=1/0;const s=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())$r(r,Rr(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of s){const s=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const a of s){if(o.nodeId===a.nodeId&&o.type===a.type&&o.id===a.id)continue;const{x:s,y:l}=Si(n,a,a.position,!0),c=Math.sqrt(Math.pow(s-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...a,x:s,y:l}],i=c):c===i&&r.push({...a,x:s,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}(Fr(z,i,!1,[1,1]),n,l,$),A||(T(),A=!0);const a=Fi(e,{handle:N,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:y,doc:C,lib:c,flowId:u,nodeLookup:l});B=a.handleDomNode,R=a.connection,L=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!N,a.isValid);const d=l.get(r),f=d?Si(d,$,wr.Left,!0):H.from,h={...H,from:f,isValid:L,to:a.toHandle&&L?Yr({x:a.toHandle.x,y:a.toHandle.y},i):z,toHandle:a.toHandle,toPosition:L&&a.toHandle?a.toHandle.position:br[$.position],toNode:a.toHandle?l.get(a.toHandle.nodeId):null,pointer:z};v(h),H=h}function Y(e){if(!("touches"in e&&e.touches.length>0)){if(I){(N||B)&&R&&L&&g?.(R);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&x?.(e,o)}h(),cancelAnimationFrame(E),A=!1,L=!1,R=null,B=null,C.removeEventListener("mousemove",F),C.removeEventListener("mouseup",Y),C.removeEventListener("touchmove",F),C.removeEventListener("touchend",Y)}}0===k&&Z(),C.addEventListener("mousemove",F),C.addEventListener("mouseup",Y),C.addEventListener("touchmove",F),C.addEventListener("touchend",Y)},isValid:Fi},Xi=e=>({x:e.x,y:e.y,zoom:e.k}),qi=({x:e,y:t,zoom:n})=>Ko.translate(e,t).scale(n),Wi=(e,t)=>e.target.closest(`.${t}`),Ki=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Gi=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ui=(e,t=0,n=Gi,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Qi=e=>{const t=e.ctrlKey&&Wr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Ji({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect();let u=[[0,0],[d.width,d.height]];const f="undefined"!=typeof ResizeObserver?new ResizeObserver(e=>{const t=e[0];t&&(u=[[0,0],[t.contentRect.width,t.contentRect.height]])}):null;f?.observe(e);const h=ir().extent(()=>u).scaleExtent([t,n]).translateExtent(o),p=dt(e).call(h);v({x:r.x,y:r.y,zoom:Mr(r.zoom,t,n)},[[0,0],[d.width,d.height]],o);const g=p.on("wheel.zoom"),m=p.on("dblclick.zoom");async function y(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).transform(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})}function x(){h.on("zoom",null)}async function v(e,t,n){const o=qi(e),r=h?.constrain()(o,t,n);return r&&await y(r),r}return h.wheelDelta(Qi),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:d,panOnScrollMode:u,panOnScrollSpeed:f,preventScrolling:y,zoomOnPinch:v,zoomOnScroll:w,zoomOnDoubleClick:b,panActivationKeyPressed:_=!1,zoomActivationKeyPressed:k,lib:S,onTransformChange:C,connectionInProgress:N,paneClickDistance:E,selectionOnDrag:M}){o&&!c.isZoomingOrPanning&&x();const P=r&&!k&&!o;h.clickDistance(M?1/0:!Hr(E)||E<0?0:E);const j=P?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return d=>{if(Wi(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const e=ft(d),t=Qi(d),r=u*Math.pow(2,t);return void o.scaleTo(n,r,e,d)}const f=1===d.deltaMode?20:1;let h=r===gr.Vertical?0:d.deltaX*f,p=r===gr.Horizontal?0:d.deltaY*f;!Wr()&&d.shiftKey&&r!==gr.Vertical&&(h=d.deltaY*f,p=0),o.translateBy(n,-h/u*i,-p/u*i,{internal:!0});const g=Xi(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(d,g):(e.isPanScrolling=!0,a?.(d,g)),e.panScrollTimeout=setTimeout(()=>{c?.(d,g),e.isPanScrolling=!1},150)}}({zoomPanValues:c,noWheelClassName:e,d3Selection:p,d3Zoom:h,panOnScrollMode:u,panOnScrollSpeed:f,zoomOnPinch:v,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,s=!t&&i&&!o.ctrlKey,a=Wi(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:y,d3ZoomHandler:g});p.on("wheel.zoom",j,{passive:!1});const D=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Xi(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});h.on("start",D);const I=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Ki(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Xi(i.transform))}}({zoomPanValues:c,panOnDrag:d,onPaneContextMenu:!!n,onPanZoom:i,onTransformChange:C});h.on("zoom",I);const O=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ki(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const t=Xi(s.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,t)},n?150:0)}}}({zoomPanValues:c,panOnDrag:d,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:a,onDraggingChange:l});h.on("end",O);const z=function({panActivationKeyPressed:e,zoomActivationKeyPressed:t,zoomOnScroll:n,zoomOnPinch:o,panOnDrag:r,panOnScroll:i,zoomOnDoubleClick:s,userSelectionActive:a,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return f=>{const h=t||n,p=o&&f.ctrlKey,g="wheel"===f.type;if(1===f.button&&"mousedown"===f.type&&(Wi(f,`${d}-flow__node`)||Wi(f,`${d}-flow__edge`)||Wi(f,`${d}-flow__selection`)||Wi(f,`${d}-flow__nodesselection`)))return!0;if(!(r||h||i||s||o))return!1;if(a)return!1;if(u&&!g)return!1;if(Wi(f,l)&&g)return!1;if(Wi(f,c)&&(!g||i&&g&&!t))return!1;if(!o&&f.ctrlKey&&g)return!1;if(!o&&"touchstart"===f.type&&f.touches?.length>1)return f.preventDefault(),!1;if(!h&&!i&&!p&&g)return!1;if(!r&&("mousedown"===f.type||"touchstart"===f.type))return!1;if(Array.isArray(r)&&!r.includes(f.button)&&"mousedown"===f.type)return!1;const m=Array.isArray(r)&&r.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g||e)&&m}}({panActivationKeyPressed:_,zoomActivationKeyPressed:k,panOnDrag:d,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:b,zoomOnPinch:v,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:S,connectionInProgress:N});h.filter(z),b?p.on("dblclick.zoom",m):p.on("dblclick.zoom",null)},destroy:x,setViewport:async function(e,t){const n=qi(e);return await y(n,t),n},setViewportConstrained:v,getViewport:function(){const e=p?Go(p.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleTo(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},scaleBy:async function(e,t){return!!p&&new Promise(n=>{h?.interpolate("linear"===t?.interpolate?dr:Et).scaleBy(Ui(p,t?.duration,t?.ease,()=>n(!0)),e)})},setScaleExtent:function(e){h?.scaleExtent(e)},setTranslateExtent:function(e){h?.translateExtent(e)},syncViewport:function(e){if(p){const t=qi(e),n=p.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||h?.transform(p,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Hr(e)||e<0?0:e;h?.clickDistance(t)}}}var es;function ts(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}function ns(e,t){return Math.max(0,t-e)}function os(e,t){return Math.max(0,e-t)}function rs(e,t,n){return Math.max(0,t-e,e-n)}function is(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(es||(es={}));const ss={width:0,height:0,x:0,y:0},as={...ss,pointerX:0,pointerY:0,aspectRatio:1};function ls(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}s();const cs=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},s=t=e(o,r,i);return i},{useDebugValue:ds}=a(),{useSyncExternalStoreWithSelector:us}=s(),fs=e=>e;function hs(e,t=fs,n){const o=us(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ds(o),o}const ps=(e,t)=>{const n=(e=>e?cs(e):cs)(e),o=(e,o=t)=>hs(n,e,o);return Object.assign(o,n),o};function gs(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const ms=window.ReactDOM,ys=(0,a().createContext)(null),xs=ys.Provider,vs=((e="react")=>`Seems like you have not used ${"svelte"===e?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`)("react");function ws(e,t){const n=(0,a().useContext)(ys);if(null===n)throw new Error(vs);return hs(n,e,t)}function bs(){const e=(0,a().useContext)(ys);if(null===e)throw new Error(vs);return(0,a().useMemo)(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const _s={display:"none"},ks={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ss="react-flow__node-desc",Cs="react-flow__edge-desc",Ns=e=>e.ariaLiveMessage,Es=e=>e.ariaLabelConfig;function Ms({rfId:e}){const t=ws(Ns);return(0,c.jsx)("div",{id:`react-flow__aria-live-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ks,children:t})}function Ps({rfId:e,disableKeyboardA11y:t}){const n=ws(Es);return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{id:`${Ss}-${e}`,style:_s,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),(0,c.jsx)("div",{id:`${Cs}-${e}`,style:_s,children:n["edge.a11yDescription.default"]}),!t&&(0,c.jsx)(Ms,{rfId:e})]})}const js=(0,a().forwardRef)(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return(0,c.jsx)("div",{className:d(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});js.displayName="Panel";const Ds="https://reactflow.dev?utm_source=attribution";function Is({proOptions:e,position:t="bottom-right"}){return(0,a().useEffect)(()=>{},[]),e?.hideAttribution?null:(0,c.jsx)(js,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Ds}`,children:(0,c.jsx)("a",{href:Ds,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Os=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},zs=e=>e.id;function As(e,t){return gs(e.selectedNodes.map(zs),t.selectedNodes.map(zs))&&gs(e.selectedEdges.map(zs),t.selectedEdges.map(zs))}function Rs({onSelectionChange:e}){const t=bs(),{selectedNodes:n,selectedEdges:o}=ws(Os,As);return(0,a().useEffect)(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(e=>e(r))},[n,o,e]),null}const Ls=e=>!!e.onSelectionChangeHandlers;function Bs({onSelectionChange:e}){const t=ws(Ls);return e||t?(0,c.jsx)(Rs,{onSelectionChange:e}):null}const Ts=[0,0],$s={x:0,y:0,zoom:1},Vs=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode","rfId"],Hs=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),Zs={translateExtent:ur,nodeOrigin:Ts,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function Fs(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c}=ws(Hs,gs),d=bs();(0,a().useEffect)(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=Zs,l()}),[]);const u=(0,a().useRef)(Zs);return(0,a().useEffect)(()=>{for(const a of Vs){const l=e[a];l!==u.current[a]&&void 0!==e[a]&&("nodes"===a?t(l):"edges"===a?n(l):"minZoom"===a?o(l):"maxZoom"===a?r(l):"translateExtent"===a?i(l):"nodeExtent"===a?s(l):"ariaLabelConfig"===a?d.setState({ariaLabelConfig:ei(l)}):"fitView"===a?d.setState({fitViewQueued:l}):"fitViewOptions"===a?d.setState({fitViewOptions:l}):d.setState({[a]:l}))}u.current=e},Vs.map(t=>e[t])),null}function Ys(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Xs="undefined"!=typeof document?document:null;function qs(e=null,t={target:Xs,actInsideInputWithModifier:!0}){const[n,o]=(0,a().useState)(!1),r=(0,a().useRef)(!1),i=(0,a().useRef)(new Set([])),[s,l]=(0,a().useMemo)(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace(/\+/g,"\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return(0,a().useEffect)(()=>{const n=t?.target??Xs,a=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{if(r.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey,(!r.current||r.current&&!a)&&si(e))return!1;const n=Ks(e.code,l);if(i.current.add(e[n]),Ws(s,i.current,!1)){const n=e.composedPath?.()?.[0]||e.target,i="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!r.current&&i||e.preventDefault(),o(!0)}},c=e=>{const t=Ks(e.code,l);Ws(s,i.current,!0)?(o(!1),i.current.clear()):i.current.delete(e[t]),"Meta"===e.key&&i.current.clear(),r.current=!1},d=()=>{i.current.clear(),o(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",c),window.addEventListener("blur",d),window.addEventListener("contextmenu",d),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",c),window.removeEventListener("blur",d),window.removeEventListener("contextmenu",d)}}},[e,o]),n}function Ws(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Ks(e,t){return t.includes(e)?"code":"key"}function Gs(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)Us(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function Us(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured={...e.dimensions},e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function Qs(e,t){return Gs(e,t)}function Js(e,t){return Gs(e,t)}function ea(e,t){return{id:e,type:"select",selected:t}}function ta(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(ea(i.id,e)))}return o}function na({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t)void 0===o.get(e)&&n.push({id:e,type:"remove"});return n}function oa(e){return{id:e.id,type:"remove"}}const ra=(e,t)=>{};const ia=e=>(e=>!!e&&"object"==typeof e&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function sa(e){return(0,a().forwardRef)(e)}const aa="undefined"!=typeof window?a().useLayoutEffect:a().useEffect;function la(e){const[t,n]=(0,a().useState)(BigInt(0)),[o]=(0,a().useState)(()=>function(){let e=[];return{get:()=>e,reset:()=>{e=[]},push:t=>{e.push(t),n(e=>e+BigInt(1))}}}());return aa(()=>{const t=o.get();t.length&&(e(t),o.reset())},[t]),o}const ca=(0,a().createContext)(null);function da({children:e}){const t=bs(),n=(0,a().useCallback)(e=>{const{nodes:n=[],setNodes:o,hasDefaultNodes:r,onNodesChange:i,nodeLookup:s,fitViewQueued:a,onNodesChangeMiddlewareMap:l}=t.getState();let c=n;for(const t of e)c="function"==typeof t?t(c):t;let d=na({items:c,lookup:s});for(const e of l.values())d=e(d);r&&o(c),d.length>0?i?.(d):a&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:n,setNodes:o}=t.getState();e&&o(n)})},[]),o=la(n),r=la((0,a().useCallback)(e=>{const{edges:n=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:s}=t.getState();let a=n;for(const t of e)a="function"==typeof t?t(a):t;r?o(a):i&&i(na({items:a,lookup:s}))},[])),i=(0,a().useMemo)(()=>({nodeQueue:o,edgeQueue:r}),[]);return(0,c.jsx)(ca.Provider,{value:i,children:e})}const ua=e=>!!e.panZoom;function fa(){const e=(()=>{const e=bs();return(0,a().useMemo)(()=>({zoomIn:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1.2,t)},zoomOut:async t=>{const{panZoom:n}=e.getState();return!!n&&n.scaleBy(1/1.2,t)},zoomTo:async(t,n)=>{const{panZoom:o}=e.getState();return!!o&&o.scaleTo(t,n)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:s}=e.getState();return!!s&&(await s.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),!0)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),l=qr(t,o,r,i,s,n?.padding??.1);return!!a&&(await a.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:l}=s.getBoundingClientRect(),c={x:t.x-a,y:t.y-l},d=n.snapGrid??r,u=n.snapToGrid??i;return Fr(c,o,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),s=Yr(t,n);return{x:s.x+r,y:s.y+i}}}),[])})(),t=bs(),n=function(){const e=(0,a().useContext)(ca);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),o=ws(ua),r=(0,a().useMemo)(()=>{const e=e=>t.getState().nodeLookup.get(e),o=e=>{n.nodeQueue.push(e)},r=e=>{n.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=ia(e)?e:n.get(e.id),i=r.parentId?Qr(r.position,r.measured,r.parentId,n,o):r.position,s={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Rr(s)},s=(e,t,n={replace:!1})=>{o(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&ia(e)?e:{...o,...e}}return o}))},a=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&_r(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:o,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,s]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:s}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:s,triggerNodeChanges:a,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:d}=t.getState(),{nodes:u,edges:f}=await async function({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),s=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&s.find(t=>t.id===e.parentId);(t||n)&&s.push(e)}const a=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(s,l),d=c;for(const e of l)a.has(e.id)&&!d.find(t=>t.id===e.id)&&d.push(e);if(!r)return{edges:d,nodes:s};const u=await r({nodes:s,edges:d});return"boolean"==typeof u?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:d}),h=f.length>0,p=u.length>0;if(h){const e=f.map(oa);s?.(f),l(e)}if(p){const e=u.map(oa);i?.(u),a(e)}return(p||h)&&c?.({nodes:u,edges:f}),{deletedNodes:u,deletedEdges:f}},getIntersectingNodes:(e,n=!0,o)=>{const r=Vr(e),s=r?e:i(e),a=void 0!==o;return s?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Rr(a?o:i),c=$r(l,s);return n&&c>0||c>=l.width*l.height||c>=s.width*s.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Vr(e)?e:i(e);if(!o)return!1;const r=$r(o,t);return n&&r>0||r>=t.width*t.height||r>=o.width*o.height},updateNode:s,updateNodeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:a,updateEdgeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState();return((e,t={nodeOrigin:[0,0]})=>{if(0===e.length)return{x:0,y:0,width:0,height:0};let n=!1;const o=e.reduce((e,o)=>{const r="string"==typeof o;let i=t.nodeLookup||r?void 0:o;return t.nodeLookup&&(i=r?t.nodeLookup.get(o):kr(o)?o:t.nodeLookup.get(o.id)),i?(n=!0,Or(e,Lr(i,t.nodeOrigin))):e},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return n?Ar(o):{x:0,y:0,width:0,height:0}})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const o=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:o}),n.nodeQueue.push(e=>[...e]),o.promise}}},[]);return(0,a().useMemo)(()=>({...r,...e,viewportInitialized:o}),[o])}const ha=e=>e.selected,pa="undefined"!=typeof window?window:void 0,ga={position:"absolute",width:"100%",height:"100%",top:0,left:0},ma=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function ya({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panActivationKeyPressed:r,panOnScrollSpeed:i=.5,panOnScrollMode:s=gr.Free,zoomOnDoubleClick:l=!0,panOnDrag:d=!0,defaultViewport:u,translateExtent:f,minZoom:h,maxZoom:p,zoomActivationKeyCode:g,preventScrolling:m=!0,children:y,noWheelClassName:x,noPanClassName:v,onViewportChange:w,isControlledViewport:b,paneClickDistance:_,selectionOnDrag:k}){const S=bs(),C=(0,a().useRef)(null),{userSelectionActive:N,lib:E,connectionInProgress:M}=ws(ma,gs),P=qs(g),j=(0,a().useRef)();!function(e){const t=bs();(0,a().useEffect)(()=>{const n=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const n=oi(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004","The parent container needs a width and a height to render the graph."),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(C);const D=(0,a().useCallback)(e=>{w?.({x:e[0],y:e[1],zoom:e[2]}),b||S.setState({transform:e})},[w,b]);return(0,a().useEffect)(()=>{if(C.current){j.current=Ji({domNode:C.current,minZoom:h,maxZoom:p,translateExtent:f,viewport:u,onDraggingChange:e=>S.setState(t=>t.paneDragging===e?t:{paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=S.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=S.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=S.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=j.current.getViewport();return S.setState({panZoom:j.current,transform:[e,t,n],domNode:C.current.closest(".react-flow")}),()=>{j.current?.destroy()}}},[]),(0,a().useEffect)(()=>{j.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:o,panActivationKeyPressed:r,panOnScrollSpeed:i,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:d,zoomActivationKeyPressed:P,preventScrolling:m,noPanClassName:v,userSelectionActive:N,noWheelClassName:x,lib:E,onTransformChange:D,connectionInProgress:M,selectionOnDrag:k,paneClickDistance:_})},[e,t,n,o,r,i,s,l,d,P,m,v,N,x,E,D,M,k,_]),(0,c.jsx)("div",{className:"react-flow__renderer",ref:C,style:ga,children:y})}const xa=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function va(){const{userSelectionActive:e,userSelectionRect:t}=ws(xa,gs);return e&&t?(0,c.jsx)("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const wa=(e,t)=>n=>{n.target===t.current&&e?.(n)},ba=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging,panBy:e.panBy,autoPanSpeed:e.autoPanSpeed});function _a({isSelecting:e,selectionKeyPressed:t,selectionMode:n=mr.Full,panOnDrag:o,autoPanOnSelection:r,paneClickDistance:i,selectionOnDrag:s,onSelectionStart:l,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:g,onPaneMouseMove:m,onPaneMouseLeave:y,children:x}){const v=(0,a().useRef)(0),w=bs(),{userSelectionActive:b,elementsSelectable:_,dragging:k,panBy:S,autoPanSpeed:C}=ws(ba,gs),N=_&&(e||b),E=(0,a().useRef)(null),M=(0,a().useRef)(),P=(0,a().useRef)(new Set),j=(0,a().useRef)(new Set),D=(0,a().useRef)(!1),I=(0,a().useRef)(!1),O=(0,a().useRef)({x:0,y:0}),z=(0,a().useRef)(!1),A=e=>{if(I.current||D.current||w.getState().connection.inProgress)return I.current=!1,void(D.current=!1);f?.(e),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},R=p?e=>p(e):void 0;function L(e,t){const{userSelectionRect:o}=w.getState();if(!o)return;const{transform:r,nodeLookup:i,edgeLookup:s,connectionLookup:a,triggerNodeChanges:l,triggerEdgeChanges:c,defaultEdgeOptions:d}=w.getState(),u={x:o.startX,y:o.startY},{x:f,y:h}=Yr(u,r),p={startX:u.x,startY:u.y,x:e<f?e:f,y:t<h?t:h,width:Math.abs(e-f),height:Math.abs(t-h)},g=P.current,m=j.current;P.current=new Set(Nr(i,p,r,n===mr.Partial,!0).map(e=>e.id)),j.current=new Set;const y=d?.selectable??!0;for(const e of P.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=s.get(e);t&&(t.selectable??y)&&j.current.add(e)}}Jr(g,P.current)||l(ta(i,P.current,!0)),Jr(m,j.current)||c(ta(s,j.current)),w.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}function B(){if(!r||!M.current)return;const[e,t]=Ir(O.current,M.current,C);S({x:e,y:t}).then(e=>{if(!I.current||!e)return void(v.current=requestAnimationFrame(B));const{x:t,y:n}=O.current;L(t,n),v.current=requestAnimationFrame(B)})}const T=()=>{cancelAnimationFrame(v.current),v.current=0,z.current=!1};(0,a().useEffect)(()=>()=>T(),[]);const $=!0===o||Array.isArray(o)&&o.includes(0);return(0,c.jsxs)("div",{className:d(["react-flow__pane",{draggable:$,dragging:k,selection:e}]),onClick:N?void 0:wa(A,E),onContextMenu:wa(e=>{Array.isArray(o)&&o?.includes(2)?e.preventDefault():h?.(e)},E),onWheel:wa(R,E),onPointerEnter:N?void 0:g,onPointerMove:N?e=>{const{userSelectionRect:n,transform:o,resetSelectedElements:r}=w.getState();if(!M.current||!n)return;const{x:s,y:a}=li(e.nativeEvent,M.current);O.current={x:s,y:a};const c=Yr({x:n.startX,y:n.startY},o);if(!I.current){const n=t?0:i;if(Math.hypot(s-c.x,a-c.y)<=n)return;r(),l?.(e)}I.current=!0,z.current||(B(),z.current=!0),L(s,a)}:m,onPointerUp:e=>{N?0===e.button&&(e.target?.releasePointerCapture?.(e.pointerId),!b&&e.target===E.current&&w.getState().userSelectionRect&&A?.(e),w.setState({userSelectionActive:!1,userSelectionRect:null}),I.current&&(u?.(e),w.setState({nodesSelectionActive:P.current.size>0})),T()):e.target===E.current&&w.getState().connection.inProgress&&(D.current=!0)},onPointerCancel:N?e=>{e.target?.releasePointerCapture?.(e.pointerId),T()}:void 0,onPointerDownCapture:N?n=>{if("touch"===n.pointerType&&!1!==o&&!t)return;const{domNode:r,transform:i}=w.getState();if(M.current=r?.getBoundingClientRect(),!M.current)return;const a=n.target===E.current;if(!a&&n.target.closest(".nokey")||!e||!(s&&a||t)||0!==n.button||!n.isPrimary)return;n.target?.setPointerCapture?.(n.pointerId),I.current=!1;const{x:l,y:c}=li(n.nativeEvent,M.current),d=Fr({x:l,y:c},i);w.setState({userSelectionRect:{width:0,height:0,startX:d.x,startY:d.y,x:l,y:c}}),a||(n.stopPropagation(),n.preventDefault())}:void 0,onClickCapture:N?e=>{I.current&&(e.stopPropagation(),I.current=!1)}:void 0,onPointerLeave:y,ref:E,style:ga,children:[x,(0,c.jsx)(va,{})]})}function ka({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:l}=t.getState(),c=a.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&s)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",(e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`)(e))}function Sa({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:r,isSelectable:i,nodeClickDistance:s}){const l=bs(),[c,d]=(0,a().useState)(!1),u=(0,a().useRef)();return(0,a().useEffect)(()=>{if(!t)return u.current=function({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},d=null,u=!1,f=null,h=!1,p=!1,g=null;return{update:function({noDragClassName:m,handleSelector:y,domNode:x,isSelectable:v,nodeId:w,nodeClickDistance:b=0}){function _({x:e,y:n}){const{nodeLookup:r,nodeExtent:s,snapGrid:l,snapToGrid:c,nodeOrigin:d,onNodeDrag:u,onSelectionDrag:f,onError:h,updateNodePositions:m}=t();i={x:e,y:n};let y=!1;const x=a.size>1,v=x&&s?zr(Cr(a)):null,b=x&&c?function({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Zr(i,t);return{x:s.x-i.x,y:s.y-i.y}}({dragItems:a,snapGrid:l,x:e,y:n}):null;for(const[t,o]of a){if(!r.has(t))continue;let i={x:e-o.distance.x,y:n-o.distance.y};c&&(i=b?{x:Math.round(i.x+b.x),y:Math.round(i.y+b.y)}:Zr(i,l));let a=null;if(x&&s&&!o.extent&&v){const{positionAbsolute:e}=o.internals,t=e.x-v.x+s[0][0],n=e.x+o.measured.width-v.x2+s[1][0];a=[[t,e.y-v.y+s[0][1]],[n,e.y+o.measured.height-v.y2+s[1][1]]]}const{position:u,positionAbsolute:f}=Er({nodeId:t,nextPosition:i,nodeLookup:r,nodeExtent:a||s,nodeOrigin:d,onError:h});y=y||o.position.x!==u.x||o.position.y!==u.y,o.position=u,o.internals.positionAbsolute=f}if(p=p||y,y&&(m(a,!0),g&&(o||u||!w&&f))){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});o?.(g,a,e,t),u?.(g,e,t),w||f?.(g,t)}}async function k(){if(!d)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(s);const[a,u]=Ir(c,d,o);0===a&&0===u||(i.x=(i.x??0)-a/e[2],i.y=(i.y??0)-u/e[2],await n({x:a,y:u})&&_(i)),s=requestAnimationFrame(k)}function S(o){const{nodeLookup:r,multiSelectionActive:s,nodesDraggable:l,transform:c,snapGrid:f,snapToGrid:h,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();u=!0,p&&v||s||!w||r.get(w)?.selected||y(),v&&p&&w&&e?.(w);const x=ni(o.sourceEvent,{transform:c,snapGrid:f,snapToGrid:h,containerBounds:d});if(i=x,a=function(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!Bi(s,e))&&(s.draggable||t&&void 0===s.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,x,w),a.size>0&&(n||g||!w&&m)){const[e,t]=$i({nodeId:w,dragItems:a,nodeLookup:r});n?.(o.sourceEvent,a,e,t),g?.(o.sourceEvent,e,t),w||m?.(o.sourceEvent,t)}}f=dt(x);const C=Ct().clickDistance(b).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:s,snapToGrid:a}=t();d=n?.getBoundingClientRect()||null,h=!1,p=!1,g=e.sourceEvent,0===o&&S(e);const l=ni(e.sourceEvent,{transform:r,snapGrid:s,snapToGrid:a,containerBounds:d});i=l,c=li(e.sourceEvent,d)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:s,nodeDragThreshold:f,nodeLookup:p}=t(),m=ni(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:s,containerBounds:d});if(g=e.sourceEvent,("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||w&&!p.has(w))&&(h=!0),!h){if(!l&&n&&u&&(l=!0,k()),!u){const t=li(e.sourceEvent,d),n=t.x-c.x,o=t.y-c.y;Math.sqrt(n*n+o*o)>f&&S(e)}(i.x!==m.xSnapped||i.y!==m.ySnapped)&&a&&u&&(c=li(e.sourceEvent,d),_(m))}}).on("end",e=>{if(u&&!h){if(l=!1,u=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:s}=t();if(p&&(o(a,!1),p=!1),r||i||!w&&s){const[t,o]=$i({nodeId:w,dragItems:a,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,a,t,o),i?.(e.sourceEvent,t,o),w||s?.(e.sourceEvent,o)}}}else h&&a.size>0&&t().updateNodePositions(a,!1)}).filter(e=>{const t=e.target;return!e.button&&(!m||!Ti(t,`.${m}`,x))&&(!y||Ti(t,y,x))});f.call(C)},destroy:function(){f?.on(".drag",null)}}}({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{ka({id:t,store:l,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}}),()=>{u.current?.destroy(),u.current=void 0}},[t,l,e]),(0,a().useEffect)(()=>{!t&&e.current&&u.current&&u.current.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:i,nodeId:r,nodeClickDistance:s})},[n,o,t,i,e,r,s]),c}function Ca(){const e=bs(),t=(0,a().useCallback)(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:s,updateNodePositions:a,nodeLookup:l,nodeOrigin:c}=e.getState(),d=new Map,u=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),f=o?r[0]:5,h=o?r[1]:5,p=t.direction.x*f*t.factor,g=t.direction.y*h*t.factor;for(const[,e]of l){if(!u(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};o&&(t=Zr(t,r));const{position:i,positionAbsolute:a}=Er({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:s});e.position=i,e.internals.positionAbsolute=a,d.set(e.id,e)}a(d)},[]);return t}const Na=(0,a().createContext)(null),Ea=Na.Provider;Na.Consumer;const Ma=()=>(0,a().useContext)(Na),Pa=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),ja=(0,a().createContext)(null);function Da({children:e}){const t=ws(Pa,gs);return(0,c.jsx)(ja.Provider,{value:t,children:e})}const Ia={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Oa=(0,a().memo)(sa(function({type:e="source",position:t=wr.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:r=!0,isConnectableEnd:i=!0,id:s,onConnect:l,children:u,className:f,onMouseDown:h,onTouchStart:p,...g},m){const y=s||null,x="target"===e,v=bs(),w=Ma(),{connectOnClick:b,noPanClassName:_,rfId:k}=function(){const e=(0,a().useContext)(ja);if(!e)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return e}(),{connectingFrom:S,connectingTo:C,clickConnecting:N,isPossibleEndHandle:E,connectionInProcess:M,clickConnectionInProcess:P,valid:j}=ws(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:s}=o,{fromHandle:a,toHandle:l,isValid:c}=s;if(!a&&!r)return Ia;const d=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:a?.nodeId===e&&a?.id===t&&a?.type===n,connectingTo:d,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===pr.Strict?a?.type!==n:e!==a?.nodeId||t!==a?.id,connectionInProcess:!!a,clickConnectionInProcess:!!r,valid:d&&c}})(w,y,e),gs);w||v.getState().onError?.("010","Handle: No node id found. Make sure to only use a Handle inside a custom Node.");const D=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=v.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t,onError:n}=v.getState();t(function(e,t,n={}){return((e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006","Can't create edge. An edge needs a source and a target."),t;const o=n.getEdgeId||mi;let r;return r=_r(e)?{...e}:{...e,id:o(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(r,t)?t:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,t.concat(r))})(e,t,{...n,onError:n.onError??ra})}(r,e,{onError:n}))}n?.(r),l?.(r)},I=e=>{if(!w)return;const t=ai(e.nativeEvent);if(r&&(t&&0===e.button||!t)){const t=v.getState();Yi.onPointerDown(e.nativeEvent,{handleDomNode:e.currentTarget,autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:x,handleId:y,nodeId:w,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:(...e)=>v.getState().onConnectEnd?.(...e),updateConnection:t.updateConnection,onConnect:D,isValidConnection:n||((...e)=>v.getState().isValidConnection?.(...e)??!0),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?h?.(e):p?.(e)};return(0,c.jsx)("div",{"data-handleid":y,"data-nodeid":w,"data-handlepos":t,"data-id":`${k}-${w}-${y}-${e}`,className:d(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",_,f,{source:!x,target:x,connectable:o,connectablestart:r,connectableend:i,clickconnecting:N,connectingfrom:S,connectingto:C,valid:j,connectionindicator:o&&(!M||E)&&(M||P?i:r)}]),onMouseDown:I,onTouchStart:I,onClick:b?t=>{const{onClickConnectStart:o,onClickConnectEnd:i,connectionClickStartHandle:s,connectionMode:a,isValidConnection:l,lib:c,rfId:d,nodeLookup:u,connection:f}=v.getState();if(!w||!s&&!r)return;if(!s)return o?.(t.nativeEvent,{nodeId:w,handleId:y,handleType:e}),void v.setState({connectionClickStartHandle:{nodeId:w,type:e,id:y}});const h=ri(t.target),p=n||l,{connection:g,isValid:m}=Yi.isValid(t.nativeEvent,{handle:{nodeId:w,id:y,type:e},connectionMode:a,fromNodeId:s.nodeId,fromHandleId:s.id||null,fromType:s.type,isValidConnection:p,flowId:d,doc:h,lib:c,nodeLookup:u});m&&g&&D(g);const x=structuredClone(f);delete x.inProgress,x.toPosition=x.toHandle?x.toHandle.position:null,i?.(t,x),v.setState({connectionClickStartHandle:null})}:void 0,ref:m,...g,children:u})})),za={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Aa={input:function({data:e,isConnectable:t,sourcePosition:n=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[e?.label,(0,c.jsx)(Oa,{type:"source",position:n,isConnectable:t})]})},default:function({data:e,isConnectable:t,targetPosition:n=wr.Top,sourcePosition:o=wr.Bottom}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label,(0,c.jsx)(Oa,{type:"source",position:o,isConnectable:t})]})},output:function({data:e,isConnectable:t,targetPosition:n=wr.Top}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Oa,{type:"target",position:n,isConnectable:t}),e?.label]})},group:function(){return null}},Ra=e=>{const{width:t,height:n,x:o,y:r}=Cr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Hr(t)?t:null,height:Hr(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function La({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const o=bs(),{width:r,height:i,transformString:s,userSelectionActive:l}=ws(Ra,gs),u=Ca(),f=(0,a().useRef)(null);(0,a().useEffect)(()=>{n||f.current?.focus({preventScroll:!0})},[n]);const h=!l&&null!==r&&null!==i;if(Sa({nodeRef:f,disabled:!h}),!h)return null;const p=e?t=>{const n=o.getState().nodes.filter(e=>e.selected);e(t,n)}:void 0;return(0,c.jsx)("div",{className:d(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:(0,c.jsx)("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:p,tabIndex:n?void 0:-1,onKeyDown:n?void 0:e=>{Object.prototype.hasOwnProperty.call(za,e.key)&&(e.preventDefault(),u({direction:za[e.key],factor:e.shiftKey?4:1}))},style:{width:r,height:i}})})}const Ba="undefined"!=typeof window?window:void 0,Ta=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function $a({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:l,deleteKeyCode:d,selectionKeyCode:u,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:x,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:_,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:N,autoPanOnSelection:E,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,preventScrolling:I,onSelectionContextMenu:O,noWheelClassName:z,noPanClassName:A,disableKeyboardA11y:R,onViewportChange:L,isControlledViewport:B}){const{nodesSelectionActive:T,userSelectionActive:$}=ws(Ta,gs),V=qs(u,{target:Ba}),H=qs(y,{target:Ba}),Z=H||N,F=H||_,Y=f&&!0!==Z,X=V||$||Y;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=bs(),{deleteElements:o}=fa(),r=qs(e,{actInsideInputWithModifier:!1}),i=qs(t,{target:pa});(0,a().useEffect)(()=>{if(r){const{edges:e,nodes:t}=n.getState();o({nodes:t.filter(ha),edges:e.filter(ha)}),n.setState({nodesSelectionActive:!1})}},[r]),(0,a().useEffect)(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:d,multiSelectionKeyCode:m}),(0,c.jsx)(ya,{onPaneContextMenu:i,elementsSelectable:v,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:F,panActivationKeyPressed:H,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:C,panOnDrag:!V&&Z,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:D,zoomActivationKeyCode:x,preventScrolling:I,noWheelClassName:z,noPanClassName:A,onViewportChange:L,isControlledViewport:B,paneClickDistance:l,selectionOnDrag:Y,children:(0,c.jsxs)(_a,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:r,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:Z,autoPanOnSelection:E,isSelecting:!!X,selectionMode:h,selectionKeyPressed:V,paneClickDistance:l,selectionOnDrag:Y,children:[e,T&&(0,c.jsx)(La,{onSelectionContextMenu:O,noPanClassName:A,disableKeyboardA11y:R})]})})}$a.displayName="FlowRenderer";const Va=(0,a().memo)($a);const Ha=e=>e.updateNodeInternals;var Za=(0,a().memo)(function({id:e,onClick:t,onMouseEnter:n,onMouseMove:o,onMouseLeave:r,onContextMenu:i,onDoubleClick:s,nodesDraggable:l,elementsSelectable:u,nodesConnectable:f,nodesFocusable:h,resizeObserver:p,noDragClassName:g,noPanClassName:m,disableKeyboardA11y:y,rfId:x,nodeTypes:v,nodeClickDistance:w,onError:b}){const{node:_,internals:k,isParent:S}=ws(t=>{const n=t.nodeLookup.get(e),o=t.parentLookup.has(e);return{node:n,internals:n.internals,isParent:o}},gs);let C=_.type||"default",N=v?.[C]||Aa[C];void 0===N&&(b?.("003",(e=>`Node type "${e}" not found. Using fallback type "default".`)(C)),C="default",N=v?.default||Aa.default);const E=!!(_.draggable||l&&void 0===_.draggable),M=!!(_.selectable||u&&void 0===_.selectable),P=!!(_.connectable||f&&void 0===_.connectable),j=!!(_.focusable||h&&void 0===_.focusable),D=bs(),I=Ur(_),O=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=bs(),i=(0,a().useRef)(null),s=(0,a().useRef)(null),l=(0,a().useRef)(e.sourcePosition),c=(0,a().useRef)(e.targetPosition),d=(0,a().useRef)(t),u=n&&!!e.internals.handleBounds;return(0,a().useEffect)(()=>{!i.current||e.hidden||u&&s.current===i.current||(s.current&&o?.unobserve(s.current),o?.observe(i.current),s.current=i.current)},[u,e.hidden]),(0,a().useEffect)(()=>()=>{s.current&&(o?.unobserve(s.current),s.current=null)},[]),(0,a().useEffect)(()=>{if(i.current){const n=d.current!==t,o=l.current!==e.sourcePosition,s=c.current!==e.targetPosition;(n||o||s)&&(d.current=t,l.current=e.sourcePosition,c.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:_,nodeType:C,hasDimensions:I,resizeObserver:p}),z=Sa({nodeRef:O,disabled:_.hidden||!E,noDragClassName:g,handleSelector:_.dragHandle,nodeId:e,isSelectable:M,nodeClickDistance:w}),A=Ca();if(_.hidden)return null;const R=Gr(_),L=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(_),B=M||E||t||n||o||r,T=n?e=>n(e,{...k.userNode}):void 0,$=o?e=>o(e,{...k.userNode}):void 0,V=r?e=>r(e,{...k.userNode}):void 0,H=i?e=>i(e,{...k.userNode}):void 0,Z=s?e=>s(e,{...k.userNode}):void 0;return(0,c.jsx)("div",{className:d(["react-flow__node",`react-flow__node-${C}`,{[m]:E},_.className,{selected:_.selected,selectable:M,parent:S,draggable:E,dragging:z}]),ref:O,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:B?"all":"none",visibility:I?"visible":"hidden",..._.style,...L},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:T,onMouseMove:$,onMouseLeave:V,onContextMenu:H,onClick:n=>{const{selectNodesOnDrag:o,nodeDragThreshold:r}=D.getState();M&&(!o||!E||r>0)&&ka({id:e,store:D,nodeRef:O}),t&&t(n,{...k.userNode})},onDoubleClick:Z,onKeyDown:j?t=>{if(!si(t.nativeEvent)&&!y)if(fr.includes(t.key)&&M){const n="Escape"===t.key;ka({id:e,store:D,unselect:n,nodeRef:O})}else if(E&&_.selected&&Object.prototype.hasOwnProperty.call(za,t.key)){t.preventDefault();const{ariaLabelConfig:e}=D.getState();D.setState({ariaLiveMessage:e["node.a11yDescription.ariaLiveMessage"]({direction:t.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),A({direction:za[t.key],factor:t.shiftKey?4:1})}}:void 0,tabIndex:j?0:void 0,onFocus:j?()=>{if(y||!O.current?.matches(":focus-visible"))return;const{transform:t,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=D.getState();r&&(Nr(new Map([[e,_]]),{x:0,y:0,width:n,height:o},t,!0).length>0||i(_.position.x+R.width/2,_.position.y+R.height/2,{zoom:t[2]}))}:void 0,role:_.ariaRole??(j?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${Ss}-${x}`,"aria-label":_.ariaLabel,..._.domAttributes,children:(0,c.jsx)(Ea,{value:e,children:(0,c.jsx)(N,{id:e,data:_.data,type:C,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:_.selected??!1,selectable:M,draggable:E,deletable:_.deletable??!0,isConnectable:P,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:z,dragHandle:_.dragHandle,zIndex:k.z,parentId:_.parentId,...R})})})});const Fa=e=>({nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ya(e){const{nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,onError:r}=ws(Fa,gs),i=function(e){const t=ws((0,a().useCallback)((e=>t=>e?Nr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),gs);return t}(e.onlyRenderVisibleElements),s=function(){const e=ws(Ha),[t]=(0,a().useState)(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return(0,a().useEffect)(()=>()=>{t?.disconnect()},[t]),t}();return(0,c.jsx)("div",{className:"react-flow__nodes",style:ga,children:i.map(i=>(0,c.jsx)(Za,{id:i,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:s,nodesDraggable:e.nodesDraggable??!0,nodesConnectable:t,nodesFocusable:n,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:r},i))})}Ya.displayName="NodeRenderer";const Xa=(0,a().memo)(Ya),qa={[vr.Arrow]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return(0,c.jsx)("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},[vr.ArrowClosed]:({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return(0,c.jsx)("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})}},Wa=({id:e,type:t,color:n,width:o=12.5,height:r=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:l="auto-start-reverse"})=>{const d=function(e){const t=bs();return(0,a().useMemo)(()=>Object.prototype.hasOwnProperty.call(qa,e)?qa[e]:(t.getState().onError?.("009",(e=>`Marker type "${e}" doesn't exist.`)(e)),null),[e])}(t);return d?(0,c.jsx)("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${o}`,markerHeight:`${r}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:(0,c.jsx)(d,{color:n,strokeWidth:s})}):null},Ka=({defaultColor:e,rfId:t})=>{const n=ws(e=>e.edges),o=ws(e=>e.defaultEdgeOptions),r=(0,a().useMemo)(()=>{const r=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,s)=>([s.markerStart||o,s.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=Ni(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(n,{id:t,defaultColor:e,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd});return r},[n,o,t,e]);return r.length?(0,c.jsx)("svg",{className:"react-flow__marker","aria-hidden":"true",children:(0,c.jsx)("defs",{children:r.map(e=>(0,c.jsx)(Wa,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id))})}):null};Ka.displayName="MarkerDefinitions";var Ga=(0,a().memo)(Ka);function Ua({x:e,y:t,label:n,labelStyle:o,labelShowBg:r=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:l=2,children:u,className:f,...h}){const[p,g]=(0,a().useState)({x:1,y:0,width:0,height:0}),m=d(["react-flow__edge-textwrapper",f]),y=(0,a().useRef)(null);return(0,a().useEffect)(()=>{if(y.current){const e=y.current.getBBox();g({x:e.x,y:e.y,width:e.width,height:e.height})}},[n]),n?(0,c.jsxs)("g",{transform:`translate(${e-p.width/2} ${t-p.height/2})`,className:m,visibility:p.width?"visible":"hidden",...h,children:[r&&(0,c.jsx)("rect",{width:p.width+2*s[0],x:-s[0],y:-s[1],height:p.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),(0,c.jsx)("text",{className:"react-flow__edge-text",y:p.height/2,dy:"0.3em",ref:y,style:o,children:n}),u]}):null}Ua.displayName="EdgeText";const Qa=(0,a().memo)(Ua);function Ja({path:e,labelX:t,labelY:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l,interactionWidth:u=20,...f}){return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("path",{...f,d:e,fill:"none",className:d(["react-flow__edge-path",f.className])}),u?(0,c.jsx)("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}):null,o&&Hr(t)&&Hr(n)?(0,c.jsx)(Qa,{x:t,y:n,label:o,labelStyle:r,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:l}):null]})}function el({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===wr.Left||e===wr.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function tl({sourceX:e,sourceY:t,sourcePosition:n=wr.Bottom,targetX:o,targetY:r,targetPosition:i=wr.Top}){const[s,a]=el({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=el({pos:i,x1:o,y1:r,x2:e,y2:t}),[d,u,f,h]=di({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${a} ${l},${c} ${o},${r}`,d,u,f,h]}function nl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s,targetPosition:a,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})=>{const[v,w,b]=tl({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a}),_=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:_,path:v,labelX:w,labelY:b,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:x})})}const ol=nl({isInternal:!1}),rl=nl({isInternal:!0});function il(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,sourcePosition:p=wr.Bottom,targetPosition:g=wr.Top,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=bi({sourceX:n,sourceY:o,sourcePosition:p,targetX:r,targetY:i,targetPosition:g,borderRadius:x?.borderRadius,offset:x?.offset,stepPosition:x?.stepPosition}),k=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:k,path:w,labelX:b,labelY:_,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:y,interactionWidth:v})})}ol.displayName="SimpleBezierEdge",rl.displayName="SimpleBezierEdgeInternal";const sl=il({isInternal:!1}),al=il({isInternal:!0});function ll(e){return(0,a().memo)(({id:t,...n})=>{const o=e.isInternal?void 0:t;return(0,c.jsx)(sl,{...n,id:o,pathOptions:(0,a().useMemo)(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}sl.displayName="SmoothStepEdge",al.displayName="SmoothStepEdgeInternal";const cl=ll({isInternal:!1}),dl=ll({isInternal:!0});function ul(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})=>{const[y,x,v]=yi({sourceX:n,sourceY:o,targetX:r,targetY:i}),w=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:w,path:y,labelX:x,labelY:v,label:s,labelStyle:a,labelShowBg:l,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})})}cl.displayName="StepEdge",dl.displayName="StepEdgeInternal";const fl=ul({isInternal:!1}),hl=ul({isInternal:!0});function pl(e){return(0,a().memo)(({id:t,sourceX:n,sourceY:o,targetX:r,targetY:i,sourcePosition:s=wr.Bottom,targetPosition:a=wr.Top,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,pathOptions:x,interactionWidth:v})=>{const[w,b,_]=hi({sourceX:n,sourceY:o,sourcePosition:s,targetX:r,targetY:i,targetPosition:a,curvature:x?.curvature}),k=e.isInternal?void 0:t;return(0,c.jsx)(Ja,{id:k,path:w,labelX:b,labelY:_,label:l,labelStyle:d,labelShowBg:u,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})})}fl.displayName="StraightEdge",hl.displayName="StraightEdgeInternal";const gl=pl({isInternal:!1}),ml=pl({isInternal:!0});gl.displayName="BezierEdge",ml.displayName="BezierEdgeInternal";const yl={default:ml,straight:hl,step:dl,smoothstep:al,simplebezier:rl},xl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},vl=(e,t,n)=>n===wr.Left?e-t:n===wr.Right?e+t:e,wl=(e,t,n)=>n===wr.Top?e-t:n===wr.Bottom?e+t:e,bl="react-flow__edgeupdater";function _l({position:e,centerX:t,centerY:n,radius:o=10,onMouseDown:r,onMouseEnter:i,onMouseOut:s,type:a}){return(0,c.jsx)("circle",{onMouseDown:r,onMouseEnter:i,onMouseOut:s,className:d([bl,`${bl}-${a}`]),cx:vl(t,o,e),cy:wl(n,o,e),r:o,stroke:"transparent",fill:"transparent"})}function kl({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:o,sourceY:r,targetX:i,targetY:s,sourcePosition:a,targetPosition:l,onReconnect:d,onReconnectStart:u,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=bs(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:o,domNode:r,connectionMode:i,connectionRadius:s,lib:a,onConnectStart:l,cancelConnection:c,nodeLookup:p,rfId:m,panBy:y,updateConnection:x}=g.getState(),v="target"===t.type;Yi.onPointerDown(e.nativeEvent,{autoPanOnConnect:o,connectionMode:i,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:p,isTarget:v,edgeUpdaterType:t.type,lib:a,flowId:m,cancelConnection:c,panBy:y,isValidConnection:(...e)=>g.getState().isValidConnection?.(...e)??!0,onConnect:e=>d?.(n,e),onConnectStart:(o,r)=>{h(!0),u?.(e,n,t.type),l?.(o,r)},onConnectEnd:(...e)=>g.getState().onConnectEnd?.(...e),onReconnectEnd:(e,o)=>{h(!1),f?.(e,n,t.type,o)},updateConnection:x,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:e.currentTarget})},y=()=>p(!0),x=()=>p(!1);return(0,c.jsxs)(c.Fragment,{children:[(!0===e||"source"===e)&&(0,c.jsx)(_l,{position:a,centerX:o,centerY:r,radius:t,onMouseDown:e=>m(e,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:x,type:"source"}),(!0===e||"target"===e)&&(0,c.jsx)(_l,{position:l,centerX:i,centerY:s,radius:t,onMouseDown:e=>m(e,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:x,type:"target"})]})}var Sl=(0,a().memo)(function({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:o,onClick:r,onDoubleClick:i,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:f,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,rfId:y,edgeTypes:x,noPanClassName:v,onError:w,disableKeyboardA11y:b}){let _=ws(t=>t.edgeLookup.get(e));const k=ws(e=>e.defaultEdgeOptions);_=k?{...k,..._}:_;let S=_.type||"default",C=x?.[S]||yl[S];void 0===C&&(w?.("011",(e=>`Edge type "${e}" not found. Using fallback type "default".`)(S)),S="default",C=x?.default||yl.default);const N=!!(_.focusable||t&&void 0===_.focusable),E=void 0!==p&&(_.reconnectable||n&&void 0===_.reconnectable),M=!!(_.selectable||o&&void 0===_.selectable),P=(0,a().useRef)(null),[j,D]=(0,a().useState)(!1),[I,O]=(0,a().useState)(!1),z=bs(),{zIndex:A=_.zIndex,sourceX:R,sourceY:L,targetX:B,targetY:T,sourcePosition:$,targetPosition:V}=ws((0,a().useCallback)(t=>{const n=t.nodeLookup.get(_.source),o=t.nodeLookup.get(_.target);if(!n||!o)return xl;const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!_i(t)||!_i(n))return null;const o=t.internals.handleBounds||ki(t.handles),r=n.internals.handleBounds||ki(n.handles),i=Ci(o?.source??[],e.sourceHandle),s=Ci(e.connectionMode===pr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",((e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`)(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||wr.Bottom,l=s?.position||wr.Top,c=Si(t,i,a),d=Si(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:l}}({id:e,sourceNode:n,targetNode:o,sourceHandle:_.sourceHandle||null,targetHandle:_.targetHandle||null,connectionMode:t.connectionMode,onError:w}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){return"manual"===i?o:(r&&n?o+1e3:o)+Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0)}({selected:_.selected,zIndex:_.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:t.elevateEdgesOnSelect,zIndexMode:t.zIndexMode});return{...r||xl,zIndex:i}},[_.source,_.target,_.sourceHandle,_.targetHandle,_.selected,_.zIndex,w]),gs),H=(0,a().useMemo)(()=>_.markerStart?`url('#${Ni(_.markerStart,y)}')`:void 0,[_.markerStart,y]),Z=(0,a().useMemo)(()=>_.markerEnd?`url('#${Ni(_.markerEnd,y)}')`:void 0,[_.markerEnd,y]);if(_.hidden||null===R||null===L||null===B||null===T)return null;const F=i?e=>{i(e,{..._})}:void 0,Y=s?e=>{s(e,{..._})}:void 0,X=l?e=>{l(e,{..._})}:void 0,q=u?e=>{u(e,{..._})}:void 0,W=f?e=>{f(e,{..._})}:void 0;return(0,c.jsx)("svg",{style:{zIndex:A},children:(0,c.jsxs)("g",{className:d(["react-flow__edge",`react-flow__edge-${S}`,_.className,v,{selected:_.selected,animated:_.animated,inactive:!M&&!r,updating:j,selectable:M}]),onClick:t=>{const{addSelectedEdges:n,unselectNodesAndEdges:o,multiSelectionActive:i}=z.getState();M&&(z.setState({nodesSelectionActive:!1}),_.selected&&i?(o({nodes:[],edges:[_]}),P.current?.blur()):n([e])),r&&r(t,_)},onDoubleClick:F,onContextMenu:Y,onMouseEnter:X,onMouseMove:q,onMouseLeave:W,onKeyDown:N?t=>{if(!b&&fr.includes(t.key)&&M){const{unselectNodesAndEdges:n,addSelectedEdges:o}=z.getState();"Escape"===t.key?(P.current?.blur(),n({edges:[_]})):o([e])}}:void 0,tabIndex:N?0:void 0,role:_.ariaRole??(N?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":null===_.ariaLabel?void 0:_.ariaLabel||`Edge from ${_.source} to ${_.target}`,"aria-describedby":N?`${Cs}-${y}`:void 0,ref:P,..._.domAttributes,children:[!I&&(0,c.jsx)(C,{id:e,source:_.source,target:_.target,type:_.type,selected:_.selected,animated:_.animated,selectable:M,deletable:_.deletable??!0,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,sourceX:R,sourceY:L,targetX:B,targetY:T,sourcePosition:$,targetPosition:V,data:_.data,style:_.style,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerStart:H,markerEnd:Z,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth}),E&&(0,c.jsx)(kl,{edge:_,isReconnectable:E,reconnectRadius:h,onReconnect:p,onReconnectStart:g,onReconnectEnd:m,sourceX:R,sourceY:L,targetX:B,targetY:T,sourcePosition:$,targetPosition:V,setUpdateHover:D,setReconnecting:O})]})})});const Cl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Nl({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:o,noPanClassName:r,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:d,onEdgeMouseLeave:u,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,onError:b}=ws(Cl,gs),_=(k=t,ws((0,a().useCallback)(e=>{if(!k)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&gi({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[k]),gs));var k;return(0,c.jsxs)("div",{className:"react-flow__edges",children:[(0,c.jsx)(Ga,{defaultColor:e,rfId:n}),_.map(e=>(0,c.jsx)(Sl,{id:e,edgesFocusable:x,edgesReconnectable:v,elementsSelectable:w,noPanClassName:r,onReconnect:i,onContextMenu:s,onMouseEnter:l,onMouseMove:d,onMouseLeave:u,onClick:f,reconnectRadius:h,onDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,rfId:n,onError:b,edgeTypes:o,disableKeyboardA11y:y},e))]})}Nl.displayName="EdgeRenderer";const El=(0,a().memo)(Nl),Ml=e=>`translate(${e[0]}px,${e[1]}px) scale(${e[2]})`;function Pl({children:e}){const t=bs(),n=(0,a().useRef)(null),[o]=(0,a().useState)(()=>t.getState().transform);return aa(()=>{let e=null;const o=()=>{const o=t.getState().transform;e&&o[0]===e[0]&&o[1]===e[1]&&o[2]===e[2]||(e=o,n.current&&(n.current.style.transform=Ml(o)))};return o(),t.subscribe(o)},[t]),(0,c.jsx)("div",{ref:n,className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:Ml(o)},children:e})}const jl=e=>e.panZoom?.syncViewport;function Dl(e){return e.connection.inProgress?{...e.connection,to:Fr(e.connection.to,e.transform)}:{...e.connection}}const Il=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Ol({containerStyle:e,style:t,type:n,component:o}){const{nodesConnectable:r,width:i,height:s,isValid:a,inProgress:l}=ws(Il,gs);return i&&r&&l?(0,c.jsx)("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:(0,c.jsx)("g",{className:d(["react-flow__connection",ti(a)]),children:(0,c.jsx)(zl,{style:t,type:n,CustomComponent:o,isValid:a})})}):null}const zl=({style:e,type:t=xr.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:r,from:i,fromNode:s,fromHandle:a,fromPosition:l,to:d,toNode:u,toHandle:f,toPosition:h,pointer:p}=ws(function(e){return e?t=>{const n=Dl(t);return e(n)}:Dl}(g),gs);var g;if(!r)return;if(n)return(0,c.jsx)(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:l,toPosition:h,connectionStatus:ti(o),toNode:u,toHandle:f,pointer:p});let m="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:l,targetX:d.x,targetY:d.y,targetPosition:h};switch(t){case xr.Bezier:[m]=hi(y);break;case xr.SimpleBezier:[m]=tl(y);break;case xr.Step:[m]=bi({...y,borderRadius:0});break;case xr.SmoothStep:[m]=bi(y);break;default:[m]=yi(y)}return(0,c.jsx)("path",{d:m,fill:"none",className:"react-flow__connection-path",style:e})};zl.displayName="ConnectionLine";const Al={};function Rl(e=Al){(0,a().useRef)(e),bs(),(0,a().useEffect)(()=>{},[e])}function Ll({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:o,onEdgeClick:r,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:p,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:v,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:C,deleteKeyCode:N,onlyRenderVisibleElements:E,elementsSelectable:M,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,preventScrolling:O,defaultMarkerColor:z,zoomOnScroll:A,zoomOnPinch:R,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,zoomOnDoubleClick:$,panOnDrag:V,autoPanOnSelection:H,onPaneClick:Z,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneScroll:q,onPaneContextMenu:W,paneClickDistance:K,nodeClickDistance:G,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,viewport:ue,onViewportChange:fe,nodesDraggable:he}){return Rl(e),Rl(t),bs(),(0,a().useRef)(!1),(0,a().useEffect)(()=>{},[]),function(e){const t=fa(),n=(0,a().useRef)(!1);(0,a().useEffect)(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(n),function(e){const t=ws(jl),n=bs();(0,a().useEffect)(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(ue),(0,c.jsx)(Va,{onPaneClick:Z,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:X,onPaneContextMenu:W,onPaneScroll:q,paneClickDistance:K,deleteKeyCode:N,selectionKeyCode:w,selectionOnDrag:b,selectionMode:_,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:k,panActivationKeyCode:S,zoomActivationKeyCode:C,elementsSelectable:M,zoomOnScroll:A,zoomOnPinch:R,zoomOnDoubleClick:$,panOnScroll:L,panOnScrollSpeed:B,panOnScrollMode:T,panOnDrag:V,autoPanOnSelection:H,defaultViewport:P,translateExtent:j,minZoom:D,maxZoom:I,onSelectionContextMenu:h,preventScrolling:O,noDragClassName:ie,noWheelClassName:se,noPanClassName:ae,disableKeyboardA11y:le,onViewportChange:fe,isControlledViewport:!!ue,children:(0,c.jsxs)(Pl,{children:[(0,c.jsx)(El,{edgeTypes:t,onEdgeClick:r,onEdgeDoubleClick:s,onReconnect:ne,onReconnectStart:oe,onReconnectEnd:re,onlyRenderVisibleElements:E,onEdgeContextMenu:U,onEdgeMouseEnter:Q,onEdgeMouseMove:J,onEdgeMouseLeave:ee,reconnectRadius:te,defaultMarkerColor:z,noPanClassName:ae,disableKeyboardA11y:le,rfId:de}),(0,c.jsx)(Ol,{style:y,type:m,component:x,containerStyle:v}),(0,c.jsx)("div",{className:"react-flow__edgelabel-renderer"}),(0,c.jsx)(Xa,{nodeTypes:e,onNodeClick:o,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:d,onNodeMouseLeave:u,onNodeContextMenu:f,nodeClickDistance:G,onlyRenderVisibleElements:E,noPanClassName:ae,noDragClassName:ie,disableKeyboardA11y:le,nodeExtent:ce,rfId:de,nodesDraggable:he}),(0,c.jsx)("div",{className:"react-flow__viewport-portal"})]})})}Ll.displayName="GraphView";const Bl=(0,a().memo)(Ll),Tl=(e,t)=>{},$l=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l=.5,maxZoom:c=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,p=new Map,g=new Map,m=new Map,y=o??t??[],x=n??e??[],v=d??[0,0],w=u??ur;Li(g,m,y);const{nodesInitialized:b}=Ii(x,h,p,{nodeOrigin:v,nodeExtent:w,zIndexMode:f});let _=[0,0,1];if(s&&r&&i){const e=Cr(h,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=qr(e,r,i,l,c,a?.padding??.1);_=[t,n,o]}return{rfId:"1",width:r??0,height:i??0,transform:_,nodes:x,nodesInitialized:b,nodeLookup:h,parentLookup:p,edges:y,edgeLookup:m,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:ur,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:pr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...yr},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Tl,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:hr,zIndexMode:f,defaultEdgeOptions:void 0,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map,onNodesDelete:void 0,onEdgesDelete:void 0,onDelete:void 0,onBeforeDelete:void 0,onViewportChangeStart:void 0,onViewportChange:void 0,onViewportChangeEnd:void 0,onNodeDragStart:void 0,onNodeDrag:void 0,onNodeDragStop:void 0,onSelectionDragStart:void 0,onSelectionDrag:void 0,onSelectionDragStop:void 0,onMoveStart:void 0,onMove:void 0,onMoveEnd:void 0,onConnect:void 0,onConnectStart:void 0,onConnectEnd:void 0,onClickConnectStart:void 0,onClickConnectEnd:void 0}},Vl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>{return h=(h,p)=>{async function g(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:s,maxZoom:a}=p();t&&(await async function({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(0===e.size)return!0;const a=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{let r;if(t?.includeHiddenNodes){const{width:t,height:n}=Gr(e);r=t>0&&n>0}else r=Boolean(e.measured.width&&e.measured.height&&!e.hidden);!r||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,s),l=Cr(a),c=qr(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}({nodes:e,width:r,height:i,panZoom:t,minZoom:s,maxZoom:a},n),o?.resolve(!0),h({fitViewResolver:null}))}return{...$l({nodes:e,edges:t,width:r,height:i,fitView:s,fitViewOptions:a,minZoom:l,maxZoom:c,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:o,zIndexMode:f}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,fitViewQueued:s,zIndexMode:a,nodesSelectionActive:l}=p(),{nodesInitialized:c,hasSelectedNodes:d}=Ii(e,t,n,{nodeOrigin:o,nodeExtent:r,elevateNodesOnSelect:i,checkEquality:!0,zIndexMode:a}),u=l&&d;s&&c?(g(),h({nodes:e,nodesInitialized:c,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:u})):h({nodes:e,nodesInitialized:c,nodesSelectionActive:u})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=p();Li(t,n,e),h({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=p();t(e),h({hasDefaultNodes:!0})}if(t){const{setEdges:e}=p();e(t),h({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:s,debug:a,fitViewQueued:l,zIndexMode:c}=p(),{changes:d,updatedInternals:u}=function(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),l=!0;continue}const a=oi(o.nodeElement),d=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(d||!e.internals.handleBounds||o.force)){const h=o.nodeElement.getBoundingClientRect(),p=Kr(e.extent)?e.extent:i;let{positionAbsolute:g}=e.internals;if(e.parentId&&"parent"===e.extent){const n=t.get(e.parentId);n&&(g=jr(g,a,n))}else p&&(g=Pr(g,p,a));const m={...e,measured:a,internals:{...e.internals,positionAbsolute:g,handleBounds:{source:ci("source",o.nodeElement,h,u,e.id),target:ci("target",o.nodeElement,h,u,e.id)}}};t.set(e.id,m),e.parentId&&Oi(m,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,d&&(c.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&f.push({id:e.id,parentId:e.parentId,rect:Rr(m,r)}))}}if(f.length>0){const e=Ai(f,t,n,r);c.push(...e)}return{changes:c,updatedInternals:l}}(e,n,o,r,i,s,c);u&&(function(e,t,n){const o=Pi(Ei,n);for(const n of e.values())if(n.parentId)Oi(n,e,t,o);else{const e=Sr(n,o.nodeOrigin),t=Kr(n.extent)?n.extent:o.nodeExtent,r=Pr(e,t,Gr(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:s,zIndexMode:c}),l?(g(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),d?.length>0&&(a&&console.log("React Flow: trigger node changes",d),t?.(d)))},updateNodePositions:(e,t=!1)=>{const n=[];let o=[];const{nodeLookup:r,triggerNodeChanges:i,connection:s,updateConnection:a,onNodesChangeMiddlewareMap:l}=p();for(const[i,l]of e){const e=r.get(i),c=!!(e?.expandParent&&e?.parentId&&l?.position),d={id:i,type:"position",position:c?{x:Math.max(0,l.position.x),y:Math.max(0,l.position.y)}:l.position,dragging:t};if(e&&s.inProgress&&s.fromNode.id===e.id){const t=Si(e,s.fromHandle,wr.Left,!0);a({...s,from:t})}c&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...l.internals.positionAbsolute,width:l.measured.width??0,height:l.measured.height??0}}),o.push(d)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=p(),i=Ai(n,r,e,t);o.push(...i)}for(const e of l.values())o=e(o);i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=p();e?.length&&(r&&n(Qs(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=p();e?.length&&(r&&n(Js(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?r(e.map(e=>ea(e,!0))):(r(ta(o,new Set([...e]),!0)),i(ta(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=p();t?i(e.map(e=>ea(e,!0))):(i(ta(n,new Set([...e]))),r(ta(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:s}=p(),a=e||o,l=t||n,c=[];for(const e of a){if(!e.selected)continue;const t=r.get(e.id);t&&(t.selected=!1),c.push(ea(e.id,!1))}const d=[];for(const e of l)e.selected&&d.push(ea(e.id,!1));i(c),s(d)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=p();t?.setScaleExtent([e,n]),h({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=p();t?.setScaleExtent([n,e]),h({maxZoom:e})},setTranslateExtent:e=>{p().panZoom?.setTranslateExtent(e),h({translateExtent:e})},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=p();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]),s=e.reduce((e,t)=>t.selected?[...e,ea(t.id,!1)]:e,[]);n(i),o(s)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:s,zIndexMode:a}=p();e[0][0]===s[0][0]&&e[0][1]===s[0][1]&&e[1][0]===s[1][0]&&e[1][1]===s[1][1]||(Ii(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1,zIndexMode:a}),h({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=p();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:s}=p();if(!s)return!1;const a=void 0!==n?.zoom?n.zoom:i;return await s.setViewport({x:o/2-e*a,y:r/2-t*a,zoom:a},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),!0},cancelConnection:()=>{h({connection:{...yr}})},updateConnection:e=>{h({connection:e})},reset:()=>h({...$l()})}},p=Object.is,h?ps(h,p):ps;var h,p};function Hl({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:o,initialWidth:r,initialHeight:i,initialMinZoom:s,initialMaxZoom:l,initialFitViewOptions:d,fitView:u,nodeOrigin:f,nodeExtent:h,zIndexMode:p,children:g}){const[m]=(0,a().useState)(()=>Vl({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:u,minZoom:s,maxZoom:l,fitViewOptions:d,nodeOrigin:f,nodeExtent:h,zIndexMode:p}));return(0,c.jsx)(xs,{value:m,children:(0,c.jsx)(da,{children:(0,c.jsx)(Da,{children:g})})})}function Zl({children:e,nodes:t,edges:n,defaultNodes:o,defaultEdges:r,width:i,height:s,fitView:l,fitViewOptions:d,minZoom:u,maxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g}){return(0,a().useContext)(ys)?(0,c.jsx)(c.Fragment,{children:e}):(0,c.jsx)(Hl,{initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:r,initialWidth:i,initialHeight:s,fitView:l,initialFitViewOptions:d,initialMinZoom:u,initialMaxZoom:f,nodeOrigin:h,nodeExtent:p,zIndexMode:g,children:e})}const Fl={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Yl=sa(function({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,className:r,nodeTypes:i,edgeTypes:s,onNodeClick:l,onEdgeClick:u,onInit:f,onMove:h,onMoveStart:p,onMoveEnd:g,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onSelectionChange:I,onSelectionDragStart:O,onSelectionDrag:z,onSelectionDragStop:A,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:B,onBeforeDelete:T,connectionMode:$,connectionLineType:V=xr.Bezier,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:F,deleteKeyCode:Y="Backspace",selectionKeyCode:X="Shift",selectionOnDrag:q=!1,selectionMode:W=mr.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:G=(Wr()?"Meta":"Control"),zoomActivationKeyCode:U=(Wr()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:se=Ts,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:de=$s,minZoom:ue=.5,maxZoom:fe=2,translateExtent:he=ur,preventScrolling:pe=!0,nodeExtent:ge,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:xe=!0,panOnScroll:ve=!1,panOnScrollSpeed:we=.5,panOnScrollMode:be=gr.Free,zoomOnDoubleClick:_e=!0,panOnDrag:ke=!0,onPaneClick:Se,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je=1,nodeClickDistance:De=0,children:Ie,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:$e,reconnectRadius:Ve=10,onNodesChange:He,onEdgesChange:Ze,noDragClassName:Fe="nodrag",noWheelClassName:Ye="nowheel",noPanClassName:Xe="nopan",fitView:qe,fitViewOptions:We,connectOnClick:Ke,attributionPosition:Ge,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je=!0,elevateEdgesOnSelect:et=!1,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanOnSelection:rt=!0,autoPanSpeed:it,connectionRadius:st,isValidConnection:at,onError:lt,style:ct,id:dt,nodeDragThreshold:ut,connectionDragThreshold:ft,viewport:ht,onViewportChange:pt,width:gt,height:mt,colorMode:yt="light",debug:xt,onScroll:vt,ariaLabelConfig:wt,zIndexMode:bt="basic",..._t},kt){const St=dt||"1",Ct=function(e){const[t,n]=(0,a().useState)("system"===e?null:e);return(0,a().useEffect)(()=>{if("system"!==e)return void n(e);const t=Ys(),o=()=>n(t?.matches?"dark":"light");return o(),t?.addEventListener("change",o),()=>{t?.removeEventListener("change",o)}},[e]),null!==t?t:Ys()?.matches?"dark":"light"}(yt),Nt=(0,a().useCallback)(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return(0,c.jsx)("div",{"data-testid":"rf__wrapper",..._t,onScroll:Nt,style:{...ct,...Fl},ref:kt,className:d(["react-flow",r,Ct]),id:dt,role:"application",children:(0,c.jsxs)(Zl,{nodes:e,edges:t,width:gt,height:mt,fitView:qe,fitViewOptions:We,minZoom:ue,maxZoom:fe,nodeOrigin:se,nodeExtent:ge,zIndexMode:bt,children:[(0,c.jsx)(Fs,{nodes:e,edges:t,defaultNodes:n,defaultEdges:o,onConnect:m,onConnectStart:y,onConnectEnd:x,onClickConnectStart:v,onClickConnectEnd:w,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:ae,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:ue,maxZoom:fe,nodeExtent:ge,onNodesChange:He,onEdgesChange:Ze,snapToGrid:Q,snapGrid:J,connectionMode:$,translateExtent:he,connectOnClick:Ke,defaultEdgeOptions:Qe,fitView:qe,fitViewOptions:We,onNodesDelete:P,onEdgesDelete:j,onDelete:D,onNodeDragStart:N,onNodeDrag:E,onNodeDragStop:M,onSelectionDrag:z,onSelectionDragStart:O,onSelectionDragStop:A,onMove:h,onMoveStart:p,onMoveEnd:g,noPanClassName:Xe,nodeOrigin:se,rfId:St,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:it,onError:lt,connectionRadius:st,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:ft,onBeforeDelete:T,debug:xt,ariaLabelConfig:wt,zIndexMode:bt}),(0,c.jsx)(Bl,{onInit:f,onNodeClick:l,onEdgeClick:u,onNodeMouseEnter:b,onNodeMouseMove:_,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:s,connectionLineType:V,connectionLineStyle:H,connectionLineComponent:Z,connectionLineContainerStyle:F,selectionKeyCode:X,selectionOnDrag:q,selectionMode:W,deleteKeyCode:Y,multiSelectionKeyCode:G,panActivationKeyCode:K,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:de,translateExtent:he,minZoom:ue,maxZoom:fe,preventScrolling:pe,zoomOnScroll:ye,zoomOnPinch:xe,zoomOnDoubleClick:_e,panOnScroll:ve,panOnScrollSpeed:we,panOnScrollMode:be,panOnDrag:ke,autoPanOnSelection:rt,onPaneClick:Se,onPaneMouseEnter:Ce,onPaneMouseMove:Ne,onPaneMouseLeave:Ee,onPaneScroll:Me,onPaneContextMenu:Pe,paneClickDistance:je,nodeClickDistance:De,onSelectionContextMenu:R,onSelectionStart:L,onSelectionEnd:B,onReconnect:Oe,onReconnectStart:ze,onReconnectEnd:Ae,onEdgeContextMenu:Re,onEdgeDoubleClick:Le,onEdgeMouseEnter:Be,onEdgeMouseMove:Te,onEdgeMouseLeave:$e,reconnectRadius:Ve,defaultMarkerColor:me,noDragClassName:Fe,noWheelClassName:Ye,noPanClassName:Xe,rfId:St,disableKeyboardA11y:tt,nodeExtent:ge,viewport:ht,onViewportChange:pt,nodesDraggable:ne}),(0,c.jsx)(Bs,{onSelectionChange:I}),Ie,(0,c.jsx)(Is,{proOptions:Ue,position:Ge}),(0,c.jsx)(Ps,{rfId:St,disableKeyboardA11y:tt})]})})});const Xl=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function ql({children:e}){const t=ws(Xl);return t?(0,ms.createPortal)(e,t):null}function Wl({dimensions:e,lineWidth:t,variant:n,className:o}){return(0,c.jsx)("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:d(["react-flow__background-pattern",n,o])})}function Kl({radius:e,className:t}){return(0,c.jsx)("circle",{cx:e,cy:e,r:e,className:d(["react-flow__background-pattern","dots",t])})}var Gl;!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Gl||(Gl={}));const Ul={[Gl.Dots]:1,[Gl.Lines]:1,[Gl.Cross]:6},Ql=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Jl({id:e,variant:t=Gl.Dots,gap:n=20,size:o,lineWidth:r=1,offset:i=0,color:s,bgColor:l,style:u,className:f,patternClassName:h}){const p=(0,a().useRef)(null),{transform:g,patternId:m}=ws(Ql,gs),y=o||Ul[t],x=t===Gl.Dots,v=t===Gl.Cross,w=Array.isArray(n)?n:[n,n],b=[w[0]*g[2]||1,w[1]*g[2]||1],_=y*g[2],k=Array.isArray(i)?i:[i,i],S=v?[_,_]:b,C=[k[0]*g[2]+S[0]/2,k[1]*g[2]+S[1]/2],N=`${m}${e||""}`;return(0,c.jsxs)("svg",{className:d(["react-flow__background",f]),style:{...u,...ga,"--xy-background-color-props":l,"--xy-background-pattern-color-props":s},ref:p,"data-testid":"rf__background",children:[(0,c.jsx)("pattern",{id:N,x:g[0]%b[0],y:g[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:x?(0,c.jsx)(Kl,{radius:_/2,className:h}):(0,c.jsx)(Wl,{dimensions:S,lineWidth:r,variant:t,className:h})}),(0,c.jsx)("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${N})`})]})}Jl.displayName="Background";const ec=(0,a().memo)(Jl);function tc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:(0,c.jsx)("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function nc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:(0,c.jsx)("path",{d:"M0 0h32v4.2H0z"})})}function oc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:(0,c.jsx)("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function rc(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function ic(){return(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:(0,c.jsx)("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function sc({children:e,className:t,...n}){return(0,c.jsx)("button",{type:"button",className:d(["react-flow__controls-button",t]),...n,children:e})}const ac=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function lc({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:r,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:l,className:u,children:f,position:h="bottom-left",orientation:p="vertical","aria-label":g}){const m=bs(),{isInteractive:y,minZoomReached:x,maxZoomReached:v,ariaLabelConfig:w}=ws(ac,gs),{zoomIn:b,zoomOut:_,fitView:k}=fa(),S="horizontal"===p?"horizontal":"vertical";return(0,c.jsxs)(js,{className:d(["react-flow__controls",S,u]),position:h,style:e,"data-testid":"rf__controls","aria-label":g??w["controls.ariaLabel"],children:[t&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(sc,{onClick:()=>{b(),i?.()},className:"react-flow__controls-zoomin",title:w["controls.zoomIn.ariaLabel"],"aria-label":w["controls.zoomIn.ariaLabel"],disabled:v,children:(0,c.jsx)(tc,{})}),(0,c.jsx)(sc,{onClick:()=>{_(),s?.()},className:"react-flow__controls-zoomout",title:w["controls.zoomOut.ariaLabel"],"aria-label":w["controls.zoomOut.ariaLabel"],disabled:x,children:(0,c.jsx)(nc,{})})]}),n&&(0,c.jsx)(sc,{className:"react-flow__controls-fitview",onClick:()=>{k(r),a?.()},title:w["controls.fitView.ariaLabel"],"aria-label":w["controls.fitView.ariaLabel"],children:(0,c.jsx)(oc,{})}),o&&(0,c.jsx)(sc,{className:"react-flow__controls-interactive",onClick:()=>{m.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),l?.(!y)},title:w["controls.interactive.ariaLabel"],"aria-label":w["controls.interactive.ariaLabel"],children:y?(0,c.jsx)(ic,{}):(0,c.jsx)(rc,{})}),f]})}lc.displayName="Controls";const cc=(0,a().memo)(lc),dc=(0,a().memo)(function({id:e,x:t,y:n,width:o,height:r,style:i,color:s,strokeColor:a,strokeWidth:l,className:u,borderRadius:f,shapeRendering:h,selected:p,onClick:g}){const{background:m,backgroundColor:y}=i||{},x=s||m||y;return(0,c.jsx)("rect",{className:d(["react-flow__minimap-node",{selected:p},u]),x:t,y:n,rx:f,ry:f,width:o,height:r,style:{fill:x,stroke:a,strokeWidth:l},shapeRendering:h,onClick:g?t=>g(t,e):void 0})}),uc=e=>e.nodes.map(e=>e.id),fc=e=>e instanceof Function?e:()=>e,hc=(0,a().memo)(function({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:r,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:l}){const{node:d,x:u,y:f,width:h,height:p}=ws(t=>{const n=t.nodeLookup.get(e);if(!n)return{node:void 0,x:0,y:0,width:0,height:0};const o=n.internals.userNode,{x:r,y:i}=n.internals.positionAbsolute,{width:s,height:a}=Gr(o);return{node:o,x:r,y:i,width:s,height:a}},gs);return d&&!d.hidden&&Ur(d)?(0,c.jsx)(a,{x:u,y:f,width:h,height:p,style:d.style,selected:!!d.selected,className:o(d),color:t(d),borderRadius:r,strokeColor:n(d),strokeWidth:i,shapeRendering:s,onClick:l,id:d.id}):null});var pc=(0,a().memo)(function({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:r,nodeComponent:i=dc,onClick:s}){const a=ws(uc,gs),l=fc(t),d=fc(e),u=fc(n),f="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return(0,c.jsx)(c.Fragment,{children:a.map(e=>(0,c.jsx)(hc,{id:e,nodeColorFunc:l,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:o,nodeStrokeWidth:r,NodeComponent:i,onClick:s,shapeRendering:f},e))})});const gc=e=>!e.hidden,mc=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};let n=!1;for(const t of e.nodeLookup.values())if(!t.hidden){n=!0;break}return{viewBB:t,boundingRect:n?Br(Cr(e.nodeLookup,{filter:gc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},yc=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,xc=(e,t)=>yc(e.viewBB,t.viewBB)&&yc(e.boundingRect,t.boundingRect)&&e.rfId===t.rfId&&e.panZoom===t.panZoom&&e.translateExtent===t.translateExtent&&e.flowWidth===t.flowWidth&&e.flowHeight===t.flowHeight&&e.ariaLabelConfig===t.ariaLabelConfig;function vc({style:e,className:t,nodeStrokeColor:n,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l,bgColor:u,maskColor:f,maskStrokeColor:h,maskStrokeWidth:p,position:g="bottom-right",onClick:m,onNodeClick:y,pannable:x=!1,zoomable:v=!1,ariaLabel:w,inversePan:b,zoomStep:_=1,offsetScale:k=5}){const S=bs(),C=(0,a().useRef)(null),{boundingRect:N,panZoom:E,viewBB:M,rfId:P,translateExtent:j,flowWidth:D,flowHeight:I,ariaLabelConfig:O}=ws(mc,xc),z=e?.width??200,A=e?.height??150,R=N.width/z,L=N.height/A,B=Math.max(R,L),T=B*z,$=B*A,V=k*B,H=N.x-(T-N.width)/2-V,Z=N.y-($-N.height)/2-V,F=T+2*V,Y=$+2*V,X=`react-flow__minimap-desc-${P}`,q=(0,a().useRef)(0),W=(0,a().useRef)();q.current=B,(0,a().useEffect)(()=>{const e=S.getState().panZoom;if(C.current&&e)return W.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=dt(e);return{update:function({translateExtent:e,width:i,height:s,zoomStep:a=1,pannable:l=!0,zoomable:c=!0,inversePan:d=!1}){let u=[0,0];const f=ir().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(u=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const a=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-u[0],l[1]-u[1]];u=l;const f=o()*Math.max(a[2],Math.log(a[2]))*(d?-1:1),h={x:a[0]-c[0]*f,y:a[1]-c[1]*f},p=[[0,0],[i,s]];t.setViewportConstrained({x:h.x,y:h.y,zoom:a[2]},p,e)}:null).on("zoom.wheel",c?e=>{if("wheel"!==e.sourceEvent.type||!t)return;const o=n(),r=e.sourceEvent.ctrlKey&&Wr()?10:1,i=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*a,s=o[2]*Math.pow(2,i*r);t.scaleTo(s)}:null);r.call(f,{})},destroy:function(){r.on("zoom",null)},pointer:ft}}({domNode:C.current,panZoom:e,getTransform:()=>S.getState().transform,getViewScale:()=>q.current}),()=>{W.current?.destroy()}},[E]),(0,a().useEffect)(()=>{W.current?.update({translateExtent:j,width:D,height:I,inversePan:b,pannable:x,zoomStep:_,zoomable:v})},[x,v,b,_,j,D,I]);const K=m?e=>{const[t,n]=W.current?.pointer(e)||[0,0];m(e,{x:t,y:n})}:void 0,G=(0,a().useCallback)((e,t)=>{const n=S.getState().nodeLookup.get(t).internals.userNode;y?.(e,n)},[y]),U=y?G:void 0,Q=w??O["minimap.ariaLabel"];return(0,c.jsx)(js,{position:g,style:{...e,"--xy-minimap-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof h?h:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof p?p*B:void 0,"--xy-minimap-node-background-color-props":"string"==typeof o?o:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof n?n:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof s?s:void 0},className:d(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:(0,c.jsxs)("svg",{width:z,height:A,viewBox:`${H} ${Z} ${F} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":X,ref:C,onClick:K,children:[Q&&(0,c.jsx)("title",{id:X,children:Q}),(0,c.jsx)(pc,{onClick:U,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:r,nodeStrokeWidth:s,nodeComponent:l}),(0,c.jsx)("path",{className:"react-flow__minimap-mask",d:`M${H-V},${Z-V}h${F+2*V}v${Y+2*V}h${-F-2*V}z\n M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}vc.displayName="MiniMap";const wc=(0,a().memo)(vc),bc={[es.Line]:"right",[es.Handle]:"bottom-right"};(0,a().memo)(function({nodeId:e,position:t,variant:n=es.Handle,className:o,style:r,children:i,color:s,minWidth:l=10,minHeight:u=10,maxWidth:f=Number.MAX_VALUE,maxHeight:h=Number.MAX_VALUE,keepAspectRatio:p=!1,resizeDirection:g,autoScale:m=!0,shouldResize:y,onResizeStart:x,onResize:v,onResizeEnd:w}){const b=Ma(),_="string"==typeof e?e:b,k=bs(),S=(0,a().useRef)(null),C=n===es.Handle,N=ws((0,a().useCallback)((E=C&&m,e=>E?`${Math.max(1/e.transform[2],1)}`:void 0),[C,m]),gs);var E;const M=(0,a().useRef)(null),P=t??bc[n];(0,a().useEffect)(()=>{if(S.current&&_)return M.current||(M.current=function({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=dt(e);let s={controlDirection:ts("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:l,resizeDirection:c,onResizeStart:d,onResize:u,onResizeEnd:f,shouldResize:h}){let p,g={...ss},m={...as};s={boundaries:a,resizeDirection:c,keepAspectRatio:l,controlDirection:ts(e)};let y,x,v,w=null,b=[];const _=Ct().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:s,nodeOrigin:a,paneDomNode:l}=n();if(p=o.get(t),!p)return;w=l?.getBoundingClientRect()??null;const{xSnapped:c,ySnapped:u}=ni(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:s,containerBounds:w});g={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},m={...g,pointerX:c,pointerY:u,aspectRatio:g.width/g.height},y=void 0,x=Kr(p.extent)?p.extent:void 0,p.parentId&&("parent"===p.extent||p.expandParent)&&(y=o.get(p.parentId)),y&&"parent"===p.extent&&(x=[[0,0],[y.measured.width,y.measured.height]]),b=[],v=void 0;for(const[e,n]of o)if(n.parentId===t&&(b.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=ls(n,p,n.origin??a);v=v?[[Math.min(e[0][0],v[0][0]),Math.min(e[0][1],v[0][1])],[Math.max(e[1][0],v[1][0]),Math.max(e[1][1],v[1][1])]]:e}d?.(e,{...g})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:a}=n(),l=ni(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),c=[];if(!p)return;const{x:d,y:f,width:_,height:k}=g,S={},C=p.origin??a,{width:N,height:E,x:M,y:P}=function(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:x}=o,{x:v,y:w,width:b,height:_,aspectRatio:k}=e;let S=Math.floor(d?h-e.pointerX:0),C=Math.floor(u?p-e.pointerY:0);const N=b+(l?-S:S),E=_+(c?-C:C),M=-i[0]*b,P=-i[1]*_;let j=rs(N,g,m),D=rs(E,y,x);if(s){let e=0,t=0;l&&S<0?e=ns(v+S+M,s[0][0]):!l&&S>0&&(e=os(v+N+M,s[1][0])),c&&C<0?t=ns(w+C+P,s[0][1]):!c&&C>0&&(t=os(w+E+P,s[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(a){let e=0,t=0;l&&S>0?e=os(v+S,a[0][0]):!l&&S<0&&(e=ns(v+N,a[1][0])),c&&C>0?t=os(w+C,a[0][1]):!c&&C<0&&(t=ns(w+E,a[1][1])),j=Math.max(j,e),D=Math.max(D,t)}if(r){if(d){const e=rs(N/k,y,x)*k;if(j=Math.max(j,e),s){let e=0;e=!l&&!c||l&&!c&&f?os(w+P+N/k,s[1][1])*k:ns(w+P+(l?S:-S)/k,s[0][1])*k,j=Math.max(j,e)}if(a){let e=0;e=!l&&!c||l&&!c&&f?ns(w+N/k,a[1][1])*k:os(w+(l?S:-S)/k,a[0][1])*k,j=Math.max(j,e)}}if(u){const e=rs(E*k,g,m)/k;if(D=Math.max(D,e),s){let e=0;e=!l&&!c||c&&!l&&f?os(v+E*k+M,s[1][0])/k:ns(v+(c?C:-C)*k+M,s[0][0])/k,D=Math.max(D,e)}if(a){let e=0;e=!l&&!c||c&&!l&&f?ns(v+E*k,a[1][0])/k:os(v+(c?C:-C)*k,a[0][0])/k,D=Math.max(D,e)}}}C+=C<0?D:-D,S+=S<0?j:-j,r&&(f?N>E*k?C=(is(l,c)?-S:S)/k:S=(is(l,c)?-C:C)*k:d?(C=S/k,c=l):(S=C*k,l=c));const I=l?v+S:v,O=c?w+C:w;return{width:b+(l?-S:S),height:_+(c?-C:C),x:i[0]*S*(l?-1:1)+I,y:i[1]*C*(c?-1:1)+O}}(m,s.controlDirection,l,s.boundaries,s.keepAspectRatio,C,x,v),j=N!==_,D=E!==k,I=M!==d&&j,O=P!==f&&D;if(!(I||O||j||D))return;const z={prevValues:{...g},startX:m.x,startY:m.y,childNodes:b.map(e=>({...e,position:{...e.position}}))};if((I||O||1===C[0]||1===C[1])&&(S.x=I?M:g.x,S.y=O?P:g.y,g.x=S.x,g.y=S.y,b.length>0)){const e=M-d,t=P-f;for(const n of b)n.position={x:n.position.x-e+C[0]*(N-_),y:n.position.y-t+C[1]*(E-k)},c.push(n)}if((j||D)&&(S.width=!j||s.resizeDirection&&"horizontal"!==s.resizeDirection?g.width:N,S.height=!D||s.resizeDirection&&"vertical"!==s.resizeDirection?g.height:E,g.width=S.width,g.height=S.height),y&&p.expandParent){const e=C[0]*(S.width??0);S.x&&S.x<e&&(g.x=e,m.x=m.x-(S.x-e));const t=C[1]*(S.height??0);S.y&&S.y<t&&(g.y=t,m.y=m.y-(S.y-t))}const A=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=-1*l[0]),a&&i&&(l[1]=-1*l[1]),l}({width:g.width,prevWidth:_,height:g.height,prevHeight:k,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),R={...g,direction:A},L=h?.(e,R);if(!1===L)return g=z.prevValues,m.x=z.startX,m.y=z.startY,void b.forEach((e,t)=>{e.position=z.childNodes[t].position});u?.(e,R),o(S,c)}).on("end",e=>{f?.(e,{...g}),r?.({...g})});i.call(_)},destroy:function(){i.on(".drag",null)}}}({domNode:S.current,nodeId:_,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=k.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=k.getState(),s=[],a={x:e.x,y:e.y},l=o.get(_);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,d=Ai([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Qr({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);s.push(...d),a.x=e.x?Math.max(t[0]*n,e.x):void 0,a.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==a.x&&void 0!==a.y){const e={id:_,type:"position",position:{...a}};s.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:_,type:"dimensions",resizing:!0,setAttributes:!g||("horizontal"===g?"width":"height"),dimensions:{width:e.width,height:e.height}};s.push(t)}for(const e of t){const t={...e,type:"position"};s.push(t)}n(s)},onEnd:({width:e,height:t})=>{const n={id:_,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};k.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:l,minHeight:u,maxWidth:f,maxHeight:h},keepAspectRatio:p,resizeDirection:g,onResizeStart:x,onResize:v,onResizeEnd:w,shouldResize:y}),()=>{M.current?.destroy()}},[P,l,u,f,h,p,x,v,w,y]);const j=P.split("-");return(0,c.jsx)("div",{className:d(["react-flow__resize-control","nodrag",...j,n,o]),ref:S,style:{...r,scale:N,...s&&{[C?"backgroundColor":"borderColor"]:s}},children:i})});const _c=window.wp.i18n,kc=window.wp.apiFetch;var Sc=n.n(kc);const Cc=window.wp.components,Nc=window.wp.hooks,Ec=window.funnelforkEditor||{};function Mc(e){return`${e}_${Math.random().toString(36).slice(2,8)}`}const Pc=["#1e1e1e","#3858e9","#f0b849","#4ab866","#cc1818","#e26f56","#33b3db","#9b51e0","#e64ca2","#738a94"];function jc(){return(Ec.yesnoAnswers||[{id:"yes",text:(0,_c.__)("Yes","funnelfork"),labels:[]},{id:"no",text:(0,_c.__)("No","funnelfork"),labels:[]}]).map(e=>({...e,labels:[],points:0}))}function Dc(e){return"start"===e.type?["next"]:"question"===e.type?e.data.answers.map(e=>e.id):[]}function Ic(e,t,n){if(t===n)return!0;const o=[n],r=new Set;for(;o.length;){const n=o.pop();if(n===t)return!0;r.has(n)||(r.add(n),e.forEach(e=>e.source===n&&o.push(e.target)))}return!1}function Oc(e){return e?"start"===e.type?(0,_c.__)("Start","funnelfork"):"end"===e.type?e.data.title||(0,_c.__)("(untitled result)","funnelfork"):e.data.question||(0,_c.__)("(empty question)","funnelfork"):""}function zc(e){return e.find(e=>"end"===e.type&&e.data.isDefault)||e.find(e=>"end"===e.type)}function Ac(e){return e.filter(e=>"question"===e.type).sort((e,t)=>e.position.x-t.position.x||e.position.y-t.position.y).map(e=>e.id)}function Rc(e,t,n,o=Ac(e)){if("score"===t){const t=o[o.indexOf(n)+1];if(t)return e.find(e=>e.id===t)}return zc(e)}function Lc(e){return null!=e&&""!==e}function Bc(e){return Lc(e.scoreMin)||Lc(e.scoreMax)}function Tc(e){const t=Lc(e.scoreMin)?Number(e.scoreMin):null,n=Lc(e.scoreMax)?Number(e.scoreMax):null;return null!==t&&null!==n?t===n?(0,_c.sprintf)(/* translators: %d: score. */ /* translators: %d: score. */ 2 2 (0,_c.__)("Score %d","funnelfork"),t):(0,_c.sprintf)(/* translators: 1: lowest score, 2: highest score. */ /* translators: 1: lowest score, 2: highest score. */ 3 3 (0,_c.__)("Score %1$d – %2$d","funnelfork"),t,n):null!==t?(0,_c.sprintf)(/* translators: %d: lowest score. */ /* translators: %d: lowest score. */ 4 4 (0,_c.__)("Score %d or more","funnelfork"),t):null!==n?(0,_c.sprintf)(/* translators: %d: highest score. */ /* translators: %d: highest score. */ 5 (0,_c.__)("Score %d or less","funnelfork"),n):(0,_c.__)("No score range","funnelfork")}function Bc(e){return e.filter(e=>"question"===e.type&&e.data.answers.length).reduce((e,t)=>{const n=t.data.answers.map(e=>Number(e.points)||0);return{min:e.min+Math.min(...n),max:e.max+Math.max(...n)}},{min:0,max:0})}function $c({nodes:e,edges:t,labels:n,settings:o}){return{version:1,settings:o,labels:n,nodes:e.map(({id:e,type:t,position:n,data:o})=>({id:e,type:t,position:n,data:o})),edges:t.map(({id:e,source:t,sourceHandle:n,target:o})=>({id:e,source:t,sourceHandle:n,target:o}))}}function Vc(e){return{nodes:e.nodes.map(e=>({...e,deletable:"start"!==e.type})),edges:e.edges.map(e=>({...e,type:"flow"})),labels:e.labels,settings:e.settings}}const Hc=(0,l.createContext)({labels:[],edges:[],defaultEndId:null,issuesByNode:{},mode:"flow",order:[]});function Zc({nodeId:e}){const{issuesByNode:t}=(0,l.useContext)(Hc),n=(t[e]||[]).filter(e=>"info"!==e.level);if(!n.length)return null;const o=n.some(e=>"error"===e.level)?"error":"warning";return(0,c.jsx)("span",{className:`fs-node__issue is-${o}`,title:n.map(e=>e.message).join("\n"),children:"!"})}function Yc({ids:e}){const{labels:t}=(0,l.useContext)(Hc),n=t.filter(t=>e.includes(t.id));return n.length?(0,c.jsx)("span",{className:"fs-dots",children:n.map(e=>(0,c.jsx)("span",{className:"fs-dot",style:{background:e.color},title:e.name},e.id))}):null}const Xc={start:function({data:e,selected:t}){return(0,c.jsxs)("div",{className:"fs-node fs-node--start"+(t?" is-selected":""),children:[(0,c.jsx)("div",{className:"fs-node__kind",children:(0,_c.__)("Start","funnelfork")}),(0,c.jsx)("div",{className:"fs-node__title",children:e.title||(0,_c.__)("Start","funnelfork")}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:"next",className:"fs-handle"})]})},question:function({id:e,data:t,selected:n}){const{edges:o,defaultEndId:r,mode:i,order:s}=(0,l.useContext)(Hc),a="yesno"===t.answerType,d="score"===i,u=s.indexOf(e),f=d?s[u+1]:null;return(0,c.jsxs)("div",{className:"fs-node fs-node--question"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Zc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[d&&u>=0&&(0,c.jsx)("span",{className:"fs-node__number",title:(0,_c.__)("Position in the question order","funnelfork"),children:u+1}),a?(0,_c.__)("Yes / no","funnelfork"):(0,_c.__)("Multiple choice","funnelfork")]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.question||(0,c.jsx)("em",{children:(0,_c.__)("Type your question…","funnelfork")})}),(0,c.jsx)("ul",{className:"fs-answers",children:t.answers.map(t=>{const n=o.some(n=>n.source===e&&n.sourceHandle===t.id);return(0,c.jsxs)("li",{className:"fs-answer"+(n?"":" is-open"),children:[(0,c.jsx)(Yc,{ids:t.labels}),(0,c.jsx)("span",{className:"fs-answer__text",children:t.text||(0,c.jsx)("em",{children:(0,_c.__)("(empty)","funnelfork")})}),d&&(0,c.jsxs)("span",{className:"fs-points"+(Number(t.points)?"":" is-zero"),title:(0,_c.__)("Points","funnelfork"),children:[Number(t.points)>0?"+":"",Number(t.points)||0]}),!n&&f&&(0,c.jsx)("span",{className:"fs-answer__fallback is-next",title:(0,_c.__)("No line: goes to the next question","funnelfork"),children:"↓"}),!n&&!f&&r&&(0,c.jsx)("span",{className:"fs-answer__fallback",title:d?(0,_c.__)("No line: the scan ends and the score picks the result","funnelfork"):(0,_c.__)("No line: goes to the default result","funnelfork"),children:"⚑"}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:t.id,className:"fs-handle"})]},t.id)})})]})},end:function({id:e,data:t,selected:n}){const{edges:o,mode:r}=(0,l.useContext)(Hc),i=o.filter(t=>t.target===e).length;let s;return"score"===r?(s=Tc(t),t.isDefault&&(s+=" · "+(0,_c.__)("also receives scores without a range","funnelfork"))):s=t.isDefault?(0,_c.__)("also receives all answers without a line","funnelfork"):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 6 (0,_c._n)("%d incoming line","%d incoming lines",i,"funnelfork"),i),(0,c.jsxs)("div",{className:"fs-node fs-node--end"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Zc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[(0,c.jsx)("span",{"aria-hidden":"true",children:"⚑ "}),(0,_c.__)("Result","funnelfork"),t.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")})]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.title||(0,c.jsx)("em",{children:(0,_c.__)("(untitled result)","funnelfork")})}),(0,c.jsxs)("div",{className:"fs-node__meta",children:[t.cta?.type&&"text"!==t.cta.type&&(Nc.endpointTypes||[]).includes(t.cta.type)?t.cta.type:(0,_c.__)("Text","funnelfork")," · ",s]})]})}},Fc=window.wp.hooks;function qc(){return Nc.proPageUrl?(0,c.jsx)("a",{href:Nc.proPageUrl,children:(0,_c.__)("Learn more","funnelfork")}):null}function Kc({value:e,onChange:t,optional:n=!1,...o}){return(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",step:1,value:e??"",onChange:e=>{if(""===e||"-"===e)return void t(n?null:0);const o=Math.round(Number(e));Number.isFinite(o)&&t(o)},...o})}function Wc({labels:e,value:t,onChange:n}){return e.length?(0,c.jsx)("div",{className:"fs-label-picker",children:e.map(e=>{const o=t.includes(e.id);return(0,c.jsx)("button",{type:"button",className:"fs-chip"+(o?" is-active":""),style:o?{background:e.color,borderColor:e.color}:{borderColor:e.color},"aria-pressed":o,onClick:()=>n(o?t.filter(t=>t!==e.id):[...t,e.id]),children:e.name||(0,_c.__)("(unnamed)","funnelfork")},e.id)})}):null}function Gc({node:e,handle:t,nodes:n,edges:o,onConnect:r,mode:i}){const s=o.find(n=>n.source===e.id&&n.sourceHandle===t),a=[{value:"",label:"score"===i?(0,_c.__)("— Next question —","funnelfork"):(0,_c.__)("— Default result —","funnelfork")},...n.filter(t=>"start"!==t.type&&t.id!==e.id).map(e=>({value:e.id,label:("end"===e.type?"⚑ ":"? ")+Ic(e)}))];return(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Leads to","funnelfork"),value:s?s.target:"",options:a,onChange:n=>r(e.id,t,n||null)})}function Uc({node:e,update:t,settings:n}){const o=e.data;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show an intro screen","funnelfork"),help:(0,_c.__)("Off: visitors start directly with the first question.","funnelfork"),checked:o.showIntro,onChange:e=>t({showIntro:e})}),o.showIntro&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:o.title,onChange:e=>t({title:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Introduction","funnelfork"),value:o.intro,onChange:e=>t({intro:e})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Button text","funnelfork"),value:o.buttonText,onChange:e=>t({buttonText:e})})]}),(0,Fc.applyFilters)("funnelfork.editor.startFields",null,{node:e,update:t,settings:n})]})}function Qc({node:e,update:t,labels:n,nodes:o,edges:r,onConnect:i,settings:s}){const a=e.data,l="score"===s.mode?"score":"flow",d=(e,n)=>t({answers:a.answers.map((t,o)=>o===e?{...t,...n}:t)}),u=(e,n)=>{const o=[...a.answers],[r]=o.splice(e,1);o.splice(e+n,0,r),t({answers:o})};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Question","funnelfork"),value:a.question,onChange:e=>t({question:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Explanation (optional)","funnelfork"),value:a.description,onChange:e=>t({description:e}),rows:2}),(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Answer type","funnelfork"),selected:a.answerType,options:[{label:(0,_c.__)("Yes / no","funnelfork"),value:"yesno"},{label:(0,_c.__)("Multiple choice (one answer)","funnelfork"),value:"choice"}],onChange:e=>{e!==a.answerType&&t({answerType:e,answers:"yesno"===e?Pc():a.answers.map(e=>({...e,id:"yes"===e.id||"no"===e.id?Ec("a"):e.id}))})}}),(0,Fc.applyFilters)("funnelfork.editor.questionFields",null,{node:e,update:t,settings:s}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Answers","funnelfork")}),a.answers.map((f,h)=>(0,c.jsxs)("div",{className:"fs-answer-edit",children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.sprintf)(/* translators: %d: answer number. */ /* translators: %d: answer number. */ 7 (0,_c.__)("Answer %d","funnelfork"),h+1),value:f.text,onChange:e=>d(h,{text:e})}),"score"===l&&(0,c.jsx)(Kc,{label:(0,_c.__)("Points","funnelfork"),value:f.points??0,onChange:e=>d(h,{points:e})}),(0,c.jsx)(Gc,{node:e,handle:f.id,nodes:o,edges:r,onConnect:i,mode:l}),(0,c.jsx)(Wc,{labels:n,value:f.labels,onChange:e=>d(h,{labels:e})}),(0,Fc.applyFilters)("funnelfork.editor.answerFields",null,{node:e,answer:f,index:h,settings:s,updateAnswer:e=>d(h,e)}),"choice"===a.answerType&&(0,c.jsxs)("div",{className:"fs-answer-edit__actions",children:[(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-up-alt2",label:(0,_c.__)("Move up","funnelfork"),disabled:0===h,onClick:()=>u(h,-1)}),(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-down-alt2",label:(0,_c.__)("Move down","funnelfork"),disabled:h===a.answers.length-1,onClick:()=>u(h,1)}),(0,c.jsx)(Cc.Button,{size:"small",isDestructive:!0,icon:"trash",label:(0,_c.__)("Remove answer","funnelfork"),disabled:a.answers.length<=2,onClick:()=>t({answers:a.answers.filter((e,t)=>t!==h)})})]})]},f.id)),"choice"===a.answerType&&(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t({answers:[...a.answers,{id:Ec("a"),text:(0,_c.sprintf)(/* translators: %d: option number. */ /* translators: %d: option number. */ 8 (0,_c.__)("Option %d","funnelfork"),a.answers.length+1),labels:[],points:0}]}),children:(0,_c.__)("Add answer","funnelfork")}),!n.length&&(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Tip: create labels in the "Labels" tab and attach them to answers to build personal advice.',"funnelfork")})]})}function Jc({node:e,nodes:t,update:n,setDefault:o,settings:r}){const i=e.data,s="score"===r.mode,a=s?Bc(t):null,l=Nc.endpointTypes||["text"],d={text:(0,_c.__)("Text","funnelfork"),gravityforms:(0,_c.__)("Gravity Forms form","funnelfork"),shortcode:(0,_c.__)("Shortcode","funnelfork")};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:i.title,onChange:e=>n({title:e})}),s&&(0,c.jsxs)("fieldset",{className:"fs-range",children:[(0,c.jsx)("legend",{className:"fs-inspector__heading",children:(0,_c.__)("Score range","funnelfork")}),(0,c.jsxs)("div",{className:"fs-range__fields",children:[(0,c.jsx)(Kc,{optional:!0,label:(0,_c.__)("From","funnelfork"),placeholder:(0,_c.__)("no minimum","funnelfork"),value:i.scoreMin,onChange:e=>n({scoreMin:e})}),(0,c.jsx)(Kc,{optional:!0,label:(0,_c.__)("To","funnelfork"),placeholder:(0,_c.__)("no maximum","funnelfork"),value:i.scoreMax,onChange:e=>n({scoreMax:e})})]}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.sprintf)(/* translators: 1: lowest possible score, 2: highest possible score. */ /* translators: 1: lowest possible score, 2: highest possible score. */ 9 (0,_c.__)("Visitors with a total score in this range (both included) get this result. Possible scores: %1$d to %2$d.","funnelfork"),a.min,a.max)}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the score","funnelfork"),checked:!1!==i.showScore,onChange:e=>n({showScore:e})})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Text","funnelfork"),help:(0,_c.__)("Basic HTML is allowed.","funnelfork"),value:i.content,rows:6,onChange:e=>n({content:e})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Call to action","funnelfork"),value:l.includes(i.cta?.type)?i.cta.type:"text",options:l.map(e=>({value:e,label:d[e]||e})),onChange:e=>n({cta:{...i.cta,type:e}})}),(0,Fc.applyFilters)("funnelfork.editor.endpointFields",null,{node:e,cta:i.cta||{type:"text"},updateCta:e=>n({cta:{...i.cta,...e}})}),!Nc.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("Show a Gravity Forms form or any shortcode on a result with FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(qc,{})]}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show collected labels (advice)","funnelfork"),checked:i.showLabels,onChange:e=>n({showLabels:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the given answers","funnelfork"),checked:i.showAnswers,onChange:e=>n({showAnswers:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Default result","funnelfork"),help:s?(0,_c.__)("Shown when the score matches no range. There is always exactly one default result.","funnelfork"):(0,_c.__)("Answers without a line lead here. There is always exactly one default result.","funnelfork"),checked:i.isDefault,disabled:i.isDefault,onChange:()=>o(e.id)})]})}function ed(e){const{node:t,deleteNode:n,duplicateNode:o}=e;return t?(0,c.jsxs)("div",{className:"fs-inspector__section",children:["start"===t.type&&(0,c.jsx)(Uc,{...e}),"question"===t.type&&(0,c.jsx)(Qc,{...e}),"end"===t.type&&(0,c.jsx)(Jc,{...e}),"start"!==t.type&&(0,c.jsxs)("div",{className:"fs-inspector__footer",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"admin-page",onClick:()=>o(t.id),children:(0,_c.__)("Duplicate","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",isDestructive:!0,icon:"trash",onClick:()=>n(t.id),children:(0,_c.__)("Delete","funnelfork")})]})]}):(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Select a question or result on the canvas to edit it.","funnelfork")})})}function td({nodes:e,edges:t,focusNode:n,addNode:o,settings:r}){const i=e.filter(e=>"end"===e.type),s="score"===r.mode;return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Every result is an endpoint of the quickscan. Click one to show it on the canvas.","funnelfork")}),(0,c.jsx)("ul",{className:"fs-endpoint-list",children:i.map(e=>{const o=t.filter(t=>t.target===e.id).length;return(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",onClick:()=>n(e.id),children:[(0,c.jsxs)("span",{className:"fs-endpoint-list__title",children:["⚑ ",Ic(e)]}),(0,c.jsxs)("span",{className:"fs-endpoint-list__meta",children:[e.data.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")}),s?Tc(e.data):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 10 (0,_c._n)("%d incoming line","%d incoming lines",o,"funnelfork"),o)]})]})},e.id)})}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>o("end"),children:(0,_c.__)("Add result","funnelfork")})]})}function nd({labels:e,setLabels:t,nodes:n}){const o=e=>n.reduce((t,n)=>t+("question"===n.type?n.data.answers.filter(t=>t.labels.includes(e)).length:0),0),r=(n,o)=>t(e.map(e=>e.id===n?{...e,...o}:e));return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Labels are collected along the way. Attach them to answers (for example a product or a piece of advice) and show them on the result.","funnelfork")}),e.map(n=>(0,c.jsxs)("div",{className:"fs-label-edit",children:[(0,c.jsxs)("div",{className:"fs-label-edit__row",children:[(0,c.jsx)("input",{type:"color",value:n.color,"aria-label":(0,_c.__)("Colour","funnelfork"),onChange:e=>r(n.id,{color:e.target.value})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,hideLabelFromVision:!0,label:(0,_c.__)("Name","funnelfork"),placeholder:(0,_c.__)("Name","funnelfork"),value:n.name,onChange:e=>r(n.id,{name:e})}),(0,c.jsx)(Cc.Button,{icon:"trash",isDestructive:!0,label:(0,_c.__)("Delete label","funnelfork"),onClick:()=>t(e.filter(e=>e.id!==n.id))})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,_c.__)("Description","funnelfork"),placeholder:(0,_c.__)("Description shown on the result (optional)","funnelfork"),rows:2,value:n.description,onChange:e=>r(n.id,{description:e})}),(0,c.jsx)("span",{className:"fs-help",children:(0,_c.sprintf)(/* translators: %d: number of answers. */ /* translators: %d: number of answers. */ 11 (0,_c._n)("Used by %d answer","Used by %d answers",o(n.id),"funnelfork"),o(n.id))})]},n.id)),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t([...e,{id:Ec("l"),name:"",color:Mc[e.length%Mc.length],description:""}]),children:(0,_c.__)("Add label","funnelfork")})]})}function od({settings:e,setSettings:t}){const n=Nc.transitions||["slide"],o=Nc.transitionLabels||{},r=Nc.modes||["flow","score"],i={flow:(0,_c.__)("Flow: lines decide the result","funnelfork"),score:(0,_c.__)("Score: the total score decides the result","funnelfork")};return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Type of quickscan","funnelfork"),selected:e.mode||"flow",options:r.map(e=>({value:e,label:i[e]||e})),onChange:n=>t({...e,mode:n}),help:"score"===e.mode?(0,_c.__)("Every answer gets points and every result a score range. Lines are optional: an answer without a line goes to the next question (left to right on the canvas).","funnelfork"):(0,_c.__)("Every answer leads along a line to a next question or a result. Answers without a line go to the default result.","funnelfork")}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show progress bar","funnelfork"),checked:e.showProgress,onChange:n=>t({...e,showProgress:n})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show back button","funnelfork"),checked:e.showBack,onChange:n=>t({...e,showBack:n})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Transition between questions","funnelfork"),value:n.includes(e.transition)?e.transition:"slide",options:n.map(e=>({value:e,label:o[e]||e})),onChange:n=>t({...e,transition:n})}),(0,Fc.applyFilters)("funnelfork.editor.settingsFields",null,{settings:e,updateSettings:n=>t({...e,...n})}),!Nc.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("More transitions and your own styling are available in FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(qc,{})]}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Embed","funnelfork")}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Use the "FunnelFork quickscan" block, or paste this shortcode:',"funnelfork")}),(0,c.jsx)("code",{className:"fs-shortcode",children:Nc.shortcode})]})}function rd({issues:e,focusNode:t}){return e.length?(0,c.jsx)("div",{className:"fs-issues",children:e.map((e,n)=>(0,c.jsx)(Cc.Notice,{status:"info"===e.level?"info":e.level,isDismissible:!1,children:(0,c.jsx)("button",{type:"button",className:"fs-issues__link",onClick:()=>t(e.nodeId),children:e.message})},n))}):null}function id(e){const{tab:t,setTab:n,issues:o,focusNode:r,labels:i}=e,s=[{name:"selected",title:(0,_c.__)("Step","funnelfork")},{name:"endpoints",title:(0,_c.sprintf)(/* translators: %d: number of results. */ /* translators: %d: number of results. */ 12 (0,_c.__)("Results (%d)","funnelfork"),e.nodes.filter(e=>"end"===e.type).length)},{name:"labels",title:(0,_c.sprintf)(/* translators: %d: number of labels. */ /* translators: %d: number of labels. */(0,_c.__)("Labels (%d)","funnelfork"),i.length)},{name:"settings",title:(0,_c.__)("Settings","funnelfork")}];return(0,c.jsxs)("aside",{className:"fs-inspector",children:[(0,c.jsx)(Cc.TabPanel,{className:"fs-inspector__tabs",tabs:s,initialTabName:t,onSelect:n,children:t=>(0,c.jsxs)(c.Fragment,{children:["selected"===t.name&&(0,c.jsx)(ed,{...e}),"endpoints"===t.name&&(0,c.jsx)(td,{...e}),"labels"===t.name&&(0,c.jsx)(nd,{...e}),"settings"===t.name&&(0,c.jsx)(od,{...e})]})},t),o.length>0&&(0,c.jsxs)("details",{className:"fs-issues-wrap",open:o.some(e=>"info"!==e.level),children:[(0,c.jsx)("summary",{children:(0,_c.sprintf)(/* translators: %d: number of notes. */ /* translators: %d: number of notes. */ 13 (0,_c._n)("%d note about this flow","%d notes about this flow",o.length,"funnelfork"),o.length)}),(0,c.jsx)(rd,{issues:o,focusNode:r})]})]})}const sd={flow:function({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s,markerEnd:a,selected:l}){const{deleteElements:d}=fa(),[u,f,h]=hi({sourceX:t,sourceY:n,sourcePosition:i,targetX:o,targetY:r,targetPosition:s});return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Ja,{id:e,path:u,markerEnd:a,className:l?"is-selected":""}),l&&(0,c.jsx)(ql,{children:(0,c.jsx)("button",{type:"button",className:"fs-edge-delete nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${f}px, ${h}px)`},onClick:()=>d({edges:[{id:e}]}),"aria-label":(0,_c.__)("Remove line","funnelfork"),title:(0,_c.__)("Remove line","funnelfork"),children:"×"})})]})}},ad={type:vr.ArrowClosed,width:18,height:18,color:"#748c85"},ld={start:"#10201f",question:"#0d7a69",end:"#f2a93b"};function cd(){return(0,c.jsxs)("div",{className:"fs-topbar__logo",children:[(0,c.jsxs)("svg",{viewBox:"0 0 48 48","aria-hidden":"true",focusable:"false",children:[(0,c.jsx)("path",{d:"M14 40V17q0-7 7-7h11M14 25h10",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,c.jsx)("circle",{cx:"36",cy:"10",r:"5",fill:"#f2a93b"}),(0,c.jsx)("circle",{cx:"29",cy:"25",r:"5",fill:"#0d7a69"}),(0,c.jsx)("circle",{cx:"14",cy:"40",r:"4",fill:"currentColor"})]}),(0,c.jsxs)("span",{children:["funnel",(0,c.jsx)("b",{children:"fork"})]})]})}function dd(e,t,n){return{id:Ec("e"),source:e,sourceHandle:t,target:n,type:"flow",markerEnd:ad}}function ud(){const e=`/funnelfork/v1/scans/${Nc.scanId}`,{screenToFlowPosition:t,fitView:n,deleteElements:o}=fa(),r=(0,l.useRef)(null),[i,s]=(0,l.useState)(!0),[d,u]=(0,l.useState)(""),[f,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(""),[m,y]=(0,l.useState)("draft"),[x,v,w]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Qs(e,t)),[]);return[e,t,n]}(),[b,_,S]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Js(e,t)),[]);return[e,t,n]}(),[k,C]=(0,l.useState)([]),[N,E]=(0,l.useState)({}),[M,P]=(0,l.useState)(!1),[j,D]=(0,l.useState)(!1),[I,O]=(0,l.useState)("selected"),[z,A]=(0,l.useState)(null),R="score"===N.mode?"score":"flow";(0,l.useEffect)(()=>{kc()({path:e}).then(e=>{const t=Vc(e.graph);g(e.title),y(e.status),v(t.nodes),_(t.edges.map(e=>({...e,markerEnd:ad}))),C(t.labels),E(t.settings),s(!1)}).catch(e=>{u(e.message||(0,_c.__)("The quickscan could not be loaded.","funnelfork")),s(!1)})},[e,v,_]),(0,l.useEffect)(()=>{const e=e=>{M&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[M]);const L=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type&&"dimensions"!==e.type)&&P(!0),w(e)},[w]),T=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type)&&P(!0),S(e)},[S]),B=(0,l.useCallback)((e,t)=>{if(v(n=>n.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n)),t.answers){const n=t.answers.map(e=>e.id);_(t=>t.filter(t=>t.source!==e||n.includes(t.sourceHandle)))}P(!0)},[v,_]),$=(0,l.useCallback)((e,t,n)=>{const o=b.filter(n=>!(n.source===e&&n.sourceHandle===t));n&&Dc(o,e,n)?h({status:"warning",text:(0,_c.__)("That line would create a loop, so it was not added.","funnelfork")}):(_(n?[...o,dd(e,t,n)]:o),P(!0))},[b,_]),V=(0,l.useCallback)(e=>{const t=x.find(t=>t.id===e.target);return!(!t||"start"===t.type)&&!Dc(b.filter(t=>!(t.source===e.source&&t.sourceHandle===e.sourceHandle)),e.source,e.target)},[x,b]),H=(0,l.useCallback)(e=>{v(t=>t.map(t=>({...t,selected:t.id===e}))),_(e=>e.map(e=>e.selected?{...e,selected:!1}:e)),O("selected")},[v,_]),Z=(e,n=null,o=null)=>{const i=function(e,t){return"end"===e?{id:Ec("end"),type:"end",position:t,data:{title:(0,_c.__)("New result","funnelfork"),content:"",showLabels:!0,showAnswers:!1,isDefault:!1,scoreMin:null,scoreMax:null,showScore:!0,cta:{type:"text"}}}:{id:Ec("q"),type:"question",position:t,data:{question:"",description:"",answerType:e,answers:"yesno"===e?Pc():[{id:Ec("a"),text:(0,_c.__)("Option 1","funnelfork"),labels:[],points:0},{id:Ec("a"),text:(0,_c.__)("Option 2","funnelfork"),labels:[],points:0}]}}}(e,n||(()=>{const e=r.current.getBoundingClientRect(),n=t({x:e.left+e.width/2,y:e.top+e.height/2});return{x:n.x-130+(40*Math.random()-20),y:n.y-60+(40*Math.random()-20)}})());v(e=>[...e.map(e=>({...e,selected:!1})),{...i,selected:!0}]),o&&$(o.source,o.handle,i.id),O("selected"),P(!0)},Y=(0,l.useCallback)((e,n)=>{if(n.isValid||!n.fromHandle||"source"!==n.fromHandle.type)return;if(!e.target?.classList?.contains("react-flow__pane"))return;const o="changedTouches"in e?e.changedTouches[0]:e,i=r.current.getBoundingClientRect();A({left:o.clientX-i.left,top:o.clientY-i.top,position:t({x:o.clientX,y:o.clientY-30}),from:{source:n.fromNode.id,handle:n.fromHandle.id}})},[t]),X=(0,l.useCallback)(e=>{e.some(e=>"end"===e.type&&e.data.isDefault)&&v(e=>{const t=e.find(e=>"end"===e.type);return e.map(e=>e===t?{...e,data:{...e.data,isDefault:!0}}:e)})},[v]),F=(0,l.useCallback)(async(t=m)=>{D(!0);try{const n=await kc()({path:e,method:"POST",data:{title:p,status:t,graph:$c({nodes:x,edges:b,labels:k,settings:N})}}),o=Vc(n.graph),r=Object.fromEntries(o.nodes.map(e=>[e.id,e]));v(e=>e.filter(e=>r[e.id]).map(e=>({...e,data:r[e.id].data})));const i=new Set(b.filter(e=>e.selected).map(e=>e.id));return _(o.edges.map(e=>({...e,markerEnd:ad,selected:i.has(e.id)}))),E(o.settings),y(n.status),g(n.title),P(!1),h({status:"success",text:"publish"===t&&"publish"!==m?(0,_c.__)("Quickscan saved and published.","funnelfork"):(0,_c.__)("Quickscan saved.","funnelfork")}),!0}catch(e){return h({status:"error",text:e.message||(0,_c.__)("Saving failed.","funnelfork")}),!1}finally{D(!1)}},[e,p,m,x,b,k,N,v,_]);(0,l.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),F())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[F]),(0,l.useEffect)(()=>{if(!f||"error"===f.status)return;const e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[f]);const q=(0,l.useMemo)(()=>function(e,t,n="flow"){const o="score"===n?function(e){const t=[],n=Oc(e),o=[];e.filter(e=>"end"===e.type).forEach(e=>{if(!Lc(e.data))return void(e.data.isDefault||t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 14 (0,_c.__)('"%s" has no score range, so it is never shown.',"funnelfork"),Ic(e))}));const n=Rc(e.data.scoreMin)?Number(e.data.scoreMin):-1/0,r=Rc(e.data.scoreMax)?Number(e.data.scoreMax):1/0;n>r?t.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 15 (0,_c.__)('The minimum score of "%s" is higher than its maximum.',"funnelfork"),Ic(e))}):(o.forEach(o=>{n<=o.max&&o.min<=r&&t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: 1: result title, 2: other result title. */ /* translators: 1: result title, 2: other result title. */ 16 (0,_c.__)('The score ranges of "%1$s" and "%2$s" overlap; "%1$s" wins.',"funnelfork"),Ic(o.node),Ic(e))})}),o.push({node:e,min:n,max:r}))});const r=e.filter(e=>"question"===e.type);r.length&&r.every(e=>e.data.answers.every(e=>!Number(e.points)))&&t.push({nodeId:r[0].id,level:"warning",message:(0,_c.__)("No answer has points yet. Select a question to give its answers points.","funnelfork")});const i=Bc(e),s=[];let a=i.min;return[...o].sort((e,t)=>e.min-t.min).forEach(e=>{e.min>a&&a<=i.max&&s.push([a,Math.min(e.min-1,i.max)]),a=Math.max(a,e.max+1)}),a<=i.max&&s.push([a,i.max]),s.length&&n&&t.push({nodeId:n.id,level:Lc(n.data)?"warning":"info",message:(0,_c.sprintf)(/* translators: 1: list of scores, 2: result title. */ /* translators: 1: list of scores, 2: result title. */ 17 (0,_c.__)('Score %1$s matches no range and goes to the default result "%2$s".',"funnelfork"),s.map(([e,t])=>e===t?`${e}`:`${e}–${t}`).join(", "),Ic(n))}),t}(e):[],r=new Set,i=e.find(e=>"start"===e.type),s=Oc(e),a=zc(e),l=i?[i.id]:[];for(;l.length;){const o=l.pop();if(r.has(o))continue;r.add(o);const i=e.find(e=>e.id===o);i&&(jc(i).forEach(r=>{const i=t.find(e=>e.source===o&&e.sourceHandle===r),s=i?i.target:Ac(e,n,o,a)?.id;s&&l.push(s)}),"score"===n&&"question"===i.type&&e.forEach(e=>"end"===e.type&&l.push(e.id)))}return e.forEach(e=>{if("question"===e.type){e.data.question.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.__)("A question has no text.","funnelfork")}),e.data.answers.length<2&&o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 18 (0,_c.__)('"%s" needs at least two answers.',"funnelfork"),Ic(e))}),e.data.answers.forEach(t=>{t.text.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 19 (0,_c.__)('"%s" has an answer without text.',"funnelfork"),Ic(e))})});const r=e.data.answers.filter(n=>!t.some(t=>t.source===e.id&&t.sourceHandle===n.id));r.length&&"score"!==n&&o.push({nodeId:e.id,level:"info",message:(0,_c.sprintf)(/* translators: 1: number of answers, 2: question text, 3: endpoint title. */ /* translators: 1: number of answers, 2: question text, 3: endpoint title. */ 20 (0,_c.__)('%1$d answer(s) of "%2$s" have no line and go to the default result "%3$s".',"funnelfork"),r.length,Ic(e),Ic(s))})}"start"===e.type||r.has(e.id)||o.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: question or result title. */ /* translators: %s: question or result title. */ 21 (0,_c.__)('"%s" cannot be reached from the start.',"funnelfork"),Ic(e))})}),o}(x,b,R),[x,b,R]),K=(0,l.useMemo)(()=>{const e={};return q.forEach(t=>e[t.nodeId]=[...e[t.nodeId]||[],t]),e},[q]),W=Oc(x)?.id||null,G="score"===R?zc(x).join(","):"",U=(0,l.useMemo)(()=>({labels:k,edges:b,defaultEndId:W,issuesByNode:K,mode:R,order:G?G.split(","):[]}),[k,b,W,K,R,G]),Q=x.filter(e=>e.selected),J=1===Q.length?Q[0]:null;if(i)return(0,c.jsx)("div",{className:"fs-editor fs-editor--loading",children:(0,c.jsx)(Cc.Spinner,{})});if(d)return(0,c.jsx)("div",{className:"fs-editor fs-editor--error",children:(0,c.jsx)(Cc.Notice,{status:"error",isDismissible:!1,children:d})});const ee=q.filter(e=>"error"===e.level).length;let te=(0,_c.__)("All changes saved","funnelfork");return j?te=(0,_c.__)("Saving…","funnelfork"):M&&(te=(0,_c.__)("Unsaved changes","funnelfork")),(0,c.jsx)(Hc.Provider,{value:U,children:(0,c.jsxs)("div",{className:"fs-editor",children:[(0,c.jsxs)("header",{className:"fs-topbar",children:[(0,c.jsx)("a",{className:"fs-topbar__back",href:Nc.listUrl,"aria-label":(0,_c.__)("Back to all quickscans","funnelfork"),title:(0,_c.__)("Back to all quickscans","funnelfork"),children:"←"}),(0,c.jsx)(cd,{}),(0,c.jsx)("input",{className:"fs-topbar__title",value:p,"aria-label":(0,_c.__)("Quickscan title","funnelfork"),placeholder:(0,_c.__)("Quickscan title","funnelfork"),onChange:e=>{g(e.target.value),P(!0)}}),(0,c.jsx)("span",{className:`fs-status is-${m}`,children:"publish"===m?(0,_c.__)("Published","funnelfork"):(0,_c.__)("Draft","funnelfork")}),(0,c.jsx)("span",{className:"fs-topbar__state",children:te}),(0,c.jsxs)("div",{className:"fs-topbar__actions",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",onClick:async()=>{const e=window.open("","_blank");!M||await F()?e&&(e.location=Nc.previewUrl):e&&e.close()},disabled:j,children:(0,_c.__)("Preview","funnelfork")}),"publish"===m?(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>F("draft"),disabled:j,children:(0,_c.__)("Switch to draft","funnelfork")}):(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>F("publish"),disabled:j||ee>0,title:ee>0?(0,_c.__)("Fix the errors in the flow first.","funnelfork"):void 0,children:(0,_c.__)("Publish","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"primary",onClick:()=>F(),isBusy:j,disabled:j||!M&&!j,children:(0,_c.__)("Save","funnelfork")})]})]}),f&&(0,c.jsx)("div",{className:"fs-editor-notice",children:(0,c.jsx)(Cc.Notice,{status:f.status,onRemove:()=>h(null),children:f.text})}),(0,c.jsxs)("div",{className:"fs-body",children:[(0,c.jsxs)("div",{className:"fs-canvas",ref:r,children:[(0,c.jsxs)(Xl,{nodes:x,edges:b,nodeTypes:Xc,edgeTypes:sd,onNodesChange:L,onEdgesChange:T,onNodesDelete:X,onConnect:e=>$(e.source,e.sourceHandle,e.target),onConnectEnd:Y,isValidConnection:V,onNodeClick:()=>O("selected"),onPaneClick:()=>A(null),deleteKeyCode:["Backspace","Delete"],fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.15,children:[(0,c.jsx)(ec,{gap:24,size:1.5,color:"#c6d4cf"}),(0,c.jsx)(cc,{showInteractive:!1}),(0,c.jsx)(wc,{pannable:!0,zoomable:!0,nodeColor:e=>ld[e.type]}),(0,c.jsxs)(js,{position:"top-left",className:"fs-toolbar",children:[(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("yesno"),children:(0,_c.__)("Yes/no question","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("choice"),children:(0,_c.__)("Multiple choice","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"flag",onClick:()=>Z("end"),children:(0,_c.__)("Result","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"layout",onClick:()=>{v(e=>function(e,t,n="flow"){const o={},r=e.find(e=>"start"===e.type),i=zc(e),s=(r,a)=>{if(void 0!==o[r]&&o[r]>=a)return;o[r]=a;const l=e.find(e=>e.id===r);l&&(o=>jc(o).map(r=>{const s=t.find(e=>e.source===o.id&&e.sourceHandle===r);return s?s.target:Ac(e,n,o.id,i)?.id}).filter(Boolean))(l).forEach(e=>s(e,a+1))};r&&s(r.id,0);const a=Math.max(0,...Object.values(o));e.forEach(e=>{"end"===e.type?o[e.id]=a:void 0===o[e.id]&&(o[e.id]=a+1)});const l={};e.forEach(e=>{(l[o[e.id]]=l[o[e.id]]||[]).push(e)});const c={};return Object.entries(l).forEach(([e,t])=>{let n=0;t.forEach(t=>{c[t.id]={x:340*Number(e),y:n},n+=(t.measured?.height||160)+48})}),e.map(e=>({...e,position:c[e.id]}))}(e,b,R)),P(!0),window.requestAnimationFrame(()=>n({duration:400}))},children:(0,_c.__)("Tidy up","funnelfork")})]}),(0,c.jsx)(js,{position:"bottom-center",className:"fs-hint",children:(0,_c.__)("Drag from an answer (●) to a question or result to draw a line. Drop on an empty spot to create a new step.","funnelfork")})]}),z&&(0,c.jsxs)("div",{className:"fs-drop-menu",style:{left:z.left,top:z.top},role:"menu",children:[(0,c.jsx)("span",{className:"fs-drop-menu__title",children:(0,_c.__)("Add here:","funnelfork")}),[["yesno",(0,_c.__)("Yes/no question","funnelfork")],["choice",(0,_c.__)("Multiple choice","funnelfork")],["end",(0,_c.__)("Result","funnelfork")]].map(([e,t])=>(0,c.jsx)("button",{type:"button",role:"menuitem",onClick:()=>{Z(e,z.position,z.from),A(null)},children:t},e)),(0,c.jsx)("button",{type:"button",className:"is-cancel",onClick:()=>A(null),children:(0,_c.__)("Cancel","funnelfork")})]})]}),(0,c.jsx)(id,{node:J,nodes:x,edges:b,labels:k,settings:N,issues:q,tab:I,setTab:O,setLabels:e=>{C(e);const t=e.map(e=>e.id);v(e=>e.map(e=>"question"===e.type&&e.data.answers.some(e=>e.labels.some(e=>!t.includes(e)))?{...e,data:{...e.data,answers:e.data.answers.map(e=>({...e,labels:e.labels.filter(e=>t.includes(e))}))}}:e)),P(!0)},setSettings:e=>{E(e),P(!0)},update:e=>J&&B(J.id,e),onConnect:$,setDefault:e=>{v(t=>t.map(t=>"end"===t.type?{...t,data:{...t.data,isDefault:t.id===e}}:t)),P(!0)},deleteNode:e=>{const t=x.find(t=>t.id===e);"end"!==t?.type||1!==x.filter(e=>"end"===e.type).length?o({nodes:[{id:e}]}):h({status:"warning",text:(0,_c.__)("A quickscan needs at least one result.","funnelfork")})},duplicateNode:e=>{const t=x.find(t=>t.id===e);if(!t)return;const n=structuredClone({id:t.id,type:t.type,position:t.position,data:t.data});n.id=Ec("end"===t.type?"end":"q"),n.position={x:t.position.x+40,y:t.position.y+40},"question"===n.type&&"choice"===n.data.answerType&&(n.data.answers=n.data.answers.map(e=>({...e,id:Ec("a")}))),"end"===n.type&&(n.data.isDefault=!1),v(e=>[...e.map(e=>({...e,selected:!1})),{...n,deletable:!0,selected:!0}]),P(!0)},focusNode:e=>{H(e),window.requestAnimationFrame(()=>n({nodes:[{id:e}],duration:400,maxZoom:1.1}))},addNode:Z})]})]})})}const fd=document.getElementById("funnelfork-editor-root");fd&&(0,l.createRoot)(fd).render((0,c.jsx)(Hl,{children:(0,c.jsx)(ud,{})}))}};const t={};function n(o){const r=t[o];if(void 0!==r)return r.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.m=e,(()=>{const e=[];n.O=(t,o,r)=>{if(!o){for(var i=0;i<e.length;i++){let[o,r]=e[i],a=!0;for(var s=0;s<o.length;s++)n.O.j(o[s])?o.splice(s--,1):a=!1;if(a){e.splice(i--,1);const n=r();void 0!==n&&(t=n)}}return t}e.push([o,r])}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.hasOwn(e,t),n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={8:0,117:0};n.O.j=t=>0===e[t];const t=(t,o)=>{let[r,i,s]=o;var a,l,c=0;if(r.some(t=>0!==e[t])){for(a in i)n.o(i,a)&&(n.m[a]=i[a]);if(s)var d=s(n)}for(t&&t(o);c<r.length;c++)l=r[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(d)},o=globalThis.webpackChunkfunnelfork||=[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();let o=n.O(void 0,[117],()=>n(46));o=n.O(o)})(); 5 (0,_c.__)("Score %d or less","funnelfork"),n):(0,_c.__)("No score range","funnelfork")}function $c(e){return e.filter(e=>"question"===e.type&&e.data.answers.length).reduce((e,t)=>{const n=t.data.answers.map(e=>Number(e.points)||0);return{min:e.min+Math.min(...n),max:e.max+Math.max(...n)}},{min:0,max:0})}function Vc({nodes:e,edges:t,labels:n,settings:o}){return{version:1,settings:o,labels:n,nodes:e.map(({id:e,type:t,position:n,data:o})=>({id:e,type:t,position:n,data:o})),edges:t.map(({id:e,source:t,sourceHandle:n,target:o})=>({id:e,source:t,sourceHandle:n,target:o}))}}function Hc(e){return{nodes:e.nodes.map(e=>({...e,deletable:"start"!==e.type})),edges:e.edges.map(e=>({...e,type:"flow"})),labels:e.labels,settings:e.settings}}function Zc({filter:e,args:t}){return(0,Nc.applyFilters)(e,null,t)}const Fc=(0,l.createContext)({labels:[],edges:[],defaultEndId:null,issuesByNode:{},mode:"flow",order:[]});function Yc({nodeId:e}){const{issuesByNode:t}=(0,l.useContext)(Fc),n=(t[e]||[]).filter(e=>"info"!==e.level);if(!n.length)return null;const o=n.some(e=>"error"===e.level)?"error":"warning";return(0,c.jsx)("span",{className:`fs-node__issue is-${o}`,title:n.map(e=>e.message).join("\n"),children:"!"})}function Xc({ids:e}){const{labels:t}=(0,l.useContext)(Fc),n=t.filter(t=>e.includes(t.id));return n.length?(0,c.jsx)("span",{className:"fs-dots",children:n.map(e=>(0,c.jsx)("span",{className:"fs-dot",style:{background:e.color},title:e.name},e.id))}):null}const qc={start:function({data:e,selected:t}){return(0,c.jsxs)("div",{className:"fs-node fs-node--start"+(t?" is-selected":""),children:[(0,c.jsx)("div",{className:"fs-node__kind",children:(0,_c.__)("Start","funnelfork")}),(0,c.jsx)("div",{className:"fs-node__title",children:e.title||(0,_c.__)("Start","funnelfork")}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:"next",className:"fs-handle"})]})},question:function({id:e,data:t,selected:n}){const{edges:o,defaultEndId:r,mode:i,order:s}=(0,l.useContext)(Fc),a="yesno"===t.answerType,d="score"===i,u=s.indexOf(e),f=d?s[u+1]:null;return(0,c.jsxs)("div",{className:"fs-node fs-node--question"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Yc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[d&&u>=0&&(0,c.jsx)("span",{className:"fs-node__number",title:(0,_c.__)("Position in the question order","funnelfork"),children:u+1}),a?(0,_c.__)("Yes / no","funnelfork"):(0,_c.__)("Multiple choice","funnelfork")]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.question||(0,c.jsx)("em",{children:(0,_c.__)("Type your question…","funnelfork")})}),(0,c.jsx)(Zc,{filter:"funnelfork.editor.nodeBadge",args:{id:e,type:"question"}}),(0,c.jsx)("ul",{className:"fs-answers",children:t.answers.map(t=>{const n=o.some(n=>n.source===e&&n.sourceHandle===t.id);return(0,c.jsxs)("li",{className:"fs-answer"+(n?"":" is-open"),children:[(0,c.jsx)(Xc,{ids:t.labels}),(0,c.jsx)(Zc,{filter:"funnelfork.editor.answerBadge",args:{nodeId:e,answerId:t.id}}),(0,c.jsx)("span",{className:"fs-answer__text",children:t.text||(0,c.jsx)("em",{children:(0,_c.__)("(empty)","funnelfork")})}),d&&(0,c.jsxs)("span",{className:"fs-points"+(Number(t.points)?"":" is-zero"),title:(0,_c.__)("Points","funnelfork"),children:[Number(t.points)>0?"+":"",Number(t.points)||0]}),!n&&f&&(0,c.jsx)("span",{className:"fs-answer__fallback is-next",title:(0,_c.__)("No line: goes to the next question","funnelfork"),children:"↓"}),!n&&!f&&r&&(0,c.jsx)("span",{className:"fs-answer__fallback",title:d?(0,_c.__)("No line: the scan ends and the score picks the result","funnelfork"):(0,_c.__)("No line: goes to the default result","funnelfork"),children:"⚑"}),(0,c.jsx)(Oa,{type:"source",position:wr.Right,id:t.id,className:"fs-handle"})]},t.id)})})]})},end:function({id:e,data:t,selected:n}){const{edges:o,mode:r}=(0,l.useContext)(Fc),i=o.filter(t=>t.target===e).length;let s;return"score"===r?(s=Tc(t),t.isDefault&&(s+=" · "+(0,_c.__)("also receives scores without a range","funnelfork"))):s=t.isDefault?(0,_c.__)("also receives all answers without a line","funnelfork"):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 6 (0,_c._n)("%d incoming line","%d incoming lines",i,"funnelfork"),i),(0,c.jsxs)("div",{className:"fs-node fs-node--end"+(n?" is-selected":""),children:[(0,c.jsx)(Oa,{type:"target",position:wr.Left,className:"fs-handle fs-handle--target"}),(0,c.jsx)(Yc,{nodeId:e}),(0,c.jsxs)("div",{className:"fs-node__kind",children:[(0,c.jsx)("span",{"aria-hidden":"true",children:"⚑ "}),(0,_c.__)("Result","funnelfork"),t.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")})]}),(0,c.jsx)("div",{className:"fs-node__title",children:t.title||(0,c.jsx)("em",{children:(0,_c.__)("(untitled result)","funnelfork")})}),(0,c.jsx)(Zc,{filter:"funnelfork.editor.nodeBadge",args:{id:e,type:"end"}}),(0,c.jsxs)("div",{className:"fs-node__meta",children:[t.cta?.type&&"text"!==t.cta.type&&(Ec.endpointTypes||[]).includes(t.cta.type)?t.cta.type:(0,_c.__)("Text","funnelfork")," · ",s]})]})}},Wc=e=>Number(e).toLocaleString(document.documentElement.lang||void 0);function Kc({label:e,value:t}){return(0,c.jsxs)("div",{className:"fs-stats__tile",children:[(0,c.jsx)("span",{className:"fs-stats__value",children:t}),(0,c.jsx)("span",{className:"fs-stats__label",children:e})]})}function Gc({daily:e}){const t=Math.max(1,...e.map(e=>e.views)),n=280/e.length,o=Math.max(2,n-2);return(0,c.jsxs)("figure",{className:"fs-stats__chart",children:[(0,c.jsx)("svg",{viewBox:"0 0 280 64",role:"img","aria-label":(0,_c.__)("Views and completions per day","funnelfork"),children:e.map((e,r)=>{const i=e.views/t*64,s=e.completes/t*64;return(0,c.jsxs)("g",{children:[(0,c.jsx)("title",{children:(0,_c.sprintf)(/* translators: 1: date, 2: views, 3: completions. */ /* translators: 1: date, 2: views, 3: completions. */ 7 (0,_c.__)("%1$s: %2$d views, %3$d completed","funnelfork"),e.day,e.views,e.completes)}),(0,c.jsx)("rect",{className:"fs-stats__bar is-views",x:r*n,y:64-i,width:o,height:i}),(0,c.jsx)("rect",{className:"fs-stats__bar is-completes",x:r*n,y:64-s,width:o,height:s})]},e.day)})}),(0,c.jsxs)("figcaption",{className:"fs-stats__legend",children:[(0,c.jsx)("span",{className:"is-views",children:(0,_c.__)("Views","funnelfork")}),(0,c.jsx)("span",{className:"is-completes",children:(0,_c.__)("Completed","funnelfork")})]})]})}function Uc({nodes:e,basic:t}){const n=e.filter(e=>"question"===e.type).slice(0,4),o=e.filter(e=>"end"===e.type).slice(0,3),{starts:r,rate:i}=t.totals,s=null===i?null:100-i,a=[92,71,55,38];return(0,c.jsxs)("section",{className:"fs-stats-pro","aria-labelledby":"fs-stats-pro-title",children:[(0,c.jsxs)("h3",{id:"fs-stats-pro-title",className:"fs-stats-pro__title",children:[(0,c.jsx)("svg",{className:"fs-stats-pro__lock",viewBox:"0 0 24 24","aria-hidden":"true",focusable:"false",children:(0,c.jsx)("path",{d:"M17 10h-1V7a4 4 0 0 0-8 0v3H7a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1v-9a1 1 0 0 0-1-1Zm-7-3a2 2 0 0 1 4 0v3h-4V7Z"})}),(0,_c.__)("Where do visitors leave?","funnelfork")]}),(0,c.jsx)("p",{className:"fs-stats-pro__lead",children:null!==s&&r>0?(0,_c.sprintf)(/* translators: %d: percentage of visitors who do not finish. */ /* translators: %d: percentage of visitors who do not finish. */ 8 (0,_c.__)("%d%% of your visitors do not finish this quickscan. FunnelFork Pro shows at which question they leave, right on the lines of your flow.","funnelfork"),s):(0,_c.__)("FunnelFork Pro shows at which question visitors leave, right on the lines of your flow.","funnelfork")}),n.length>0&&(0,c.jsx)("ul",{className:"fs-stats-pro__list","aria-hidden":"true",children:n.map((e,t)=>(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"fs-stats-pro__name",children:Oc(e)}),(0,c.jsx)("span",{className:"fs-stats-pro__bar",children:(0,c.jsx)("span",{style:{width:`${a[t]}%`}})}),(0,c.jsx)("span",{className:"fs-stats-pro__num",children:"00%"})]},e.id))}),o.length>0&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("h4",{className:"fs-stats-pro__subtitle",children:(0,_c.__)("Which result do visitors get?","funnelfork")}),(0,c.jsx)("ul",{className:"fs-stats-pro__list","aria-hidden":"true",children:o.map((e,t)=>(0,c.jsxs)("li",{children:[(0,c.jsx)("span",{className:"fs-stats-pro__name",children:Oc(e)}),(0,c.jsx)("span",{className:"fs-stats-pro__bar",children:(0,c.jsx)("span",{style:{width:`${a[t+1]}%`}})}),(0,c.jsx)("span",{className:"fs-stats-pro__num",children:"00%"})]},e.id))})]}),(0,c.jsxs)("ul",{className:"fs-stats-pro__features",children:[(0,c.jsx)("li",{children:(0,_c.__)("Drop-off per question on the canvas","funnelfork")}),(0,c.jsx)("li",{children:(0,_c.__)("How often every answer, result and label is chosen","funnelfork")}),(0,c.jsx)("li",{children:(0,_c.__)("Leads, product clicks and add to cart","funnelfork")}),(0,c.jsx)("li",{children:(0,_c.__)("Any period, compared with the period before, and CSV export","funnelfork")})]}),Ec.proPageUrl&&(0,c.jsx)(Cc.Button,{variant:"primary",href:Ec.proPageUrl,children:(0,_c.__)("See FunnelFork Pro","funnelfork")})]})}function Qc({nodes:e,edges:t,labels:n,settings:o}){const[r,i]=(0,l.useState)(null),[s,a]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{Ec.scanId&&Sc()({path:`/funnelfork/v1/stats/${Ec.scanId}?days=30`}).then(i).catch(()=>a(!0))},[]),s)return(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)(Cc.Notice,{status:"error",isDismissible:!1,children:(0,_c.__)("The statistics could not be loaded.","funnelfork")})});if(!r)return(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)(Cc.Spinner,{})});const{views:d,starts:u,completes:f,rate:h}=r.totals,p=(0,Nc.applyFilters)("funnelfork.editor.statsPanel",null,{scanId:Ec.scanId,nodes:e,edges:t,labels:n,settings:o,basic:r});return(0,c.jsxs)("div",{className:"fs-inspector__section fs-stats",children:[(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.sprintf)(/* translators: %d: number of days. */ /* translators: %d: number of days. */ 9 (0,_c.__)("Last %d days","funnelfork"),30)}),(0,c.jsxs)("div",{className:"fs-stats__tiles",children:[(0,c.jsx)(Kc,{label:(0,_c.__)("Views","funnelfork"),value:Wc(d)}),(0,c.jsx)(Kc,{label:(0,_c.__)("Started","funnelfork"),value:Wc(u)}),(0,c.jsx)(Kc,{label:(0,_c.__)("Completed","funnelfork"),value:Wc(f)}),(0,c.jsx)(Kc,{label:(0,_c.__)("Completion rate","funnelfork"),value:null===h?"–":`${h}%`})]}),d>0?(0,c.jsx)(Gc,{daily:r.daily}):(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("No visitors yet. Publish the quickscan and place it on a page; views, starts and completions appear here. Your own visits (while logged in) are not counted.","funnelfork")}),!Ec.isPremium&&f>=50&&(0,c.jsx)(Cc.Notice,{status:"info",isDismissible:!1,children:(0,_c.sprintf)(/* translators: %s: number of completions. */ /* translators: %s: number of completions. */ 10 (0,_c._n)("Your quickscan was completed %s time. Want to know what people answer? Save every response with FunnelFork Pro.","Your quickscan was completed %s times. Want to know what people answer? Save every response with FunnelFork Pro.",f,"funnelfork"),Wc(f))}),p,!p&&!Ec.isPremium&&(0,c.jsx)(Uc,{nodes:e,basic:r}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Counted anonymously: no IP addresses, cookies or answers. Bots and logged-in editors are not counted.","funnelfork")})]})}function Jc(){return Ec.proPageUrl?(0,c.jsx)("a",{href:Ec.proPageUrl,children:(0,_c.__)("Learn more","funnelfork")}):null}function ed({value:e,onChange:t,optional:n=!1,...o}){return(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,type:"number",step:1,value:e??"",onChange:e=>{if(""===e||"-"===e)return void t(n?null:0);const o=Math.round(Number(e));Number.isFinite(o)&&t(o)},...o})}function td({labels:e,value:t,onChange:n}){return e.length?(0,c.jsx)("div",{className:"fs-label-picker",children:e.map(e=>{const o=t.includes(e.id);return(0,c.jsx)("button",{type:"button",className:"fs-chip"+(o?" is-active":""),style:o?{background:e.color,borderColor:e.color}:{borderColor:e.color},"aria-pressed":o,onClick:()=>n(o?t.filter(t=>t!==e.id):[...t,e.id]),children:e.name||(0,_c.__)("(unnamed)","funnelfork")},e.id)})}):null}function nd({node:e,handle:t,nodes:n,edges:o,onConnect:r,mode:i}){const s=o.find(n=>n.source===e.id&&n.sourceHandle===t),a=[{value:"",label:"score"===i?(0,_c.__)("— Next question —","funnelfork"):(0,_c.__)("— Default result —","funnelfork")},...n.filter(t=>"start"!==t.type&&t.id!==e.id).map(e=>({value:e.id,label:("end"===e.type?"⚑ ":"? ")+Oc(e)}))];return(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Leads to","funnelfork"),value:s?s.target:"",options:a,onChange:n=>r(e.id,t,n||null)})}function od({node:e,update:t,settings:n}){const o=e.data;return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show an intro screen","funnelfork"),help:(0,_c.__)("Off: visitors start directly with the first question.","funnelfork"),checked:o.showIntro,onChange:e=>t({showIntro:e})}),o.showIntro&&(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:o.title,onChange:e=>t({title:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Introduction","funnelfork"),value:o.intro,onChange:e=>t({intro:e})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Button text","funnelfork"),value:o.buttonText,onChange:e=>t({buttonText:e})})]}),(0,Nc.applyFilters)("funnelfork.editor.startFields",null,{node:e,update:t,settings:n})]})}function rd({node:e,update:t,labels:n,nodes:o,edges:r,onConnect:i,settings:s}){const a=e.data,l="score"===s.mode?"score":"flow",d=(e,n)=>t({answers:a.answers.map((t,o)=>o===e?{...t,...n}:t)}),u=(e,n)=>{const o=[...a.answers],[r]=o.splice(e,1);o.splice(e+n,0,r),t({answers:o})};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Question","funnelfork"),value:a.question,onChange:e=>t({question:e})}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Explanation (optional)","funnelfork"),value:a.description,onChange:e=>t({description:e}),rows:2}),(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Answer type","funnelfork"),selected:a.answerType,options:[{label:(0,_c.__)("Yes / no","funnelfork"),value:"yesno"},{label:(0,_c.__)("Multiple choice (one answer)","funnelfork"),value:"choice"}],onChange:e=>{e!==a.answerType&&t({answerType:e,answers:"yesno"===e?jc():a.answers.map(e=>({...e,id:"yes"===e.id||"no"===e.id?Mc("a"):e.id}))})}}),(0,Nc.applyFilters)("funnelfork.editor.questionFields",null,{node:e,update:t,settings:s}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Answers","funnelfork")}),a.answers.map((f,h)=>(0,c.jsxs)("div",{className:"fs-answer-edit",children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.sprintf)(/* translators: %d: answer number. */ /* translators: %d: answer number. */ 11 (0,_c.__)("Answer %d","funnelfork"),h+1),value:f.text,onChange:e=>d(h,{text:e})}),"score"===l&&(0,c.jsx)(ed,{label:(0,_c.__)("Points","funnelfork"),value:f.points??0,onChange:e=>d(h,{points:e})}),(0,c.jsx)(nd,{node:e,handle:f.id,nodes:o,edges:r,onConnect:i,mode:l}),(0,c.jsx)(td,{labels:n,value:f.labels,onChange:e=>d(h,{labels:e})}),(0,Nc.applyFilters)("funnelfork.editor.answerFields",null,{node:e,answer:f,index:h,settings:s,updateAnswer:e=>d(h,e)}),"choice"===a.answerType&&(0,c.jsxs)("div",{className:"fs-answer-edit__actions",children:[(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-up-alt2",label:(0,_c.__)("Move up","funnelfork"),disabled:0===h,onClick:()=>u(h,-1)}),(0,c.jsx)(Cc.Button,{size:"small",icon:"arrow-down-alt2",label:(0,_c.__)("Move down","funnelfork"),disabled:h===a.answers.length-1,onClick:()=>u(h,1)}),(0,c.jsx)(Cc.Button,{size:"small",isDestructive:!0,icon:"trash",label:(0,_c.__)("Remove answer","funnelfork"),disabled:a.answers.length<=2,onClick:()=>t({answers:a.answers.filter((e,t)=>t!==h)})})]})]},f.id)),"choice"===a.answerType&&(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t({answers:[...a.answers,{id:Mc("a"),text:(0,_c.sprintf)(/* translators: %d: option number. */ /* translators: %d: option number. */ 12 (0,_c.__)("Option %d","funnelfork"),a.answers.length+1),labels:[],points:0}]}),children:(0,_c.__)("Add answer","funnelfork")}),!n.length&&(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Tip: create labels in the "Labels" tab and attach them to answers to build personal advice.',"funnelfork")})]})}function id({node:e,nodes:t,update:n,setDefault:o,settings:r}){const i=e.data,s="score"===r.mode,a=s?$c(t):null,l=Ec.endpointTypes||["text"],d={text:(0,_c.__)("Text","funnelfork"),gravityforms:(0,_c.__)("Gravity Forms form","funnelfork"),shortcode:(0,_c.__)("Shortcode","funnelfork")};return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Title","funnelfork"),value:i.title,onChange:e=>n({title:e})}),s&&(0,c.jsxs)("fieldset",{className:"fs-range",children:[(0,c.jsx)("legend",{className:"fs-inspector__heading",children:(0,_c.__)("Score range","funnelfork")}),(0,c.jsxs)("div",{className:"fs-range__fields",children:[(0,c.jsx)(ed,{optional:!0,label:(0,_c.__)("From","funnelfork"),placeholder:(0,_c.__)("no minimum","funnelfork"),value:i.scoreMin,onChange:e=>n({scoreMin:e})}),(0,c.jsx)(ed,{optional:!0,label:(0,_c.__)("To","funnelfork"),placeholder:(0,_c.__)("no maximum","funnelfork"),value:i.scoreMax,onChange:e=>n({scoreMax:e})})]}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.sprintf)(/* translators: 1: lowest possible score, 2: highest possible score. */ /* translators: 1: lowest possible score, 2: highest possible score. */ 13 (0,_c.__)("Visitors with a total score in this range (both included) get this result. Possible scores: %1$d to %2$d.","funnelfork"),a.min,a.max)}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the score","funnelfork"),checked:!1!==i.showScore,onChange:e=>n({showScore:e})})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Text","funnelfork"),help:(0,_c.__)("Basic HTML is allowed.","funnelfork"),value:i.content,rows:6,onChange:e=>n({content:e})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Call to action","funnelfork"),value:l.includes(i.cta?.type)?i.cta.type:"text",options:l.map(e=>({value:e,label:d[e]||e})),onChange:e=>n({cta:{...i.cta,type:e}})}),(0,Nc.applyFilters)("funnelfork.editor.endpointFields",null,{node:e,cta:i.cta||{type:"text"},updateCta:e=>n({cta:{...i.cta,...e}})}),!Ec.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("Show a Gravity Forms form or any shortcode on a result with FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(Jc,{})]}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show collected labels (advice)","funnelfork"),checked:i.showLabels,onChange:e=>n({showLabels:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show the given answers","funnelfork"),checked:i.showAnswers,onChange:e=>n({showAnswers:e})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Default result","funnelfork"),help:s?(0,_c.__)("Shown when the score matches no range. There is always exactly one default result.","funnelfork"):(0,_c.__)("Answers without a line lead here. There is always exactly one default result.","funnelfork"),checked:i.isDefault,disabled:i.isDefault,onChange:()=>o(e.id)})]})}function sd(e){const{node:t,deleteNode:n,duplicateNode:o}=e;return t?(0,c.jsxs)("div",{className:"fs-inspector__section",children:["start"===t.type&&(0,c.jsx)(od,{...e}),"question"===t.type&&(0,c.jsx)(rd,{...e}),"end"===t.type&&(0,c.jsx)(id,{...e}),"start"!==t.type&&(0,c.jsxs)("div",{className:"fs-inspector__footer",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"admin-page",onClick:()=>o(t.id),children:(0,_c.__)("Duplicate","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",isDestructive:!0,icon:"trash",onClick:()=>n(t.id),children:(0,_c.__)("Delete","funnelfork")})]})]}):(0,c.jsx)("div",{className:"fs-inspector__section",children:(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Select a question or result on the canvas to edit it.","funnelfork")})})}function ad({nodes:e,edges:t,focusNode:n,addNode:o,settings:r}){const i=e.filter(e=>"end"===e.type),s="score"===r.mode;return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Every result is an endpoint of the quickscan. Click one to show it on the canvas.","funnelfork")}),(0,c.jsx)("ul",{className:"fs-endpoint-list",children:i.map(e=>{const o=t.filter(t=>t.target===e.id).length;return(0,c.jsx)("li",{children:(0,c.jsxs)("button",{type:"button",onClick:()=>n(e.id),children:[(0,c.jsxs)("span",{className:"fs-endpoint-list__title",children:["⚑ ",Oc(e)]}),(0,c.jsxs)("span",{className:"fs-endpoint-list__meta",children:[e.data.isDefault&&(0,c.jsx)("span",{className:"fs-badge",children:(0,_c.__)("Default","funnelfork")}),s?Tc(e.data):(0,_c.sprintf)(/* translators: %d: number of incoming lines. */ /* translators: %d: number of incoming lines. */ 14 (0,_c._n)("%d incoming line","%d incoming lines",o,"funnelfork"),o)]})]})},e.id)})}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>o("end"),children:(0,_c.__)("Add result","funnelfork")})]})}function ld({labels:e,setLabels:t,nodes:n}){const o=e=>n.reduce((t,n)=>t+("question"===n.type?n.data.answers.filter(t=>t.labels.includes(e)).length:0),0),r=(n,o)=>t(e.map(e=>e.id===n?{...e,...o}:e));return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)("Labels are collected along the way. Attach them to answers (for example a product or a piece of advice) and show them on the result.","funnelfork")}),e.map(n=>(0,c.jsxs)("div",{className:"fs-label-edit",children:[(0,c.jsxs)("div",{className:"fs-label-edit__row",children:[(0,c.jsx)("input",{type:"color",value:n.color,"aria-label":(0,_c.__)("Colour","funnelfork"),onChange:e=>r(n.id,{color:e.target.value})}),(0,c.jsx)(Cc.TextControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,hideLabelFromVision:!0,label:(0,_c.__)("Name","funnelfork"),placeholder:(0,_c.__)("Name","funnelfork"),value:n.name,onChange:e=>r(n.id,{name:e})}),(0,c.jsx)(Cc.Button,{icon:"trash",isDestructive:!0,label:(0,_c.__)("Delete label","funnelfork"),onClick:()=>t(e.filter(e=>e.id!==n.id))})]}),(0,c.jsx)(Cc.TextareaControl,{__nextHasNoMarginBottom:!0,hideLabelFromVision:!0,label:(0,_c.__)("Description","funnelfork"),placeholder:(0,_c.__)("Description shown on the result (optional)","funnelfork"),rows:2,value:n.description,onChange:e=>r(n.id,{description:e})}),(0,c.jsx)("span",{className:"fs-help",children:(0,_c.sprintf)(/* translators: %d: number of answers. */ /* translators: %d: number of answers. */ 15 (0,_c._n)("Used by %d answer","Used by %d answers",o(n.id),"funnelfork"),o(n.id))})]},n.id)),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>t([...e,{id:Mc("l"),name:"",color:Pc[e.length%Pc.length],description:""}]),children:(0,_c.__)("Add label","funnelfork")})]})}function cd({settings:e,setSettings:t}){const n=Ec.transitions||["slide"],o=Ec.transitionLabels||{},r=Ec.modes||["flow","score"],i={flow:(0,_c.__)("Flow: lines decide the result","funnelfork"),score:(0,_c.__)("Score: the total score decides the result","funnelfork")};return(0,c.jsxs)("div",{className:"fs-inspector__section",children:[(0,c.jsx)(Cc.RadioControl,{label:(0,_c.__)("Type of quickscan","funnelfork"),selected:e.mode||"flow",options:r.map(e=>({value:e,label:i[e]||e})),onChange:n=>t({...e,mode:n}),help:"score"===e.mode?(0,_c.__)("Every answer gets points and every result a score range. Lines are optional: an answer without a line goes to the next question (left to right on the canvas).","funnelfork"):(0,_c.__)("Every answer leads along a line to a next question or a result. Answers without a line go to the default result.","funnelfork")}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show progress bar","funnelfork"),checked:e.showProgress,onChange:n=>t({...e,showProgress:n})}),(0,c.jsx)(Cc.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,_c.__)("Show back button","funnelfork"),checked:e.showBack,onChange:n=>t({...e,showBack:n})}),(0,c.jsx)(Cc.SelectControl,{__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0,label:(0,_c.__)("Transition between questions","funnelfork"),value:n.includes(e.transition)?e.transition:"slide",options:n.map(e=>({value:e,label:o[e]||e})),onChange:n=>t({...e,transition:n})}),(0,Nc.applyFilters)("funnelfork.editor.settingsFields",null,{settings:e,updateSettings:n=>t({...e,...n})}),!Ec.isPremium&&(0,c.jsxs)("p",{className:"fs-help fs-help--pro",children:[(0,_c.__)("More transitions and your own styling are available in FunnelFork Pro.","funnelfork")," ",(0,c.jsx)(Jc,{})]}),(0,c.jsx)("h3",{className:"fs-inspector__heading",children:(0,_c.__)("Embed","funnelfork")}),(0,c.jsx)("p",{className:"fs-help",children:(0,_c.__)('Use the "FunnelFork quickscan" block, or paste this shortcode:',"funnelfork")}),(0,c.jsx)("code",{className:"fs-shortcode",children:Ec.shortcode})]})}function dd({issues:e,focusNode:t}){return e.length?(0,c.jsx)("div",{className:"fs-issues",children:e.map((e,n)=>(0,c.jsx)(Cc.Notice,{status:"info"===e.level?"info":e.level,isDismissible:!1,children:(0,c.jsx)("button",{type:"button",className:"fs-issues__link",onClick:()=>t(e.nodeId),children:e.message})},n))}):null}function ud(e){const{tab:t,setTab:n,issues:o,focusNode:r,labels:i}=e,s=[{name:"selected",title:(0,_c.__)("Step","funnelfork")},{name:"endpoints",title:(0,_c.sprintf)(/* translators: %d: number of results. */ /* translators: %d: number of results. */ 16 (0,_c.__)("Results (%d)","funnelfork"),e.nodes.filter(e=>"end"===e.type).length)},{name:"labels",title:(0,_c.sprintf)(/* translators: %d: number of labels. */ /* translators: %d: number of labels. */(0,_c.__)("Labels (%d)","funnelfork"),i.length)},{name:"settings",title:(0,_c.__)("Settings","funnelfork")},{name:"stats",title:(0,_c.__)("Statistics","funnelfork")}];return(0,c.jsxs)("aside",{className:"fs-inspector",children:[(0,c.jsx)(Cc.TabPanel,{className:"fs-inspector__tabs",tabs:s,initialTabName:t,onSelect:n,children:t=>(0,c.jsxs)(c.Fragment,{children:["selected"===t.name&&(0,c.jsx)(sd,{...e}),"endpoints"===t.name&&(0,c.jsx)(ad,{...e}),"labels"===t.name&&(0,c.jsx)(ld,{...e}),"stats"===t.name&&(0,c.jsx)(Qc,{...e}),"settings"===t.name&&(0,c.jsx)(cd,{...e})]})},t),o.length>0&&(0,c.jsxs)("details",{className:"fs-issues-wrap",open:o.some(e=>"info"!==e.level),children:[(0,c.jsx)("summary",{children:(0,_c.sprintf)(/* translators: %d: number of notes. */ /* translators: %d: number of notes. */ 17 (0,_c._n)("%d note about this flow","%d notes about this flow",o.length,"funnelfork"),o.length)}),(0,c.jsx)(dd,{issues:o,focusNode:r})]})]})}const fd={flow:function({id:e,sourceX:t,sourceY:n,targetX:o,targetY:r,sourcePosition:i,targetPosition:s,markerEnd:a,selected:l,source:d,sourceHandleId:u,target:f}){const{deleteElements:h}=fa(),[p,g,m]=hi({sourceX:t,sourceY:n,sourcePosition:i,targetX:o,targetY:r,targetPosition:s}),y=(0,Nc.applyFilters)("funnelfork.editor.edgeLabel",null,{id:e,source:d,sourceHandle:u,target:f});return(0,c.jsxs)(c.Fragment,{children:[y&&!l&&(0,c.jsx)(ql,{children:(0,c.jsx)("div",{className:"fs-edge-label nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${g}px, ${m}px)`},children:y})}),(0,c.jsx)(Ja,{id:e,path:p,markerEnd:a,className:l?"is-selected":""}),l&&(0,c.jsx)(ql,{children:(0,c.jsx)("button",{type:"button",className:"fs-edge-delete nodrag nopan",style:{transform:`translate(-50%, -50%) translate(${g}px, ${m}px)`},onClick:()=>h({edges:[{id:e}]}),"aria-label":(0,_c.__)("Remove line","funnelfork"),title:(0,_c.__)("Remove line","funnelfork"),children:"×"})})]})}},hd={type:vr.ArrowClosed,width:18,height:18,color:"#748c85"},pd={start:"#10201f",question:"#0d7a69",end:"#f2a93b"};function gd(){return(0,c.jsxs)("div",{className:"fs-topbar__logo",children:[(0,c.jsxs)("svg",{viewBox:"0 0 48 48","aria-hidden":"true",focusable:"false",children:[(0,c.jsx)("path",{d:"M14 40V17q0-7 7-7h11M14 25h10",fill:"none",stroke:"currentColor",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,c.jsx)("circle",{cx:"36",cy:"10",r:"5",fill:"#f2a93b"}),(0,c.jsx)("circle",{cx:"29",cy:"25",r:"5",fill:"#0d7a69"}),(0,c.jsx)("circle",{cx:"14",cy:"40",r:"4",fill:"currentColor"})]}),(0,c.jsxs)("span",{children:["funnel",(0,c.jsx)("b",{children:"fork"})]})]})}function md(e,t,n){return{id:Mc("e"),source:e,sourceHandle:t,target:n,type:"flow",markerEnd:hd}}function yd(){const e=`/funnelfork/v1/scans/${Ec.scanId}`,{screenToFlowPosition:t,fitView:n,deleteElements:o}=fa(),r=(0,l.useRef)(null),[i,s]=(0,l.useState)(!0),[d,u]=(0,l.useState)(""),[f,h]=(0,l.useState)(null),[p,g]=(0,l.useState)(""),[m,y]=(0,l.useState)("draft"),[x,v,w]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Qs(e,t)),[]);return[e,t,n]}(),[b,_,k]=function(){const[e,t]=(0,a().useState)([]),n=(0,a().useCallback)(e=>t(t=>Js(e,t)),[]);return[e,t,n]}(),[S,C]=(0,l.useState)([]),[N,E]=(0,l.useState)({}),[M,P]=(0,l.useState)(!1),[j,D]=(0,l.useState)(!1),[I,O]=(0,l.useState)("selected"),[z,A]=(0,l.useState)(null),R="score"===N.mode?"score":"flow";(0,l.useEffect)(()=>{Sc()({path:e}).then(e=>{const t=Hc(e.graph);g(e.title),y(e.status),v(t.nodes),_(t.edges.map(e=>({...e,markerEnd:hd}))),C(t.labels),E(t.settings),s(!1)}).catch(e=>{u(e.message||(0,_c.__)("The quickscan could not be loaded.","funnelfork")),s(!1)})},[e,v,_]),(0,l.useEffect)(()=>{const e=e=>{M&&(e.preventDefault(),e.returnValue="")};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[M]);const L=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type&&"dimensions"!==e.type)&&P(!0),w(e)},[w]),B=(0,l.useCallback)(e=>{e.some(e=>"select"!==e.type)&&P(!0),k(e)},[k]),T=(0,l.useCallback)((e,t)=>{if(v(n=>n.map(n=>n.id===e?{...n,data:{...n.data,...t}}:n)),t.answers){const n=t.answers.map(e=>e.id);_(t=>t.filter(t=>t.source!==e||n.includes(t.sourceHandle)))}P(!0)},[v,_]),$=(0,l.useCallback)((e,t,n)=>{const o=b.filter(n=>!(n.source===e&&n.sourceHandle===t));n&&Ic(o,e,n)?h({status:"warning",text:(0,_c.__)("That line would create a loop, so it was not added.","funnelfork")}):(_(n?[...o,md(e,t,n)]:o),P(!0))},[b,_]),V=(0,l.useCallback)(e=>{const t=x.find(t=>t.id===e.target);return!(!t||"start"===t.type)&&!Ic(b.filter(t=>!(t.source===e.source&&t.sourceHandle===e.sourceHandle)),e.source,e.target)},[x,b]),H=(0,l.useCallback)(e=>{v(t=>t.map(t=>({...t,selected:t.id===e}))),_(e=>e.map(e=>e.selected?{...e,selected:!1}:e)),O("selected")},[v,_]),Z=(e,n=null,o=null)=>{const i=function(e,t){return"end"===e?{id:Mc("end"),type:"end",position:t,data:{title:(0,_c.__)("New result","funnelfork"),content:"",showLabels:!0,showAnswers:!1,isDefault:!1,scoreMin:null,scoreMax:null,showScore:!0,cta:{type:"text"}}}:{id:Mc("q"),type:"question",position:t,data:{question:"",description:"",answerType:e,answers:"yesno"===e?jc():[{id:Mc("a"),text:(0,_c.__)("Option 1","funnelfork"),labels:[],points:0},{id:Mc("a"),text:(0,_c.__)("Option 2","funnelfork"),labels:[],points:0}]}}}(e,n||(()=>{const e=r.current.getBoundingClientRect(),n=t({x:e.left+e.width/2,y:e.top+e.height/2});return{x:n.x-130+(40*Math.random()-20),y:n.y-60+(40*Math.random()-20)}})());v(e=>[...e.map(e=>({...e,selected:!1})),{...i,selected:!0}]),o&&$(o.source,o.handle,i.id),O("selected"),P(!0)},F=(0,l.useCallback)((e,n)=>{if(n.isValid||!n.fromHandle||"source"!==n.fromHandle.type)return;if(!e.target?.classList?.contains("react-flow__pane"))return;const o="changedTouches"in e?e.changedTouches[0]:e,i=r.current.getBoundingClientRect();A({left:o.clientX-i.left,top:o.clientY-i.top,position:t({x:o.clientX,y:o.clientY-30}),from:{source:n.fromNode.id,handle:n.fromHandle.id}})},[t]),Y=(0,l.useCallback)(e=>{e.some(e=>"end"===e.type&&e.data.isDefault)&&v(e=>{const t=e.find(e=>"end"===e.type);return e.map(e=>e===t?{...e,data:{...e.data,isDefault:!0}}:e)})},[v]),X=(0,l.useCallback)(async(t=m)=>{D(!0);try{const n=await Sc()({path:e,method:"POST",data:{title:p,status:t,graph:Vc({nodes:x,edges:b,labels:S,settings:N})}}),o=Hc(n.graph),r=Object.fromEntries(o.nodes.map(e=>[e.id,e]));v(e=>e.filter(e=>r[e.id]).map(e=>({...e,data:r[e.id].data})));const i=new Set(b.filter(e=>e.selected).map(e=>e.id));return _(o.edges.map(e=>({...e,markerEnd:hd,selected:i.has(e.id)}))),E(o.settings),y(n.status),g(n.title),P(!1),h({status:"success",text:"publish"===t&&"publish"!==m?(0,_c.__)("Quickscan saved and published.","funnelfork"):(0,_c.__)("Quickscan saved.","funnelfork")}),!0}catch(e){return h({status:"error",text:e.message||(0,_c.__)("Saving failed.","funnelfork")}),!1}finally{D(!1)}},[e,p,m,x,b,S,N,v,_]);(0,l.useEffect)(()=>{const e=e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()&&(e.preventDefault(),X())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[X]),(0,l.useEffect)(()=>{if(!f||"error"===f.status)return;const e=setTimeout(()=>h(null),4e3);return()=>clearTimeout(e)},[f]);const q=(0,l.useMemo)(()=>function(e,t,n="flow"){const o="score"===n?function(e){const t=[],n=zc(e),o=[];e.filter(e=>"end"===e.type).forEach(e=>{if(!Bc(e.data))return void(e.data.isDefault||t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 18 (0,_c.__)('"%s" has no score range, so it is never shown.',"funnelfork"),Oc(e))}));const n=Lc(e.data.scoreMin)?Number(e.data.scoreMin):-1/0,r=Lc(e.data.scoreMax)?Number(e.data.scoreMax):1/0;n>r?t.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: result title. */ /* translators: %s: result title. */ 19 (0,_c.__)('The minimum score of "%s" is higher than its maximum.',"funnelfork"),Oc(e))}):(o.forEach(o=>{n<=o.max&&o.min<=r&&t.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: 1: result title, 2: other result title. */ /* translators: 1: result title, 2: other result title. */ 20 (0,_c.__)('The score ranges of "%1$s" and "%2$s" overlap; "%1$s" wins.',"funnelfork"),Oc(o.node),Oc(e))})}),o.push({node:e,min:n,max:r}))});const r=e.filter(e=>"question"===e.type);r.length&&r.every(e=>e.data.answers.every(e=>!Number(e.points)))&&t.push({nodeId:r[0].id,level:"warning",message:(0,_c.__)("No answer has points yet. Select a question to give its answers points.","funnelfork")});const i=$c(e),s=[];let a=i.min;return[...o].sort((e,t)=>e.min-t.min).forEach(e=>{e.min>a&&a<=i.max&&s.push([a,Math.min(e.min-1,i.max)]),a=Math.max(a,e.max+1)}),a<=i.max&&s.push([a,i.max]),s.length&&n&&t.push({nodeId:n.id,level:Bc(n.data)?"warning":"info",message:(0,_c.sprintf)(/* translators: 1: list of scores, 2: result title. */ /* translators: 1: list of scores, 2: result title. */ 21 (0,_c.__)('Score %1$s matches no range and goes to the default result "%2$s".',"funnelfork"),s.map(([e,t])=>e===t?`${e}`:`${e}–${t}`).join(", "),Oc(n))}),t}(e):[],r=new Set,i=e.find(e=>"start"===e.type),s=zc(e),a=Ac(e),l=i?[i.id]:[];for(;l.length;){const o=l.pop();if(r.has(o))continue;r.add(o);const i=e.find(e=>e.id===o);i&&(Dc(i).forEach(r=>{const i=t.find(e=>e.source===o&&e.sourceHandle===r),s=i?i.target:Rc(e,n,o,a)?.id;s&&l.push(s)}),"score"===n&&"question"===i.type&&e.forEach(e=>"end"===e.type&&l.push(e.id)))}return e.forEach(e=>{if("question"===e.type){e.data.question.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.__)("A question has no text.","funnelfork")}),e.data.answers.length<2&&o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 22 (0,_c.__)('"%s" needs at least two answers.',"funnelfork"),Oc(e))}),e.data.answers.forEach(t=>{t.text.trim()||o.push({nodeId:e.id,level:"error",message:(0,_c.sprintf)(/* translators: %s: question text. */ /* translators: %s: question text. */ 23 (0,_c.__)('"%s" has an answer without text.',"funnelfork"),Oc(e))})});const r=e.data.answers.filter(n=>!t.some(t=>t.source===e.id&&t.sourceHandle===n.id));r.length&&"score"!==n&&o.push({nodeId:e.id,level:"info",message:(0,_c.sprintf)(/* translators: 1: number of answers, 2: question text, 3: endpoint title. */ /* translators: 1: number of answers, 2: question text, 3: endpoint title. */ 24 (0,_c.__)('%1$d answer(s) of "%2$s" have no line and go to the default result "%3$s".',"funnelfork"),r.length,Oc(e),Oc(s))})}"start"===e.type||r.has(e.id)||o.push({nodeId:e.id,level:"warning",message:(0,_c.sprintf)(/* translators: %s: question or result title. */ /* translators: %s: question or result title. */ 25 (0,_c.__)('"%s" cannot be reached from the start.',"funnelfork"),Oc(e))})}),o}(x,b,R),[x,b,R]),W=(0,l.useMemo)(()=>{const e={};return q.forEach(t=>e[t.nodeId]=[...e[t.nodeId]||[],t]),e},[q]),K=zc(x)?.id||null,G="score"===R?Ac(x).join(","):"",U=(0,l.useMemo)(()=>({labels:S,edges:b,defaultEndId:K,issuesByNode:W,mode:R,order:G?G.split(","):[]}),[S,b,K,W,R,G]),Q=x.filter(e=>e.selected),J=1===Q.length?Q[0]:null;if(i)return(0,c.jsx)("div",{className:"fs-editor fs-editor--loading",children:(0,c.jsx)(Cc.Spinner,{})});if(d)return(0,c.jsx)("div",{className:"fs-editor fs-editor--error",children:(0,c.jsx)(Cc.Notice,{status:"error",isDismissible:!1,children:d})});const ee=q.filter(e=>"error"===e.level).length;let te=(0,_c.__)("All changes saved","funnelfork");return j?te=(0,_c.__)("Saving…","funnelfork"):M&&(te=(0,_c.__)("Unsaved changes","funnelfork")),(0,c.jsx)(Fc.Provider,{value:U,children:(0,c.jsxs)("div",{className:"fs-editor",children:[(0,c.jsxs)("header",{className:"fs-topbar",children:[(0,c.jsx)("a",{className:"fs-topbar__back",href:Ec.listUrl,"aria-label":(0,_c.__)("Back to all quickscans","funnelfork"),title:(0,_c.__)("Back to all quickscans","funnelfork"),children:"←"}),(0,c.jsx)(gd,{}),(0,c.jsx)("input",{className:"fs-topbar__title",value:p,"aria-label":(0,_c.__)("Quickscan title","funnelfork"),placeholder:(0,_c.__)("Quickscan title","funnelfork"),onChange:e=>{g(e.target.value),P(!0)}}),(0,c.jsx)("span",{className:`fs-status is-${m}`,children:"publish"===m?(0,_c.__)("Published","funnelfork"):(0,_c.__)("Draft","funnelfork")}),(0,c.jsx)("span",{className:"fs-topbar__state",children:te}),(0,c.jsxs)("div",{className:"fs-topbar__actions",children:[(0,c.jsx)(Cc.Button,{variant:"tertiary",onClick:async()=>{const e=window.open("","_blank");!M||await X()?e&&(e.location=Ec.previewUrl):e&&e.close()},disabled:j,children:(0,_c.__)("Preview","funnelfork")}),"publish"===m?(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>X("draft"),disabled:j,children:(0,_c.__)("Switch to draft","funnelfork")}):(0,c.jsx)(Cc.Button,{variant:"secondary",onClick:()=>X("publish"),disabled:j||ee>0,title:ee>0?(0,_c.__)("Fix the errors in the flow first.","funnelfork"):void 0,children:(0,_c.__)("Publish","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"primary",onClick:()=>X(),isBusy:j,disabled:j||!M&&!j,children:(0,_c.__)("Save","funnelfork")})]})]}),f&&(0,c.jsx)("div",{className:"fs-editor-notice",children:(0,c.jsx)(Cc.Notice,{status:f.status,onRemove:()=>h(null),children:f.text})}),(0,c.jsxs)("div",{className:"fs-body",children:[(0,c.jsxs)("div",{className:"fs-canvas",ref:r,children:[(0,c.jsxs)(Yl,{nodes:x,edges:b,nodeTypes:qc,edgeTypes:fd,onNodesChange:L,onEdgesChange:B,onNodesDelete:Y,onConnect:e=>$(e.source,e.sourceHandle,e.target),onConnectEnd:F,isValidConnection:V,onNodeClick:()=>O("selected"),onPaneClick:()=>A(null),deleteKeyCode:["Backspace","Delete"],fitView:!0,fitViewOptions:{maxZoom:1},minZoom:.15,children:[(0,c.jsx)(ec,{gap:24,size:1.5,color:"#c6d4cf"}),(0,c.jsx)(cc,{showInteractive:!1}),(0,c.jsx)(wc,{pannable:!0,zoomable:!0,nodeColor:e=>pd[e.type]}),(0,c.jsxs)(js,{position:"top-left",className:"fs-toolbar",children:[(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("yesno"),children:(0,_c.__)("Yes/no question","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"plus",onClick:()=>Z("choice"),children:(0,_c.__)("Multiple choice","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"secondary",icon:"flag",onClick:()=>Z("end"),children:(0,_c.__)("Result","funnelfork")}),(0,c.jsx)(Cc.Button,{variant:"tertiary",icon:"layout",onClick:()=>{v(e=>function(e,t,n="flow"){const o={},r=e.find(e=>"start"===e.type),i=Ac(e),s=(r,a)=>{if(void 0!==o[r]&&o[r]>=a)return;o[r]=a;const l=e.find(e=>e.id===r);l&&(o=>Dc(o).map(r=>{const s=t.find(e=>e.source===o.id&&e.sourceHandle===r);return s?s.target:Rc(e,n,o.id,i)?.id}).filter(Boolean))(l).forEach(e=>s(e,a+1))};r&&s(r.id,0);const a=Math.max(0,...Object.values(o));e.forEach(e=>{"end"===e.type?o[e.id]=a:void 0===o[e.id]&&(o[e.id]=a+1)});const l={};e.forEach(e=>{(l[o[e.id]]=l[o[e.id]]||[]).push(e)});const c={};return Object.entries(l).forEach(([e,t])=>{let n=0;t.forEach(t=>{c[t.id]={x:340*Number(e),y:n},n+=(t.measured?.height||160)+48})}),e.map(e=>({...e,position:c[e.id]}))}(e,b,R)),P(!0),window.requestAnimationFrame(()=>n({duration:400}))},children:(0,_c.__)("Tidy up","funnelfork")})]}),(0,c.jsx)(js,{position:"bottom-center",className:"fs-hint",children:(0,_c.__)("Drag from an answer (●) to a question or result to draw a line. Drop on an empty spot to create a new step.","funnelfork")})]}),z&&(0,c.jsxs)("div",{className:"fs-drop-menu",style:{left:z.left,top:z.top},role:"menu",children:[(0,c.jsx)("span",{className:"fs-drop-menu__title",children:(0,_c.__)("Add here:","funnelfork")}),[["yesno",(0,_c.__)("Yes/no question","funnelfork")],["choice",(0,_c.__)("Multiple choice","funnelfork")],["end",(0,_c.__)("Result","funnelfork")]].map(([e,t])=>(0,c.jsx)("button",{type:"button",role:"menuitem",onClick:()=>{Z(e,z.position,z.from),A(null)},children:t},e)),(0,c.jsx)("button",{type:"button",className:"is-cancel",onClick:()=>A(null),children:(0,_c.__)("Cancel","funnelfork")})]})]}),(0,c.jsx)(ud,{node:J,nodes:x,edges:b,labels:S,settings:N,issues:q,tab:I,setTab:O,setLabels:e=>{C(e);const t=e.map(e=>e.id);v(e=>e.map(e=>"question"===e.type&&e.data.answers.some(e=>e.labels.some(e=>!t.includes(e)))?{...e,data:{...e.data,answers:e.data.answers.map(e=>({...e,labels:e.labels.filter(e=>t.includes(e))}))}}:e)),P(!0)},setSettings:e=>{E(e),P(!0)},update:e=>J&&T(J.id,e),onConnect:$,setDefault:e=>{v(t=>t.map(t=>"end"===t.type?{...t,data:{...t.data,isDefault:t.id===e}}:t)),P(!0)},deleteNode:e=>{const t=x.find(t=>t.id===e);"end"!==t?.type||1!==x.filter(e=>"end"===e.type).length?o({nodes:[{id:e}]}):h({status:"warning",text:(0,_c.__)("A quickscan needs at least one result.","funnelfork")})},duplicateNode:e=>{const t=x.find(t=>t.id===e);if(!t)return;const n=structuredClone({id:t.id,type:t.type,position:t.position,data:t.data});n.id=Mc("end"===t.type?"end":"q"),n.position={x:t.position.x+40,y:t.position.y+40},"question"===n.type&&"choice"===n.data.answerType&&(n.data.answers=n.data.answers.map(e=>({...e,id:Mc("a")}))),"end"===n.type&&(n.data.isDefault=!1),v(e=>[...e.map(e=>({...e,selected:!1})),{...n,deletable:!0,selected:!0}]),P(!0)},focusNode:e=>{H(e),window.requestAnimationFrame(()=>n({nodes:[{id:e}],duration:400,maxZoom:1.1}))},addNode:Z})]})]})})}const xd=document.getElementById("funnelfork-editor-root");xd&&(0,l.createRoot)(xd).render((0,c.jsx)(Hl,{children:(0,c.jsx)(yd,{})}))}};const t={};function n(o){const r=t[o];if(void 0!==r)return r.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.m=e,(()=>{const e=[];n.O=(t,o,r)=>{if(!o){for(var i=0;i<e.length;i++){let[o,r]=e[i],a=!0;for(var s=0;s<o.length;s++)n.O.j(o[s])?o.splice(s--,1):a=!1;if(a){e.splice(i--,1);const n=r();void 0!==n&&(t=n)}}return t}e.push([o,r])}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.cw=e=>{var t;return()=>{if(e){var n=e;e=0,t={exports:{}},n.call(t.exports,t,t.exports)}return t.exports}},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.hasOwn(e,t),n.dn=e=>{var t=Object.getOwnPropertyDescriptor(e,"name");(!t||!t.writable&&t.configurable)&&Object.defineProperty(e,"name",{value:"default",configurable:!0})},(()=>{const e={8:0,117:0};n.O.j=t=>0===e[t];const t=(t,o)=>{let[r,i,s]=o;var a,l,c=0;if(r.some(t=>0!==e[t])){for(a in i)n.o(i,a)&&(n.m[a]=i[a]);if(s)var d=s(n)}for(t&&t(o);c<r.length;c++)l=r[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(d)},o=globalThis.webpackChunkfunnelfork||=[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();let o=n.O(void 0,[117],()=>n(730));o=n.O(o)})(); -
funnelfork/trunk/build/runner.asset.php
r3763298 r3792829 3 3 4 4 ), 5 'version' => ' 5ccd18a9029cabcf9d3d'5 'version' => 'b754e60e0473a8684f3f' 6 6 ); -
funnelfork/trunk/build/runner.js
r3763298 r3792829 1 (()=>{"use strict";const t=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function e(t,e,s){const n=document.createElement(t);return e&&(n.className=e),null!=s&&(n.textContent=s),n}const s={slide:function({from:t,to:e,direction:s,viewport:n,done:i}){const r="back"===s?-1:1;e.style.transform=`translateX(${100*r}%)`;const o=e.offsetHeight;window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{n.style.height=`${o}px`,t.style.transform=`translateX(${100*-r}%)`,t.style.opacity="0",e.style.transform="translateX(0)"})}),e.addEventListener("transitionend",t=>t.target===e&&"transform"===t.propertyName&&i()),setTimeout(i,700)}};class n{constructor(t){this.root=t,this.data=JSON.parse(t.querySelector(".funnelfork__data").textContent),this.i18n=this.data.i18n,this.history=[],this.current=null,this.busy=!1,this.depthCache={},this.mode="score"===this.data.settings.mode?"score":"flow",this.order=this.data.order||[];const e=Object.entries(this.data.nodes).filter(([,t])=>"end"===t.type);this.defaultEnd=(e.find(([,t])=>t.data.isDefault)||e[0]||[])[0],this.startId=Object.keys(this.data.nodes).find(t=>"start"===this.data.nodes[t].type),this.build(),this.s howFirst("none")}build(){const{settings:t}=this.data;this.header=e("div","funnelfork__header"),this.backButton=e("button","funnelfork__back",this.i18n.back),this.backButton.type="button",this.backButton.addEventListener("click",()=>this.back()),t.showBack&&this.header.append(this.backButton),this.progress=e("div","funnelfork__progress"),this.progress.setAttribute("role","progressbar"),this.progress.setAttribute("aria-label",this.i18n.progress),this.progress.setAttribute("aria-valuemin","0"),this.progress.setAttribute("aria-valuemax","100"),this.progressBar=e("div","funnelfork__progress-bar"),this.progress.append(this.progressBar),t.showProgress&&this.header.append(this.progress),this.viewport=e("div","funnelfork__viewport"),this.live=e("div","funnelfork__sr"),this.live.setAttribute("aria-live","polite"),this.root.append(this.header,this.viewport,this.live),this.root.classList.add("is-ready")}showFirst(t){this.data.nodes[this.startId]?.data.showIntro?this.go(this.startId,t):this.begin(t)}begin(t){const e=this.step(this.startId,"next");let s=!1;this.emit("beforestart",{resume:()=>{s||(s=!0,this.go(e,"none"===t?"forward":t))}},!0).defaultPrevented||(s=!0,this.go(e,t))}show(t,s="forward"){const n=t.classList.contains("funnelfork__slide")?t:e("section","funnelfork__slide funnelfork__slide--custom");n!==t&&n.append(t),this.header.hidden=!0,this.transition(n,s)}visited(){return new Set(this.history.map(t=>t.nodeId))}next(t,e,s=this.visited()){const n=this.data.edges[`${t}|${e}`];if("score"!==this.mode)return n||this.defaultEnd;if(n&&!s.has(n))return n;const i=this.order.indexOf(t);return this.order.find((e,n)=>n>i&&e!==t&&!s.has(e))||this.defaultEnd}step(t,e){const s=this.next(t,e);return"score"===this.mode&&"end"===this.data.nodes[s]?.type?this.scoreEnd():s}score(){return this.answers().reduce((t,e)=>t+e.points,0)}scoreEnd(){const t=this.score(),e=Object.entries(this.data.nodes).find(([,e])=>{if("end"!==e.type)return!1;const s=e.data.scoreMin??null,n=e.data.scoreMax??null;return(null!==s||null!==n)&&(null===s||t>=s)&&(null===n||t<=n)});return e?e[0]:this.defaultEnd}remaining(t){if("score"===this.mode)return this.remainingScore(t,this.visited(),new Map);if(void 0!==this.depthCache[t])return this.depthCache[t];const e=this.data.nodes[t];let s=0;return"question"===e?.type?s=1+Math.max(0,...e.data.answers.map(e=>this.remaining(this.next(t,e.id)))):"start"===e?.type&&(s=this.remaining(this.next(t,"next"))),this.depthCache[t]=s,s}remainingScore(t,e,s){const n=this.data.nodes[t];if("question"!==n?.type)return 0;const i=`${t}|${[...e].sort().join(",")}`;if(!s.has(i)){const r=new Set(e).add(t),o=new Set(n.data.answers.map(e=>this.next(t,e.id,r)));s.set(i,1+Math.max(0,...[...o].map(t=>this.remainingScore(t,r,s))))}return s.get(i)}answer(t,e){this.busy||(this.history.push({nodeId:t,answerId:e}),this.emit("answer",{questionId:t,answerId:e}),this.go(this.step(t,e),"forward"))}back(){if(this.busy)return;const t=this.history.pop();t?this.go(t.nodeId,"back",t.answerId):this.current!==this.startId&&this.data.nodes[this.startId]?.data.showIntro&&this.go(this.startId,"back")}restart(){this.history=[],this.showFirst("back")}answers(){return this.history.map(({nodeId:t,answerId:e})=>{const s=this.data.nodes[t].data,n=s.answers.find(t=>t.id===e)||{};return{questionId:t,question:s.question,answerId:e,answer:n.text,labels:n.labels||[],points:Number(n.points)||0}})}collectedLabels(){const t=new Set(this.answers().flatMap(t=>t.labels));return this.data.labels.filter(e=>t.has(e.id))}emit(t,e={},s=!1){const n=new CustomEvent(`funnelfork:${t}`,{bubbles:!0,cancelable:s,detail:{scanId:this.data.id,scan:this,...e}});return this.root.dispatchEvent(n),n}go(t,e,s=null){const n=this.data.nodes[t];if(!n)return;let i;this.current=t,i="start"===n.type?this.renderStart(n):"question"===n.type?this.renderQuestion(t,n,s):this.renderEnd(t,n),this.emit("render",{nodeId:t,type:n.type,slide:i}),this.updateHeader(n),this.transition(i,e),this.emit("step",{nodeId:t,type:n.type}),"end"===n.type&&this.emit("complete",{endpointId:t,answers:this.answers(),labels:this.collectedLabels(),mode:this.mode,score:this.score()})}updateHeader(t){const e=this.history.length;let s=0;"end"===t.type?s=100:"question"===t.type&&(s=Math.round(e/(e+this.remaining(this.current))*100)),this.progressBar.style.width=`${s}%`,this.progress.setAttribute("aria-valuenow",String(s));const n=this.history.length>0||"start"!==t.type&&this.data.nodes[this.startId]?.data.showIntro;this.backButton.hidden=!n||"end"===t.type,this.header.hidden="start"===t.type}renderStart(t){const s=e("section","funnelfork__slide funnelfork__slide--start"),n=e("h2","funnelfork__title",t.data.title);if(n.tabIndex=-1,s.append(n),t.data.intro){const n=e("div","funnelfork__intro");n.innerHTML=t.data.intro,s.append(n)}const i=e("button","funnelfork__start wp-element-button",t.data.buttonText||this.i18n.start);return i.type="button",i.addEventListener("click",()=>this.begin("forward")),s.append(i),s}renderQuestion(t,s,n){const{data:i}=s,r=e("section",`funnelfork__slide funnelfork__slide--question is-${i.answerType}`),o=`funnelfork-${this.data.id}-${t}`;r.append(e("p","funnelfork__eyebrow",this.i18n.questionN.replace("%d",this.history.length+1)));const a=e("h2","funnelfork__title",i.question);a.id=o,a.tabIndex=-1,r.append(a),i.description&&r.append(e("p","funnelfork__description",i.description));const d=e("div","funnelfork__answers");return d.setAttribute("role","group"),d.setAttribute("aria-labelledby",o),i.answers.forEach(s=>{const i=e("button","funnelfork__answer");i.type="button",i.dataset.answerId=s.id,i.append(e("span","funnelfork__answer-text",s.text)),s.id===n&&(i.classList.add("is-selected"),i.setAttribute("aria-pressed","true")),i.addEventListener("click",()=>{i.classList.add("is-selected"),this.answer(t,s.id)}),d.append(i)}),r.append(d),r}renderEnd(t,s){const{data:n}=s,i=e("section","funnelfork__slide funnelfork__slide--end"),r=e("h2","funnelfork__title",n.title);r.tabIndex=-1,i.append(r),"score"===this.mode&&!1!==n.showScore&&i.append(e("p","funnelfork__score",this.i18n.yourScore.replace("%d",this.score())));const o=this.root.querySelector(`template[data-funnelfork-end="${CSS.escape(t)}"]`);o&&i.append(o.content.cloneNode(!0));const a=this.collectedLabels();if(n.showLabels&&a.length){const t=e("div","funnelfork__advice");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAdvice));const s=e("ul","funnelfork__labels");a.forEach(t=>{const n=e("li","funnelfork__label"),i=e("span","funnelfork__label-dot");i.style.background=t.color,n.append(i);const r=e("div","funnelfork__label-body");r.append(e("strong","funnelfork__label-name",t.name)),t.description&&r.append(e("p","funnelfork__label-description",t.description)),n.append(r),s.append(n)}),t.append(s),i.append(t)}if(n.showAnswers&&this.history.length){const t=e("div","funnelfork__summary");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAnswers));const s=e("dl","funnelfork__summary-list");this.answers().forEach(t=>{s.append(e("dt","",t.question),e("dd","",t.answer))}),t.append(s),i.append(t)}const d=e("button","funnelfork__restart",this.i18n.restart);return d.type="button",d.addEventListener("click",()=>this.restart()),i.append(d),i}transition(e,n){const i=this.viewport.querySelector(".funnelfork__slide.is-current");e.classList.add("is-current");const r=()=>{"none"!==n&&(e.querySelector(".funnelfork__title")?.focus({preventScroll:!0}),this.live.textContent=e.querySelector(".funnelfork__title")?.textContent||"",this.root.getBoundingClientRect().top<0&&this.root.scrollIntoView({behavior:t?"auto":"smooth",block:"start"}))};if(!i||"none"===n||t)return i?.remove(),this.viewport.append(e),void r();this.busy=!0,this.viewport.style.height=`${i.offsetHeight}px`,e.classList.add("is-entering"),this.viewport.append(e);let o=!1;const a=()=>{o||(o=!0,i.remove(),e.getAnimations?.().forEach(t=>{try{t.finish()}catch{t.cancel()}}),e.classList.remove("is-entering"),e.style.transform="",e.style.opacity="",this.viewport.style.height="",this.busy=!1,r())},d=s[this.data.settings.transition]||s.slide;try{d({from:i,to:e,direction:n,viewport:this.viewport,done:a})}catch(t){console.error("FunnelFork transition:",t),a()}setTimeout(a,1e3)}}function i(t=document){t.querySelectorAll(".funnelfork[data-funnelfork]:not(.is-ready)").forEach(t=>{try{t.funnelfork=new n(t)}catch(t){console.error("FunnelFork:",t)}})}window.FunnelFork={init:i,Scan:n,registerTransition:function(t,e){"function"==typeof e&&(s[t]=e)}},"complete"===document.readyState?i():(document.addEventListener("DOMContentLoaded",()=>i()),window.addEventListener("load",()=>i()))})();1 (()=>{"use strict";const t=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;function e(t,e,s){const n=document.createElement(t);return e&&(n.className=e),null!=s&&(n.textContent=s),n}const s={slide:function({from:t,to:e,direction:s,viewport:n,done:i}){const r="back"===s?-1:1;e.style.transform=`translateX(${100*r}%)`;const o=e.offsetHeight;window.requestAnimationFrame(()=>{window.requestAnimationFrame(()=>{n.style.height=`${o}px`,t.style.transform=`translateX(${100*-r}%)`,t.style.opacity="0",e.style.transform="translateX(0)"})}),e.addEventListener("transitionend",t=>t.target===e&&"transform"===t.propertyName&&i()),setTimeout(i,700)}};class n{constructor(t){this.root=t,this.data=JSON.parse(t.querySelector(".funnelfork__data").textContent),this.i18n=this.data.i18n,this.history=[],this.current=null,this.busy=!1,this.depthCache={},this.mode="score"===this.data.settings.mode?"score":"flow",this.order=this.data.order||[];const e=Object.entries(this.data.nodes).filter(([,t])=>"end"===t.type);this.defaultEnd=(e.find(([,t])=>t.data.isDefault)||e[0]||[])[0],this.startId=Object.keys(this.data.nodes).find(t=>"start"===this.data.nodes[t].type),this.build(),this.started=!1,this.watchView(),this.showFirst("none")}track(t){const e=this.data.track;if(!e)return;if("view"===t){if(this.viewed)return;this.viewed=!0}else this.viewed||this.track("view");const s=JSON.stringify({scanId:this.data.id,event:t});try{if(navigator.sendBeacon?.(e,new Blob([s],{type:"application/json"})))return}catch{}window.fetch(e,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json"},body:s}).catch(()=>{})}watchView(){if(!this.data.track)return;if(!("IntersectionObserver"in window))return void this.track("view");const t=new window.IntersectionObserver(e=>{e.some(t=>t.isIntersecting)&&(t.disconnect(),this.track("view"))},{threshold:.5});t.observe(this.root)}build(){const{settings:t}=this.data;this.header=e("div","funnelfork__header"),this.backButton=e("button","funnelfork__back",this.i18n.back),this.backButton.type="button",this.backButton.addEventListener("click",()=>this.back()),t.showBack&&this.header.append(this.backButton),this.progress=e("div","funnelfork__progress"),this.progress.setAttribute("role","progressbar"),this.progress.setAttribute("aria-label",this.i18n.progress),this.progress.setAttribute("aria-valuemin","0"),this.progress.setAttribute("aria-valuemax","100"),this.progressBar=e("div","funnelfork__progress-bar"),this.progress.append(this.progressBar),t.showProgress&&this.header.append(this.progress),this.viewport=e("div","funnelfork__viewport"),this.live=e("div","funnelfork__sr"),this.live.setAttribute("aria-live","polite"),this.root.append(this.header,this.viewport,this.live),this.root.classList.add("is-ready")}showFirst(t){this.data.nodes[this.startId]?.data.showIntro?this.go(this.startId,t):this.begin(t)}begin(t){const e=this.step(this.startId,"next");let s=!1;this.emit("beforestart",{resume:()=>{s||(s=!0,this.go(e,"none"===t?"forward":t))}},!0).defaultPrevented||(s=!0,this.go(e,t))}show(t,s="forward"){const n=t.classList.contains("funnelfork__slide")?t:e("section","funnelfork__slide funnelfork__slide--custom");n!==t&&n.append(t),this.header.hidden=!0,this.transition(n,s)}visited(){return new Set(this.history.map(t=>t.nodeId))}next(t,e,s=this.visited()){const n=this.data.edges[`${t}|${e}`];if("score"!==this.mode)return n||this.defaultEnd;if(n&&!s.has(n))return n;const i=this.order.indexOf(t);return this.order.find((e,n)=>n>i&&e!==t&&!s.has(e))||this.defaultEnd}step(t,e){const s=this.next(t,e);return"score"===this.mode&&"end"===this.data.nodes[s]?.type?this.scoreEnd():s}score(){return this.answers().reduce((t,e)=>t+e.points,0)}scoreEnd(){const t=this.score(),e=Object.entries(this.data.nodes).find(([,e])=>{if("end"!==e.type)return!1;const s=e.data.scoreMin??null,n=e.data.scoreMax??null;return(null!==s||null!==n)&&(null===s||t>=s)&&(null===n||t<=n)});return e?e[0]:this.defaultEnd}remaining(t){if("score"===this.mode)return this.remainingScore(t,this.visited(),new Map);if(void 0!==this.depthCache[t])return this.depthCache[t];const e=this.data.nodes[t];let s=0;return"question"===e?.type?s=1+Math.max(0,...e.data.answers.map(e=>this.remaining(this.next(t,e.id)))):"start"===e?.type&&(s=this.remaining(this.next(t,"next"))),this.depthCache[t]=s,s}remainingScore(t,e,s){const n=this.data.nodes[t];if("question"!==n?.type)return 0;const i=`${t}|${[...e].sort().join(",")}`;if(!s.has(i)){const r=new Set(e).add(t),o=new Set(n.data.answers.map(e=>this.next(t,e.id,r)));s.set(i,1+Math.max(0,...[...o].map(t=>this.remainingScore(t,r,s))))}return s.get(i)}answer(t,e){this.busy||(this.history.push({nodeId:t,answerId:e}),this.emit("answer",{questionId:t,answerId:e}),this.goForward(this.step(t,e)))}goForward(t){if("end"!==this.data.nodes[t]?.type)return void this.go(t,"forward");let e=!1;const s=()=>{e||(e=!0,this.go(t,"forward"))};this.emit("beforecomplete",{endpointId:t,answers:this.answers(),labels:this.collectedLabels(),mode:this.mode,score:this.score(),resume:s},!0).defaultPrevented||s()}back(){if(this.busy)return;const t=this.history.pop();t?this.go(t.nodeId,"back",t.answerId):this.current!==this.startId&&this.data.nodes[this.startId]?.data.showIntro&&this.go(this.startId,"back")}restart(){this.history=[],this.showFirst("back")}answers(){return this.history.map(({nodeId:t,answerId:e})=>{const s=this.data.nodes[t].data,n=s.answers.find(t=>t.id===e)||{};return{questionId:t,question:s.question,answerId:e,answer:n.text,labels:n.labels||[],points:Number(n.points)||0}})}collectedLabels(){const t=new Set(this.answers().flatMap(t=>t.labels));return this.data.labels.filter(e=>t.has(e.id))}emit(t,e={},s=!1){const n=new CustomEvent(`funnelfork:${t}`,{bubbles:!0,cancelable:s,detail:{scanId:this.data.id,scan:this,...e}});return this.root.dispatchEvent(n),n}go(t,e,s=null){const n=this.data.nodes[t];if(!n)return;let i;this.current=t,i="start"===n.type?this.renderStart(n):"question"===n.type?this.renderQuestion(t,n,s):this.renderEnd(t,n),this.emit("render",{nodeId:t,type:n.type,slide:i}),this.updateHeader(n),this.transition(i,e),this.emit("step",{nodeId:t,type:n.type}),"question"!==n.type||this.started||(this.started=!0,this.track("start")),"end"===n.type&&(this.track("complete"),this.started=!1,this.emit("complete",{endpointId:t,answers:this.answers(),labels:this.collectedLabels(),mode:this.mode,score:this.score()}))}updateHeader(t){const e=this.history.length;let s=0;"end"===t.type?s=100:"question"===t.type&&(s=Math.round(e/(e+this.remaining(this.current))*100)),this.progressBar.style.width=`${s}%`,this.progress.setAttribute("aria-valuenow",String(s));const n=this.history.length>0||"start"!==t.type&&this.data.nodes[this.startId]?.data.showIntro;this.backButton.hidden=!n||"end"===t.type,this.header.hidden="start"===t.type}renderStart(t){const s=e("section","funnelfork__slide funnelfork__slide--start"),n=e("h2","funnelfork__title",t.data.title);if(n.tabIndex=-1,s.append(n),t.data.intro){const n=e("div","funnelfork__intro");n.innerHTML=t.data.intro,s.append(n)}const i=e("button","funnelfork__start wp-element-button",t.data.buttonText||this.i18n.start);return i.type="button",i.addEventListener("click",()=>this.begin("forward")),s.append(i),s}renderQuestion(t,s,n){const{data:i}=s,r=e("section",`funnelfork__slide funnelfork__slide--question is-${i.answerType}`),o=`funnelfork-${this.data.id}-${t}`;r.append(e("p","funnelfork__eyebrow",this.i18n.questionN.replace("%d",this.history.length+1)));const a=e("h2","funnelfork__title",i.question);a.id=o,a.tabIndex=-1,r.append(a),i.description&&r.append(e("p","funnelfork__description",i.description));const d=e("div","funnelfork__answers");return d.setAttribute("role","group"),d.setAttribute("aria-labelledby",o),i.answers.forEach(s=>{const i=e("button","funnelfork__answer");i.type="button",i.dataset.answerId=s.id,i.append(e("span","funnelfork__answer-text",s.text)),s.id===n&&(i.classList.add("is-selected"),i.setAttribute("aria-pressed","true")),i.addEventListener("click",()=>{i.classList.add("is-selected"),this.answer(t,s.id)}),d.append(i)}),r.append(d),r}renderEnd(t,s){const{data:n}=s,i=e("section","funnelfork__slide funnelfork__slide--end"),r=e("h2","funnelfork__title",n.title);r.tabIndex=-1,i.append(r),"score"===this.mode&&!1!==n.showScore&&i.append(e("p","funnelfork__score",this.i18n.yourScore.replace("%d",this.score())));const o=this.root.querySelector(`template[data-funnelfork-end="${CSS.escape(t)}"]`);o&&i.append(o.content.cloneNode(!0));const a=this.collectedLabels();if(n.showLabels&&a.length){const t=e("div","funnelfork__advice");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAdvice));const s=e("ul","funnelfork__labels");a.forEach(t=>{const n=e("li","funnelfork__label"),i=e("span","funnelfork__label-dot");i.style.background=t.color,n.append(i);const r=e("div","funnelfork__label-body");r.append(e("strong","funnelfork__label-name",t.name)),t.description&&r.append(e("p","funnelfork__label-description",t.description)),n.append(r),s.append(n)}),t.append(s),i.append(t)}if(n.showAnswers&&this.history.length){const t=e("div","funnelfork__summary");t.append(e("h3","funnelfork__subtitle",this.i18n.yourAnswers));const s=e("dl","funnelfork__summary-list");this.answers().forEach(t=>{s.append(e("dt","",t.question),e("dd","",t.answer))}),t.append(s),i.append(t)}const d=e("button","funnelfork__restart",this.i18n.restart);return d.type="button",d.addEventListener("click",()=>this.restart()),i.append(d),i}transition(e,n){const i=this.viewport.querySelector(".funnelfork__slide.is-current");e.classList.add("is-current");const r=()=>{"none"!==n&&(e.querySelector(".funnelfork__title")?.focus({preventScroll:!0}),this.live.textContent=e.querySelector(".funnelfork__title")?.textContent||"",this.root.getBoundingClientRect().top<0&&this.root.scrollIntoView({behavior:t?"auto":"smooth",block:"start"}))};if(!i||"none"===n||t)return i?.remove(),this.viewport.append(e),void r();this.busy=!0,this.viewport.style.height=`${i.offsetHeight}px`,e.classList.add("is-entering"),this.viewport.append(e);let o=!1;const a=()=>{o||(o=!0,i.remove(),e.getAnimations?.().forEach(t=>{try{t.finish()}catch{t.cancel()}}),e.classList.remove("is-entering"),e.style.transform="",e.style.opacity="",this.viewport.style.height="",this.busy=!1,r())},d=s[this.data.settings.transition]||s.slide;try{d({from:i,to:e,direction:n,viewport:this.viewport,done:a})}catch(t){console.error("FunnelFork transition:",t),a()}setTimeout(a,1e3)}}function i(t=document){t.querySelectorAll(".funnelfork[data-funnelfork]:not(.is-ready)").forEach(t=>{try{t.funnelfork=new n(t)}catch(t){console.error("FunnelFork:",t)}})}window.FunnelFork={init:i,Scan:n,registerTransition:function(t,e){"function"==typeof e&&(s[t]=e)}},"complete"===document.readyState?i():(document.addEventListener("DOMContentLoaded",()=>i()),window.addEventListener("load",()=>i()))})(); -
funnelfork/trunk/funnelfork.php
r3764618 r3792829 4 4 * Plugin URI: https://funnelfork.com/ 5 5 * Description: Drag & drop quiz builder: draw product recommendation quizzes, decision trees and assessments as a flowchart, and turn visitors into leads. 6 * Version: 1. 0.26 * Version: 1.1.0 7 7 * Requires at least: 6.7 8 8 * Requires PHP: 8.1 … … 19 19 defined( 'ABSPATH' ) || exit; 20 20 21 define( 'FUNNELFORK_VERSION', '1. 0.2' );21 define( 'FUNNELFORK_VERSION', '1.1.0' ); 22 22 define( 'FUNNELFORK_FILE', __FILE__ ); 23 23 define( 'FUNNELFORK_DIR', plugin_dir_path( __FILE__ ) ); … … 33 33 require_once FUNNELFORK_DIR . 'includes/class-upgrade.php'; 34 34 require_once FUNNELFORK_DIR . 'includes/class-review.php'; 35 require_once FUNNELFORK_DIR . 'includes/class-stats.php'; 35 36 require_once FUNNELFORK_DIR . 'includes/freemius.php'; 36 37 … … 45 46 FunnelFork\Upgrade::init(); 46 47 FunnelFork\Review::init(); 48 FunnelFork\Stats::init(); 47 49 48 50 /** -
funnelfork/trunk/includes/freemius.php
r3763298 r3792829 107 107 ); 108 108 109 // Freemius builds the trial texts in the FunnelFork Pro dialog from English pieces ("14 days", 110 // "/ year"), which ends up as "Start mijn gratis 14 days". Whole sentences of our own instead. 111 add_action( 112 'admin_init', 113 static function () { 114 $texts = array( 115 'start-free-x' => __( 'Start 14-day free trial', 'funnelfork' ), 116 'no-commitment-x' => __( 'Card required. Cancel before day 14 and you pay nothing.', 'funnelfork' ), 117 'after-x-pay-as-little-y' => __( 'After 14 days your yearly license starts.', 'funnelfork' ), 118 ); 119 // The dialog uses the add-on's slug in Freemius. 120 foreach ( array( 'funnelfork', 'funnelfork-pro' ) as $slug ) { 121 fs_override_i18n( $texts, $slug ); 122 } 123 } 124 ); 109 // Deleting the plugin removes the statistics table (scans stay, as posts of the site). 110 $funnelfork_fs->add_action( 'after_uninstall', array( 'FunnelFork\Stats', 'uninstall' ) ); 125 111 126 112 do_action( 'funnelfork_fs_loaded' ); -
funnelfork/trunk/languages/funnelfork.pot
r3764618 r3792829 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: FunnelFork – Visual Quiz Builder for Product Recommendations & Decision Trees 1. 0.2\n"5 "Project-Id-Version: FunnelFork – Visual Quiz Builder for Product Recommendations & Decision Trees 1.1.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/funnelfork\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2026-1 0-25T12:50:48+00:00\n"12 "POT-Creation-Date: 2026-11-09T15:48:38+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 "X-Generator: WP-CLI 2.1 1.0\n"14 "X-Generator: WP-CLI 2.12.0\n" 15 15 "X-Domain: funnelfork\n" 16 16 … … 56 56 #: includes/class-admin.php:171 57 57 #: includes/class-rest.php:75 58 #: includes/class-stats.php:372 58 59 msgid "Quickscan not found." 59 60 msgstr "" … … 69 70 70 71 #: includes/class-admin.php:261 71 #: build/editor.js:8 72 #: src/editor/components/Inspector.js:411 72 #: build/editor.js:12 73 73 msgid "Shortcode" 74 74 msgstr "" … … 83 83 84 84 #: includes/class-admin.php:305 85 #: build/editor.js:21 86 #: src/editor/App.js:636 85 #: build/editor.js:25 87 86 msgid "Preview" 88 87 msgstr "" … … 111 110 #. translators: %d: question number. 112 111 #: includes/class-frontend.php:177 112 #, php-format 113 113 msgid "Question %d" 114 114 msgstr "" … … 124 124 #. translators: %d: total score. 125 125 #: includes/class-frontend.php:181 126 #, php-format 126 127 msgid "Your score: %d" 127 128 msgstr "" … … 131 132 #: build/editor.js:1 132 133 #: build/editor.js:5 133 #: src/editor/components/nodes.js:68134 #: src/editor/components/nodes.js:70135 #: src/editor/utils.js:151136 134 msgid "Start" 137 135 msgstr "" … … 171 169 #: includes/class-graph.php:169 172 170 #: build/editor.js:1 173 #: src/editor/utils.js:36174 171 msgid "Yes" 175 172 msgstr "" … … 177 174 #: includes/class-graph.php:175 178 175 #: build/editor.js:1 179 #: src/editor/utils.js:37180 176 msgid "No" 181 177 msgstr "" … … 186 182 187 183 #: includes/class-post-type.php:36 184 #: includes/class-stats.php:472 188 185 #: build/block/index.js:1 189 #: src/block/index.js:54190 #: src/block/index.js:66191 186 msgid "Quickscan" 192 187 msgstr "" … … 227 222 #. translators: %s: first name of the user. 228 223 #: includes/class-review.php:151 224 #, php-format 229 225 msgid "Hi %s, congratulations on publishing your first quickscan. I hope it helps your visitors find the right answer." 230 226 msgstr "" … … 258 254 #. translators: %s: link to the support forum. 259 255 #: includes/class-review.php:170 256 #, php-format 260 257 msgid "Ran into a problem? %s and we will help you out." 261 258 msgstr "" … … 267 264 #: includes/class-review.php:190 268 265 msgid "Sorry, you are not allowed to do that." 266 msgstr "" 267 268 #. translators: %d: number of days. 269 #: includes/class-stats.php:395 270 #, php-format 271 msgid "Views (%d days)" 272 msgstr "" 273 274 #: includes/class-stats.php:396 275 #: includes/class-stats.php:457 276 #: build/editor.js:7 277 #: build/editor.js:9 278 msgid "Completed" 279 msgstr "" 280 281 #: includes/class-stats.php:397 282 #: includes/class-stats.php:458 283 #: includes/class-stats.php:474 284 #: build/editor.js:9 285 msgid "Completion rate" 286 msgstr "" 287 288 #. translators: %d: number of days. 289 #: includes/class-stats.php:437 290 #, php-format 291 msgid "FunnelFork – last %d days" 292 msgstr "" 293 294 #: includes/class-stats.php:455 295 #: includes/class-stats.php:473 296 #: build/editor.js:7 297 #: build/editor.js:9 298 msgid "Views" 299 msgstr "" 300 301 #: includes/class-stats.php:456 302 #: build/editor.js:9 303 msgid "Started" 304 msgstr "" 305 306 #: includes/class-stats.php:487 307 msgid "No visitors yet. Place a quickscan on a page with the block or the shortcode, and the numbers appear here." 308 msgstr "" 309 310 #. translators: %d: percentage of visitors who do not finish. 311 #: includes/class-stats.php:495 312 #, php-format 313 msgid "%d%% of the visitors who start do not finish. FunnelFork Pro shows at which question they leave." 314 msgstr "" 315 316 #: includes/class-stats.php:500 317 #: build/editor.js:10 318 msgid "Learn more" 319 msgstr "" 320 321 #: includes/class-stats.php:514 322 msgid "When you view or do a quickscan, we count this anonymously: per quickscan and per day only the number of views, starts and completions. No IP address, cookie or answer is stored for these statistics." 269 323 msgstr "" 270 324 … … 419 473 msgstr "" 420 474 421 #: includes/freemius.php:115422 msgid "Start 14-day free trial"423 msgstr ""424 425 #: includes/freemius.php:116426 msgid "Card required. Cancel before day 14 and you pay nothing."427 msgstr ""428 429 #: includes/freemius.php:117430 msgid "After 14 days your yearly license starts."431 msgstr ""432 433 475 #: build/block/index.js:1 434 #: src/block/index.js:38435 476 msgid "— Choose a quickscan —" 436 477 msgstr "" 437 478 438 479 #: build/block/index.js:1 439 #: src/block/index.js:42440 480 msgid "(no title)" 441 481 msgstr "" 442 482 443 483 #: build/block/index.js:1 444 #: src/block/index.js:44445 484 msgid "draft" 446 485 msgstr "" 447 486 448 487 #: build/block/index.js:1 449 #: src/block/index.js:72450 488 msgid "FunnelFork quickscan" 451 489 msgstr "" 452 490 453 491 #: build/block/index.js:1 454 #: src/block/index.js:76455 492 msgid "Choose which quickscan to show here." 456 493 msgstr "" 457 494 458 495 #: build/block/index.js:1 459 #: src/block/index.js:87460 496 msgid "Edit this quickscan" 461 497 msgstr "" … … 463 499 #: build/editor.js:1 464 500 #: build/editor.js:6 465 #: src/editor/components/nodes.js:240466 #: src/editor/utils.js:154467 501 msgid "(untitled result)" 468 502 msgstr "" 469 503 470 504 #: build/editor.js:1 471 #: src/editor/utils.js:156472 505 msgid "(empty question)" 473 506 msgstr "" … … 475 508 #. translators: %d: score. 476 509 #: build/editor.js:2 477 # : src/editor/utils.js:239510 #, js-format 478 511 msgid "Score %d" 479 512 msgstr "" … … 481 514 #. translators: 1: lowest score, 2: highest score. 482 515 #: build/editor.js:3 483 # : src/editor/utils.js:244516 #, js-format 484 517 msgid "Score %1$d – %2$d" 485 518 msgstr "" … … 487 520 #. translators: %d: lowest score. 488 521 #: build/editor.js:4 489 # : src/editor/utils.js:252522 #, js-format 490 523 msgid "Score %d or more" 491 524 msgstr "" … … 493 526 #. translators: %d: highest score. 494 527 #: build/editor.js:5 495 # : src/editor/utils.js:259528 #, js-format 496 529 msgid "Score %d or less" 497 530 msgstr "" 498 531 499 532 #: build/editor.js:5 500 #: src/editor/utils.js:263501 533 msgid "No score range" 502 534 msgstr "" 503 535 504 536 #: build/editor.js:5 505 #: src/editor/components/nodes.js:103506 537 msgid "Position in the question order" 507 538 msgstr "" 508 539 509 540 #: build/editor.js:5 510 #: build/editor.js:6 511 #: src/editor/components/Inspector.js:268 512 #: src/editor/components/nodes.js:112 541 #: build/editor.js:10 513 542 msgid "Yes / no" 514 543 msgstr "" 515 544 516 545 #: build/editor.js:5 517 #: build/editor.js:21 518 #: src/editor/App.js:727 519 #: src/editor/App.js:771 520 #: src/editor/components/nodes.js:113 546 #: build/editor.js:25 521 547 msgid "Multiple choice" 522 548 msgstr "" 523 549 524 550 #: build/editor.js:5 525 #: src/editor/components/nodes.js:117526 551 msgid "Type your question…" 527 552 msgstr "" 528 553 529 554 #: build/editor.js:5 530 #: src/editor/components/nodes.js:133531 555 msgid "(empty)" 532 556 msgstr "" 533 557 534 558 #: build/editor.js:5 535 #: build/editor.js:7 536 #: src/editor/components/Inspector.js:303 537 #: src/editor/components/nodes.js:143 559 #: build/editor.js:11 538 560 msgid "Points" 539 561 msgstr "" 540 562 541 563 #: build/editor.js:5 542 #: src/editor/components/nodes.js:152543 564 msgid "No line: goes to the next question" 544 565 msgstr "" 545 566 546 567 #: build/editor.js:5 547 #: src/editor/components/nodes.js:165548 568 msgid "No line: the scan ends and the score picks the result" 549 569 msgstr "" 550 570 551 571 #: build/editor.js:5 552 #: src/editor/components/nodes.js:169553 572 msgid "No line: goes to the default result" 554 573 msgstr "" 555 574 556 575 #: build/editor.js:5 557 #: src/editor/components/nodes.js:202558 576 msgid "also receives scores without a range" 559 577 msgstr "" 560 578 561 579 #: build/editor.js:5 562 #: src/editor/components/nodes.js:205563 580 msgid "also receives all answers without a line" 564 581 msgstr "" … … 566 583 #. translators: %d: number of incoming lines. 567 584 #: build/editor.js:6 568 #: build/editor.js:10 569 #: src/editor/components/Inspector.js:608 570 #: src/editor/components/nodes.js:209 585 #: build/editor.js:14 586 #, js-format 571 587 msgid "%d incoming line" 572 588 msgid_plural "%d incoming lines" … … 575 591 576 592 #: build/editor.js:6 577 #: build/editor.js:21 578 #: src/editor/App.js:734 579 #: src/editor/App.js:773 580 #: src/editor/components/nodes.js:231 593 #: build/editor.js:25 581 594 msgid "Result" 582 595 msgstr "" 583 596 584 597 #: build/editor.js:6 598 #: build/editor.js:13 599 msgid "Default" 600 msgstr "" 601 602 #: build/editor.js:6 603 #: build/editor.js:12 604 #: build/editor.js:13 605 msgid "Text" 606 msgstr "" 607 608 #: build/editor.js:6 609 msgid "Views and completions per day" 610 msgstr "" 611 612 #. translators: 1: date, 2: views, 3: completions. 613 #: build/editor.js:7 614 #, js-format 615 msgid "%1$s: %2$d views, %3$d completed" 616 msgstr "" 617 618 #: build/editor.js:7 619 msgid "Where do visitors leave?" 620 msgstr "" 621 622 #. translators: %d: percentage of visitors who do not finish. 623 #: build/editor.js:8 624 #, js-format 625 msgid "%d%% of your visitors do not finish this quickscan. FunnelFork Pro shows at which question they leave, right on the lines of your flow." 626 msgstr "" 627 628 #: build/editor.js:8 629 msgid "FunnelFork Pro shows at which question visitors leave, right on the lines of your flow." 630 msgstr "" 631 632 #: build/editor.js:8 633 msgid "Which result do visitors get?" 634 msgstr "" 635 636 #: build/editor.js:8 637 msgid "Drop-off per question on the canvas" 638 msgstr "" 639 640 #: build/editor.js:8 641 msgid "How often every answer, result and label is chosen" 642 msgstr "" 643 644 #: build/editor.js:8 645 msgid "Leads, product clicks and add to cart" 646 msgstr "" 647 648 #: build/editor.js:8 649 msgid "Any period, compared with the period before, and CSV export" 650 msgstr "" 651 652 #: build/editor.js:8 653 msgid "See FunnelFork Pro" 654 msgstr "" 655 656 #: build/editor.js:8 657 msgid "The statistics could not be loaded." 658 msgstr "" 659 660 #. translators: %d: number of days. 585 661 #: build/editor.js:9 586 #: src/editor/components/Inspector.js:601 587 #: src/editor/components/nodes.js:234 588 msgid "Default" 589 msgstr "" 590 591 #: build/editor.js:6 592 #: build/editor.js:8 662 #, js-format 663 msgid "Last %d days" 664 msgstr "" 665 593 666 #: build/editor.js:9 594 #: src/editor/components/Inspector.js:409 595 #: src/editor/components/Inspector.js:465 596 #: src/editor/components/nodes.js:248 597 msgid "Text" 598 msgstr "" 599 600 #: build/editor.js:6 601 #: src/editor/components/Inspector.js:34 602 msgid "Learn more" 603 msgstr "" 604 605 #: build/editor.js:6 606 #: src/editor/components/Inspector.js:105 667 msgid "No visitors yet. Publish the quickscan and place it on a page; views, starts and completions appear here. Your own visits (while logged in) are not counted." 668 msgstr "" 669 670 #. translators: %s: number of completions. 671 #: build/editor.js:10 672 #, js-format 673 msgid "Your quickscan was completed %s time. Want to know what people answer? Save every response with FunnelFork Pro." 674 msgid_plural "Your quickscan was completed %s times. Want to know what people answer? Save every response with FunnelFork Pro." 675 msgstr[0] "" 676 msgstr[1] "" 677 678 #: build/editor.js:10 679 msgid "Counted anonymously: no IP addresses, cookies or answers. Bots and logged-in editors are not counted." 680 msgstr "" 681 682 #: build/editor.js:10 607 683 msgid "(unnamed)" 608 684 msgstr "" 609 685 610 #: build/editor.js:6 611 #: src/editor/components/Inspector.js:132 686 #: build/editor.js:10 612 687 msgid "— Next question —" 613 688 msgstr "" 614 689 615 #: build/editor.js:6 616 #: src/editor/components/Inspector.js:133 690 #: build/editor.js:10 617 691 msgid "— Default result —" 618 692 msgstr "" 619 693 620 #: build/editor.js:6 621 #: src/editor/components/Inspector.js:146 694 #: build/editor.js:10 622 695 msgid "Leads to" 623 696 msgstr "" 624 697 625 #: build/editor.js:6 626 #: src/editor/components/Inspector.js:162 698 #: build/editor.js:10 627 699 msgid "Show an intro screen" 628 700 msgstr "" 629 701 630 #: build/editor.js:6 631 #: src/editor/components/Inspector.js:163 702 #: build/editor.js:10 632 703 msgid "Off: visitors start directly with the first question." 633 704 msgstr "" 634 705 635 #: build/editor.js:6 636 #: build/editor.js:8 637 #: src/editor/components/Inspector.js:175 638 #: src/editor/components/Inspector.js:419 706 #: build/editor.js:10 707 #: build/editor.js:12 639 708 msgid "Title" 640 709 msgstr "" 641 710 642 #: build/editor.js:6 643 #: src/editor/components/Inspector.js:181 711 #: build/editor.js:10 644 712 msgid "Introduction" 645 713 msgstr "" 646 714 647 #: build/editor.js:6 648 #: src/editor/components/Inspector.js:188 715 #: build/editor.js:10 649 716 msgid "Button text" 650 717 msgstr "" 651 718 652 #: build/editor.js:6 653 #: src/editor/components/Inspector.js:253 719 #: build/editor.js:10 654 720 msgid "Question" 655 721 msgstr "" 656 722 657 #: build/editor.js:6 658 #: src/editor/components/Inspector.js:259 723 #: build/editor.js:10 659 724 msgid "Explanation (optional)" 660 725 msgstr "" 661 726 662 #: build/editor.js:6 663 #: src/editor/components/Inspector.js:265 727 #: build/editor.js:10 664 728 msgid "Answer type" 665 729 msgstr "" 666 730 667 #: build/editor.js:6 668 #: src/editor/components/Inspector.js:270 731 #: build/editor.js:10 669 732 msgid "Multiple choice (one answer)" 670 733 msgstr "" 671 734 672 #: build/editor.js:6 673 #: src/editor/components/Inspector.js:286 735 #: build/editor.js:10 674 736 msgid "Answers" 675 737 msgstr "" 676 738 677 739 #. translators: %d: answer number. 678 #: build/editor.js: 7679 # : src/editor/components/Inspector.js:295740 #: build/editor.js:11 741 #, js-format 680 742 msgid "Answer %d" 681 743 msgstr "" 682 744 683 #: build/editor.js:7 684 #: src/editor/components/Inspector.js:337 745 #: build/editor.js:11 685 746 msgid "Move up" 686 747 msgstr "" 687 748 688 #: build/editor.js:7 689 #: src/editor/components/Inspector.js:344 749 #: build/editor.js:11 690 750 msgid "Move down" 691 751 msgstr "" 692 752 693 #: build/editor.js:7 694 #: src/editor/components/Inspector.js:352 753 #: build/editor.js:11 695 754 msgid "Remove answer" 696 755 msgstr "" 697 756 698 757 #. translators: %d: option number. 699 #: build/editor.js: 8700 # : src/editor/components/Inspector.js:378758 #: build/editor.js:12 759 #, js-format 701 760 msgid "Option %d" 702 761 msgstr "" 703 762 704 #: build/editor.js:8 705 #: src/editor/components/Inspector.js:388 763 #: build/editor.js:12 706 764 msgid "Add answer" 707 765 msgstr "" 708 766 709 #: build/editor.js:8 710 #: src/editor/components/Inspector.js:393 767 #: build/editor.js:12 711 768 msgid "Tip: create labels in the \"Labels\" tab and attach them to answers to build personal advice." 712 769 msgstr "" 713 770 714 #: build/editor.js:8 715 #: src/editor/components/Inspector.js:410 771 #: build/editor.js:12 716 772 msgid "Gravity Forms form" 717 773 msgstr "" 718 774 719 #: build/editor.js:8 720 #: src/editor/components/Inspector.js:426 775 #: build/editor.js:12 721 776 msgid "Score range" 722 777 msgstr "" 723 778 724 #: build/editor.js:8 725 #: src/editor/components/Inspector.js:431 779 #: build/editor.js:12 726 780 msgid "From" 727 781 msgstr "" 728 782 729 #: build/editor.js:8 730 #: src/editor/components/Inspector.js:432 783 #: build/editor.js:12 731 784 msgid "no minimum" 732 785 msgstr "" 733 786 734 #: build/editor.js:8 735 #: src/editor/components/Inspector.js:438 787 #: build/editor.js:12 736 788 msgid "To" 737 789 msgstr "" 738 790 739 #: build/editor.js:8 740 #: src/editor/components/Inspector.js:439 791 #: build/editor.js:12 741 792 msgid "no maximum" 742 793 msgstr "" 743 794 744 795 #. translators: 1: lowest possible score, 2: highest possible score. 745 #: build/editor.js: 9746 # : src/editor/components/Inspector.js:447796 #: build/editor.js:13 797 #, js-format 747 798 msgid "Visitors with a total score in this range (both included) get this result. Possible scores: %1$d to %2$d." 748 799 msgstr "" 749 800 750 #: build/editor.js:9 751 #: src/editor/components/Inspector.js:457 801 #: build/editor.js:13 752 802 msgid "Show the score" 753 803 msgstr "" 754 804 755 #: build/editor.js:9 756 #: src/editor/components/Inspector.js:466 805 #: build/editor.js:13 757 806 msgid "Basic HTML is allowed." 758 807 msgstr "" 759 808 760 #: build/editor.js:9 761 #: src/editor/components/Inspector.js:474 809 #: build/editor.js:13 762 810 msgid "Call to action" 763 811 msgstr "" 764 812 765 #: build/editor.js:9 766 #: src/editor/components/Inspector.js:490 813 #: build/editor.js:13 767 814 msgid "Show a Gravity Forms form or any shortcode on a result with FunnelFork Pro." 768 815 msgstr "" 769 816 770 #: build/editor.js:9 771 #: src/editor/components/Inspector.js:499 817 #: build/editor.js:13 772 818 msgid "Show collected labels (advice)" 773 819 msgstr "" 774 820 775 #: build/editor.js:9 776 #: src/editor/components/Inspector.js:505 821 #: build/editor.js:13 777 822 msgid "Show the given answers" 778 823 msgstr "" 779 824 780 #: build/editor.js:9 781 #: src/editor/components/Inspector.js:511 825 #: build/editor.js:13 782 826 msgid "Default result" 783 827 msgstr "" 784 828 785 #: build/editor.js:9 786 #: src/editor/components/Inspector.js:514 829 #: build/editor.js:13 787 830 msgid "Shown when the score matches no range. There is always exactly one default result." 788 831 msgstr "" 789 832 790 #: build/editor.js:9 791 #: src/editor/components/Inspector.js:518 833 #: build/editor.js:13 792 834 msgid "Answers without a line lead here. There is always exactly one default result." 793 835 msgstr "" 794 836 795 #: build/editor.js:9 796 #: src/editor/components/Inspector.js:557 837 #: build/editor.js:13 797 838 msgid "Duplicate" 798 839 msgstr "" 799 840 800 #: build/editor.js:9 801 #: src/editor/components/Inspector.js:565 841 #: build/editor.js:13 802 842 msgid "Delete" 803 843 msgstr "" 804 844 805 #: build/editor.js:9 806 #: src/editor/components/Inspector.js:537 845 #: build/editor.js:13 807 846 msgid "Select a question or result on the canvas to edit it." 808 847 msgstr "" 809 848 810 #: build/editor.js:9 811 #: src/editor/components/Inspector.js:579 849 #: build/editor.js:13 812 850 msgid "Every result is an endpoint of the quickscan. Click one to show it on the canvas." 813 851 msgstr "" 814 852 815 #: build/editor.js:10 816 #: src/editor/components/Inspector.js:627 853 #: build/editor.js:14 817 854 msgid "Add result" 818 855 msgstr "" 819 856 820 #: build/editor.js:10 821 #: src/editor/components/Inspector.js:653 857 #: build/editor.js:14 822 858 msgid "Labels are collected along the way. Attach them to answers (for example a product or a piece of advice) and show them on the result." 823 859 msgstr "" 824 860 825 #: build/editor.js:10 826 #: src/editor/components/Inspector.js:664 861 #: build/editor.js:14 827 862 msgid "Colour" 828 863 msgstr "" 829 864 830 #: build/editor.js:10 831 #: src/editor/components/Inspector.js:673 832 #: src/editor/components/Inspector.js:674 865 #: build/editor.js:14 833 866 msgid "Name" 834 867 msgstr "" 835 868 836 #: build/editor.js:10 837 #: src/editor/components/Inspector.js:683 869 #: build/editor.js:14 838 870 msgid "Delete label" 839 871 msgstr "" 840 872 841 #: build/editor.js:10 842 #: src/editor/components/Inspector.js:694 873 #: build/editor.js:14 843 874 msgid "Description" 844 875 msgstr "" 845 876 846 #: build/editor.js:10 847 #: src/editor/components/Inspector.js:695 877 #: build/editor.js:14 848 878 msgid "Description shown on the result (optional)" 849 879 msgstr "" 850 880 851 881 #. translators: %d: number of answers. 852 #: build/editor.js:1 1853 # : src/editor/components/Inspector.js:708882 #: build/editor.js:15 883 #, js-format 854 884 msgid "Used by %d answer" 855 885 msgid_plural "Used by %d answers" … … 857 887 msgstr[1] "" 858 888 859 #: build/editor.js:11 860 #: src/editor/components/Inspector.js:736 889 #: build/editor.js:15 861 890 msgid "Add label" 862 891 msgstr "" 863 892 864 #: build/editor.js:11 865 #: src/editor/components/Inspector.js:747 893 #: build/editor.js:15 866 894 msgid "Flow: lines decide the result" 867 895 msgstr "" 868 896 869 #: build/editor.js:11 870 #: src/editor/components/Inspector.js:748 897 #: build/editor.js:15 871 898 msgid "Score: the total score decides the result" 872 899 msgstr "" 873 900 874 #: build/editor.js:11 875 #: src/editor/components/Inspector.js:753 901 #: build/editor.js:15 876 902 msgid "Type of quickscan" 877 903 msgstr "" 878 904 879 #: build/editor.js:11 880 #: src/editor/components/Inspector.js:762 905 #: build/editor.js:15 881 906 msgid "Every answer gets points and every result a score range. Lines are optional: an answer without a line goes to the next question (left to right on the canvas)." 882 907 msgstr "" 883 908 884 #: build/editor.js:11 885 #: src/editor/components/Inspector.js:766 909 #: build/editor.js:15 886 910 msgid "Every answer leads along a line to a next question or a result. Answers without a line go to the default result." 887 911 msgstr "" 888 912 889 #: build/editor.js:11 890 #: src/editor/components/Inspector.js:774 913 #: build/editor.js:15 891 914 msgid "Show progress bar" 892 915 msgstr "" 893 916 894 #: build/editor.js:11 895 #: src/editor/components/Inspector.js:782 917 #: build/editor.js:15 896 918 msgid "Show back button" 897 919 msgstr "" 898 920 899 #: build/editor.js:11 900 #: src/editor/components/Inspector.js:791 921 #: build/editor.js:15 901 922 msgid "Transition between questions" 902 923 msgstr "" 903 924 904 #: build/editor.js:11 905 #: src/editor/components/Inspector.js:812 925 #: build/editor.js:15 906 926 msgid "More transitions and your own styling are available in FunnelFork Pro." 907 927 msgstr "" 908 928 909 #: build/editor.js:11 910 #: src/editor/components/Inspector.js:821 929 #: build/editor.js:15 911 930 msgid "Embed" 912 931 msgstr "" 913 932 914 #: build/editor.js:11 915 #: src/editor/components/Inspector.js:824 933 #: build/editor.js:15 916 934 msgid "Use the \"FunnelFork quickscan\" block, or paste this shortcode:" 917 935 msgstr "" 918 936 919 #: build/editor.js:11 920 #: src/editor/components/Inspector.js:863 937 #: build/editor.js:15 921 938 msgid "Step" 922 939 msgstr "" 923 940 924 941 #. translators: %d: number of results. 925 #: build/editor.js:1 2926 # : src/editor/components/Inspector.js:868942 #: build/editor.js:16 943 #, js-format 927 944 msgid "Results (%d)" 928 945 msgstr "" 929 946 930 947 #. translators: %d: number of labels. 931 #: build/editor.js:1 2932 # : src/editor/components/Inspector.js:875948 #: build/editor.js:16 949 #, js-format 933 950 msgid "Labels (%d)" 934 951 msgstr "" 935 952 936 #: build/editor.js:12 937 #: src/editor/components/Inspector.js:882 953 #: build/editor.js:16 938 954 msgid "Settings" 939 955 msgstr "" 940 956 957 #: build/editor.js:16 958 msgid "Statistics" 959 msgstr "" 960 941 961 #. translators: %d: number of notes. 942 #: build/editor.js:1 3943 # : src/editor/components/Inspector.js:919962 #: build/editor.js:17 963 #, js-format 944 964 msgid "%d note about this flow" 945 965 msgid_plural "%d notes about this flow" … … 947 967 msgstr[1] "" 948 968 949 #: build/editor.js:13 950 #: src/editor/components/FlowEdge.js:52 951 #: src/editor/components/FlowEdge.js:53 969 #: build/editor.js:17 952 970 msgid "Remove line" 953 971 msgstr "" 954 972 955 #: build/editor.js:13 956 #: src/editor/App.js:131 973 #: build/editor.js:17 957 974 msgid "The quickscan could not be loaded." 958 975 msgstr "" 959 976 960 #: build/editor.js:13 961 #: src/editor/App.js:241 977 #: build/editor.js:17 962 978 msgid "That line would create a loop, so it was not added." 963 979 msgstr "" 964 980 965 #: build/editor.js:13 966 #: src/editor/utils.js:55 981 #: build/editor.js:17 967 982 msgid "New result" 968 983 msgstr "" 969 984 970 #: build/editor.js:13 971 #: src/editor/utils.js:82 985 #: build/editor.js:17 972 986 msgid "Option 1" 973 987 msgstr "" 974 988 975 #: build/editor.js:13 976 #: src/editor/utils.js:88 989 #: build/editor.js:17 977 990 msgid "Option 2" 978 991 msgstr "" 979 992 980 #: build/editor.js:13 981 #: src/editor/App.js:477 993 #: build/editor.js:17 982 994 msgid "Quickscan saved and published." 983 995 msgstr "" 984 996 985 #: build/editor.js:13 986 #: src/editor/App.js:481 997 #: build/editor.js:17 987 998 msgid "Quickscan saved." 988 999 msgstr "" 989 1000 990 #: build/editor.js:13 991 #: src/editor/App.js:487 1001 #: build/editor.js:17 992 1002 msgid "Saving failed." 993 1003 msgstr "" 994 1004 995 1005 #. translators: %s: result title. 996 #: build/editor.js:1 4997 # : src/editor/utils.js:3111006 #: build/editor.js:18 1007 #, js-format 998 1008 msgid "\"%s\" has no score range, so it is never shown." 999 1009 msgstr "" 1000 1010 1001 1011 #. translators: %s: result title. 1002 #: build/editor.js:1 51003 # : src/editor/utils.js:3331012 #: build/editor.js:19 1013 #, js-format 1004 1014 msgid "The minimum score of \"%s\" is higher than its maximum." 1005 1015 msgstr "" 1006 1016 1007 1017 #. translators: 1: result title, 2: other result title. 1008 #: build/editor.js: 161009 # : src/editor/utils.js:3491018 #: build/editor.js:20 1019 #, js-format 1010 1020 msgid "The score ranges of \"%1$s\" and \"%2$s\" overlap; \"%1$s\" wins." 1011 1021 msgstr "" 1012 1022 1013 #: build/editor.js:16 1014 #: src/editor/utils.js:372 1023 #: build/editor.js:20 1015 1024 msgid "No answer has points yet. Select a question to give its answers points." 1016 1025 msgstr "" 1017 1026 1018 1027 #. translators: 1: list of scores, 2: result title. 1019 #: build/editor.js: 171020 # : src/editor/utils.js:4001028 #: build/editor.js:21 1029 #, js-format 1021 1030 msgid "Score %1$s matches no range and goes to the default result \"%2$s\"." 1022 1031 msgstr "" 1023 1032 1024 #: build/editor.js:17 1025 #: src/editor/utils.js:467 1033 #: build/editor.js:21 1026 1034 msgid "A question has no text." 1027 1035 msgstr "" 1028 1036 1029 1037 #. translators: %s: question text. 1030 #: build/editor.js: 181031 # : src/editor/utils.js:4761038 #: build/editor.js:22 1039 #, js-format 1032 1040 msgid "\"%s\" needs at least two answers." 1033 1041 msgstr "" 1034 1042 1035 1043 #. translators: %s: question text. 1036 #: build/editor.js: 191037 # : src/editor/utils.js:4881044 #: build/editor.js:23 1045 #, js-format 1038 1046 msgid "\"%s\" has an answer without text." 1039 1047 msgstr "" 1040 1048 1041 1049 #. translators: 1: number of answers, 2: question text, 3: endpoint title. 1042 #: build/editor.js:2 01043 # : src/editor/utils.js:5091050 #: build/editor.js:24 1051 #, js-format 1044 1052 msgid "%1$d answer(s) of \"%2$s\" have no line and go to the default result \"%3$s\"." 1045 1053 msgstr "" 1046 1054 1047 1055 #. translators: %s: question or result title. 1048 #: build/editor.js:2 11049 # : src/editor/utils.js:5261056 #: build/editor.js:25 1057 #, js-format 1050 1058 msgid "\"%s\" cannot be reached from the start." 1051 1059 msgstr "" 1052 1060 1053 #: build/editor.js:21 1054 #: src/editor/App.js:591 1061 #: build/editor.js:25 1055 1062 msgid "All changes saved" 1056 1063 msgstr "" 1057 1064 1058 #: build/editor.js:21 1059 #: src/editor/App.js:593 1065 #: build/editor.js:25 1060 1066 msgid "Saving…" 1061 1067 msgstr "" 1062 1068 1063 #: build/editor.js:21 1064 #: src/editor/App.js:595 1069 #: build/editor.js:25 1065 1070 msgid "Unsaved changes" 1066 1071 msgstr "" 1067 1072 1068 #: build/editor.js:21 1069 #: src/editor/App.js:605 1070 #: src/editor/App.js:609 1073 #: build/editor.js:25 1071 1074 msgid "Back to all quickscans" 1072 1075 msgstr "" 1073 1076 1074 #: build/editor.js:21 1075 #: src/editor/App.js:617 1076 #: src/editor/App.js:618 1077 #: build/editor.js:25 1077 1078 msgid "Quickscan title" 1078 1079 msgstr "" 1079 1080 1080 #: build/editor.js:21 1081 #: src/editor/App.js:626 1081 #: build/editor.js:25 1082 1082 msgid "Published" 1083 1083 msgstr "" 1084 1084 1085 #: build/editor.js:21 1086 #: src/editor/App.js:627 1085 #: build/editor.js:25 1087 1086 msgid "Draft" 1088 1087 msgstr "" 1089 1088 1090 #: build/editor.js:21 1091 #: src/editor/App.js:644 1089 #: build/editor.js:25 1092 1090 msgid "Switch to draft" 1093 1091 msgstr "" 1094 1092 1095 #: build/editor.js:21 1096 #: src/editor/App.js:653 1093 #: build/editor.js:25 1097 1094 msgid "Fix the errors in the flow first." 1098 1095 msgstr "" 1099 1096 1100 #: build/editor.js:21 1101 #: src/editor/App.js:660 1097 #: build/editor.js:25 1102 1098 msgid "Publish" 1103 1099 msgstr "" 1104 1100 1105 #: build/editor.js:21 1106 #: src/editor/App.js:669 1101 #: build/editor.js:25 1107 1102 msgid "Save" 1108 1103 msgstr "" 1109 1104 1110 #: build/editor.js:21 1111 #: src/editor/App.js:720 1112 #: src/editor/App.js:767 1105 #: build/editor.js:25 1113 1106 msgid "Yes/no question" 1114 1107 msgstr "" 1115 1108 1116 #: build/editor.js:21 1117 #: src/editor/App.js:741 1109 #: build/editor.js:25 1118 1110 msgid "Tidy up" 1119 1111 msgstr "" 1120 1112 1121 #: build/editor.js:21 1122 #: src/editor/App.js:745 1113 #: build/editor.js:25 1123 1114 msgid "Drag from an answer (●) to a question or result to draw a line. Drop on an empty spot to create a new step." 1124 1115 msgstr "" 1125 1116 1126 #: build/editor.js:21 1127 #: src/editor/App.js:762 1117 #: build/editor.js:25 1128 1118 msgid "Add here:" 1129 1119 msgstr "" 1130 1120 1131 #: build/editor.js:21 1132 #: src/editor/App.js:796 1121 #: build/editor.js:25 1133 1122 msgid "Cancel" 1134 1123 msgstr "" 1135 1124 1136 #: build/editor.js:21 1137 #: src/editor/App.js:383 1125 #: build/editor.js:25 1138 1126 msgid "A quickscan needs at least one result." 1139 1127 msgstr "" 1140 1128 1141 1129 #: build/block/block.json 1142 #: src/block/block.json1143 1130 msgctxt "block title" 1144 1131 msgid "FunnelFork quickscan" … … 1146 1133 1147 1134 #: build/block/block.json 1148 #: src/block/block.json1149 1135 msgctxt "block description" 1150 1136 msgid "Shows one of your FunnelFork quickscans." … … 1152 1138 1153 1139 #: build/block/block.json 1154 #: src/block/block.json1155 1140 msgctxt "block keyword" 1156 1141 msgid "quickscan" … … 1158 1143 1159 1144 #: build/block/block.json 1160 #: src/block/block.json1161 1145 msgctxt "block keyword" 1162 1146 msgid "quiz" … … 1164 1148 1165 1149 #: build/block/block.json 1166 #: src/block/block.json1167 1150 msgctxt "block keyword" 1168 1151 msgid "survey" … … 1170 1153 1171 1154 #: build/block/block.json 1172 #: src/block/block.json1173 1155 msgctxt "block keyword" 1174 1156 msgid "flow" -
funnelfork/trunk/package.json
r3764618 r3792829 1 1 { 2 2 "name": "funnelfork", 3 "version": "1. 0.2",3 "version": "1.1.0", 4 4 "private": true, 5 5 "description": "FunnelFork – Visual Quiz Builder for Product Recommendations & Decision Trees", -
funnelfork/trunk/readme.txt
r3781455 r3792829 5 5 Tested up to: 7.1 6 6 Requires PHP: 8.1 7 Stable tag: 1. 0.27 Stable tag: 1.1.0 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Drag & drop quiz builder: draw product recommendation quizzes , decision trees and assessments as a flowchart. Works with WooCommerce.11 Drag & drop quiz builder: draw product recommendation quizzes for WooCommerce, decision trees and assessments as a flowchart. With free statistics. 12 12 13 13 == Description == 14 14 15 FunnelFork lets you build a quiz or quickscan like you draw a flowchart. Add questions, connect each answer to the next question or to a result, and FunnelFork guides your visitors through it, one question per page. No code, no form builder logic to puzzle out: you see the whole funnel on one canvas.15 **Build a quiz like you draw a flowchart.** FunnelFork is a visual quiz builder for WordPress: add questions, connect every answer to the next question or to a result, and see your whole funnel on one canvas. No conditional logic rules to puzzle out, no dead ends: every visitor reaches a result. 16 16 17 **What you can build** 17 Use it for a **product recommendation quiz** in your WooCommerce store, a **decision tree**, an **assessment or scorecard**, a **lead generation quiz** or a **product finder**. Your visitors answer one question per screen and end on a personal result, with advice that fits their answers. 18 18 19 * **Product recommendation quiz for WooCommerce** – "Which product fits me?" Send every shopper to the product that matches their answers, in your WooCommerce store or any other shop. 19 Try it right away with the **Live Preview** button on this page: a ready-made coffee quiz in WordPress Playground, nothing to install. More examples are on [funnelfork.com](https://funnelfork.com/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 20 21 ### What you can build 22 23 * **Product recommendation quiz for WooCommerce** – "Which product fits me?" Send every shopper to the product, category or package that matches their answers. 20 24 * **Assessment or scorecard** – "How ready is your business for…?" Give every answer points and show a result per score range. 21 * **Lead magnet** – a quiz or self-test that visitors actually finish, with a lead form before the first questionin FunnelFork Pro.25 * **Lead generation quiz and lead magnet** – a quiz or self-test that visitors actually finish, with a lead form in FunnelFork Pro. 22 26 * **Price indication or cost estimate** – "What would your new website cost?" Lead visitors to the price range or package that fits. 23 27 * **Decision tree or eligibility check** – "Do I qualify?", "Which option do I need?", troubleshooting and support flows. … … 25 29 * **Advice tool or product finder** – collect labels along the way and show personal advice on the result. 26 30 27 **Features** 31 ### Why FunnelFork 28 32 29 * Visual editor: drag questions and results on a canvas and draw the answer logic with lines. Loops are impossible, so every visitor reaches a result. 30 * Two kinds of quickscans: 33 * **You see the logic.** Every answer is a line on the canvas. You see at a glance where each visitor ends up, and the editor warns you about empty questions, steps nobody can reach and overlapping score ranges. 34 * **Flow mode and score mode, both free.** Let the lines decide the result, like a decision tree, or give every answer points and pick the result by score range. 35 * **No limits.** Unlimited quizzes, questions, results and visitors, also in the free version. 36 * **Fast.** The front end is plain JavaScript without dependencies, and it only loads on pages that show a quiz. It works with page caching. 37 * **Privacy-friendly.** The free plugin stores nothing a visitor answers and sends nothing to external services. The statistics are anonymous counters, without cookies or IP addresses. 38 * **Looks like your site.** Quizzes take over the colours, fonts and buttons of your theme. 39 * **Accessible.** Keyboard-friendly, respects "reduced motion", moves the focus to every new step and announces it to screen readers. 40 41 ### Features 42 43 * Visual drag & drop editor: place questions and results on a canvas and draw the answer logic with lines. Loops are impossible, so every visitor reaches a result. 44 * Two kinds of quizzes: 31 45 * **Flow mode** – the lines decide the result, like a decision tree. 32 46 * **Score mode** – every answer has points and every result a score range (for example 0–10, 11–20, 21 or more). Ideal for assessments and "how do you score?" quizzes. 33 * Unlimited quickscans, questions and results.34 47 * Yes/no questions and multiple choice questions, each with an optional explanation. 35 * Multiple results (endpoints), clearly marked, with one default result for answers without a line or a score outside every range.48 * Multiple results, clearly marked, with one default result for answers without a line or a score outside every range. 36 49 * Labels: attach labels (for example products or pieces of advice) to answers and show the collected labels as personal advice on the result. 37 50 * Optionally show the given answers and the score on the result. 38 51 * An optional start screen, then one question per page that slides smoothly into view, with a back button and a progress bar. 39 * Inherits the colours, fonts and buttons of your theme. 40 * Accessible: respects "reduced motion", moves the focus to every new step and announces it to screen readers. 41 * Block and shortcode: `[funnelfork id="123"]`, so it works in every page builder. 42 * Works with WooCommerce: link every result to a product or category. With FunnelFork Pro you show the WooCommerce product itself on the result, with its price and Add to cart button. 52 * **Statistics:** views, starts, completions and the completion rate of every quiz over the last 30 days, in the overview, in a dashboard widget and in the editor, with a chart per day. Bots and logged-in editors are not counted. 53 * Block and shortcode `[funnelfork id="123"]`, so it works in the block editor and in every page builder (Elementor, Bricks, Divi, Beaver Builder and others). 54 * Works with WooCommerce: link every result to a product or category. 43 55 * Translation-ready. Translations are delivered through [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/funnelfork/). 44 * For developers: JavaScript events (`funnelfork:step`, `funnelfork:answer`, `funnelfork:complete`) for analytics, PHP and JS hooks, and `--funnelfork-*` CSS custom properties.56 * For developers: JavaScript events (`funnelfork:step`, `funnelfork:answer`, `funnelfork:complete`) for your own analytics, PHP and JS hooks, and `--funnelfork-*` CSS custom properties. 45 57 46 **FunnelFork Pro** turns your quickscans into a lead machine: a lead form before the scan, saving responses with CSV export, an email or webhook (Zapier, Make, n8n) for every lead and result, a Gravity Forms form or any shortcode on a result (such as a WooCommerce product with its cart button), images and icons for answers, more transitions and your own styling. [Compare Free and Pro](https://funnelfork.com/pricing/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 58 ### FunnelFork Pro 59 60 Want to know **where visitors leave**, turn them into leads or sell more? [FunnelFork Pro](https://funnelfork.com/pricing/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork) is an add-on with a yearly license and no limit on responses: 61 62 * **WooCommerce product picker** – show the right products on every result as cards with price and an Add to cart button, each with a short "why it fits". 63 * **Funnel statistics** – drop-off per question right on the canvas, how often every answer, result and label is chosen, leads, product clicks and add to cart, for any period and compared with the period before, with CSV export. 64 * **Lead form** before the first question or just before the result, protected against spam bots, and every response saved with CSV export. 65 * **Result by email** to the visitor, with the advice, the score and the recommended products. 66 * **Notifications** by email and **webhook** (Zapier, Make, n8n or your CRM) for every lead and result. 67 * **Redirect** from a result to any page, optionally with the result in the URL. 68 * **GA4, Google Tag Manager and Meta Pixel events** with one switch. 69 * A Gravity Forms form or any shortcode on a result, images and icons for answers, more transitions and your own styling. 70 71 Every Pro license comes with a 30-day money-back guarantee. [Compare Free and Pro](https://funnelfork.com/pricing/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 47 72 48 73 == Installation == 49 74 50 1. Upload the plugin and activate it. 51 2. Go to FunnelFork → Add quickscan. 52 3. Build your flow, press Publish and place the "FunnelFork quickscan" block or the shortcode on a page. 75 1. Go to Plugins → Add New, search for "FunnelFork" and click Install and Activate. Or upload the plugin zip under Plugins → Add New → Upload Plugin. 76 2. Go to FunnelFork → Add quickscan and give your quiz a title. 77 3. Add questions and results, draw a line from every answer to the next step, and press Publish. 78 4. Place the "FunnelFork quickscan" block or the shortcode `[funnelfork id="123"]` on a page. 79 5. Follow the views and completions in the Statistics tab of the editor. 53 80 54 81 == Frequently Asked Questions == 55 82 83 = How do I create a product recommendation quiz in WordPress? = 84 85 Make a result for every product, category or package, add the questions that tell them apart, and draw each answer to the result it points to. With labels you can also collect several products or tips along the way and show them together on the result. Place the quiz with the block or the shortcode, and you are done. 86 87 = Does it work with WooCommerce? = 88 89 Yes. Link every result to the WooCommerce product or category that fits. With FunnelFork Pro you pick the products per result (or a whole category), and shoppers see them as cards with the price and an Add to cart button, right in the quiz. See the [WooCommerce product quiz guide](https://funnelfork.com/blog/woocommerce-product-quiz/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 90 91 = What is the difference between flow mode and score mode? = 92 93 In flow mode the lines decide where a visitor ends up, like a decision tree. In score mode every answer gives points and the total score picks the result; lines are optional and only set the order of the questions. 94 56 95 = What happens with an answer that has no line? = 57 96 58 It leads to the default result. Every qui ckscan has exactly one default result, marked in the editor.97 It leads to the default result. Every quiz has exactly one default result, marked in the editor. In score mode an answer without a line goes to the next question. 59 98 60 99 = Can a flow loop back to an earlier question? = … … 62 101 No. Loops are prevented so that every visitor always reaches a result. 63 102 64 = What is the difference between flow mode and score mode? =103 = Are there limits on quizzes, questions or responses? = 65 104 66 In flow mode the lines decide where a visitor ends up. In score mode every answer gives points and the total score picks the result; lines are optional and only set the order of the questions.105 No. You can make as many quizzes, questions and results as you like, and there is no limit on visitors or responses, in the free version and in Pro. 67 106 68 = Can I build a product recommendation quiz? =107 = Can I see how my quiz performs? = 69 108 70 Yes. Make a result per product or package and draw the answers that fit it to that result. With labels you can also collect several products or tips along the way and show them together on the result. 71 72 = Does it work with WooCommerce? = 73 74 Yes. Build a product quiz and link every result to the WooCommerce product or category that fits. With FunnelFork Pro you can place any shortcode under a result, for example `[product_page id="123"]` or `[add_to_cart id="123"]`, so the shopper sees the product with its price and cart button right on the result. See the [WooCommerce product quiz guide](https://funnelfork.com/blog/woocommerce-product-quiz/?utm_source=wordpress.org&utm_medium=readme&utm_campaign=funnelfork). 109 Yes. The free plugin counts views, starts and completions per quiz and shows the completion rate for the last 30 days. FunnelFork Pro adds funnel statistics: at which question visitors leave, which answers and results they get, leads, product clicks and add to cart, for any period. 75 110 76 111 = Can I collect email addresses or leads? = 77 112 78 The free plugin does not collect personal data. FunnelFork Pro adds a lead form before the first question (name, email, phone), saves every response with CSV export, and sends an email or a webhook (Zapier, Make, n8n) for every lead and result. You can also show a Gravity Forms form on a result. 113 The free plugin does not collect personal data. FunnelFork Pro adds a lead form (name, email, phone, optional consent) before the first question or just before the result, saves every response with CSV export, emails the result to the visitor, and sends an email or a webhook (Zapier, Make, n8n) for every lead and result. 114 115 = Can I send visitors to a page or product after the quiz? = 116 117 In the free plugin you link to a page or product in the text of a result. FunnelFork Pro can redirect visitors from a result straight to any URL, optionally with the result, score and labels in the URL. 118 119 = Does it work with Google Analytics, Tag Manager or the Meta Pixel? = 120 121 Yes. Developers can use the JavaScript events of the free plugin. FunnelFork Pro sends ready-made events (quiz_start, question_view, quiz_complete, generate_lead and add_to_cart) to GA4, Google Tag Manager and the Meta Pixel with one switch, without personal data. 79 122 80 123 = Is it a survey or a form builder? = … … 82 125 FunnelFork is made for guided flows: every visitor answers one question at a time and ends on a personal result. For long surveys with many open questions a form plugin is a better fit; for quizzes, assessments, product finders and decision trees FunnelFork is. 83 126 84 = Does it work with my page builder? =127 = Does it work with my theme and page builder? = 85 128 86 Yes. Use the "FunnelFork quickscan" block in the block editor, or the shortcode `[funnelfork id="123"]` in any page builder (Elementor, Bricks, Divi and so on). 129 Yes. The quiz takes over the colours, fonts and buttons of your theme. Use the "FunnelFork quickscan" block in the block editor, or the shortcode `[funnelfork id="123"]` in any page builder (Elementor, Bricks, Divi and so on). 130 131 = Does it slow down my site? = 132 133 No. The front-end script has no dependencies and only loads on pages that show a quiz, and it works with page caching. 87 134 88 135 = Does FunnelFork store personal data? = 89 136 90 The free plugin does not store or send anything a visitor answers. Saving responses and lead forms are part of FunnelFork Pro, which works with the WordPress privacy export and erase tools. 137 The free plugin does not store or send anything a visitor answers. The statistics are anonymous counters per quiz per day (views, starts, completions), without cookies or IP addresses. Saving responses and lead forms are part of FunnelFork Pro, which works with the WordPress privacy export and erase tools and never stores IP addresses. 138 139 = Is FunnelFork translated? = 140 141 The plugin is translation-ready, and translations are delivered through [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/funnelfork/). Your own questions and results are in the language you write them in. 91 142 92 143 = Can developers react to answers? = 93 144 94 Yes. The `.funnelfork` element fires the `funnelfork:step`, `funnelfork:answer` and `funnelfork:complete` events, for example for Google Analytics or Google Tag Manager. The complete event contains the answers, the collected labels, the score and the endpoint.145 Yes. The `.funnelfork` element fires the `funnelfork:step`, `funnelfork:answer` and `funnelfork:complete` events, for example for your own tracking. The complete event contains the answers, the collected labels, the score and the result. 95 146 96 147 = Where is the source code of the JavaScript? = … … 100 151 == External services == 101 152 102 FunnelFork uses the [Freemius](https://freemius.com/) SDK for the optional opt-in and to offer FunnelFork Pro. Only when you click "Allow & Continue" are the admin's name and email, the site URL and the WordPress, PHP and plugin versions sent to Freemius; "Skip" sends nothing. The Add-ons screen loads FunnelFork Pro details from Freemius, and Pro purchases are handled by Freemius ([Terms](https://freemius.com/terms/), [Privacy Policy](https://freemius.com/privacy/)). Visitor answers a re never sent to an external service.153 FunnelFork uses the [Freemius](https://freemius.com/) SDK for the optional opt-in and to offer FunnelFork Pro. Only when you click "Allow & Continue" are the admin's name and email, the site URL and the WordPress, PHP and plugin versions sent to Freemius; "Skip" sends nothing. The Add-ons screen loads FunnelFork Pro details from Freemius, and Pro purchases are handled by Freemius ([Terms](https://freemius.com/terms/), [Privacy Policy](https://freemius.com/privacy/)). Visitor answers and statistics are never sent to an external service; they stay on your own site. 103 154 104 155 == Screenshots == … … 111 162 6. Score mode: every answer gets points and every result a score range. 112 163 7. The result with the score and personal advice from the labels collected along the way. 164 8. Free statistics: views, starts, completions and the completion rate of every quiz, with a chart per day. 165 9. Funnel statistics: see at which question visitors leave, right on the canvas (FunnelFork Pro). 166 10. WooCommerce product picker: recommended products with price and an Add to cart button on the result (FunnelFork Pro). 167 11. A lead form after the last question, just before the result (FunnelFork Pro). 168 12. The result by email to the visitor, with the recommended products (FunnelFork Pro). 113 169 114 170 == Changelog == 171 172 = 1.1.0 = 173 * New: statistics. Views, starts, completions and the completion rate per quiz for the last 30 days, in the overview, in a dashboard widget and in the new Statistics tab of the editor. Anonymous counters per day; bots and logged-in editors are not counted. 174 * New for developers: the `funnelfork:beforecomplete` event to hold the quiz before a result, and editor filters for the Statistics tab and the canvas. 115 175 116 176 = 1.0.2 = … … 118 178 * Updated short description and tags. 119 179 * Live Preview: try FunnelFork with a ready-made coffee quiz in WordPress Playground, straight from this page. 180 * A friendly request to review FunnelFork, shown once your first quickscan is published. 120 181 121 182 = 1.0.1 = … … 124 185 = 1.0.0 = 125 186 * First release. 187 188 == Upgrade Notice == 189 190 = 1.1.0 = 191 Free statistics: see views, starts and completions of every quiz. Update FunnelFork Pro to 1.2 as well for the funnel statistics and the lead form before the result. -
funnelfork/trunk/src/editor/App.js
r3763298 r3792829 705 705 minZoom={ 0.15 } 706 706 > 707 <Background gap={ 24 } size={ 1.5 } color="#c6d4cf" /> 707 <Background 708 gap={ 24 } 709 size={ 1.5 } 710 color="#c6d4cf" 711 /> 708 712 <Controls showInteractive={ false } /> 709 713 <MiniMap -
funnelfork/trunk/src/editor/components/FlowEdge.js
r3763298 r3792829 3 3 */ 4 4 import { __ } from '@wordpress/i18n'; 5 import { applyFilters } from '@wordpress/hooks'; 5 6 import { 6 7 BaseEdge, … … 20 21 markerEnd, 21 22 selected, 23 source, 24 sourceHandleId, 25 target, 22 26 } ) { 23 27 const { deleteElements } = useReactFlow(); … … 31 35 } ); 32 36 37 // Room for add-ons on the line, for example statistics. 38 const extra = applyFilters( 'funnelfork.editor.edgeLabel', null, { 39 id, 40 source, 41 sourceHandle: sourceHandleId, 42 target, 43 } ); 44 33 45 return ( 34 46 <> 47 { extra && ! selected && ( 48 <EdgeLabelRenderer> 49 <div 50 className="fs-edge-label nodrag nopan" 51 style={ { 52 transform: `translate(-50%, -50%) translate(${ labelX }px, ${ labelY }px)`, 53 } } 54 > 55 { extra } 56 </div> 57 </EdgeLabelRenderer> 58 ) } 35 59 <BaseEdge 36 60 id={ id } -
funnelfork/trunk/src/editor/components/Inspector.js
r3763298 r3792829 4 4 import { __, _n, sprintf } from '@wordpress/i18n'; 5 5 import { applyFilters } from '@wordpress/hooks'; 6 import StatsTab from './Stats'; 6 7 import { 7 8 Button, … … 881 882 }, 882 883 { name: 'settings', title: __( 'Settings', 'funnelfork' ) }, 884 { name: 'stats', title: __( 'Statistics', 'funnelfork' ) }, 883 885 ]; 884 886 … … 902 904 { current.name === 'labels' && ( 903 905 <LabelsTab { ...props } /> 906 ) } 907 { current.name === 'stats' && ( 908 <StatsTab { ...props } /> 904 909 ) } 905 910 { current.name === 'settings' && ( -
funnelfork/trunk/src/editor/components/nodes.js
r3763298 r3792829 4 4 import { createContext, useContext } from '@wordpress/element'; 5 5 import { __, _n, sprintf } from '@wordpress/i18n'; 6 import { applyFilters } from '@wordpress/hooks'; 6 7 import { Handle, Position } from '@xyflow/react'; 8 9 /** 10 * Room for add-ons on a node (`funnelfork.editor.nodeBadge`, props 11 * { id, type }) or an answer (`funnelfork.editor.answerBadge`, props 12 * { nodeId, answerId }), for example statistics. 13 * 14 * @param {Object} props 15 * @param {string} props.filter Filter name. 16 * @param {Object} props.args Filter props. 17 */ 18 function AddonSlot( { filter, args } ) { 19 return applyFilters( filter, null, args ); 20 } 7 21 8 22 import { config, formatRange } from '../utils'; … … 118 132 ) } 119 133 </div> 134 <AddonSlot 135 filter="funnelfork.editor.nodeBadge" 136 args={ { id, type: 'question' } } 137 /> 120 138 <ul className="fs-answers"> 121 139 { data.answers.map( ( answer ) => { … … 129 147 > 130 148 <LabelDots ids={ answer.labels } /> 149 <AddonSlot 150 filter="funnelfork.editor.answerBadge" 151 args={ { nodeId: id, answerId: answer.id } } 152 /> 131 153 <span className="fs-answer__text"> 132 154 { answer.text || ( … … 241 263 ) } 242 264 </div> 265 <AddonSlot 266 filter="funnelfork.editor.nodeBadge" 267 args={ { id, type: 'end' } } 268 /> 243 269 <div className="fs-node__meta"> 244 270 { data.cta?.type && -
funnelfork/trunk/src/editor/editor.scss
r3763298 r3792829 699 699 700 700 .fs-issues-wrap { 701 flex-shrink: 0; // Never squeezed by the tab content (it then showed a tiny scrollbar). 701 702 border-top: 1px solid var(--ff-wire); 702 703 padding: 10px 16px; … … 780 781 } 781 782 } 783 784 /* Statistics tab (components/Stats.js). */ 785 .fs-edge-label { 786 position: absolute; 787 pointer-events: all; 788 } 789 790 .fs-stats__tiles { 791 display: grid; 792 grid-template-columns: repeat(2, 1fr); 793 gap: 8px; 794 } 795 796 .fs-stats__tile { 797 display: flex; 798 flex-direction: column; 799 padding: 10px 12px; 800 border-radius: var(--ff-radius-s); 801 background: var(--ff-board-sunken); 802 } 803 804 .fs-stats__value { 805 font-family: var(--ff-font-display); 806 font-size: 22px; 807 font-weight: 600; 808 line-height: 1.2; 809 color: var(--ff-ink); 810 } 811 812 .fs-stats__label { 813 font-family: var(--ff-font-mono); 814 font-size: 11px; 815 letter-spacing: 0.06em; 816 text-transform: uppercase; 817 color: var(--ff-ink-muted); 818 } 819 820 .fs-stats__chart { 821 margin: 0; 822 823 svg { 824 display: block; 825 width: 100%; 826 height: auto; 827 } 828 } 829 830 .fs-stats__bar.is-views { 831 fill: var(--ff-teal-soft); 832 } 833 834 .fs-stats__bar.is-completes { 835 fill: var(--ff-teal); 836 } 837 838 .fs-stats__legend { 839 display: flex; 840 gap: 12px; 841 margin-top: 4px; 842 font-size: 12px; 843 color: var(--ff-ink-muted); 844 845 span::before { 846 content: ""; 847 display: inline-block; 848 width: 10px; 849 height: 10px; 850 margin-right: 4px; 851 border-radius: 2px; 852 vertical-align: -1px; 853 } 854 855 .is-views::before { 856 background: var(--ff-teal-soft); 857 border: 1px solid var(--ff-wire); 858 } 859 860 .is-completes::before { 861 background: var(--ff-teal); 862 } 863 } 864 865 .fs-stats .components-notice { 866 margin: 0; 867 } 868 869 .fs-stats .fs-inspector__heading { 870 margin: 0; 871 } 872 873 .fs-stats-pro { 874 margin: 0; 875 padding: 14px; 876 border: 1px solid var(--ff-amber); 877 border-radius: var(--ff-radius-m); 878 background: var(--ff-amber-soft); 879 } 880 881 .fs-stats-pro__title { 882 display: flex; 883 gap: 6px; 884 align-items: center; 885 margin: 0 0 6px; 886 font-family: var(--ff-font-display); 887 font-size: 15px; 888 color: var(--ff-ink); 889 } 890 891 .fs-stats-pro__lock { 892 width: 16px; 893 height: 16px; 894 fill: var(--ff-amber-ink); 895 } 896 897 .fs-stats-pro__lead { 898 margin: 0 0 10px; 899 color: var(--ff-ink); 900 } 901 902 .fs-stats-pro__subtitle { 903 margin: 12px 0 6px; 904 font-size: 13px; 905 } 906 907 .fs-stats-pro__list { 908 margin: 0 0 8px; 909 padding: 0; 910 list-style: none; 911 912 li { 913 display: grid; 914 grid-template-columns: minmax(0, 1fr) 70px 34px; 915 gap: 8px; 916 align-items: center; 917 margin-bottom: 6px; 918 font-size: 12px; 919 } 920 } 921 922 .fs-stats-pro__name { 923 overflow: hidden; 924 text-overflow: ellipsis; 925 white-space: nowrap; 926 } 927 928 .fs-stats-pro__bar { 929 height: 8px; 930 overflow: hidden; 931 border-radius: 4px; 932 background: #fff; 933 934 span { 935 display: block; 936 height: 100%; 937 background: var(--ff-amber); 938 filter: blur(1px); 939 } 940 } 941 942 .fs-stats-pro__num { 943 color: var(--ff-amber-ink); 944 filter: blur(3px); 945 user-select: none; 946 } 947 948 .fs-stats-pro__features { 949 margin: 10px 0 12px 1.2em; 950 padding: 0; 951 list-style: disc; 952 font-size: 12px; 953 } -
funnelfork/trunk/src/runner/index.js
r3763298 r3792829 12 12 * funnelfork:beforestart: call event.preventDefault(), show an own step with 13 13 * detail.scan.show( element ) and continue with detail.resume(); 14 * - hold the scan the same way before a result with funnelfork:beforecomplete; 14 15 * - add transitions with FunnelFork.registerTransition( name, fn ). 15 16 * … … 113 114 114 115 this.build(); 116 this.started = false; 117 this.watchView(); 115 118 this.showFirst( 'none' ); 119 } 120 121 /* ---- Statistics (anonymous counters, see includes/class-stats.php) ---- */ 122 123 track( event ) { 124 const url = this.data.track; 125 if ( ! url ) { 126 return; 127 } 128 if ( event === 'view' ) { 129 if ( this.viewed ) { 130 return; 131 } 132 this.viewed = true; 133 } else if ( ! this.viewed ) { 134 this.track( 'view' ); // A start without a counted view (no IntersectionObserver callback yet). 135 } 136 const body = JSON.stringify( { scanId: this.data.id, event } ); 137 try { 138 if ( 139 navigator.sendBeacon?.( 140 url, 141 new Blob( [ body ], { type: 'application/json' } ) 142 ) 143 ) { 144 return; 145 } 146 } catch {} 147 window 148 .fetch( url, { 149 method: 'POST', 150 keepalive: true, 151 headers: { 'Content-Type': 'application/json' }, 152 body, 153 } ) 154 .catch( () => {} ); 155 } 156 157 /** Counts one view per page load, once the scan is (half) in view. */ 158 watchView() { 159 if ( ! this.data.track ) { 160 return; 161 } 162 if ( ! ( 'IntersectionObserver' in window ) ) { 163 this.track( 'view' ); 164 return; 165 } 166 const observer = new window.IntersectionObserver( 167 ( entries ) => { 168 if ( entries.some( ( e ) => e.isIntersecting ) ) { 169 observer.disconnect(); 170 this.track( 'view' ); 171 } 172 }, 173 { threshold: 0.5 } 174 ); 175 observer.observe( this.root ); 116 176 } 117 177 … … 336 396 this.history.push( { nodeId, answerId } ); 337 397 this.emit( 'answer', { questionId: nodeId, answerId } ); 338 this.go( this.step( nodeId, answerId ), 'forward' ); 398 this.goForward( this.step( nodeId, answerId ) ); 399 } 400 401 /** 402 * Goes to the next step. Before a result, an add-on can hold the scan on 403 * funnelfork:beforecomplete (for example for a form); it then shows an own 404 * step with scan.show() and continues with detail.resume(). 405 * @param {string} target Next node ID. 406 */ 407 goForward( target ) { 408 if ( this.data.nodes[ target ]?.type !== 'end' ) { 409 this.go( target, 'forward' ); 410 return; 411 } 412 let resumed = false; 413 const resume = () => { 414 if ( ! resumed ) { 415 resumed = true; 416 this.go( target, 'forward' ); 417 } 418 }; 419 const event = this.emit( 420 'beforecomplete', 421 { 422 endpointId: target, 423 answers: this.answers(), 424 labels: this.collectedLabels(), 425 mode: this.mode, 426 score: this.score(), 427 resume, 428 }, 429 true 430 ); 431 if ( ! event.defaultPrevented ) { 432 resume(); 433 } 339 434 } 340 435 … … 413 508 this.emit( 'step', { nodeId, type: node.type } ); 414 509 510 if ( node.type === 'question' && ! this.started ) { 511 this.started = true; 512 this.track( 'start' ); 513 } 415 514 if ( node.type === 'end' ) { 515 this.track( 'complete' ); 516 this.started = false; // "Start over" counts as a new start. 416 517 this.emit( 'complete', { 417 518 endpointId: nodeId,
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)