@camunda/task-testing 3.0.0-0 → 3.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! For license information please see index.js.LICENSE.txt */
|
|
2
|
-
import*as e from"react";import{Button as t,InlineLoading as n,Link as i,SkeletonPlaceholder as r}from"@carbon/react";import{createPortal as s}from"react-dom";import{CheckmarkFilled as o,CheckmarkOutline as l,ChevronDown as a,ChevronRight as c,Copy as h,Cursor_1 as u,Email as d,Erase as f,ErrorFilled as p,Information as g,Launch as m,PlayFilledAlt as A,Settings as v,StopFilledAlt as b,TaskComplete as x,Warning as y,WarningFilled as w}from"@carbon/icons-react";var C={520(e,t,n){n.d(t,{A:()=>l});var i=n(354),r=n.n(i),s=n(314),o=n.n(s)()(r());o.push([e.id,'.task-testing__container{--color-text-primary: #161616;--color-text-secondary: #525252;--color-text-disabled: #8d8d8d;--color-text-placeholder: hsl(225, 10%, 35%);--color-bg: #fff;--color-bg-light: #f4f4f4;--color-bg-muted: hsl(225, 10%, 95%);--color-border-light: #e0e0e0;--color-border-strong: hsl(225, 10%, 75%);--color-interactive: #0f62fe;--color-info: #0043ce;--color-info-bg: #edf5ff;--color-info-border: #0043ce4d;--color-success: #24a148;--color-success-bg: #defbe6;--color-success-border: #24a1484d;--color-error: #da1e28;--color-error-bg: #fff1f1;--color-error-border: #da1e284d;--color-warning: #f1c21b;--color-warning-bg: #fdf6dd;--color-warning-border: #e0a520;--color-canceled: var(--color-text-secondary);--color-canceled-bg: #f4f4f4;--color-canceled-border: #e0e0e0;display:flex;flex-direction:column;height:100%;width:100%;font-size:14px;container-type:inline-size}.task-testing__container.task-testing__container--empty{align-items:center;justify-content:center;background-color:var(--color-bg-muted)}.task-testing__container.task-testing__container--empty .task-testing__container-no-config,.task-testing__container.task-testing__container--empty .task-testing__container-no-element{display:flex;flex-direction:column;align-items:center;gap:8px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config>svg,.task-testing__container.task-testing__container--empty .task-testing__container-no-element>svg{width:32px;height:32px;color:var(--color-text-placeholder)}.task-testing__container.task-testing__container--empty .task-testing__container-no-config>span,.task-testing__container.task-testing__container--empty .task-testing__container-no-element>span{margin:12px 48px;text-align:center;color:var(--color-text-placeholder);font-size:14px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config .cds--inline-loading,.task-testing__container.task-testing__container--empty .task-testing__container-no-element .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .task-testing-tabs__list{display:flex;border-bottom:1px solid var(--color-border-strong);background:var(--color-bg-muted);flex-shrink:0}.task-testing__container .task-testing-tabs__tab{padding:6px 12px;background:none;border:none;border-bottom:2px solid rgba(0,0,0,0);font-size:14px;font-weight:600;color:var(--color-text-secondary)}.task-testing__container .task-testing-tabs__tab:hover{color:var(--color-text-primary);background-color:var(--color-bg-light);cursor:pointer}.task-testing__container .task-testing-tabs__tab.task-testing-tabs__tab--active{color:var(--color-text-primary);border-bottom-color:var(--color-interactive)}.task-testing__container .task-testing-tabs__tab.task-testing-tabs__tab--disabled{color:var(--color-text-disabled)}.task-testing__container .task-testing-tabs__panel{display:flex;flex-direction:column;flex-grow:1;min-height:0;overflow-y:auto}.task-testing__container .task-testing__container--header{flex-shrink:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:12px;border-bottom:1px solid var(--color-border-light)}.task-testing__container .task-testing__container--header .cds--popover{display:none}.task-testing__container .task-testing__container--header .task-testing__header-status{display:flex;align-items:center;gap:6px;min-width:0;flex:1}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--success{fill:var(--color-success);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--error{fill:var(--color-error);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--canceled{fill:var(--color-canceled);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--terminated{fill:var(--color-warning);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__header-status-text{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .task-testing__container--header .task-testing__header-actions{display:flex;align-items:center;flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-actions-right{display:flex;align-items:center;flex-shrink:0}.task-testing__container .task-testing__container--header .btn-execute{width:140px}.task-testing__container .task-testing__container--header .cds--btn .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .task-testing__container--body{display:flex;flex-direction:column;flex-grow:1;min-height:0;overflow:hidden}.task-testing__container .task-testing__container--body.task-testing__container--body-executing{padding-bottom:12px;overflow-y:auto}.task-testing__container .input{flex-grow:1;display:flex;flex-direction:column;gap:6px;margin:12px 0;padding:0 12px}.task-testing__container .input .input__header{display:flex;justify-content:space-between;align-items:center;gap:6px;width:100%}.task-testing__container .input .input__header--title{color:var(--color-text-secondary);font-weight:600}.task-testing__container .input .input__footer{border-radius:4px;border:1px solid var(--color-info-border);background-color:var(--color-info-bg);color:var(--color-text-primary);padding:12px;display:flex;align-items:flex-start}.task-testing__container .input .input__footer .input__footer--icon{flex-shrink:0;display:flex;align-items:center}.task-testing__container .input .input__footer .input__footer--icon svg{fill:var(--color-info)}.task-testing__container .input .input__footer .input__footer--text{font-size:14px;line-height:18px;margin-left:12px}.task-testing__container .output{flex-grow:1;display:flex;flex-direction:column;gap:12px;min-height:0}.task-testing__container .output .output__banner{display:flex;flex-direction:column;gap:0;font-size:14px;flex-shrink:0;border-radius:4px;margin:12px 12px 0}.task-testing__container .output .output__banner.output__banner--success{background-color:var(--color-success-bg);border:1px solid var(--color-success-border)}.task-testing__container .output .output__banner.output__banner--success .output__banner-icon svg{fill:var(--color-success)}.task-testing__container .output .output__banner.output__banner--error{background-color:var(--color-error-bg);border:1px solid var(--color-error-border)}.task-testing__container .output .output__banner.output__banner--error .output__banner-details-content{margin-top:6px;white-space:pre-wrap;font-family:"IBM Plex Mono",monospace;line-height:18px;width:100%}.task-testing__container .output .output__banner.output__banner--error .output__banner-icon svg{fill:var(--color-error)}.task-testing__container .output .output__banner.output__banner--warning{background-color:var(--color-warning-bg);border:1px solid var(--color-warning-border)}.task-testing__container .output .output__banner.output__banner--warning .output__banner-icon svg{fill:var(--color-warning)}.task-testing__container .output .output__banner.output__banner--canceled{background-color:var(--color-canceled-bg);border:1px solid var(--color-canceled-border)}.task-testing__container .output .output__banner.output__banner--canceled .output__banner-icon svg{fill:var(--color-canceled)}.task-testing__container .output .output__banner.output__banner--executing{background-color:var(--color-info-bg);border:1px solid var(--color-info-border)}.task-testing__container .output .output__banner.output__banner--executing .output__banner-loader{width:auto;min-height:0}.task-testing__container .output .output__banner .output__banner-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px}.task-testing__container .output .output__banner .output__banner-main{display:flex;align-items:center;gap:6px;min-width:0;flex-grow:1}.task-testing__container .output .output__banner .output__banner-chevron{margin-left:auto;flex-shrink:0;fill:currentColor}.task-testing__container .output .output__banner .output__banner-icon{display:flex;flex-shrink:0}.task-testing__container .output .output__banner .output__banner-text{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .output .output__banner .output__banner-timing{color:var(--color-text-secondary);white-space:nowrap;flex-shrink:0;margin-left:auto}.task-testing__container .output .output__banner .output__banner-actions{display:flex;flex-direction:column;gap:4px;padding:0 12px 8px 34px}.task-testing__container .output .output__banner .output__banner-actions .cds--link{font-size:14px;display:flex;align-items:center}.task-testing__container .output .output__banner .output__banner-actions .link--disabled,.task-testing__container .output .output__banner .output__banner-actions .link--disabled:hover{color:var(--color-text-disabled);text-decoration:none}.task-testing__container .output .output__banner .output__banner-details{padding:0 12px 8px 34px}.task-testing__container .output .output__banner .output__banner-details .output__banner-details-content{margin:0;color:var(--color-text-secondary)}.task-testing__container .output .output__banner .output__banner-incident,.task-testing__container .output .output__banner .output__banner-error{display:flex;flex-direction:column;gap:6px;align-items:flex-start}.task-testing__container .output .output__banner .output__banner-incident-heading,.task-testing__container .output .output__banner .output__banner-error-heading{font-weight:600;color:var(--color-text-primary);text-decoration:underline dotted;text-underline-offset:2px}.task-testing__container .output .output__banner .output__banner--error .output__banner-details{font-family:"IBM Plex Mono",monospace;line-height:18px}.task-testing__container .output .output__banner .output__banner-details-row{display:flex;column-gap:8px;line-height:18px}.task-testing__container .output .output__banner .output__banner-details-label{color:var(--color-text-secondary);white-space:nowrap;width:30%;overflow:hidden;text-overflow:ellipsis}.task-testing__container .output .output__banner .output__banner-details-value{color:var(--color-text-primary);font-family:"IBM Plex Mono",monospace;width:70%;white-space:pre-wrap;word-break:break-word}@container (max-width: 380px){.task-testing__container .output .output__banner .output__banner-details-row{flex-wrap:wrap}.task-testing__container .output .output__banner .output__banner-details-label{width:auto}.task-testing__container .output .output__banner .output__banner-details-value{width:auto;overflow:visible;white-space:normal;word-break:break-word}}.task-testing__container .output .output__empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:48px 24px;color:var(--color-text-secondary)}.task-testing__container .output .output__empty-state .output__empty-state-icon{width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;background-color:var(--color-bg-light)}.task-testing__container .output .output__empty-state .output__empty-state-icon svg{width:24px;height:24px}.task-testing__container .output .output__empty-state .output__empty-state-text{text-align:center}.task-testing__container .output .output__body{display:flex;flex-direction:column;padding-bottom:8px}.task-testing__container .output .output__body .cds--tabs{--cds-layout-size-height-local: 32px;display:flex;flex-direction:column;min-height:0}.task-testing__container .output .output__body .cds--tab-content{padding:0}.task-testing__container .output .output__body .cds--tab-content:not([hidden]){display:flex;flex-grow:1;min-height:0}.task-testing__container .output .output__collapsible{border-bottom:1px solid var(--color-border-strong)}.task-testing__container .output .output__collapsible:last-child{border-bottom:none}.task-testing__container .output .output__collapsible-sentinel{height:1px;margin-bottom:-1px;visibility:hidden;pointer-events:none}.task-testing__container .output .output__collapsible-header{display:flex;align-items:center;gap:4px;width:100%;padding:6px 12px;background:var(--color-bg);border:none;border-bottom:1px solid rgba(0,0,0,0);font-size:14px;font-weight:normal;color:var(--color-text-secondary);position:sticky;top:0;z-index:2}.task-testing__container .output .output__collapsible-header.stuck{background:var(--color-bg-muted);border-bottom-color:var(--color-border-strong)}.task-testing__container .output .output__collapsible-header:hover{color:var(--color-text-primary)}.task-testing__container .output .output__collapsible-header svg{flex-shrink:0;fill:currentColor}.task-testing__container .output .output__collapsible-chevron{margin-left:auto}.task-testing__container .output .output__collapsible-title{user-select:none}.task-testing__container .output .output__collapsible-content{padding:0 12px 8px}.task-testing__container .output .output__section-empty{color:var(--color-text-secondary);font-size:14px;padding:4px 0}.task-testing__container .output .output__error{display:flex;flex-direction:column;gap:12px;padding:12px;margin-bottom:12px;border:1px solid var(--color-error);border-left-width:3px;background-color:var(--color-error-bg)}.task-testing__container .output .output__error .output__error--title{display:flex;flex-direction:row;align-items:center;font-weight:bold}.task-testing__container .output .output__error .output__error--title svg{fill:var(--color-error)}.task-testing__container .output .output__error .output__error--title .output__error--action{margin-left:auto}.task-testing__container .output .output__variables--empty{height:32px;display:flex;align-items:center;color:var(--color-text-secondary)}.task-testing__container .output .output__variables--empty-action{font-weight:bold}.task-testing__container .output .output__variables--skeleton .cds--skeleton__placeholder{width:100% !important}.task-testing__container .output code{font-size:14px}.task-testing__container .execution-log{font-size:14px}.task-testing__container .execution-log .execution-log__details{margin:4px 0 0 0}.task-testing__container .execution-log .execution-log__details-row{display:flex;column-gap:8px;line-height:18px}.task-testing__container .execution-log .execution-log__details-label{color:var(--color-text-secondary);white-space:nowrap;width:30%;overflow:hidden;text-overflow:ellipsis}.task-testing__container .execution-log .execution-log__details-value{color:var(--color-text-primary);font-family:"IBM Plex Mono",monospace;width:70%;overflow:hidden;text-overflow:ellipsis}@container (max-width: 380px){.task-testing__container .execution-log .execution-log__details-row{flex-wrap:wrap}.task-testing__container .execution-log .execution-log__details-label{width:auto}.task-testing__container .execution-log .execution-log__details-value{width:auto;overflow:visible;white-space:normal;word-break:break-word}}.task-testing__container .execution-log .execution-log__empty{color:var(--color-text-secondary)}.task-testing__container .execution-log .execution-log__empty-action{font-weight:bold}.task-testing__container .execution-log .execution-log__entries{list-style:none;margin:0;padding:0 0 0 2px;display:flex;flex-direction:column;position:relative}.task-testing__container .execution-log .execution-log__entry-wrapper{display:flex;flex-direction:column;position:relative;padding:0 0 0 20px;margin-bottom:0}.task-testing__container .execution-log .execution-log__entry-wrapper::before{content:"";position:absolute;left:0;top:9px;width:7px;height:7px;border-radius:50%;background-color:var(--color-border-light);z-index:1}.task-testing__container .execution-log .execution-log__entry-wrapper::after{content:"";position:absolute;left:3px;top:20px;bottom:-4px;width:1px;background-color:var(--color-border-light)}.task-testing__container .execution-log .execution-log__entry-wrapper:last-child::after{display:none}.task-testing__container .execution-log .execution-log__entry-wrapper.execution-log__entry-wrapper--active::before{background-color:rgba(0,0,0,0);border:1px solid var(--color-border-strong)}.task-testing__container .execution-log .execution-log__entry-content{padding:4px 8px;border-radius:4px}.task-testing__container .execution-log .execution-log__entry-content:hover{background-color:var(--color-bg-light)}.task-testing__container .execution-log .execution-log__entry{display:flex;align-items:center;gap:8px;color:var(--color-text-secondary);font-size:14px;line-height:18px}.task-testing__container .execution-log .execution-log__entry--expandable:hover{color:var(--color-text-primary)}.task-testing__container .execution-log .execution-log__toggle{display:flex;align-items:center;margin-left:auto}.task-testing__container .execution-log .execution-log__toggle svg{fill:var(--color-text-disabled)}.task-testing__container .execution-log .execution-log__labels{display:flex;flex-direction:column;min-width:0;flex:1}.task-testing__container .execution-log .execution-log__label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .execution-log .execution-log__label-row{display:flex;align-items:center;gap:8px;min-width:0}.task-testing__container .execution-log .execution-log__duration{font-size:11px;color:var(--color-text-disabled);white-space:nowrap;flex-shrink:0}.task-testing__container .execution-log .execution-log__secondary-label{color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:4px;background-color:var(--color-bg-light);padding:2px 4px;font-size:12px;align-self:flex-start;margin-top:2px}.task-testing__container .execution-log .execution-log__cta{margin-top:12px;padding:12px;border:1px solid var(--color-info-border);background-color:var(--color-info-bg);border-radius:4px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-header{display:flex;align-items:center;gap:6px;margin-bottom:6px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-header svg{fill:var(--color-info-border);flex-shrink:0}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-title{font-weight:600;font-size:14px;color:var(--color-text-primary)}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-description{margin:0 0 8px;font-size:14px;color:var(--color-text-secondary);line-height:18px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-link{font-size:14px}.task-testing__container .task-testing-tooltip__wrapper{display:inline-flex;align-items:center;width:fit-content}.task-testing__container .code__editor{position:relative;display:flex;flex-direction:column}.task-testing__container .code__editor.code__editor--error .code__editor-codemirror{border-color:var(--color-error);background-color:var(--color-error-bg)}.task-testing__container .code__editor.code__editor--error .cm-gutter{background-color:var(--color-error-bg)}.task-testing__container .code__editor .code__editor-codemirror{border:1px solid var(--color-border-strong);border-radius:2px;background-color:var(--color-bg-light)}.task-testing__container .code__editor .code__editor-codemirror .cm-scroller{overflow:visible !important}.task-testing__container .code__editor .code__editor-codemirror .cm-content{padding:6px}.task-testing__container .code__editor .code__editor-codemirror .cm-focused{outline:none}.task-testing__container .code__editor .code__editor-codemirror .cm-tooltip{font-size:14px}.task-testing__container .code__editor .code__editor-codemirror .info{padding:6px;font-family:"IBM Plex Mono",monospace;font-size:12px;max-width:300px;word-wrap:break-word}.task-testing__container .code__editor .code__editor-codemirror .info pre{margin-top:8px}.task-testing__container .code__editor .code__editor-error{color:var(--color-error);font-size:14px;margin-top:5px}.task-testing__container .code__editor .code__editor-copy-button,.task-testing__container .code__editor .code__editor-clear-button{position:absolute;top:5px;right:5px;z-index:10;block-size:24px;inline-size:24px;padding-block-start:0;padding-inline-end:0;min-block-size:0;display:flex;justify-content:center;align-items:center}.task-testing__container .code__editor .code__editor-copy-button svg,.task-testing__container .code__editor .code__editor-clear-button svg{fill:var(--color-text-secondary)}.task-testing__container .has-tooltip{text-decoration:underline;text-decoration-style:dotted;text-underline-offset:2px}.task-testing-tooltip{--tooltip-color-bg: hsl(0, 0%, 22%);--tooltip-color-text: #fff;--tooltip-color-link: hsl(218, 100%, 74%);--tooltip-color-code-text: hsl(225, 10%, 35%);--tooltip-color-code-bg: hsl(225, 10%, 97%);--tooltip-color-code-border: hsl(225, 10%, 85%);position:fixed;z-index:1000;max-width:300px;font-size:13px;font-family:"IBM Plex Sans",sans-serif;color:var(--tooltip-color-text)}.task-testing-tooltip .task-testing-tooltip__content{background-color:var(--tooltip-color-bg);color:var(--tooltip-color-text);padding:16px;border-radius:2px;font-size:14px;font-weight:400;white-space:pre-wrap;line-height:21px}.task-testing-tooltip .task-testing-tooltip__content .bio-properties-panel-tooltip-content h1{font-size:14px;font-weight:bold;margin:0}.task-testing-tooltip .task-testing-tooltip__content a{color:var(--tooltip-color-link) !important;text-decoration:underline !important}.task-testing-tooltip .task-testing-tooltip__content code,.task-testing-tooltip .task-testing-tooltip__content pre{color:var(--tooltip-color-code-text);font-family:"IBM Plex Mono",monospace;font-size:13px;line-height:17px;padding:0 2px;background-color:var(--tooltip-color-code-bg);border:1px solid var(--tooltip-color-code-border);border-radius:2px}.task-testing-tooltip .task-testing-tooltip__content pre code{border:none}.task-testing-tooltip .task-testing-tooltip__content p:first-child{margin-top:0}.task-testing-tooltip .task-testing-tooltip__content p:last-child{margin-bottom:0}.task-testing-tooltip .task-testing-tooltip__arrow{position:absolute;width:0;height:0}.task-testing-tooltip.bottom-start,.task-testing-tooltip.bottom-end{padding-top:6px}.task-testing-tooltip.bottom-start .task-testing-tooltip__arrow,.task-testing-tooltip.bottom-end .task-testing-tooltip__arrow{top:1px;left:12px;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-bottom:5px solid var(--tooltip-color-bg)}.task-testing-tooltip.bottom-end .task-testing-tooltip__arrow{left:auto;right:12px}.task-testing-tooltip.top-start,.task-testing-tooltip.top-end{padding-bottom:6px}.task-testing-tooltip.top-start .task-testing-tooltip__arrow,.task-testing-tooltip.top-end .task-testing-tooltip__arrow{bottom:1px;left:12px;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-top:5px solid var(--tooltip-color-bg)}.task-testing-tooltip.top-end .task-testing-tooltip__arrow{left:auto;right:12px}',"",{version:3,sources:["webpack://./lib/style/style.scss"],names:[],mappings:"AAAA,yBAGE,6BAAA,CACA,+BAAA,CACA,8BAAA,CACA,4CAAA,CAGA,gBAAA,CACA,yBAAA,CACA,oCAAA,CAGA,6BAAA,CACA,yCAAA,CAGA,4BAAA,CAGA,qBAAA,CACA,wBAAA,CACA,8BAAA,CAGA,wBAAA,CACA,2BAAA,CACA,iCAAA,CAGA,sBAAA,CACA,yBAAA,CACA,+BAAA,CAGA,wBAAA,CACA,2BAAA,CACA,+BAAA,CAGA,6CAAA,CACA,4BAAA,CACA,gCAAA,CAEA,YAAA,CACA,qBAAA,CACA,WAAA,CACA,UAAA,CACA,cAAA,CACA,0BAAA,CAEA,wDACE,kBAAA,CACA,sBAAA,CACA,sCAAA,CAEA,uLAEE,YAAA,CACA,qBAAA,CACA,kBAAA,CACA,OAAA,CAEA,+LACE,UAAA,CACA,WAAA,CACA,mCAAA,CAGF,iMACE,gBAAA,CACA,iBAAA,CACA,mCAAA,CACA,cAAA,CAGF,iOACE,mBAAA,CACA,sBAAA,CAKN,kDACE,YAAA,CACA,kDAAA,CACA,gCAAA,CACA,aAAA,CAGF,iDACE,gBAAA,CACA,eAAA,CACA,WAAA,CACA,qCAAA,CACA,cAAA,CACA,eAAA,CACA,iCAAA,CAEA,uDACE,+BAAA,CACA,sCAAA,CACA,cAAA,CAGF,gFACE,+BAAA,CACA,4CAAA,CAGF,kFACE,gCAAA,CAIJ,mDACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,YAAA,CACA,eAAA,CAGF,0DACE,aAAA,CACA,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,6BAAA,CACA,QAAA,CACA,UAAA,CACA,YAAA,CACA,iDAAA,CAGA,wEACE,YAAA,CAGF,uFACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CACA,MAAA,CAEA,2HACE,yBAAA,CACA,aAAA,CAGF,yHACE,uBAAA,CACA,aAAA,CAGF,4HACE,0BAAA,CACA,aAAA,CAGF,8HACE,yBAAA,CACA,aAAA,CAGF,yHACE,cAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CAIJ,wFACE,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,8FACE,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,uEACE,WAAA,CAGF,yFACE,mBAAA,CACA,sBAAA,CAIJ,wDACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,YAAA,CACA,eAAA,CAEA,gGACE,mBAAA,CACA,eAAA,CAIJ,gCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,OAAA,CACA,aAAA,CACA,cAAA,CAEA,+CACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CAGF,sDACE,iCAAA,CACA,eAAA,CAGF,+CACE,iBAAA,CACA,yCAAA,CACA,qCAAA,CACA,+BAAA,CACA,YAAA,CACA,YAAA,CACA,sBAAA,CAEA,oEACE,aAAA,CACA,YAAA,CACA,kBAAA,CAEA,wEACE,sBAAA,CAIJ,oEACE,cAAA,CACA,gBAAA,CACA,gBAAA,CAKN,iCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CAEA,iDACE,YAAA,CACA,qBAAA,CACA,KAAA,CACA,cAAA,CACA,aAAA,CACA,iBAAA,CACA,kBAAA,CAEA,yEACE,wCAAA,CACA,4CAAA,CAEA,kGACE,yBAAA,CAIJ,uEACE,sCAAA,CACA,0CAAA,CAEA,uGACE,cAAA,CACA,oBAAA,CACA,qCAAA,CACA,gBAAA,CACA,UAAA,CAGF,gGACE,uBAAA,CAIJ,yEACE,wCAAA,CACA,4CAAA,CAEA,kGACE,yBAAA,CAIJ,0EACE,yCAAA,CACA,6CAAA,CAEA,mGACE,0BAAA,CAIJ,2EACE,qCAAA,CACA,yCAAA,CAEA,kGACE,UAAA,CACA,YAAA,CAIJ,wEACE,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,OAAA,CACA,gBAAA,CAGF,sEACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CACA,WAAA,CAGF,yEACE,gBAAA,CACA,aAAA,CACA,iBAAA,CAGF,sEACE,YAAA,CACA,aAAA,CAGF,sEACE,eAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CAGF,wEACE,iCAAA,CACA,kBAAA,CACA,aAAA,CACA,gBAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CACA,OAAA,CACA,uBAAA,CAEA,oFACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,wLACE,gCAAA,CACA,oBAAA,CAIJ,yEACE,uBAAA,CAEA,yGACE,QAAA,CACA,iCAAA,CAIJ,iJACE,YAAA,CACA,qBAAA,CACA,OAAA,CACA,sBAAA,CAGF,iKACE,eAAA,CACA,+BAAA,CACA,gCAAA,CACA,yBAAA,CAGF,gGACE,qCAAA,CACA,gBAAA,CAGF,6EACE,YAAA,CACA,cAAA,CACA,gBAAA,CAGF,+EACE,iCAAA,CACA,kBAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,+EACE,+BAAA,CACA,qCAAA,CACA,SAAA,CACA,oBAAA,CACA,qBAAA,CAGF,8BACE,6EACE,cAAA,CAGF,+EACE,UAAA,CAGF,+EACE,UAAA,CACA,gBAAA,CACA,kBAAA,CACA,qBAAA,CAAA,CAKN,sDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CACA,sBAAA,CACA,QAAA,CACA,iBAAA,CACA,iCAAA,CAEA,gFACE,UAAA,CACA,WAAA,CACA,iBAAA,CACA,YAAA,CACA,kBAAA,CACA,sBAAA,CACA,sCAAA,CAEA,oFACE,UAAA,CACA,WAAA,CAIJ,gFACE,iBAAA,CAIJ,+CACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAEA,0DACE,oCAAA,CACA,YAAA,CACA,qBAAA,CACA,YAAA,CAGF,iEACE,SAAA,CAGF,+EACE,YAAA,CACA,WAAA,CACA,YAAA,CAIJ,sDACE,kDAAA,CAEA,iEACE,kBAAA,CAIJ,+DACE,UAAA,CACA,kBAAA,CACA,iBAAA,CACA,mBAAA,CAGF,6DACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CACA,gBAAA,CACA,0BAAA,CACA,WAAA,CACA,qCAAA,CACA,cAAA,CACA,kBAAA,CACA,iCAAA,CACA,eAAA,CACA,KAAA,CACA,SAAA,CAEA,mEACE,gCAAA,CACA,8CAAA,CAGF,mEACE,+BAAA,CAGF,iEACE,aAAA,CACA,iBAAA,CAIJ,8DACE,gBAAA,CAGF,4DACE,gBAAA,CAGF,8DACE,kBAAA,CAGF,wDACE,iCAAA,CACA,cAAA,CACA,aAAA,CAGF,gDACE,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CACA,kBAAA,CACA,mCAAA,CACA,qBAAA,CACA,sCAAA,CAEA,sEACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,gBAAA,CAEA,0EACE,uBAAA,CAGF,6FACE,gBAAA,CAKN,2DACE,WAAA,CACA,YAAA,CACA,kBAAA,CACA,iCAAA,CAGF,kEACE,gBAAA,CAGF,0FACE,qBAAA,CAGF,sCACE,cAAA,CAIJ,wCACE,cAAA,CAEA,gEACE,gBAAA,CAGF,oEACE,YAAA,CACA,cAAA,CACA,gBAAA,CAGF,sEACE,iCAAA,CACA,kBAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,sEACE,+BAAA,CACA,qCAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,8BACE,oEACE,cAAA,CAGF,sEACE,UAAA,CAGF,sEACE,UAAA,CACA,gBAAA,CACA,kBAAA,CACA,qBAAA,CAAA,CAIJ,8DACE,iCAAA,CAGF,qEACE,gBAAA,CAGF,gEACE,eAAA,CACA,QAAA,CACA,iBAAA,CACA,YAAA,CACA,qBAAA,CACA,iBAAA,CAGF,sEACE,YAAA,CACA,qBAAA,CACA,iBAAA,CACA,kBAAA,CACA,eAAA,CAGA,8EACE,UAAA,CACA,iBAAA,CACA,MAAA,CACA,OAAA,CACA,SAAA,CACA,UAAA,CACA,iBAAA,CACA,0CAAA,CACA,SAAA,CAIF,6EACE,UAAA,CACA,iBAAA,CACA,QAAA,CACA,QAAA,CACA,WAAA,CACA,SAAA,CACA,0CAAA,CAGF,wFACE,YAAA,CAGF,mHAEE,8BAAA,CACA,2CAAA,CAIJ,sEACE,eAAA,CACA,iBAAA,CAEA,4EACE,sCAAA,CAIJ,8DACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iCAAA,CACA,cAAA,CACA,gBAAA,CAIA,gFACE,+BAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CACA,gBAAA,CAEA,mEACE,+BAAA,CAIJ,+DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,MAAA,CAGF,8DACE,kBAAA,CACA,eAAA,CACA,sBAAA,CAGF,kEACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CAGF,iEACE,cAAA,CACA,gCAAA,CACA,kBAAA,CACA,aAAA,CAGF,wEACE,iCAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CACA,iBAAA,CACA,sCAAA,CACA,eAAA,CACA,cAAA,CACA,qBAAA,CACA,cAAA,CAGF,4DACE,eAAA,CACA,YAAA,CACA,yCAAA,CACA,qCAAA,CACA,iBAAA,CAEA,uFACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iBAAA,CAEA,2FACE,6BAAA,CACA,aAAA,CAIJ,sFACE,eAAA,CACA,cAAA,CACA,+BAAA,CAGF,4FACE,cAAA,CACA,cAAA,CACA,iCAAA,CACA,gBAAA,CAGF,qFACE,cAAA,CAKN,wDACE,mBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,uCACE,iBAAA,CACA,YAAA,CACA,qBAAA,CAGE,oFACE,+BAAA,CACA,sCAAA,CAGF,sEACE,sCAAA,CAIJ,gEACE,2CAAA,CACA,iBAAA,CACA,sCAAA,CAEA,6EACE,2BAAA,CAGF,4EACE,WAAA,CAGF,4EACE,YAAA,CAGF,4EACE,cAAA,CAGF,sEACE,WAAA,CACA,qCAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CAEA,0EACE,cAAA,CAKN,2DACE,wBAAA,CACA,cAAA,CACA,cAAA,CAGF,mIAEE,iBAAA,CACA,OAAA,CACA,SAAA,CACA,UAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,oBAAA,CACA,gBAAA,CACA,YAAA,CACA,sBAAA,CACA,kBAAA,CAEA,2IACE,gCAAA,CAKN,sCACE,yBAAA,CACA,4BAAA,CACA,yBAAA,CAKJ,sBACE,mCAAA,CACA,0BAAA,CACA,yCAAA,CACA,6CAAA,CACA,2CAAA,CACA,+CAAA,CAEA,cAAA,CACA,YAAA,CACA,eAAA,CACA,cAAA,CACA,sCAAA,CACA,+BAAA,CAEA,qDACE,wCAAA,CACA,+BAAA,CACA,YAAA,CACA,iBAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CACA,gBAAA,CAEA,8FACE,cAAA,CACA,gBAAA,CACA,QAAA,CAGF,uDACE,0CAAA,CACA,oCAAA,CAGF,mHACE,oCAAA,CACA,qCAAA,CACA,cAAA,CACA,gBAAA,CACA,aAAA,CACA,6CAAA,CACA,iDAAA,CACA,iBAAA,CAGF,8DACE,WAAA,CAGF,mEACE,YAAA,CAGF,kEACE,eAAA,CAIJ,mDACE,iBAAA,CACA,OAAA,CACA,QAAA,CAIF,oEAEE,eAAA,CAEA,8HACE,OAAA,CACA,SAAA,CACA,mCAAA,CACA,oCAAA,CACA,+CAAA,CAKF,8DACE,SAAA,CACA,UAAA,CAKJ,8DAEE,kBAAA,CAEA,wHACE,UAAA,CACA,SAAA,CACA,mCAAA,CACA,oCAAA,CACA,4CAAA,CAKF,2DACE,SAAA,CACA,UAAA",sourcesContent:[".task-testing__container {\n\n // Text\n --color-text-primary: #161616;\n --color-text-secondary: #525252;\n --color-text-disabled: #8d8d8d;\n --color-text-placeholder: hsl(225, 10%, 35%);\n\n // Backgrounds\n --color-bg: #fff;\n --color-bg-light: #f4f4f4;\n --color-bg-muted: hsl(225, 10%, 95%);\n\n // Borders\n --color-border-light: #e0e0e0;\n --color-border-strong: hsl(225, 10%, 75%);\n\n // Interactive\n --color-interactive: #0f62fe;\n\n // Info\n --color-info: #0043ce;\n --color-info-bg: #edf5ff;\n --color-info-border: #0043ce4d;\n\n // Success\n --color-success: #24a148;\n --color-success-bg: #defbe6;\n --color-success-border: #24a1484d;\n\n // Error\n --color-error: #da1e28;\n --color-error-bg: #fff1f1;\n --color-error-border: #da1e284d;\n\n // Warning\n --color-warning: #f1c21b;\n --color-warning-bg: #fdf6dd;\n --color-warning-border: #e0a520;\n\n // Canceled\n --color-canceled: var(--color-text-secondary);\n --color-canceled-bg: #f4f4f4;\n --color-canceled-border: #e0e0e0;\n\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n font-size: 14px;\n container-type: inline-size;\n\n &.task-testing__container--empty {\n align-items: center;\n justify-content: center;\n background-color: var(--color-bg-muted);\n\n .task-testing__container-no-config,\n .task-testing__container-no-element {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n\n > svg {\n width: 32px;\n height: 32px;\n color: var(--color-text-placeholder);\n }\n\n > span {\n margin: 12px 48px;\n text-align: center;\n color: var(--color-text-placeholder);\n font-size: 14px;\n }\n\n .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n }\n\n .task-testing-tabs__list {\n display: flex;\n border-bottom: 1px solid var(--color-border-strong);\n background: var(--color-bg-muted);\n flex-shrink: 0;\n }\n\n .task-testing-tabs__tab {\n padding: 6px 12px;\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text-secondary);\n\n &:hover {\n color: var(--color-text-primary);\n background-color: var(--color-bg-light);\n cursor: pointer;\n }\n\n &.task-testing-tabs__tab--active {\n color: var(--color-text-primary);\n border-bottom-color: var(--color-interactive);\n }\n\n &.task-testing-tabs__tab--disabled {\n color: var(--color-text-disabled);\n }\n }\n\n .task-testing-tabs__panel {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n overflow-y: auto;\n }\n\n .task-testing__container--header {\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n width: 100%;\n padding: 12px;\n border-bottom: 1px solid var(--color-border-light);\n\n /** Prevent IBM Carbon tooltips for `hasIconOnly` buttons */\n .cds--popover {\n display: none;\n }\n\n .task-testing__header-status {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n flex: 1;\n\n .task-testing__status-icon--success {\n fill: var(--color-success);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--error {\n fill: var(--color-error);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--canceled {\n fill: var(--color-canceled);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--terminated {\n fill: var(--color-warning);\n flex-shrink: 0;\n }\n\n .task-testing__header-status-text {\n font-size: 14px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .task-testing__header-actions {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .task-testing__header-actions-right {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .btn-execute {\n width: 140px;\n }\n\n .cds--btn .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n\n .task-testing__container--body {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n overflow: hidden;\n\n &.task-testing__container--body-executing {\n padding-bottom: 12px;\n overflow-y: auto;\n }\n }\n\n .input {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 12px 0;\n padding: 0 12px;\n\n .input__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 6px;\n width: 100%;\n }\n\n .input__header--title {\n color: var(--color-text-secondary);\n font-weight: 600;\n }\n\n .input__footer {\n border-radius: 4px;\n border: 1px solid var(--color-info-border);\n background-color: var(--color-info-bg);\n color: var(--color-text-primary);\n padding: 12px;\n display: flex;\n align-items: flex-start;\n\n .input__footer--icon {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n\n svg {\n fill: var(--color-info);\n }\n }\n\n .input__footer--text {\n font-size: 14px;\n line-height: 18px;\n margin-left: 12px;\n }\n }\n }\n\n .output {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 12px;\n min-height: 0;\n\n .output__banner {\n display: flex;\n flex-direction: column;\n gap: 0;\n font-size: 14px;\n flex-shrink: 0;\n border-radius: 4px;\n margin: 12px 12px 0;\n\n &.output__banner--success {\n background-color: var(--color-success-bg);\n border: 1px solid var(--color-success-border);\n\n .output__banner-icon svg {\n fill: var(--color-success);\n }\n }\n\n &.output__banner--error {\n background-color: var(--color-error-bg);\n border: 1px solid var(--color-error-border);\n\n .output__banner-details-content {\n margin-top: 6px;\n white-space: pre-wrap;\n font-family: 'IBM Plex Mono', monospace;\n line-height: 18px;\n width: 100%;\n }\n\n .output__banner-icon svg {\n fill: var(--color-error);\n }\n }\n\n &.output__banner--warning {\n background-color: var(--color-warning-bg);\n border: 1px solid var(--color-warning-border);\n\n .output__banner-icon svg {\n fill: var(--color-warning);\n }\n }\n\n &.output__banner--canceled {\n background-color: var(--color-canceled-bg);\n border: 1px solid var(--color-canceled-border);\n\n .output__banner-icon svg {\n fill: var(--color-canceled);\n }\n }\n\n &.output__banner--executing {\n background-color: var(--color-info-bg);\n border: 1px solid var(--color-info-border);\n\n .output__banner-loader {\n width: auto;\n min-height: 0;\n }\n }\n\n .output__banner-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 8px 12px;\n }\n\n .output__banner-main {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n flex-grow: 1;\n }\n\n .output__banner-chevron {\n margin-left: auto;\n flex-shrink: 0;\n fill: currentColor;\n }\n\n .output__banner-icon {\n display: flex;\n flex-shrink: 0;\n }\n\n .output__banner-text {\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .output__banner-timing {\n color: var(--color-text-secondary);\n white-space: nowrap;\n flex-shrink: 0;\n margin-left: auto;\n }\n\n .output__banner-actions {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 0 12px 8px 34px;\n\n .cds--link {\n font-size: 14px;\n display: flex;\n align-items: center;\n }\n\n .link--disabled, .link--disabled:hover {\n color: var(--color-text-disabled);\n text-decoration: none;\n }\n }\n\n .output__banner-details {\n padding: 0 12px 8px 34px;\n\n .output__banner-details-content {\n margin: 0;\n color: var(--color-text-secondary);\n }\n }\n\n .output__banner-incident, .output__banner-error {\n display: flex;\n flex-direction: column;\n gap: 6px;\n align-items: flex-start;\n }\n\n .output__banner-incident-heading, .output__banner-error-heading {\n font-weight: 600;\n color: var(--color-text-primary);\n text-decoration: underline dotted;\n text-underline-offset: 2px;\n }\n\n .output__banner--error .output__banner-details {\n font-family: 'IBM Plex Mono', monospace;\n line-height: 18px;\n }\n\n .output__banner-details-row {\n display: flex;\n column-gap: 8px;\n line-height: 18px;\n }\n\n .output__banner-details-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n width: 30%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .output__banner-details-value {\n color: var(--color-text-primary);\n font-family: 'IBM Plex Mono', monospace;\n width: 70%;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n @container (max-width: 380px) {\n .output__banner-details-row {\n flex-wrap: wrap;\n }\n\n .output__banner-details-label {\n width: auto;\n }\n\n .output__banner-details-value {\n width: auto;\n overflow: visible;\n white-space: normal;\n word-break: break-word;\n }\n }\n }\n\n .output__empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n padding: 48px 24px;\n color: var(--color-text-secondary);\n\n .output__empty-state-icon {\n width: 42px;\n height: 42px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--color-bg-light);\n\n svg {\n width: 24px;\n height: 24px;\n }\n }\n\n .output__empty-state-text {\n text-align: center;\n }\n }\n\n .output__body {\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n\n .cds--tabs {\n --cds-layout-size-height-local: 32px;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n \n .cds--tab-content {\n padding: 0;\n }\n\n .cds--tab-content:not([hidden]) {\n display: flex;\n flex-grow: 1;\n min-height: 0;\n }\n }\n\n .output__collapsible {\n border-bottom: 1px solid var(--color-border-strong);\n\n &:last-child {\n border-bottom: none;\n }\n }\n\n .output__collapsible-sentinel {\n height: 1px;\n margin-bottom: -1px;\n visibility: hidden;\n pointer-events: none;\n }\n\n .output__collapsible-header {\n display: flex;\n align-items: center;\n gap: 4px;\n width: 100%;\n padding: 6px 12px;\n background: var(--color-bg);\n border: none;\n border-bottom: 1px solid transparent;\n font-size: 14px;\n font-weight: normal;\n color: var(--color-text-secondary);\n position: sticky;\n top: 0;\n z-index: 2;\n\n &.stuck {\n background: var(--color-bg-muted);\n border-bottom-color: var(--color-border-strong);\n }\n\n &:hover {\n color: var(--color-text-primary);\n }\n\n svg {\n flex-shrink: 0;\n fill: currentColor;\n }\n }\n\n .output__collapsible-chevron {\n margin-left: auto;\n }\n\n .output__collapsible-title {\n user-select: none;\n }\n\n .output__collapsible-content {\n padding: 0 12px 8px;\n }\n\n .output__section-empty {\n color: var(--color-text-secondary);\n font-size: 14px;\n padding: 4px 0;\n }\n\n .output__error {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 12px;\n margin-bottom: 12px;\n border: 1px solid var(--color-error);\n border-left-width: 3px;\n background-color: var(--color-error-bg);\n\n .output__error--title {\n display: flex;\n flex-direction: row;\n align-items: center;\n font-weight: bold;\n\n svg {\n fill: var(--color-error);\n }\n\n .output__error--action {\n margin-left: auto;\n }\n }\n }\n\n .output__variables--empty {\n height: 32px;\n display: flex;\n align-items: center;\n color: var(--color-text-secondary);\n }\n\n .output__variables--empty-action {\n font-weight: bold;\n }\n\n .output__variables--skeleton .cds--skeleton__placeholder {\n width: 100% !important;\n }\n\n code {\n font-size: 14px;\n }\n }\n\n .execution-log {\n font-size: 14px;\n\n .execution-log__details {\n margin: 4px 0 0 0;\n }\n\n .execution-log__details-row {\n display: flex;\n column-gap: 8px;\n line-height: 18px;\n }\n\n .execution-log__details-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n width: 30%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .execution-log__details-value {\n color: var(--color-text-primary);\n font-family: 'IBM Plex Mono', monospace;\n width: 70%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n @container (max-width: 380px) {\n .execution-log__details-row {\n flex-wrap: wrap;\n }\n\n .execution-log__details-label {\n width: auto;\n }\n\n .execution-log__details-value {\n width: auto;\n overflow: visible;\n white-space: normal;\n word-break: break-word;\n }\n }\n\n .execution-log__empty {\n color: var(--color-text-secondary);\n }\n\n .execution-log__empty-action {\n font-weight: bold;\n }\n\n .execution-log__entries {\n list-style: none;\n margin: 0;\n padding: 0 0 0 2px;\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n .execution-log__entry-wrapper {\n display: flex;\n flex-direction: column;\n position: relative;\n padding: 0 0 0 20px;\n margin-bottom: 0;\n\n // timeline dot\n &::before {\n content: '';\n position: absolute;\n left: 0;\n top: 9px;\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: var(--color-border-light);\n z-index: 1;\n }\n\n // timeline line\n &::after {\n content: '';\n position: absolute;\n left: 3px;\n top: 20px;\n bottom: -4px;\n width: 1px;\n background-color: var(--color-border-light);\n }\n\n &:last-child::after {\n display: none;\n }\n\n &.execution-log__entry-wrapper--active::before {\n // make it unfilled with a border to indicate active entry\n background-color: transparent;\n border: 1px solid var(--color-border-strong);\n }\n }\n\n .execution-log__entry-content {\n padding: 4px 8px;\n border-radius: 4px;\n\n &:hover {\n background-color: var(--color-bg-light);\n }\n }\n\n .execution-log__entry {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--color-text-secondary);\n font-size: 14px;\n line-height: 18px;\n }\n\n .execution-log__entry--expandable {\n &:hover {\n color: var(--color-text-primary);\n }\n }\n\n .execution-log__toggle {\n display: flex;\n align-items: center;\n margin-left: auto;\n\n svg {\n fill: var(--color-text-disabled);\n }\n }\n\n .execution-log__labels {\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: 1;\n }\n\n .execution-log__label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .execution-log__label-row {\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n }\n\n .execution-log__duration {\n font-size: 11px;\n color: var(--color-text-disabled);\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .execution-log__secondary-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n border-radius: 4px;\n background-color: var(--color-bg-light);\n padding: 2px 4px;\n font-size: 12px;\n align-self: flex-start;\n margin-top: 2px;\n }\n\n .execution-log__cta {\n margin-top: 12px;\n padding: 12px;\n border: 1px solid var(--color-info-border);\n background-color: var(--color-info-bg);\n border-radius: 4px;\n\n .execution-log__cta-header {\n display: flex;\n align-items: center;\n gap: 6px;\n margin-bottom: 6px;\n\n svg {\n fill: var(--color-info-border);\n flex-shrink: 0;\n }\n }\n\n .execution-log__cta-title {\n font-weight: 600;\n font-size: 14px;\n color: var(--color-text-primary);\n }\n\n .execution-log__cta-description {\n margin: 0 0 8px;\n font-size: 14px;\n color: var(--color-text-secondary);\n line-height: 18px;\n }\n\n .execution-log__cta-link {\n font-size: 14px;\n }\n }\n }\n\n .task-testing-tooltip__wrapper {\n display: inline-flex;\n align-items: center;\n width: fit-content;\n }\n\n .code__editor {\n position: relative;\n display: flex;\n flex-direction: column;\n\n &.code__editor--error {\n .code__editor-codemirror {\n border-color: var(--color-error);\n background-color: var(--color-error-bg);\n }\n\n .cm-gutter {\n background-color: var(--color-error-bg);\n }\n }\n\n .code__editor-codemirror {\n border: 1px solid var(--color-border-strong);\n border-radius: 2px;\n background-color: var(--color-bg-light);\n\n .cm-scroller {\n overflow: visible !important;\n }\n\n .cm-content {\n padding: 6px;\n }\n\n .cm-focused {\n outline: none;\n }\n\n .cm-tooltip {\n font-size: 14px;\n }\n\n .info {\n padding: 6px;\n font-family: 'IBM Plex Mono', monospace;\n font-size: 12px;\n max-width: 300px;\n word-wrap: break-word;\n\n pre {\n margin-top: 8px;\n }\n }\n }\n\n .code__editor-error {\n color: var(--color-error);\n font-size: 14px;\n margin-top: 5px;\n }\n\n .code__editor-copy-button,\n .code__editor-clear-button {\n position: absolute;\n top: 5px;\n right: 5px;\n z-index: 10;\n block-size: 24px;\n inline-size: 24px;\n padding-block-start: 0;\n padding-inline-end: 0;\n min-block-size: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n\n svg {\n fill: var(--color-text-secondary);\n }\n }\n }\n\n .has-tooltip {\n text-decoration: underline;\n text-decoration-style: dotted;\n text-underline-offset: 2px;\n }\n}\n\n// Tooltip (portaled to document.body)\n.task-testing-tooltip {\n --tooltip-color-bg: hsl(0, 0%, 22%);\n --tooltip-color-text: #fff;\n --tooltip-color-link: hsl(218, 100%, 74%);\n --tooltip-color-code-text: hsl(225, 10%, 35%);\n --tooltip-color-code-bg: hsl(225, 10%, 97%);\n --tooltip-color-code-border: hsl(225, 10%, 85%);\n\n position: fixed;\n z-index: 1000;\n max-width: 300px;\n font-size: 13px;\n font-family: 'IBM Plex Sans', sans-serif;\n color: var(--tooltip-color-text);\n\n .task-testing-tooltip__content {\n background-color: var(--tooltip-color-bg);\n color: var(--tooltip-color-text);\n padding: 16px;\n border-radius: 2px;\n font-size: 14px;\n font-weight: 400;\n white-space: pre-wrap;\n line-height: 21px;\n\n .bio-properties-panel-tooltip-content h1 {\n font-size: 14px;\n font-weight: bold;\n margin: 0;\n }\n\n a {\n color: var(--tooltip-color-link) !important;\n text-decoration: underline !important;\n }\n\n code, pre {\n color: var(--tooltip-color-code-text);\n font-family: 'IBM Plex Mono', monospace;\n font-size: 13px;\n line-height: 17px;\n padding: 0 2px;\n background-color: var(--tooltip-color-code-bg);\n border: 1px solid var(--tooltip-color-code-border);\n border-radius: 2px;\n }\n\n pre code {\n border: none;\n }\n\n p:first-child {\n margin-top: 0;\n }\n\n p:last-child {\n margin-bottom: 0;\n }\n }\n\n .task-testing-tooltip__arrow {\n position: absolute;\n width: 0;\n height: 0;\n }\n\n // bottom-start / bottom-end\n &.bottom-start,\n &.bottom-end {\n padding-top: 6px;\n\n .task-testing-tooltip__arrow {\n top: 1px;\n left: 12px;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-bottom: 5px solid var(--tooltip-color-bg);\n }\n }\n\n &.bottom-end {\n .task-testing-tooltip__arrow {\n left: auto;\n right: 12px;\n }\n }\n\n // top-start / top-end\n &.top-start,\n &.top-end {\n padding-bottom: 6px;\n\n .task-testing-tooltip__arrow {\n bottom: 1px;\n left: 12px;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid var(--tooltip-color-bg);\n }\n }\n\n &.top-end {\n .task-testing-tooltip__arrow {\n left: auto;\n right: 12px;\n }\n }\n}"],sourceRoot:""}]);const l=o},314(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var l=0;l<this.length;l++){var a=this[l][0];null!=a&&(o[a]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},354(e){e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},7(e){var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var r,s,o,c;if(l(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=a(e))>0&&o.length>r&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=o.length,c=h,console&&console.warn&&console.warn(c)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function d(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):p(r,r.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function g(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return a(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var a=s[e];if(void 0===a)return!1;if("function"==typeof a)i(a,this,t);else{var c=a.length,h=p(a,c);for(n=0;n<c;++n)i(h[n],this,t)}return!0},s.prototype.addListener=function(e,t){return c(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return c(this,e,t,!0)},s.prototype.once=function(e,t){return l(t),this.on(e,u(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,u(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,r,s,o;if(l(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},633(e,t,n){var i=n(649);function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=Object.prototype.hasOwnProperty,o=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,l={},a={};function c(e){return!!s.call(a,e)||!s.call(l,e)&&(o.test(e)?a[e]=!0:(l[e]=!0,!1))}function h(e,t,n,i,r,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var u={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){u[e]=new h(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];u[t]=new h(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){u[e]=new h(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){u[e]=new h(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){u[e]=new h(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){u[e]=new h(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){u[e]=new h(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){u[e]=new h(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){u[e]=new h(e,5,!1,e.toLowerCase(),null,!1,!1)});var d=/[\-:]([a-z])/g;function f(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){u[e]=new h(e,1,!1,e.toLowerCase(),null,!1,!1)}),u.xlinkHref=new h("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){u[e]=new h(e,1,!1,e.toLowerCase(),null,!0,!0)});var p={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},g=["Webkit","ms","Moz","O"];Object.keys(p).forEach(function(e){g.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),p[t]=p[e]})});var m=/["'&<>]/;function A(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=m.exec(e);if(t){var n,i="",r=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}r!==n&&(i+=e.substring(r,n)),r=n+1,i+=t}e=r!==n?i+e.substring(r,n):i}return e}var v=/([A-Z])/g,b=/^ms-/,x=Array.isArray;function y(e,t){return{insertionMode:e,selectedValue:t}}var w=new Map;function C(e,t,n){if("object"!=typeof n)throw Error(r(62));for(var i in t=!0,n)if(s.call(n,i)){var o=n[i];if(null!=o&&"boolean"!=typeof o&&""!==o){if(0===i.indexOf("--")){var l=A(i);o=A((""+o).trim())}else{l=i;var a=w.get(l);void 0!==a||(a=A(l.replace(v,"-$1").toLowerCase().replace(b,"-ms-")),w.set(l,a)),l=a,o="number"==typeof o?0===o||s.call(p,i)?""+o:o+"px":A((""+o).trim())}t?(t=!1,e.push(' style="',l,":",o)):e.push(";",l,":",o)}}t||e.push('"')}function k(e,t,n,i){switch(n){case"style":return void C(e,t,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(t=u.hasOwnProperty(n)?u[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!t.acceptsBooleans)return}switch(n=t.attributeName,t.type){case 3:i&&e.push(" ",n,'=""');break;case 4:!0===i?e.push(" ",n,'=""'):!1!==i&&e.push(" ",n,'="',A(i),'"');break;case 5:isNaN(i)||e.push(" ",n,'="',A(i),'"');break;case 6:!isNaN(i)&&1<=i&&e.push(" ",n,'="',A(i),'"');break;default:t.sanitizeURL&&(i=""+i),e.push(" ",n,'="',A(i),'"')}}else if(c(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(t=n.toLowerCase().slice(0,5))&&"aria-"!==t)return}e.push(" ",n,'="',A(i),'"')}}function _(e,t,n){if(null!=t){if(null!=n)throw Error(r(60));if("object"!=typeof t||!("__html"in t))throw Error(r(61));null!=(t=t.__html)&&e.push(""+t)}}function S(e,t,n,i){e.push(O(n));var r,o=n=null;for(r in t)if(s.call(t,r)){var l=t[r];if(null!=l)switch(r){case"children":n=l;break;case"dangerouslySetInnerHTML":o=l;break;default:k(e,i,r,l)}}return e.push(">"),_(e,o,n),"string"==typeof n?(e.push(A(n)),null):n}var E=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,T=new Map;function O(e){var t=T.get(e);if(void 0===t){if(!E.test(e))throw Error(r(65,e));t="<"+e,T.set(e,t)}return t}function M(e,t,n){if(e.push('\x3c!--$?--\x3e<template id="'),null===n)throw Error(r(395));return e.push(n),e.push('"></template>')}var B=/[<\u2028\u2029]/g;function D(e){return JSON.stringify(e).replace(B,function(e){switch(e){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function R(e,t,n,i){return n.generateStaticMarkup?(e.push(A(t)),!1):(""===t?e=i:(i&&e.push("\x3c!-- --\x3e"),e.push(A(t)),e=!0),e)}var I=Object.assign,P=Symbol.for("react.element"),N=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),V=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.scope"),G=Symbol.for("react.debug_trace_mode"),Y=Symbol.for("react.legacy_hidden"),J=Symbol.for("react.default_value"),Q=Symbol.iterator;function X(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case L:return"Fragment";case N:return"Portal";case j:return"Profiler";case F:return"StrictMode";case H:return"Suspense";case q:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case V:return(e.displayName||"Context")+".Consumer";case z:return(e._context.displayName||"Context")+".Provider";case W:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case $:return null!==(t=e.displayName||null)?t:X(e.type)||"Memo";case U:t=e._payload,e=e._init;try{return X(e(t))}catch(e){}}return null}var Z={};function ee(e,t){if(!(e=e.contextTypes))return Z;var n,i={};for(n in e)i[n]=t[n];return i}var te=null;function ne(e,t){if(e!==t){e.context._currentValue2=e.parentValue,e=e.parent;var n=t.parent;if(null===e){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));ne(e,n)}t.context._currentValue2=t.value}}function ie(e){e.context._currentValue2=e.parentValue,null!==(e=e.parent)&&ie(e)}function re(e){var t=e.parent;null!==t&&re(t),e.context._currentValue2=e.value}function se(e,t){if(e.context._currentValue2=e.parentValue,null===(e=e.parent))throw Error(r(402));e.depth===t.depth?ne(e,t):se(e,t)}function oe(e,t){var n=t.parent;if(null===n)throw Error(r(402));e.depth===n.depth?ne(e,n):oe(e,n),t.context._currentValue2=t.value}function le(e){var t=te;t!==e&&(null===t?re(e):null===e?ie(t):t.depth===e.depth?ne(t,e):t.depth>e.depth?se(t,e):oe(t,e),te=e)}var ae={isMounted:function(){return!1},enqueueSetState:function(e,t){null!==(e=e._reactInternals).queue&&e.queue.push(t)},enqueueReplaceState:function(e,t){(e=e._reactInternals).replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function ce(e,t,n,i){var r=void 0!==e.state?e.state:null;e.updater=ae,e.props=n,e.state=r;var s={queue:[],replace:!1};e._reactInternals=s;var o=t.contextType;if(e.context="object"==typeof o&&null!==o?o._currentValue2:i,"function"==typeof(o=t.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:I({},r,o),e.state=r),"function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate&&("function"==typeof e.UNSAFE_componentWillMount||"function"==typeof e.componentWillMount))if(t=e.state,"function"==typeof e.componentWillMount&&e.componentWillMount(),"function"==typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),t!==e.state&&ae.enqueueReplaceState(e,e.state,null),null!==s.queue&&0<s.queue.length)if(t=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===t.length)e.state=t[0];else{for(s=o?t[0]:e.state,r=!0,o=o?1:0;o<t.length;o++){var l=t[o];null!=(l="function"==typeof l?l.call(e,s,n,i):l)&&(r?(r=!1,s=I({},s,l)):I(s,l))}e.state=s}else s.queue=null}var he={id:1,overflow:""};function ue(e,t,n){var i=e.id;e=e.overflow;var r=32-de(i)-1;i&=~(1<<r),n+=1;var s=32-de(t)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-de(t)+r|n<<r|i,overflow:s+e}}return{id:1<<s|n<<r|i,overflow:e}}var de=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(fe(e)/pe|0)|0},fe=Math.log,pe=Math.LN2,ge="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},me=null,Ae=null,ve=null,be=null,xe=!1,ye=!1,we=0,Ce=null,ke=0;function _e(){if(null===me)throw Error(r(321));return me}function Se(){if(0<ke)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Ee(){return null===be?null===ve?(xe=!1,ve=be=Se()):(xe=!0,be=ve):null===be.next?(xe=!1,be=be.next=Se()):(xe=!0,be=be.next),be}function Te(){Ae=me=null,ye=!1,ve=null,ke=0,be=Ce=null}function Oe(e,t){return"function"==typeof t?t(e):t}function Me(e,t,n){if(me=_e(),be=Ee(),xe){var i=be.queue;if(t=i.dispatch,null!==Ce&&void 0!==(n=Ce.get(i))){Ce.delete(i),i=be.memoizedState;do{i=e(i,n.action),n=n.next}while(null!==n);return be.memoizedState=i,[i,t]}return[be.memoizedState,t]}return e=e===Oe?"function"==typeof t?t():t:void 0!==n?n(t):t,be.memoizedState=e,e=(e=be.queue={last:null,dispatch:null}).dispatch=De.bind(null,me,e),[be.memoizedState,e]}function Be(e,t){if(me=_e(),t=void 0===t?null:t,null!==(be=Ee())){var n=be.memoizedState;if(null!==n&&null!==t){var i=n[1];e:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<t.length;r++)if(!ge(t[r],i[r])){i=!1;break e}i=!0}if(i)return n[0]}}return e=e(),be.memoizedState=[e,t],e}function De(e,t,n){if(25<=ke)throw Error(r(301));if(e===me)if(ye=!0,e={action:n,next:null},null===Ce&&(Ce=new Map),void 0===(n=Ce.get(t)))Ce.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function Re(){throw Error(r(394))}function Ie(){}var Pe={readContext:function(e){return e._currentValue2},useContext:function(e){return _e(),e._currentValue2},useMemo:Be,useReducer:Me,useRef:function(e){me=_e();var t=(be=Ee()).memoizedState;return null===t?(e={current:e},be.memoizedState=e):t},useState:function(e){return Me(Oe,e)},useInsertionEffect:Ie,useLayoutEffect:function(){},useCallback:function(e,t){return Be(function(){return e},t)},useImperativeHandle:Ie,useEffect:Ie,useDebugValue:Ie,useDeferredValue:function(e){return _e(),e},useTransition:function(){return _e(),[!1,Re]},useId:function(){var e=Ae.treeContext,t=e.overflow;e=((e=e.id)&~(1<<32-de(e)-1)).toString(32)+t;var n=Ne;if(null===n)throw Error(r(404));return t=we++,e=":"+n.idPrefix+"R"+e,0<t&&(e+="H"+t.toString(32)),e+":"},useMutableSource:function(e,t){return _e(),t(e._source)},useSyncExternalStore:function(e,t,n){if(void 0===n)throw Error(r(407));return n()}},Ne=null,Le=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function Fe(e){return console.error(e),null}function je(){}function ze(e,t,n,i,r,s,o,l){e.allPendingTasks++,null===n?e.pendingRootTasks++:n.pendingTasks++;var a={node:t,ping:function(){var t=e.pingedTasks;t.push(a),1===t.length&&tt(e)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function Ve(e,t,n,i,r,s){return{status:0,id:-1,index:t,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function We(e,t){if(null!=(e=e.onError(t))&&"string"!=typeof e)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof e+'" instead');return e}function He(e,t){var n=e.onShellError;n(t),(n=e.onFatalError)(t),null!==e.destination?(e.status=2,e.destination.destroy(t)):(e.status=1,e.fatalError=t)}function qe(e,t,n,i,r){for(me={},Ae=t,we=0,e=n(i,r);ye;)ye=!1,we=0,ke+=1,be=null,e=n(i,r);return Te(),e}function $e(e,t,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=t.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,X(i)||"Unknown",a));i=I({},l,n)}t.legacyContext=i,Ge(e,t,s),t.legacyContext=l}else Ge(e,t,s)}function Ue(e,t){if(e&&e.defaultProps){for(var n in t=I({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function Ke(e,t,n,o,l){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){l=ee(n,t.legacyContext);var a=n.contextType;ce(a=new n(o,"object"==typeof a&&null!==a?a._currentValue2:l),n,o,l),$e(e,t,a,n)}else{l=qe(e,t,n,o,a=ee(n,t.legacyContext));var h=0!==we;if("object"==typeof l&&null!==l&&"function"==typeof l.render&&void 0===l.$$typeof)ce(l,n,o,a),$e(e,t,l,n);else if(h){o=t.treeContext,t.treeContext=ue(o,1,0);try{Ge(e,t,l)}finally{t.treeContext=o}}else Ge(e,t,l)}else{if("string"!=typeof n){switch(n){case Y:case G:case F:case j:case L:case q:return void Ge(e,t,o.children);case K:throw Error(r(343));case H:e:{n=t.blockedBoundary,l=t.blockedSegment,a=o.fallback,o=o.children;var u={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:h=new Set,errorDigest:null},d=Ve(0,l.chunks.length,u,l.formatContext,!1,!1);l.children.push(d),l.lastPushedText=!1;var f=Ve(0,0,null,l.formatContext,!1,!1);f.parentFlushed=!0,t.blockedBoundary=u,t.blockedSegment=f;try{if(Je(e,t,o),e.responseState.generateStaticMarkup||f.lastPushedText&&f.textEmbedded&&f.chunks.push("\x3c!-- --\x3e"),f.status=1,Ze(u,f),0===u.pendingTasks)break e}catch(t){f.status=4,u.forceClientRender=!0,u.errorDigest=We(e,t)}finally{t.blockedBoundary=n,t.blockedSegment=l}t=ze(e,a,n,d,h,t.legacyContext,t.context,t.treeContext),e.pingedTasks.push(t)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case W:if(o=qe(e,t,n.render,o,l),0!==we){n=t.treeContext,t.treeContext=ue(n,1,0);try{Ge(e,t,o)}finally{t.treeContext=n}}else Ge(e,t,o);return;case $:return void Ke(e,t,n=n.type,o=Ue(n,o),l);case z:if(l=o.children,n=n._context,o=o.value,a=n._currentValue2,n._currentValue2=o,te=o={parent:h=te,depth:null===h?0:h.depth+1,context:n,parentValue:a,value:o},t.context=o,Ge(e,t,l),null===(e=te))throw Error(r(403));return o=e.parentValue,e.context._currentValue2=o===J?e.context._defaultValue:o,e=te=e.parent,void(t.context=e);case V:return void Ge(e,t,o=(o=o.children)(n._currentValue2));case U:return void Ke(e,t,n=(l=n._init)(n._payload),o=Ue(n,o),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(a=function(e,t,n,o,l){switch(t){case"select":e.push(O("select"));var a=null,h=null;for(p in n)if(s.call(n,p)){var u=n[p];if(null!=u)switch(p){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;case"defaultValue":case"value":break;default:k(e,o,p,u)}}return e.push(">"),_(e,h,a),a;case"option":h=l.selectedValue,e.push(O("option"));var d=u=null,f=null,p=null;for(a in n)if(s.call(n,a)){var g=n[a];if(null!=g)switch(a){case"children":u=g;break;case"selected":f=g;break;case"dangerouslySetInnerHTML":p=g;break;case"value":d=g;default:k(e,o,a,g)}}if(null!=h)if(n=null!==d?""+d:function(e){var t="";return i.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(u),x(h)){for(o=0;o<h.length;o++)if(""+h[o]===n){e.push(' selected=""');break}}else""+h===n&&e.push(' selected=""');else f&&e.push(' selected=""');return e.push(">"),_(e,p,u),u;case"textarea":for(u in e.push(O("textarea")),p=h=a=null,n)if(s.call(n,u)&&null!=(d=n[u]))switch(u){case"children":p=d;break;case"value":a=d;break;case"defaultValue":h=d;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:k(e,o,u,d)}if(null===a&&null!==h&&(a=h),e.push(">"),null!=p){if(null!=a)throw Error(r(92));if(x(p)&&1<p.length)throw Error(r(93));a=""+p}return"string"==typeof a&&"\n"===a[0]&&e.push("\n"),null!==a&&e.push(A(""+a)),null;case"input":for(h in e.push(O("input")),d=p=u=a=null,n)if(s.call(n,h)&&null!=(f=n[h]))switch(h){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":d=f;break;case"defaultValue":u=f;break;case"checked":p=f;break;case"value":a=f;break;default:k(e,o,h,f)}return null!==p?k(e,o,"checked",p):null!==d&&k(e,o,"checked",d),null!==a?k(e,o,"value",a):null!==u&&k(e,o,"value",u),e.push("/>"),null;case"menuitem":for(var m in e.push(O("menuitem")),n)if(s.call(n,m)&&null!=(a=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:k(e,o,m,a)}return e.push(">"),null;case"title":for(g in e.push(O("title")),a=null,n)if(s.call(n,g)&&null!=(h=n[g]))switch(g){case"children":a=h;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:k(e,o,g,h)}return e.push(">"),a;case"listing":case"pre":for(d in e.push(O(t)),h=a=null,n)if(s.call(n,d)&&null!=(u=n[d]))switch(d){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;default:k(e,o,d,u)}if(e.push(">"),null!=h){if(null!=a)throw Error(r(60));if("object"!=typeof h||!("__html"in h))throw Error(r(61));null!=(n=h.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?e.push("\n",n):e.push(""+n))}return"string"==typeof a&&"\n"===a[0]&&e.push("\n"),a;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var v in e.push(O(t)),n)if(s.call(n,v)&&null!=(a=n[v]))switch(v){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,t));default:k(e,o,v,a)}return e.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return S(e,n,t,o);case"html":return 0===l.insertionMode&&e.push("<!DOCTYPE html>"),S(e,n,t,o);default:if(-1===t.indexOf("-")&&"string"!=typeof n.is)return S(e,n,t,o);for(f in e.push(O(t)),h=a=null,n)if(s.call(n,f)&&null!=(u=n[f]))switch(f){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;case"style":C(e,o,u);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:c(f)&&"function"!=typeof u&&"symbol"!=typeof u&&e.push(" ",f,'="',A(u),'"')}return e.push(">"),_(e,h,a),a}}((l=t.blockedSegment).chunks,n,o,e.responseState,l.formatContext),l.lastPushedText=!1,h=l.formatContext,l.formatContext=function(e,t,n){switch(t){case"select":return y(1,null!=n.value?n.value:n.defaultValue);case"svg":return y(2,null);case"math":return y(3,null);case"foreignObject":return y(1,null);case"table":return y(4,null);case"thead":case"tbody":case"tfoot":return y(5,null);case"colgroup":return y(7,null);case"tr":return y(6,null)}return 4<=e.insertionMode||0===e.insertionMode?y(1,null):e}(h,n,o),Je(e,t,a),l.formatContext=h,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:l.chunks.push("</",n,">")}l.lastPushedText=!1}}function Ge(e,t,n){if(t.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case P:return void Ke(e,t,n.type,n.props,n.ref);case N:throw Error(r(257));case U:var i=n._init;return void Ge(e,t,n=i(n._payload))}if(x(n))return void Ye(e,t,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=Q&&n[Q]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);Ye(e,t,s)}return}throw e=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(n).join(", ")+"}":e))}"string"==typeof n?(i=t.blockedSegment).lastPushedText=R(t.blockedSegment.chunks,n,e.responseState,i.lastPushedText):"number"==typeof n&&((i=t.blockedSegment).lastPushedText=R(t.blockedSegment.chunks,""+n,e.responseState,i.lastPushedText))}function Ye(e,t,n){for(var i=n.length,r=0;r<i;r++){var s=t.treeContext;t.treeContext=ue(s,i,r);try{Je(e,t,n[r])}finally{t.treeContext=s}}}function Je(e,t,n){var i=t.blockedSegment.formatContext,r=t.legacyContext,s=t.context;try{return Ge(e,t,n)}catch(a){if(Te(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,le(s),a;n=a;var o=t.blockedSegment,l=Ve(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,e=ze(e,t.node,t.blockedBoundary,l,t.abortSet,t.legacyContext,t.context,t.treeContext).ping,n.then(e,e),t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,le(s)}}function Qe(e){var t=e.blockedBoundary;(e=e.blockedSegment).status=3,et(this,t,e)}function Xe(e,t,n){var i=e.blockedBoundary;e.blockedSegment.status=3,null===i?(t.allPendingTasks--,2!==t.status&&(t.status=2,null!==t.destination&&t.destination.push(null))):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,e=void 0===n?Error(r(432)):n,i.errorDigest=t.onError(e),i.parentFlushed&&t.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(e){return Xe(e,t,n)}),i.fallbackAbortableTasks.clear(),t.allPendingTasks--,0===t.allPendingTasks&&(i=t.onAllReady)())}function Ze(e,t){if(0===t.chunks.length&&1===t.children.length&&null===t.children[0].boundary){var n=t.children[0];n.id=t.id,n.parentFlushed=!0,1===n.status&&Ze(e,n)}else e.completedSegments.push(t)}function et(e,t,n){if(null===t){if(n.parentFlushed){if(null!==e.completedRootSegment)throw Error(r(389));e.completedRootSegment=n}e.pendingRootTasks--,0===e.pendingRootTasks&&(e.onShellError=je,(t=e.onShellReady)())}else t.pendingTasks--,t.forceClientRender||(0===t.pendingTasks?(n.parentFlushed&&1===n.status&&Ze(t,n),t.parentFlushed&&e.completedBoundaries.push(t),t.fallbackAbortableTasks.forEach(Qe,e),t.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(Ze(t,n),1===t.completedSegments.length&&t.parentFlushed&&e.partialBoundaries.push(t)));e.allPendingTasks--,0===e.allPendingTasks&&(e=e.onAllReady)()}function tt(e){if(2!==e.status){var t=te,n=Le.current;Le.current=Pe;var i=Ne;Ne=e.responseState;try{var r,s=e.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=e,a=o.blockedSegment;if(0===a.status){le(o.context);try{Ge(l,o,o.node),l.responseState.generateStaticMarkup||a.lastPushedText&&a.textEmbedded&&a.chunks.push("\x3c!-- --\x3e"),o.abortSet.delete(o),a.status=1,et(l,o.blockedBoundary,a)}catch(e){if(Te(),"object"==typeof e&&null!==e&&"function"==typeof e.then){var c=o.ping;e.then(c,c)}else{o.abortSet.delete(o),a.status=4;var h=o.blockedBoundary,u=e,d=We(l,u);null===h?He(l,u):(h.pendingTasks--,h.forceClientRender||(h.forceClientRender=!0,h.errorDigest=d,h.parentFlushed&&l.clientRenderedBoundaries.push(h))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==e.destination&<(e,e.destination)}catch(t){We(e,t),He(e,t)}finally{Ne=i,Le.current=n,n===Pe&&le(t)}}}function nt(e,t,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=e.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,e=e.responseState,t.push('<template id="'),t.push(e.placeholderPrefix),e=i.toString(16),t.push(e),t.push('"></template>');case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var l=0;l<n.length;l++){for(s=n[l];o<s.index;o++)t.push(i[o]);s=it(e,t,s)}for(;o<i.length-1;o++)t.push(i[o]);return o<i.length&&(s=t.push(i[o])),s;default:throw Error(r(390))}}function it(e,t,n){var i=n.boundary;if(null===i)return nt(e,t,n);if(i.parentFlushed=!0,i.forceClientRender)return e.responseState.generateStaticMarkup||(i=i.errorDigest,t.push("\x3c!--$!--\x3e"),t.push("<template"),i&&(t.push(' data-dgst="'),i=A(i),t.push(i),t.push('"')),t.push("></template>")),nt(e,t,n),!!e.responseState.generateStaticMarkup||t.push("\x3c!--/$--\x3e");if(0<i.pendingTasks){i.rootSegmentID=e.nextSegmentId++,0<i.completedSegments.length&&e.partialBoundaries.push(i);var s=e.responseState,o=s.nextSuspenseID++;return s=s.boundaryPrefix+o.toString(16),i=i.id=s,M(t,e.responseState,i),nt(e,t,n),t.push("\x3c!--/$--\x3e")}if(i.byteSize>e.progressiveChunkSize)return i.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(i),M(t,e.responseState,i.id),nt(e,t,n),t.push("\x3c!--/$--\x3e");if(e.responseState.generateStaticMarkup||t.push("\x3c!--$--\x3e"),1!==(n=i.completedSegments).length)throw Error(r(391));return it(e,t,n[0]),!!e.responseState.generateStaticMarkup||t.push("\x3c!--/$--\x3e")}function rt(e,t,n){return function(e,t,n,i){switch(n.insertionMode){case 0:case 1:return e.push('<div hidden id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 2:return e.push('<svg aria-hidden="true" style="display:none" id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 3:return e.push('<math aria-hidden="true" style="display:none" id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 4:return e.push('<table hidden id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 5:return e.push('<table hidden><tbody id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 6:return e.push('<table hidden><tr id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 7:return e.push('<table hidden><colgroup id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');default:throw Error(r(397))}}(t,e.responseState,n.formatContext,n.id),it(e,t,n),function(e,t){switch(t.insertionMode){case 0:case 1:return e.push("</div>");case 2:return e.push("</svg>");case 3:return e.push("</math>");case 4:return e.push("</table>");case 5:return e.push("</tbody></table>");case 6:return e.push("</tr></table>");case 7:return e.push("</colgroup></table>");default:throw Error(r(397))}}(t,n.formatContext)}function st(e,t,n){for(var i=n.completedSegments,s=0;s<i.length;s++)ot(e,t,n,i[s]);if(i.length=0,e=e.responseState,i=n.id,n=n.rootSegmentID,t.push(e.startInlineScript),e.sentCompleteBoundaryFunction?t.push('$RC("'):(e.sentCompleteBoundaryFunction=!0,t.push('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("')),null===i)throw Error(r(395));return n=n.toString(16),t.push(i),t.push('","'),t.push(e.segmentPrefix),t.push(n),t.push('")<\/script>')}function ot(e,t,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return rt(e,t,i)}return rt(e,t,i),e=e.responseState,t.push(e.startInlineScript),e.sentCompleteSegmentFunction?t.push('$RS("'):(e.sentCompleteSegmentFunction=!0,t.push('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("')),t.push(e.segmentPrefix),s=s.toString(16),t.push(s),t.push('","'),t.push(e.placeholderPrefix),t.push(s),t.push('")<\/script>')}function lt(e,t){try{var n=e.completedRootSegment;if(null!==n&&0===e.pendingRootTasks){it(e,t,n),e.completedRootSegment=null;var i=e.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)t.push(i[n]);n<i.length&&t.push(i[n])}var s,o=e.clientRenderedBoundaries;for(s=0;s<o.length;s++){var l=o[s];i=t;var a=e.responseState,c=l.id,h=l.errorDigest,u=l.errorMessage,d=l.errorComponentStack;if(i.push(a.startInlineScript),a.sentClientRenderFunction?i.push('$RX("'):(a.sentClientRenderFunction=!0,i.push('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("')),null===c)throw Error(r(395));if(i.push(c),i.push('"'),h||u||d){i.push(",");var f=D(h||"");i.push(f)}if(u||d){i.push(",");var p=D(u||"");i.push(p)}if(d){i.push(",");var g=D(d);i.push(g)}if(!i.push(")<\/script>"))return e.destination=null,s++,void o.splice(0,s)}o.splice(0,s);var m=e.completedBoundaries;for(s=0;s<m.length;s++)if(!st(e,t,m[s]))return e.destination=null,s++,void m.splice(0,s);m.splice(0,s);var A=e.partialBoundaries;for(s=0;s<A.length;s++){var v=A[s];e:{o=e,l=t;var b=v.completedSegments;for(a=0;a<b.length;a++)if(!ot(o,l,v,b[a])){a++,b.splice(0,a);var x=!1;break e}b.splice(0,a),x=!0}if(!x)return e.destination=null,s++,void A.splice(0,s)}A.splice(0,s);var y=e.completedBoundaries;for(s=0;s<y.length;s++)if(!st(e,t,y[s]))return e.destination=null,s++,void y.splice(0,s);y.splice(0,s)}finally{0===e.allPendingTasks&&0===e.pingedTasks.length&&0===e.clientRenderedBoundaries.length&&0===e.completedBoundaries.length&&t.push(null)}}function at(e,t){try{var n=e.abortableTasks;n.forEach(function(n){return Xe(n,e,t)}),n.clear(),null!==e.destination&<(e,e.destination)}catch(t){We(e,t),He(e,t)}}function ct(){}function ht(e,t,n,i){var s=!1,o=null,l="",a={push:function(e){return null!==e&&(l+=e),!0},destroy:function(e){s=!0,o=e}},c=!1;if(e=function(e,t,n,i,r,s,o){var l=[],a=new Set;return(n=Ve(t={destination:null,responseState:t,progressiveChunkSize:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:a,pingedTasks:l,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?Fe:r,onAllReady:je,onShellReady:void 0===o?je:o,onShellError:je,onFatalError:je},0,null,n,!1,!1)).parentFlushed=!0,e=ze(t,e,null,n,a,Z,null,he),l.push(e),t}(e,function(e,t){return{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:(t=void 0===t?"":t)+"P:",segmentPrefix:t+"S:",boundaryPrefix:t+"B:",idPrefix:t,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:e}}(n,t?t.identifierPrefix:void 0),{insertionMode:1,selectedValue:null},1/0,ct,0,function(){c=!0}),tt(e),at(e,i),1===e.status)e.status=2,a.destroy(e.fatalError);else if(2!==e.status&&null===e.destination){e.destination=a;try{lt(e,a)}catch(t){We(e,t),He(e,t)}}if(s)throw o;if(!c)throw Error(r(426));return l}t.renderToNodeStream=function(){throw Error(r(207))},t.renderToStaticMarkup=function(e,t){return ht(e,t,!0,'The server used "renderToStaticMarkup" which does not support Suspense. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},t.renderToStaticNodeStream=function(){throw Error(r(208))},t.renderToString=function(e,t){return ht(e,t,!1,'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},t.version="18.3.1"},911(e,t,n){var i=n(649);function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=null,o=0;function l(e,t){if(0!==t.length)if(512<t.length)0<o&&(e.enqueue(new Uint8Array(s.buffer,0,o)),s=new Uint8Array(512),o=0),e.enqueue(t);else{var n=s.length-o;n<t.length&&(0===n?e.enqueue(s):(s.set(t.subarray(0,n),o),e.enqueue(s),t=t.subarray(n)),s=new Uint8Array(512),o=0),s.set(t,o),o+=t.length}}function a(e,t){return l(e,t),!0}function c(e){s&&0<o&&(e.enqueue(new Uint8Array(s.buffer,0,o)),s=null,o=0)}var h=new TextEncoder;function u(e){return h.encode(e)}function d(e){return h.encode(e)}function f(e,t){"function"==typeof e.error?e.error(t):e.close()}var p=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},A={};function v(e){return!!p.call(A,e)||!p.call(m,e)&&(g.test(e)?A[e]=!0:(m[e]=!0,!1))}function b(e,t,n,i,r,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){x[e]=new b(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];x[t]=new b(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){x[e]=new b(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){x[e]=new b(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){x[e]=new b(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){x[e]=new b(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){x[e]=new b(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){x[e]=new b(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){x[e]=new b(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function w(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){x[e]=new b(e,1,!1,e.toLowerCase(),null,!1,!1)}),x.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){x[e]=new b(e,1,!1,e.toLowerCase(),null,!0,!0)});var C={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},k=["Webkit","ms","Moz","O"];Object.keys(C).forEach(function(e){k.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),C[t]=C[e]})});var _=/["'&<>]/;function S(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=_.exec(e);if(t){var n,i="",r=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}r!==n&&(i+=e.substring(r,n)),r=n+1,i+=t}e=r!==n?i+e.substring(r,n):i}return e}var E=/([A-Z])/g,T=/^ms-/,O=Array.isArray,M=d("<script>"),B=d("<\/script>"),D=d('<script src="'),R=d('<script type="module" src="'),I=d('" async=""><\/script>'),P=/(<\/|<)(s)(cript)/gi;function N(e,t,n,i){return t+("s"===n?"\\u0073":"\\u0053")+i}function L(e,t){return{insertionMode:e,selectedValue:t}}var F=d("\x3c!-- --\x3e");function j(e,t,n,i){return""===t?i:(i&&e.push(F),e.push(u(S(t))),!0)}var z=new Map,V=d(' style="'),W=d(":"),H=d(";");function q(e,t,n){if("object"!=typeof n)throw Error(r(62));for(var i in t=!0,n)if(p.call(n,i)){var s=n[i];if(null!=s&&"boolean"!=typeof s&&""!==s){if(0===i.indexOf("--")){var o=u(S(i));s=u(S((""+s).trim()))}else{o=i;var l=z.get(o);void 0!==l||(l=d(S(o.replace(E,"-$1").toLowerCase().replace(T,"-ms-"))),z.set(o,l)),o=l,s="number"==typeof s?0===s||p.call(C,i)?u(""+s):u(s+"px"):u(S((""+s).trim()))}t?(t=!1,e.push(V,o,W,s)):e.push(H,o,W,s)}}t||e.push(K)}var $=d(" "),U=d('="'),K=d('"'),G=d('=""');function Y(e,t,n,i){switch(n){case"style":return void q(e,t,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(t=x.hasOwnProperty(n)?x[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!t.acceptsBooleans)return}switch(n=u(t.attributeName),t.type){case 3:i&&e.push($,n,G);break;case 4:!0===i?e.push($,n,G):!1!==i&&e.push($,n,U,u(S(i)),K);break;case 5:isNaN(i)||e.push($,n,U,u(S(i)),K);break;case 6:!isNaN(i)&&1<=i&&e.push($,n,U,u(S(i)),K);break;default:t.sanitizeURL&&(i=""+i),e.push($,n,U,u(S(i)),K)}}else if(v(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(t=n.toLowerCase().slice(0,5))&&"aria-"!==t)return}e.push($,u(n),U,u(S(i)),K)}}var J=d(">"),Q=d("/>");function X(e,t,n){if(null!=t){if(null!=n)throw Error(r(60));if("object"!=typeof t||!("__html"in t))throw Error(r(61));null!=(t=t.__html)&&e.push(u(""+t))}}var Z=d(' selected=""');function ee(e,t,n,i){e.push(re(n));var r,s=n=null;for(r in t)if(p.call(t,r)){var o=t[r];if(null!=o)switch(r){case"children":n=o;break;case"dangerouslySetInnerHTML":s=o;break;default:Y(e,i,r,o)}}return e.push(J),X(e,s,n),"string"==typeof n?(e.push(u(S(n))),null):n}var te=d("\n"),ne=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ie=new Map;function re(e){var t=ie.get(e);if(void 0===t){if(!ne.test(e))throw Error(r(65,e));t=d("<"+e),ie.set(e,t)}return t}var se=d("<!DOCTYPE html>");var oe=d("</"),le=d(">"),ae=d('<template id="'),ce=d('"></template>'),he=d("\x3c!--$--\x3e"),ue=d('\x3c!--$?--\x3e<template id="'),de=d('"></template>'),fe=d("\x3c!--$!--\x3e"),pe=d("\x3c!--/$--\x3e"),ge=d("<template"),me=d('"'),Ae=d(' data-dgst="');d(' data-msg="'),d(' data-stck="');var ve=d("></template>");function be(e,t,n){if(l(e,ue),null===n)throw Error(r(395));return l(e,n),a(e,de)}var xe=d('<div hidden id="'),ye=d('">'),we=d("</div>"),Ce=d('<svg aria-hidden="true" style="display:none" id="'),ke=d('">'),_e=d("</svg>"),Se=d('<math aria-hidden="true" style="display:none" id="'),Ee=d('">'),Te=d("</math>"),Oe=d('<table hidden id="'),Me=d('">'),Be=d("</table>"),De=d('<table hidden><tbody id="'),Re=d('">'),Ie=d("</tbody></table>"),Pe=d('<table hidden><tr id="'),Ne=d('">'),Le=d("</tr></table>"),Fe=d('<table hidden><colgroup id="'),je=d('">'),ze=d("</colgroup></table>"),Ve=d('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),We=d('$RS("'),He=d('","'),qe=d('")<\/script>'),$e=d('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),Ue=d('$RC("'),Ke=d('","'),Ge=d('")<\/script>'),Ye=d('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),Je=d('$RX("'),Qe=d('"'),Xe=d(")<\/script>"),Ze=d(","),et=/[<\u2028\u2029]/g;function tt(e){return JSON.stringify(e).replace(et,function(e){switch(e){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}var nt=Object.assign,it=Symbol.for("react.element"),rt=Symbol.for("react.portal"),st=Symbol.for("react.fragment"),ot=Symbol.for("react.strict_mode"),lt=Symbol.for("react.profiler"),at=Symbol.for("react.provider"),ct=Symbol.for("react.context"),ht=Symbol.for("react.forward_ref"),ut=Symbol.for("react.suspense"),dt=Symbol.for("react.suspense_list"),ft=Symbol.for("react.memo"),pt=Symbol.for("react.lazy"),gt=Symbol.for("react.scope"),mt=Symbol.for("react.debug_trace_mode"),At=Symbol.for("react.legacy_hidden"),vt=Symbol.for("react.default_value"),bt=Symbol.iterator;function xt(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case st:return"Fragment";case rt:return"Portal";case lt:return"Profiler";case ot:return"StrictMode";case ut:return"Suspense";case dt:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ct:return(e.displayName||"Context")+".Consumer";case at:return(e._context.displayName||"Context")+".Provider";case ht:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ft:return null!==(t=e.displayName||null)?t:xt(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return xt(e(t))}catch(e){}}return null}var yt={};function wt(e,t){if(!(e=e.contextTypes))return yt;var n,i={};for(n in e)i[n]=t[n];return i}var Ct=null;function kt(e,t){if(e!==t){e.context._currentValue=e.parentValue,e=e.parent;var n=t.parent;if(null===e){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));kt(e,n)}t.context._currentValue=t.value}}function _t(e){e.context._currentValue=e.parentValue,null!==(e=e.parent)&&_t(e)}function St(e){var t=e.parent;null!==t&&St(t),e.context._currentValue=e.value}function Et(e,t){if(e.context._currentValue=e.parentValue,null===(e=e.parent))throw Error(r(402));e.depth===t.depth?kt(e,t):Et(e,t)}function Tt(e,t){var n=t.parent;if(null===n)throw Error(r(402));e.depth===n.depth?kt(e,n):Tt(e,n),t.context._currentValue=t.value}function Ot(e){var t=Ct;t!==e&&(null===t?St(e):null===e?_t(t):t.depth===e.depth?kt(t,e):t.depth>e.depth?Et(t,e):Tt(t,e),Ct=e)}var Mt={isMounted:function(){return!1},enqueueSetState:function(e,t){null!==(e=e._reactInternals).queue&&e.queue.push(t)},enqueueReplaceState:function(e,t){(e=e._reactInternals).replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function Bt(e,t,n,i){var r=void 0!==e.state?e.state:null;e.updater=Mt,e.props=n,e.state=r;var s={queue:[],replace:!1};e._reactInternals=s;var o=t.contextType;if(e.context="object"==typeof o&&null!==o?o._currentValue:i,"function"==typeof(o=t.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:nt({},r,o),e.state=r),"function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate&&("function"==typeof e.UNSAFE_componentWillMount||"function"==typeof e.componentWillMount))if(t=e.state,"function"==typeof e.componentWillMount&&e.componentWillMount(),"function"==typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),t!==e.state&&Mt.enqueueReplaceState(e,e.state,null),null!==s.queue&&0<s.queue.length)if(t=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===t.length)e.state=t[0];else{for(s=o?t[0]:e.state,r=!0,o=o?1:0;o<t.length;o++){var l=t[o];null!=(l="function"==typeof l?l.call(e,s,n,i):l)&&(r?(r=!1,s=nt({},s,l)):nt(s,l))}e.state=s}else s.queue=null}var Dt={id:1,overflow:""};function Rt(e,t,n){var i=e.id;e=e.overflow;var r=32-It(i)-1;i&=~(1<<r),n+=1;var s=32-It(t)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-It(t)+r|n<<r|i,overflow:s+e}}return{id:1<<s|n<<r|i,overflow:e}}var It=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(Pt(e)/Nt|0)|0},Pt=Math.log,Nt=Math.LN2,Lt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Ft=null,jt=null,zt=null,Vt=null,Wt=!1,Ht=!1,qt=0,$t=null,Ut=0;function Kt(){if(null===Ft)throw Error(r(321));return Ft}function Gt(){if(0<Ut)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Yt(){return null===Vt?null===zt?(Wt=!1,zt=Vt=Gt()):(Wt=!0,Vt=zt):null===Vt.next?(Wt=!1,Vt=Vt.next=Gt()):(Wt=!0,Vt=Vt.next),Vt}function Jt(){jt=Ft=null,Ht=!1,zt=null,Ut=0,Vt=$t=null}function Qt(e,t){return"function"==typeof t?t(e):t}function Xt(e,t,n){if(Ft=Kt(),Vt=Yt(),Wt){var i=Vt.queue;if(t=i.dispatch,null!==$t&&void 0!==(n=$t.get(i))){$t.delete(i),i=Vt.memoizedState;do{i=e(i,n.action),n=n.next}while(null!==n);return Vt.memoizedState=i,[i,t]}return[Vt.memoizedState,t]}return e=e===Qt?"function"==typeof t?t():t:void 0!==n?n(t):t,Vt.memoizedState=e,e=(e=Vt.queue={last:null,dispatch:null}).dispatch=en.bind(null,Ft,e),[Vt.memoizedState,e]}function Zt(e,t){if(Ft=Kt(),t=void 0===t?null:t,null!==(Vt=Yt())){var n=Vt.memoizedState;if(null!==n&&null!==t){var i=n[1];e:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<t.length;r++)if(!Lt(t[r],i[r])){i=!1;break e}i=!0}if(i)return n[0]}}return e=e(),Vt.memoizedState=[e,t],e}function en(e,t,n){if(25<=Ut)throw Error(r(301));if(e===Ft)if(Ht=!0,e={action:n,next:null},null===$t&&($t=new Map),void 0===(n=$t.get(t)))$t.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function tn(){throw Error(r(394))}function nn(){}var rn={readContext:function(e){return e._currentValue},useContext:function(e){return Kt(),e._currentValue},useMemo:Zt,useReducer:Xt,useRef:function(e){Ft=Kt();var t=(Vt=Yt()).memoizedState;return null===t?(e={current:e},Vt.memoizedState=e):t},useState:function(e){return Xt(Qt,e)},useInsertionEffect:nn,useLayoutEffect:function(){},useCallback:function(e,t){return Zt(function(){return e},t)},useImperativeHandle:nn,useEffect:nn,useDebugValue:nn,useDeferredValue:function(e){return Kt(),e},useTransition:function(){return Kt(),[!1,tn]},useId:function(){var e=jt.treeContext,t=e.overflow;e=((e=e.id)&~(1<<32-It(e)-1)).toString(32)+t;var n=sn;if(null===n)throw Error(r(404));return t=qt++,e=":"+n.idPrefix+"R"+e,0<t&&(e+="H"+t.toString(32)),e+":"},useMutableSource:function(e,t){return Kt(),t(e._source)},useSyncExternalStore:function(e,t,n){if(void 0===n)throw Error(r(407));return n()}},sn=null,on=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function ln(e){return console.error(e),null}function an(){}function cn(e,t,n,i,r,s,o,l){e.allPendingTasks++,null===n?e.pendingRootTasks++:n.pendingTasks++;var a={node:t,ping:function(){var t=e.pingedTasks;t.push(a),1===t.length&&kn(e)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function hn(e,t,n,i,r,s){return{status:0,id:-1,index:t,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function un(e,t){if(null!=(e=e.onError(t))&&"string"!=typeof e)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof e+'" instead');return e}function dn(e,t){var n=e.onShellError;n(t),(n=e.onFatalError)(t),null!==e.destination?(e.status=2,f(e.destination,t)):(e.status=1,e.fatalError=t)}function fn(e,t,n,i,r){for(Ft={},jt=t,qt=0,e=n(i,r);Ht;)Ht=!1,qt=0,Ut+=1,Vt=null,e=n(i,r);return Jt(),e}function pn(e,t,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=t.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,xt(i)||"Unknown",a));i=nt({},l,n)}t.legacyContext=i,An(e,t,s),t.legacyContext=l}else An(e,t,s)}function gn(e,t){if(e&&e.defaultProps){for(var n in t=nt({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function mn(e,t,n,s,o){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){o=wt(n,t.legacyContext);var l=n.contextType;Bt(l=new n(s,"object"==typeof l&&null!==l?l._currentValue:o),n,s,o),pn(e,t,l,n)}else{o=fn(e,t,n,s,l=wt(n,t.legacyContext));var a=0!==qt;if("object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof)Bt(o,n,s,l),pn(e,t,o,n);else if(a){s=t.treeContext,t.treeContext=Rt(s,1,0);try{An(e,t,o)}finally{t.treeContext=s}}else An(e,t,o)}else{if("string"!=typeof n){switch(n){case At:case mt:case ot:case lt:case st:case dt:return void An(e,t,s.children);case gt:throw Error(r(343));case ut:e:{n=t.blockedBoundary,o=t.blockedSegment,l=s.fallback,s=s.children;var c={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:a=new Set,errorDigest:null},h=hn(0,o.chunks.length,c,o.formatContext,!1,!1);o.children.push(h),o.lastPushedText=!1;var d=hn(0,0,null,o.formatContext,!1,!1);d.parentFlushed=!0,t.blockedBoundary=c,t.blockedSegment=d;try{if(bn(e,t,s),d.lastPushedText&&d.textEmbedded&&d.chunks.push(F),d.status=1,wn(c,d),0===c.pendingTasks)break e}catch(t){d.status=4,c.forceClientRender=!0,c.errorDigest=un(e,t)}finally{t.blockedBoundary=n,t.blockedSegment=o}t=cn(e,l,n,h,a,t.legacyContext,t.context,t.treeContext),e.pingedTasks.push(t)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case ht:if(s=fn(e,t,n.render,s,o),0!==qt){n=t.treeContext,t.treeContext=Rt(n,1,0);try{An(e,t,s)}finally{t.treeContext=n}}else An(e,t,s);return;case ft:return void mn(e,t,n=n.type,s=gn(n,s),o);case at:if(o=s.children,n=n._context,s=s.value,l=n._currentValue,n._currentValue=s,Ct=s={parent:a=Ct,depth:null===a?0:a.depth+1,context:n,parentValue:l,value:s},t.context=s,An(e,t,o),null===(e=Ct))throw Error(r(403));return s=e.parentValue,e.context._currentValue=s===vt?e.context._defaultValue:s,e=Ct=e.parent,void(t.context=e);case ct:return void An(e,t,s=(s=s.children)(n._currentValue));case pt:return void mn(e,t,n=(o=n._init)(n._payload),s=gn(n,s),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(l=function(e,t,n,s,o){switch(t){case"select":e.push(re("select"));var l=null,a=null;for(f in n)if(p.call(n,f)){var c=n[f];if(null!=c)switch(f){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;case"defaultValue":case"value":break;default:Y(e,s,f,c)}}return e.push(J),X(e,a,l),l;case"option":a=o.selectedValue,e.push(re("option"));var h=c=null,d=null,f=null;for(l in n)if(p.call(n,l)){var g=n[l];if(null!=g)switch(l){case"children":c=g;break;case"selected":d=g;break;case"dangerouslySetInnerHTML":f=g;break;case"value":h=g;default:Y(e,s,l,g)}}if(null!=a)if(n=null!==h?""+h:function(e){var t="";return i.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(c),O(a)){for(s=0;s<a.length;s++)if(""+a[s]===n){e.push(Z);break}}else""+a===n&&e.push(Z);else d&&e.push(Z);return e.push(J),X(e,f,c),c;case"textarea":for(c in e.push(re("textarea")),f=a=l=null,n)if(p.call(n,c)&&null!=(h=n[c]))switch(c){case"children":f=h;break;case"value":l=h;break;case"defaultValue":a=h;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:Y(e,s,c,h)}if(null===l&&null!==a&&(l=a),e.push(J),null!=f){if(null!=l)throw Error(r(92));if(O(f)&&1<f.length)throw Error(r(93));l=""+f}return"string"==typeof l&&"\n"===l[0]&&e.push(te),null!==l&&e.push(u(S(""+l))),null;case"input":for(a in e.push(re("input")),h=f=c=l=null,n)if(p.call(n,a)&&null!=(d=n[a]))switch(a){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":h=d;break;case"defaultValue":c=d;break;case"checked":f=d;break;case"value":l=d;break;default:Y(e,s,a,d)}return null!==f?Y(e,s,"checked",f):null!==h&&Y(e,s,"checked",h),null!==l?Y(e,s,"value",l):null!==c&&Y(e,s,"value",c),e.push(Q),null;case"menuitem":for(var m in e.push(re("menuitem")),n)if(p.call(n,m)&&null!=(l=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:Y(e,s,m,l)}return e.push(J),null;case"title":for(g in e.push(re("title")),l=null,n)if(p.call(n,g)&&null!=(a=n[g]))switch(g){case"children":l=a;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:Y(e,s,g,a)}return e.push(J),l;case"listing":case"pre":for(h in e.push(re(t)),a=l=null,n)if(p.call(n,h)&&null!=(c=n[h]))switch(h){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;default:Y(e,s,h,c)}if(e.push(J),null!=a){if(null!=l)throw Error(r(60));if("object"!=typeof a||!("__html"in a))throw Error(r(61));null!=(n=a.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?e.push(te,u(n)):e.push(u(""+n)))}return"string"==typeof l&&"\n"===l[0]&&e.push(te),l;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var A in e.push(re(t)),n)if(p.call(n,A)&&null!=(l=n[A]))switch(A){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,t));default:Y(e,s,A,l)}return e.push(Q),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return ee(e,n,t,s);case"html":return 0===o.insertionMode&&e.push(se),ee(e,n,t,s);default:if(-1===t.indexOf("-")&&"string"!=typeof n.is)return ee(e,n,t,s);for(d in e.push(re(t)),a=l=null,n)if(p.call(n,d)&&null!=(c=n[d]))switch(d){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;case"style":q(e,s,c);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:v(d)&&"function"!=typeof c&&"symbol"!=typeof c&&e.push($,u(d),U,u(S(c)),K)}return e.push(J),X(e,a,l),l}}((o=t.blockedSegment).chunks,n,s,e.responseState,o.formatContext),o.lastPushedText=!1,a=o.formatContext,o.formatContext=function(e,t,n){switch(t){case"select":return L(1,null!=n.value?n.value:n.defaultValue);case"svg":return L(2,null);case"math":return L(3,null);case"foreignObject":return L(1,null);case"table":return L(4,null);case"thead":case"tbody":case"tfoot":return L(5,null);case"colgroup":return L(7,null);case"tr":return L(6,null)}return 4<=e.insertionMode||0===e.insertionMode?L(1,null):e}(a,n,s),bn(e,t,l),o.formatContext=a,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:o.chunks.push(oe,u(n),le)}o.lastPushedText=!1}}function An(e,t,n){if(t.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case it:return void mn(e,t,n.type,n.props,n.ref);case rt:throw Error(r(257));case pt:var i=n._init;return void An(e,t,n=i(n._payload))}if(O(n))return void vn(e,t,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=bt&&n[bt]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);vn(e,t,s)}return}throw e=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(n).join(", ")+"}":e))}"string"==typeof n?(i=t.blockedSegment).lastPushedText=j(t.blockedSegment.chunks,n,e.responseState,i.lastPushedText):"number"==typeof n&&((i=t.blockedSegment).lastPushedText=j(t.blockedSegment.chunks,""+n,e.responseState,i.lastPushedText))}function vn(e,t,n){for(var i=n.length,r=0;r<i;r++){var s=t.treeContext;t.treeContext=Rt(s,i,r);try{bn(e,t,n[r])}finally{t.treeContext=s}}}function bn(e,t,n){var i=t.blockedSegment.formatContext,r=t.legacyContext,s=t.context;try{return An(e,t,n)}catch(a){if(Jt(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,Ot(s),a;n=a;var o=t.blockedSegment,l=hn(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,e=cn(e,t.node,t.blockedBoundary,l,t.abortSet,t.legacyContext,t.context,t.treeContext).ping,n.then(e,e),t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,Ot(s)}}function xn(e){var t=e.blockedBoundary;(e=e.blockedSegment).status=3,Cn(this,t,e)}function yn(e,t,n){var i=e.blockedBoundary;e.blockedSegment.status=3,null===i?(t.allPendingTasks--,2!==t.status&&(t.status=2,null!==t.destination&&t.destination.close())):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,e=void 0===n?Error(r(432)):n,i.errorDigest=t.onError(e),i.parentFlushed&&t.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(e){return yn(e,t,n)}),i.fallbackAbortableTasks.clear(),t.allPendingTasks--,0===t.allPendingTasks&&(i=t.onAllReady)())}function wn(e,t){if(0===t.chunks.length&&1===t.children.length&&null===t.children[0].boundary){var n=t.children[0];n.id=t.id,n.parentFlushed=!0,1===n.status&&wn(e,n)}else e.completedSegments.push(t)}function Cn(e,t,n){if(null===t){if(n.parentFlushed){if(null!==e.completedRootSegment)throw Error(r(389));e.completedRootSegment=n}e.pendingRootTasks--,0===e.pendingRootTasks&&(e.onShellError=an,(t=e.onShellReady)())}else t.pendingTasks--,t.forceClientRender||(0===t.pendingTasks?(n.parentFlushed&&1===n.status&&wn(t,n),t.parentFlushed&&e.completedBoundaries.push(t),t.fallbackAbortableTasks.forEach(xn,e),t.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(wn(t,n),1===t.completedSegments.length&&t.parentFlushed&&e.partialBoundaries.push(t)));e.allPendingTasks--,0===e.allPendingTasks&&(e=e.onAllReady)()}function kn(e){if(2!==e.status){var t=Ct,n=on.current;on.current=rn;var i=sn;sn=e.responseState;try{var r,s=e.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=e,a=o.blockedSegment;if(0===a.status){Ot(o.context);try{An(l,o,o.node),a.lastPushedText&&a.textEmbedded&&a.chunks.push(F),o.abortSet.delete(o),a.status=1,Cn(l,o.blockedBoundary,a)}catch(e){if(Jt(),"object"==typeof e&&null!==e&&"function"==typeof e.then){var c=o.ping;e.then(c,c)}else{o.abortSet.delete(o),a.status=4;var h=o.blockedBoundary,u=e,d=un(l,u);null===h?dn(l,u):(h.pendingTasks--,h.forceClientRender||(h.forceClientRender=!0,h.errorDigest=d,h.parentFlushed&&l.clientRenderedBoundaries.push(h))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==e.destination&&Mn(e,e.destination)}catch(t){un(e,t),dn(e,t)}finally{sn=i,on.current=n,n===rn&&Ot(t)}}}function _n(e,t,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=e.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,e=e.responseState,l(t,ae),l(t,e.placeholderPrefix),l(t,e=u(i.toString(16))),a(t,ce);case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var c=0;c<n.length;c++){for(s=n[c];o<s.index;o++)l(t,i[o]);s=Sn(e,t,s)}for(;o<i.length-1;o++)l(t,i[o]);return o<i.length&&(s=a(t,i[o])),s;default:throw Error(r(390))}}function Sn(e,t,n){var i=n.boundary;if(null===i)return _n(e,t,n);if(i.parentFlushed=!0,i.forceClientRender)i=i.errorDigest,a(t,fe),l(t,ge),i&&(l(t,Ae),l(t,u(S(i))),l(t,me)),a(t,ve),_n(e,t,n);else if(0<i.pendingTasks){i.rootSegmentID=e.nextSegmentId++,0<i.completedSegments.length&&e.partialBoundaries.push(i);var s=e.responseState,o=s.nextSuspenseID++;s=d(s.boundaryPrefix+o.toString(16)),i=i.id=s,be(t,e.responseState,i),_n(e,t,n)}else if(i.byteSize>e.progressiveChunkSize)i.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(i),be(t,e.responseState,i.id),_n(e,t,n);else{if(a(t,he),1!==(n=i.completedSegments).length)throw Error(r(391));Sn(e,t,n[0])}return a(t,pe)}function En(e,t,n){return function(e,t,n,i){switch(n.insertionMode){case 0:case 1:return l(e,xe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,ye);case 2:return l(e,Ce),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,ke);case 3:return l(e,Se),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Ee);case 4:return l(e,Oe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Me);case 5:return l(e,De),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Re);case 6:return l(e,Pe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Ne);case 7:return l(e,Fe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,je);default:throw Error(r(397))}}(t,e.responseState,n.formatContext,n.id),Sn(e,t,n),function(e,t){switch(t.insertionMode){case 0:case 1:return a(e,we);case 2:return a(e,_e);case 3:return a(e,Te);case 4:return a(e,Be);case 5:return a(e,Ie);case 6:return a(e,Le);case 7:return a(e,ze);default:throw Error(r(397))}}(t,n.formatContext)}function Tn(e,t,n){for(var i=n.completedSegments,s=0;s<i.length;s++)On(e,t,n,i[s]);if(i.length=0,e=e.responseState,i=n.id,n=n.rootSegmentID,l(t,e.startInlineScript),e.sentCompleteBoundaryFunction?l(t,Ue):(e.sentCompleteBoundaryFunction=!0,l(t,$e)),null===i)throw Error(r(395));return n=u(n.toString(16)),l(t,i),l(t,Ke),l(t,e.segmentPrefix),l(t,n),a(t,Ge)}function On(e,t,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return En(e,t,i)}return En(e,t,i),l(t,(e=e.responseState).startInlineScript),e.sentCompleteSegmentFunction?l(t,We):(e.sentCompleteSegmentFunction=!0,l(t,Ve)),l(t,e.segmentPrefix),l(t,s=u(s.toString(16))),l(t,He),l(t,e.placeholderPrefix),l(t,s),a(t,qe)}function Mn(e,t){s=new Uint8Array(512),o=0;try{var n=e.completedRootSegment;if(null!==n&&0===e.pendingRootTasks){Sn(e,t,n),e.completedRootSegment=null;var i=e.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)l(t,i[n]);n<i.length&&a(t,i[n])}var h,d=e.clientRenderedBoundaries;for(h=0;h<d.length;h++){var f=d[h];i=t;var p=e.responseState,g=f.id,m=f.errorDigest,A=f.errorMessage,v=f.errorComponentStack;if(l(i,p.startInlineScript),p.sentClientRenderFunction?l(i,Je):(p.sentClientRenderFunction=!0,l(i,Ye)),null===g)throw Error(r(395));if(l(i,g),l(i,Qe),(m||A||v)&&(l(i,Ze),l(i,u(tt(m||"")))),(A||v)&&(l(i,Ze),l(i,u(tt(A||"")))),v&&(l(i,Ze),l(i,u(tt(v)))),!a(i,Xe))return e.destination=null,h++,void d.splice(0,h)}d.splice(0,h);var b=e.completedBoundaries;for(h=0;h<b.length;h++)if(!Tn(e,t,b[h]))return e.destination=null,h++,void b.splice(0,h);b.splice(0,h),c(t),s=new Uint8Array(512),o=0;var x=e.partialBoundaries;for(h=0;h<x.length;h++){var y=x[h];e:{d=e,f=t;var w=y.completedSegments;for(p=0;p<w.length;p++)if(!On(d,f,y,w[p])){p++,w.splice(0,p);var C=!1;break e}w.splice(0,p),C=!0}if(!C)return e.destination=null,h++,void x.splice(0,h)}x.splice(0,h);var k=e.completedBoundaries;for(h=0;h<k.length;h++)if(!Tn(e,t,k[h]))return e.destination=null,h++,void k.splice(0,h);k.splice(0,h)}finally{c(t),0===e.allPendingTasks&&0===e.pingedTasks.length&&0===e.clientRenderedBoundaries.length&&0===e.completedBoundaries.length&&t.close()}}function Bn(e,t){try{var n=e.abortableTasks;n.forEach(function(n){return yn(n,e,t)}),n.clear(),null!==e.destination&&Mn(e,e.destination)}catch(t){un(e,t),dn(e,t)}}t.renderToReadableStream=function(e,t){return new Promise(function(n,i){var r,s,o=new Promise(function(e,t){s=e,r=t}),l=function(e,t,n,i,r,s,o,l,a){var c=[],h=new Set;return(n=hn(t={destination:null,responseState:t,progressiveChunkSize:void 0===i?12800:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:h,pingedTasks:c,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?ln:r,onAllReady:void 0===s?an:s,onShellReady:void 0===o?an:o,onShellError:void 0===l?an:l,onFatalError:void 0===a?an:a},0,null,n,!1,!1)).parentFlushed=!0,e=cn(t,e,null,n,h,yt,null,Dt),c.push(e),t}(e,function(e,t,n,i,r){e=void 0===e?"":e,t=void 0===t?M:d('<script nonce="'+S(t)+'">');var s=[];if(void 0!==n&&s.push(t,u((""+n).replace(P,N)),B),void 0!==i)for(n=0;n<i.length;n++)s.push(D,u(S(i[n])),I);if(void 0!==r)for(i=0;i<r.length;i++)s.push(R,u(S(r[i])),I);return{bootstrapChunks:s,startInlineScript:t,placeholderPrefix:d(e+"P:"),segmentPrefix:d(e+"S:"),boundaryPrefix:e+"B:",idPrefix:e,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1}}(t?t.identifierPrefix:void 0,t?t.nonce:void 0,t?t.bootstrapScriptContent:void 0,t?t.bootstrapScripts:void 0,t?t.bootstrapModules:void 0),function(e){return L("http://www.w3.org/2000/svg"===e?2:"http://www.w3.org/1998/Math/MathML"===e?3:0,null)}(t?t.namespaceURI:void 0),t?t.progressiveChunkSize:void 0,t?t.onError:void 0,s,function(){var e=new ReadableStream({type:"bytes",pull:function(e){if(1===l.status)l.status=2,f(e,l.fatalError);else if(2!==l.status&&null===l.destination){l.destination=e;try{Mn(l,e)}catch(e){un(l,e),dn(l,e)}}},cancel:function(){Bn(l)}},{highWaterMark:0});e.allReady=o,n(e)},function(e){o.catch(function(){}),i(e)},r);if(t&&t.signal){var a=t.signal,c=function(){Bn(l,a.reason),a.removeEventListener("abort",c)};a.addEventListener("abort",c)}kn(l)})},t.version="18.3.1"},467(e,t,n){var i,r;i=n(633),r=n(911),i.version,i.renderToString,t.qV=i.renderToStaticMarkup,i.renderToNodeStream,i.renderToStaticNodeStream,r.renderToReadableStream},20(e,t,n){var i=n(649),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var i,s={},c=null,h=null;for(i in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(h=t.ref),t)o.call(t,i)&&!a.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===s[i]&&(s[i]=t[i]);return{$$typeof:r,type:e,key:c,ref:h,props:s,_owner:l.current}}t.Fragment=s,t.jsx=c,t.jsxs=c},848(e,t,n){e.exports=n(20)},72(e){var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],l=0;l<e.length;l++){var a=e[l],c=i.base?a[0]+i.base:a[0],h=s[c]||0,u="".concat(c," ").concat(h);s[c]=h+1;var d=n(u),f={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)t[d].references++,t[d].updater(f);else{var p=r(f,i);i.byIndex=l,t.splice(l,0,{identifier:u,updater:p,references:1})}o.push(u)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var l=n(s[o]);t[l].references--}for(var a=i(e,r),c=0;c<s.length;c++){var h=n(s[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}s=a}}},659(e){var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},649(t){t.exports=e},942(e,t){var n;!function(){var i={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,s(n)))}return e}function s(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)i.call(e,n)&&e[n]&&(t=o(t,n));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()}},k={};function _(e){var t=k[e];if(void 0!==t)return t.exports;var n=k[e]={id:e,exports:{}};return C[e](n,n.exports,_),n.exports}_.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return _.d(t,{a:t}),t},_.d=(e,t)=>{for(var n in t)_.o(t,n)&&!_.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},_.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_.nc=void 0;var S=_(649),E=_(848);function T({label:e,children:t,align:n="bottom-start",className:i,showDelay:r=250,hideDelay:o=250}){const[l,a]=(0,S.useState)(!1),c=(0,S.useRef)(void 0),h=(0,S.useRef)(void 0),u=(0,S.useRef)(null),d=(0,S.useRef)(null),f=(0,S.useCallback)((e=!1)=>{clearTimeout(c.current),clearTimeout(h.current),e?c.current=setTimeout(()=>{a(!0)},r):a(!0)},[r]),p=(0,S.useCallback)((e=!1)=>{clearTimeout(c.current),clearTimeout(h.current),e?h.current=setTimeout(()=>{a(!1)},o):a(!1)},[o]);(0,S.useEffect)(()=>()=>{clearTimeout(c.current),clearTimeout(h.current)},[]),(0,S.useEffect)(()=>{if(!l)return;const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l,p]);const g=({relatedTarget:e})=>{var t,n;if(e===u.current||e===d.current||null!==(t=u.current)&&void 0!==t&&t.contains(e)||null!==(n=d.current)&&void 0!==n&&n.contains(e))return;const i=window.getSelection();if(i&&i.toString().length>0)try{var r,s,o;const e=i.getRangeAt(0);if(null!==(r=d.current)&&void 0!==r&&r.contains(e.commonAncestorContainer)||null!==(s=d.current)&&void 0!==s&&s.contains(i.anchorNode)||null!==(o=d.current)&&void 0!==o&&o.contains(i.focusNode))return}catch(e){}p(!0)},m=()=>{clearTimeout(h.current)};return(0,E.jsxs)("div",{className:"task-testing-tooltip__wrapper"+(i?` ${i}`:""),ref:u,onMouseEnter:()=>f(!0),onMouseLeave:g,onFocus:e=>{e.target===u.current&&f(!1)},onBlur:e=>{var t,n;const{relatedTarget:i}=e;null!==(t=d.current)&&void 0!==t&&t.contains(i)||null!==(n=u.current)&&void 0!==n&&n.contains(i)||p(!1)},onKeyDown:e=>{"Escape"===e.code&&p(!1)},children:[t,l&&s((()=>{const t=function(e,t){if(!e)return{};const n=e.getBoundingClientRect(),i={};return t.startsWith("bottom")?i.top=n.bottom+6:t.startsWith("top")&&(i.bottom=window.innerHeight-n.top+6),t.endsWith("start")?i.left=n.left:t.endsWith("end")&&(i.right=window.innerWidth-n.right),i}(u.current,n);return(0,E.jsxs)("div",{className:`task-testing-tooltip ${n}`,role:"tooltip",style:t,ref:d,onClick:e=>e.stopPropagation(),onMouseEnter:m,onMouseLeave:g,children:[(0,E.jsx)("div",{className:"task-testing-tooltip__content",children:e}),(0,E.jsx)("div",{className:"task-testing-tooltip__arrow"})]})})(),document.body)]})}var O=_(942),M=_.n(O);const B=Object.prototype.toString,D=Object.prototype.hasOwnProperty;function R(e){return"[object Object]"===B.call(e)}function I(e){const t=B.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function P(e,t){return!(null==e)&&D.call(e,t)}function N(e,t){let n,i;if(void 0===e)return;const r=function(e){return"[object Array]"===B.call(e)}(e)?j:F;for(let s in e)if(P(e,s)&&(n=e[s],i=t(n,r(s)),!1===i))return n}function L(e,t){return!!function(e,t){const n=function(e){return I(e)?e:t=>t===e}(t);let i;return N(e,function(e,t){if(n(e,t))return i=e,!1}),i}(e,t)}function F(e){return e}function j(e){return Number(e)}function z(e,t){let n={};return N(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n}function V(e,t){var n=H(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function W(e,t){return L(t,function(t){return V(e,t)})}function H(e){return e&&e.businessObject||e}const q=["bpmn:Task","bpmn:SubProcess"],$="Select a task or subprocess to start testing.",U="Task testing is only supported for tasks and subprocesses. Select one to start testing.";var K=_(7),G=_.n(K);const Y={input:{},output:{}},J=["bpmn:Task","bpmn:SubProcess"];class Q extends(G()){constructor(e,t,n=Y){super(),this._injector=e,this._elementVariables=t,this._config={...Y,...n},this._selectedElement=null,this._variablesForElements=new Map}setConfig(e){this._config=e,this.emit("config.changed")}getConfig(){return this._config}setInputConfigForElement(e,t){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,input:{...this._config.input,[e.id]:t}},this.emit("config.changed",{config:this._config})}resetInputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,input:z(this._config.input,e.id)},this.emit("config.changed")}setOutputConfigForElement(e,t){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,output:{...this._config.output,[e.id]:t}},this.emit("config.changed")}resetOutputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,output:z(this._config.output,e.id)},this.emit("config.changed")}getInputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);return t=this._config.input[e.id],"[object String]"!==B.call(t)?this._getDefaultInputConfig():this._config.input[e.id];var t}getOutputConfigForElement(e){if(!W(e,J))throw new Error(`Unsupported element type: ${e.type}`);if(this._config.output[e.id])return this._config.output[e.id]}_getDefaultInputConfig(){return"{}"}}class X extends(G()){constructor(e){super(),this._injector=e,this._variables={},this._variableResolver=e.get("variableResolver"),this._injector.get("eventBus").on("commandStack.changed",()=>{this._variables={},this.emit("variables.changed")})}async getVariablesForElement(e){if(this._variables[e.id])return this._variables[e.id];const t=(await this._variableResolver.getVariablesForElement(e).catch(()=>[])).filter(({origin:t})=>!(1===t.length&&t[0].id===e.id));return this._variables[e.id]=t,t}}var Z=_(467);let ee=[],te=[];function ne(e){if(e<768)return!1;for(let t=0,n=ee.length;;){let i=t+n>>1;if(e<ee[i])n=i;else{if(!(e>=te[i]))return!0;t=i+1}if(t==n)return!1}}function ie(e){return e>=127462&&e<=127487}function re(e,t,n=!0,i=!0){return(n?se:oe)(e,t,i)}function se(e,t,n){if(t==e.length)return t;t&&ae(e.charCodeAt(t))&&ce(e.charCodeAt(t-1))&&t--;let i=le(e,t);for(t+=he(i);t<e.length;){let r=le(e,t);if(8205==i||8205==r||n&&ne(r))t+=he(r),i=r;else{if(!ie(r))break;{let n=0,i=t-2;for(;i>=0&&ie(le(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function oe(e,t,n){for(;t>0;){let i=se(e,t-2,n);if(i<t)return i;t--}return 0}function le(e,t){let n=e.charCodeAt(t);if(!ce(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return ae(i)?i-56320+(n-55296<<10)+65536:n}function ae(e){return e>=56320&&e<57344}function ce(e){return e>=55296&&e<56320}function he(e){return e<65536?1:2}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?te:ee).push(n+=e[t])})();class ue{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=xe(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),fe.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=xe(this,e,t);let n=[];return this.decompose(e,t,n,0),fe.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new me(this),r=new me(e);for(let e=t,s=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new me(this,e)}iterRange(e,t=this.length){return new Ae(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ve(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new de(e):fe.from(de.split(e,[])):ue.empty}}class de extends ue{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.text[r],o=i+s.length;if((t?n:o)>=e)return new be(i,o,n,s);i=o+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new de(ge(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=pe(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new de(t,e.length+r.length));else{let e=t.length>>1;n.push(new de(t.slice(0,e)),new de(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof de))return super.replace(e,t,n);[e,t]=xe(this,e,t);let i=pe(this.text,pe(n.text,ge(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new de(i,r):fe.from(de.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=xe(this,e,t);let i="";for(let r=0,s=0;r<=t&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;r>e&&s&&(i+=n),e<l&&t>r&&(i+=o.slice(Math.max(0,e-r),t-r)),r=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new de(n,i)),n=[],i=-1);return i>-1&&t.push(new de(n,i)),t}}class fe extends ue{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.children[r],o=i+s.length,l=n+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,n,i);i=o+1,n=l+1}}decompose(e,t,n,i){for(let r=0,s=0;s<=t&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e<=l&&t>=s){let r=i&((s<=e?1:0)|(l>=t?2:0));s>=e&&l<=t&&!r?n.push(o):o.decompose(e-s,t-s,n,r)}s=l+1}}replace(e,t,n){if([e,t]=xe(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let s=this.children[i],o=r+s.length;if(e>=r&&t<=o){let l=s.replace(e-r,t-r,n),a=this.lines-s.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let r=this.children.slice();return r[i]=l,new fe(r,this.length-(t-e)+n.length)}return super.replace(r,o,l)}r=o+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=xe(this,e,t);let i="";for(let r=0,s=0;r<this.children.length&&s<=t;r++){let o=this.children[r],l=s+o.length;s>e&&r&&(i+=n),e<l&&t>s&&(i+=o.sliceString(e-s,t-s,n)),s=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof fe))return 0;let n=0,[i,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==s||r==o)return n;let l=this.children[i],a=e.children[r];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new de(n,t)}let i=Math.max(32,n>>5),r=i<<1,s=i>>1,o=[],l=0,a=-1,c=[];function h(e){let t;if(e.lines>r&&e instanceof fe)for(let t of e.children)h(t);else e.lines>s&&(l>s||!l)?(u(),o.push(e)):e instanceof de&&l&&(t=c[c.length-1])instanceof de&&e.lines+t.lines<=32?(l+=e.lines,a+=e.length+1,c[c.length-1]=new de(t.text.concat(e.text),t.length+1+e.length)):(l+e.lines>i&&u(),l+=e.lines,a+=e.length+1,c.push(e))}function u(){0!=l&&(o.push(1==c.length?c[0]:fe.from(c,a)),a=-1,l=c.length=0)}for(let t of e)h(t);return u(),1==o.length?o[0]:new fe(o,t)}}function pe(e,t,n=0,i=1e9){for(let r=0,s=0,o=!0;s<e.length&&r<=i;s++){let l=e[s],a=r+l.length;a>=n&&(a>i&&(l=l.slice(0,i-r)),r<n&&(l=l.slice(n-r)),o?(t[t.length-1]+=l,o=!1):t.push(l)),r=a+1}return t}function ge(e,t,n){return pe(e,[""],t,n)}ue.empty=new de([""],0);class me{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof de?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,o=i instanceof de?i.text.length:i.children.length;if(s==(t>0?o:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof de){let r=i.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[s+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof de?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Ae{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new me(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class ve{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(ue.prototype[Symbol.iterator]=function(){return this.iter()},me.prototype[Symbol.iterator]=Ae.prototype[Symbol.iterator]=ve.prototype[Symbol.iterator]=function(){return this});class be{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function xe(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function ye(e,t,n=!0,i=!0){return re(e,t,n,i)}function we(e,t){let n=e.charCodeAt(t);if(!((i=n)>=55296&&i<56320&&t+1!=e.length))return n;var i;let r=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(r)?r-56320+(n-55296<<10)+65536:n}function Ce(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function ke(e){return e<65536?1:2}const _e=/\r\n?|\n/;var Se=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Se||(Se={}));class Ee{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let r=this.sections[t++],s=this.sections[t++];s<0?(e(n,i,r),i+=r):i+=s,n+=r}}iterChangedRanges(e,t=!1){Be(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new Ee(e)}composeDesc(e){return this.empty?e:e.empty?this:Re(this,e)}mapDesc(e,t=!1){return e.empty?this:De(this,e,t)}mapPos(e,t=-1,n=Se.Simple){let i=0,r=0;for(let s=0;s<this.sections.length;){let o=this.sections[s++],l=this.sections[s++],a=i+o;if(l<0){if(a>e)return r+(e-i);r+=o}else{if(n!=Se.Simple&&a>=e&&(n==Se.TrackDel&&i<e&&a>e||n==Se.TrackBefore&&i<e||n==Se.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!o)return e==i||t<0?r:r+l;r+=l}i=a}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&r>=e)return!(i<e&&r>t)||"cover";i=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ee(e)}static create(e){return new Ee(e)}}class Te extends Ee{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Be(this,(t,n,i,r,s)=>e=e.replace(i,i+(n-t),s),!1),e}mapDesc(e,t=!1){return De(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let s=t[i],o=t[i+1];if(o>=0){t[i]=o,t[i+1]=s;let l=i>>1;for(;n.length<l;)n.push(ue.empty);n.push(s?e.slice(r,r+s):ue.empty)}r+=s}return new Te(t,n)}compose(e){return this.empty?e:e.empty?this:Re(this,e,!0)}map(e,t=!1){return e.empty?this:De(this,e,t,!0)}iterChanges(e,t=!1){Be(this,e,t)}get desc(){return Ee.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new Ie(this);e:for(let s=0,o=0;;){let l=s==e.length?1e9:e[s++];for(;o<l||o==l&&0==r.len;){if(r.done)break e;let e=Math.min(r.len,l-o);Oe(i,e,-1);let s=-1==r.ins?-1:0==r.off?r.ins:0;Oe(t,e,s),s>0&&Me(n,t,r.text),r.forward(e),o+=e}let a=e[s++];for(;o<a;){if(r.done)break e;let e=Math.min(r.len,a-o);Oe(t,e,-1),Oe(i,e,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(e),o+=e}}return{changes:new Te(t,n),filtered:Ee.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):0==i?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],s=0,o=null;function l(e=!1){if(!e&&!i.length)return;s<t&&Oe(i,t-s,-1);let n=new Te(i,r);o=o?o.compose(n.map(o)):n,i=[],r=[],s=0}return function e(a){if(Array.isArray(a))for(let t of a)e(t);else if(a instanceof Te){if(a.length!=t)throw new RangeError(`Mismatched change set length (got ${a.length}, expected ${t})`);l(),o=o?o.compose(a.map(o)):a}else{let{from:e,to:o=e,insert:c}=a;if(e>o||e<0||o>t)throw new RangeError(`Invalid change range ${e} to ${o} (in doc of length ${t})`);let h=c?"string"==typeof c?ue.of(c.split(n||_e)):c:ue.empty,u=h.length;if(e==o&&0==u)return;e<s&&l(),e>s&&Oe(i,e-s,-1),Oe(i,o-e,u),Me(r,i,h),s=o}}(e),l(!o),o}static empty(e){return new Te(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let r=e[i];if("number"==typeof r)t.push(r,-1);else{if(!Array.isArray(r)||"number"!=typeof r[0]||r.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length<i;)n.push(ue.empty);n[i]=ue.of(r.slice(1)),t.push(r[0],n[i].length)}}}return new Te(t,n)}static createSet(e,t){return new Te(e,t)}}function Oe(e,t,n,i=!1){if(0==t&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Me(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<i;)e.push(ue.empty);e.push(n)}}function Be(e,t,n){let i=e.inserted;for(let r=0,s=0,o=0;o<e.sections.length;){let l=e.sections[o++],a=e.sections[o++];if(a<0)r+=l,s+=l;else{let c=r,h=s,u=ue.empty;for(;c+=l,h+=a,a&&i&&(u=u.append(i[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],a=e.sections[o++];t(r,c,s,h,u),r=c,s=h}}}function De(e,t,n,i=!1){let r=[],s=i?[]:null,o=new Ie(e),l=new Ie(t);for(let e=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(-1==o.ins&&-1==l.ins){let e=Math.min(o.len,l.len);Oe(r,e,-1),o.forward(e),l.forward(e)}else if(l.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(l.len<o.len||l.len==o.len&&!n))){let t=l.len;for(Oe(r,l.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(Oe(r,0,o.ins),s&&Me(s,r,o.text),e=o.i),o.forward(n),t-=n}l.next()}else{if(!(o.ins>=0)){if(o.done&&l.done)return s?Te.createSet(r,s):Ee.create(r);throw new Error("Mismatched change set lengths")}{let t=0,n=o.len;for(;n;)if(-1==l.ins){let e=Math.min(n,l.len);t+=e,n-=e,l.forward(e)}else{if(!(0==l.ins&&l.len<n))break;n-=l.len,l.next()}Oe(r,t,e<o.i?o.ins:0),s&&e<o.i&&Me(s,r,o.text),e=o.i,o.forward(o.len-n)}}}}function Re(e,t,n=!1){let i=[],r=n?[]:null,s=new Ie(e),o=new Ie(t);for(let e=!1;;){if(s.done&&o.done)return r?Te.createSet(i,r):Ee.create(i);if(0==s.ins)Oe(i,s.len,0,e),s.next();else if(0!=o.len||o.done){if(s.done||o.done)throw new Error("Mismatched change set lengths");{let t=Math.min(s.len2,o.len),n=i.length;if(-1==s.ins){let n=-1==o.ins?-1:o.off?0:o.ins;Oe(i,t,n,e),r&&n&&Me(r,i,o.text)}else-1==o.ins?(Oe(i,s.off?0:s.len,t,e),r&&Me(r,i,s.textBit(t))):(Oe(i,s.off?0:s.len,o.off?0:o.ins,e),r&&!o.off&&Me(r,i,o.text));e=(s.ins>t||o.ins>=0&&o.len>t)&&(e||i.length>n),s.forward2(t),o.forward(t)}}else Oe(i,0,o.ins,e),r&&Me(r,i,o.text),o.next()}}class Ie{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?ue.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?ue.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Pe{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new Pe(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Ne.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Ne.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Ne.range(e.anchor,e.head)}static create(e,t,n){return new Pe(e,t,n)}}class Ne{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Ne.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Ne([this.main],0)}addRange(e,t=!0){return Ne.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Ne.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ne(e.ranges.map(e=>Pe.fromJSON(e)),e.main)}static single(e,t=e){return new Ne([Ne.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let r=e[i];if(r.empty?r.from<=n:r.from<n)return Ne.normalized(e.slice(),t);n=r.to}return new Ne(e,t)}static cursor(e,t=0,n,i){return Pe.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(e,t,n,i){let r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return t<e?Pe.create(t,e,48|r):Pe.create(e,t,(t>e?8:0)|r)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let i=e[n],r=e[n-1];if(i.empty?i.from<=r.to:i.from<r.to){let s=r.from,o=Math.max(i.to,r.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?Ne.range(o,s):Ne.range(s,o))}}return new Ne(e,t)}}function Le(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Fe=0;class je{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Fe++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(e={}){return new je(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:ze),!!e.static,e.enables)}of(e){return new Ve([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ve(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ve(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function ze(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class Ve{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Fe++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,s=e[r]>>1,o=2==this.type,l=!1,a=!1,c=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[s]=n(e),1),update(e,t){if(l&&t.docChanged||a&&(t.docChanged||t.selection)||He(e,c)){let t=n(e);if(o?!We(t,e.values[s],i):!i(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let l,a=t.config.address[r];if(null!=a){let r=et(t,a);if(this.dependencies.every(n=>n instanceof je?t.facet(n)===e.facet(n):!(n instanceof Ue)||t.field(n,!1)==e.field(n,!1))||(o?We(l=n(e),r,i):i(l=n(e),r)))return e.values[s]=r,0}else l=n(e);return e.values[s]=l,1}}}}function We(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function He(e,t){let n=!1;for(let i of t)1&Ze(e,i)&&(n=!0);return n}function qe(e,t,n){let i=n.map(t=>e[t.id]),r=n.map(e=>e.type),s=i.filter(e=>!(1&e)),o=e[t.id]>>1;function l(e){let n=[];for(let t=0;t<i.length;t++){let s=et(e,i[t]);if(2==r[t])for(let e of s)n.push(e);else n.push(s)}return t.combine(n)}return{create(e){for(let t of i)Ze(e,t);return e.values[o]=l(e),1},update(e,n){if(!He(e,s))return 0;let i=l(e);return t.compare(i,e.values[o])?0:(e.values[o]=i,1)},reconfigure(e,r){let s=He(e,i),a=r.config.facets[t.id],c=r.facet(t);if(a&&!s&&ze(n,a))return e.values[o]=c,0;let h=l(e);return t.compare(h,c)?(e.values[o]=c,0):(e.values[o]=h,1)}}}const $e=je.define({static:!0});class Ue{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new Ue(Fe++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet($e).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,1)},reconfigure:(e,n)=>{let i,r=e.facet($e),s=n.facet($e);return(i=r.find(e=>e.field==this))&&i!=s.find(e=>e.field==this)?(e.values[t]=i.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,$e.of({field:this,create:e})]}get extension(){return this}}function Ke(e){return t=>new Ye(t,e)}const Ge={highest:Ke(0),high:Ke(1),default:Ke(2),low:Ke(3),lowest:Ke(4)};class Ye{constructor(e,t){this.inner=e,this.prec=t}}class Je{of(e){return new Qe(this,e)}reconfigure(e){return Je.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Qe{constructor(e,t){this.compartment=e,this.inner=t}}class Xe{constructor(e,t,n,i,r,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],r=Object.create(null),s=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;return function e(s,o){let l=r.get(s);if(null!=l){if(l<=o)return;let e=i[l].indexOf(s);e>-1&&i[l].splice(e,1),s instanceof Qe&&n.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let t of s)e(t,o);else if(s instanceof Qe){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(s.compartment)||s.inner;n.set(s.compartment,i),e(i,o)}else if(s instanceof Ye)e(s.inner,s.prec);else if(s instanceof Ue)i[o].push(s),s.provides&&e(s.provides,o);else if(s instanceof Ve)i[o].push(s),s.facet.extensions&&e(s.facet.extensions,2);else{let t=s.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,o)}}(e,2),i.reduce((e,t)=>e.concat(t))}(e,t,s))n instanceof Ue?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let o=Object.create(null),l=[],a=[];for(let e of i)o[e.id]=a.length<<1,a.push(t=>e.slot(t));let c=null==n?void 0:n.config.facets;for(let e in r){let t=r[e],i=t[0].facet,s=c&&c[e]||[];if(t.every(e=>0==e.type))if(o[i.id]=l.length<<1|1,ze(s,t))l.push(n.facet(i));else{let e=i.combine(t.map(e=>e.value));l.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=l.length<<1|1,l.push(e.value)):(o[e.id]=a.length<<1,a.push(t=>e.dynamicSlot(t)));o[i.id]=a.length<<1,a.push(e=>qe(e,i,t))}}let h=a.map(e=>e(o));return new Xe(e,s,h,o,l,r)}}function Ze(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function et(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const tt=je.define(),nt=je.define({combine:e=>e.some(e=>e),static:!0}),it=je.define({combine:e=>e.length?e[0]:void 0,static:!0}),rt=je.define(),st=je.define(),ot=je.define(),lt=je.define({combine:e=>!!e.length&&e[0]});class at{constructor(e,t){this.type=e,this.value=t}static define(){return new ct}}class ct{of(e){return new at(this,e)}}class ht{constructor(e){this.map=e}of(e){return new ut(this,e)}}class ut{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ut(this.type,t)}is(e){return this.type==e}static define(e={}){return new ht(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}ut.reconfigure=ut.define(),ut.appendConfig=ut.define();class dt{constructor(e,t,n,i,r,s){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Le(n,t.newLength),r.some(e=>e.type==dt.time)||(this.annotations=r.concat(dt.time.of(Date.now())))}static create(e,t,n,i,r,s){return new dt(e,t,n,i,r,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(dt.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function ft(e,t){let n=[];for(let i=0,r=0;;){let s,o;if(i<e.length&&(r==t.length||t[r]>=e[i]))s=e[i++],o=e[i++];else{if(!(r<t.length))return n;s=t[r++],o=t[r++]}!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function pt(e,t,n){var i;let r,s,o;return n?(r=t.changes,s=Te.empty(t.changes.length),o=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),s=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(s):null===(i=e.selection)||void 0===i?void 0:i.map(r),effects:ut.mapEffects(e.effects,r).concat(ut.mapEffects(t.effects,s)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function gt(e,t,n){let i=t.selection,r=vt(t.annotations);return t.userEvent&&(r=r.concat(dt.userEvent.of(t.userEvent))),{changes:t.changes instanceof Te?t.changes:Te.of(t.changes||[],n,e.facet(it)),selection:i&&(i instanceof Ne?i:Ne.single(i.anchor,i.head)),effects:vt(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function mt(e,t,n){let i=gt(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let r=1;r<t.length;r++){!1===t[r].filter&&(n=!1);let s=!!t[r].sequential;i=pt(i,gt(e,t[r],s?i.changes.newLength:e.doc.length),s)}let r=dt.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(ot),i=e;for(let r=n.length-1;r>=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=pt(i,gt(t,s,e.changes.newLength),!0))}return i==e?e:dt.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(rt)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:ft(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=Te.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=dt.create(t,i,e.selection&&e.selection.map(r),ut.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(st);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof dt?r:Array.isArray(r)&&1==r.length&&r[0]instanceof dt?r[0]:mt(t,vt(r),!1)}return e}(r):r)}dt.time=at.define(),dt.userEvent=at.define(),dt.addToHistory=at.define(),dt.remote=at.define();const At=[];function vt(e){return null==e?At:Array.isArray(e)?e:[e]}var bt=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(bt||(bt={}));const xt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let yt;try{yt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class wt{constructor(e,t,n,i,r,s){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Ze(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return Ze(this,n),et(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return mt(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:r}=n;for(let t of e.effects)t.is(Je.reconfigure)?(n&&(r=new Map,n.compartments.forEach((e,t)=>r.set(t,e)),n=null),r.set(t.value.compartment,t.value.extension)):t.is(ut.reconfigure)?(n=null,i=t.value):t.is(ut.appendConfig)&&(n=null,i=vt(i).concat(t.value));n?t=e.startState.values.slice():(n=Xe.resolve(i,r,this),t=new wt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let s=e.startState.facet(nt)?e.newSelection:e.newSelection.asSingle();new wt(n,e.newDoc,s,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Ne.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],s=vt(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),l=this.changes(o.changes),a=l.map(i);for(let e=0;e<n;e++)r[e]=r[e].map(a);let c=i.mapDesc(l,!0);r.push(o.range.map(c)),i=i.compose(a),s=ut.mapEffects(s,a).concat(ut.mapEffects(vt(o.effects),c))}return{changes:i,selection:Ne.create(r,t.mainIndex),effects:s}}changes(e=[]){return e instanceof Te?e:Te.of(e,this.doc.length,this.facet(wt.lineSeparator))}toText(e){return ue.of(e.split(this.facet(wt.lineSeparator)||_e))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(Ze(this,t),et(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof Ue&&null!=this.config.address[i.id]&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let r=n[t],s=e[t];i.push(r.init(e=>r.spec.fromJSON(s,e)))}return wt.create({doc:e.doc,selection:Ne.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Xe.resolve(e.extensions||[],new Map),n=e.doc instanceof ue?e.doc:ue.of((e.doc||"").split(t.staticFacet(wt.lineSeparator)||_e)),i=e.selection?e.selection instanceof Ne?e.selection:Ne.single(e.selection.anchor,e.selection.head):Ne.single(0);return Le(i,n.length),t.staticFacet(nt)||(i=i.asSingle()),new wt(t,n,i,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(wt.tabSize)}get lineBreak(){return this.facet(wt.lineSeparator)||"\n"}get readOnly(){return this.facet(lt)}phrase(e,...t){for(let t of this.facet(wt.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(tt))for(let s of r(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&i.push(s[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return n=t.length?t[0]:"",e=>{if(!/\S/.test(e))return bt.Space;if(function(e){if(yt)return yt.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||xt.test(n)))return!0}return!1}(e))return bt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return bt.Word;return bt.Other};var n}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),s=e-n,o=e-n;for(;s>0;){let e=ye(t,s,!1);if(r(t.slice(e,s))!=bt.Word)break;s=e}for(;o<i;){let e=ye(t,o);if(r(t.slice(o,e))!=bt.Word)break;o=e}return s==o?null:Ne.range(s+n,o+n)}}function Ct(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let r=t[e],s=i[e];if(void 0===s)i[e]=r;else if(s===r||void 0===r);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](s,r)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}wt.allowMultipleSelections=nt,wt.tabSize=je.define({combine:e=>e.length?e[0]:4}),wt.lineSeparator=it,wt.readOnly=lt,wt.phrases=je.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every(n=>e[n]==t[n])}}),wt.languageData=tt,wt.changeFilter=rt,wt.transactionFilter=st,wt.transactionExtender=ot,Je.reconfigure=ut.define();class kt{eq(e){return this==e}range(e,t=e){return St.create(e,t,this)}}function _t(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}kt.prototype.startSide=kt.prototype.endSide=0,kt.prototype.point=!1,kt.prototype.mapMode=Se.TrackDel;class St{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new St(e,t,n)}}function Et(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Tt{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let s=i,o=r.length;;){if(s==o)return s;let i=s+o>>1,l=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==s)return l>=0?s:o;l>=0?o=i:s=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,r);r<s;r++)if(!1===i(this.from[r]+e,this.to[r]+e,this.value[r]))return!1}map(e,t){let n=[],i=[],r=[],s=-1,o=-1;for(let l=0;l<this.value.length;l++){let a,c,h=this.value[l],u=this.from[l]+e,d=this.to[l]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(a=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<a))continue}else if(a=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),a>c||a==c&&h.startSide>0&&h.endSide<=0)continue;(c-a||h.endSide-h.startSide)<0||(s<0&&(s=a),h.point&&(o=Math.max(o,c-a)),n.push(h),i.push(a-s),r.push(c-s))}return{mapped:n.length?new Tt(i,r,n,o):null,pos:s}}}class Ot{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new Ot(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,s=e.filter;if(0==t.length&&!s)return this;if(n&&(t=t.slice().sort(Et)),this.isEmpty)return t.length?Ot.of(t):this;let o=new Dt(this,null,-1).goto(0),l=0,a=[],c=new Mt;for(;o.value||l<t.length;)if(l<t.length&&(o.from-t[l].from||o.startSide-t[l].value.startSide)>=0){let e=t[l++];c.addInner(e.from,e.to,e.value)||a.push(e)}else 1==o.rangeIndex&&o.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(o.chunkIndex)<t[l].from)&&(!s||i>this.chunkEnd(o.chunkIndex)||r<this.chunkPos[o.chunkIndex])&&c.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!s||i>o.to||r<o.from||s(o.from,o.to,o.value))&&(c.addInner(o.from,o.to,o.value)||a.push(St.create(o.from,o.to,o.value))),o.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?Ot.empty:this.nextLayer.update({add:a,filter:s,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r],l=e.touchesRange(s,s+o.length);if(!1===l)i=Math.max(i,o.maxPoint),t.push(o),n.push(e.mapPos(s));else if(!0===l){let{mapped:r,pos:l}=o.map(s,e);r&&(i=Math.max(i,r.maxPoint),t.push(r),n.push(l))}}let r=this.nextLayer.map(e);return 0==t.length?r:new Ot(n,t,r||Ot.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],s=this.chunk[i];if(t>=r&&e<=r+s.length&&!1===s.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Rt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Rt.from(e).goto(t)}static compare(e,t,n,i,r=-1){let s=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),l=Bt(s,o,n),a=new Pt(s,l,r),c=new Pt(o,l,r);n.iterGaps((e,t,n)=>Nt(a,e,c,t,n,i)),n.empty&&0==n.length&&Nt(a,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),s=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(r.length!=s.length)return!1;if(!r.length)return!0;let o=Bt(r,s),l=new Pt(r,o,0).goto(n),a=new Pt(s,o,0).goto(n);for(;;){if(l.to!=a.to||!Lt(l.active,a.active)||l.point&&(!a.point||!_t(l.point,a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(e,t,n,i,r=-1){let s=new Pt(e,null,r).goto(t),o=t,l=s.openStart;for(;;){let e=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),r=s.pointFrom<t?n.length+1:s.point.startSide<0?n.length:Math.min(n.length,l);i.point(o,e,s.point,n,r,s.pointRank),l=Math.min(s.openEnd(e),n.length)}else e>o&&(i.span(o,e,s.active,l),l=s.openEnd(e));if(s.to>n)return l+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(e,t=!1){let n=new Mt;for(let i of e instanceof St?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(Et(t,i)>0)return e.slice().sort(Et);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return Ot.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=Ot.empty;i=i.nextLayer)t=new Ot(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}Ot.empty=new Ot([],[],null,-1),Ot.empty.nextLayer=Ot.empty;class Mt{finishChunk(e){this.chunks.push(new Tt(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Mt)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Ot.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Ot.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Bt(e,t,n){let i=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&i.set(t.chunk[e],t.chunkPos[e]);let r=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let s=i.get(e.chunk[t]);null==s||(n?n.mapPos(s):s)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(s,s+e.chunk[t].length))||r.add(e.chunk[t])}return r}class Dt{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Rt{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let s=e[r];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&i.push(new Dt(s,t,n,r));return 1==i.length?i[0]:new Rt(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)It(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)It(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),It(this.heap,0)}}}function It(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class Pt{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Rt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Ft(this.active,e),Ft(this.activeTo,e),Ft(this.activeRank,e),this.minActive=zt(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0;)t++;jt(this.active,t,n),jt(this.activeTo,t,i),jt(this.activeRank,t,r),e&&jt(e,t,this.cursor.from),this.minActive=zt(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Ft(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Nt(e,t,n,i,r,s){e.goto(t),n.goto(i);let o=i+r,l=i,a=i-t,c=!!s.boundChange;for(let t=!1;;){let i=e.to+a-n.to,r=i||e.endSide-n.endSide,h=r<0?e.to+a:n.to,u=Math.min(h,o);if(e.point||n.point?(e.point&&n.point&&_t(e.point,n.point)&&Lt(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,u,e.point,n.point),t=!1):(t&&s.boundChange(l),u>l&&!Lt(e.active,n.active)&&s.compareRange(l,u,e.active,n.active),c&&u<o&&(i||e.openEnd(h)!=n.openEnd(h))&&(t=!0)),h>o)break;l=h,r<=0&&e.next(),r>=0&&n.next()}}function Lt(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!_t(e[n],t[n]))return!1;return!0}function Ft(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function jt(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function zt(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)(t[r]-i||e[r].endSide-e[n].endSide)<0&&(n=r,i=t[r]);return n}function Vt(e,t,n=e.length){let i=0;for(let r=0;r<n&&r<e.length;)9==e.charCodeAt(r)?(i+=t-i%t,r++):(i++,r=ye(e,r));return i}const Wt="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Ht="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),qt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class $t{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function r(e,t,s,o){let l=[],a=/^@(\w+)\b/.exec(e[0]),c=a&&"keyframes"==a[1];if(a&&null==t)return s.push(e[0]+";");for(let n in t){let o=t[n];if(/&/.test(n))r(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,s);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),o,l,c)}else null!=o&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+o+";")}(l.length||c)&&s.push((!n||a||o?e:e.map(n)).join(", ")+" {"+l.join(" ")+"}")}for(let t in e)r(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=qt[Wt]||1;return qt[Wt]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Ht],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Kt(e,r),i.mount(Array.isArray(t)?t:[t],e)}}let Ut=new Map;class Kt{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=Ut.get(n);if(t)return e[Ht]=t;this.sheet=new i.CSSStyleSheet,Ut.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Ht]=this}mount(e,t){let n=this.sheet,i=0,r=0;for(let t=0;t<e.length;t++){let s=e[t],o=this.modules.indexOf(s);if(o<r&&o>-1&&(this.modules.splice(o,1),r--,o=-1),-1==o){if(this.modules.splice(r++,0,s),n)for(let e=0;e<s.rules.length;e++)n.insertRule(s.rules[e],i++)}else{for(;r<o;)i+=this.modules[r++].rules.length;i+=s.rules.length,r++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Gt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Yt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Jt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Qt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Xt=0;Xt<10;Xt++)Gt[48+Xt]=Gt[96+Xt]=String(Xt);for(Xt=1;Xt<=24;Xt++)Gt[Xt+111]="F"+Xt;for(Xt=65;Xt<=90;Xt++)Gt[Xt]=String.fromCharCode(Xt+32),Yt[Xt]=String.fromCharCode(Xt);for(var Zt in Gt)Yt.hasOwnProperty(Zt)||(Yt[Zt]=Gt[Zt]);let en="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},tn="undefined"!=typeof document?document:{documentElement:{style:{}}};const nn=/Edge\/(\d+)/.exec(en.userAgent),rn=/MSIE \d/.test(en.userAgent),sn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(en.userAgent),on=!!(rn||sn||nn),ln=!on&&/gecko\/(\d+)/i.test(en.userAgent),an=!on&&/Chrome\/(\d+)/.exec(en.userAgent),cn="webkitFontSmoothing"in tn.documentElement.style,hn=!on&&/Apple Computer/.test(en.vendor),un=hn&&(/Mobile\/\w+/.test(en.userAgent)||en.maxTouchPoints>2);var dn={mac:un||/Mac/.test(en.platform),windows:/Win/.test(en.platform),linux:/Linux|X11/.test(en.platform),ie:on,ie_version:rn?tn.documentMode||6:sn?+sn[1]:nn?+nn[1]:0,gecko:ln,gecko_version:ln?+(/Firefox\/(\d+)/.exec(en.userAgent)||[0,0])[1]:0,chrome:!!an,chrome_version:an?+an[1]:0,ios:un,android:/Android\b/.test(en.userAgent),webkit:cn,webkit_version:cn?+(/\bAppleWebKit\/(\d+)/.exec(en.userAgent)||[0,0])[1]:0,safari:hn,safari_version:hn?+(/\bVersion\/(\d+(\.\d+)?)/.exec(en.userAgent)||[0,0])[1]:0,tabSize:null!=tn.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function fn(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const pn=Object.create(null);function gn(e,t,n){if(e==t)return!0;e||(e=pn),t||(t=pn);let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let s of i)if(s!=n&&(-1==r.indexOf(s)||e[s]!==t[s]))return!1;return!0}function mn(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function An(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class vn{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var bn=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(bn||(bn={}));class xn extends kt{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new yn(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Cn(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:r,end:s}=kn(e,i);t=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new Cn(e,t,n,i,e.widget||null,!0)}static line(e){return new wn(e)}static set(e,t=!1){return Ot.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}xn.none=Ot.empty;class yn extends xn{constructor(e){let{start:t,end:n}=kn(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?fn(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||pn}eq(e){return this==e||e instanceof yn&&this.tagName==e.tagName&&gn(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}yn.prototype.point=!1;class wn extends xn{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof wn&&this.spec.class==e.spec.class&&gn(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}wn.prototype.mapMode=Se.TrackBefore,wn.prototype.point=!0;class Cn extends xn{constructor(e,t,n,i,r,s){super(t,n,r,e),this.block=i,this.isReplace=s,this.mapMode=i?t<=0?Se.TrackBefore:Se.TrackAfter:Se.TrackDel}get type(){return this.startSide!=this.endSide?bn.WidgetRange:this.startSide<=0?bn.WidgetBefore:bn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Cn&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function kn(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function _n(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}Cn.prototype.point=!0;class Sn extends kt{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Sn&&this.tagName==e.tagName&&gn(this.attributes,e.attributes)}static create(e){return new Sn(e.tagName,e.attributes||pn)}static set(e,t=!1){return Ot.of(e,t)}}function En(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Tn(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function On(e,t){if(!t.anchorNode)return!1;try{return Tn(e,t.anchorNode)}catch(e){return!1}}function Mn(e){return 3==e.nodeType?qn(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Bn(e,t,n,i){return!!n&&(In(e,t,n,i,-1)||In(e,t,n,i,1))}function Dn(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Rn(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function In(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:Pn(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Dn(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?Pn(e):0}}}function Pn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Nn(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Ln(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Fn(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function jn(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let s=e.parentNode;s&&s!=n.body&&(t&&!i||!r);)if(1==s.nodeType)!r&&s.scrollHeight>s.clientHeight&&(r=s),t&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else{if(11!=s.nodeType)break;s=s.host}return{x:i,y:r}}Sn.prototype.startSide=Sn.prototype.endSide=-1;class zn{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?Pn(t):0),n,Math.min(e.focusOffset,n?Pn(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let Vn,Wn=null;function Hn(e){if(e.setActive)return e.setActive();if(Wn)return e.focus(Wn);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Wn?{get preventScroll(){return Wn={preventScroll:!0},!0}}:void 0),!Wn){Wn=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],r=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}}}function qn(e,t,n=t){let i=Vn||(Vn=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function $n(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,e.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function Un(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Kn(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=Pn(n)}else{if(!n.parentNode||Rn(n))return null;i=Dn(n),n=n.parentNode}}}function Gn(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||Rn(n))return null;i=Dn(n)+1,n=n.parentNode}}}dn.safari&&dn.safari_version>=26&&(Wn=!1);class Yn{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Yn(e.parentNode,Dn(e),t)}static after(e,t){return new Yn(e.parentNode,Dn(e)+1,t)}}var Jn=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Jn||(Jn={}));const Qn=Jn.LTR,Xn=Jn.RTL;function Zn(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const ei=Zn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ti=Zn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ni=Object.create(null),ii=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);ni[t]=n,ni[n]=-t}function ri(e){return e<=247?ei[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?ti[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const si=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class oi{get dir(){return this.level%2?Xn:Qn}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let r=-1;for(let s=0;s<e.length;s++){let o=e[s];if(o.from<=t&&o.to>=t){if(o.level==n)return s;(r<0||(0!=i?i<0?o.from<t:o.to>t:e[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function li(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!li(i.inner,r.inner))return!1}return!0}const ai=[];function ci(e,t,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=t,c=0;a<n;){let t=!0,h=!1;if(c==s.length||a<s[c].from){let e=ai[a];e!=l&&(t=!1,h=16==e)}let u=t||1!=l?null:[],d=t?i:i+1,f=a;e:for(;;)if(c<s.length&&f==s[c].from){if(h)break e;let p=s[c];if(!t)for(let e=p.to,t=c+1;;){if(e==n)break e;if(!(t<s.length&&s[t].from==e)){if(ai[e]==l)break e;break}e=s[t++].to}c++,u?u.push(p):(p.from>a&&o.push(new oi(a,p.from,d)),hi(e,p.direction==Qn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.to),f=p.to}else{if(f==n||(t?ai[f]!=l:ai[f]==l))break;f++}u?ci(e,a,f,i+1,r,u,o):a<f&&o.push(new oi(a,f,d)),a=f}else for(let a=n,c=s.length;a>t;){let n=!0,h=!1;if(!c||a>s[c-1].to){let e=ai[a-1];e!=l&&(n=!1,h=16==e)}let u=n||1!=l?null:[],d=n?i:i+1,f=a;e:for(;;)if(c&&f==s[c-1].to){if(h)break e;let p=s[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||s[n-1].to!=e){if(ai[e-1]==l)break e;break}e=s[--n].from}u?u.push(p):(p.to<a&&o.push(new oi(p.to,a,d)),hi(e,p.direction==Qn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.from),f=p.from}else{if(f==t||(n?ai[f-1]!=l:ai[f-1]==l))break;f--}u?ci(e,f,a,i+1,r,u,o):f<a&&o.push(new oi(f,a,d)),a=f}}function hi(e,t,n,i,r,s,o){let l=t%2?2:1;!function(e,t,n,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:t,l=s<i.length?i[s].from:n,a=s?256:r;for(let t=o,n=a,i=a;t<l;t++){let r=ri(e.charCodeAt(t));512==r?r=n:8==r&&4==i&&(r=16),ai[t]=4==r?2:r,7&r&&(i=r),n=r}for(let e=o,t=a,i=a;e<l;e++){let r=ai[e];if(128==r)e<l-1&&t==ai[e+1]&&24&t?r=ai[e]=t:ai[e]=256;else if(64==r){let r=e+1;for(;r<l&&64==ai[r];)r++;let s=e&&8==t||r<n&&8==ai[r]?1==i?1:8:256;for(let t=e;t<r;t++)ai[t]=s;e=r-1}else 8==r&&1==i&&(ai[e]=1);t=r,7&r&&(i=r)}}}(e,r,s,i,l),function(e,t,n,i,r){let s=1==r?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let c=o?i[o-1].to:t,h=o<i.length?i[o].from:n;for(let t,n,i,o=c;o<h;o++)if(n=ni[t=e.charCodeAt(o)])if(n<0){for(let e=l-3;e>=0;e-=3)if(ii[e+1]==-n){let t=ii[e+2],n=2&t?r:4&t?1&t?s:r:0;n&&(ai[o]=ai[ii[e]]=n),l=e;break}}else{if(189==ii.length)break;ii[l++]=o,ii[l++]=t,ii[l++]=a}else if(2==(i=ai[o])||1==i){let e=i==r;a=e?0:1;for(let t=l-3;t>=0;t-=3){let n=ii[t+2];if(2&n)break;if(e)ii[t+2]|=2;else{if(4&n)break;ii[t+2]|=4}}}}}(e,r,s,i,l),function(e,t,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:e,l=r<n.length?n[r].from:t;for(let a=o;a<l;){let o=ai[a];if(256==o){let o=a+1;for(;;)if(o==l){if(r==n.length)break;o=n[r++].to,l=r<n.length?n[r].from:t}else{if(256!=ai[o])break;o++}let c=1==s,h=c==(1==(o<t?ai[o]:i))?c?1:2:i;for(let t=o,i=r,s=i?n[i-1].to:e;t>a;)t==s&&(t=n[--i].from,s=i?n[i-1].to:e),ai[--t]=h;a=o}else s=o,a++}}}(r,s,i,l),ci(e,r,s,t,n,i,o)}function ui(e){return[new oi(0,e,0)]}let di="";function fi(e,t,n,i,r){var s;let o=i.head-e.from,l=oi.find(t,o,null!==(s=i.bidiLevel)&&void 0!==s?s:-1,i.assoc),a=t[l],c=a.side(r,n);if(o==c){let e=l+=r?1:-1;if(e<0||e>=t.length)return null;a=t[l=e],o=a.side(!r,n),c=a.side(r,n)}let h=ye(e.text,o,a.forward(r,n));(h<a.from||h>a.to)&&(h=c),di=e.text.slice(Math.min(o,h),Math.max(o,h));let u=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return u&&h==c&&u.level+(r?0:1)<a.level?Ne.cursor(u.side(!r,n)+e.from,u.forward(r,n)?1:-1,u.level):Ne.cursor(h+e.from,a.forward(r,n)?-1:1,a.level)}function pi(e,t,n){for(let i=t;i<n;i++){let t=ri(e.charCodeAt(i));if(1==t)return Qn;if(2==t||4==t)return Xn}return Qn}const gi=je.define(),mi=je.define(),Ai=je.define(),vi=je.define(),bi=je.define(),xi=je.define(),yi=je.define(),wi=je.define(),Ci=je.define(),ki=je.define({combine:e=>e.some(e=>e)}),_i=je.define({combine:e=>e.some(e=>e)}),Si=je.define();class Ei{constructor(e,t="nearest",n="nearest",i=5,r=5,s=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=s}map(e){return e.empty?this:new Ei(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Ei(Ne.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ti=ut.define({map:(e,t)=>e.map(t)}),Oi=ut.define();function Mi(e,t,n){let i=e.facet(vi);i.length?i[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Bi=je.define({combine:e=>!e.length||e[0]});let Di=0;const Ri=je.define({combine:e=>e.filter((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0})});class Ii{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Ri.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Ri.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=t||{};return new Ii(Di++,e,n,i,e=>{let t=[];return s&&t.push(Fi.of(t=>{let n=t.plugin(e);return n?s(n):xn.none})),r&&t.push(r(e)),t})}static fromClass(e,t){return Ii.define((t,n)=>new e(t,n),t)}}class Pi{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Mi(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Mi(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){Mi(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Ni=je.define(),Li=je.define(),Fi=je.define(),ji=je.define(),zi=je.define(),Vi=je.define(),Wi=je.define();function Hi(e,t){let n=e.state.facet(Wi);if(!n.length)return n;let i=n.map(t=>t instanceof Function?t(e):t),r=[];return Ot.spans(i,t.from,t.to,{point(){},span(e,n,i,s){let o=e-t.from,l=n-t.from,a=r;for(let e=i.length-1;e>=0;e--,s--){let n,r=i[e].spec.bidiIsolate;if(null==r&&(r=pi(t.text,o,l)),s>0&&a.length&&(n=a[a.length-1]).to==o&&n.direction==r)n.to=l,a=n.inner;else{let e={from:o,to:l,direction:r,inner:[]};a.push(e),a=e.inner}}}}),r}const qi=je.define();function $i(e){let t=0,n=0,i=0,r=0;for(let s of e.state.facet(qi)){let o=s(e);o&&(null!=o.left&&(t=Math.max(t,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:i,bottom:r}}const Ui=je.define();class Ki{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Ki(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let i=0,r=0,s=0;;){let o=i<e.length?e[i].fromB:1e9,l=r<t.length?t[r]:1e9,a=Math.min(o,l);if(1e9==a)break;let c=a+s,h=a,u=c;for(;;)if(r<t.length&&t[r]<=h){let n=t[r+1];r+=2,h=Math.max(h,n);for(let t=i;t<e.length&&e[t].fromB<=h;t++)s=e[t].toA-e[t].toB;u=Math.max(u,n+s)}else{if(!(i<e.length&&e[i].fromB<=h))break;{let t=e[i++];h=Math.max(h,t.toB),u=Math.max(u,t.toA),s=t.toA-t.toB}}n.push(new Ki(c,u,a,h))}return n}}class Gi{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Te.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges((e,t,n,r)=>i.push(new Ki(e,t,n,r))),this.changedRanges=i}static create(e,t,n){return new Gi(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}const Yi=[];class Ji{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return Yi}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;null==t[i]&&e.removeAttribute(i)}for(let n in t){let i=t[n];"style"==n?e.style.cssText=i:e.getAttribute(n)!=i&&e.setAttribute(n,i)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Dn(this.dom),i=this.length?e>0:t>0;return new Yn(this.parent.dom,n+(i?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Zi)return e;return null}static get(e){return e.cmTile}}class Qi extends Ji{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,i=null,r=(null==e?void 0:e.node)==n?e:null,s=0;for(let o of this.children){if(o.sync(e),s+=o.length+o.breakAfter,t=i?i.nextSibling:n.firstChild,r&&t!=o.dom&&(r.written=!0),o.dom.parentNode==n)for(;t&&t!=o.dom;)t=Xi(t);else n.insertBefore(o.dom,t);i=o.dom}for(t=i?i.nextSibling:n.firstChild,r&&t&&(r.written=!0);t;)t=Xi(t);this.length=s}}function Xi(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Zi extends Qi{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Ji.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,r=0;;)if(i==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&r++,i=t.pop()}else{let s=n.children[i++];if(s instanceof er)t.push(i),n=s,i=0;else{let t=r+s.length,n=e(s,r);if(void 0!==n)return n;r=t+s.breakAfter}}}resolveBlock(e,t){let n,i,r=-1,s=-1;if(this.blockTiles((o,l)=>{let a=l+o.length;if(e>=l&&e<=a){if(o.isWidget()&&t>=-1&&t<=1){if(32&o.flags)return!0;16&o.flags&&(n=void 0)}(l<e||e==a&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-l),(a>e||e==l&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,s=e-l)}}),!n&&!i)throw new Error("No tile at position "+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:s}}}class er extends Qi{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new er(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class tr extends Qi{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new tr(t||document.createElement("div"),e);return t&&n||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,r=-1,s=null,o=-1;!function e(l,a){for(let c=0,h=0;c<l.children.length&&h<=a;c++){let u=l.children[c],d=h+u.length;d>=a&&(u.isComposite()?e(u,a-h):(!s||s.isHidden&&(t>0||n&&nr(s,u)))&&(d>a||32&u.flags)?(s=u,o=a-h):(h<a||16&u.flags&&!u.isHidden)&&(i=u,r=a-h)),h=d}}(this,e);let l=(t<0?i:s)||i||s;return l?{tile:l,offset:l==i?r:o}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=Mn(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:i}=n;if(this.dom.contains(e.dom))return e.isText()?new Yn(e.dom,Math.min(e.dom.nodeValue.length,i)):e.domPosFor(i,16&e.flags?1:32&e.flags?-1:t);let r=n.tile.parent,s=!1;for(let e of r.children){if(s)return new Yn(e.dom,0);e==n.tile&&(s=!0)}}return new Yn(this.dom,0)}}function nr(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class ir extends Qi{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new ir(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class rr extends Ji{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let i=e,r=e,s=0;0==e&&t<0||e==n&&t>=0?dn.chrome||dn.gecko||(e?(i--,s=1):r<n&&(r++,s=-1)):t<0?i--:r<n&&r++;let o=qn(this.dom,i,r).getClientRects();if(!o.length)return null;let l=o[(s?s<0:t>=0)?0:o.length-1];return dn.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(o,e=>e.width)||l),s?Nn(l,s<0):l||null}static of(e,t){let n=new rr(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class sr extends Ji{constructor(e,t,n,i){super(e,t,i),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return Nn(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let i=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let r=i?t.length-1:0;n=t[r],!(e>0?0==r:r==t.length-1||n.top<n.bottom);r+=i?-1:1);return Nn(n,!i)}}get overrideDOMText(){if(!this.length)return ue.empty;let{root:e}=this;if(!e)return ue.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,r){return r||(r=e.toDOM(t),e.editable||(r.contentEditable="false")),new sr(r,n,e,i)}}class or extends Ji{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return ue.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class lr{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:r,beforeBreak:s,parents:o}=this;for(;e||t>0;)if(i.isComposite())if(s){if(!e)break;n&&n.break(),e--,s=!1}else if(r==i.children.length){if(!e&&!o.length)break;n&&n.leave(i),s=!!i.breakAfter,({tile:i,index:r}=o.pop()),r++}else{let l=i.children[r],a=l.breakAfter;!(t>0?l.length<=e:l.length<e)||n&&!1===n.skip(l,0,l.length)&&l.isComposite?(o.push({tile:i,index:r}),i=l,r=0,n&&l.isComposite()&&n.enter(l)):(s=!!a,r++,e-=l.length)}else if(r==i.length)s=!!i.breakAfter,({tile:i,index:r}=o.pop()),r++;else{if(!e)break;{let t=Math.min(e,i.length-r);n&&n.skip(i,r,r+t),e-=t,r+=t}}return this.tile=i,this.index=r,this.beforeBreak=s,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class ar{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class cr{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var r;this.flushBuffer();let s=this.ensureMarks(t,n),o=s.lastChild;o&&o.isText()&&!(8&o.flags)&&o.length+e.length<512?(this.cache.reused.set(o,2),(s.children[s.children.length-1]=new rr(o.dom,o.text+e)).parent=s):s.append(i||rr.of(e,null===(r=this.cache.find(rr))||void 0===r?void 0:r.dom)),this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?mr(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],r=i.lastChild;if(r instanceof ir&&r.mark.eq(n.mark))r.dom!=n.dom&&r.setDOM(mr(n.dom)),i=r;else{if(this.cache.reused.get(n)){let e=Ji.get(n.dom);e&&e.setDOM(mr(n.dom))}let e=ir.of(n.mark,n.dom);i.append(e),i=e}this.cache.reused.set(n,2)}let r=Ji.get(e.text);r&&this.cache.reused.set(r,2);let s=new rr(e.text,e.text.nodeValue);s.flags|=8,i.append(s)}addInlineWidget(e,t,n){let i=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);i||this.flushBuffer();let r=this.ensureMarks(t,n);i||16&e.flags||r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=gr);let i=tr.start(e,t||(null===(n=this.cache.find(tr))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let r=e.length-1;r>=0;r--){let s,o=e[r];if(t>0&&(s=i.lastChild)&&s instanceof ir&&s.mark.eq(o))i=s,t--;else{let e=ir.of(o,null===(n=this.cache.find(ir,e=>e.mark.eq(o)))||void 0===n?void 0:n.dom);i.append(e),i=e,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&pr(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||dn.ios&&pr(this.curLine,!0))||this.curLine.append(this.cache.findWidget(vr,0,32)||new sr(vr.toDOM(),0,vr,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new ar(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof er&&i.wrapper.eq(n.wrapper))t=i;else{let i=er.of(n.wrapper,null===(e=this.cache.find(er,e=>e.wrapper.eq(n.wrapper)))||void 0===e?void 0:e.dom);t.append(i),t=i}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(or,void 0,1);return n&&(n.flags=t),n||new or(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class hr{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skipCount);if(this.skipCount=0,i)throw new Error("Ran out of text content when drawing inline views");this.text=t;let r=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,r)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const ur=[sr,tr,rr,ir,or,er,Zi];for(let e=0;e<ur.length;e++)ur[e].bucket=e;class dr{constructor(e){this.view=e,this.buckets=ur.map(()=>[]),this.index=ur.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,r=this.buckets[i],s=this.index[i];for(let e=r.length-1;e>=0;e--){let o=(e+s)%r.length,l=r[o];if((!t||t(l))&&!this.reused.has(l))return r.splice(o,1),o<s&&this.index[i]--,this.reused.set(l,n),l}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let r=0,s=0;;r++){if(r==i.length){if(s)return null;s=1,r=0}let o=i[r];if(!this.reused.has(o)&&(0==s?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view)))return i.splice(r,1),r<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(497&o.flags)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new sr(o.dom,t,e,-498&o.flags|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class fr{constructor(e,t,n,i,r){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new dr(e),this.text=new hr(e.state.doc),this.builder=new cr(this.cache,new Zi(e,e.contentDOM),Ot.iter(n)),this.cache.reused.set(t,2),this.old=new lr(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,r=0,s=0;;){let o=s<e.length?e[s++]:null,l=o?o.fromA:this.old.root.length;if(l>i){let e=l-i;this.preserve(e,!s,!o),i=l,r+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(r,o.toB)),r=o.toB,i=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let i=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;i instanceof ir&&t.push(i.mark)}return t}(this.old),r=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let s=n>0||t<e.length?sr.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&s.flags?(s.flags&=-2,this.builder.addBlockWidget(s)):(this.builder.ensureLine(null),this.builder.addInlineWidget(s,i,r),r=i.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length||this.cache.reused.has(e)?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),i,r)):this.builder.addText(e.text,i,r,this.cache.reuse(e)),r=i.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof or)this.cache.add(e);else{if(!(e instanceof ir))return!1;this.builder.ensureLine(null),this.builder.addMark(e,i,r),this.cache.reused.set(e,1),r=i.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof ir&&i.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?i.length&&(i.length=r=0):e instanceof ir&&(i.shift(),r=Math.min(r,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,r=0,s=Ot.spans(this.decorations,e,t,{point:(e,t,s,o,l,a)=>{if(s instanceof Cn){if(this.disallowBlockEffectsFor[a]){if(s.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=o.length,l>o.length)i.continueWidget(t-e);else{let r=s.widget||(s.block?Ar.block:Ar.inline),a=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}(s),c=this.cache.findWidget(r,t-e,a)||sr.of(r,this.view,t-e,a);s.block?(s.startSide>0&&i.addLineStartIfNotCovered(n),i.addBlockWidget(c)):(i.ensureLine(n),i.addInlineWidget(c,o,l))}n=null}else n=function(e,t){let n=t.spec.attributes,i=t.spec.class;return n||i?(e||(e={class:"cm-line"}),n&&fn(n,e),i&&(e.class+=" "+i),e):e}(n,s);t>e&&this.text.skip(t-e)},span:(e,t,r,s)=>{for(let o=e;o<t;){let l=this.text.next(Math.min(512,t-o));null==l?(i.addLineStartIfNotCovered(n),i.addBreak(),o++):(i.ensureLine(n),i.addText(l,r,o==e?s:r.length),o+=l.length),n=null}}});i.addLineStartIfNotCovered(n),this.openWidget=s>r,this.openMarks=s}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let e=Ji.get(i);if(i==this.view.contentDOM)break;e instanceof ir?t.push(e):(null==e?void 0:e.isLine())?n=e:e instanceof er||("DIV"!=i.nodeName||n||i==this.view.contentDOM?n||t.push(ir.of(new yn({tagName:i.nodeName.toLowerCase(),attributes:An(i)}),i)):n=new tr(i,gr))}return{line:n,marks:t}}}function pr(e,t){let n=e=>{for(let i of e.children)if((t?i.isText():i.length)||n(i))return!0;return!1};return n(e)}const gr={class:"cm-line"};function mr(e){let t=Ji.get(e);return t&&t.setDOM(e.cloneNode()),e}class Ar extends vn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ar.inline=new Ar("span"),Ar.block=new Ar("div");const vr=new class extends vn{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class br{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=xn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Zi(e,e.contentDOM),this.updateInner([new Ki(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges((e,i)=>{e<t.to&&i>t.from&&(n=!0)}),n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let r=i>-1?function(e,t,n){let i=yr(e,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(e.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc;return{range:new Ki(a.mapPos(s),a.mapPos(o),s,o),text:r}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:i}=this.hasComposition;n=new Ki(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(dn.ie||dn.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,o=this.blockWrappers;this.updateDeco();let l=function(e,t,n){let i=new wr;return Ot.compare(e,t,n,i),i.changes}(s,this.decorations,e.changes);l.length&&(n=Ki.extendWithRanges(n,l));let a=function(e,t,n){let i=new Cr;return Ot.compare(e,t,n,i),i.changes}(o,this.blockWrappers,e.changes);return a.length&&(n=Ki.extendWithRanges(n,a)),r&&!n.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(n=r.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length||(this.updateInner(n,r),e.transactions.length&&(this.lastUpdate=Date.now()),0))}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,i=new fr(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Ji.get(t.text)&&i.cache.reused.set(Ji.get(t.text),2),this.tile=i.run(e,t),xr(n,i.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=dn.chrome||dn.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),!i||!i.written&&n.selectionRange.focusNode==i.node&&this.tile.dom.contains(i.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof kr&&i.push(e.dom);n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Oi)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,r=i==n,s=!r&&!(this.view.state.facet(Bi)||n.tabIndex>-1)&&On(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(r||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l,a,c=this.view.state.selection.main;if(c.empty?a=l=this.inlineDOMNearPos(c.anchor,c.assoc||1):(a=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),l=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),dn.gecko&&c.empty&&!this.hasComposition&&1==(h=l).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(e,l.node.childNodes[l.offset]||null)),l=a=new Yn(e,0),o=!0}var h;let u=this.view.observer.selectionRange;!o&&u.focusNode&&(Bn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Bn(a.node,a.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,c))||(this.view.observer.ignore(()=>{dn.android&&dn.chrome&&n.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=En(this.view.root);if(e)if(c.empty){if(dn.gecko){let e=(t=l.node,r=l.offset,1!=t.nodeType?0:(r&&"false"==t.childNodes[r-1].contentEditable?1:0)|(r<t.childNodes.length&&"false"==t.childNodes[r].contentEditable?2:0));if(e&&3!=e){let t=(1==e?Kn:Gn)(l.node,l.offset);t&&(l=new Yn(t.node,t.offset))}}e.collapse(l.node,l.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(l.node,l.offset);try{e.extend(a.node,a.offset)}catch(e){}}else{let t=document.createRange();c.anchor>c.head&&([l,a]=[a,l]),t.setEnd(a.node,a.offset),t.setStart(l.node,l.offset),e.removeAllRanges(),e.addRange(t)}var t,r;s&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new Yn(u.anchorNode,u.anchorOffset),this.impreciseHead=a.precise?null:new Yn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Bn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=En(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let s=this.lineAt(t.head,t.assoc);if(!s)return;let o=s.posAtStart;if(t.head==o||t.head==o+s.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,r)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let i=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?i+t:i+(t?n.length:0):i;{let r;if(e==n.dom)r=n.dom.childNodes[t];else{let i=0==Pn(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}r=i<0?e:e.nextSibling}if(r==n.dom.firstChild)return i;for(;r&&!Ji.get(r);)r=r.nextSibling;if(!r)return i+n.length;for(let e=0,t=i;;e++){let i=n.children[e];if(i.dom==r)return t;t+=i.length+i.breakAfter}}}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i,r=-1,s=!1,o=-1,l=!1;return this.tile.blockTiles((t,a)=>{if(t.isWidget()){if(32&t.flags&&a>=e)return!0;16&t.flags&&(s=!0)}else{let c=a+t.length;if(a<=e&&(n=t,r=e-a,s=c<e),c>=e&&!i&&(i=t,o=e-a,l=a>e),a>e&&i)return!0}}),n||i?(s&&i?n=null:l&&n&&(i=null),n&&t<0||!i?n.domIn(r,t):i.domIn(o,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof kr?null:n.coordsInWidget(i,t,!0):n.coordsIn(i,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,n){if(t.isComposite())for(let i of t.children){if(i.length>=n){let t=e(i,n);if(t)return t}if((n-=i.length)<0)break}else if(t.isText()&&n<t.length){let e=ye(t.text,n);if(e==n)return null;let i=qn(t.dom,n,e).getClientRects();for(let e=0;e<i.length;e++){let t=i[e];if(e==i.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n):null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,s=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Jn.LTR,a=0,c=(e,h,u)=>{for(let d=0;d<e.children.length&&!(h>i);d++){let i=e.children[d],f=h+i.length,p=i.dom.getBoundingClientRect(),{height:g}=p;if(u&&!d&&(a+=p.top-u.top),i instanceof er)f>n&&c(i,h,p);else if(h>=n&&(a>0&&t.push(-a),t.push(g+a),a=0,s)){let e=i.dom.lastChild,t=e?Mn(e):[];if(t.length){let e=t[t.length-1],n=l?e.right-p.left:p.right-e.left;n>o&&(o=n,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=f)}}u&&d==e.children.length-1&&(a+=u.bottom-p.bottom),h=f+i.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?Jn.RTL:Jn.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let i of e.children){if(!i.isText()||/[^ -~]/.test(i.text))return;let e=Mn(i.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}});if(e)return e;let t,n,i,r=document.createElement("div");return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(r);let e=Mn(r.firstChild)[0];t=r.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,i=e&&e.height?e.height:t,r.remove()}),{lineHeight:t,charWidth:n,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],s=r?r.from-1:this.view.state.doc.length;if(s>n){let i=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(xn.replace({widget:new kr(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return xn.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Fi).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,i=this.view.state.facet(zi).map((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e});for(i.length&&(this.dynamicDecorationMap[e++]=n,t.push(Ot.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(ji).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(Si))try{if(t(this.view,e.range,e))return!0}catch(e){Mi(this.view.state,e,"scroll handler")}let t,{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let r=$i(this.view),s={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:o,offsetHeight:l}=this.view.scrollDOM;if(function(e,t,n,i,r,s,o,l){let a=e.ownerDocument,c=a.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==a.body,f=1,p=1;if(d)e=Ln(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:f,scaleY:p}=Fn(h,t)),e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*p}}let g=0,m=0;if("nearest"==r)t.top<e.top?(m=t.top-(e.top+o),n>0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+o)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+o,n<0&&t.top-m<e.top&&(m=t.top-(e.top+o)));else{let i=t.bottom-t.top,s=e.bottom-e.top;m=("center"==r&&i<=s?t.top+i/2-s/2:"start"==r||"center"==r&&n<0?t.top-o:t.bottom-s+o)-e.top}if("nearest"==i?t.left<e.left?(g=t.left-(e.left+s),n>0&&t.right>e.right+g&&(g=t.right-e.right+s)):t.right>e.right&&(g=t.right-e.right+s,n<0&&t.left<e.left+g&&(g=t.left-(e.left+s))):g=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==l?t.left-s:t.right-(e.right-e.left)+s)-e.left,g||m)if(d)c.scrollBy(g,m);else{let e=0,n=0;if(m){let e=h.scrollTop;h.scrollTop+=m/p,n=(h.scrollTop-e)*p}if(g){let t=h.scrollLeft;h.scrollLeft+=g/f,e=(h.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-g)<1&&(i="nearest"),n&&Math.abs(n-m)<1&&(r="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,s,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Jn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(n.head,1);e&&e.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){xr(this.tile)}}function xr(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)xr(n,t)}}function yr(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=Kn(n.focusNode,n.focusOffset),r=Gn(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let t=Ji.get(r.node);if(!t||t.isText()&&t.text!=r.node.nodeValue)s=r;else if(e.docView.lastCompositionAfterCursor){let e=Ji.get(i.node);!e||e.isText()&&e.text!=i.node.nodeValue||(s=r)}}if(e.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=t-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}let wr=class{constructor(){this.changes=[]}compareRange(e,t){_n(e,t,this.changes)}comparePoint(e,t){_n(e,t,this.changes)}boundChange(e){_n(e,e,this.changes)}};class Cr{constructor(){this.changes=[]}compareRange(e,t){_n(e,t,this.changes)}comparePoint(){}boundChange(e){_n(e,e,this.changes)}}class kr extends vn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function _r(e,t,n,i){let r=e.state.doc.lineAt(t.head),s=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let l=t,a=null;;){let t=fi(r,s,o,l,n),c=di;if(!t){if(r.number==(n?e.state.doc.lines:1))return l;c="\n",r=e.state.doc.line(r.number+(n?1:-1)),s=e.bidiSpans(r),t=e.visualLineSide(r,!n)}if(a){if(!a(c))return l}else{if(!i)return t;a=i(c)}l=t}}function Sr(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,(e,r,s)=>{if(t>e&&t<r){let s=i||n||(t-e<r-t?-1:1);t=s<0?e:r,i=s}});if(!i)return t}}function Er(e,t){let n=null;for(let i=0;i<t.ranges.length;i++){let r=t.ranges[i],s=null;if(r.empty){let t=Sr(e,r.from,0);t!=r.from&&(s=Ne.cursor(t,-1))}else{let t=Sr(e,r.from,-1),n=Sr(e,r.to,1);t==r.from&&n==r.to||(s=Ne.range(r.from==r.anchor?t:n,r.from==r.head?t:n))}s&&(n||(n=t.ranges.slice()),n[i]=s)}return n?Ne.create(n,t.mainIndex):t}function Tr(e,t,n){let i=Sr(e.state.facet(Vi).map(t=>t(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:Ne.cursor(i,i<n.from?1:-1)}class Or{constructor(e,t){this.pos=e,this.assoc=t}}function Mr(e,t,n,i){let r,s=e.contentDOM.getBoundingClientRect(),o=s.top+e.viewState.paddingTop,{x:l,y:a}=t,c=a-o;for(;;){if(c<0)return new Or(0,1);if(c>e.viewState.docHeight)return new Or(e.state.doc.length,-1);if(r=e.elementAtHeight(c),null==i)break;if(r.type==bn.Text){if(i<0?r.to<e.viewport.from:r.from>e.viewport.to)break;let t=e.docView.coordsAt(i<0?r.from:r.to,i>0?-1:1);if(t&&(i<0?t.top<=c+o:t.bottom>=c+o))break}let t=e.viewState.heightOracle.textHeight/2;c=i>0?r.bottom+t:r.top-t}if(e.viewport.from>=r.to||e.viewport.to<=r.from){if(n)return null;if(r.type==bn.Text){let t=function(e,t,n,i,r){let s=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;s+=Math.floor((r-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+function(e,t,n){for(let i=0,r=0;;){if(r>=t)return i;if(i==e.length)break;r+=9==e.charCodeAt(i)?n-r%n:1,i=ye(e,i)}return e.length}(o,s,e.state.tabSize)}(e,s,r,l,a);return new Or(t,t==r.from?1:-1)}}if(r.type!=bn.Text)return c<(r.top+r.bottom)/2?new Or(r.from,1):new Or(r.to,-1);let h=e.docView.lineAt(r.from,2);return h&&h.length==r.length||(h=e.docView.lineAt(r.from,-2)),new Br(e,l,a,e.textDirectionAt(r.from)).scanTile(h,r.from)}class Br{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oi.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[oi.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t){let n,i,r,s=0,o=e.length-1,l=new Set,a=this.bidiIn(e[0],e[o]),c=-1,h=1e9;e:for(;s<o;){let u=o-s,d=s+o>>1;t:if(l.has(d)){let e=s+Math.floor(Math.random()*u);for(let t=0;t<u;t++){if(!l.has(e)){d=e;break t}e++,e==o&&(e=s)}break e}l.add(d);let f=t(d);if(f)for(let t=0;t<f.length;t++){let l=f[t],u=0;if(l.bottom<this.y)(!n||n.bottom<l.bottom)&&(n=l),u=1;else if(l.top>this.y)(!i||i.top>l.top)&&(i=l),u=-1;else{let e=l.left>this.x?this.x-l.left:l.right<this.x?this.x-l.right:0,t=Math.abs(e);t<h&&(c=d,h=t,r=l),e&&(u=e<0==(this.baseDir==Jn.LTR)?-1:1)}-1!=u||a&&!this.baseDirAt(e[d],1)?1!=u||a&&!this.baseDirAt(e[d+1],-1)||(s=d+1):o=d}}if(!r){let r=n&&(!i||this.y-n.bottom<i.top-this.y)?n:i;return this.y=(r.top+r.bottom)/2,this.scan(e,t)}let u=(a?this.dirAt(e[c],1):this.baseDir)==Jn.LTR;return{i:c,after:this.x>(r.left+r.right)/2==u}}scanText(e,t){let n=[];for(let i=0;i<e.length;i=ye(e.text,i))n.push(t+i);n.push(t+e.length);let i=this.scan(n,i=>{let r=n[i]-t,s=n[i+1]-t;return qn(e.dom,r,s).getClientRects()});return i.after?new Or(n[i.i+1],-1):new Or(n[i.i],1)}scanTile(e,t){if(!e.length)return new Or(t,1);if(1==e.children.length){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let i=0,r=t;i<e.children.length;i++)n.push(r+=e.children[i].length);let i=this.scan(n,t=>{let n=e.children[t];return 48&n.flags?null:(1==n.dom.nodeType?n.dom:qn(n.dom,0,n.length)).getClientRects()}),r=e.children[i.i],s=n[i.i];return r.isText()?this.scanText(r,s):r.isComposite()?this.scanTile(r,s):i.after?new Or(n[i.i+1],-1):new Or(s,1)}}const Dr="";class Rr{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(wt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Dr}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let r=Ji.get(i),s=i.nextSibling;if(s==t){(null==r?void 0:r.breakAfter)&&!s&&n!=this.view.contentDOM&&this.lineBreak();break}let o=Ji.get(s);(r&&o?r.breakAfter:(r?r.breakAfter:Rn(i))||Rn(s)&&("BR"!=i.nodeName||(null==r?void 0:r.isWidget()))&&this.text.length>e)&&!Pr(s,t)&&this.lineBreak(),i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(r=i.exec(t))&&(s=r.index,o=r[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=s+o}}readNode(e){let t=Ji.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Ir(e,n.node,n.offset)?t:0))}}function Ir(e,t,n){for(;;){if(!t||n<Pn(t))return!1;if(t==e)return!0;n=Dn(t)+1,t=t.parentNode}}function Pr(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=Ji.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class Nr{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Lr{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Fr(e.docView.tile,t,n,0))){let t=r||s?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=e.observer.selectionRange;return n&&(t.push(new Nr(n,i)),r==n&&s==i||t.push(new Nr(r,s))),t}(e),n=new Rr(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?Ne.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!Tn(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=s&&s.node==t.anchorNode&&s.offset==t.anchorOffset||!Tn(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),o=e.viewport;if((dn.ios||dn.chrome)&&e.state.selection.main.empty&&n!=i&&(o.from>0||o.to<e.state.doc.length)){let t=Math.min(n,i),r=Math.max(n,i),s=o.from-t,l=o.to-r;0!=s&&1!=s&&0!=t||0!=l&&-1!=l&&r!=e.state.doc.length||(n=0,i=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ne.range(i,n)):this.newSel=Ne.single(i,n)}}}function Fr(e,t,n,i){if(e.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let a=0,c=i,h=i;a<e.children.length;a++){let i=e.children[a],u=c+i.length;if(c<t&&u>n)return Fr(i,t,n,c);if(u>=t&&-1==r&&(r=a,s=c),c>n&&i.dom.parentNode==e.dom){o=a,l=h;break}h=u,c=u+i.breakAfter}return{from:s,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function jr(e,t){let n,{newSel:i}=t,{state:r}=e,s=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:i}=t.bounds,l=s.from,a=null;(8===o||dn.android&&t.text.length<i-e)&&(l=s.to,a="end");let c,h,u=r.doc.sliceString(e,i,Dr);!s.empty&&s.from>=e&&s.to<=i&&(t.typeOver||u!=t.text)&&u.slice(0,s.from-e)==t.text.slice(0,s.from-e)&&u.slice(s.to-e)==t.text.slice(c=t.text.length-(u.length-(s.to-e)))?n={from:s.from,to:s.to,insert:ue.of(t.text.slice(s.from-e,c).split(Dr))}:(h=Vr(u,t.text,l-e,a))&&(dn.chrome&&13==o&&h.toB==h.from+2&&t.text.slice(h.from,h.toB)==Dr+Dr&&h.toB--,n={from:e+h.from,to:e+h.toA,insert:ue.of(t.text.slice(h.from,h.toB).split(Dr))})}else i&&(!e.hasFocus&&r.facet(Bi)||Wr(i,s))&&(i=null);if(!n&&!i)return!1;if((dn.mac||dn.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Ne.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:ue.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).to<s.to&&e.docView.lineHasWidget(s.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:r.toText(e.inputState.insertingText)}:dn.chrome&&n&&n.from==n.to&&n.from==s.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Ne.single(i.main.anchor-1,i.main.head-1)),n={from:s.from,to:s.to,insert:ue.of([" "])}),n)return zr(e,n,i,o);if(i&&!Wr(i,s)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(i=Er(r.facet(Vi).map(t=>t(e)),i))),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}function zr(e,t,n,i=-1){if(dn.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(dn.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&" "==e.state.sliceDoc(t.from,r.from))&&1==t.insert.length&&2==t.insert.lines&&$n(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&0==t.insert.length||8==i&&t.insert.length<t.to-t.from&&t.to>r.head)&&$n(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&0==t.insert.length&&$n(e.contentDOM,"Delete",46)))return!0;let s,o=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>s||(s=function(e,t,n){let i,r=e.state,s=r.selection.main,o=-1;if(t.from==t.to&&t.from<s.from||t.from>s.to){let n=t.from<s.from?-1:1,i=n<0?s.from:s.to,l=Sr(r.facet(Vi).map(t=>t(e)),i,n);t.from==l&&(o=l)}if(o>-1)i={changes:t,selection:Ne.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=s.from<t.from?r.sliceDoc(s.from,t.from):"",o=s.to>t.to?r.sliceDoc(t.to,s.to):"";i=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=r.changes(t),l=n&&n.main.to<=o.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let a,c=e.state.sliceDoc(t.from,t.to),h=n&&yr(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);a={from:h.from,to:h.to-e}}else a=e.state.doc.lineAt(s.head);let u=s.to-t.to;i=r.changeByRange(n=>{if(n.from==s.from&&n.to==s.to)return{changes:o,range:l||n.map(o)};let i=n.to-u,h=i-c.length;if(e.state.sliceDoc(h,i)!=c||i>=a.from&&h<=a.to)return{range:n};let d=r.changes({from:h,to:i,insert:t.insert}),f=n.to-s.to;return{changes:d,range:l?Ne.range(Math.max(0,l.anchor+f),Math.max(0,l.head+f)):n.map(d)}})}else i={changes:o,selection:l&&r.selection.replaceRange(l)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}(e,t,n));return e.state.facet(xi).some(n=>n(e,t.from,t.to,o,l))||e.dispatch(l()),!0}function Vr(e,t,n,i){let r=Math.min(e.length,t.length),s=0;for(;s<r&&e.charCodeAt(s)==t.charCodeAt(s);)s++;if(s==r&&e.length==t.length)return null;let o=e.length,l=t.length;for(;o>0&&l>0&&e.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;return"end"==i&&(n-=o+Math.max(0,s-Math.min(o,l))-s),o<s&&e.length<t.length?(s-=n<=s&&n>=o?s-n:0,l=s+(l-o),o=s):l<s&&(s-=n<=s&&n>=l?s-n:0,o=s+(o-l),l=s),{from:s,toA:o,toB:l}}function Wr(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Hr{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,dn.safari&&e.contentDOM.addEventListener("input",()=>null),dn.gecko&&function(e){fs.has(e)||(fs.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=Ji.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=$r(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,s=n[e];s&&r!=!s.handlers.length&&(i.removeEventListener(e,this.handleEvent),s=null),s||i.addEventListener(e,this.handleEvent,{passive:r})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Gr.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),dn.android&&dn.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!dn.ios||e.synthetic||e.altKey||e.metaKey||!((t=Ur.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||Kr.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,$n(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(dn.safari&&!dn.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function qr(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){Mi(n.state,e)}}}function $r(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,i=e&&e.plugin.domEventHandlers,r=e&&e.plugin.domEventObservers;if(i)for(let e in i){let r=i[e];r&&n(e).handlers.push(qr(t.value,r))}if(r)for(let e in r){let i=r[e];i&&n(e).observers.push(qr(t.value,i))}}for(let e in Qr)n(e).handlers.push(Qr[e]);for(let e in Xr)n(e).observers.push(Xr[e]);return t}const Ur=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Kr="dthko",Gr=[16,17,18,20,91,92,224,225];function Yr(e){return.7*Math.max(0,e)+8}class Jr{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=jn(e.contentDOM),this.atoms=e.state.facet(Vi).map(t=>t(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(wt.allowMultipleSelections)&&function(e,t){let n=e.state.facet(gi);return n.length?n[0](t):dn.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=En(e.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let e=0;e<r.length;e++){let n=r[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=ls(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let i=0,r=0,s=0,o=0,l=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let c=$i(this.view);e.clientX-c.left<=s+6?i=-Yr(s-e.clientX):e.clientX+c.right>=l-6&&(i=Yr(e.clientX-l)),e.clientY-c.top<=o+6?r=-Yr(o-e.clientY):e.clientY+c.bottom>=a-6&&(r=Yr(e.clientY-a)),this.setScrollSpeed(i,r)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Er(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const Qr=Object.create(null),Xr=Object.create(null),Zr=dn.ie&&dn.ie_version<15||dn.ios&&dn.webkit_version<604;function es(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function ts(e,t){t=es(e.state,wi,t);let n,{state:i}=e,r=1,s=i.toText(t),o=s.lines==i.selection.ranges.length;if(null!=cs&&i.selection.ranges.every(e=>e.empty)&&cs==s.toString()){let e=-1;n=i.changeByRange(n=>{let l=i.doc.lineAt(n.from);if(l.from==e)return{range:n};e=l.from;let a=i.toText((o?s.line(r++).text:t)+i.lineBreak);return{changes:{from:l.from,insert:a},range:Ne.cursor(n.from+a.length)}})}else n=o?i.changeByRange(e=>{let t=s.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Ne.cursor(e.from+t.length)}}):i.replaceSelection(s);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function ns(e,t,n,i){if(1==i)return Ne.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),s=t-r.from;if(0==r.length)return Ne.cursor(t);0==s?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=ye(r.text,s,!1):l=ye(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let e=ye(r.text,o,!1);if(i(r.text.slice(e,o))!=a)break;o=e}for(;l<r.length;){let e=ye(r.text,l);if(i(r.text.slice(l,e))!=a)break;l=e}return Ne.range(o+r.from,l+r.from)}(e.state,t,n);{let i=e.docView.lineAt(t,n),r=e.state.doc.lineAt(i?i.posAtEnd:t),s=i?i.posAtStart:r.from,o=i?i.posAtEnd:r.to;return o<e.state.doc.length&&o==r.to&&o++,Ne.range(s,o)}}Xr.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Xr.wheel=Xr.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},Qr.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),Xr.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},Xr.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Qr.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(Ai))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=ls(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,s,o){let l,a=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=ns(e,a.pos,a.assoc,i);if(n.pos!=a.pos&&!s){let t=ns(e,n.pos,n.assoc,i),r=Math.min(t.from,c.from),s=Math.max(t.to,c.to);c=r<c.from?Ne.range(r,s):Ne.range(s,r)}return s?r.replaceRange(r.main.extend(c.from,c.to)):o&&1==i&&r.ranges.length>1&&(l=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:r}=e.ranges[n];if(i<=t&&r>=t)return Ne.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(r,a.pos))?l:o?r.addRange(c):Ne.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new Jr(e,t,n,i)),i&&e.observer.ignore(()=>{Hn(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const is=dn.ie&&dn.ie_version<=11;let rs=null,ss=0,os=0;function ls(e){if(!is)return e.detail;let t=rs,n=os;return rs=e,os=Date.now(),ss=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(ss+1)%3:1}function as(e,t,n,i){if(!(n=es(e.state,wi,n)))return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,o=i&&s&&function(e,t){let n=e.state.facet(mi);return n.length?n[0](t):dn.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:s.from,to:s.to}:null,l={from:r,insert:n},a=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Qr.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.tile.nearest(t.target);if(i&&i.isWidget()){let e=i.posAtStart,t=e+i.length;(e>=n.to||t<=n.from)&&(n=Ne.range(e,t))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",es(e.state,Ci,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Qr.dragend=e=>(e.inputState.draggedContent=null,!1),Qr.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&as(e,t,i.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=s,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),s()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return as(e,t,n,!0),!0}return!1},Qr.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Zr?null:t.clipboardData;return n?(ts(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),ts(e,n.value)},50)}(e),!1)};let cs=null;Qr.copy=Qr.cut=(e,t)=>{if(!On(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let s=e.doc.lineAt(i);s.number>r&&(t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)})),r=s.number}i=!0}return{text:es(e,Ci,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!r)return!1;cs=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Zr?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}(e,n),!1)};const hs=at.define();function us(e,t){let n=[];for(let i of e.facet(yi)){let r=i(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:hs.of(!0)}):null}function ds(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=us(e.state,t);n?e.dispatch(n):e.update([])}},10)}Xr.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),ds(e)},Xr.blur=e=>{e.observer.clearSelectionRange(),ds(e)},Xr.compositionstart=Xr.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},Xr.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,dn.chrome&&dn.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},Xr.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Qr.beforeinput=(e,t)=>{var n,i;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),r=t.getTargetRanges();if(i&&r.length){let t=r[0],n=e.posAtDOM(t.startContainer,t.startOffset),s=e.posAtDOM(t.endContainer,t.endOffset);return zr(e,{from:n,to:s,insert:e.state.toText(i)},null),!0}}let r;if(dn.chrome&&dn.android&&(r=Ur.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return dn.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),dn.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>Xr.compositionend(e,t),20),!1};const fs=new Set,ps=["pre-wrap","normal","pre-line","break-spaces"];let gs=!1;function ms(){gs=!1}class As{constructor(e){this.lineWrapping=e,this.doc=ue.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ps.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(t=!0,this.heightSamples[Math.floor(10*i)]=!0)}return t}refresh(e,t,n,i,r,s){let o=ps.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let e=0;e<s.length;e++){let t=s[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return l}}class vs{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class bs{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return"number"==typeof this._content?bn.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Cn?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new bs(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var xs=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(xs||(xs={}));const ys=.001;class ws{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>ys&&(gs=!0),this.height=e)}replace(e,t,n){return ws.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,s=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:c,toB:h}=i[o],u=r.lineAt(l,xs.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=a?u:r.lineAt(a,xs.ByPosNoHeight,n,0,0);for(h+=d.to-a,a=d.to;o>0&&u.from<=i[o-1].toA;)l=i[o-1].fromA,c=i[o-1].fromB,o--,l<u.from&&(u=r.lineAt(l,xs.ByPosNoHeight,n,0,0));c+=u.from-l,l=u.from;let f=Ms.build(n.setDoc(s),e,c,h);r=Cs(r,r.replace(l,a,f))}return r.updateHeight(n,0)}static empty(){return new Ss(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>2*r){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,r-=t.size}}else if(i<r){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(r+=t.size)}let s=0;return null==e[t-1]?(s=1,t--):null==e[t]&&(s=1,n++),new Ts(ws.of(e.slice(0,t)),s,ws.of(e.slice(n)))}}function Cs(e,t){return e==t?e:(e.constructor!=t.constructor&&(gs=!0),t)}ws.prototype.size=1;const ks=xn.replace({});class _s extends ws{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new bs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new bs(i,0,n,this.spaceAbove,ks):this.mainBlock(n,i)}lineAt(e,t,n,i,r){let s=this.mainBlock(i,r);return this.spaceAbove?this.blockAt(0,n,i,r).join(s):s}forEachLine(e,t,n,i,r,s){e<=r+this.length&&t>=r&&s(this.lineAt(0,xs.ByPos,n,i,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ss extends _s{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new bs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof Ss||i instanceof Es&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Es?i=new Ss(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):ws.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Es extends ws{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*s);n=t/s,this.length>s+1&&(o=(this.height-t)/(this.length-s-1))}else n=this.height/s;return{firstLine:i,lastLine:r,perLine:n,perChar:o}}blockAt(e,t,n,i){let{firstLine:r,lastLine:s,perLine:o,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let r=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),s=t.doc.lineAt(r),a=o+s.length*l,c=Math.max(n,e-a/2);return new bs(s.from,s.length,c,a,0)}{let i=Math.max(0,Math.min(s-r,Math.floor((e-n)/o))),{from:l,length:a}=t.doc.line(r+i);return new bs(l,a,n+o*i,o,0)}}lineAt(e,t,n,i,r){if(t==xs.ByHeight)return this.blockAt(e,n,i,r);if(t==xs.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new bs(t,i-t,0,0,0)}let{firstLine:s,perLine:o,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(e),c=o+a.length*l,h=a.number-s,u=i+o*h+l*(a.from-r-h);return new bs(a.from,a.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,r,s){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-o;h+=l*n+a*(e-r-n)}let i=l+a*t.length;s(new bs(t.from,t.length,h,i,0)),h+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof Es?n[n.length-1]=new Es(e.length+i):n.push(null,new Es(i-1))}if(e>0){let t=n[0];t instanceof Es?n[0]=new Es(e+t.length):n.unshift(new Es(e-1),null)}return ws.of(n)}decomposeLeft(e,t){t.push(new Es(e-1),null)}decomposeRight(e,t){t.push(null,new Es(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],s=Math.max(t,i.from),o=-1;for(i.from>t&&n.push(new Es(i.from-t-1).updateHeight(e,t));s<=r&&i.more;){let t=e.doc.lineAt(s).length;n.length&&n.push(null);let r=i.heights[i.index++],l=0;r<0&&(l=-r,r=i.heights[i.index++]),-1==o?o=r:Math.abs(r-o)>=ys&&(o=-2);let a=new Ss(t,r,l);a.outdated=!1,n.push(a),s+=t+1}s<=r&&n.push(null,new Es(r-s).updateHeight(e,s));let l=ws.of(n);return(o<0||Math.abs(l.height-this.height)>=ys||Math.abs(o-this.heightMetrics(e,t).perLine)>=ys)&&(gs=!0),Cs(this,l)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Ts extends ws{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let s=i+this.left.height,o=r+this.left.length+this.break,l=t==xs.ByHeight?e<s:e<o,a=l?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,s,o);if(this.break||(l?a.to<o:a.from>o))return a;let c=t==xs.ByPosNoHeight?xs.ByPosNoHeight:xs.ByPos;return l?a.join(this.right.lineAt(o,c,n,s,o)):this.left.lineAt(o,c,n,i,r).join(a)}forEachLine(e,t,n,i,r,s){let o=i+this.left.height,l=r+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,i,r,s),t>=l&&this.right.forEachLine(e,t,n,o,l,s);else{let a=this.lineAt(l,xs.ByPos,n,i,r);e<a.from&&this.left.forEachLine(e,a.from-1,n,i,r,s),a.to>=e&&a.from<=t&&s(a),t>a.to&&this.right.forEachLine(a.to+1,t,n,o,l,s)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];e>0&&this.decomposeLeft(e,r);let s=r.length;for(let e of n)r.push(e);if(e>0&&Os(r,s-1),t<this.length){let e=r.length;this.decomposeRight(t,r),Os(r,e)}return ws.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ws.of(this.break?[e,null,t]:[e,t]):(this.left=Cs(this.left,e),this.right=Cs(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:r,right:s}=this,o=t+r.length+this.break,l=null;return i&&i.from<=t+r.length&&i.more?l=r=r.updateHeight(e,t,n,i):r.updateHeight(e,t,n),i&&i.from<=o+s.length&&i.more?l=s=s.updateHeight(e,o,n,i):s.updateHeight(e,o,n),l?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Os(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof Es&&(i=e[t+1])instanceof Es&&e.splice(t-1,3,new Es(n.length+1+i.length))}class Ms{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ss?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Ss(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let s=t-e;n.block?this.addBlock(new _s(s,i,n)):(s||r||i>=5)&&this.addLineDeco(i,r,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Ss(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Es(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ss)return e;let t=new Ss(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Ss||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new Ss(0,-1,0));let n=e;for(let e of this.nodes)e instanceof Ss&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,i){let r=new Ms(n,e);return Ot.spans(t,n,i,r,0),r.finish(n)}}class Bs{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&_n(e,t,this.changes,5)}}function Ds(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,r=i.defaultView||window,s=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=i.body;)if(1==t.nodeType){let n=t,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();s=Math.max(s,i.left),o=Math.min(o,i.right),l=Math.max(l,i.top),a=Math.min(t==e.parentNode?r.innerHeight:a,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}}function Rs(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Is{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return xn.replace({widget:new Ps(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Ps extends vn{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ns{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=zs,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Jn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Li).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new As(n),this.stateDeco=Vs(t),this.heightMap=ws.empty().applyChanges(this.stateDeco,ue.empty,this.heightOracle.setDoc(t.doc),[new Ki(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=xn.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>i>=e&&i<=t)){let{from:t,to:n}=this.lineBlockAt(i);e.push(new Ls(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?zs:new Ws(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Hs(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Vs(this.state);let i=e.changedRanges,r=Ki.extendWithRanges(i,function(e,t,n){let i=new Bs;return Ot.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:Te.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);ms(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=s||gs)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let a=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(a||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(_i)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Jn.RTL:Jn.LTR;let s=this.heightOracle.mustRefreshForWrapping(r)||"refresh"===this.mustMeasureContent,o=t.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let a=0,c=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=Fn(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,a|=16,s=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,a|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,a|=16);let d=jn(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let f=this.getScrollOffset();this.scrollOffset!=f&&(this.scrollAnchorHeight=-1,this.scrollOffset=f),this.scrolledToBottom=Un(this.scrollParent||e.win);let p=(this.printing?Rs:Ds)(t,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=o.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,a|=16),l){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(s=!0),s||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:o,textHeight:l}=e.docView.measureTextSize();s=n>0&&i.refresh(r,n,o,l,Math.max(5,v/o),t),s&&(e.docView.minWidth=0,a|=16)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),ms();for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(s?ws.empty().applyChanges(this.stateDeco,ue.empty,this.heightOracle,[new Ki(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new vs(n.from,r))}gs&&(a|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&a&&(a|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),a|=this.updateForViewport()),(2&a||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,l=new Ls(i.lineAt(s-1e3*n,xs.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),xs.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(e<l.from||e>l.to){let n,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(e,xs.ByPos,r,0,0);n="center"==t.y?(o.top+o.bottom)/2-s/2:"start"==t.y||"nearest"==t.y&&e<l.from?o.top:o.bottom-s,l=new Ls(i.lineAt(n-500,xs.ByHeight,r,0,0).from,i.lineAt(n+s+500,xs.ByHeight,r,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Ls(this.heightMap.lineAt(n,xs.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,xs.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,xs.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,xs.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:o}=this;return(0==e||i<=s-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=o+Math.max(10,Math.min(n,250)))&&i>s-2e3&&r<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new Is(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,r=i>>1,s=i<<1;if(this.defaultTextDirection!=Jn.LTR&&!n)return[];let o=[],l=(i,s,a,c)=>{if(s-i<r)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>i&&e<s)return l(i,e-10,a,c),void l(e+10,s,a,c);let d=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=a.from&&e.to<=a.to&&Math.abs(e.from-i)<r&&Math.abs(e.to-s)<r&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(s<a.to&&t&&n&&t.visibleRanges.some(e=>e.from<=s&&e.to>=s)){let e=t.moveToLineBoundary(Ne.cursor(s),!1,!0).head;e>i&&(s=e)}let e=this.gapSize(a,i,s,c);d=new Is(i,s,e,n||e<2e6?e:2e6)}o.push(d)},a=t=>{if(t.length<s||t.type!=bn.Text)return;let r=function(e,t,n){let i=[],r=e,s=0;return Ot.spans(n,e,t,{span(){},point(e,t){e>r&&(i.push({from:r,to:e}),s+=e-r),r=t}},20),r<t&&(i.push({from:r,to:t}),s+=t-r),{total:s,ranges:i}}(t.from,t.to,this.stateDeco);if(r.total<s)return;let o,a,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,s=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let i=js(r,c),o=((this.visibleBottom-this.visibleTop)/2+s)/t.height;e=i-o,n=i+o}else e=(this.visibleTop-t.top-s)/t.height,n=(this.visibleBottom-t.top+s)/t.height;o=Fs(r,e),a=Fs(r,n)}else{let n=r.total*this.heightOracle.charWidth,s=i*this.heightOracle.charWidth,l=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let h,u,d=this.pixelViewport.left+l,f=this.pixelViewport.right+l;if(null!=c){let e=js(r,c),t=((f-d)/2+s)/n;h=e-t,u=e+t}else h=(d-s)/n,u=(f+s)/n;o=Fs(r,h),a=Fs(r,u)}o>t.from&&l(t.from,o,t,r),a<t.to&&l(a,t.to,t,r)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(a):a(e);return o}gapSize(e,t,n,i){let r=js(i,n)-js(i,t);return this.heightOracle.lineWrapping?e.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(e){Is.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=xn.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Ot.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let t=0;t<n.length&&!(8&i);t++){let r=this.visibleRanges[t],s=n[t];r.from==s.from&&r.to==s.to||(i|=4,e&&e.mapPos(r.from,-1)==s.from&&e.mapPos(r.to,1)==s.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Hs(this.heightMap.lineAt(e,xs.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Hs(this.heightMap.lineAt(this.scaler.fromDOM(e),xs.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Hs(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ls{constructor(e,t){this.from=e,this.to=t}}function Fs({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:r}=t[e],s=r-n;if(i<=s)return n+i;i-=s}}function js(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}const zs={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function Vs(e){let t=e.facet(Fi).filter(e=>"function"!=typeof e),n=e.facet(zi).filter(e=>"function"!=typeof e);return n.length&&t.push(Ot.join(n)),t}class Ws{constructor(e,t,n){let i=0,r=0,s=0;this.viewports=n.map(({from:n,to:r})=>{let s=t.lineAt(n,xs.ByPos,e,0,0).top,o=t.lineAt(r,xs.ByPos,e,0,0).bottom;return i+=o-s,{from:n,to:r,top:s,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=s+(e.top-r)*this.scale,s=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){return e instanceof Ws&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function Hs(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new bs(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map(e=>Hs(e,t)):e._content)}const qs=je.define({combine:e=>e.join(" ")}),$s=je.define({combine:e=>e.indexOf(!0)>-1}),Us=$t.newName(),Ks=$t.newName(),Gs=$t.newName(),Ys={"&light":"."+Ks,"&dark":"."+Gs};function Js(e,t,n){return new $t(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const Qs=Js("."+Us,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Ys),Xs={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Zs=dn.ie&&dn.ie_version<=11;class eo{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new zn,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(dn.ie&&dn.ie_version<=11||dn.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!dn.android||!1===e.constructor.EDIT_CONTEXT||dn.chrome&&dn.chrome_version<126||(this.editContext=new io(e),e.state.facet(Bi)&&(e.contentDOM.editContext=this.editContext.editContext)),Zs&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Bi)?n.root.activeElement!=this.dom:!On(this.dom,i))return;let r=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);r&&r.isWidget()&&r.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(dn.ie&&dn.ie_version<=11||dn.android&&dn.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Bn(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=En(e.root);if(!t)return!1;let n=dn.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return no(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?no(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=On(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,i=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;for(i=Math.min(i,Pn(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=Pn(n))}else{if(n==e)return!0;i=Dn(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Xs),Zs&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Zs&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&$n(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let r of e){let e=this.readMutation(r);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&On(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Lr(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=jr(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Wr(this.view.state.selection,t.newSel.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=to(t,e.previousSibling||e.target.previousSibling,-1),i=to(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Bi)!=e.state.facet(Bi)&&(e.view.contentDOM.editContext=e.state.facet(Bi)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function to(e,t,n){for(;t;){let i=Ji.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function no(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,s=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return Bn(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}class io{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let i=e.state.selection.main,{anchor:r,head:s}=i,o=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let a=l-o>n.text.length;o==this.from&&r<this.from?o=r:l==this.to&&r>this.to&&(l=r);let c=Vr(e.state.sliceDoc(o,l),n.text,(a?i.from:i.to)-o,a?"end":null);if(!c){let t=Ne.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(Wr(t,i)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+o,to:c.toA+o,insert:ue.of(n.text.slice(c.from,c.toB).split("\n"))};if((dn.mac||dn.android)&&h.from==s-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:o,to:l,insert:ue.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);zr(e,h,Ne.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],r=null;for(let t=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);t<s;t++){let n=e.coordsForChar(t);r=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||r||new DOMRect,i.push(r)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(i)){let r=this.toEditorPos(e.rangeStart),s=this.toEditorPos(e.rangeEnd);if(r<s){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(i)?1:2}px`;n.push(xn.mark({attributes:{style:e}}).range(r,s))}}}e.dispatch({effects:Oi.of(xn.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=En(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((r,s,o,l,a)=>{if(n)return;let c=a.length-(s-r);if(i&&s>=i.to){if(i.from==r&&i.to==s&&i.insert.eq(a))return i=this.pendingContextChange=null,t+=c,void(this.to+=c);i=null,this.revertPending(e.state)}if(r+=t,(s+=t)<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||s>this.to||this.to-this.from+a.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(r),this.toContextPos(s),a.toString()),this.to+=c}t+=c}),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ro{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Ns(this,e.state||wt.create(e)),e.scrollTo&&e.scrollTo.is(Ti)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ri).map(e=>new Pi(e));for(let e of this.plugins)e.update(this);this.observer=new eo(this),this.inputState=new Hr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new br(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof dt?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,l=null;e.some(e=>e.annotation(hs))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=us(r,s),l||(o=1));let a=this.observer.delayedAndroidKey,c=null;if(a?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(wt.phrases)!=this.state.facet(wt.phrases))return this.setState(r);t=Gi.create(this,r,e),t.flags|=o;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Ei(e.empty?e:Ne.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Ti)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=lo.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Ui)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(qs)!=t.state.facet(qs)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(bi))try{e(t)}catch(e){Mi(this.state,e,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!jr(this,c)&&a.force&&$n(this.contentDOM,a.key,a.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Ns(this,e),this.plugins=e.facet(Ri).map(e=>new Pi(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new br(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Ri),n=e.state.facet(Ri);if(t!=n){let i=[];for(let r of n){let n=t.indexOf(r);if(n<0)i.push(new Pi(r));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Mi(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(s<0)if(Un(n||this.win))r=-1,s=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);r=e.from,s=e.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(e=>{try{return e.read(this)}catch(e){return Mi(this.state,e),oo}}),c=Gi.create(this,this.state,[]),h=!1;c.flags|=o,t?t.flags|=o:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<l.length;e++)if(a[e]!=oo)try{let t=l[e];t.write&&t.write(a[e],this)}catch(e){Mi(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}{let e=((r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-s)/this.scaleY;if((e>1||e<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(bi))e(t)}get themeClasses(){return Us+" "+(this.state.facet($s)?Gs:Ks)+" "+this.state.facet(qs)}updateAttrs(){let e=ao(this,Ni,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Bi)?"true":"false",class:"cm-content",style:`${dn.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),ao(this,Li,t);let n=this.observer.ignore(()=>{let n=mn(this.contentDOM,this.contentAttrs,t),i=mn(this.dom,this.editorAttrs,e);return n||i});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(ro.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet(Ui);let e=this.state.facet(ro.cspNonce);$t.mount(this.root,this.styleModules.concat(Qs).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Tr(this,e,_r(this,e,t,n))}moveByGroup(e,t){return Tr(this,e,_r(this,e,t,t=>function(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return e=>{let t=i(e);return r==bt.Space&&(r=t),r==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return Ne.cursor(r.side(t,i)+e.from,r.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,i){let r=function(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let e;for(let r of i.type){if(r.from>t)break;if(!(r.to<t)){if(r.from<t&&r.to>t)return r;e&&(r.type!=bn.Text||e.type==r.type&&!(n<0?r.from<t:r.to>t))||(e=r)}}return e||i}return i}(e,t.head,t.assoc||-1),s=i&&r.type==bn.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(s){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(r.from),o=e.posAtCoords({x:n==(i==Jn.LTR)?t.right-1:t.left+1,y:(s.top+s.bottom)/2});if(null!=o)return Ne.cursor(o,n?-1:1)}return Ne.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Tr(this,e,function(e,t,n,i){let r=t.head,s=n?1:-1;if(r==(n?e.state.doc.length:0))return Ne.cursor(r,t.assoc);let o,l=t.goalColumn,a=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,(t.empty?t.assoc:0)||(n?1:-1)),h=e.documentTop;if(c)null==l&&(l=c.left-a.left),o=s<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==l&&(l=Math.min(a.right-a.left,e.defaultCharacterWidth*(r-t.from))),o=(s<0?t.top:t.bottom)+h}let u=Mr(e,{x:a.left+l,y:o+(null!=i?i:e.viewState.heightOracle.textHeight>>1)*s},!1,s);return Ne.cursor(u.pos,u.assoc,void 0,l)}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Mr(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Mr(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),r=this.bidiSpans(i);return Nn(n,r[oi.find(r,e-i.from,-1,t)].dir==Jn.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(ki)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>so)return ui(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||li(i.isolates,t=Hi(this,e))))return i.order;t||(t=Hi(this,e));let i=function(e,t,n){if(!e)return[new oi(0,0,t==Xn?1:0)];if(t==Qn&&!n.length&&!si.test(e))return ui(e.length);if(n.length)for(;e.length>ai.length;)ai[ai.length]=256;let i=[],r=t==Qn?0:1;return hi(e,r,r,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new lo(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||dn.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Hn(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ti.of(new Ei("number"==typeof e?Ne.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Ti.of(new Ei(Ne.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ii.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ii.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=$t.newName(),i=[qs.of(n),Ui.of(Js(`.${n}`,e))];return t&&t.dark&&i.push($s.of(!0)),i}static baseTheme(e){return Ge.lowest(Ui.of(Js("."+Us,e,Ys)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Ji.get(n)||Ji.get(e);return(null===(t=null==i?void 0:i.root)||void 0===t?void 0:t.view)||null}}ro.styleModule=Ui,ro.inputHandler=xi,ro.clipboardInputFilter=wi,ro.clipboardOutputFilter=Ci,ro.scrollHandler=Si,ro.focusChangeEffect=yi,ro.perLineTextDirection=ki,ro.exceptionSink=vi,ro.updateListener=bi,ro.editable=Bi,ro.mouseSelectionStyle=Ai,ro.dragMovesSelection=mi,ro.clickAddsSelectionRange=gi,ro.decorations=Fi,ro.blockWrappers=ji,ro.outerDecorations=zi,ro.atomicRanges=Vi,ro.bidiIsolatedRanges=Wi,ro.scrollMargins=qi,ro.darkTheme=$s,ro.cspNonce=je.define({combine:e=>e.length?e[0]:""}),ro.contentAttributes=Li,ro.editorAttributes=Ni,ro.lineWrapping=ro.contentAttributes.of({class:"cm-lineWrapping"}),ro.announce=ut.define();const so=4096,oo={};class lo{constructor(e,t,n,i,r,s){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=s}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:Jn.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let s=e[r];s.dir!=i||t.touchesRange(s.from,s.to)||n.push(new lo(t.mapPos(s.from,1),t.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function ao(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let t=i[r],s="function"==typeof t?t(e):t;s&&fn(s,n)}return n}const co=dn.mac?"mac":dn.windows?"win":dn.linux?"linux":"key";function ho(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const uo=Ge.default(ro.domEventHandlers({keydown:(e,t)=>function(e,t,n,i){Ao=t;let r=function(e){var t=!(Jt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Qt&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Yt:Gt)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),s=ke(we(r,0))==r.length&&" "!=r,o="",l=!1,a=!1,c=!1;go&&go.view==n&&go.scope==i&&(o=go.prefix+" ",Gr.indexOf(t.keyCode)<0&&(a=!0,go=null));let h,u,d=new Set,f=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),a=!0)}return!1},p=e[i];return p&&(f(p[o+ho(r,t,!s)])?l=!0:!s||!(t.altKey||t.metaKey||t.ctrlKey)||dn.windows&&t.ctrlKey&&t.altKey||dn.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=Gt[t.keyCode])||h==r?s&&t.shiftKey&&f(p[o+ho(r,t,!0)])&&(l=!0):(f(p[o+ho(h,t,!0)])||t.shiftKey&&(u=Yt[t.keyCode])!=r&&u!=h&&f(p[o+ho(u,t,!1)]))&&(l=!0),!l&&f(p._any)&&(l=!0)),a&&(l=!0),l&&c&&t.stopPropagation(),Ao=null,l}(function(e){let t=e.facet(fo),n=po.get(t);return n||po.set(t,n=function(e,t=co){let n=Object.create(null),i=Object.create(null),r=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},s=(e,i,s,o,l)=>{var a,c;let h=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let i,r,s,o,l=n[n.length-1];"Space"==l&&(l=" ");for(let e=0;e<n.length-1;++e){const l=n[e];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))s=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);"mac"==t?o=!0:r=!0}}return i&&(l="Alt-"+l),r&&(l="Ctrl-"+l),o&&(l="Meta-"+l),s&&(l="Shift-"+l),l}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");r(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let i=go={view:t,prefix:n,scope:e};return setTimeout(()=>{go==i&&(go=null)},mo),!0}]})}let d=u.join(" ");r(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===c?void 0:c.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:r}=i;for(let t in e)e[t].run.push(e=>r(e,Ao))}let r=i[t]||i.key;if(r)for(let t of e)s(t,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&s(t,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}(t.state),e,t,"editor")})),fo=je.define({enables:uo}),po=new WeakMap;let go=null;const mo=4e3;let Ao=null;class vo extends vn{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?Mn(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Nn(t[0],"rtl"!=n.direction),r=parseInt(n.lineHeight);return i.bottom-i.top>1.5*r?{left:i.left,right:i.right,top:i.top,bottom:i.top+r}:i}ignoreEvent(){return!1}}function bo(e){let t=Ii.fromClass(class{constructor(t){this.view=t,this.placeholder=e?xn.set([xn.widget({widget:new vo(e),side:1}).range(0)]):xn.none}get decorations(){return this.view.state.doc.length?xn.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,ro.contentAttributes.of({"aria-placeholder":e})]:t}const xo="-10000px";class yo{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let r=null;this.tooltipViews=this.tooltips.map(e=>r=n(e,r))}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter(e=>e);if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let s=[],o=t?[]:null;for(let n=0;n<r.length;n++){let i=r[n],l=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(l=e)}if(l<0)s[n]=this.createTooltipView(i,n?s[n-1]:null),o&&(o[n]=!!i.above);else{let i=s[n]=this.tooltipViews[l];o&&(o[n]=t[l]),i.update&&i.update(e)}}}for(let e of this.tooltipViews)s.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=i,this.tooltips=r,this.tooltipViews=s,!0}}function wo(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const Co=je.define({combine:e=>{var t,n,i;return{position:dn.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find(e=>e.tooltipSpace))||void 0===i?void 0:i.tooltipSpace)||wo}}}),ko=new WeakMap,_o=Ii.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Co);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new yo(e,Oo,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(Co);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=xo,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(dn.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=$i(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(Co).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=e,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:h}=c,u=e.pos[l],d=e.size[l];if(!u||!1!==a.clip&&(u.bottom<=Math.max(n.top,i.top)||u.top>=Math.min(n.bottom,i.bottom)||u.right<Math.max(n.left,i.left)-.1||u.left>Math.min(n.right,i.right)+.1)){h.style.top=xo;continue}let f=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,m=null!==(t=ko.get(c))&&void 0!==t?t:d.bottom-d.top,A=c.offset||To,v=this.view.textDirection==Jn.LTR,b=d.width>i.right-i.left?v?i.left:i.right-d.width:v?Math.max(i.left,Math.min(u.left-(f?14:0)+A.x,i.right-g)):Math.min(Math.max(i.left,u.left-g+(f?14:0)-A.x),i.right-g),x=this.above[l];!a.strictSide&&(x?u.top-m-p-A.y<i.top:u.bottom+m+p+A.y>i.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[l]=!x);let y=(x?u.top-i.top:i.bottom-u.bottom)-p;if(y<m&&!1!==c.resize){if(y<this.view.defaultLineHeight){h.style.top=xo;continue}ko.set(c,m),h.style.height=(m=y)/s+"px"}else h.style.height&&(h.style.height="");let w=x?u.top-m-p-A.y:u.bottom+p+A.y,C=b+g;if(!0!==c.overlap)for(let e of o)e.left<C&&e.right>b&&e.top<w+m&&e.bottom>w&&(w=x?e.top-m-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(w-e.parent.top)/s+"px",So(h,(b-e.parent.left)/r)):(h.style.top=w/s+"px",So(h,b/r)),f){let e=u.left+(v?A.x:-A.x)-(b+14-7);f.style.left=e/r+"px"}!0!==c.overlap&&o.push({left:b,top:w,right:C,bottom:w+m}),h.classList.toggle("cm-tooltip-above",x),h.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=xo}},{eventObservers:{scroll(){this.maybeMeasure()}}});function So(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const Eo=ro.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),To={x:0,y:0},Oo=je.define({enables:[_o,Eo]}),Mo=je.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class Bo{static create(e){return new Bo(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new yo(e,Mo,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(void 0!==i)if(void 0===t)t=i;else if(t!==i)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Do=Oo.compute([Mo],e=>{let t=e.facet(Mo);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:Bo.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class Ro{constructor(e,t,n,i,r){this.view=e,this.source=t,this.field=n,this.setHover=i,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let i,r=1;if(n.isWidget())i=n.posAtStart;else{if(i=e.posAtCoords(t),null==i)return;let n=e.coordsAtPos(i);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let s=e.bidiSpans(e.state.doc.lineAt(i)).find(e=>e.from<=i&&e.to>=i),o=s&&s.dir==Jn.RTL?-1:1;r=t.x<n.left?-o:o}let s=this.source(e,i,r);if(null==s?void 0:s.then){let t=this.pending={pos:i};s.then(n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>Mi(e.state,t,"hover tooltip"))}else!s||Array.isArray(s)&&!s.length||e.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let e=this.view.plugin(_o),t=e?e.manager.tooltips.findIndex(e=>e.create==Bo.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i.length&&r&&!function(e,t){let n,{left:i,right:r,top:s,bottom:o}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();s=Math.min(e.top,s),o=Math.max(e.bottom,o)}return t.clientX>=i-Io&&t.clientX<=r+Io&&t.clientY>=s-Io&&t.clientY<=o+Io}(r.dom,e)||this.pending){let{pos:r}=i[0]||this.pending,s=null!==(n=null===(t=i[0])||void 0===t?void 0:t.end)&&void 0!==n?n:r;(r==s?this.view.posAtCoords(this.lastMove)==r:function(e,t,n,i,r){let s=e.scrollDOM.getBoundingClientRect(),o=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>i||s.right<i||s.top>r||Math.min(s.bottom,o)<r)return!1;let l=e.posAtCoords({x:i,y:r},!1);return l>=t&&l<=n}(this.view,r,s,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Io=4;function Po(e,t={}){let n=ut.define(),i=Ue.define({create:()=>[],update(e,i){if(e.length&&(t.hideOnChange&&(i.docChanged||i.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(i,e))),i.docChanged)){let t=[];for(let n of e){let e=i.changes.mapPos(n.pos,-1,Se.TrackDel);if(null!=e){let r=Object.assign(Object.create(null),n);r.pos=e,null!=r.end&&(r.end=i.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(Lo)&&(e=[]);return e},provide:e=>Mo.from(e)});return{active:i,extension:[i,Ii.define(r=>new Ro(r,e,i,n,t.hoverTime||300)),Do]}}function No(e,t){let n=e.plugin(_o);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const Lo=ut.define(),Fo=je.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}}),jo=Ii.fromClass(class{constructor(e){this.input=e.state.facet(Wo),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Fo);this.top=new zo(e,!0,t.topContainer),this.bottom=new zo(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Fo);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new zo(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new zo(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Wo);if(n!=this.input){let t=n.filter(e=>e),i=[],r=[],s=[],o=[];for(let n of t){let t,l=this.specs.indexOf(n);l<0?(t=n(e.view),o.push(t)):(t=this.panels[l],t.update&&t.update(e)),i.push(t),(t.top?r:s).push(t)}this.specs=t,this.panels=i,this.top.sync(r),this.bottom.sync(s);for(let e of o)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>ro.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class zo{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Vo(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Vo(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Vo(e){let t=e.nextSibling;return e.remove(),t}const Wo=je.define({enables:jo});class Ho extends kt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Ho.prototype.elementClass="",Ho.prototype.toDOM=void 0,Ho.prototype.mapMode=Se.TrackBefore,Ho.prototype.startSide=Ho.prototype.endSide=-1,Ho.prototype.point=!0;const qo=je.define(),$o=je.define(),Uo={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Ot.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Ko=je.define();function Go(e){return[Jo(),Ko.of({...Uo,...e})]}const Yo=je.define({combine:e=>e.some(e=>e)});function Jo(e){let t=[Qo];return e&&!1===e.fixed&&t.push(Yo.of(!0)),t}const Qo=Ii.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Ko).map(t=>new tl(e,t)),this.fixed=!e.state.facet(Yo);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Yo)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Ot.iter(this.view.state.facet(qo),this.view.viewport.from),i=[],r=this.gutters.map(e=>new el(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(e.type)){let t=!0;for(let s of e.type)if(s.type==bn.Text&&t){Zo(n,i,s.from);for(let e of r)e.line(this.view,s,i);t=!1}else if(s.widget)for(let e of r)e.widget(this.view,s)}else if(e.type==bn.Text){Zo(n,i,e.from);for(let t of r)t.line(this.view,e,i)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Ko),n=e.state.facet(Ko),i=e.docChanged||e.heightChanged||e.viewportChanged||!Ot.eq(e.startState.facet(qo),e.state.facet(qo),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(i=!0);else{i=!0;let r=[];for(let i of n){let n=t.indexOf(i);n<0?r.push(new tl(this.view,i)):(this.gutters[n].update(e),r.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),r.indexOf(e)<0&&e.destroy();for(let e of r)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=r}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>ro.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let i=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Jn.LTR?{left:i,right:r}:{right:i,left:r}})});function Xo(e){return Array.isArray(e)?e:[e]}function Zo(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class el{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Ot.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,r=(t.top-this.height)/e.scaleY,s=t.height/e.scaleY;if(this.i==i.elements.length){let t=new nl(e,s,r,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,s,r,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Zo(this.cursor,i,t.from),n.length&&(i=i.concat(n));let r=this.gutter.config.lineMarker(e,t,i);r&&i.unshift(r);let s=this.gutter;(0!=i.length||s.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let n of e.state.facet($o)){let r=n(e,t.widget,t);r&&(i||(i=[])).push(r)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class tl{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let r,s=i.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let e=s.getBoundingClientRect();r=(e.top+e.bottom)/2}else r=i.clientY;let o=e.lineBlockAtHeight(r-e.documentTop);t.domEventHandlers[n](e,o,i)&&i.preventDefault()});this.markers=Xo(t.markers(e)),t.initialSpacer&&(this.spacer=new nl(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Xo(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!Ot.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class nl{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let r=0,s=0;;){let o=s,l=r<t.length?t[r++]:null,a=!1;if(l){let e=l.elementClass;e&&(n+=" "+e);for(let e=s;e<this.markers.length;e++)if(this.markers[e].compare(l)){o=e,a=!0;break}}else o=this.markers.length;for(;s<o;){let e=this.markers[s++];if(e.toDOM){e.destroy(i);let t=i.nextSibling;i.remove(),i=t}}if(!l)break;l.toDOM&&(a?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),a&&s++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const il=1024;let rl=0;class sl{constructor(e,t){this.from=e,this.to=t}}class ol{constructor(e={}){this.id=rl++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=cl.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}ol.closedBy=new ol({deserialize:e=>e.split(" ")}),ol.openedBy=new ol({deserialize:e=>e.split(" ")}),ol.group=new ol({deserialize:e=>e.split(" ")}),ol.isolate=new ol({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),ol.contextHash=new ol({perNode:!0}),ol.lookAhead=new ol({perNode:!0}),ol.mounted=new ol({perNode:!0});class ll{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[ol.mounted.id]}}const al=Object.create(null);class cl{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):al,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new cl(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(ol.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(ol.group),i=-1;i<(n?n.length:0);i++){let r=t[i<0?e.name:n[i]];if(r)return r}}}}cl.none=new cl("",Object.create(null),0,8);class hl{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let t of e){let e=t(n);if(e){i||(i=Object.assign({},n.props));let t=e[1],r=e[0];r.combine&&r.id in i&&(t=r.combine(i[r.id],t)),i[r.id]=t}}t.push(i?new cl(n.name,i,n.id,n.flags):n)}return new hl(t)}}const ul=new WeakMap,dl=new WeakMap;var fl;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"}(fl||(fl={}));class pl{constructor(e,t,n,i,r){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[e,t]of r)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=ll.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new El(this.topNode,e)}cursorAt(e,t=0,n=0){let i=ul.get(this)||this.topNode,r=new El(i);return r.moveTo(e,t),ul.set(this,r._tree),r}get topNode(){return new xl(this,0,0,null)}resolve(e,t=0){let n=vl(ul.get(this)||this.topNode,e,t,!1);return ul.set(this,n),n}resolveInner(e,t=0){let n=vl(dl.get(this)||this.topNode,e,t,!0);return dl.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let i=e.resolveInner(t,n),r=null;for(let e=i instanceof xl?i:i.context.parent;e;e=e.parent)if(e.index<0){let s=e.parent;(r||(r=[i])).push(s.resolve(t,n)),e=s}else{let s=ll.get(e.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){let o=new xl(s.tree,s.overlay[0].from+e.from,-1,e);(r||(r=[i])).push(vl(o,t,n,!1))}}return r?_l(r):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,s=e.mode||0,o=(s&fl.IncludeAnonymous)>0;for(let e=this.cursor(s|fl.IncludeAnonymous);;){let s=!1;if(e.from<=r&&e.to>=i&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Bl(cl.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new pl(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new pl(cl.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=il,reused:s=[],minRepeatType:o=i.types.length}=e,l=Array.isArray(n)?new gl(n,n.length):n,a=i.types,c=0,h=0;function u(e,t,n,m,A,v){let{id:b,start:x,end:y,size:w}=l,C=h,k=c;if(w<0){if(l.next(),-1==w){let t=s[b];return n.push(t),void m.push(x-e)}if(-3==w)return void(c=b);if(-4==w)return void(h=b);throw new RangeError(`Unrecognized record size: ${w}`)}let _,S,E=a[b],T=x-e;if(y-x<=r&&(S=function(e,t){let n=l.fork(),i=0,s=0,a=0,c=n.end-r,h={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){h.size=i,h.start=s,h.skip=a,a+=4,i+=4,n.next();continue}let l=n.pos-e;if(e<0||l<r||n.start<c)break;let u=n.id>=o?4:0,d=n.start;for(n.next();n.pos>l;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;u+=4}else n.id>=o&&(u+=4);n.next()}s=d,i+=e,a+=u}return(t<0||i==e)&&(h.size=i,h.start=s,h.skip=a),h.size>4?h:void 0}(l.pos-t,A))){let t=new Uint16Array(S.size-S.skip),n=l.pos-S.size,r=t.length;for(;l.pos>n;)r=g(S.start,t,r);_=new ml(t,y-S.start,i),T=S.start-e}else{let e=l.pos-w;l.next();let t=[],n=[],i=b>=o?b:-1,s=0,a=y;for(;l.pos>e;)i>=0&&l.id==i&&l.size>=0?(l.end<=a-r&&(f(t,n,x,s,l.end,a,i,C,k),s=t.length,a=l.end),l.next()):v>2500?d(x,e,t,n):u(x,e,t,n,i,v+1);if(i>=0&&s>0&&s<t.length&&f(t,n,x,s,x,a,i,C,k),t.reverse(),n.reverse(),i>-1&&s>0){let e=function(e,t){return(n,i,r)=>{let s,o,l=0,a=n.length-1;if(a>=0&&(s=n[a])instanceof pl){if(!a&&s.type==e&&s.length==r)return s;(o=s.prop(ol.lookAhead))&&(l=i[a]+s.length+o)}return p(e,n,i,r,l,t)}}(E,k);_=Bl(E,t,n,0,t.length,0,y-x,e,e)}else _=p(E,t,n,y-x,C-y,k)}n.push(_),m.push(T)}function d(e,t,n,s){let o=[],a=0,c=-1;for(;l.pos>t;){let{id:e,start:t,end:n,size:i}=l;if(i>4)l.next();else{if(c>-1&&t<c)break;c<0&&(c=n-r),o.push(e,t,n),a++,l.next()}}if(a){let t=new Uint16Array(4*a),r=o[o.length-2];for(let e=o.length-3,n=0;e>=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-r,t[n++]=o[e+2]-r,t[n++]=n;n.push(new ml(t,o[2]-r,i)),s.push(r-e)}}function f(e,t,n,r,s,o,l,a,c){let h=[],u=[];for(;e.length>r;)h.push(e.pop()),u.push(t.pop()+n-s);e.push(p(i.types[l],h,u,o-s,a-o,c)),t.push(s-n)}function p(e,t,n,i,r,s,o){if(s){let e=[ol.contextHash,s];o=o?[e].concat(o):[e]}if(r>25){let e=[ol.lookAhead,r];o=o?[e].concat(o):[e]}return new pl(e,t,n,i,o)}function g(e,t,n){let{id:i,start:r,end:s,size:a}=l;if(l.next(),a>=0&&i<o){let o=n;if(a>4){let i=l.pos-(a-4);for(;l.pos>i;)n=g(e,t,n)}t[--n]=o,t[--n]=s-e,t[--n]=r-e,t[--n]=i}else-3==a?c=i:-4==a&&(h=i);return n}let m=[],A=[];for(;l.pos>0;)u(e.start||0,e.bufferStart||0,m,A,-1,0);let v=null!==(t=e.length)&&void 0!==t?t:m.length?A[0]+m[0].length:0;return new pl(a[e.topID],m.reverse(),A.reverse(),v)}(e)}}pl.empty=new pl(cl.none,[],[],0);class gl{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new gl(this.buffer,this.index)}}class ml{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return cl.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(e+=4))return r;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return r+"("+s.join(",")+")"}findChild(e,t,n,i,r){let{buffer:s}=this,o=-1;for(let l=e;l!=t&&!(Al(r,i,s[l+1],s[l+2])&&(o=l,n>0));l=s[l+3]);return o}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),s=0;for(let o=e,l=0;o<t;){r[l++]=i[o++],r[l++]=i[o++]-n;let t=r[l++]=i[o++]-n;r[l++]=i[o++]-e,s=Math.max(s,t)}return new ml(r,s,this.set)}}function Al(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function vl(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!i&&e instanceof xl&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=i?0:fl.IgnoreOverlays;if(i)for(let i=e,o=i.parent;o;i=o,o=i.parent)i instanceof xl&&i.index<0&&(null===(r=o.enter(t,n,s))||void 0===r?void 0:r.from)!=i.from&&(e=o);for(;;){let i=e.enter(t,n,s);if(!i)return e;e=i}}class bl{cursor(e=0){return new El(this,e)}getChild(e,t=null,n=null){let i=yl(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return yl(this,e,t,n)}resolve(e,t=0){return vl(this,e,t,!1)}resolveInner(e,t=0){return vl(this,e,t,!0)}matchContext(e){return wl(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class xl extends bl{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,r=0){for(let s=this;;){for(let{children:o,positions:l}=s._tree,a=t>0?o.length:-1;e!=a;e+=t){let a,c=o[e],h=l[e]+s.from;if(r&fl.EnterBracketed&&c instanceof pl&&(a=ll.get(c))&&!a.overlay&&a.bracketed&&n>=h&&n<=h+c.length||Al(i,n,h,h+c.length))if(c instanceof ml){if(r&fl.ExcludeBuffers)continue;let o=c.findChild(0,c.buffer.length,t,n-h,i);if(o>-1)return new kl(new Cl(s,c,e,h),null,o)}else if(r&fl.IncludeAnonymous||!c.type.isAnonymous||Tl(c)){let o;if(!(r&fl.IgnoreMounts)&&(o=ll.get(c))&&!o.overlay)return new xl(o.tree,h,e,s);let l=new xl(c,h,e,s);return r&fl.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?c.children.length-1:0,t,n,i,r)}}if(r&fl.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let i;if(!(n&fl.IgnoreOverlays)&&(i=ll.get(this._tree))&&i.overlay){let r=e-this.from,s=n&fl.EnterBracketed&&i.bracketed;for(let{from:e,to:n}of i.overlay)if((t>0||s?e<=r:e<r)&&(t<0||s?n>=r:n>r))return new xl(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function yl(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(null!=n)for(let e=!1;!e;)if(e=r.type.is(n),!r.nextSibling())return s;for(;;){if(null!=i&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return null==i?s:[]}}function wl(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class Cl{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class kl extends bl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new kl(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&fl.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new kl(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new kl(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new kl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let s=n.buffer[this.index+1];e.push(n.slice(i,r,s)),t.push(0)}return new pl(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function _l(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let r=e[i];(r.from>n.from||r.to<n.to)&&(n=r,t=i)}let i=n instanceof xl&&n.index<0?null:n.parent,r=e.slice();return i?r[t]=i:r.splice(t,1),new Sl(r,n)}class Sl{constructor(e,t){this.heads=e,this.node=t}get next(){return _l(this.heads)}}class El{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~fl.EnterBracketed,e instanceof xl)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return!!e&&(e instanceof xl?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&fl.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fl.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(i.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let i=t+e,r=e<0?-1:n._tree.children.length;i!=r;i+=e){let e=n._tree.children[i];if(this.mode&fl.IncludeAnonymous||e instanceof ml||!e.type.isAnonymous||Tl(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,r=this.stack.length;r>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,n=r+1;break e}i=this.stack[--r]}for(let e=n;e<this.stack.length;e++)t=new kl(this.buffer,t,this.stack[e]);return this.bufferNode=new kl(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return wl(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return wl(this._tree,e,i);let s=n[t.buffer[this.stack[r]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Tl(e){return e.children.some(e=>e instanceof ml||!e.type.isAnonymous||Tl(e))}const Ol=new WeakMap;function Ml(e,t){if(!e.isAnonymous||t instanceof ml||t.type!=e)return 1;let n=Ol.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof pl)){n=1;break}n+=Ml(e,i)}Ol.set(t,n)}return n}function Bl(e,t,n,i,r,s,o,l,a){let c=0;for(let n=i;n<r;n++)c+=Ml(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,i,r,o,l){for(let c=r;c<o;){let r=c,f=i[c],p=Ml(e,n[c]);for(c++;c<o;c++){let t=Ml(e,n[c]);if(p+t>=h)break;p+=t}if(c==r+1){if(p>h){let e=n[r];t(e.children,e.positions,0,e.children.length,i[r]+l);continue}u.push(n[r])}else{let t=i[c-1]+n[c-1].length-f;u.push(Bl(e,n,i,r,c,f,t,null,a))}d.push(f+l-s)}}(t,n,i,r,0),(l||a)(u,d,o)}class Dl{constructor(e,t,n,i,r=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new Dl(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,s=e.length?e[0]:null;for(let o=0,l=0,a=0;;o++){let c=o<t.length?t[o]:null,h=c?c.fromA:1e9;if(h-l>=n)for(;s&&s.from<h;){let t=s;if(l>=t.from||h<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,h)-a;t=e>=n?null:new Dl(e,n,t.tree,t.offset+a,o>0,!!c)}if(t&&i.push(t),s.to>h)break;s=r<e.length?e[r++]:null}if(!c)break;l=c.toA,a=c.toA-c.toB}return i}}class Rl{startParse(e,t,n){return"string"==typeof e&&(e=new Il(e)),n=n?n.length?n.map(e=>new sl(e.from,e.to)):[new sl(0,0)]:[new sl(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class Il{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ol({perNode:!0});let Pl=0;class Nl{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=Pl++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof Nl&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new Nl(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new Fl(e);return e=>e.modified.indexOf(t)>-1?e:Fl.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let Ll=0;class Fl{constructor(e){this.name=e,this.instances=[],this.id=Ll++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{return n.base==e&&(i=t,r=n.modified,i.length==r.length&&i.every((e,t)=>e==r[t]));var i,r});if(n)return n;let i=[],r=new Nl(e.name,i,e,t);for(let e of t)e.instances.push(r);let s=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)i.push(Fl.get(t,e));return r}}function jl(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],r=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);s=e.slice(t)}let o=n.length-1,l=n[o];if(!l)throw new RangeError("Invalid path: "+e);let a=new Vl(i,r,o>0?n.slice(0,o):null);t[l]=a.sort(t[l])}}return zl.add(t)}const zl=new ol({combine(e,t){let n,i,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let s=new Vl(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});class Vl{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function Wl(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:i,all:r=null}=t||{};return{style:e=>{let t=r;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function Hl(e,t,n,i=0,r=e.length){let s=new ql(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}Vl.empty=new Vl([],2,null);class ql{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,r){let{type:s,from:o,to:l}=e;if(o>=n||l<=t)return;s.isTop&&(r=this.highlighters.filter(e=>!e.scope||e.scope(s)));let a=i,c=function(e){let t=e.type.prop(zl);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||Vl.empty,h=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(h&&(a&&(a+=" "),a+=h,1==c.mode&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,o),a),c.opaque)return;let u=e.tree&&e.tree.prop(ol.mounted);if(u&&u.overlay){let s=e.node.enter(u.overlay[0].from+o,1),c=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),h=e.firstChild();for(let d=0,f=o;;d++){let p=d<u.overlay.length?u.overlay[d]:null,g=p?p.from+o:l,m=Math.max(t,f),A=Math.min(n,g);if(m<A&&h)for(;e.from<A&&(this.highlightRange(e,m,A,i,r),this.startSpan(Math.min(A,e.to),a),!(e.to>=g)&&e.nextSibling()););if(!p||g>n)break;f=p.to+o,f>t&&(this.highlightRange(s.cursor(),Math.max(t,p.from+o),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),a))}h&&e.parent()}else if(e.firstChild()){u&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,r),this.startSpan(Math.min(n,e.to),a)}}while(e.nextSibling());e.parent()}}}const $l=Nl.define,Ul=$l(),Kl=$l(),Gl=$l(Kl),Yl=$l(Kl),Jl=$l(),Ql=$l(Jl),Xl=$l(Jl),Zl=$l(),ea=$l(Zl),ta=$l(),na=$l(),ia=$l(),ra=$l(ia),sa=$l(),oa={comment:Ul,lineComment:$l(Ul),blockComment:$l(Ul),docComment:$l(Ul),name:Kl,variableName:$l(Kl),typeName:Gl,tagName:$l(Gl),propertyName:Yl,attributeName:$l(Yl),className:$l(Kl),labelName:$l(Kl),namespace:$l(Kl),macroName:$l(Kl),literal:Jl,string:Ql,docString:$l(Ql),character:$l(Ql),attributeValue:$l(Ql),number:Xl,integer:$l(Xl),float:$l(Xl),bool:$l(Jl),regexp:$l(Jl),escape:$l(Jl),color:$l(Jl),url:$l(Jl),keyword:ta,self:$l(ta),null:$l(ta),atom:$l(ta),unit:$l(ta),modifier:$l(ta),operatorKeyword:$l(ta),controlKeyword:$l(ta),definitionKeyword:$l(ta),moduleKeyword:$l(ta),operator:na,derefOperator:$l(na),arithmeticOperator:$l(na),logicOperator:$l(na),bitwiseOperator:$l(na),compareOperator:$l(na),updateOperator:$l(na),definitionOperator:$l(na),typeOperator:$l(na),controlOperator:$l(na),punctuation:ia,separator:$l(ia),bracket:ra,angleBracket:$l(ra),squareBracket:$l(ra),paren:$l(ra),brace:$l(ra),content:Zl,heading:ea,heading1:$l(ea),heading2:$l(ea),heading3:$l(ea),heading4:$l(ea),heading5:$l(ea),heading6:$l(ea),contentSeparator:$l(Zl),list:$l(Zl),quote:$l(Zl),emphasis:$l(Zl),strong:$l(Zl),link:$l(Zl),monospace:$l(Zl),strikethrough:$l(Zl),inserted:$l(),deleted:$l(),changed:$l(),invalid:$l(),meta:sa,documentMeta:$l(sa),annotation:$l(sa),processingInstruction:$l(sa),definition:Nl.defineModifier("definition"),constant:Nl.defineModifier("constant"),function:Nl.defineModifier("function"),standard:Nl.defineModifier("standard"),local:Nl.defineModifier("local"),special:Nl.defineModifier("special")};for(let e in oa){let t=oa[e];t instanceof Nl&&(t.name=e)}var la;Wl([{tag:oa.link,class:"tok-link"},{tag:oa.heading,class:"tok-heading"},{tag:oa.emphasis,class:"tok-emphasis"},{tag:oa.strong,class:"tok-strong"},{tag:oa.keyword,class:"tok-keyword"},{tag:oa.atom,class:"tok-atom"},{tag:oa.bool,class:"tok-bool"},{tag:oa.url,class:"tok-url"},{tag:oa.labelName,class:"tok-labelName"},{tag:oa.inserted,class:"tok-inserted"},{tag:oa.deleted,class:"tok-deleted"},{tag:oa.literal,class:"tok-literal"},{tag:oa.string,class:"tok-string"},{tag:oa.number,class:"tok-number"},{tag:[oa.regexp,oa.escape,oa.special(oa.string)],class:"tok-string2"},{tag:oa.variableName,class:"tok-variableName"},{tag:oa.local(oa.variableName),class:"tok-variableName tok-local"},{tag:oa.definition(oa.variableName),class:"tok-variableName tok-definition"},{tag:oa.special(oa.variableName),class:"tok-variableName2"},{tag:oa.definition(oa.propertyName),class:"tok-propertyName tok-definition"},{tag:oa.typeName,class:"tok-typeName"},{tag:oa.namespace,class:"tok-namespace"},{tag:oa.className,class:"tok-className"},{tag:oa.macroName,class:"tok-macroName"},{tag:oa.propertyName,class:"tok-propertyName"},{tag:oa.operator,class:"tok-operator"},{tag:oa.comment,class:"tok-comment"},{tag:oa.meta,class:"tok-meta"},{tag:oa.invalid,class:"tok-invalid"},{tag:oa.punctuation,class:"tok-punctuation"}]);const aa=new ol;const ca=new ol;class ha{constructor(e,t,n=[],i=""){this.data=e,this.name=i,wt.prototype.hasOwnProperty("tree")||Object.defineProperty(wt.prototype,"tree",{get(){return fa(this)}}),this.parser=t,this.extension=[wa.of(this),wt.languageData.of((e,t,n)=>{let i=ua(e,t,n),r=i.type.prop(aa);if(!r)return[];let s=e.facet(r),o=i.type.prop(ca);if(o){let r=i.resolve(t-i.from,n);for(let t of o)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(s)}}return s})].concat(n)}isActiveAt(e,t,n=-1){return ua(e,t,n).type.prop(aa)==this.data}findRegions(e){let t=e.facet(wa);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(aa)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(ol.mounted);if(r){if(r.tree.prop(aa)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let r=e.children[n];r instanceof pl&&i(r,e.positions[n]+t)}};return i(fa(e),0),n}get allowsNesting(){return!0}}function ua(e,t,n){let i=e.facet(wa),r=fa(e).topNode;if(!i||i.allowsNesting)for(let e=r;e;e=e.enter(t,n,fl.ExcludeBuffers|fl.EnterBracketed))e.type.isTop&&(r=e);return r}ha.setState=ut.define();class da extends ha{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,je.define({combine:n?e=>e.concat(n):void 0}));var n;return new da(t,e.parser.configure({props:[aa.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new da(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function fa(e){let t=e.field(ha.state,!1);return t?t.tree:pl.empty}class pa{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let ga=null;class ma{constructor(e,t,n=[],i,r,s,o,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new ma(e,t,[],pl.empty,0,n,[],null)}startParse(){return this.parser.startParse(new pa(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=pl.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(Dl.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Dl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ga;ga=this;try{return e()}finally{ga=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Aa(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,i,r)=>t.push({fromA:e,toA:n,fromB:i,toB:r})),n=Dl.applyChanges(n,t),i=pl.empty,r=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){o=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);n<i&&o.push({from:n,to:i})}}}return new ma(this.parser,t,n,i,r,s,o,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:i}=this.skipped[t];n<e.to&&i>e.from&&(this.fragments=Aa(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Rl{createParse(t,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let t=ga;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new pl(cl.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return ga}}function Aa(e,t,n){return Dl.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class va{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new va(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ma.create(e.facet(wa).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new va(n)}}ha.state=Ue.define({create:va.init,update(e,t){for(let e of t.effects)if(e.is(ha.setState))return e.value;return t.startState.facet(wa)!=t.state.facet(wa)?va.init(t.state):e.apply(t)}});let ba=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(ba=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const xa="undefined"!=typeof navigator&&(null===(la=navigator.scheduling)||void 0===la?void 0:la.isInputPending)?()=>navigator.scheduling.isInputPending():null,ya=Ii.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ha.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ha.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=ba(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,r=n.field(ha.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!xa?Math.max(25,e.timeRemaining()-5):1e9),o=r.context.treeLen<i&&n.doc.length>i+1e3,l=r.context.work(()=>xa&&xa()||Date.now()>s,i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:ha.setState.of(new va(r.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Mi(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),wa=je.define({combine:e=>e.length?e[0]:null,enables:e=>[ha.state,ya,ro.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class Ca{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const ka=je.define(),_a=je.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Sa(e){let t=e.facet(_a);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function Ea(e,t){let n="",i=e.tabSize,r=e.facet(_a)[0];if("\t"==r){for(;t>=i;)n+="\t",t-=i;r=" "}for(let e=0;e<t;e++)n+=r;return n}function Ta(e,t){e instanceof wt&&(e=new Oa(e));for(let n of e.state.facet(ka)){let i=n(e,t);if(void 0!==i)return i}let n=fa(e.state);return n.length>=t?function(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let e=[];for(let t=r;t&&!(t.from<i.node.from||t.to>i.node.to||t.from==i.node.from&&t.type==i.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return Ba(i,e,n)}(e,n,t):null}class Oa{constructor(e,t={}){this.state=e,this.options=t,this.unit=Sa(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.countColumn(n,e-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(r+=s-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return Vt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Ma=new ol;function Ba(e,t,n){for(let i=e;i;i=i.next){let e=Da(i.node);if(e)return e(Ia.create(t,n,i))}return 0}function Da(e){let t=e.type.prop(Ma);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(ol.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,i,r){let s=e.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==e.pos+o,a=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==i)return null;if(!r.type.isSkipped){if(r.from>=o)return null;let e=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+e}}e=r.to}}(e):null;return a?l?e.column(a.from):e.column(a.to):e.baseIndent+(l?0:e.unit*n)}(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?Ra:null}function Ra(){return 0}class Ia extends Oa{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Ia(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Pa(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Ba(this.context.next,this.base,this.pos)}}function Pa(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Na({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const La=je.define(),Fa=new ol;function ja(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function za(e,t,n){for(let i of e.facet(La)){let r=i(e,t,n);if(r)return r}return function(e,t,n){let i=fa(e);if(i.length<n)return null;let r=null;for(let s=i.resolveStack(n,1);s;s=s.next){let o=s.node;if(o.to<=n||o.from>n)continue;if(r&&o.from<t)break;let l=o.type.prop(Fa);if(l&&(o.to<i.length-50||i.length==e.doc.length||!ja(o))){let i=l(o,e);i&&i.from<=n&&i.from>=t&&i.to>n&&(r=i)}}return r}(e,t,n)}function Va(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const Wa=ut.define({map:Va}),Ha=ut.define({map:Va});function qa(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const $a=Ue.define({create:()=>xn.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=Ua(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(Wa)&&!Ga(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(Za),r=i?xn.replace({widget:new ic(i(t.state,n.value))}):nc;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Ha)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=Ua(e,t.selection.main.head)),e},provide:e=>ro.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let i=e[n++],r=e[n++];if("number"!=typeof i||"number"!=typeof r)throw new RangeError("Invalid JSON for fold state");t.push(nc.range(i,r))}return xn.set(t,!0)}});function Ua(e,t,n=t){let i=!1;return e.between(t,n,(e,r)=>{e<n&&r>t&&(i=!0)}),i?e.update({filterFrom:t,filterTo:n,filter:(e,i)=>e>=n||i<=t}):e}function Ka(e,t,n){var i;let r=null;return null===(i=e.field($a,!1))||void 0===i||i.between(t,n,(e,t)=>{(!r||r.from>e)&&(r={from:e,to:t})}),r}function Ga(e,t,n){let i=!1;return e.between(t,t,(e,r)=>{e==t&&r==n&&(i=!0)}),i}function Ya(e,t){return e.field($a,!1)?t:t.concat(ut.appendConfig.of(ec()))}function Ja(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return ro.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${r}.`)}const Qa=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of qa(e)){let n=za(e.state,t.from,t.to);if(n)return e.dispatch({effects:Ya(e.state,[Wa.of(n),Ja(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field($a,!1))return!1;let t=[];for(let n of qa(e)){let i=Ka(e.state,n.from,n.to);i&&t.push(Ha.of(i),Ja(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let i=0;i<t.doc.length;){let r=e.lineBlockAt(i),s=za(t,r.from,r.to);s&&n.push(Wa.of(s)),i=(s?e.lineBlockAt(s.to):r).to+1}return n.length&&e.dispatch({effects:Ya(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field($a,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(Ha.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],Xa={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Za=je.define({combine:e=>Ct(e,Xa)});function ec(e){let t=[$a,lc];return e&&t.push(Za.of(e)),t}function tc(e,t){let{state:n}=e,i=n.facet(Za),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=Ka(e.state,n.from,n.to);i&&e.dispatch({effects:Ha.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const nc=xn.replace({widget:new class extends vn{toDOM(e){return tc(e,null)}}});class ic extends vn{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return tc(e,this.value)}}const rc={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class sc extends Ho{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function oc(e={}){let t={...rc,...e},n=new sc(t,!0),i=new sc(t,!1),r=Ii.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(wa)!=e.state.facet(wa)||e.startState.field($a,!1)!=e.state.field($a,!1)||fa(e.startState)!=fa(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new Mt;for(let r of e.viewportLineBlocks){let s=Ka(e.state,r.from,r.to)?i:za(e.state,r.from,r.to)?n:null;s&&t.add(r.from,r.from,s)}return t.finish()}}),{domEventHandlers:s}=t;return[r,Go({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.markers)||Ot.empty},initialSpacer:()=>new sc(t,!1),domEventHandlers:{...s,click:(e,t,n)=>{if(s.click&&s.click(e,t,n))return!0;let i=Ka(e.state,t.from,t.to);if(i)return e.dispatch({effects:Ha.of(i)}),!0;let r=za(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:Wa.of(r)}),!0)}}}),ec()]}const lc=ro.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class ac{constructor(e,t){let n;function i(e){let t=$t.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?i(t.all):void 0,s=t.scope;this.scope=s instanceof ha?e=>e.prop(aa)==s.data:s?e=>e==s:void 0,this.style=Wl(e.map(e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))})),{all:r}).style,this.module=n?new $t(n):null,this.themeType=t.themeType}static define(e,t){return new ac(e,t||{})}}const cc=je.define(),hc=je.define({combine:e=>e.length?[e[0]]:null});function uc(e){let t=e.facet(cc);return t.length?t:e.facet(hc)}class dc{constructor(e){this.markCache=Object.create(null),this.tree=fa(e.state),this.decorations=this.buildDeco(e,uc(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=fa(e.state),n=uc(e.state),i=n!=uc(e.startState),{viewport:r}=e.view,s=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!i&&t.type==this.tree.type&&s>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return xn.none;let n=new Mt;for(let{from:i,to:r}of e.visibleRanges)Hl(this.tree,t,(e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=xn.mark({class:i})))},i,r);return n.finish()}}const fc=Ge.high(Ii.fromClass(dc,{decorations:e=>e.decorations})),pc=(oa.meta,oa.link,oa.heading,oa.emphasis,oa.strong,oa.strikethrough,oa.keyword,oa.atom,oa.bool,oa.url,oa.contentSeparator,oa.labelName,oa.literal,oa.inserted,oa.string,oa.deleted,oa.regexp,oa.escape,oa.string,oa.variableName,oa.variableName,oa.typeName,oa.namespace,oa.className,oa.variableName,oa.macroName,oa.propertyName,oa.comment,oa.invalid,ro.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),gc="()[]{}",mc=je.define({combine:e=>Ct(e,{afterCursor:!0,brackets:gc,maxScanDistance:1e4,renderMatch:bc})}),Ac=xn.mark({class:"cm-matchingBracket"}),vc=xn.mark({class:"cm-nonmatchingBracket"});function bc(e){let t=[],n=e.matched?Ac:vc;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function xc(e){let t=[],n=e.facet(mc);for(let i of e.selection.ranges){if(!i.empty)continue;let r=Sc(e,i.head,-1,n)||i.head>0&&Sc(e,i.head-1,1,n)||n.afterCursor&&(Sc(e,i.head,1,n)||i.head<e.doc.length&&Sc(e,i.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return xn.set(t,!0)}const yc=[Ii.fromClass(class{constructor(e){this.paused=!1,this.decorations=xc(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=xc(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),pc];function wc(e={}){return[mc.of(e),yc]}const Cc=new ol;function kc(e,t,n){let i=e.prop(t<0?ol.openedBy:ol.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function _c(e){let t=e.type.prop(Cc);return t?t(e.node):e}function Sc(e,t,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||gc,o=fa(e),l=o.resolveInner(t,n);for(let e=l;e;e=e.parent){let i=kc(e.type,n,s);if(i&&e.from<e.to){let r=_c(e);if(r&&(n>0?t>=r.from&&t<r.to:t>r.from&&t<=r.to))return Ec(0,0,n,e,r,i,s)}}return function(e,t,n,i,r,s,o){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=s;){let s=h.value;n<0&&(e+=s.length);let l=t+e*n;for(let e=n>0?0:s.length-1,t=n>0?s.length:-1;e!=t;e+=n){let t=o.indexOf(s[e]);if(!(t<0||i.resolveInner(l+e,1).type!=r))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};u--}}n>0&&(e+=s.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,o,l.type,r,s)}function Ec(e,t,n,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},c=0,h=null==l?void 0:l.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==c&&s.indexOf(h.type.name)>-1&&h.from<h.to){let e=_c(h);return{start:a,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(kc(h.type,n,o))c++;else if(kc(h.type,-n,o)){if(0==c){let e=_c(h);return{start:a,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:a,matched:!1}}const Tc=Object.create(null),Oc=[cl.none],Mc=[],Bc=Object.create(null),Dc=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Dc[e]=Ic(Tc,t);function Rc(e,t){Mc.indexOf(e)>-1||(Mc.push(e),console.warn(t))}function Ic(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||oa[n];i?"function"==typeof i?t.length?t=t.map(i):Rc(n,`Modifier ${n} used at start of tag`):t.length?Rc(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:Rc(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map(e=>e.id),s=Bc[r];if(s)return s.id;let o=Bc[r]=cl.define({id:Oc.length,name:i,props:[jl({[i]:n})]});return Oc.push(o),o.id}Jn.RTL,Jn.LTR;class Pc{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=fa(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(jc(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Nc(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class Lc{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function Fc(e){return e.selection.main.from}function jc(e,t){var n;let{source:i}=e,r=t&&"^"!=i[0],s="$"!=i[i.length-1];return r||s?new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const zc=at.define();function Vc(e,t,n,i){let{main:r}=e.selection,s=n-r.from,o=i-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+s,l.from+o)!=e.sliceDoc(n,i))return{range:l};let a=e.toText(t);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:Ne.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Wc=new WeakMap;function Hc(e){if(!Array.isArray(e))return e;let t=Wc.get(e);return t||Wc.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,i]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=Nc(t)+Nc(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(t);return e=>{let r=e.matchBefore(i);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}(e)),t}const qc=ut.define(),$c=ut.define();class Uc{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=we(e,t),i=ke(n);this.chars.push(n);let r=e.slice(t,t+i),s=r.toUpperCase();this.folded.push(we(s==r?r.toLowerCase():s,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:r,byWord:s}=this;if(1==t.length){let i=we(e,0),r=ke(i),s=r==e.length?0:-100;if(i==t[0]);else{if(i!=n[0])return null;s+=-200}return this.ret(s,[0,r])}let o=e.indexOf(this.pattern);if(0==o)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(o<0){for(let r=0,s=Math.min(e.length,200);r<s&&a<l;){let s=we(e,r);s!=t[a]&&s!=n[a]||(i[a++]=r),r+=ke(s)}if(a<l)return null}let c=0,h=0,u=!1,d=0,f=-1,p=-1,g=/[a-z]/.test(e),m=!0;for(let i=0,a=Math.min(e.length,200),A=0;i<a&&h<l;){let a=we(e,i);o<0&&(c<l&&a==t[c]&&(r[c++]=i),d<l&&(a==t[d]||a==n[d]?(0==d&&(f=i),p=i+1,d++):d=0));let v,b=a<255?a>=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(v=Ce(a))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!i||1==b&&g||0==A&&0!=b)&&(t[h]==a||n[h]==a&&(u=!0)?s[h++]=i:s.length&&(m=!1)),A=b,i+=ke(a)}return h==l&&0==s[0]&&m?this.result((u?-200:0)-100,s,e):d==l&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):d==l?this.ret(-900-e.length,[f,p]):h==l?this.result((u?-200:0)-100-700+(m?0:-1100),s,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[],r=0;for(let e of t){let t=e+(this.astral?ke(we(n,e)):1);r&&i[r-1]==e?i[r-1]=t:(i[r++]=e,i[r++]=t)}return this.ret(e-n.length,i)}}class Kc{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Gc=je.define({combine:e=>Ct(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Jc,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Yc(e(n),t(n)),optionClass:(e,t)=>n=>Yc(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function Yc(e,t){return e?t?e+" "+t:e:t}function Jc(e,t,n,i,r,s){let o,l,a=e.textDirection==Jn.RTL,c=a,h=!1,u="top",d=t.left-r.left,f=r.right-t.right,p=i.right-i.left,g=i.bottom-i.top;if(c&&d<Math.min(p,f)?c=!1:!c&&f<Math.min(p,d)&&(c=!0),p<=(c?d:f))o=Math.max(r.top,Math.min(n.top,r.bottom-g))-t.top,l=Math.min(400,c?d:f);else{h=!0,l=Math.min(400,(a?t.right:r.right-t.left)-30);let e=r.bottom-t.bottom;e>=g||e>t.top?o=n.bottom-t.top:(u="bottom",o=t.bottom-n.top)}return{style:`${u}: ${o/((t.bottom-t.top)/s.offsetHeight)}px; max-width: ${l/((t.right-t.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":c?"left":"right")}}const Qc=ut.define();function Xc(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class Zc{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:r,selected:s}=i.open,o=e.state.facet(Gc);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,i){let r=document.createElement("span");r.className="cm-completionLabel";let s=e.displayLabel||e.label,o=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>o&&r.appendChild(document.createTextNode(s.slice(o,t)));let l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(t,n))),l.className="cm-completionMatchedText",o=n}return o<s.length&&r.appendChild(document.createTextNode(s.slice(o))),r},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Xc(r.length,s,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:i}=e.state.field(t).open;for(let t,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(t=/-(\d+)$/.exec(r.id))&&+t[1]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault();if(n.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:Qc.of(t)}),n.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Gc).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:$c.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:r,selected:s,disabled:o}=n.open;i.open&&i.open.options==r||(this.range=Xc(r.length,s,e.state.facet(Gc).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),o!=(null===(t=i.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Xc(t.options.length,t.selected,this.view.state.facet(Gc).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:r}=i;if(!r)return;let s="string"==typeof r?document.createTextNode(r):r(i);if(!s)return;"then"in s?s.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)}).catch(e=>Mi(this.view.state,e,"completion info")):(this.addInfoPane(s,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):i--;return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/r)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return i.top>Math.min(r.bottom,t.bottom)-10||i.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(Gc).positionInfo(this.view,t,i,n,r,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",e=>{e.target==i&&e.preventDefault()});let r=null;for(let s=n.from;s<n.to;s++){let{completion:o,match:l}=e[s],{section:a}=o;if(a){let e="string"==typeof a?a:a.name;e!=r&&(s>n.from||0==n.from)&&(r=e,"string"!=typeof a&&a.header?i.appendChild(a.header(a)):i.appendChild(document.createElement("completion-section")).textContent=e)}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+s,c.setAttribute("role","option");let h=this.optionClass(o);h&&(c.className=h);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function eh(e,t){return n=>new Zc(n,e,t)}function th(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class nh{constructor(e,t,n,i,r,s){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=s}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new nh(this.options,oh(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r,s){if(i&&!s&&e.some(e=>e.isPending))return i.setDisabled();let o=function(e,t){let n=[],i=null,r=null,s=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some(t=>t.name==e)||i.push("string"==typeof t?{name:e}:t)}},o=t.facet(Gc);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)s(new Lc(t,i.source,e?e(t):[],1e9-n.length));else{let n,l=t.sliceDoc(i.from,i.to),a=o.filterStrict?new Kc(l):new Uc(l);for(let t of i.result.options)if(n=a.match(t.label)){let o=t.displayLabel?e?e(t,n.matched):[]:n.matched,l=n.score+(t.boost||0);if(s(new Lc(t,i.source,o,l)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;r||(r=Object.create(null)),r[e]=Math.max(l,r[e]||-1e9)}}}}if(i){let e=Object.create(null),t=0,s=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?r[t.name]-r[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of i.sort(s))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let l=[],a=null,c=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;!a||a.label!=t.label||a.detail!=t.detail||null!=a.type&&null!=t.type&&a.type!=t.type||a.apply!=t.apply||a.boost!=t.boost?l.push(e):th(e.completion)>th(a)&&(l[l.length-1]=e),a=e.completion}return l}(e,t);if(!o.length)return i&&e.some(e=>e.isPending)?i.setDisabled():null;let l=t.facet(Gc).selectOnOpen?0:-1;if(i&&i.selected!=l&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<o.length;t++)if(o[t].completion==e){l=t;break}}return new nh(o,oh(n,l),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:ph,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new nh(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new nh(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class ih{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new ih(lh,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Gc),i=(n.override||t.languageDataAt("autocomplete",Fc(t)).map(Hc)).map(t=>(this.active.find(e=>e.source==t)||new ch(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let r=this.open,s=e.effects.some(e=>e.is(uh));r&&e.docChanged&&(r=r.map(e.changes)),e.selection||i.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;i<t.length&&!t[i].hasResult();)i++;let r=n==e.length,s=i==t.length;if(r||s)return r==s;if(e[n++].result!=t[i++].result)return!1}}(i,this.active)||s?r=nh.build(i,t,this.id,r,n,s):r&&r.disabled&&!i.some(e=>e.isPending)&&(r=null),!r&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new ch(e.source,0):e));for(let t of e.effects)t.is(Qc)&&(r=r&&r.setSelected(t.value,this.id));return i==this.active&&r==this.open?this:new ih(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?rh:sh}}const rh={"aria-autocomplete":"list"},sh={};function oh(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const lh=[];function ah(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(zc);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class ch{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=ah(e,t),i=this;(8&n||16&n&&this.touches(e))&&(i=new ch(i.source,0)),4&n&&0==i.state&&(i=new ch(this.source,1)),i=i.updateFor(e,n);for(let t of e.effects)if(t.is(qc))i=new ch(i.source,1,t.value);else if(t.is($c))i=new ch(i.source,0);else if(t.is(uh))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Fc(e.state))}}class hh extends ch{constructor(e,t,n,i,r,s){super(e,3,t),this.limit=n,this.result=i,this.from=r,this.to=s}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let r=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),o=Fc(e.state);if(o>s||!i||2&t&&(Fc(e.startState)==this.from||o<this.limit))return new ch(this.source,4&t?1:0);let l=e.changes.mapPos(this.limit);return function(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return"function"==typeof e?e(r,n,i,t):jc(e,!0).test(r)}(i.validFor,e.state,r,s)?new hh(this.source,this.explicit,l,i,r,s):i.update&&(i=i.update(i,r,s,new Pc(e.state,o,!1)))?new hh(this.source,this.explicit,l,i,i.from,null!==(n=i.to)&&void 0!==n?n:Fc(e.state)):new ch(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new hh(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ch(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const uh=ut.define({map:(e,t)=>e.map(e=>e.map(t))}),dh=Ue.define({create:()=>ih.start(),update:(e,t)=>e.update(t),provide:e=>[Oo.from(e,e=>e.tooltip),ro.contentAttributes.from(e,e=>e.attrs)]});function fh(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(dh).active.find(e=>e.source==t.source);return i instanceof hh&&("string"==typeof n?e.dispatch({...Vc(e.state,n,i.from,i.to),annotations:zc.of(t.completion)}):n(e,t.completion,i.from,i.to),!0)}const ph=eh(dh,fh);function gh(e,t="option"){return n=>{let i=n.state.field(dh,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Gc).interactionDelay)return!1;let r,s=1;"page"==t&&(r=No(n,i.open.tooltip))&&(s=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(e?1:-1):e?0:o-1;return l<0?l="page"==t?0:o-1:l>=o&&(l="page"==t?o-1:0),n.dispatch({effects:Qc.of(l)}),!0}}const mh=e=>!!e.state.field(dh,!1)&&(e.dispatch({effects:qc.of(!0)}),!0);class Ah{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const vh=Ii.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(dh).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(dh),n=e.state.facet(Gc);if(!e.selectionSet&&!e.docChanged&&e.startState.field(dh)==t)return;let i=e.transactions.some(e=>{let t=ah(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(i||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){Mi(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(qc)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),r):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(dh);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gc).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Fc(t),i=new Pc(t,n,e.explicit,this.view),r=new Ah(e,i);this.running.push(r),Promise.resolve(e.source(i)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:$c.of(null)}),Mi(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Gc).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Gc),i=this.view.state.field(dh);for(let r=0;r<this.running.length;r++){let s=this.running[r];if(void 0===s.done)continue;if(this.running.splice(r--,1),s.done){let i=Fc(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(i,s.done.from+(s.active.explicit?0:1)),o=new hh(s.active.source,s.active.explicit,r,s.done,s.done.from,null!==(e=s.done.to)&&void 0!==e?e:i);for(let e of s.updates)o=o.update(e,n);if(o.hasResult()){t.push(o);continue}}let o=i.active.find(e=>e.source==s.active.source);if(o&&o.isPending)if(null==s.done){let e=new ch(s.active.source,0);for(let t of s.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(o)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:uh.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(dh,!1);if(t&&t.tooltip&&this.view.state.facet(Gc).closeOnBlur){let n=t.open&&No(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:$c.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:qc.of(!1)}),20),this.composing=0}}}),bh="object"==typeof navigator&&/Win/.test(navigator.platform),xh=Ge.highest(ro.domEventHandlers({keydown(e,t){let n=t.state.field(dh,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!bh||!e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(e=>e.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&fh(t,i),!1}})),yh=ro.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),wh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ch=ut.define({map(e,t){let n=t.mapPos(e,-1,Se.TrackAfter);return null==n?void 0:n}}),kh=new class extends kt{};kh.startSide=1,kh.endSide=-1;const _h=Ue.define({create:()=>Ot.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(Ch)&&(e=e.update({add:[kh.range(n.value,n.value+1)]}));return e}}),Sh="()[]{}<>«»»«[]{}";function Eh(e){for(let t=0;t<16;t+=2)if(Sh.charCodeAt(t)==e)return Sh.charAt(t+1);return Ce(e<128?e:e+1)}const Th="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Oh=ro.inputHandler.of((e,t,n,i)=>{if((Th?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||2==i.length&&1==ke(we(i,0))||t!=r.from||n!=r.to)return!1;let s=function(e,t){let n=function(e,t){return e.languageDataAt("closeBrackets",t)[0]||wh}(e,e.selection.main.head),i=n.brackets||wh.brackets;for(let r of i){let s=Eh(we(r,0));if(t==r)return s==r?Ih(e,r,i.indexOf(r+r+r)>-1,n):Dh(e,r,s,n.before||wh.before);if(t==s&&Mh(e,e.selection.main.from))return Rh(e,0,s)}return null}(e.state,i);return!!s&&(e.dispatch(s),!0)});function Mh(e,t){let n=!1;return e.field(_h).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function Bh(e,t){let n=e.sliceString(t,t+2);return n.slice(0,ke(we(n,0)))}function Dh(e,t,n,i){let r=null,s=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:Ch.of(s.to+t.length),range:Ne.range(s.anchor+t.length,s.head+t.length)};let o=Bh(e.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:t+n,from:s.head},effects:Ch.of(s.head+t.length),range:Ne.cursor(s.head+t.length)}:{range:r=s}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Rh(e,t,n){let i=null,r=e.changeByRange(t=>t.empty&&Bh(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Ne.cursor(t.head+n.length)}:i={range:t});return i?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Ih(e,t,n,i){let r=i.stringPrefixes||wh.stringPrefixes,s=null,o=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:Ch.of(i.to+t.length),range:Ne.range(i.anchor+t.length,i.head+t.length)};let o,l=i.head,a=Bh(e.doc,l);if(a==t){if(Ph(e,l))return{changes:{insert:t+t,from:l},effects:Ch.of(l+t.length),range:Ne.cursor(l+t.length)};if(Mh(e,l)){let i=n&&e.sliceDoc(l,l+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+i.length,insert:i},range:Ne.cursor(l+i.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(o=Nh(e,l-2*t.length,r))>-1&&Ph(e,o))return{changes:{insert:t+t+t+t,from:l},effects:Ch.of(l+t.length),range:Ne.cursor(l+t.length)};if(e.charCategorizer(l)(a)!=bt.Word&&Nh(e,l,r)>-1&&!function(e,t,n,i){let r=fa(e).resolveInner(t,-1),s=i.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),l=o.indexOf(n);if(!l||l>-1&&i.indexOf(o.slice(0,l))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=r.to==t&&r.parent;if(!a)break;r=a}return!1}(e,l,t,r))return{changes:{insert:t+t,from:l},effects:Ch.of(l+t.length),range:Ne.cursor(l+t.length)}}return{range:s=i}});return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ph(e,t){let n=fa(e).resolveInner(t+1);return n.parent&&n.from==t}function Nh(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=bt.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&i(e.sliceDoc(n-1,n))!=bt.Word)return n}return-1}function Lh(e={}){return[xh,dh,Gc.of(e),vh,jh,yh]}const Fh=[{key:"Ctrl-Space",run:mh},{mac:"Alt-`",run:mh},{mac:"Alt-i",run:mh},{key:"Escape",run:e=>{let t=e.state.field(dh,!1);return!(!t||!t.active.some(e=>0!=e.state)||(e.dispatch({effects:$c.of(null)}),0))}},{key:"ArrowDown",run:gh(!0)},{key:"ArrowUp",run:gh(!1)},{key:"PageDown",run:gh(!0,"page")},{key:"PageUp",run:gh(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(dh,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Gc).interactionDelay)&&fh(e,t.open.options[t.open.selected])}}],jh=Ge.highest(fo.computeN([Gc],e=>e.facet(Gc).defaultKeymap?[Fh]:[]));function zh(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(i(n.update(r)),!0)}}const Vh=zh(Kh,0),Wh=zh(Uh,0),Hh=zh((e,t)=>Uh(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>i.from?t[s].to=r.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}(t)),0);function qh(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const $h=50;function Uh(e,t,n=t.selection.ranges){let i=n.map(e=>qh(t,e.from).block);if(!i.every(e=>e))return null;let r=n.map((e,n)=>function(e,{open:t,close:n},i,r){let s,o,l=e.sliceDoc(i-$h,i),a=e.sliceDoc(r,r+$h),c=/\s*$/.exec(l)[0].length,h=/^\s*/.exec(a)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&a.slice(h,h+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};r-i<=2*$h?s=o=e.sliceDoc(i,r):(s=e.sliceDoc(i,i+$h),o=e.sliceDoc(r-$h,r));let d=/^\s*/.exec(s)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-n.length;return s.slice(d,d+t.length)==t&&o.slice(p,p+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(s.charAt(d+t.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(t,i[n],e.from,e.to));if(2!=e&&!r.every(e=>e))return{changes:t.changes(n.map((e,t)=>r[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}]))};if(1!=e&&r.some(e=>e)){let e=[];for(let t,n=0;n<r.length;n++)if(t=r[n]){let r=i[n],{open:s,close:o}=t;e.push({from:s.pos-r.open.length,to:s.pos+s.margin},{from:o.pos-o.margin,to:o.pos+r.close.length})}return{changes:e}}return null}function Kh(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:e,to:s}of n){let n,o=i.length,l=1e9;for(let o=e;o<=s;){let a=t.doc.lineAt(o);if(null==n&&(n=qh(t,a.from).line,!n))continue e;if(a.from>r&&(e==s||s>a.from)){r=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,s=a.text.slice(e,e+n.length)==n?e:-1;e<a.text.length&&e<l&&(l=e),i.push({line:a,comment:s,token:n,indent:e,empty:t,single:!1})}o=a.to+1}if(l<1e9)for(let e=o;e<i.length;e++)i[e].indent<i[e].line.text.length&&(i[e].indent=l);i.length==o+1&&(i[o].single=!0)}if(2!=e&&i.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:r,empty:s,single:o}of i)!o&&s||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:r}of i)if(n>=0){let i=t.from+n,s=i+r.length;" "==t.text[s-t.from]&&s++,e.push({from:i,to:s})}return{changes:e}}return null}const Gh=at.define(),Yh=je.define();class Jh{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new Jh(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new Jh(e.changes&&Te.fromJSON(e.changes),[],e.mapped&&Ee.fromJSON(e.mapped),e.startSelection&&Ne.fromJSON(e.startSelection),e.selectionsAfter.map(Ne.fromJSON))}static fromTransaction(e,t){let n=Zh;for(let t of e.startState.facet(Yh)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new Jh(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Zh)}static selection(e){return new Jh(void 0,Zh,void 0,void 0,e)}}function Qh(e,t,n,i){let r=t+1>n+20?t-n-1:0,s=e.slice(r,t);return s.push(i),s}function Xh(e,t){return e.length?t.length?e.concat(t):e:t}const Zh=[];function eu(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function tu(e,t){if(!e.length)return e;let n=e.length,i=Zh;for(;n;){let r=nu(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,i=r.selectionsAfter}return i.length?[Jh.selection(i)]:Zh}function nu(e,t,n){let i=Xh(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Zh,n);if(!e.changes)return Jh.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new Jh(r,ut.mapEffects(e.effects,t),o,e.startSelection.map(s),i)}const iu=/^(input\.type|delete)($|\.)/;class ru{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new ru(this.done,this.undone):this}addChanges(e,t,n,i,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&e.changes&&(!n||iu.test(n))&&(!o.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,function(e,t){let n=[],i=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,r,s)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];s>=t&&r<=o&&(i=!0)}}),i}(o.changes,e.changes))||"input.type.compose"==n)?Qh(s,s.length-1,i.minDepth,new Jh(e.changes.compose(o.changes),Xh(ut.mapEffects(e.effects,o.changes),o.effects),o.mapped,o.startSelection,Zh)):Qh(s,s.length,i.minDepth,e),new ru(s,Zh,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Zh;return r.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(s=r[r.length-1],o=e,s.ranges.length==o.ranges.length&&0===s.ranges.filter((e,t)=>e.empty!=o.ranges[t].empty).length)?this:new ru(function(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),Qh(e,e.length-1,1e9,n.setSelAfter(i)))}return[Jh.selection([t])]}(this.done,e),this.undone,t,n);var s,o}addMapping(e){return new ru(tu(this.done,e),tu(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1],s=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Gh.of({side:e,rest:eu(i),selection:s}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?Zh:i.slice(0,i.length-1);return r.mapped&&(n=tu(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Gh.of({side:e,rest:n,selection:s}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}function su(e,t){return Ne.create(e.ranges.map(t),e.mainIndex)}function ou(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function lu({state:e,dispatch:t},n){let i=su(e.selection,n);return!i.eq(e.selection,!0)&&(t(ou(e,i)),!0)}function au(e,t){return Ne.cursor(t?e.to:e.from)}function cu(e,t){return lu(e,n=>n.empty?e.moveByChar(n,t):au(n,t))}function hu(e){return e.textDirectionAt(e.state.selection.main.head)==Jn.LTR}ru.empty=new ru(Zh,Zh);const uu=e=>cu(e,!hu(e)),du=e=>cu(e,hu(e));function fu(e,t){return lu(e,n=>n.empty?e.moveByGroup(n,t):au(n,t))}function pu(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function gu(e,t,n){let i,r,s=fa(e).resolveInner(t.head),o=n?ol.closedBy:ol.openedBy;for(let i=t.head;;){let t=n?s.childAfter(i):s.childBefore(i);if(!t)break;pu(e,t,o)?s=t:i=n?t.to:t.from}return r=s.type.prop(o)&&(i=n?Sc(e,s.from,1):Sc(e,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,Ne.cursor(r,n?-1:1)}function mu(e,t){return lu(e,n=>{if(!n.empty)return au(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;const Au=e=>mu(e,!1),vu=e=>mu(e,!0);function bu(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,i=0,r=0;if(n){for(let t of e.state.facet(ro.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(r=Math.max(null==n?void 0:n.bottom,r))}t=e.scrollDOM.clientHeight-i-r}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:r,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function xu(e,t){let n,i=bu(e),{state:r}=e,s=su(r.selection,n=>n.empty?e.moveVertically(n,t,i.height):au(n,t));if(s.eq(r.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+i.marginTop,a=o.bottom-i.marginBottom;t&&t.top>l&&t.bottom<a&&(n=ro.scrollIntoView(s.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(ou(r,s),{effects:n}),!0}const yu=e=>xu(e,!1),wu=e=>xu(e,!0);function Cu(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(r=Ne.cursor(i.from+n))}return r}function ku(e,t){let n=su(e.state.selection,e=>{let n=t(e);return Ne.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(ou(e.state,n)),!0)}function _u(e,t){return ku(e,n=>e.moveByChar(n,t))}const Su=e=>_u(e,!hu(e)),Eu=e=>_u(e,hu(e));function Tu(e,t){return ku(e,n=>e.moveByGroup(n,t))}function Ou(e,t){return ku(e,n=>e.moveVertically(n,t))}const Mu=e=>Ou(e,!1),Bu=e=>Ou(e,!0);function Du(e,t){return ku(e,n=>e.moveVertically(n,t,bu(e).height))}const Ru=e=>Du(e,!1),Iu=e=>Du(e,!0),Pu=({state:e,dispatch:t})=>(t(ou(e,{anchor:0})),!0),Nu=({state:e,dispatch:t})=>(t(ou(e,{anchor:e.doc.length})),!0),Lu=({state:e,dispatch:t})=>(t(ou(e,{anchor:e.selection.main.anchor,head:0})),!0),Fu=({state:e,dispatch:t})=>(t(ou(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function ju(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head);if(t?s.to<e.state.doc.length:s.from>0)for(let n=i;;){let i=e.moveVertically(n,t);if(i.head<s.from||i.head>s.to){r.some(e=>e.head==i.head)||r.push(i);break}if(i.head==n.head)break;n=i}}return r.length!=i.ranges.length&&(e.dispatch(ou(n,Ne.create(r,r.length-1))),!0)}function zu(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange(i=>{let{from:r,to:s}=i;if(r==s){let o=t(i);o<r?(n="delete.backward",o=Vu(e,o,!1)):o>r&&(n="delete.forward",o=Vu(e,o,!0)),r=Math.min(r,o),s=Math.max(s,o)}else r=Vu(e,r,!1),s=Vu(e,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:Ne.cursor(r,r<i.head?-1:1)}});return!r.changes.empty&&(e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?ro.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Vu(e,t,n){if(e instanceof ro)for(let i of e.state.facet(ro.atomicRanges).map(t=>t(e)))i.between(t,t,(e,i)=>{e<t&&i>t&&(t=n?i:e)});return t}const Wu=(e,t,n)=>zu(e,i=>{let r,s,o=i.from,{state:l}=e,a=l.doc.lineAt(o);if(n&&!t&&o>a.from&&o<a.from+200&&!/[^ \t]/.test(r=a.text.slice(0,o-a.from))){if("\t"==r[r.length-1])return o-1;let e=Vt(r,l.tabSize)%Sa(l)||Sa(l);for(let t=0;t<e&&" "==r[r.length-1-t];t++)o--;s=o}else s=ye(a.text,o-a.from,t,t)+a.from,s==o&&a.number!=(t?l.doc.lines:1)?s+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(a.text.slice(s-a.from,o-a.from))&&(s=ye(a.text,s-a.from,!1,!1)+a.from);return s}),Hu=e=>Wu(e,!1,!0),qu=e=>Wu(e,!0,!1),$u=(e,t)=>zu(e,n=>{let i=n.head,{state:r}=e,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let e=null;;){if(i==(t?s.to:s.from)){i==n.head&&s.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let l=ye(s.text,i-s.from,t)+s.from,a=s.text.slice(Math.min(i,l)-s.from,Math.max(i,l)-s.from),c=o(a);if(null!=e&&c!=e)break;" "==a&&i==n.head||(e=c),i=l}return i}),Uu=e=>$u(e,!1);function Ku(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),s=e.doc.lineAt(i.to);if(i.empty||i.to!=s.from||(s=e.doc.lineAt(i.to-1)),n>=r.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function Gu(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let t of Ku(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),o=s.length+1;if(n){i.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)r.push(Ne.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{i.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)r.push(Ne.range(e.anchor-o,e.head-o))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:Ne.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Yu(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of Ku(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Ju=Qu(!1);function Qu(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{let{from:i,to:r}=n,s=t.doc.lineAt(i),o=!e&&i==r&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=fa(e).resolveInner(t),r=i.childBefore(t),s=i.childAfter(t);return r&&s&&r.to<=t&&s.from>=t&&(n=r.type.prop(ol.closedBy))&&n.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(t,i);e&&(i=r=(r<=s.to?s:t.doc.lineAt(r)).to);let l=new Oa(t,{simulateBreak:i,simulateDoubleBreak:!!o}),a=Ta(l,i);for(null==a&&(a=Vt(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));r<s.to&&/\s/.test(s.text[r-s.from]);)r++;o?({from:i,to:r}=o):i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let c=["",Ea(t,a)];return o&&c.push(Ea(t,l.lineIndent(s.from,-1))),{changes:{from:i,to:r,insert:ue.of(c)},range:Ne.cursor(i+1+c[1].length)}});return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Xu(e,t){let n=-1;return e.changeByRange(i=>{let r=[];for(let s=i.from;s<=i.to;){let o=e.doc.lineAt(s);o.number>n&&(i.empty||i.to>o.from)&&(t(o,r,i),n=o.number),s=o.to+1}let s=e.changes(r);return{changes:r,range:Ne.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Zu=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>lu(e,t=>gu(e.state,t,!hu(e))),shift:e=>ku(e,t=>gu(e.state,t,!hu(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>lu(e,t=>gu(e.state,t,hu(e))),shift:e=>ku(e,t=>gu(e.state,t,hu(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Gu(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Yu(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Gu(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Yu(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>ju(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>ju(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=Ne.create([n.main]):n.main.empty||(i=Ne.create([Ne.cursor(n.main.head)])),!!i&&(t(ou(e,i)),!0)}},{key:"Mod-Enter",run:Qu(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Ku(e).map(({from:t,to:n})=>Ne.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Ne.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=su(e.selection,t=>{let n=fa(e),i=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Ne.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(ou(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Xu(e,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let r=Vt(i,e.tabSize),s=0,o=Ea(e,Math.max(0,r-Sa(e)));for(;s<i.length&&s<o.length&&i.charCodeAt(s)==o.charCodeAt(s);)s++;n.push({from:t.from+s,to:t.from+i.length,insert:o.slice(s)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Xu(e,(t,n)=>{n.push({from:t.from,insert:e.facet(_a)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new Oa(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=Xu(e,(t,r,s)=>{let o=Ta(i,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let l=/^\s*/.exec(t.text)[0],a=Ea(e,o);(l!=a||s.from<t.from+l.length)&&(n[t.from]=o,r.push({from:t.from,to:t.from+l.length,insert:a}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Ku(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),i=su(t.selection,t=>{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),r=e.coordsAtPos(t.head,t.assoc||1);r&&(n=i.bottom+e.documentTop-r.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let i=!1,r=su(e.selection,t=>{let r=Sc(e,t.head,-1)||Sc(e,t.head,1)||t.head>0&&Sc(e,t.head-1,1)||t.head<e.doc.length&&Sc(e,t.head+1,-1);if(!r||!r.end)return t;i=!0;let s=r.start.from==t.head?r.end.to:r.end.from;return n?Ne.range(t.anchor,s):Ne.cursor(s)});return!!i&&(t(ou(e,r)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=qh(e.state,n.from);return i.line?Vh(e):!!i.block&&Hh(e)}},{key:"Alt-A",run:Wh},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:uu,shift:Su,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>fu(e,!hu(e)),shift:e=>Tu(e,!hu(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>lu(e,t=>Cu(e,t,!hu(e))),shift:e=>ku(e,t=>Cu(e,t,!hu(e))),preventDefault:!0},{key:"ArrowRight",run:du,shift:Eu,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>fu(e,hu(e)),shift:e=>Tu(e,hu(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>lu(e,t=>Cu(e,t,hu(e))),shift:e=>ku(e,t=>Cu(e,t,hu(e))),preventDefault:!0},{key:"ArrowUp",run:Au,shift:Mu,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Pu,shift:Lu},{mac:"Ctrl-ArrowUp",run:yu,shift:Ru},{key:"ArrowDown",run:vu,shift:Bu,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Nu,shift:Fu},{mac:"Ctrl-ArrowDown",run:wu,shift:Iu},{key:"PageUp",run:yu,shift:Ru},{key:"PageDown",run:wu,shift:Iu},{key:"Home",run:e=>lu(e,t=>Cu(e,t,!1)),shift:e=>ku(e,t=>Cu(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:Pu,shift:Lu},{key:"End",run:e=>lu(e,t=>Cu(e,t,!0)),shift:e=>ku(e,t=>Cu(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:Nu,shift:Fu},{key:"Enter",run:Ju,shift:Ju},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Hu,shift:Hu,preventDefault:!0},{key:"Delete",run:qu,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Uu,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>$u(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>zu(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>zu(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat([{key:"Ctrl-b",run:uu,shift:Su,preventDefault:!0},{key:"Ctrl-f",run:du,shift:Eu},{key:"Ctrl-p",run:Au,shift:Mu},{key:"Ctrl-n",run:vu,shift:Bu},{key:"Ctrl-a",run:e=>lu(e,t=>Ne.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>ku(e,t=>Ne.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>lu(e,t=>Ne.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>ku(e,t=>Ne.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:qu},{key:"Ctrl-h",run:Hu},{key:"Ctrl-k",run:e=>zu(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:Uu},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:ue.of(["",""])},range:Ne.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),r=n==i.from?n-1:ye(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:ye(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(r,n))},range:Ne.cursor(s)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:wu}].map(e=>({mac:e.key,run:e.run,shift:e.shift}))));function ed(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?e.setAttribute(i,r):null!=r&&(e[i]=r)}t++}for(;t<arguments.length;t++)td(e,arguments[t]);return e}function td(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)td(e,t[n])}}class nd{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class id{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=n.facet(gd).markerFilter;i&&(e=i(e,n));let r=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new Mt,o=[],l=0,a=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,i=e==r.length?null:r[e];if(!i&&!o.length)break;if(o.length)t=l,n=o.reduce((e,t)=>Math.min(e,t.to),i&&i.from>t?i.from:1e8);else{if(t=i.from,t>h)break;n=i.to,o.push(i),e++}for(;e<r.length;){let i=r[e];if(i.from!=t||!(i.to>i.from||i.to==t)){n=Math.min(i.from,n);break}o.push(i),e++,n=Math.min(i.to,n)}n=Math.min(n,h);let u=!1;if(o.some(e=>e.from==t&&(e.to==n||n==h))&&(u=t==n,!u&&n-t<10)){let e=t-(c+a.value.length);e>0&&(a.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!a.lineBreak&&c+a.value.length>e)break;e=c+a.value.length,c+=a.value.length,a.next()}}let d=Sd(o);if(u)s.add(t,t,xn.widget({widget:new xd(d),diagnostics:o.slice()}));else{let e=o.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");s.add(t,n,xn.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:o.slice(),inclusiveEnd:o.some(e=>e.to>n)}))}if(l=n,l==h)break;for(let e=0;e<o.length;e++)o[e].to<=l&&o.splice(e--,1)}let u=s.finish();return new id(u,t,rd(u))}}function rd(e,t=null,n=0){let i=null;return e.between(n,1e9,(e,n,{spec:r})=>{if(!(t&&r.diagnostics.indexOf(t)<0))if(i){if(r.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new nd(i.from,n,i.diagnostic)}else i=new nd(e,n,t||r.diagnostics[0])}),i}function sd(e,t){return e.field(cd,!1)?t:t.concat(ut.appendConfig.of(Ed))}const od=ut.define(),ld=ut.define(),ad=ut.define(),cd=Ue.define({create:()=>new id(xn.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,r=e.panel;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);i=rd(n,e.selected.diagnostic,r)||rd(n,null,r)}!n.size&&r&&t.state.facet(gd).autoPanel&&(r=null),e=new id(n,r,i)}for(let n of t.effects)if(n.is(od)){let i=t.state.facet(gd).autoPanel?n.value.length?wd.open:null:e.panel;e=id.init(n.value,i,t.state)}else n.is(ld)?e=new id(e.diagnostics,n.value?wd.open:null,e.selected):n.is(ad)&&(e=new id(e.diagnostics,e.panel,n.value));return e},provide:e=>[Wo.from(e,e=>e.panel),ro.decorations.from(e,e=>e.diagnostics)]}),hd=xn.mark({class:"cm-lintRange cm-lintRange-active"});function ud(e,t,n){let i,{diagnostics:r}=e.state.field(cd),s=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=l.diagnostics,s=e,o=r,!1});let l=e.state.facet(gd).tooltipFilter;return i&&l&&(i=l(i,e.state)),i?{pos:s,end:o,above:e.state.doc.lineAt(s).to<o,create:()=>({dom:dd(e,i)})}:null}function dd(e,t){return ed("ul",{class:"cm-tooltip-lint"},t.map(t=>bd(e,t,!1)))}const fd=e=>{let t=e.state.field(cd,!1);return!(!t||!t.panel||(e.dispatch({effects:ld.of(!1)}),0))},pd=Ii.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(gd);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(gd);t.length&&function(e,t,n){let i=[],r=-1;for(let s of e)s.then(n=>{i.push(n),clearTimeout(r),i.length==e.length?t(i):r=setTimeout(()=>t(i),200)},n)}(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:sd(e,[od.of(t)])}}(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{Mi(this.view.state,e)})}}update(e){let t=e.state.facet(gd);(e.docChanged||t!=e.startState.facet(gd)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),gd=je.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...Ct(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:md,tooltipFilter:md,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,i,r)=>e(n,i,r)||t(n,i,r):e:t,autoPanel:(e,t)=>e||t})})});function md(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function Ad(e,t={}){return[gd.of({source:e,config:t}),pd,Ed]}function vd(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let i=n[e];if(/[a-zA-Z]/.test(i)&&!t.some(e=>e.toLowerCase()==i.toLowerCase())){t.push(i);continue e}}t.push("")}return t}function bd(e,t,n){var i;let r=n?vd(t.actions):[];return ed("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},ed("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(i=t.actions)||void 0===i?void 0:i.map((n,i)=>{let s=!1,o=i=>{if(i.preventDefault(),s)return;s=!0;let r=rd(e.state.field(cd).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:l}=n,a=r[i]?l.indexOf(r[i]):-1,c=a<0?l:[l.slice(0,a),ed("u",l.slice(a,a+1)),l.slice(a+1)];return ed("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:o,onmousedown:o,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[i]})"`}.`},c)}),t.source&&ed("div",{class:"cm-diagnosticSource"},t.source))}class xd extends vn{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return ed("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class yd{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=bd(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class wd{constructor(e){this.view=e,this.items=[],this.list=ed("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(27==t.keyCode)fd(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=vd(n.actions);for(let r=0;r<i.length;r++)if(i[r].toUpperCase().charCodeAt(0)==t.keyCode){let t=rd(this.view.state.field(cd).diagnostics,n);t&&n.actions[r].apply(e,t.from,t.to)}}}t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=ed("div",{class:"cm-panel-lint"},this.list,ed("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>fd(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(cd).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(cd),n=0,i=!1,r=null,s=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:l})=>{for(let e of l.diagnostics){if(s.has(e))continue;s.add(e);let o,l=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){l=t;break}l<0?(o=new yd(this.view,e),this.items.splice(n,0,o),i=!0):(o=this.items[l],l>n&&(this.items.splice(n,l-n),i=!0)),t&&o.diagnostic==t.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),r=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new yd(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=rd(this.view.state.field(cd).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:ad.of(t)})}static open(e){return new wd(e)}}function Cd(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const kd=ro.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Cd("#d11")},".cm-lintRange-warning":{backgroundImage:Cd("orange")},".cm-lintRange-info":{backgroundImage:Cd("#999")},".cm-lintRange-hint":{backgroundImage:Cd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function _d(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function Sd(e){let t="hint",n=1;for(let i of e){let e=_d(i.severity);e>n&&(n=e,t=i.severity)}return t}const Ed=[cd,ro.decorations.compute([cd],e=>{let{selected:t,panel:n}=e.field(cd);return t&&n&&t.from!=t.to?xn.set([hd.range(t.from,t.to)]):xn.none}),Po(ud,{hideOn:function(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(gd).hideOn(e,n,i);if(null!=r)return r;let s=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(od))&&!e.changes.touchesRange(s.from,Math.max(s.to,i)))}}),kd];class Td{constructor(e,t,n,i,r,s,o,l,a,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=l,this.curContext=a,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new Td(e,[],t,n,n,0,[],0,i?new Od(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:r}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),o=r.dynamicPrecedence(i);if(o&&(this.score+=o),0==n)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i<r.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),void this.reduceContext(i,this.reducePos);let l=this.stack.length-3*(n-1)-(262144&e?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,c=this.reducePos-a;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=c));let h=l?this.stack[l-1]:0,u=this.bufferBase+this.buffer.length-h;if(i<r.minRepeatTerm||131072&e){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,e,u+4,!0)}if(262144&e)this.state=this.stack[l];else{let e=this.stack[l-3];this.state=r.getGoto(e,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,t,n,i=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,i=this.buffer.length;if(0==i&&e.parent&&(i=e.bufferBase-e.parent.bufferBase,e=e.parent),i>0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&(0!=this.buffer[r-4]||this.buffer[r-1]<0)){let e=!1;for(let t=r;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let r=e,{parser:s}=this.p;this.pos=i;let o=s.stateFlag(r,1);!o&&(i>n||t<=s.maxNode)&&(this.reducePos=i),this.pushState(r,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new Td(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Md(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let i=t[e+1];n.some((e,t)=>1&t&&e==i)||n.push(t[e],i)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let i=t[e+1];if(i==this.state)continue;let r=this.split();r.pushState(i,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(t[e],this.pos),r.reducePos=this.pos,r.score-=200,n.push(r)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=65535&t,r=this.stack.length-3*n;if(r<0||e.getGoto(this.stack[r],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,r)=>{if(!t.includes(i))return t.push(i),e.allActions(i,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-r;if(n>1){let i=65535&t,r=this.stack.length-3*n;if(r>=0&&e.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,r+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Od(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead||(this.emitLookAhead(),this.lookAhead=e,0))}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Od{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Md{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Bd{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Bd(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Bd(this.stack,this.pos,this.index)}}function Dd(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,r=0;i<e.length;){let s=0;for(;;){let t=e.charCodeAt(i++),n=!1;if(126==t){s=65535;break}t>=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,n=!0),s+=r,n)break;s*=46}n?n[r++]=s:n=new t(s)}return n}class Rd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Id=new Rd;class Pd{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Id,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,r=this.pos+e;for(;r<n.from;){if(!i)return null;let e=this.ranges[--i];r-=n.from-e.to,n=e}for(;t<0?r>n.to:r>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];r+=e.from-n.to,n=e}return r}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(e,1);if(null==i)return-1;if(t=i,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,i=this.range;for(;i.to<=t;)i=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Id,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Nd{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,i,r,s){let o=0,l=1<<i,{dialect:a}=n.p.parser;e:for(;0!=(l&e[o]);){let n=e[o+1];for(let i=o+3;i<n;i+=2)if((e[i+1]&l)>0){let n=e[i];if(a.allows(n)&&(-1==t.token.value||t.token.value==n||Fd(n,t.token.value,r,s))){t.acceptToken(n);break}}let i=t.next,c=0,h=e[o+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3])){for(;c<h;){let r=c+h>>1,s=n+r+(r<<1),l=e[s],a=e[s+1]||65536;if(i<l)h=r;else{if(!(i>=a)){o=e[s+2],t.advance();continue e}c=r+1}}break}o=e[n+3*h-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function Ld(e,t,n){for(let i,r=t;65535!=(i=e[r]);r++)if(i==n)return r-t;return-1}function Fd(e,t,n,i){let r=Ld(n,i,t);return r<0||Ld(n,i,e)<r}Nd.prototype.contextual=Nd.prototype.fallback=Nd.prototype.extend=!1,Nd.prototype.fallback=Nd.prototype.extend=!1;const jd="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let zd=null;function Vd(e,t,n){let i=e.cursor(fl.IncludeAnonymous);for(i.moveTo(t);;)if(!(n<0?i.childBefore(t):i.childAfter(t)))for(;;){if((n<0?i.to<t:i.from>t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class Wd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Vd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Vd(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=n.children[i],s=this.start[t]+n.positions[i];if(s>e)return this.nextStart=s,null;if(r instanceof pl){if(s==e){if(s<this.safeFrom)return null;let e=s+r.length;if(e<=this.safeTo){let t=r.prop(ol.lookAhead);if(!t||e+t<this.fragment.to)return r}}this.index[t]++,s+r.length>=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+r.length}}}class Hd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new Rd)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:r}=i,s=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let i=0;i<r.length;i++){if(!(1<<i&s))continue;let a=r[i],c=this.tokens[i];if((!n||a.fallback)&&((a.contextual||c.start!=e.pos||c.mask!=s||c.context!=o)&&(this.updateCachedToken(c,a,e),c.mask=s,c.context=o),c.lookAhead>c.end+25&&(l=Math.max(c.lookAhead,l)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!a.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),n||e.pos!=this.stream.end||(n=new Rd,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Rd,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i<t.specialized.length;i++)if(t.specialized[i]==e.value){let r=t.specializers[i](this.stream.read(e.start,e.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){1&r?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t<i;t+=3)if(this.actions[t]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:r}=e,{parser:s}=e.p,{data:o}=s;for(let e=0;e<2;e++)for(let l=s.stateSlot(r,e?2:1);;l+=3){if(65535==o[l]){if(1!=o[l+1]){0==i&&2==o[l+1]&&(i=this.putAction(Gd(o,l+2),t,n,i));break}l=Gd(o,l+2)}o[l]==t&&(i=this.putAction(Gd(o,l+1),t,n,i))}return i}}class qd{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Pd(t,i),this.tokens=new Hd(e,this.stream),this.topTerm=e.top[1];let{from:r}=i[0];this.stacks=[Td.start(this,e.top[0],r)],this.fragments=n.length&&this.stream.end-r>4*e.bufferLength?new Wd(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<n.length;s++){let o=n[s];for(;;){if(this.tokens.mainToken=null,o.pos>i)r.push(o);else{if(this.advanceStack(o,r,n))continue;{e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);t.push(n.value,n.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return jd&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw jd&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,r);if(n)return jd&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort((e,t)=>t.score-e.score);r.length>e;)r.pop();r.some(e=>e.reducePos>i)&&this.recovering--}else if(r.length>1){e:for(let e=0;e<r.length-1;e++){let t=r[e];for(let n=e+1;n<r.length;n++){let i=r[n];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(n--,1)}}}r.length>12&&(r.sort((e,t)=>t.score-e.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let e=1;e<r.length;e++)r[e].pos<this.minStackPos&&(this.minStackPos=r[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:r}=this,s=jd?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(i);o;){let i=this.parser.nodeSet.types[o.type.id]==o.type?r.getGoto(e.state,o.type.id):-1;if(i>-1&&o.length&&(!t||(o.prop(ol.contextHash)||0)==n))return e.useNode(o,i),jd&&console.log(s+this.stackID(e)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof pl)||0==o.children.length||o.positions[0]>0)break;let l=o.children[0];if(!(l instanceof pl&&0==o.positions[0]))break;o=l}}let o=r.stateSlot(e.state,4);if(o>0)return e.reduce(o),jd&&console.log(s+this.stackID(e)+` (via always-reduce ${r.getName(65535&o)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let o=0;o<l.length;){let a=l[o++],c=l[o++],h=l[o++],u=o==l.length||!n,d=u?e:e.split(),f=this.tokens.mainToken;if(d.apply(a,c,f?f.start:d.pos,h),jd&&console.log(s+this.stackID(d)+` (via ${65536&a?`reduce of ${r.getName(65535&a)}`:"shift"} for ${r.getName(c)} @ ${i}${d==e?"":", split"})`),u)return!0;d.pos>i?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return $d(e,t),!0}}runRecovery(e,t,n){let i=null,r=!1;for(let s=0;s<e.length;s++){let o=e[s],l=t[s<<1],a=t[1+(s<<1)],c=jd?this.stackID(o)+" -> ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),jd&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let h=o.split(),u=c;for(let e=0;e<10&&h.forceReduce()&&(jd&&console.log(u+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));e++)jd&&(u=this.stackID(h)+" -> ");for(let e of o.recoverByInsert(l))jd&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>o.pos?(a==o.pos&&(a++,l=0),o.recoverByDelete(l,a),jd&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),$d(o,n)):(!i||i.score<h.score)&&(i=h)}return i}stackToTree(e){return e.close(),pl.build({buffer:Bd.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(zd||(zd=new WeakMap)).get(e);return t||zd.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function $d(e,t){for(let n=0;n<t.length;n++){let i=t[n];if(i.pos==e.pos&&i.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class Ud{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class Kd extends Rl{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),i=[];for(let e=0;e<t.length;e++)i.push([]);function r(e,t,n){i[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=ol[e]);for(let n=1;n<t.length;){let i=t[n++];if(i>=0)r(i,e,t[n++]);else{let s=t[n+-i];for(let o=-i;o>0;o--)r(t[n++],e,s);n++}}}this.nodeSet=new hl(t.map((t,r)=>cl.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=il;let s=Dd(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(Yd),this.states=Dd(e.states,Uint32Array),this.data=Dd(e.stateData),this.goto=Dd(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new Nd(s,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new qd(this,e,t,n);for(let r of this.wrappers)i=r(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let r=i[t+1];;){let t=i[r++],s=1&t,o=i[r++];if(s&&n)return o;for(let n=r+(t>>1);r<n;r++)if(i[r]==e)return o;if(s)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let r,s=this.stateSlot(e,i?2:1);;s+=3){if(65535==(r=n[s])){if(1!=n[s+1]){if(2==n[s+1])return Gd(n,s+2);break}r=n[s=Gd(n,s+2)]}if(r==t||0==r)return Gd(n,s+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Gd(this.data,n+2)}i=t(Gd(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Gd(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(Kd.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let r=e.specializers.find(e=>e.from==n.external);if(!r)return n;let s=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[i]=Yd(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,r=this.dialects[t[e]];65535!=(n=this.data[r++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new Ud(e,n,i)}static deserialize(e){return new Kd(e)}}function Gd(e,t){return e[t]|e[t+1]<<16}function Yd(e){if(e.external){let t=e.extend?1:0;return(n,i)=>e.external(n,i)<<1|t}return e.get}const Jd=jl({String:oa.string,Number:oa.number,"True False":oa.bool,PropertyName:oa.propertyName,Null:oa.null,", :":oa.separator,"[ ]":oa.squareBracket,"{ }":oa.brace}),Qd=Kd.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Jd],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Xd=da.define({name:"json",parser:Qd.configure({props:[Ma.add({Object:Na({except:/^\s*\}/}),Array:Na({except:/^\s*\]/})}),Fa.add({"Object Array":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Zd(){return new Ca(Xd)}const ef=[ro.theme({"&":{height:"100%",width:"100%"},".cm-scroller":{overflow:"auto"},"& .cm-content":{padding:"0px"},"& .cm-line":{padding:"0px"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-completionInfo":{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis"},"&.cm-editor":{height:"100%"},"& .cm-completionInfo > *":{whiteSpace:"normal"},"& .cm-completionInfo ul":{margin:0,paddingLeft:"15px"},"& .cm-completionInfo pre":{marginBottom:0,whiteSpace:"pre-wrap"},"& .cm-completionInfo p":{marginTop:0},"& .cm-completionInfo p:not(:last-of-type)":{marginBottom:0},"& .cm-completionDetail":{float:"right",fontStyle:"normal"}}),ro.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),function(e){let t,n=[fc];return e instanceof ac&&(e.module&&n.push(ro.styleModule.of(e.module)),t=e.themeType),t?n.push(cc.computeN([ro.darkTheme],n=>n.facet(ro.darkTheme)==("dark"==t)?[e]:[])):n.push(cc.of(e)),n}(ac.define([{tag:oa.variableName,class:"variableName"},{tag:oa.name,class:"variableName"},{tag:oa.number,class:"number"},{tag:oa.string,class:"string"},{tag:oa.bool,class:"bool"},{tag:oa.function(oa.variableName),class:"function"},{tag:oa.function(oa.special(oa.variableName)),class:"function"},{tag:oa.controlKeyword,class:"control"},{tag:oa.operatorKeyword,class:"control"}]))];function tf(e){return[nf(e),ro.updateListener.of(e=>{if(e.selectionSet||e.docChanged){const{state:t}=e,n=t.selection.main.head;if(!rf(fa(t).resolve(n,-1)))return null;""===t.doc.lineAt(n).text.trim()&&setTimeout(()=>{mh(e.view)},100)}})]}function nf(e){return Lh({override:[t=>function(e,t){const{state:n,pos:i}=e,r=n.doc.lineAt(i),s=i-r.from;if(r.text.slice(0,s).includes(":"))return null;const o=fa(n).resolve(i,-1);if(!rf(o))return null;const l=n.sliceDoc(o.from,i).startsWith('"'),a='"'===r.text[s],c=t.map(e=>({label:e.label,type:e.type,info:e.info,apply:(t,n,i,r)=>{const s=t.state.sliceDoc(i-1,r+1);s.startsWith('"')&&(i-=1),s.endsWith('"')&&(r+=1);let o=`"${e.label}": ,`,l=i+o.length-1,a=l;(function(e,t){const n=e.sliceDoc(t).trimStart();return n&&'"'===n[0]})(t.state,r)||(o=o.slice(0,-1));const c=t.state.update({changes:{from:i,to:r,insert:o},selection:{anchor:l,head:a}});t.dispatch(c)}})),h="Object"===o.name?i:o.from;return{from:l?h+1:h,to:a?r.to-1:r.to,options:c}}(t,e)]})}function rf(e){return!!function(e){let t=0,n=e;for(;n.parent;){if("Object"===n.name&&t++,t>1)return!1;n=n.parent}return!0}(e)&&["Object","PropertyName","⚠"].includes(e.name)}const sf="LOCAL",of="PROCESS";function lf(e,t,n,i){const r={};for(const s of e){const{name:e,value:o,variableKey:l}=s,a=af(s,t,n,i);try{r[l]={name:e,value:JSON.parse(o),scope:a}}catch{r[l]={name:e,value:o,scope:a}}}return r}function af(e,t,n,i){const{scopeKey:r}=e;return t.find(e=>e.elementInstanceKey===r&&e.elementId===i)?sf:r===n?of:null}function cf(e,t){return Object.values(e).reduce((e,n)=>(R(n)&&P(n,"name")&&t===n.scope&&(e[n.name]=n.value),e),{})}const hf=at.define(),uf=new Je,df="JSON contains errors",ff={},pf=[];function gf({allOutputs:e=ff,value:n,onChange:i,onClear:r,onErrorChange:s,variablesForElement:o=pf}){const l=(0,S.useMemo)(()=>{const t=o.map(({name:e,detail:t,info:n})=>({label:e,type:"variable",info:()=>mf(0,"Process variable"),detail:t,value:n||void 0})),n=function(e){const t=[];for(const n in e)if(e[n]){const{variables:i={}}=e[n];N(i,e=>{if(!R(e)||!P(e,"name"))return;const{name:i,value:r,scope:s}=e;s===of&&t.push({name:i,value:r,origin:n})})}return t}(e),i=n.map(({name:e,value:t,origin:n})=>({label:e,type:"variable",info:()=>mf(0,`Output variable from ${n}`),detail:Af(t),value:t}));return[...t,...i]},[e,o]),a=(0,S.useRef)(null),[c,h]=(0,S.useState)(),[u,d]=(0,S.useState)();return(0,S.useEffect)(()=>{if(!a.current)return;const e=wt.create({doc:n,extensions:[Lh(),[Oh,_h],wc(),wt.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return e;let s=n.sliceString(r.from,i);if(!t.some(e=>e.test(s)))return e;let{state:o}=e,l=-1,a=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=Ta(o,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],r=Ea(o,n);i!=r&&a.push({from:t.from,to:t.from+i.length,insert:r})}return a.length?[e,{changes:a,sequential:!0}]:e}),fo.of([...Zu]),(new Je).of(Zd()),(new Je).of(wt.tabSize.of(2)),ro.contentAttributes.of({"aria-label":"JSON editor",tabindex:"0"}),Ad(e=>{const t=(e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;const n=function(e,t){let n;return(n=e.message.match(/at position (\d+)/))?Math.min(+n[1],t.length):(n=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+n[1]).from+ +n[2]-1,t.length):0}(t,e.state.doc);return[{from:n,message:t.message,severity:"error",to:n}]}return[]})(e),n=t&&t.length>0;return s(n?df:null),d(n?df:null),t},{delay:300}),uf.of(tf(l)),bo("Enter process variables in JSON format"),oc(),fo.of(Qa),ef,ro.lineWrapping,ro.updateListener.of(e=>{if(e.docChanged){if(e.transactions.some(e=>e.annotation(hf)))return;const t=e.state.doc.toString();i(t)}})]}),t=new ro({state:e,parent:a.current});return h(t),()=>{t.destroy()}},[i]),(0,S.useEffect)(()=>{c&&c.dispatch({effects:uf.reconfigure(tf(l))})},[l,c]),(0,S.useEffect)(()=>{if(!c)return;const e=c.state.doc.toString();n!==e&&c.dispatch({changes:{from:0,to:e.length,insert:n},annotations:hf.of(!0)})},[c,n]),(0,E.jsxs)("div",{className:M()("code__editor",{"code__editor--error":u}),children:[(0,E.jsx)(t,{className:"code__editor-clear-button",renderIcon:f,iconDescription:"Clear editor",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:r}),(0,E.jsx)("div",{className:"code__editor-codemirror",children:(0,E.jsx)("div",{ref:a,className:"code__editor-codemirror-inner"})}),u&&(0,E.jsx)("div",{className:"code__editor-error",children:u})]})}function mf(e,t){const n=document.createElement("div"),i=(0,Z.qV)((0,E.jsx)("div",{className:"info",children:(0,E.jsx)("span",{children:t})}));return n.innerHTML=i,n}function Af(e){const t=typeof e;return"object"===t?Array.isArray(e)?"Array":null===e?"null":"Object":t.charAt(0).toUpperCase()+t.slice(1)}function vf({allOutputs:e,input:t="",onErrorChange:n,onResetInput:r,onSetInput:s,variablesForElement:o}){return(0,E.jsxs)("div",{className:"input",children:[(0,E.jsx)("div",{className:"input__header",children:(0,E.jsx)("div",{className:"input__header--title",children:(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsxs)("span",{children:["Variables the process instance will be started with. ",(0,E.jsx)(i,{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),align:"bottom-start",children:(0,E.jsx)("span",{children:"Process variables"})})})}),(0,E.jsx)(gf,{allOutputs:e,value:t,onChange:s,onClear:()=>{r()},onErrorChange:n,variablesForElement:o}),(0,E.jsxs)("div",{className:"input__footer",children:[(0,E.jsx)("div",{className:"input__footer--icon",children:(0,E.jsx)(g,{})}),(0,E.jsx)("div",{className:"input__footer--text",children:"Optionally define process variables to start the process instance with."})]})]})}function bf({value:e}){const n=(0,S.useRef)(null),[i,r]=(0,S.useState)();return(0,S.useEffect)(()=>{if(!n.current)return;const t=wt.create({doc:e,extensions:[Zd(),wt.tabSize.of(2),wt.readOnly.of(!0),ro.editable.of(!1),ro.lineWrapping,oc(),fo.of(Qa),ef]}),i=new ro({state:t,parent:n.current});return r(i),()=>{i.destroy()}},[]),(0,S.useEffect)(()=>{if(!i)return;const t=i.state.doc.toString();e!==t&&i.dispatch({changes:{from:0,to:t.length,insert:e}})},[i,e]),(0,E.jsxs)("div",{className:"code__editor",children:[(0,E.jsx)(t,{className:"code__editor-copy-button",renderIcon:h,iconDescription:"Copy to clipboard",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:()=>{navigator.clipboard.writeText(e)}}),(0,E.jsx)("div",{className:"code__editor-codemirror",children:(0,E.jsx)("div",{ref:n,className:"code__editor-codemirror-inner"})})]})}const xf="status",yf="job",wf="user-task",Cf="message-subscription",kf="element-instance",_f="deployed",Sf="instance-started";function Ef(e){if(!e)return null;const t=new Date(e).getTime();return isNaN(t)?null:t}function Tf(e,t){return{state:e.state,type:e.type,elementId:e.elementId,kind:e.kind,listenerEventType:e.listenerEventType,jobKey:e.jobKey,creationTime:e.creationTime,endTime:e.endTime,...t}}function Of(e,t){return{state:e.state||"",name:e.name,userTaskKey:e.userTaskKey,creationDate:e.creationDate,completionDate:e.completionDate,...t}}function Mf(e,t){return{type:e.type,state:e.state,elementId:e.elementId,elementName:e.elementName,startDate:e.startDate,endDate:e.endDate,elementInstanceKey:e.elementInstanceKey,...t}}function Bf(e,t){return{messageName:e.messageName,elementId:e.elementId,messageSubscriptionState:e.messageSubscriptionState,messageSubscriptionKey:e.messageSubscriptionKey,...t}}function Df(e,t,n){return{type:yf,data:Tf(e,n),timestamp:t}}class Rf{constructor(e){var t;this._state=null,this._deployResponse=null,this._startInstanceResponse=null,this._polledResult=null,this._finishedResult=null,this._entries=[],this._elementRegistry=(null==e||null===(t=e.get)||void 0===t?void 0:t.call(e,"elementRegistry"))||null}setState(e,t=Date.now()){this._state={type:e,timestamp:t},this._updateEntries()}setDeployResponse(e,t=Date.now()){this._deployResponse={response:e,timestamp:t},this._updateEntries()}setStartInstanceResponse(e,t=Date.now()){this._startInstanceResponse={response:e,timestamp:t},this._updateEntries()}setPolledResult(e,t=Date.now()){this._polledResult={result:e,timestamp:t},this._updateEntries()}setFinishedResult(e,t=Date.now()){this._finishedResult={result:e,timestamp:t},this._updateEntries()}getEntries(){return this._entries}reset(){this._state=null,this._deployResponse=null,this._startInstanceResponse=null,this._polledResult=null,this._finishedResult=null,this._entries=[]}_updateEntries(){const e=[];if(this._deployResponse){const n=this._deployResponse.response;let i;if(!1!==n.success){var t;const e=n.response||n,r=null===(t=e.deployments)||void 0===t?void 0:t[0],s=r&&"processDefinition"in r?r.processDefinition:void 0;i={processDefinitionId:null==s?void 0:s.processDefinitionId,processDefinitionKey:null==s?void 0:s.processDefinitionKey,processDefinitionVersion:null==s?void 0:s.processDefinitionVersion,deploymentKey:e.deploymentKey}}e.push({type:xf,status:_f,data:i,timestamp:this._deployResponse.timestamp})}if(this._startInstanceResponse){const t=this._startInstanceResponse.response;let n;if(!1!==t.success){const e=t.response||t;n={processInstanceKey:e.processInstanceKey,processDefinitionId:e.processDefinitionId,processDefinitionKey:e.processDefinitionKey}}e.push({type:xf,status:Sf,data:n,timestamp:this._startInstanceResponse.timestamp})}if(this._polledResult){var n,i,r,s;const{result:t,timestamp:o}=this._polledResult;let l=[];if(null!==(n=t.elementInstancesResponse)&&void 0!==n&&n.success&&(l=t.elementInstancesResponse.response.items||[],e.push(...function(e,t){const n=[];for(const i of e){const e=Ef(i.startDate);if(n.push({type:kf,data:Mf(i,{state:"ACTIVE"}),timestamp:e||t}),"ACTIVE"===i.state)continue;const r=Ef(i.endDate);n.push({type:kf,data:Mf(i),timestamp:r||t})}return n}(l,o))),null!==(i=t.jobsResponse)&&void 0!==i&&i.success){const n=t.jobsResponse.response.items||[];e.push(...function(e,t,n){const i=[];for(const r of e){let e=Ef(r.creationTime);if(!e&&r.elementInstanceKey&&t){const n=t.find(e=>e.elementInstanceKey===r.elementInstanceKey);if(null!=n&&n.startDate){const t=new Date(n.startDate).getTime();isNaN(t)||(e=t)}}if(i.push(Df(r,e||n,{state:"CREATED"})),"CREATED"===r.state)continue;const s=Ef(r.endTime);i.push(Df(r,s||n,{state:r.state}))}return i}(n,l,o))}if(null!==(r=t.userTasksResponse)&&void 0!==r&&r.success){const n=t.userTasksResponse.response.items||[];e.push(...function(e,t){const n=[];for(const i of e){const e=Ef(i.creationDate);if(n.push({type:wf,data:Of(i,{state:"CREATED"}),timestamp:e||t}),"CREATED"===i.state)continue;const r=Ef(i.completionDate);n.push({type:wf,data:Of(i),timestamp:r||t})}return n}(n,o))}if(null!==(s=t.messageSubscriptionsResponse)&&void 0!==s&&s.success){const n=t.messageSubscriptionsResponse.response.items||[];e.push(...function(e,t,n){const i=[];for(const r of e){let e=n,s=n;if(r.elementInstanceKey&&t){const n=t.find(e=>e.elementInstanceKey===r.elementInstanceKey);if(null!=n&&n.startDate){const t=new Date(n.startDate).getTime();isNaN(t)||(e=t)}if(null!=n&&n.endDate&&"CORRELATED"===r.messageSubscriptionState){const e=new Date(n.endDate).getTime();isNaN(e)||(s=e)}}i.push({type:Cf,data:Bf(r,{messageSubscriptionState:"CREATED"}),timestamp:e}),"CORRELATED"===r.messageSubscriptionState&&i.push({type:Cf,data:Bf(r),timestamp:s})}return i}(n,l,o))}}if(this._finishedResult){const{result:t,timestamp:n}=this._finishedResult;e.push(function(e,t){var n,i;if(e.success)return{type:xf,status:"completed",data:{processInstanceKey:e.processInstanceKey},timestamp:t};switch(e.reason){case"incident":return{type:xf,status:"incident",data:{processInstanceKey:e.processInstanceKey,errorType:null===(n=e.incident)||void 0===n?void 0:n.errorType,errorMessage:null===(i=e.incident)||void 0===i?void 0:i.errorMessage},timestamp:t};case"terminated":return{type:xf,status:"terminated",data:{processInstanceKey:e.processInstanceKey},timestamp:t};default:return{type:xf,status:"canceled",data:"error"in e?{error:e.error}:void 0,timestamp:t}}}(t,n))}this._state&&("deploying"===this._state.type&&!this._deployResponse||"starting-instance"===this._state.type&&!this._startInstanceResponse||"executing"===this._state.type&&!this._polledResult&&!this._finishedResult)&&e.push({type:xf,status:this._state.type,timestamp:this._state.timestamp}),e.sort((e,t)=>e.timestamp-t.timestamp),this._entries=e}}function If(e){let t=e.length;for(;t>0&&"/"===e[t-1];)t--;return e.slice(0,t)}const Pf={deploying:"Deploying process",deployed:"Process deployed","starting-instance":"Starting process instance","instance-started":"Process instance started",executing:null,completed:"Process instance completed",terminated:"Process instance terminated",incident:"Incident",canceled:"Test canceled"},Nf="CREATED",Lf="CREATED",Ff="ACTIVE";function jf(e){const t=e.data;if(!t)return[];const n=[];return e.status===_f&&(t.processDefinitionId&&n.push({label:"Process",value:t.processDefinitionId}),t.processDefinitionKey&&n.push({label:"Definition Key",value:t.processDefinitionKey}),t.processDefinitionVersion&&n.push({label:"Version",value:String(t.processDefinitionVersion)}),t.deploymentKey&&n.push({label:"Deployment Key",value:t.deploymentKey})),e.status===Sf&&(t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),t.processDefinitionId&&n.push({label:"Process",value:t.processDefinitionId}),t.processDefinitionKey&&n.push({label:"Definition Key",value:t.processDefinitionKey})),"completed"!==e.status&&"terminated"!==e.status||t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),"incident"===e.status&&(t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),t.errorType&&n.push({label:"Error Type",value:t.errorType}),t.errorMessage&&n.push({label:"Error",value:t.errorMessage})),n}function zf(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function Vf({entries:e,tasklistBaseUrl:t,currentOperateUrl:n,isTaskExecuting:i}){if(!e.length)return(0,E.jsx)("div",{className:"execution-log",children:(0,E.jsxs)("div",{className:"execution-log__empty",children:["No log entries yet. Click ",(0,E.jsx)("span",{className:"execution-log__empty-action",children:"Test"})," to execute the task."]})});const r=function(e,t){if(!t)return[];const n=[];for(const t of e)t.type===yf&&t.data.state===Nf?n.push({label:"Waiting for job to be completed",secondaryLabel:t.data.type}):t.type===wf&&t.data.state===Lf?n.push({label:"Waiting for user task to be completed",secondaryLabel:t.data.name||t.data.elementId}):t.type===Cf&&"CREATED"===t.data.messageSubscriptionState&&n.push({label:"Waiting for message to be correlated",secondaryLabel:t.data.messageName});return n}(e,i);return(0,E.jsxs)("div",{className:"execution-log",children:[(0,E.jsxs)("ol",{className:"execution-log__entries",children:[e.map((e,t)=>e.type===xf?(0,E.jsx)(Wf,{entry:e},t):(0,E.jsx)(Hf,{entry:e},t)),r.map((e,t)=>(0,E.jsx)("li",{className:"execution-log__entry-wrapper execution-log__entry-wrapper--active",children:(0,E.jsx)("div",{className:"execution-log__entry-content",children:(0,E.jsx)("div",{className:"execution-log__entry",children:(0,E.jsxs)("div",{className:"execution-log__labels",children:[(0,E.jsx)("div",{className:"execution-log__label-row",children:(0,E.jsx)("span",{className:"execution-log__label",children:e.label})}),(0,E.jsx)("span",{className:"execution-log__secondary-label",children:e.secondaryLabel})]})})})},`waiting-${t}`))]}),(0,E.jsx)(qf,{entries:e,currentOperateUrl:n,isTaskExecuting:i}),(0,E.jsx)($f,{entries:e,currentOperateUrl:n,isTaskExecuting:i}),(0,E.jsx)(Uf,{entries:e,tasklistBaseUrl:t,isTaskExecuting:i})]})}function Wf({entry:e}){const[t,n]=(0,S.useState)(!1),i=Pf[e.status];if(!i)return null;const r=jf(e),s=r.length>0,o=s,l=()=>{o&&n(!t)};return(0,E.jsx)("li",{className:"execution-log__entry-wrapper",children:(0,E.jsxs)("div",{className:"execution-log__entry-content",children:[(0,E.jsxs)("div",{className:M()("execution-log__entry",{"execution-log__entry--expandable":o}),onClick:o?l:void 0,children:[(0,E.jsx)("span",{className:"execution-log__label",children:i}),o&&(0,E.jsx)("span",{className:"execution-log__toggle",onClick:e=>{e.stopPropagation(),l()},children:t?(0,E.jsx)(a,{size:16,className:"execution-log__chevron execution-log__chevron--open"}):(0,E.jsx)(c,{size:16,className:"execution-log__chevron"})})]}),t&&s&&(0,E.jsx)("dl",{className:"execution-log__details",children:r.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"execution-log__details-row",children:[(0,E.jsx)("dt",{className:"execution-log__details-label",children:e}),(0,E.jsx)("dd",{className:"execution-log__details-value",children:t})]},n))})]})})}function Hf({entry:e}){const[t,n]=(0,S.useState)(!1),i=function(e){switch(e.type){case xf:return Pf[e.status]||null;case yf:return"CANCELED"===(t=e.data).state?"Job canceled":"COMPLETED"===t.state?"Job completed":t.state===Nf?"Job created":"ERROR_THROWN"===t.state?"Job threw an error":"FAILED"===t.state?"Job failed":"MIGRATED"===t.state?"Job migrated":"RETRIES_UPDATED"===t.state?"Job retries updated":"TIMED_OUT"===t.state?"Job timed out":void 0;case wf:return function(e){return"COMPLETED"===e.state?"User task completed":"CANCELED"===e.state?"User task canceled":e.state===Lf?"User task created":void 0}(e.data);case Cf:return function(e){return"CREATED"===e.messageSubscriptionState?"Message subscription created":"CORRELATED"===e.messageSubscriptionState?"Message correlated":"CANCELED"===e.messageSubscriptionState?"Message subscription canceled":void 0}(e.data);case kf:return function(e){const{type:t,state:n}=e;if("BOUNDARY_EVENT"===t)return n===Ff?"Boundary event triggered":"Boundary event completed";if("EVENT_SUB_PROCESS"===t)return n===Ff?"Event sub-process triggered":"Event sub-process completed";const i=function(e){return(e||"").toLowerCase().replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(t);return n===Ff?`${i} activated`:`${i} completed`}(e.data);default:return null}var t}(e),r=function(e){var t,n,i,r,s;switch(e.type){case kf:return(null===(t=e.data)||void 0===t?void 0:t.elementName)||(null===(n=e.data)||void 0===n?void 0:n.elementId)||null;case yf:return(null===(i=e.data)||void 0===i?void 0:i.type)||null;case Cf:return(null===(r=e.data)||void 0===r?void 0:r.messageName)||null;case wf:return(null===(s=e.data)||void 0===s?void 0:s.name)||null;default:return null}}(e),s=function(e){const{data:t,type:n}=e;if(n===kf){const{endDate:e,startDate:n,state:i}=t;if(["COMPLETED","TERMINATED"].includes(i)&&n&&e)return zf(new Date(e).getTime()-new Date(n).getTime())}else if(n===yf){const{creationTime:e,endTime:n,state:i}=t;if(["COMPLETED","FAILED"].includes(i)&&e&&n)return zf(new Date(n).getTime()-new Date(e).getTime())}else if(n===wf){const{completionDate:e,creationDate:n,state:i}=t;if(["CANCELED","COMPLETED","FAILED"].includes(i)&&n&&e)return zf(new Date(e).getTime()-new Date(n).getTime())}return null}(e),o=function(e){if(e.type===xf)return jf(e);if(e.type===yf){const t=e.data,n=[];t.type&&n.push({label:"Type",value:t.type}),t.elementId&&n.push({label:"Element",value:t.elementId});const i=function(e){if(!e)return null;const{kind:t,listenerEventType:n}=e;return"EXECUTION_LISTENER"!==t?null:"START"===n?"Start execution listener":"END"===n?"End execution listener":null}(t);return i&&n.push({label:"Kind",value:i}),t.state&&n.push({label:"State",value:t.state}),t.jobKey&&n.push({label:"Job Key",value:t.jobKey}),n}if(e.type===Cf){const t=e.data,n=[];return t.messageName&&n.push({label:"Message",value:t.messageName}),t.elementId&&n.push({label:"Element",value:t.elementId}),t.messageSubscriptionState&&n.push({label:"State",value:t.messageSubscriptionState}),t.messageSubscriptionKey&&n.push({label:"Subscription Key",value:t.messageSubscriptionKey}),n}if(e.type===kf){const t=e.data,n=[];return t.elementId&&n.push({label:"Element",value:t.elementId}),t.elementName&&n.push({label:"Name",value:t.elementName}),t.state&&n.push({label:"State",value:t.state}),t.startDate&&n.push({label:"Started",value:new Date(t.startDate).toLocaleTimeString()}),t.elementInstanceKey&&n.push({label:"Instance Key",value:t.elementInstanceKey}),n}return[]}(e),l=o.length>0,h=l;if(!i)return null;const u=()=>{h&&n(!t)},d=["execution-log__entry",h?"execution-log__entry--expandable":""].filter(Boolean).join(" ");return(0,E.jsx)("li",{className:"execution-log__entry-wrapper",children:(0,E.jsxs)("div",{className:"execution-log__entry-content",children:[(0,E.jsxs)("div",{className:d,onClick:h?u:void 0,children:[(0,E.jsxs)("div",{className:"execution-log__labels",children:[(0,E.jsxs)("div",{className:"execution-log__label-row",children:[(0,E.jsx)("span",{className:"execution-log__label",children:i}),s&&(0,E.jsx)("span",{className:"execution-log__duration",children:s})]}),r&&(0,E.jsx)("span",{className:"execution-log__secondary-label",children:r})]}),h&&(0,E.jsx)("span",{className:"execution-log__toggle",onClick:e=>{e.stopPropagation(),u()},children:t?(0,E.jsx)(a,{size:16,className:"execution-log__chevron execution-log__chevron--open"}):(0,E.jsx)(c,{size:16,className:"execution-log__chevron"})})]}),t&&l&&(0,E.jsx)("dl",{className:"execution-log__details",children:o.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"execution-log__details-row",children:[(0,E.jsx)("dt",{className:"execution-log__details-label",children:e}),(0,E.jsx)("dd",{className:"execution-log__details-value",children:t})]},n))})]})})}function qf({entries:e,currentOperateUrl:t,isTaskExecuting:n}){return n&&e.some(e=>e.type===yf&&"COMPLETED"!==e.data.state)?(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(d,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for job completion"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Ensure the corresponding job is completed to continue the test execution."}),t&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:t,target:"_blank",renderIcon:m,children:"Open in Operate"})]}):null}function $f({entries:e,currentOperateUrl:t,isTaskExecuting:n}){return n&&e.some(e=>e.type===Cf&&"CREATED"===e.data.messageSubscriptionState)?(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(d,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for message correlation"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Ensure the required message is correlated to continue the test execution."}),t&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:t,target:"_blank",renderIcon:m,children:"Open in Operate"})]}):null}function Uf({entries:e,tasklistBaseUrl:t,isTaskExecuting:n}){if(!n)return null;const r=e.find(e=>e.type===wf&&e.data.state===Lf);if(!r)return null;const s=function(e,t){try{const n=If(e);return new URL(t,`${n}/`).toString()}catch(e){return null}}(t,r.data.userTaskKey);return(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(x,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for user task completion"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Complete the user task to continue the test execution."}),s&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:s,target:"_blank",renderIcon:m,children:"Open in Tasklist"})]})}const Kf={plugins:[],registerPlugin:e=>{},unregisterPlugin:e=>{},getPlugins:e=>[]},Gf=(0,S.createContext)(Kf),Yf=[];function Jf({element:e,isConnectionConfigured:t,isTaskExecuting:n,output:i,currentOperateUrl:r,onResetOutput:s,taskExecutionState:l,executionLog:a,tasklistBaseUrl:c,currentVariables:h}){const u=(null==i?void 0:i.error)||(null==i?void 0:i.incident),d=(null==i?void 0:i.success)&&!u,f=null==i?void 0:i.terminated,g=null==i?void 0:i.canceled,m=(0,S.useMemo)(()=>u?"error":d?"success":f?"warning":g?"canceled":null,[u,d,f,g]),A=(0,S.useMemo)(()=>u?(0,E.jsx)(w,{}):d?(0,E.jsx)(o,{}):f?(0,E.jsx)(b,{}):g?(0,E.jsx)(p,{}):null,[u,d,f,g]),v=(0,S.useMemo)(()=>{if(null==i||!i.startedAt||null==i||!i.finishedAt)return null;const e=i.finishedAt-i.startedAt;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`},[i]);return(0,E.jsxs)("div",{className:"output",children:[n&&(0,E.jsx)(ip,{currentOperateUrl:r}),!n&&i&&(0,E.jsx)(rp,{bannerVariant:m,statusIcon:A,timingText:v,onResetOutput:s,isConnectionConfigured:t,currentOperateUrl:r,element:e,output:i,isTaskExecuting:n}),n||i?(0,E.jsxs)("div",{className:"output__body",children:[(0,E.jsx)(op,{title:"Log",defaultOpen:!0,isExecuting:n,children:(null==a?void 0:a.length)>0?(0,E.jsx)(Vf,{entries:a,tasklistBaseUrl:c,currentOperateUrl:r,isTaskExecuting:n}):(0,E.jsx)("div",{className:"output__section-empty",children:"Result does not have a log."})}),(0,E.jsx)(lp,{title:"Process Variables",tooltip:(0,E.jsxs)("span",{children:["Variables in the process scope. ",(0,E.jsx)("a",{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),scope:of,output:i,currentVariables:h,isTaskExecuting:n}),(0,E.jsx)(lp,{title:"Local Variables",tooltip:(0,E.jsxs)("span",{children:["Variables in the scope of the executed element. ",(0,E.jsx)("a",{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),scope:sf,output:i,currentVariables:h,isTaskExecuting:n})]}):(0,E.jsx)(np,{})]})}const Qf=e=>{const{getPlugins:t}=(0,S.useContext)(Gf),n=t("output.header.link").reduce((t,n)=>{var i;const r=t=>I(t)?t(e):t;if(!(r(n.visible)??1))return t;const s=(null===(i=n.render)||void 0===i?void 0:i.call(n,e))||n.children;return t.push({content:s,href:r(n.href),target:r(n.target),className:r(n.className),onClick:r(n.onClick),renderIcon:r(n.renderIcon),role:r(n.role),tooltip:r(n.tooltip)}),t},[]);return(0,E.jsx)(E.Fragment,{children:n.map(({content:e,href:t,target:n,className:r,onClick:s,renderIcon:o,role:l,tooltip:a},c)=>{const h=(0,E.jsx)(i,{href:t,target:n,className:r,onClick:s,renderIcon:o,role:l,children:e},c);return a?(0,E.jsx)(T,{className:"has-tooltip",label:a,align:"bottom-start",children:h},c):h})})},Xf=()=>null,Zf=({children:e=null,render:t=Xf,visible:n,href:i,target:r,className:s,onClick:o,renderIcon:l,role:a,tooltip:c,priority:h=100})=>{const{registerPlugin:u,unregisterPlugin:d}=(0,S.useContext)(Gf);return(0,S.useEffect)(()=>{const f={children:e,render:t,visible:n,href:i,target:r,className:s,onClick:o,renderIcon:l,role:a,tooltip:c,priority:h,type:"output.header.link"};return u(f),()=>{d(f)}},[e,t,n,i,r,s,o,l,a,c,h,u,d]),null},ep=()=>{const e=(0,S.useCallback)(()=>"Open in Operate",[]),t=(0,S.useCallback)(({output:e,isConnectionConfigured:t,currentOperateUrl:n})=>t&&(n||e&&!e.error),[]),n=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl),[]),i=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl)?void 0:"link--disabled",[]),r=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl)?null:"Operate URL not found",[]);return(0,E.jsx)(Zf,{priority:1/0,render:e,visible:t,href:n,target:"_blank",className:i,tooltip:r,renderIcon:m})};function tp(){return(0,E.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("mask",{id:"mask0_191_9328",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:(0,E.jsx)("path",{d:"M24 0H0V24H24V0Z",fill:"white"})}),(0,E.jsxs)("g",{mask:"url(#mask0_191_9328)",children:[(0,E.jsx)("path",{d:"M19.3852 2.40472C21.2873 2.50108 22.8 4.07389 22.8 6.00002V13.2H21.3V6.00002C21.3 4.84022 20.3598 3.90002 19.2 3.90002H4.80001C3.64021 3.90002 2.70001 4.84022 2.70001 6.00002V15.6C2.70001 16.7598 3.64021 17.7 4.80001 17.7H13.2V19.2H4.80001C2.87388 19.2 1.30106 17.6873 1.2047 15.7852L1.20001 15.6V6.00002C1.20001 4.0118 2.81179 2.40002 4.80001 2.40002H19.2L19.3852 2.40472Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M15.9273 22.8C15.8405 22.8 15.7572 22.7579 15.6959 22.6829C15.6345 22.6079 15.6 22.5061 15.6 22.4V13.6001C15.6 13.5305 15.6148 13.4622 15.643 13.4018C15.6712 13.3415 15.7118 13.2911 15.7607 13.2557C15.8097 13.2203 15.8654 13.2011 15.9222 13.2C15.9791 13.1989 16.0352 13.216 16.0851 13.2496L22.6305 17.6495C22.6818 17.684 22.7247 17.7348 22.7544 17.7964C22.7843 17.858 22.8 17.9284 22.8 18C22.8 18.0716 22.7843 18.142 22.7544 18.2036C22.7247 18.2652 22.6818 18.316 22.6305 18.3505L16.0851 22.7504C16.0367 22.783 15.9825 22.8 15.9273 22.8Z",fill:"currentColor"})]})]})}function np(){return(0,E.jsxs)("div",{className:"output__empty-state",children:[(0,E.jsx)("span",{className:"output__empty-state-icon",children:(0,E.jsx)(tp,{})}),(0,E.jsx)("span",{className:"output__empty-state-text",children:"Result will appear here after you run the test."})]})}function ip({currentOperateUrl:e}){return(0,E.jsx)("div",{className:"output__banner output__banner--executing",children:(0,E.jsxs)("div",{className:"output__banner-header",children:[(0,E.jsxs)("div",{className:"output__banner-main",children:[(0,E.jsx)(n,{className:"output__banner-loader"}),(0,E.jsx)("span",{className:"output__banner-text",children:"Running test..."})]}),e&&(0,E.jsx)(i,{className:"output__banner-operate-link",href:e,target:"_blank",renderIcon:m,children:"Open in Operate"})]})})}function rp({bannerVariant:e,statusIcon:t,timingText:n,output:r,onResetOutput:s,isConnectionConfigured:o,currentOperateUrl:l,element:h,isTaskExecuting:u}){var d,f,p,g,m;const A=(0,S.useMemo)(()=>{if(r){var e;if(r.error)return r.error?`Error: ${null==r||null===(e=r.error)||void 0===e?void 0:e.message}`:"Error";if(r.incident)return r.incident.errorType?`Incident: ${r.incident.errorType}`:"Incident";if(r.success)return"Test passed";if(r.terminated)return"Process instance terminated";if(r.canceled)return"Test canceled"}return null},[r]),v=(0,S.useMemo)(()=>null!=r&&r.success?"See output variables below.":null!=r&&r.terminated?"The process instance was terminated before the test could complete. This might be the expected behavior.":null!=r&&r.canceled?"The test was manually canceled.":null,[r]),b=(0,S.useMemo)(()=>null!=r&&r.incident?function(e){const{errorType:t,errorMessage:n,creationTime:i,...r}=e,s=[];return t&&s.push({label:"Type",value:t}),i&&s.push({label:"Creation Time",value:new Date(i).toLocaleString()}),n&&s.push({label:"Message",value:n}),Object.entries(r).forEach(([e,t])=>{s.push({label:sp(e),value:String(t)})}),s}(r.incident):null,[r]),x=(null==r?void 0:r.error)||(null==r?void 0:r.incident),[y,w]=(0,S.useState)(!0);return(0,E.jsxs)("div",{className:`output__banner output__banner--${e}`,children:[(0,E.jsxs)("div",{className:"output__banner-header",onClick:x?()=>w(!y):void 0,children:[(0,E.jsxs)("div",{className:"output__banner-main",children:[(0,E.jsx)("span",{className:"output__banner-icon",children:t}),(0,E.jsx)("span",{className:"output__banner-text",children:A})]}),n&&(0,E.jsx)("span",{className:"output__banner-timing",children:n}),x&&(y?(0,E.jsx)(a,{size:16,className:"output__banner-chevron output__banner-chevron--open"}):(0,E.jsx)(c,{size:16,className:"output__banner-chevron"}))]}),y&&v&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsx)("div",{className:"output__banner-details-content",children:v})}),y&&(null==r?void 0:r.error)&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsxs)("div",{className:"output__banner-error",children:[(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsx)("span",{children:"Details about the error that occurred during task execution"}),align:"bottom-start",children:(0,E.jsx)("span",{className:"output__banner-error-heading",children:"Error details"})}),(0,E.jsxs)("div",{className:"output__banner-details-content",children:[(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Message"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:(null===(d=r.error)||void 0===d?void 0:d.message)||"No error message available"})]}),(null===(f=r.error)||void 0===f?void 0:f.detail)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Detail"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.detail})]}),(null===(p=r.error)||void 0===p?void 0:p.errorType)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Error type"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.errorType})]}),null!=(null===(g=r.error)||void 0===g?void 0:g.status)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Status"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.status})]}),(null===(m=r.error)||void 0===m?void 0:m.response)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Response"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.response})]})]})]})}),y&&b&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsxs)("div",{className:"output__banner-incident",children:[(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsxs)("span",{children:["Details about the incident that occurred during task execution ",(0,E.jsx)(i,{href:"https://docs.camunda.io/docs/components/concepts/incidents/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),align:"bottom-start",children:(0,E.jsx)("span",{className:"output__banner-incident-heading",children:"Incident details"})}),(0,E.jsx)("div",{className:"output__banner-details-content",children:b.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:e}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:t})]},n))})]})}),(0,E.jsxs)("div",{className:"output__banner-actions",children:[(0,E.jsx)(ep,{}),(0,E.jsx)(Qf,{onResetOutput:s,isConnectionConfigured:o,currentOperateUrl:l,element:h,output:r,isTaskExecuting:u})]})]})}function sp(e){return e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase())}function op({title:e,tooltip:t,defaultOpen:n=!0,isExecuting:i=!1,children:r}){const[s,o]=(0,S.useState)(n),[l,h]=(0,S.useState)(!1),u=(0,S.useRef)(null);return(0,S.useEffect)(()=>{const e=u.current;if(!e)return;const t=e.closest(".task-testing-tabs__panel")||e.closest(".task-testing__container--body-executing");if(!t)return;const n=new IntersectionObserver(([e])=>{h(!e.isIntersecting)},{root:t,threshold:0});return n.observe(e),()=>n.disconnect()},[]),(0,E.jsxs)("div",{className:"output__collapsible"+(s?" output__collapsible--open":""),children:[(0,E.jsx)("div",{ref:u,className:"output__collapsible-sentinel"}),(0,E.jsxs)("button",{className:"output__collapsible-header"+(l?" stuck":""),onClick:()=>o(!s),children:[s?(0,E.jsx)(a,{size:16,className:"output__chevron output__chevron--open"}):(0,E.jsx)(c,{size:16,className:"output__chevron"}),t?(0,E.jsx)(T,{className:"has-tooltip",label:t,align:"bottom-start",children:(0,E.jsx)("span",{className:"output__collapsible-title",children:e})}):(0,E.jsx)("span",{className:"output__collapsible-title",children:e})]}),s&&(0,E.jsx)("div",{className:"output__collapsible-content",children:r})]})}function lp({title:e,tooltip:t,scope:n,output:i,currentVariables:s,isTaskExecuting:o}){const l=o&&!s,a=(0,S.useMemo)(()=>o&&s&&Object.keys(s).length>0?cf(s,n):i&&i.variables?cf(i.variables,n):null,[o,s,i,n]),c=!a||0===Object.keys(a).length,h=c?"":JSON.stringify(a,null,2);return(0,E.jsx)(op,{title:e,tooltip:t,defaultOpen:!0,isExecuting:o,children:l?(0,E.jsx)("div",{className:"output__variables--skeleton",children:(0,E.jsx)(r,{})}):(0,E.jsx)(bf,{value:c?"{}":h})})}function ap(e,t){return{message:e,response:null==t?void 0:t.error,errorType:null==t?void 0:t.errorType,status:null==t?void 0:t.status,detail:null==t?void 0:t.detail,operationId:null==t?void 0:t.operationId}}const cp="idle",hp="error",up="incident",dp="terminated",fp="user.cancel",pp="user.selectionChanged",gp="taskExecution.state.changed",mp="taskExecution.deployed",Ap="taskExecution.instanceStarted",vp="taskExecution.polled",bp="taskExecution.finished";class xp extends(G()){constructor(e,t){super(),this._api=t,this._interval=null,this._executionId=null,this._state=cp,this._lastPolledResult=null,e.get("eventBus").on("selection.changed",()=>{this._cancelTaskExecution(pp)})}async executeTask(e,t){const n=function(e){let t=H(e);for(;t;){if(V(t,"bpmn:Process"))return t.get("id");t=t.$parent}return null}(e);if(!n)return;this._lastPolledResult=null;const i=Symbol();this._executionId=i,this._changeState("deploying");const r=await this._api.deploy();if(this._executionId!==i)return;if(!r.success){const e=ap("Failed to deploy process definition",r);return void this._cancelTaskExecution(hp,e)}const s=function(e,t){const{deployments:n=[]}=e;for(const e of n)if(e.processDefinition){const{processDefinition:n}=e;if(n.processDefinitionId===t)return n.processDefinitionKey}return null}(r.response,n);if(!s){const e=ap("Failed to retrieve process definition key from deployment response");return void this._cancelTaskExecution(hp,e)}this.emit(mp,r),this._changeState("starting-instance");const o=await this._api.startInstance(s,e.id,t);if(this._executionId!==i)return;if(!o.success){const e=ap("Failed to start process instance",o);return void this._cancelTaskExecution(hp,e)}const l=function(e){const{processInstanceKey:t}=e;return t||null}(o.response);if(!l){const e=ap("Failed to retrieve process instance key from start instance response");return void this._cancelTaskExecution(hp,e)}this.emit(Ap,o),this._changeState("executing"),this._interval=setInterval(async()=>{const t=await this._api.getProcessInstance(l);if(this._executionId!==i)return;if(!t.success)return void this._cancelTaskExecution(hp,ap("Failed to get process instance",t));if(!yp(t.response,l))return;const n=await Promise.all([this._api.getProcessInstanceElementInstances(l),this._api.getProcessInstanceJobs(l,e.id),this._api.getProcessInstanceMessageSubscriptions(l,e.id),this._api.getProcessInstanceUserTasks(l,e.id),this._api.getProcessInstanceVariables(l)]);if(this._executionId!==i)return;const r=n.find(e=>!e.success);if(r)return void this._cancelTaskExecution(hp,ap("Failed to poll process instance data",r));const[s,o,a,c,h]=n,u={elementId:e.id,processInstanceKey:l,elementInstancesResponse:s,jobsResponse:o,messageSubscriptionsResponse:a,processInstanceResponse:t,userTasksResponse:c,variablesResponse:h};this._lastPolledResult=u,this.emit(vp,u);const d=function(e,t){const n=yp(e,t);return n&&n.hasIncident||!1}(t.response,l);if(d){const e=await this._api.getProcessInstanceIncident(l);if(this._executionId!==i)return;if(!e.success)return void this._cancelTaskExecution(hp,ap("Failed to get process instance incident",e));const t=function(e){const{items:t=[]}=e;return t.length?t[0]:null}(e.response);return this.emit(bp,{incident:t,lastPolledResult:this._lastPolledResult,processInstanceKey:l,reason:up,success:!1}),void this._cancelTaskExecution()}const f=function(e,t){const n=yp(e,t);return n?n.state:null}(t.response,l);if("COMPLETED"===f||"TERMINATED"===f){const t=s.success?function(e,t){const{items:n=[]}=e;return n.find(e=>e.elementId===t.id)||null}(s.response,e):null;t&&"COMPLETED"===t.state?this.emit(bp,{lastPolledResult:this._lastPolledResult,processInstanceKey:l,success:!0}):this.emit(bp,{lastPolledResult:this._lastPolledResult,processInstanceKey:l,reason:dp,success:!1}),this._cancelTaskExecution()}},1e3)}async cancelTaskExecution(){this._cancelTaskExecution(fp)}_cancelTaskExecution(e,t){if(!this._isIdle()){if(this._interval&&clearInterval(this._interval),this._executionId=null,this._changeState(cp),e){var n,i;const r=e===hp?{success:!1,reason:e,error:t,processInstanceKey:(null===(n=this._lastPolledResult)||void 0===n?void 0:n.processInstanceKey)??null,lastPolledResult:this._lastPolledResult}:{success:!1,reason:e,processInstanceKey:(null===(i=this._lastPolledResult)||void 0===i?void 0:i.processInstanceKey)??null,lastPolledResult:this._lastPolledResult};this.emit(bp,r)}this._lastPolledResult=null}}_changeState(e){this._state!==e&&(this._state=e,this.emit(gp,e))}_isIdle(){return this._state===cp}}function yp(e,t){const{items:n=[]}=e;return n.length&&n.find(e=>e.processInstanceKey===t)||null}var wp=_(72),Cp=_.n(wp),kp=_(825),_p=_.n(kp),Sp=_(659),Ep=_.n(Sp),Tp=_(56),Op=_.n(Tp),Mp=_(540),Bp=_.n(Mp),Dp=_(113),Rp=_.n(Dp),Ip=_(520),Pp={};Pp.styleTagTransform=Rp(),Pp.setAttributes=Op(),Pp.insert=Ep().bind(null,"head"),Pp.domAPI=_p(),Pp.insertStyleElement=Bp(),Cp()(Ip.A,Pp),Ip.A&&Ip.A.locals&&Ip.A.locals;const Np=()=>null;function Lp({injector:e,api:r,isConnectionConfigured:s,configureConnectionBannerTitle:o="Connection required",configureConnectionBannerDescription:l="Configure a connection to start testing.",configureConnectionLabel:a="Configure",onConfigureConnection:c,onTestTask:h,config:d,onConfigChanged:p=()=>{},operateBaseUrl:g,tasklistBaseUrl:m,documentationUrl:x,onTaskExecutionStarted:y=()=>{},onTaskExecutionFinished:w=()=>{},children:C=[]}){const k=(0,S.useRef)(null),_=(0,S.useRef)(null),[O,M]=(0,S.useState)([]),[B,D]=(0,S.useState)(cp),[R,I]=(0,S.useState)(),[P,N]=(0,S.useState)(),[L,F]=(0,S.useState)({}),[j,z]=(0,S.useState)(null),[K,G]=(0,S.useState)(null),[Y,J]=function(e){const[t,n]=(0,S.useState)(null),[i,r]=(0,S.useState)($);(0,S.useEffect)(()=>{const t=e.get("selection");s({newSelection:t.get()});const n=e.get("eventBus");return n.on("selection.changed",s),()=>{n.off("selection.changed",s)}},[e]);const s=({newSelection:e})=>{const t=1!==(i=e).length?$:W(i[0],q)?function(e){let t=H(e).$parent;for(;t;){if(V(t,"bpmn:AdHocSubProcess"))return!0;t=t.$parent}return!1}(i[0])?"Task testing is not supported for tasks inside ad-hoc subprocesses.":null:U;var i;if(t)return n(null),void r(t);n(e[0]),r(null),1!==e.length?(n(null),r($)):W(e[0],q)?(n(e[0]),r(null)):(n(null),r(U))};return[t,i]}(e),Z=(0,S.useRef)(null),[ee,te]=(0,S.useState)(!0),[ne,ie]=(0,S.useState)([]),re=(0,S.useRef)(new Rf),se=(0,S.useRef)(null),[oe,le]=(0,S.useState)(null),[ae,ce]=(0,S.useState)(0);(0,S.useEffect)(()=>{const t=new X(e);k.current=t;const n=new Q(e,t,d);_.current=n;const i=new xp(e,r);return Z.current=i,re.current=new Rf(e),()=>{var e;null===(e=Z.current)||void 0===e||e.cancelTaskExecution()}},[e]),(0,S.useEffect)(()=>{Y&&k.current&&k.current.getVariablesForElement(Y).then(e=>M(e))},[Y]),(0,S.useEffect)(()=>{if(!k.current)return;const e=async()=>{if(!Y||!k.current)return;const e=await k.current.getVariablesForElement(Y);M(e)};return k.current.on("variables.changed",e),()=>{k.current&&k.current.off("variables.changed",e)}},[Y]),(0,S.useEffect)(()=>{if(!_.current)return;const e=()=>{_.current&&(p(_.current.getConfig()),Y&&(I(_.current.getInputConfigForElement(Y)),N(_.current.getOutputConfigForElement(Y)),F(_.current.getConfig().output)))};return _.current.on("config.changed",e),()=>{_.current&&_.current.off("config.changed",e)}},[Y,p,F,I,N]),(0,S.useEffect)(()=>{var e,t,n,i,r;const s=e=>{D(e),re.current.setState(e,Date.now()),ie(re.current.getEntries())},o=e=>{re.current.setDeployResponse(e),ie(re.current.getEntries())},l=e=>{if(e.success){const t=g?function(e,t){try{const n=If(e),i=`processes/${t}`;return new URL(i,`${n}/`).toString()}catch(e){return null}}(g,e.response.processInstanceKey):null;G(t)}re.current.setStartInstanceResponse(e),ie(re.current.getEntries())},a=e=>{var t,n;if(null!==(t=e.variablesResponse)&&void 0!==t&&t.success&&null!==(n=e.elementInstancesResponse)&&void 0!==n&&n.success){const t=lf(e.variablesResponse.response.items,e.elementInstancesResponse.response.items||[],e.processInstanceKey,Y.id);le(t)}re.current.setPolledResult(e),ie(re.current.getEntries())},c=e=>{re.current.setFinishedResult(e,Date.now()),ie(re.current.getEntries());const t=re.current.getEntries(),n=function(e,t){var n,i;const r=e.lastPolledResult;if(null!=r&&null!==(n=r.variablesResponse)&&void 0!==n&&n.success&&null!=r&&null!==(i=r.elementInstancesResponse)&&void 0!==i&&i.success)return lf(r.variablesResponse.response.items,r.elementInstancesResponse.response.items||[],r.processInstanceKey,t.id)}(e,Y);var i;if(e.success)null==_||null===(i=_.current)||void 0===i||i.setOutputConfigForElement(Y,{success:!0,variables:n,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()});else if(function(e){return!e.success&&e.reason===up}(e)){var r;null==_||null===(r=_.current)||void 0===r||r.setOutputConfigForElement(Y,{success:!1,variables:n,incident:e.incident,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}else if(function(e){return!e.success&&e.reason===hp}(e)){var s;null==_||null===(s=_.current)||void 0===s||s.setOutputConfigForElement(Y,{success:!1,error:e.error,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}else if(function(e){return!e.success&&e.reason===dp}(e)){var o;null==_||null===(o=_.current)||void 0===o||o.setOutputConfigForElement(Y,{success:!1,terminated:!0,variables:n,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}else if(e.reason===fp||e.reason===pp){var l;null==_||null===(l=_.current)||void 0===l||l.setOutputConfigForElement(Y,{success:!1,canceled:!0,variables:n,operateUrl:K,executionLog:t,startedAt:se.current,finishedAt:Date.now()})}w(Y,e)};return null==Z||null===(e=Z.current)||void 0===e||e.on(bp,c),null==Z||null===(t=Z.current)||void 0===t||t.on(mp,o),null==Z||null===(n=Z.current)||void 0===n||n.on(Ap,l),null==Z||null===(i=Z.current)||void 0===i||i.on(vp,a),null==Z||null===(r=Z.current)||void 0===r||r.on(gp,s),()=>{Z.current&&(Z.current.off(gp,s),Z.current.off(mp,o),Z.current.off(Ap,l),Z.current.off(vp,a),Z.current.off(bp,c))}},[Y,g,K,w]),(0,S.useEffect)(()=>{d&&_.current&&JSON.stringify(d)!==JSON.stringify(_.current.getConfig())&&_.current.setConfig(d)},[d]),(0,S.useEffect)(()=>{var e,t;Y?(I(null==_||null===(e=_.current)||void 0===e?void 0:e.getInputConfigForElement(Y)),N(null==_||null===(t=_.current)||void 0===t?void 0:t.getOutputConfigForElement(Y))):I(void 0)},[Y]);const he=((e=Yf)=>{const[t,n]=(0,S.useState)(e),i=(0,S.useCallback)(e=>{n(t=>[...t,e])},[]),r=(0,S.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]),s=(0,S.useCallback)(e=>t.filter(t=>t.type===e).sort((e,t)=>(t.priority||0)-(e.priority||0)),[t]);return(0,S.useMemo)(()=>({plugins:t,registerPlugin:i,unregisterPlugin:r,getPlugins:s}),[t,i,r,s])})(),ue=(0,S.useCallback)(e=>{Y&&_.current&&_.current.setInputConfigForElement(Y,e)},[Y]),de=(0,S.useCallback)(()=>{Y&&_.current&&_.current.resetInputConfigForElement(Y)},[Y]),fe=async()=>{if(j||!Y||!Z.current||!_.current)return;y(Y),ce(1),ie([]),re.current.reset(),le(null),se.current=Date.now();const e=_.current.getInputConfigForElement(Y);_.current.setOutputConfigForElement(Y,null),Z.current.executeTask(Y,JSON.parse(e))},pe=(0,S.useCallback)(()=>{Y&&_.current&&(_.current.resetOutputConfigForElement(Y),ce(1))},[Y]);if(!d)return(0,E.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,E.jsxs)("div",{className:"task-testing__container-no-config",children:[(0,E.jsx)(n,{})," ",(0,E.jsx)("span",{children:"Configuring..."})]})});if(!Y)return(0,E.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,E.jsxs)("div",{className:"task-testing__container-no-element",children:[(0,E.jsx)(u,{}),(0,E.jsx)("span",{children:J}),x&&(0,E.jsx)(i,{href:x,target:"_blank",children:"Learn more"})]})});const ge=!s||!!j,me=s?j:o,Ae=B!==cp,ve=async()=>{var e;Ae?null==Z||null===(e=Z.current)||void 0===e||e.cancelTaskExecution():h?(te(!1),await h()&&fe(),te(!0)):s&&fe()};return(0,E.jsxs)(Gf.Provider,{value:he,children:[(0,E.jsxs)("div",{className:"task-testing__container",children:[(0,E.jsxs)("div",{className:`task-testing__container--header ${Fp({isTaskExecuting:Ae,isConnectionConfigured:s,inputError:j,output:P})}`,children:[(0,E.jsx)("div",{className:"task-testing__header-actions",children:ge?(0,E.jsx)(T,{label:me,align:"bottom-start",children:(0,E.jsx)(t,{"data-testid":"test-task-btn",className:"btn-execute",kind:"secondary",size:"sm",renderIcon:Ae?b:A,iconDescription:Ae?"Stop test":"Run test",onClick:ve,disabled:!ee,children:Ae?"Stop test":"Run test"})}):(0,E.jsx)(t,{"data-testid":"test-task-btn",className:"btn-execute",kind:Ae?"secondary":"primary",size:"sm",renderIcon:Ae?b:A,iconDescription:Ae?"Stop test":"Run test",onClick:ve,disabled:!ee,children:Ae?"Stop test":"Run test"})}),(0,E.jsxs)("div",{className:"task-testing__header-status",children:[(0,E.jsx)(jp,{isTaskExecuting:Ae,isConnectionConfigured:s,inputError:j,output:P}),(0,E.jsx)("span",{className:"task-testing__header-status-text",children:(0,E.jsx)(zp,{configureConnectionBannerTitle:o,isConnectionConfigured:s,inputError:j,output:P})})]}),(0,E.jsxs)("div",{className:"task-testing__header-actions-right",children:[(0,E.jsx)(T,{label:"Clear result",align:"bottom-end",children:(0,E.jsx)(t,{kind:"ghost",size:"sm",hasIconOnly:!0,renderIcon:f,iconDescription:"Clear result",onClick:pe,disabled:!P||Ae})}),c&&(0,E.jsx)(T,{label:s?"Configure connection":a,align:"bottom-end",children:(0,E.jsx)(t,{"data-testid":"configure-connection-btn",kind:"ghost",size:"sm",hasIconOnly:!0,renderIcon:v,iconDescription:a,onClick:()=>c(),disabled:Ae})})]})]}),(0,E.jsx)("div",{className:"task-testing__container--body"+(Ae?" task-testing__container--body-executing":""),children:(0,E.jsx)(Vp,{selectedIndex:ae,setSelectedIndex:ce,tabs:[{label:"Input",disabled:Ae,children:(0,E.jsx)(vf,{allOutputs:L,input:R,onErrorChange:z,onResetInput:de,onSetInput:ue,variablesForElement:O})},{label:"Result",children:(0,E.jsx)(Jf,{element:Y,isConnectionConfigured:s,isTaskExecuting:Ae,currentVariables:oe,output:P,currentOperateUrl:K,onResetOutput:pe,taskExecutionState:B,executionLog:Ae?ne:(null==P?void 0:P.executionLog)||[],tasklistBaseUrl:m})},...he.getPlugins("output.body.tab").map(e=>{var t;return{label:e.label,disabled:Ae,children:(null===(t=e.render)||void 0===t?void 0:t.call(e,{element:Y,output:P,isTaskExecuting:Ae,executionLog:ne}))||e.children}}).filter(e=>e.children)]})})]}),C]})}function Fp({isTaskExecuting:e,isConnectionConfigured:t,inputError:n,output:i}){return e?"task-testing__container--header-executing":null!=i&&i.error||null!=i&&i.incident||!t||n?"task-testing__container--header-error":null!=i&&i.success?"task-testing__container--header-success":null!=i&&i.terminated?"task-testing__container--header-terminated":null!=i&&i.canceled?"task-testing__container--header-canceled":""}function jp({isTaskExecuting:e,isConnectionConfigured:t,inputError:n,output:i}){return null!=i&&i.error||null!=i&&i.incident||!t||n?(0,E.jsx)(y,{size:16,className:"task-testing__status-icon--error"}):null!=i&&i.success?(0,E.jsx)(l,{size:16,className:"task-testing__status-icon--success"}):null!=i&&i.terminated?(0,E.jsx)(b,{size:16,className:"task-testing__status-icon--terminated"}):null!=i&&i.canceled?(0,E.jsx)(p,{size:16,className:"task-testing__status-icon--canceled"}):null}function zp({isConnectionConfigured:e,configureConnectionBannerTitle:t,inputError:n,output:i}){if(!e)return t;if(n)return"Input error";if(i){if(i.error)return"Error";if(i.incident)return"Incident";if(i.success)return"Passed";if(i.terminated)return"Terminated";if(i.canceled)return"Canceled"}return null}function Vp({selectedIndex:e=0,setSelectedIndex:t=()=>{},tabs:n}){var i;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"task-testing-tabs__list",role:"tablist",children:n.map((n,i)=>(0,E.jsx)("button",{type:"button",role:"tab",className:M()("task-testing-tabs__tab",{"task-testing-tabs__tab--active":i===e,"task-testing-tabs__tab--disabled":n.disabled}),"aria-selected":i===e,onClick:()=>t(i),disabled:n.disabled,children:n.label},i))}),(0,E.jsx)("div",{className:"task-testing-tabs__panel",children:null===(i=n[e])||void 0===i?void 0:i.children})]})}Lp.Tab=({children:e=null,render:t=Np,label:n,priority:i=1e3})=>{const{registerPlugin:r,unregisterPlugin:s}=(0,S.useContext)(Gf);return(0,S.useEffect)(()=>{const o={label:n,render:t,children:e,priority:i,type:"output.body.tab"};return r(o),()=>{s(o)}},[e,t,n,i,r,s]),null},Lp.Link=Zf;export{Lp as default};
|
|
2
|
+
import*as e from"react";import{Button as t,InlineLoading as n,Link as i,SkeletonPlaceholder as r}from"@carbon/react";import{createPortal as s}from"react-dom";import{CheckmarkFilled as o,CheckmarkOutline as l,ChevronDown as a,ChevronRight as c,Copy as h,Cursor_1 as u,Email as d,Erase as f,ErrorFilled as p,Information as g,Launch as m,PlayFilledAlt as A,Settings as v,StopFilledAlt as b,TaskComplete as x,Warning as y,WarningFilled as w}from"@carbon/icons-react";var C={520(e,t,n){n.d(t,{A:()=>l});var i=n(354),r=n.n(i),s=n(314),o=n.n(s)()(r());o.push([e.id,'.task-testing__container{--color-text-primary: #161616;--color-text-secondary: #525252;--color-text-disabled: #8d8d8d;--color-text-placeholder: hsl(225, 10%, 35%);--color-bg: #fff;--color-bg-light: #f4f4f4;--color-bg-muted: hsl(225, 10%, 95%);--color-border-light: #e0e0e0;--color-border-strong: hsl(225, 10%, 75%);--color-interactive: #0f62fe;--color-info: #0043ce;--color-info-bg: #edf5ff;--color-info-border: #0043ce4d;--color-success: #24a148;--color-success-bg: #defbe6;--color-success-border: #24a1484d;--color-error: #da1e28;--color-error-bg: #fff1f1;--color-error-border: #da1e284d;--color-warning: #f1c21b;--color-warning-bg: #fdf6dd;--color-warning-border: #e0a520;--color-canceled: var(--color-text-secondary);--color-canceled-bg: #f4f4f4;--color-canceled-border: #e0e0e0;display:flex;flex-direction:column;height:100%;width:100%;font-size:14px;container-type:inline-size}.task-testing__container.task-testing__container--empty{align-items:center;justify-content:center;background-color:var(--color-bg-muted)}.task-testing__container.task-testing__container--empty .task-testing__container-no-config,.task-testing__container.task-testing__container--empty .task-testing__container-no-element{display:flex;flex-direction:column;align-items:center;gap:8px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config>svg,.task-testing__container.task-testing__container--empty .task-testing__container-no-element>svg{width:32px;height:32px;color:var(--color-text-placeholder)}.task-testing__container.task-testing__container--empty .task-testing__container-no-config>span,.task-testing__container.task-testing__container--empty .task-testing__container-no-element>span{margin:12px 48px;text-align:center;color:var(--color-text-placeholder);font-size:14px}.task-testing__container.task-testing__container--empty .task-testing__container-no-config .cds--inline-loading,.task-testing__container.task-testing__container--empty .task-testing__container-no-element .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .task-testing-tabs__list{display:flex;border-bottom:1px solid var(--color-border-strong);background:var(--color-bg-muted);flex-shrink:0}.task-testing__container .task-testing-tabs__tab{padding:6px 12px;background:none;border:none;border-bottom:2px solid rgba(0,0,0,0);font-size:14px;font-weight:600;color:var(--color-text-secondary)}.task-testing__container .task-testing-tabs__tab:hover{color:var(--color-text-primary);background-color:var(--color-bg-light);cursor:pointer}.task-testing__container .task-testing-tabs__tab.task-testing-tabs__tab--active{color:var(--color-text-primary);border-bottom-color:var(--color-interactive)}.task-testing__container .task-testing-tabs__tab.task-testing-tabs__tab--disabled{color:var(--color-text-disabled)}.task-testing__container .task-testing-tabs__panel{display:flex;flex-direction:column;flex-grow:1;min-height:0;overflow-y:auto}.task-testing__container .task-testing__container--header{flex-shrink:0;display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:12px;width:100%;padding:12px;border-bottom:1px solid var(--color-border-light)}.task-testing__container .task-testing__container--header .cds--popover{display:none}.task-testing__container .task-testing__container--header .task-testing__header-status{display:flex;align-items:center;gap:6px;min-width:0;flex:1}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--success{fill:var(--color-success);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--error{fill:var(--color-error);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--canceled{fill:var(--color-canceled);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__status-icon--terminated{fill:var(--color-warning);flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-status .task-testing__header-status-text{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .task-testing__container--header .task-testing__header-actions{display:flex;align-items:center;flex-shrink:0}.task-testing__container .task-testing__container--header .task-testing__header-actions-right{display:flex;align-items:center;flex-shrink:0}.task-testing__container .task-testing__container--header .btn-execute{width:140px}.task-testing__container .task-testing__container--header .cds--btn .cds--inline-loading{inline-size:initial;min-block-size:initial}.task-testing__container .task-testing__container--body{display:flex;flex-direction:column;flex-grow:1;min-height:0;overflow:hidden}.task-testing__container .task-testing__container--body.task-testing__container--body-executing{padding-bottom:12px;overflow-y:auto}.task-testing__container .input{flex-grow:1;display:flex;flex-direction:column;gap:6px;margin:12px 0;padding:0 12px}.task-testing__container .input .input__header{display:flex;justify-content:space-between;align-items:center;gap:6px;width:100%}.task-testing__container .input .input__header--title{color:var(--color-text-secondary);font-weight:600}.task-testing__container .input .input__footer{border-radius:4px;border:1px solid var(--color-info-border);background-color:var(--color-info-bg);color:var(--color-text-primary);padding:12px;display:flex;align-items:flex-start}.task-testing__container .input .input__footer .input__footer--icon{flex-shrink:0;display:flex;align-items:center}.task-testing__container .input .input__footer .input__footer--icon svg{fill:var(--color-info)}.task-testing__container .input .input__footer .input__footer--text{font-size:14px;line-height:18px;margin-left:12px}.task-testing__container .output{flex-grow:1;display:flex;flex-direction:column;gap:12px;min-height:0}.task-testing__container .output .output__banner{display:flex;flex-direction:column;gap:0;font-size:14px;flex-shrink:0;border-radius:4px;margin:12px 12px 0}.task-testing__container .output .output__banner.output__banner--success{background-color:var(--color-success-bg);border:1px solid var(--color-success-border)}.task-testing__container .output .output__banner.output__banner--success .output__banner-icon svg{fill:var(--color-success)}.task-testing__container .output .output__banner.output__banner--error{background-color:var(--color-error-bg);border:1px solid var(--color-error-border)}.task-testing__container .output .output__banner.output__banner--error .output__banner-details-content{margin-top:6px;white-space:pre-wrap;font-family:"IBM Plex Mono",monospace;line-height:18px;width:100%}.task-testing__container .output .output__banner.output__banner--error .output__banner-icon svg{fill:var(--color-error)}.task-testing__container .output .output__banner.output__banner--warning{background-color:var(--color-warning-bg);border:1px solid var(--color-warning-border)}.task-testing__container .output .output__banner.output__banner--warning .output__banner-icon svg{fill:var(--color-warning)}.task-testing__container .output .output__banner.output__banner--canceled{background-color:var(--color-canceled-bg);border:1px solid var(--color-canceled-border)}.task-testing__container .output .output__banner.output__banner--canceled .output__banner-icon svg{fill:var(--color-canceled)}.task-testing__container .output .output__banner.output__banner--executing{background-color:var(--color-info-bg);border:1px solid var(--color-info-border)}.task-testing__container .output .output__banner.output__banner--executing .output__banner-loader{width:auto;min-height:0}.task-testing__container .output .output__banner .output__banner-header{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 12px}.task-testing__container .output .output__banner .output__banner-main{display:flex;align-items:center;gap:6px;min-width:0;flex-grow:1}.task-testing__container .output .output__banner .output__banner-chevron{margin-left:auto;flex-shrink:0;fill:currentColor}.task-testing__container .output .output__banner .output__banner-icon{display:flex;flex-shrink:0}.task-testing__container .output .output__banner .output__banner-text{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .output .output__banner .output__banner-timing{color:var(--color-text-secondary);white-space:nowrap;flex-shrink:0;margin-left:auto}.task-testing__container .output .output__banner .output__banner-actions{display:flex;flex-direction:column;gap:4px;padding:0 12px 8px 34px}.task-testing__container .output .output__banner .output__banner-actions .cds--link{font-size:14px;display:flex;align-items:center}.task-testing__container .output .output__banner .output__banner-actions .link--disabled,.task-testing__container .output .output__banner .output__banner-actions .link--disabled:hover{color:var(--color-text-disabled);text-decoration:none}.task-testing__container .output .output__banner .output__banner-details{padding:0 12px 8px 34px}.task-testing__container .output .output__banner .output__banner-details .output__banner-details-content{margin:0;color:var(--color-text-secondary)}.task-testing__container .output .output__banner .output__banner-incident,.task-testing__container .output .output__banner .output__banner-error{display:flex;flex-direction:column;gap:6px;align-items:flex-start}.task-testing__container .output .output__banner .output__banner-incident-heading,.task-testing__container .output .output__banner .output__banner-error-heading{font-weight:600;color:var(--color-text-primary);text-decoration:underline dotted;text-underline-offset:2px}.task-testing__container .output .output__banner .output__banner--error .output__banner-details{font-family:"IBM Plex Mono",monospace;line-height:18px}.task-testing__container .output .output__banner .output__banner-details-row{display:flex;column-gap:8px;line-height:18px}.task-testing__container .output .output__banner .output__banner-details-label{color:var(--color-text-secondary);white-space:nowrap;width:30%;overflow:hidden;text-overflow:ellipsis}.task-testing__container .output .output__banner .output__banner-details-value{color:var(--color-text-primary);font-family:"IBM Plex Mono",monospace;width:70%;white-space:pre-wrap;word-break:break-word}@container (max-width: 380px){.task-testing__container .output .output__banner .output__banner-details-row{flex-wrap:wrap}.task-testing__container .output .output__banner .output__banner-details-label{width:auto}.task-testing__container .output .output__banner .output__banner-details-value{width:auto;overflow:visible;white-space:normal;word-break:break-word}}.task-testing__container .output .output__empty-state{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:48px 24px;color:var(--color-text-secondary)}.task-testing__container .output .output__empty-state .output__empty-state-icon{width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;background-color:var(--color-bg-light)}.task-testing__container .output .output__empty-state .output__empty-state-icon svg{width:24px;height:24px}.task-testing__container .output .output__empty-state .output__empty-state-text{text-align:center}.task-testing__container .output .output__body{display:flex;flex-direction:column;padding-bottom:8px}.task-testing__container .output .output__body .cds--tabs{--cds-layout-size-height-local: 32px;display:flex;flex-direction:column;min-height:0}.task-testing__container .output .output__body .cds--tab-content{padding:0}.task-testing__container .output .output__body .cds--tab-content:not([hidden]){display:flex;flex-grow:1;min-height:0}.task-testing__container .output .output__collapsible{border-bottom:1px solid var(--color-border-strong)}.task-testing__container .output .output__collapsible:last-child{border-bottom:none}.task-testing__container .output .output__collapsible-sentinel{height:1px;margin-bottom:-1px;visibility:hidden;pointer-events:none}.task-testing__container .output .output__collapsible-header{display:flex;align-items:center;gap:4px;width:100%;padding:6px 12px;background:var(--color-bg);border:none;border-bottom:1px solid rgba(0,0,0,0);font-size:14px;font-weight:normal;color:var(--color-text-secondary);position:sticky;top:0;z-index:2}.task-testing__container .output .output__collapsible-header.stuck{background:var(--color-bg-muted);border-bottom-color:var(--color-border-strong)}.task-testing__container .output .output__collapsible-header:hover{color:var(--color-text-primary)}.task-testing__container .output .output__collapsible-header svg{flex-shrink:0;fill:currentColor}.task-testing__container .output .output__collapsible-chevron{margin-left:auto}.task-testing__container .output .output__collapsible-title{user-select:none}.task-testing__container .output .output__collapsible-content{padding:0 12px 8px}.task-testing__container .output .output__section-empty{color:var(--color-text-secondary);font-size:14px;padding:4px 0}.task-testing__container .output .output__error{display:flex;flex-direction:column;gap:12px;padding:12px;margin-bottom:12px;border:1px solid var(--color-error);border-left-width:3px;background-color:var(--color-error-bg)}.task-testing__container .output .output__error .output__error--title{display:flex;flex-direction:row;align-items:center;font-weight:bold}.task-testing__container .output .output__error .output__error--title svg{fill:var(--color-error)}.task-testing__container .output .output__error .output__error--title .output__error--action{margin-left:auto}.task-testing__container .output .output__variables--empty{height:32px;display:flex;align-items:center;color:var(--color-text-secondary)}.task-testing__container .output .output__variables--empty-action{font-weight:bold}.task-testing__container .output .output__variables--skeleton .cds--skeleton__placeholder{width:100% !important}.task-testing__container .output code{font-size:14px}.task-testing__container .execution-log{font-size:14px}.task-testing__container .execution-log .execution-log__details{margin:4px 0 0 0}.task-testing__container .execution-log .execution-log__details-row{display:flex;column-gap:8px;line-height:18px}.task-testing__container .execution-log .execution-log__details-label{color:var(--color-text-secondary);white-space:nowrap;width:30%;overflow:hidden;text-overflow:ellipsis}.task-testing__container .execution-log .execution-log__details-value{color:var(--color-text-primary);font-family:"IBM Plex Mono",monospace;width:70%;overflow:hidden;text-overflow:ellipsis}@container (max-width: 380px){.task-testing__container .execution-log .execution-log__details-row{flex-wrap:wrap}.task-testing__container .execution-log .execution-log__details-label{width:auto}.task-testing__container .execution-log .execution-log__details-value{width:auto;overflow:visible;white-space:normal;word-break:break-word}}.task-testing__container .execution-log .execution-log__empty{color:var(--color-text-secondary)}.task-testing__container .execution-log .execution-log__empty-action{font-weight:bold}.task-testing__container .execution-log .execution-log__entries{list-style:none;margin:0;padding:0 0 0 2px;display:flex;flex-direction:column;position:relative}.task-testing__container .execution-log .execution-log__entry-wrapper{display:flex;flex-direction:column;position:relative;padding:0 0 0 20px;margin-bottom:0}.task-testing__container .execution-log .execution-log__entry-wrapper::before{content:"";position:absolute;left:0;top:9px;width:7px;height:7px;border-radius:50%;background-color:var(--color-border-light);z-index:1}.task-testing__container .execution-log .execution-log__entry-wrapper::after{content:"";position:absolute;left:3px;top:20px;bottom:-4px;width:1px;background-color:var(--color-border-light)}.task-testing__container .execution-log .execution-log__entry-wrapper:last-child::after{display:none}.task-testing__container .execution-log .execution-log__entry-wrapper.execution-log__entry-wrapper--active::before{background-color:rgba(0,0,0,0);border:1px solid var(--color-border-strong)}.task-testing__container .execution-log .execution-log__entry-content{padding:4px 8px;border-radius:4px}.task-testing__container .execution-log .execution-log__entry-content:hover{background-color:var(--color-bg-light)}.task-testing__container .execution-log .execution-log__entry{display:flex;align-items:center;gap:8px;color:var(--color-text-secondary);font-size:14px;line-height:18px}.task-testing__container .execution-log .execution-log__entry--expandable:hover{color:var(--color-text-primary)}.task-testing__container .execution-log .execution-log__toggle{display:flex;align-items:center;margin-left:auto}.task-testing__container .execution-log .execution-log__toggle svg{fill:var(--color-text-disabled)}.task-testing__container .execution-log .execution-log__labels{display:flex;flex-direction:column;min-width:0;flex:1}.task-testing__container .execution-log .execution-log__label{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.task-testing__container .execution-log .execution-log__label-row{display:flex;align-items:center;gap:8px;min-width:0}.task-testing__container .execution-log .execution-log__duration{font-size:11px;color:var(--color-text-disabled);white-space:nowrap;flex-shrink:0}.task-testing__container .execution-log .execution-log__secondary-label{color:var(--color-text-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;border-radius:4px;background-color:var(--color-bg-light);padding:2px 4px;font-size:12px;align-self:flex-start;margin-top:2px}.task-testing__container .execution-log .execution-log__cta{margin-top:12px;padding:12px;border:1px solid var(--color-info-border);background-color:var(--color-info-bg);border-radius:4px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-header{display:flex;align-items:center;gap:6px;margin-bottom:6px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-header svg{fill:var(--color-info-border);flex-shrink:0}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-title{font-weight:600;font-size:14px;color:var(--color-text-primary)}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-description{margin:0 0 8px;font-size:14px;color:var(--color-text-secondary);line-height:18px}.task-testing__container .execution-log .execution-log__cta .execution-log__cta-link{font-size:14px}.task-testing__container .task-testing-tooltip__wrapper{display:inline-flex;align-items:center;width:fit-content}.task-testing__container .code__editor{position:relative;display:flex;flex-direction:column}.task-testing__container .code__editor.code__editor--error .code__editor-codemirror{border-color:var(--color-error);background-color:var(--color-error-bg)}.task-testing__container .code__editor.code__editor--error .cm-gutter{background-color:var(--color-error-bg)}.task-testing__container .code__editor .code__editor-codemirror{border:1px solid var(--color-border-strong);border-radius:2px;background-color:var(--color-bg-light)}.task-testing__container .code__editor .code__editor-codemirror .cm-scroller{overflow:visible !important}.task-testing__container .code__editor .code__editor-codemirror .cm-content{padding:6px}.task-testing__container .code__editor .code__editor-codemirror .cm-focused{outline:none}.task-testing__container .code__editor .code__editor-codemirror .cm-tooltip{font-size:14px}.task-testing__container .code__editor .code__editor-codemirror .info{padding:6px;font-family:"IBM Plex Mono",monospace;font-size:12px;max-width:300px;word-wrap:break-word}.task-testing__container .code__editor .code__editor-codemirror .info pre{margin-top:8px}.task-testing__container .code__editor .code__editor-error{color:var(--color-error);font-size:14px;margin-top:5px}.task-testing__container .code__editor .code__editor-copy-button,.task-testing__container .code__editor .code__editor-clear-button{position:absolute;top:5px;right:5px;z-index:10;block-size:24px;inline-size:24px;padding-block-start:0;padding-inline-end:0;min-block-size:0;display:flex;justify-content:center;align-items:center}.task-testing__container .code__editor .code__editor-copy-button svg,.task-testing__container .code__editor .code__editor-clear-button svg{fill:var(--color-text-secondary)}.task-testing__container .has-tooltip{text-decoration:underline;text-decoration-style:dotted;text-underline-offset:2px}.task-testing-tooltip{--tooltip-color-bg: hsl(0, 0%, 22%);--tooltip-color-text: #fff;--tooltip-color-link: hsl(218, 100%, 74%);--tooltip-color-code-text: hsl(225, 10%, 35%);--tooltip-color-code-bg: hsl(225, 10%, 97%);--tooltip-color-code-border: hsl(225, 10%, 85%);position:fixed;z-index:1000;max-width:300px;font-size:13px;font-family:"IBM Plex Sans",sans-serif;color:var(--tooltip-color-text)}.task-testing-tooltip .task-testing-tooltip__content{background-color:var(--tooltip-color-bg);color:var(--tooltip-color-text);padding:16px;border-radius:2px;font-size:14px;font-weight:400;white-space:pre-wrap;line-height:21px}.task-testing-tooltip .task-testing-tooltip__content .bio-properties-panel-tooltip-content h1{font-size:14px;font-weight:bold;margin:0}.task-testing-tooltip .task-testing-tooltip__content a{color:var(--tooltip-color-link) !important;text-decoration:underline !important}.task-testing-tooltip .task-testing-tooltip__content code,.task-testing-tooltip .task-testing-tooltip__content pre{color:var(--tooltip-color-code-text);font-family:"IBM Plex Mono",monospace;font-size:13px;line-height:17px;padding:0 2px;background-color:var(--tooltip-color-code-bg);border:1px solid var(--tooltip-color-code-border);border-radius:2px}.task-testing-tooltip .task-testing-tooltip__content pre code{border:none}.task-testing-tooltip .task-testing-tooltip__content p:first-child{margin-top:0}.task-testing-tooltip .task-testing-tooltip__content p:last-child{margin-bottom:0}.task-testing-tooltip .task-testing-tooltip__arrow{position:absolute;width:0;height:0}.task-testing-tooltip.bottom-start,.task-testing-tooltip.bottom-end{padding-top:6px}.task-testing-tooltip.bottom-start .task-testing-tooltip__arrow,.task-testing-tooltip.bottom-end .task-testing-tooltip__arrow{top:1px;left:12px;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-bottom:5px solid var(--tooltip-color-bg)}.task-testing-tooltip.bottom-end .task-testing-tooltip__arrow{left:auto;right:12px}.task-testing-tooltip.top-start,.task-testing-tooltip.top-end{padding-bottom:6px}.task-testing-tooltip.top-start .task-testing-tooltip__arrow,.task-testing-tooltip.top-end .task-testing-tooltip__arrow{bottom:1px;left:12px;border-left:5px solid rgba(0,0,0,0);border-right:5px solid rgba(0,0,0,0);border-top:5px solid var(--tooltip-color-bg)}.task-testing-tooltip.top-end .task-testing-tooltip__arrow{left:auto;right:12px}',"",{version:3,sources:["webpack://./lib/style/style.scss"],names:[],mappings:"AAAA,yBAGE,6BAAA,CACA,+BAAA,CACA,8BAAA,CACA,4CAAA,CAGA,gBAAA,CACA,yBAAA,CACA,oCAAA,CAGA,6BAAA,CACA,yCAAA,CAGA,4BAAA,CAGA,qBAAA,CACA,wBAAA,CACA,8BAAA,CAGA,wBAAA,CACA,2BAAA,CACA,iCAAA,CAGA,sBAAA,CACA,yBAAA,CACA,+BAAA,CAGA,wBAAA,CACA,2BAAA,CACA,+BAAA,CAGA,6CAAA,CACA,4BAAA,CACA,gCAAA,CAEA,YAAA,CACA,qBAAA,CACA,WAAA,CACA,UAAA,CACA,cAAA,CACA,0BAAA,CAEA,wDACE,kBAAA,CACA,sBAAA,CACA,sCAAA,CAEA,uLAEE,YAAA,CACA,qBAAA,CACA,kBAAA,CACA,OAAA,CAEA,+LACE,UAAA,CACA,WAAA,CACA,mCAAA,CAGF,iMACE,gBAAA,CACA,iBAAA,CACA,mCAAA,CACA,cAAA,CAGF,iOACE,mBAAA,CACA,sBAAA,CAKN,kDACE,YAAA,CACA,kDAAA,CACA,gCAAA,CACA,aAAA,CAGF,iDACE,gBAAA,CACA,eAAA,CACA,WAAA,CACA,qCAAA,CACA,cAAA,CACA,eAAA,CACA,iCAAA,CAEA,uDACE,+BAAA,CACA,sCAAA,CACA,cAAA,CAGF,gFACE,+BAAA,CACA,4CAAA,CAGF,kFACE,gCAAA,CAIJ,mDACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,YAAA,CACA,eAAA,CAGF,0DACE,aAAA,CACA,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,6BAAA,CACA,QAAA,CACA,UAAA,CACA,YAAA,CACA,iDAAA,CAGA,wEACE,YAAA,CAGF,uFACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CACA,MAAA,CAEA,2HACE,yBAAA,CACA,aAAA,CAGF,yHACE,uBAAA,CACA,aAAA,CAGF,4HACE,0BAAA,CACA,aAAA,CAGF,8HACE,yBAAA,CACA,aAAA,CAGF,yHACE,cAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CAIJ,wFACE,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,8FACE,YAAA,CACA,kBAAA,CACA,aAAA,CAGF,uEACE,WAAA,CAGF,yFACE,mBAAA,CACA,sBAAA,CAIJ,wDACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,YAAA,CACA,eAAA,CAEA,gGACE,mBAAA,CACA,eAAA,CAIJ,gCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,OAAA,CACA,aAAA,CACA,cAAA,CAEA,+CACE,YAAA,CACA,6BAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CAGF,sDACE,iCAAA,CACA,eAAA,CAGF,+CACE,iBAAA,CACA,yCAAA,CACA,qCAAA,CACA,+BAAA,CACA,YAAA,CACA,YAAA,CACA,sBAAA,CAEA,oEACE,aAAA,CACA,YAAA,CACA,kBAAA,CAEA,wEACE,sBAAA,CAIJ,oEACE,cAAA,CACA,gBAAA,CACA,gBAAA,CAKN,iCACE,WAAA,CACA,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CAEA,iDACE,YAAA,CACA,qBAAA,CACA,KAAA,CACA,cAAA,CACA,aAAA,CACA,iBAAA,CACA,kBAAA,CAEA,yEACE,wCAAA,CACA,4CAAA,CAEA,kGACE,yBAAA,CAIJ,uEACE,sCAAA,CACA,0CAAA,CAEA,uGACE,cAAA,CACA,oBAAA,CACA,qCAAA,CACA,gBAAA,CACA,UAAA,CAGF,gGACE,uBAAA,CAIJ,yEACE,wCAAA,CACA,4CAAA,CAEA,kGACE,yBAAA,CAIJ,0EACE,yCAAA,CACA,6CAAA,CAEA,mGACE,0BAAA,CAIJ,2EACE,qCAAA,CACA,yCAAA,CAEA,kGACE,UAAA,CACA,YAAA,CAIJ,wEACE,YAAA,CACA,kBAAA,CACA,6BAAA,CACA,OAAA,CACA,gBAAA,CAGF,sEACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CACA,WAAA,CAGF,yEACE,gBAAA,CACA,aAAA,CACA,iBAAA,CAGF,sEACE,YAAA,CACA,aAAA,CAGF,sEACE,eAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CAGF,wEACE,iCAAA,CACA,kBAAA,CACA,aAAA,CACA,gBAAA,CAGF,yEACE,YAAA,CACA,qBAAA,CACA,OAAA,CACA,uBAAA,CAEA,oFACE,cAAA,CACA,YAAA,CACA,kBAAA,CAGF,wLACE,gCAAA,CACA,oBAAA,CAIJ,yEACE,uBAAA,CAEA,yGACE,QAAA,CACA,iCAAA,CAIJ,iJACE,YAAA,CACA,qBAAA,CACA,OAAA,CACA,sBAAA,CAGF,iKACE,eAAA,CACA,+BAAA,CACA,gCAAA,CACA,yBAAA,CAGF,gGACE,qCAAA,CACA,gBAAA,CAGF,6EACE,YAAA,CACA,cAAA,CACA,gBAAA,CAGF,+EACE,iCAAA,CACA,kBAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,+EACE,+BAAA,CACA,qCAAA,CACA,SAAA,CACA,oBAAA,CACA,qBAAA,CAGF,8BACE,6EACE,cAAA,CAGF,+EACE,UAAA,CAGF,+EACE,UAAA,CACA,gBAAA,CACA,kBAAA,CACA,qBAAA,CAAA,CAKN,sDACE,YAAA,CACA,qBAAA,CACA,kBAAA,CACA,sBAAA,CACA,QAAA,CACA,iBAAA,CACA,iCAAA,CAEA,gFACE,UAAA,CACA,WAAA,CACA,iBAAA,CACA,YAAA,CACA,kBAAA,CACA,sBAAA,CACA,sCAAA,CAEA,oFACE,UAAA,CACA,WAAA,CAIJ,gFACE,iBAAA,CAIJ,+CACE,YAAA,CACA,qBAAA,CACA,kBAAA,CAEA,0DACE,oCAAA,CACA,YAAA,CACA,qBAAA,CACA,YAAA,CAGF,iEACE,SAAA,CAGF,+EACE,YAAA,CACA,WAAA,CACA,YAAA,CAIJ,sDACE,kDAAA,CAEA,iEACE,kBAAA,CAIJ,+DACE,UAAA,CACA,kBAAA,CACA,iBAAA,CACA,mBAAA,CAGF,6DACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,UAAA,CACA,gBAAA,CACA,0BAAA,CACA,WAAA,CACA,qCAAA,CACA,cAAA,CACA,kBAAA,CACA,iCAAA,CACA,eAAA,CACA,KAAA,CACA,SAAA,CAEA,mEACE,gCAAA,CACA,8CAAA,CAGF,mEACE,+BAAA,CAGF,iEACE,aAAA,CACA,iBAAA,CAIJ,8DACE,gBAAA,CAGF,4DACE,gBAAA,CAGF,8DACE,kBAAA,CAGF,wDACE,iCAAA,CACA,cAAA,CACA,aAAA,CAGF,gDACE,YAAA,CACA,qBAAA,CACA,QAAA,CACA,YAAA,CACA,kBAAA,CACA,mCAAA,CACA,qBAAA,CACA,sCAAA,CAEA,sEACE,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,gBAAA,CAEA,0EACE,uBAAA,CAGF,6FACE,gBAAA,CAKN,2DACE,WAAA,CACA,YAAA,CACA,kBAAA,CACA,iCAAA,CAGF,kEACE,gBAAA,CAGF,0FACE,qBAAA,CAGF,sCACE,cAAA,CAIJ,wCACE,cAAA,CAEA,gEACE,gBAAA,CAGF,oEACE,YAAA,CACA,cAAA,CACA,gBAAA,CAGF,sEACE,iCAAA,CACA,kBAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,sEACE,+BAAA,CACA,qCAAA,CACA,SAAA,CACA,eAAA,CACA,sBAAA,CAGF,8BACE,oEACE,cAAA,CAGF,sEACE,UAAA,CAGF,sEACE,UAAA,CACA,gBAAA,CACA,kBAAA,CACA,qBAAA,CAAA,CAIJ,8DACE,iCAAA,CAGF,qEACE,gBAAA,CAGF,gEACE,eAAA,CACA,QAAA,CACA,iBAAA,CACA,YAAA,CACA,qBAAA,CACA,iBAAA,CAGF,sEACE,YAAA,CACA,qBAAA,CACA,iBAAA,CACA,kBAAA,CACA,eAAA,CAGA,8EACE,UAAA,CACA,iBAAA,CACA,MAAA,CACA,OAAA,CACA,SAAA,CACA,UAAA,CACA,iBAAA,CACA,0CAAA,CACA,SAAA,CAIF,6EACE,UAAA,CACA,iBAAA,CACA,QAAA,CACA,QAAA,CACA,WAAA,CACA,SAAA,CACA,0CAAA,CAGF,wFACE,YAAA,CAGF,mHAEE,8BAAA,CACA,2CAAA,CAIJ,sEACE,eAAA,CACA,iBAAA,CAEA,4EACE,sCAAA,CAIJ,8DACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iCAAA,CACA,cAAA,CACA,gBAAA,CAIA,gFACE,+BAAA,CAIJ,+DACE,YAAA,CACA,kBAAA,CACA,gBAAA,CAEA,mEACE,+BAAA,CAIJ,+DACE,YAAA,CACA,qBAAA,CACA,WAAA,CACA,MAAA,CAGF,8DACE,kBAAA,CACA,eAAA,CACA,sBAAA,CAGF,kEACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,WAAA,CAGF,iEACE,cAAA,CACA,gCAAA,CACA,kBAAA,CACA,aAAA,CAGF,wEACE,iCAAA,CACA,kBAAA,CACA,eAAA,CACA,sBAAA,CACA,iBAAA,CACA,sCAAA,CACA,eAAA,CACA,cAAA,CACA,qBAAA,CACA,cAAA,CAGF,4DACE,eAAA,CACA,YAAA,CACA,yCAAA,CACA,qCAAA,CACA,iBAAA,CAEA,uFACE,YAAA,CACA,kBAAA,CACA,OAAA,CACA,iBAAA,CAEA,2FACE,6BAAA,CACA,aAAA,CAIJ,sFACE,eAAA,CACA,cAAA,CACA,+BAAA,CAGF,4FACE,cAAA,CACA,cAAA,CACA,iCAAA,CACA,gBAAA,CAGF,qFACE,cAAA,CAKN,wDACE,mBAAA,CACA,kBAAA,CACA,iBAAA,CAGF,uCACE,iBAAA,CACA,YAAA,CACA,qBAAA,CAGE,oFACE,+BAAA,CACA,sCAAA,CAGF,sEACE,sCAAA,CAIJ,gEACE,2CAAA,CACA,iBAAA,CACA,sCAAA,CAEA,6EACE,2BAAA,CAGF,4EACE,WAAA,CAGF,4EACE,YAAA,CAGF,4EACE,cAAA,CAGF,sEACE,WAAA,CACA,qCAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CAEA,0EACE,cAAA,CAKN,2DACE,wBAAA,CACA,cAAA,CACA,cAAA,CAGF,mIAEE,iBAAA,CACA,OAAA,CACA,SAAA,CACA,UAAA,CACA,eAAA,CACA,gBAAA,CACA,qBAAA,CACA,oBAAA,CACA,gBAAA,CACA,YAAA,CACA,sBAAA,CACA,kBAAA,CAEA,2IACE,gCAAA,CAKN,sCACE,yBAAA,CACA,4BAAA,CACA,yBAAA,CAKJ,sBACE,mCAAA,CACA,0BAAA,CACA,yCAAA,CACA,6CAAA,CACA,2CAAA,CACA,+CAAA,CAEA,cAAA,CACA,YAAA,CACA,eAAA,CACA,cAAA,CACA,sCAAA,CACA,+BAAA,CAEA,qDACE,wCAAA,CACA,+BAAA,CACA,YAAA,CACA,iBAAA,CACA,cAAA,CACA,eAAA,CACA,oBAAA,CACA,gBAAA,CAEA,8FACE,cAAA,CACA,gBAAA,CACA,QAAA,CAGF,uDACE,0CAAA,CACA,oCAAA,CAGF,mHACE,oCAAA,CACA,qCAAA,CACA,cAAA,CACA,gBAAA,CACA,aAAA,CACA,6CAAA,CACA,iDAAA,CACA,iBAAA,CAGF,8DACE,WAAA,CAGF,mEACE,YAAA,CAGF,kEACE,eAAA,CAIJ,mDACE,iBAAA,CACA,OAAA,CACA,QAAA,CAIF,oEAEE,eAAA,CAEA,8HACE,OAAA,CACA,SAAA,CACA,mCAAA,CACA,oCAAA,CACA,+CAAA,CAKF,8DACE,SAAA,CACA,UAAA,CAKJ,8DAEE,kBAAA,CAEA,wHACE,UAAA,CACA,SAAA,CACA,mCAAA,CACA,oCAAA,CACA,4CAAA,CAKF,2DACE,SAAA,CACA,UAAA",sourcesContent:[".task-testing__container {\n\n // Text\n --color-text-primary: #161616;\n --color-text-secondary: #525252;\n --color-text-disabled: #8d8d8d;\n --color-text-placeholder: hsl(225, 10%, 35%);\n\n // Backgrounds\n --color-bg: #fff;\n --color-bg-light: #f4f4f4;\n --color-bg-muted: hsl(225, 10%, 95%);\n\n // Borders\n --color-border-light: #e0e0e0;\n --color-border-strong: hsl(225, 10%, 75%);\n\n // Interactive\n --color-interactive: #0f62fe;\n\n // Info\n --color-info: #0043ce;\n --color-info-bg: #edf5ff;\n --color-info-border: #0043ce4d;\n\n // Success\n --color-success: #24a148;\n --color-success-bg: #defbe6;\n --color-success-border: #24a1484d;\n\n // Error\n --color-error: #da1e28;\n --color-error-bg: #fff1f1;\n --color-error-border: #da1e284d;\n\n // Warning\n --color-warning: #f1c21b;\n --color-warning-bg: #fdf6dd;\n --color-warning-border: #e0a520;\n\n // Canceled\n --color-canceled: var(--color-text-secondary);\n --color-canceled-bg: #f4f4f4;\n --color-canceled-border: #e0e0e0;\n\n display: flex;\n flex-direction: column;\n height: 100%;\n width: 100%;\n font-size: 14px;\n container-type: inline-size;\n\n &.task-testing__container--empty {\n align-items: center;\n justify-content: center;\n background-color: var(--color-bg-muted);\n\n .task-testing__container-no-config,\n .task-testing__container-no-element {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 8px;\n\n > svg {\n width: 32px;\n height: 32px;\n color: var(--color-text-placeholder);\n }\n\n > span {\n margin: 12px 48px;\n text-align: center;\n color: var(--color-text-placeholder);\n font-size: 14px;\n }\n\n .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n }\n\n .task-testing-tabs__list {\n display: flex;\n border-bottom: 1px solid var(--color-border-strong);\n background: var(--color-bg-muted);\n flex-shrink: 0;\n }\n\n .task-testing-tabs__tab {\n padding: 6px 12px;\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n font-size: 14px;\n font-weight: 600;\n color: var(--color-text-secondary);\n\n &:hover {\n color: var(--color-text-primary);\n background-color: var(--color-bg-light);\n cursor: pointer;\n }\n\n &.task-testing-tabs__tab--active {\n color: var(--color-text-primary);\n border-bottom-color: var(--color-interactive);\n }\n\n &.task-testing-tabs__tab--disabled {\n color: var(--color-text-disabled);\n }\n }\n\n .task-testing-tabs__panel {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n overflow-y: auto;\n }\n\n .task-testing__container--header {\n flex-shrink: 0;\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n width: 100%;\n padding: 12px;\n border-bottom: 1px solid var(--color-border-light);\n\n /** Prevent IBM Carbon tooltips for `hasIconOnly` buttons */\n .cds--popover {\n display: none;\n }\n\n .task-testing__header-status {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n flex: 1;\n\n .task-testing__status-icon--success {\n fill: var(--color-success);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--error {\n fill: var(--color-error);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--canceled {\n fill: var(--color-canceled);\n flex-shrink: 0;\n }\n\n .task-testing__status-icon--terminated {\n fill: var(--color-warning);\n flex-shrink: 0;\n }\n\n .task-testing__header-status-text {\n font-size: 14px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n }\n\n .task-testing__header-actions {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .task-testing__header-actions-right {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n }\n\n .btn-execute {\n width: 140px;\n }\n\n .cds--btn .cds--inline-loading {\n inline-size: initial;\n min-block-size: initial;\n }\n }\n\n .task-testing__container--body {\n display: flex;\n flex-direction: column;\n flex-grow: 1;\n min-height: 0;\n overflow: hidden;\n\n &.task-testing__container--body-executing {\n padding-bottom: 12px;\n overflow-y: auto;\n }\n }\n\n .input {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 12px 0;\n padding: 0 12px;\n\n .input__header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 6px;\n width: 100%;\n }\n\n .input__header--title {\n color: var(--color-text-secondary);\n font-weight: 600;\n }\n\n .input__footer {\n border-radius: 4px;\n border: 1px solid var(--color-info-border);\n background-color: var(--color-info-bg);\n color: var(--color-text-primary);\n padding: 12px;\n display: flex;\n align-items: flex-start;\n\n .input__footer--icon {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n\n svg {\n fill: var(--color-info);\n }\n }\n\n .input__footer--text {\n font-size: 14px;\n line-height: 18px;\n margin-left: 12px;\n }\n }\n }\n\n .output {\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n gap: 12px;\n min-height: 0;\n\n .output__banner {\n display: flex;\n flex-direction: column;\n gap: 0;\n font-size: 14px;\n flex-shrink: 0;\n border-radius: 4px;\n margin: 12px 12px 0;\n\n &.output__banner--success {\n background-color: var(--color-success-bg);\n border: 1px solid var(--color-success-border);\n\n .output__banner-icon svg {\n fill: var(--color-success);\n }\n }\n\n &.output__banner--error {\n background-color: var(--color-error-bg);\n border: 1px solid var(--color-error-border);\n\n .output__banner-details-content {\n margin-top: 6px;\n white-space: pre-wrap;\n font-family: 'IBM Plex Mono', monospace;\n line-height: 18px;\n width: 100%;\n }\n\n .output__banner-icon svg {\n fill: var(--color-error);\n }\n }\n\n &.output__banner--warning {\n background-color: var(--color-warning-bg);\n border: 1px solid var(--color-warning-border);\n\n .output__banner-icon svg {\n fill: var(--color-warning);\n }\n }\n\n &.output__banner--canceled {\n background-color: var(--color-canceled-bg);\n border: 1px solid var(--color-canceled-border);\n\n .output__banner-icon svg {\n fill: var(--color-canceled);\n }\n }\n\n &.output__banner--executing {\n background-color: var(--color-info-bg);\n border: 1px solid var(--color-info-border);\n\n .output__banner-loader {\n width: auto;\n min-height: 0;\n }\n }\n\n .output__banner-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 8px 12px;\n }\n\n .output__banner-main {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n flex-grow: 1;\n }\n\n .output__banner-chevron {\n margin-left: auto;\n flex-shrink: 0;\n fill: currentColor;\n }\n\n .output__banner-icon {\n display: flex;\n flex-shrink: 0;\n }\n\n .output__banner-text {\n font-weight: 600;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .output__banner-timing {\n color: var(--color-text-secondary);\n white-space: nowrap;\n flex-shrink: 0;\n margin-left: auto;\n }\n\n .output__banner-actions {\n display: flex;\n flex-direction: column;\n gap: 4px;\n padding: 0 12px 8px 34px;\n\n .cds--link {\n font-size: 14px;\n display: flex;\n align-items: center;\n }\n\n .link--disabled, .link--disabled:hover {\n color: var(--color-text-disabled);\n text-decoration: none;\n }\n }\n\n .output__banner-details {\n padding: 0 12px 8px 34px;\n\n .output__banner-details-content {\n margin: 0;\n color: var(--color-text-secondary);\n }\n }\n\n .output__banner-incident, .output__banner-error {\n display: flex;\n flex-direction: column;\n gap: 6px;\n align-items: flex-start;\n }\n\n .output__banner-incident-heading, .output__banner-error-heading {\n font-weight: 600;\n color: var(--color-text-primary);\n text-decoration: underline dotted;\n text-underline-offset: 2px;\n }\n\n .output__banner--error .output__banner-details {\n font-family: 'IBM Plex Mono', monospace;\n line-height: 18px;\n }\n\n .output__banner-details-row {\n display: flex;\n column-gap: 8px;\n line-height: 18px;\n }\n\n .output__banner-details-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n width: 30%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .output__banner-details-value {\n color: var(--color-text-primary);\n font-family: 'IBM Plex Mono', monospace;\n width: 70%;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n @container (max-width: 380px) {\n .output__banner-details-row {\n flex-wrap: wrap;\n }\n\n .output__banner-details-label {\n width: auto;\n }\n\n .output__banner-details-value {\n width: auto;\n overflow: visible;\n white-space: normal;\n word-break: break-word;\n }\n }\n }\n\n .output__empty-state {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n gap: 12px;\n padding: 48px 24px;\n color: var(--color-text-secondary);\n\n .output__empty-state-icon {\n width: 42px;\n height: 42px;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: var(--color-bg-light);\n\n svg {\n width: 24px;\n height: 24px;\n }\n }\n\n .output__empty-state-text {\n text-align: center;\n }\n }\n\n .output__body {\n display: flex;\n flex-direction: column;\n padding-bottom: 8px;\n\n .cds--tabs {\n --cds-layout-size-height-local: 32px;\n display: flex;\n flex-direction: column;\n min-height: 0;\n }\n \n .cds--tab-content {\n padding: 0;\n }\n\n .cds--tab-content:not([hidden]) {\n display: flex;\n flex-grow: 1;\n min-height: 0;\n }\n }\n\n .output__collapsible {\n border-bottom: 1px solid var(--color-border-strong);\n\n &:last-child {\n border-bottom: none;\n }\n }\n\n .output__collapsible-sentinel {\n height: 1px;\n margin-bottom: -1px;\n visibility: hidden;\n pointer-events: none;\n }\n\n .output__collapsible-header {\n display: flex;\n align-items: center;\n gap: 4px;\n width: 100%;\n padding: 6px 12px;\n background: var(--color-bg);\n border: none;\n border-bottom: 1px solid transparent;\n font-size: 14px;\n font-weight: normal;\n color: var(--color-text-secondary);\n position: sticky;\n top: 0;\n z-index: 2;\n\n &.stuck {\n background: var(--color-bg-muted);\n border-bottom-color: var(--color-border-strong);\n }\n\n &:hover {\n color: var(--color-text-primary);\n }\n\n svg {\n flex-shrink: 0;\n fill: currentColor;\n }\n }\n\n .output__collapsible-chevron {\n margin-left: auto;\n }\n\n .output__collapsible-title {\n user-select: none;\n }\n\n .output__collapsible-content {\n padding: 0 12px 8px;\n }\n\n .output__section-empty {\n color: var(--color-text-secondary);\n font-size: 14px;\n padding: 4px 0;\n }\n\n .output__error {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 12px;\n margin-bottom: 12px;\n border: 1px solid var(--color-error);\n border-left-width: 3px;\n background-color: var(--color-error-bg);\n\n .output__error--title {\n display: flex;\n flex-direction: row;\n align-items: center;\n font-weight: bold;\n\n svg {\n fill: var(--color-error);\n }\n\n .output__error--action {\n margin-left: auto;\n }\n }\n }\n\n .output__variables--empty {\n height: 32px;\n display: flex;\n align-items: center;\n color: var(--color-text-secondary);\n }\n\n .output__variables--empty-action {\n font-weight: bold;\n }\n\n .output__variables--skeleton .cds--skeleton__placeholder {\n width: 100% !important;\n }\n\n code {\n font-size: 14px;\n }\n }\n\n .execution-log {\n font-size: 14px;\n\n .execution-log__details {\n margin: 4px 0 0 0;\n }\n\n .execution-log__details-row {\n display: flex;\n column-gap: 8px;\n line-height: 18px;\n }\n\n .execution-log__details-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n width: 30%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .execution-log__details-value {\n color: var(--color-text-primary);\n font-family: 'IBM Plex Mono', monospace;\n width: 70%;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n @container (max-width: 380px) {\n .execution-log__details-row {\n flex-wrap: wrap;\n }\n\n .execution-log__details-label {\n width: auto;\n }\n\n .execution-log__details-value {\n width: auto;\n overflow: visible;\n white-space: normal;\n word-break: break-word;\n }\n }\n\n .execution-log__empty {\n color: var(--color-text-secondary);\n }\n\n .execution-log__empty-action {\n font-weight: bold;\n }\n\n .execution-log__entries {\n list-style: none;\n margin: 0;\n padding: 0 0 0 2px;\n display: flex;\n flex-direction: column;\n position: relative;\n }\n\n .execution-log__entry-wrapper {\n display: flex;\n flex-direction: column;\n position: relative;\n padding: 0 0 0 20px;\n margin-bottom: 0;\n\n // timeline dot\n &::before {\n content: '';\n position: absolute;\n left: 0;\n top: 9px;\n width: 7px;\n height: 7px;\n border-radius: 50%;\n background-color: var(--color-border-light);\n z-index: 1;\n }\n\n // timeline line\n &::after {\n content: '';\n position: absolute;\n left: 3px;\n top: 20px;\n bottom: -4px;\n width: 1px;\n background-color: var(--color-border-light);\n }\n\n &:last-child::after {\n display: none;\n }\n\n &.execution-log__entry-wrapper--active::before {\n // make it unfilled with a border to indicate active entry\n background-color: transparent;\n border: 1px solid var(--color-border-strong);\n }\n }\n\n .execution-log__entry-content {\n padding: 4px 8px;\n border-radius: 4px;\n\n &:hover {\n background-color: var(--color-bg-light);\n }\n }\n\n .execution-log__entry {\n display: flex;\n align-items: center;\n gap: 8px;\n color: var(--color-text-secondary);\n font-size: 14px;\n line-height: 18px;\n }\n\n .execution-log__entry--expandable {\n &:hover {\n color: var(--color-text-primary);\n }\n }\n\n .execution-log__toggle {\n display: flex;\n align-items: center;\n margin-left: auto;\n\n svg {\n fill: var(--color-text-disabled);\n }\n }\n\n .execution-log__labels {\n display: flex;\n flex-direction: column;\n min-width: 0;\n flex: 1;\n }\n\n .execution-log__label {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .execution-log__label-row {\n display: flex;\n align-items: center;\n gap: 8px;\n min-width: 0;\n }\n\n .execution-log__duration {\n font-size: 11px;\n color: var(--color-text-disabled);\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .execution-log__secondary-label {\n color: var(--color-text-secondary);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n border-radius: 4px;\n background-color: var(--color-bg-light);\n padding: 2px 4px;\n font-size: 12px;\n align-self: flex-start;\n margin-top: 2px;\n }\n\n .execution-log__cta {\n margin-top: 12px;\n padding: 12px;\n border: 1px solid var(--color-info-border);\n background-color: var(--color-info-bg);\n border-radius: 4px;\n\n .execution-log__cta-header {\n display: flex;\n align-items: center;\n gap: 6px;\n margin-bottom: 6px;\n\n svg {\n fill: var(--color-info-border);\n flex-shrink: 0;\n }\n }\n\n .execution-log__cta-title {\n font-weight: 600;\n font-size: 14px;\n color: var(--color-text-primary);\n }\n\n .execution-log__cta-description {\n margin: 0 0 8px;\n font-size: 14px;\n color: var(--color-text-secondary);\n line-height: 18px;\n }\n\n .execution-log__cta-link {\n font-size: 14px;\n }\n }\n }\n\n .task-testing-tooltip__wrapper {\n display: inline-flex;\n align-items: center;\n width: fit-content;\n }\n\n .code__editor {\n position: relative;\n display: flex;\n flex-direction: column;\n\n &.code__editor--error {\n .code__editor-codemirror {\n border-color: var(--color-error);\n background-color: var(--color-error-bg);\n }\n\n .cm-gutter {\n background-color: var(--color-error-bg);\n }\n }\n\n .code__editor-codemirror {\n border: 1px solid var(--color-border-strong);\n border-radius: 2px;\n background-color: var(--color-bg-light);\n\n .cm-scroller {\n overflow: visible !important;\n }\n\n .cm-content {\n padding: 6px;\n }\n\n .cm-focused {\n outline: none;\n }\n\n .cm-tooltip {\n font-size: 14px;\n }\n\n .info {\n padding: 6px;\n font-family: 'IBM Plex Mono', monospace;\n font-size: 12px;\n max-width: 300px;\n word-wrap: break-word;\n\n pre {\n margin-top: 8px;\n }\n }\n }\n\n .code__editor-error {\n color: var(--color-error);\n font-size: 14px;\n margin-top: 5px;\n }\n\n .code__editor-copy-button,\n .code__editor-clear-button {\n position: absolute;\n top: 5px;\n right: 5px;\n z-index: 10;\n block-size: 24px;\n inline-size: 24px;\n padding-block-start: 0;\n padding-inline-end: 0;\n min-block-size: 0;\n display: flex;\n justify-content: center;\n align-items: center;\n\n svg {\n fill: var(--color-text-secondary);\n }\n }\n }\n\n .has-tooltip {\n text-decoration: underline;\n text-decoration-style: dotted;\n text-underline-offset: 2px;\n }\n}\n\n// Tooltip (portaled to document.body)\n.task-testing-tooltip {\n --tooltip-color-bg: hsl(0, 0%, 22%);\n --tooltip-color-text: #fff;\n --tooltip-color-link: hsl(218, 100%, 74%);\n --tooltip-color-code-text: hsl(225, 10%, 35%);\n --tooltip-color-code-bg: hsl(225, 10%, 97%);\n --tooltip-color-code-border: hsl(225, 10%, 85%);\n\n position: fixed;\n z-index: 1000;\n max-width: 300px;\n font-size: 13px;\n font-family: 'IBM Plex Sans', sans-serif;\n color: var(--tooltip-color-text);\n\n .task-testing-tooltip__content {\n background-color: var(--tooltip-color-bg);\n color: var(--tooltip-color-text);\n padding: 16px;\n border-radius: 2px;\n font-size: 14px;\n font-weight: 400;\n white-space: pre-wrap;\n line-height: 21px;\n\n .bio-properties-panel-tooltip-content h1 {\n font-size: 14px;\n font-weight: bold;\n margin: 0;\n }\n\n a {\n color: var(--tooltip-color-link) !important;\n text-decoration: underline !important;\n }\n\n code, pre {\n color: var(--tooltip-color-code-text);\n font-family: 'IBM Plex Mono', monospace;\n font-size: 13px;\n line-height: 17px;\n padding: 0 2px;\n background-color: var(--tooltip-color-code-bg);\n border: 1px solid var(--tooltip-color-code-border);\n border-radius: 2px;\n }\n\n pre code {\n border: none;\n }\n\n p:first-child {\n margin-top: 0;\n }\n\n p:last-child {\n margin-bottom: 0;\n }\n }\n\n .task-testing-tooltip__arrow {\n position: absolute;\n width: 0;\n height: 0;\n }\n\n // bottom-start / bottom-end\n &.bottom-start,\n &.bottom-end {\n padding-top: 6px;\n\n .task-testing-tooltip__arrow {\n top: 1px;\n left: 12px;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-bottom: 5px solid var(--tooltip-color-bg);\n }\n }\n\n &.bottom-end {\n .task-testing-tooltip__arrow {\n left: auto;\n right: 12px;\n }\n }\n\n // top-start / top-end\n &.top-start,\n &.top-end {\n padding-bottom: 6px;\n\n .task-testing-tooltip__arrow {\n bottom: 1px;\n left: 12px;\n border-left: 5px solid transparent;\n border-right: 5px solid transparent;\n border-top: 5px solid var(--tooltip-color-bg);\n }\n }\n\n &.top-end {\n .task-testing-tooltip__arrow {\n left: auto;\n right: 12px;\n }\n }\n}"],sourceRoot:""}]);const l=o},314(e){e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",i=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),i&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),i&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,i,r,s){"string"==typeof e&&(e=[[null,e,void 0]]);var o={};if(i)for(var l=0;l<this.length;l++){var a=this[l][0];null!=a&&(o[a]=!0)}for(var c=0;c<e.length;c++){var h=[].concat(e[c]);i&&o[h[0]]||(void 0!==s&&(void 0===h[5]||(h[1]="@layer".concat(h[5].length>0?" ".concat(h[5]):""," {").concat(h[1],"}")),h[5]=s),n&&(h[2]?(h[1]="@media ".concat(h[2]," {").concat(h[1],"}"),h[2]=n):h[2]=n),r&&(h[4]?(h[1]="@supports (".concat(h[4],") {").concat(h[1],"}"),h[4]=r):h[4]="".concat(r)),t.push(h))}},t}},354(e){e.exports=function(e){var t=e[1],n=e[3];if(!n)return t;if("function"==typeof btoa){var i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),s="/*# ".concat(r," */");return[t].concat([s]).join("\n")}return[t].join("\n")}},7(e){var t,n="object"==typeof Reflect?Reflect:null,i=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var r=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(n,i){function r(n){e.removeListener(t,s),i(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",r),n([].slice.call(arguments))}g(e,t,s,{once:!0}),"error"!==t&&function(e,t){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,r)})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function a(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function c(e,t,n,i){var r,s,o,c;if(l(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[n,o]:[o,n]:i?o.unshift(n):o.push(n),(r=a(e))>0&&o.length>r&&!o.warned){o.warned=!0;var h=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");h.name="MaxListenersExceededWarning",h.emitter=e,h.type=t,h.count=o.length,c=h,console&&console.warn&&console.warn(c)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(e,t,n){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function d(e,t,n){var i=e._events;if(void 0===i)return[];var r=i[t];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(r):p(r,r.length)}function f(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function p(e,t){for(var n=new Array(t),i=0;i<t;++i)n[i]=e[i];return n}function g(e,t,n,i){if("function"==typeof e.on)i.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,function r(s){i.once&&e.removeEventListener(t,r),n(s)})}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||r(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return a(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,s=this._events;if(void 0!==s)r=r&&void 0===s.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var l=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw l.context=o,l}var a=s[e];if(void 0===a)return!1;if("function"==typeof a)i(a,this,t);else{var c=a.length,h=p(a,c);for(n=0;n<c;++n)i(h[n],this,t)}return!0},s.prototype.addListener=function(e,t){return c(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return c(this,e,t,!0)},s.prototype.once=function(e,t){return l(t),this.on(e,u(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,u(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,i,r,s,o;if(l(t),void 0===(i=this._events))return this;if(void 0===(n=i[e]))return this;if(n===t||n.listener===t)0===--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(r=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,r=s;break}if(r<0)return this;0===r?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,r),1===n.length&&(i[e]=n[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,i;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0===--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var r,s=Object.keys(n);for(i=0;i<s.length;++i)"removeListener"!==(r=s[i])&&this.removeAllListeners(r);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):f.call(e,t)},s.prototype.listenerCount=f,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},633(e,t,n){var i=n(649);function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=Object.prototype.hasOwnProperty,o=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,l={},a={};function c(e){return!!s.call(a,e)||!s.call(l,e)&&(o.test(e)?a[e]=!0:(l[e]=!0,!1))}function h(e,t,n,i,r,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var u={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){u[e]=new h(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];u[t]=new h(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){u[e]=new h(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){u[e]=new h(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){u[e]=new h(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){u[e]=new h(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){u[e]=new h(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){u[e]=new h(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){u[e]=new h(e,5,!1,e.toLowerCase(),null,!1,!1)});var d=/[\-:]([a-z])/g;function f(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(d,f);u[t]=new h(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){u[e]=new h(e,1,!1,e.toLowerCase(),null,!1,!1)}),u.xlinkHref=new h("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){u[e]=new h(e,1,!1,e.toLowerCase(),null,!0,!0)});var p={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},g=["Webkit","ms","Moz","O"];Object.keys(p).forEach(function(e){g.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),p[t]=p[e]})});var m=/["'&<>]/;function A(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=m.exec(e);if(t){var n,i="",r=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}r!==n&&(i+=e.substring(r,n)),r=n+1,i+=t}e=r!==n?i+e.substring(r,n):i}return e}var v=/([A-Z])/g,b=/^ms-/,x=Array.isArray;function y(e,t){return{insertionMode:e,selectedValue:t}}var w=new Map;function C(e,t,n){if("object"!=typeof n)throw Error(r(62));for(var i in t=!0,n)if(s.call(n,i)){var o=n[i];if(null!=o&&"boolean"!=typeof o&&""!==o){if(0===i.indexOf("--")){var l=A(i);o=A((""+o).trim())}else{l=i;var a=w.get(l);void 0!==a||(a=A(l.replace(v,"-$1").toLowerCase().replace(b,"-ms-")),w.set(l,a)),l=a,o="number"==typeof o?0===o||s.call(p,i)?""+o:o+"px":A((""+o).trim())}t?(t=!1,e.push(' style="',l,":",o)):e.push(";",l,":",o)}}t||e.push('"')}function k(e,t,n,i){switch(n){case"style":return void C(e,t,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(t=u.hasOwnProperty(n)?u[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!t.acceptsBooleans)return}switch(n=t.attributeName,t.type){case 3:i&&e.push(" ",n,'=""');break;case 4:!0===i?e.push(" ",n,'=""'):!1!==i&&e.push(" ",n,'="',A(i),'"');break;case 5:isNaN(i)||e.push(" ",n,'="',A(i),'"');break;case 6:!isNaN(i)&&1<=i&&e.push(" ",n,'="',A(i),'"');break;default:t.sanitizeURL&&(i=""+i),e.push(" ",n,'="',A(i),'"')}}else if(c(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(t=n.toLowerCase().slice(0,5))&&"aria-"!==t)return}e.push(" ",n,'="',A(i),'"')}}function _(e,t,n){if(null!=t){if(null!=n)throw Error(r(60));if("object"!=typeof t||!("__html"in t))throw Error(r(61));null!=(t=t.__html)&&e.push(""+t)}}function S(e,t,n,i){e.push(O(n));var r,o=n=null;for(r in t)if(s.call(t,r)){var l=t[r];if(null!=l)switch(r){case"children":n=l;break;case"dangerouslySetInnerHTML":o=l;break;default:k(e,i,r,l)}}return e.push(">"),_(e,o,n),"string"==typeof n?(e.push(A(n)),null):n}var E=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,T=new Map;function O(e){var t=T.get(e);if(void 0===t){if(!E.test(e))throw Error(r(65,e));t="<"+e,T.set(e,t)}return t}function M(e,t,n){if(e.push('\x3c!--$?--\x3e<template id="'),null===n)throw Error(r(395));return e.push(n),e.push('"></template>')}var B=/[<\u2028\u2029]/g;function D(e){return JSON.stringify(e).replace(B,function(e){switch(e){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}function R(e,t,n,i){return n.generateStaticMarkup?(e.push(A(t)),!1):(""===t?e=i:(i&&e.push("\x3c!-- --\x3e"),e.push(A(t)),e=!0),e)}var I=Object.assign,P=Symbol.for("react.element"),N=Symbol.for("react.portal"),L=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),V=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),K=Symbol.for("react.scope"),G=Symbol.for("react.debug_trace_mode"),Y=Symbol.for("react.legacy_hidden"),J=Symbol.for("react.default_value"),Q=Symbol.iterator;function X(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case L:return"Fragment";case N:return"Portal";case j:return"Profiler";case F:return"StrictMode";case H:return"Suspense";case q:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case V:return(e.displayName||"Context")+".Consumer";case z:return(e._context.displayName||"Context")+".Provider";case W:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case $:return null!==(t=e.displayName||null)?t:X(e.type)||"Memo";case U:t=e._payload,e=e._init;try{return X(e(t))}catch(e){}}return null}var Z={};function ee(e,t){if(!(e=e.contextTypes))return Z;var n,i={};for(n in e)i[n]=t[n];return i}var te=null;function ne(e,t){if(e!==t){e.context._currentValue2=e.parentValue,e=e.parent;var n=t.parent;if(null===e){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));ne(e,n)}t.context._currentValue2=t.value}}function ie(e){e.context._currentValue2=e.parentValue,null!==(e=e.parent)&&ie(e)}function re(e){var t=e.parent;null!==t&&re(t),e.context._currentValue2=e.value}function se(e,t){if(e.context._currentValue2=e.parentValue,null===(e=e.parent))throw Error(r(402));e.depth===t.depth?ne(e,t):se(e,t)}function oe(e,t){var n=t.parent;if(null===n)throw Error(r(402));e.depth===n.depth?ne(e,n):oe(e,n),t.context._currentValue2=t.value}function le(e){var t=te;t!==e&&(null===t?re(e):null===e?ie(t):t.depth===e.depth?ne(t,e):t.depth>e.depth?se(t,e):oe(t,e),te=e)}var ae={isMounted:function(){return!1},enqueueSetState:function(e,t){null!==(e=e._reactInternals).queue&&e.queue.push(t)},enqueueReplaceState:function(e,t){(e=e._reactInternals).replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function ce(e,t,n,i){var r=void 0!==e.state?e.state:null;e.updater=ae,e.props=n,e.state=r;var s={queue:[],replace:!1};e._reactInternals=s;var o=t.contextType;if(e.context="object"==typeof o&&null!==o?o._currentValue2:i,"function"==typeof(o=t.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:I({},r,o),e.state=r),"function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate&&("function"==typeof e.UNSAFE_componentWillMount||"function"==typeof e.componentWillMount))if(t=e.state,"function"==typeof e.componentWillMount&&e.componentWillMount(),"function"==typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),t!==e.state&&ae.enqueueReplaceState(e,e.state,null),null!==s.queue&&0<s.queue.length)if(t=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===t.length)e.state=t[0];else{for(s=o?t[0]:e.state,r=!0,o=o?1:0;o<t.length;o++){var l=t[o];null!=(l="function"==typeof l?l.call(e,s,n,i):l)&&(r?(r=!1,s=I({},s,l)):I(s,l))}e.state=s}else s.queue=null}var he={id:1,overflow:""};function ue(e,t,n){var i=e.id;e=e.overflow;var r=32-de(i)-1;i&=~(1<<r),n+=1;var s=32-de(t)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-de(t)+r|n<<r|i,overflow:s+e}}return{id:1<<s|n<<r|i,overflow:e}}var de=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(fe(e)/pe|0)|0},fe=Math.log,pe=Math.LN2,ge="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},me=null,Ae=null,ve=null,be=null,xe=!1,ye=!1,we=0,Ce=null,ke=0;function _e(){if(null===me)throw Error(r(321));return me}function Se(){if(0<ke)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Ee(){return null===be?null===ve?(xe=!1,ve=be=Se()):(xe=!0,be=ve):null===be.next?(xe=!1,be=be.next=Se()):(xe=!0,be=be.next),be}function Te(){Ae=me=null,ye=!1,ve=null,ke=0,be=Ce=null}function Oe(e,t){return"function"==typeof t?t(e):t}function Me(e,t,n){if(me=_e(),be=Ee(),xe){var i=be.queue;if(t=i.dispatch,null!==Ce&&void 0!==(n=Ce.get(i))){Ce.delete(i),i=be.memoizedState;do{i=e(i,n.action),n=n.next}while(null!==n);return be.memoizedState=i,[i,t]}return[be.memoizedState,t]}return e=e===Oe?"function"==typeof t?t():t:void 0!==n?n(t):t,be.memoizedState=e,e=(e=be.queue={last:null,dispatch:null}).dispatch=De.bind(null,me,e),[be.memoizedState,e]}function Be(e,t){if(me=_e(),t=void 0===t?null:t,null!==(be=Ee())){var n=be.memoizedState;if(null!==n&&null!==t){var i=n[1];e:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<t.length;r++)if(!ge(t[r],i[r])){i=!1;break e}i=!0}if(i)return n[0]}}return e=e(),be.memoizedState=[e,t],e}function De(e,t,n){if(25<=ke)throw Error(r(301));if(e===me)if(ye=!0,e={action:n,next:null},null===Ce&&(Ce=new Map),void 0===(n=Ce.get(t)))Ce.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function Re(){throw Error(r(394))}function Ie(){}var Pe={readContext:function(e){return e._currentValue2},useContext:function(e){return _e(),e._currentValue2},useMemo:Be,useReducer:Me,useRef:function(e){me=_e();var t=(be=Ee()).memoizedState;return null===t?(e={current:e},be.memoizedState=e):t},useState:function(e){return Me(Oe,e)},useInsertionEffect:Ie,useLayoutEffect:function(){},useCallback:function(e,t){return Be(function(){return e},t)},useImperativeHandle:Ie,useEffect:Ie,useDebugValue:Ie,useDeferredValue:function(e){return _e(),e},useTransition:function(){return _e(),[!1,Re]},useId:function(){var e=Ae.treeContext,t=e.overflow;e=((e=e.id)&~(1<<32-de(e)-1)).toString(32)+t;var n=Ne;if(null===n)throw Error(r(404));return t=we++,e=":"+n.idPrefix+"R"+e,0<t&&(e+="H"+t.toString(32)),e+":"},useMutableSource:function(e,t){return _e(),t(e._source)},useSyncExternalStore:function(e,t,n){if(void 0===n)throw Error(r(407));return n()}},Ne=null,Le=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function Fe(e){return console.error(e),null}function je(){}function ze(e,t,n,i,r,s,o,l){e.allPendingTasks++,null===n?e.pendingRootTasks++:n.pendingTasks++;var a={node:t,ping:function(){var t=e.pingedTasks;t.push(a),1===t.length&&tt(e)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function Ve(e,t,n,i,r,s){return{status:0,id:-1,index:t,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function We(e,t){if(null!=(e=e.onError(t))&&"string"!=typeof e)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof e+'" instead');return e}function He(e,t){var n=e.onShellError;n(t),(n=e.onFatalError)(t),null!==e.destination?(e.status=2,e.destination.destroy(t)):(e.status=1,e.fatalError=t)}function qe(e,t,n,i,r){for(me={},Ae=t,we=0,e=n(i,r);ye;)ye=!1,we=0,ke+=1,be=null,e=n(i,r);return Te(),e}function $e(e,t,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=t.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,X(i)||"Unknown",a));i=I({},l,n)}t.legacyContext=i,Ge(e,t,s),t.legacyContext=l}else Ge(e,t,s)}function Ue(e,t){if(e&&e.defaultProps){for(var n in t=I({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function Ke(e,t,n,o,l){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){l=ee(n,t.legacyContext);var a=n.contextType;ce(a=new n(o,"object"==typeof a&&null!==a?a._currentValue2:l),n,o,l),$e(e,t,a,n)}else{l=qe(e,t,n,o,a=ee(n,t.legacyContext));var h=0!==we;if("object"==typeof l&&null!==l&&"function"==typeof l.render&&void 0===l.$$typeof)ce(l,n,o,a),$e(e,t,l,n);else if(h){o=t.treeContext,t.treeContext=ue(o,1,0);try{Ge(e,t,l)}finally{t.treeContext=o}}else Ge(e,t,l)}else{if("string"!=typeof n){switch(n){case Y:case G:case F:case j:case L:case q:return void Ge(e,t,o.children);case K:throw Error(r(343));case H:e:{n=t.blockedBoundary,l=t.blockedSegment,a=o.fallback,o=o.children;var u={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:h=new Set,errorDigest:null},d=Ve(0,l.chunks.length,u,l.formatContext,!1,!1);l.children.push(d),l.lastPushedText=!1;var f=Ve(0,0,null,l.formatContext,!1,!1);f.parentFlushed=!0,t.blockedBoundary=u,t.blockedSegment=f;try{if(Je(e,t,o),e.responseState.generateStaticMarkup||f.lastPushedText&&f.textEmbedded&&f.chunks.push("\x3c!-- --\x3e"),f.status=1,Ze(u,f),0===u.pendingTasks)break e}catch(t){f.status=4,u.forceClientRender=!0,u.errorDigest=We(e,t)}finally{t.blockedBoundary=n,t.blockedSegment=l}t=ze(e,a,n,d,h,t.legacyContext,t.context,t.treeContext),e.pingedTasks.push(t)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case W:if(o=qe(e,t,n.render,o,l),0!==we){n=t.treeContext,t.treeContext=ue(n,1,0);try{Ge(e,t,o)}finally{t.treeContext=n}}else Ge(e,t,o);return;case $:return void Ke(e,t,n=n.type,o=Ue(n,o),l);case z:if(l=o.children,n=n._context,o=o.value,a=n._currentValue2,n._currentValue2=o,te=o={parent:h=te,depth:null===h?0:h.depth+1,context:n,parentValue:a,value:o},t.context=o,Ge(e,t,l),null===(e=te))throw Error(r(403));return o=e.parentValue,e.context._currentValue2=o===J?e.context._defaultValue:o,e=te=e.parent,void(t.context=e);case V:return void Ge(e,t,o=(o=o.children)(n._currentValue2));case U:return void Ke(e,t,n=(l=n._init)(n._payload),o=Ue(n,o),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(a=function(e,t,n,o,l){switch(t){case"select":e.push(O("select"));var a=null,h=null;for(p in n)if(s.call(n,p)){var u=n[p];if(null!=u)switch(p){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;case"defaultValue":case"value":break;default:k(e,o,p,u)}}return e.push(">"),_(e,h,a),a;case"option":h=l.selectedValue,e.push(O("option"));var d=u=null,f=null,p=null;for(a in n)if(s.call(n,a)){var g=n[a];if(null!=g)switch(a){case"children":u=g;break;case"selected":f=g;break;case"dangerouslySetInnerHTML":p=g;break;case"value":d=g;default:k(e,o,a,g)}}if(null!=h)if(n=null!==d?""+d:function(e){var t="";return i.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(u),x(h)){for(o=0;o<h.length;o++)if(""+h[o]===n){e.push(' selected=""');break}}else""+h===n&&e.push(' selected=""');else f&&e.push(' selected=""');return e.push(">"),_(e,p,u),u;case"textarea":for(u in e.push(O("textarea")),p=h=a=null,n)if(s.call(n,u)&&null!=(d=n[u]))switch(u){case"children":p=d;break;case"value":a=d;break;case"defaultValue":h=d;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:k(e,o,u,d)}if(null===a&&null!==h&&(a=h),e.push(">"),null!=p){if(null!=a)throw Error(r(92));if(x(p)&&1<p.length)throw Error(r(93));a=""+p}return"string"==typeof a&&"\n"===a[0]&&e.push("\n"),null!==a&&e.push(A(""+a)),null;case"input":for(h in e.push(O("input")),d=p=u=a=null,n)if(s.call(n,h)&&null!=(f=n[h]))switch(h){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":d=f;break;case"defaultValue":u=f;break;case"checked":p=f;break;case"value":a=f;break;default:k(e,o,h,f)}return null!==p?k(e,o,"checked",p):null!==d&&k(e,o,"checked",d),null!==a?k(e,o,"value",a):null!==u&&k(e,o,"value",u),e.push("/>"),null;case"menuitem":for(var m in e.push(O("menuitem")),n)if(s.call(n,m)&&null!=(a=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:k(e,o,m,a)}return e.push(">"),null;case"title":for(g in e.push(O("title")),a=null,n)if(s.call(n,g)&&null!=(h=n[g]))switch(g){case"children":a=h;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:k(e,o,g,h)}return e.push(">"),a;case"listing":case"pre":for(d in e.push(O(t)),h=a=null,n)if(s.call(n,d)&&null!=(u=n[d]))switch(d){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;default:k(e,o,d,u)}if(e.push(">"),null!=h){if(null!=a)throw Error(r(60));if("object"!=typeof h||!("__html"in h))throw Error(r(61));null!=(n=h.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?e.push("\n",n):e.push(""+n))}return"string"==typeof a&&"\n"===a[0]&&e.push("\n"),a;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var v in e.push(O(t)),n)if(s.call(n,v)&&null!=(a=n[v]))switch(v){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,t));default:k(e,o,v,a)}return e.push("/>"),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return S(e,n,t,o);case"html":return 0===l.insertionMode&&e.push("<!DOCTYPE html>"),S(e,n,t,o);default:if(-1===t.indexOf("-")&&"string"!=typeof n.is)return S(e,n,t,o);for(f in e.push(O(t)),h=a=null,n)if(s.call(n,f)&&null!=(u=n[f]))switch(f){case"children":a=u;break;case"dangerouslySetInnerHTML":h=u;break;case"style":C(e,o,u);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:c(f)&&"function"!=typeof u&&"symbol"!=typeof u&&e.push(" ",f,'="',A(u),'"')}return e.push(">"),_(e,h,a),a}}((l=t.blockedSegment).chunks,n,o,e.responseState,l.formatContext),l.lastPushedText=!1,h=l.formatContext,l.formatContext=function(e,t,n){switch(t){case"select":return y(1,null!=n.value?n.value:n.defaultValue);case"svg":return y(2,null);case"math":return y(3,null);case"foreignObject":return y(1,null);case"table":return y(4,null);case"thead":case"tbody":case"tfoot":return y(5,null);case"colgroup":return y(7,null);case"tr":return y(6,null)}return 4<=e.insertionMode||0===e.insertionMode?y(1,null):e}(h,n,o),Je(e,t,a),l.formatContext=h,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:l.chunks.push("</",n,">")}l.lastPushedText=!1}}function Ge(e,t,n){if(t.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case P:return void Ke(e,t,n.type,n.props,n.ref);case N:throw Error(r(257));case U:var i=n._init;return void Ge(e,t,n=i(n._payload))}if(x(n))return void Ye(e,t,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=Q&&n[Q]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);Ye(e,t,s)}return}throw e=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(n).join(", ")+"}":e))}"string"==typeof n?(i=t.blockedSegment).lastPushedText=R(t.blockedSegment.chunks,n,e.responseState,i.lastPushedText):"number"==typeof n&&((i=t.blockedSegment).lastPushedText=R(t.blockedSegment.chunks,""+n,e.responseState,i.lastPushedText))}function Ye(e,t,n){for(var i=n.length,r=0;r<i;r++){var s=t.treeContext;t.treeContext=ue(s,i,r);try{Je(e,t,n[r])}finally{t.treeContext=s}}}function Je(e,t,n){var i=t.blockedSegment.formatContext,r=t.legacyContext,s=t.context;try{return Ge(e,t,n)}catch(a){if(Te(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,le(s),a;n=a;var o=t.blockedSegment,l=Ve(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,e=ze(e,t.node,t.blockedBoundary,l,t.abortSet,t.legacyContext,t.context,t.treeContext).ping,n.then(e,e),t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,le(s)}}function Qe(e){var t=e.blockedBoundary;(e=e.blockedSegment).status=3,et(this,t,e)}function Xe(e,t,n){var i=e.blockedBoundary;e.blockedSegment.status=3,null===i?(t.allPendingTasks--,2!==t.status&&(t.status=2,null!==t.destination&&t.destination.push(null))):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,e=void 0===n?Error(r(432)):n,i.errorDigest=t.onError(e),i.parentFlushed&&t.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(e){return Xe(e,t,n)}),i.fallbackAbortableTasks.clear(),t.allPendingTasks--,0===t.allPendingTasks&&(i=t.onAllReady)())}function Ze(e,t){if(0===t.chunks.length&&1===t.children.length&&null===t.children[0].boundary){var n=t.children[0];n.id=t.id,n.parentFlushed=!0,1===n.status&&Ze(e,n)}else e.completedSegments.push(t)}function et(e,t,n){if(null===t){if(n.parentFlushed){if(null!==e.completedRootSegment)throw Error(r(389));e.completedRootSegment=n}e.pendingRootTasks--,0===e.pendingRootTasks&&(e.onShellError=je,(t=e.onShellReady)())}else t.pendingTasks--,t.forceClientRender||(0===t.pendingTasks?(n.parentFlushed&&1===n.status&&Ze(t,n),t.parentFlushed&&e.completedBoundaries.push(t),t.fallbackAbortableTasks.forEach(Qe,e),t.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(Ze(t,n),1===t.completedSegments.length&&t.parentFlushed&&e.partialBoundaries.push(t)));e.allPendingTasks--,0===e.allPendingTasks&&(e=e.onAllReady)()}function tt(e){if(2!==e.status){var t=te,n=Le.current;Le.current=Pe;var i=Ne;Ne=e.responseState;try{var r,s=e.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=e,a=o.blockedSegment;if(0===a.status){le(o.context);try{Ge(l,o,o.node),l.responseState.generateStaticMarkup||a.lastPushedText&&a.textEmbedded&&a.chunks.push("\x3c!-- --\x3e"),o.abortSet.delete(o),a.status=1,et(l,o.blockedBoundary,a)}catch(e){if(Te(),"object"==typeof e&&null!==e&&"function"==typeof e.then){var c=o.ping;e.then(c,c)}else{o.abortSet.delete(o),a.status=4;var h=o.blockedBoundary,u=e,d=We(l,u);null===h?He(l,u):(h.pendingTasks--,h.forceClientRender||(h.forceClientRender=!0,h.errorDigest=d,h.parentFlushed&&l.clientRenderedBoundaries.push(h))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==e.destination&<(e,e.destination)}catch(t){We(e,t),He(e,t)}finally{Ne=i,Le.current=n,n===Pe&&le(t)}}}function nt(e,t,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=e.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,e=e.responseState,t.push('<template id="'),t.push(e.placeholderPrefix),e=i.toString(16),t.push(e),t.push('"></template>');case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var l=0;l<n.length;l++){for(s=n[l];o<s.index;o++)t.push(i[o]);s=it(e,t,s)}for(;o<i.length-1;o++)t.push(i[o]);return o<i.length&&(s=t.push(i[o])),s;default:throw Error(r(390))}}function it(e,t,n){var i=n.boundary;if(null===i)return nt(e,t,n);if(i.parentFlushed=!0,i.forceClientRender)return e.responseState.generateStaticMarkup||(i=i.errorDigest,t.push("\x3c!--$!--\x3e"),t.push("<template"),i&&(t.push(' data-dgst="'),i=A(i),t.push(i),t.push('"')),t.push("></template>")),nt(e,t,n),!!e.responseState.generateStaticMarkup||t.push("\x3c!--/$--\x3e");if(0<i.pendingTasks){i.rootSegmentID=e.nextSegmentId++,0<i.completedSegments.length&&e.partialBoundaries.push(i);var s=e.responseState,o=s.nextSuspenseID++;return s=s.boundaryPrefix+o.toString(16),i=i.id=s,M(t,e.responseState,i),nt(e,t,n),t.push("\x3c!--/$--\x3e")}if(i.byteSize>e.progressiveChunkSize)return i.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(i),M(t,e.responseState,i.id),nt(e,t,n),t.push("\x3c!--/$--\x3e");if(e.responseState.generateStaticMarkup||t.push("\x3c!--$--\x3e"),1!==(n=i.completedSegments).length)throw Error(r(391));return it(e,t,n[0]),!!e.responseState.generateStaticMarkup||t.push("\x3c!--/$--\x3e")}function rt(e,t,n){return function(e,t,n,i){switch(n.insertionMode){case 0:case 1:return e.push('<div hidden id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 2:return e.push('<svg aria-hidden="true" style="display:none" id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 3:return e.push('<math aria-hidden="true" style="display:none" id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 4:return e.push('<table hidden id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 5:return e.push('<table hidden><tbody id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 6:return e.push('<table hidden><tr id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');case 7:return e.push('<table hidden><colgroup id="'),e.push(t.segmentPrefix),t=i.toString(16),e.push(t),e.push('">');default:throw Error(r(397))}}(t,e.responseState,n.formatContext,n.id),it(e,t,n),function(e,t){switch(t.insertionMode){case 0:case 1:return e.push("</div>");case 2:return e.push("</svg>");case 3:return e.push("</math>");case 4:return e.push("</table>");case 5:return e.push("</tbody></table>");case 6:return e.push("</tr></table>");case 7:return e.push("</colgroup></table>");default:throw Error(r(397))}}(t,n.formatContext)}function st(e,t,n){for(var i=n.completedSegments,s=0;s<i.length;s++)ot(e,t,n,i[s]);if(i.length=0,e=e.responseState,i=n.id,n=n.rootSegmentID,t.push(e.startInlineScript),e.sentCompleteBoundaryFunction?t.push('$RC("'):(e.sentCompleteBoundaryFunction=!0,t.push('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("')),null===i)throw Error(r(395));return n=n.toString(16),t.push(i),t.push('","'),t.push(e.segmentPrefix),t.push(n),t.push('")<\/script>')}function ot(e,t,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return rt(e,t,i)}return rt(e,t,i),e=e.responseState,t.push(e.startInlineScript),e.sentCompleteSegmentFunction?t.push('$RS("'):(e.sentCompleteSegmentFunction=!0,t.push('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("')),t.push(e.segmentPrefix),s=s.toString(16),t.push(s),t.push('","'),t.push(e.placeholderPrefix),t.push(s),t.push('")<\/script>')}function lt(e,t){try{var n=e.completedRootSegment;if(null!==n&&0===e.pendingRootTasks){it(e,t,n),e.completedRootSegment=null;var i=e.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)t.push(i[n]);n<i.length&&t.push(i[n])}var s,o=e.clientRenderedBoundaries;for(s=0;s<o.length;s++){var l=o[s];i=t;var a=e.responseState,c=l.id,h=l.errorDigest,u=l.errorMessage,d=l.errorComponentStack;if(i.push(a.startInlineScript),a.sentClientRenderFunction?i.push('$RX("'):(a.sentClientRenderFunction=!0,i.push('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("')),null===c)throw Error(r(395));if(i.push(c),i.push('"'),h||u||d){i.push(",");var f=D(h||"");i.push(f)}if(u||d){i.push(",");var p=D(u||"");i.push(p)}if(d){i.push(",");var g=D(d);i.push(g)}if(!i.push(")<\/script>"))return e.destination=null,s++,void o.splice(0,s)}o.splice(0,s);var m=e.completedBoundaries;for(s=0;s<m.length;s++)if(!st(e,t,m[s]))return e.destination=null,s++,void m.splice(0,s);m.splice(0,s);var A=e.partialBoundaries;for(s=0;s<A.length;s++){var v=A[s];e:{o=e,l=t;var b=v.completedSegments;for(a=0;a<b.length;a++)if(!ot(o,l,v,b[a])){a++,b.splice(0,a);var x=!1;break e}b.splice(0,a),x=!0}if(!x)return e.destination=null,s++,void A.splice(0,s)}A.splice(0,s);var y=e.completedBoundaries;for(s=0;s<y.length;s++)if(!st(e,t,y[s]))return e.destination=null,s++,void y.splice(0,s);y.splice(0,s)}finally{0===e.allPendingTasks&&0===e.pingedTasks.length&&0===e.clientRenderedBoundaries.length&&0===e.completedBoundaries.length&&t.push(null)}}function at(e,t){try{var n=e.abortableTasks;n.forEach(function(n){return Xe(n,e,t)}),n.clear(),null!==e.destination&<(e,e.destination)}catch(t){We(e,t),He(e,t)}}function ct(){}function ht(e,t,n,i){var s=!1,o=null,l="",a={push:function(e){return null!==e&&(l+=e),!0},destroy:function(e){s=!0,o=e}},c=!1;if(e=function(e,t,n,i,r,s,o){var l=[],a=new Set;return(n=Ve(t={destination:null,responseState:t,progressiveChunkSize:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:a,pingedTasks:l,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?Fe:r,onAllReady:je,onShellReady:void 0===o?je:o,onShellError:je,onFatalError:je},0,null,n,!1,!1)).parentFlushed=!0,e=ze(t,e,null,n,a,Z,null,he),l.push(e),t}(e,function(e,t){return{bootstrapChunks:[],startInlineScript:"<script>",placeholderPrefix:(t=void 0===t?"":t)+"P:",segmentPrefix:t+"S:",boundaryPrefix:t+"B:",idPrefix:t,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1,generateStaticMarkup:e}}(n,t?t.identifierPrefix:void 0),{insertionMode:1,selectedValue:null},1/0,ct,0,function(){c=!0}),tt(e),at(e,i),1===e.status)e.status=2,a.destroy(e.fatalError);else if(2!==e.status&&null===e.destination){e.destination=a;try{lt(e,a)}catch(t){We(e,t),He(e,t)}}if(s)throw o;if(!c)throw Error(r(426));return l}t.renderToNodeStream=function(){throw Error(r(207))},t.renderToStaticMarkup=function(e,t){return ht(e,t,!0,'The server used "renderToStaticMarkup" which does not support Suspense. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},t.renderToStaticNodeStream=function(){throw Error(r(208))},t.renderToString=function(e,t){return ht(e,t,!1,'The server used "renderToString" which does not support Suspense. If you intended for this Suspense boundary to render the fallback content on the server consider throwing an Error somewhere within the Suspense boundary. If you intended to have the server wait for the suspended component please switch to "renderToReadableStream" which supports Suspense on the server')},t.version="18.3.1"},911(e,t,n){var i=n(649);function r(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var s=null,o=0;function l(e,t){if(0!==t.length)if(512<t.length)0<o&&(e.enqueue(new Uint8Array(s.buffer,0,o)),s=new Uint8Array(512),o=0),e.enqueue(t);else{var n=s.length-o;n<t.length&&(0===n?e.enqueue(s):(s.set(t.subarray(0,n),o),e.enqueue(s),t=t.subarray(n)),s=new Uint8Array(512),o=0),s.set(t,o),o+=t.length}}function a(e,t){return l(e,t),!0}function c(e){s&&0<o&&(e.enqueue(new Uint8Array(s.buffer,0,o)),s=null,o=0)}var h=new TextEncoder;function u(e){return h.encode(e)}function d(e){return h.encode(e)}function f(e,t){"function"==typeof e.error?e.error(t):e.close()}var p=Object.prototype.hasOwnProperty,g=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,m={},A={};function v(e){return!!p.call(A,e)||!p.call(m,e)&&(g.test(e)?A[e]=!0:(m[e]=!0,!1))}function b(e,t,n,i,r,s,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=i,this.attributeNamespace=r,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=s,this.removeEmptyString=o}var x={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){x[e]=new b(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];x[t]=new b(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){x[e]=new b(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){x[e]=new b(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){x[e]=new b(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){x[e]=new b(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){x[e]=new b(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){x[e]=new b(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){x[e]=new b(e,5,!1,e.toLowerCase(),null,!1,!1)});var y=/[\-:]([a-z])/g;function w(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(y,w);x[t]=new b(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){x[e]=new b(e,1,!1,e.toLowerCase(),null,!1,!1)}),x.xlinkHref=new b("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){x[e]=new b(e,1,!1,e.toLowerCase(),null,!0,!0)});var C={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},k=["Webkit","ms","Moz","O"];Object.keys(C).forEach(function(e){k.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),C[t]=C[e]})});var _=/["'&<>]/;function S(e){if("boolean"==typeof e||"number"==typeof e)return""+e;e=""+e;var t=_.exec(e);if(t){var n,i="",r=0;for(n=t.index;n<e.length;n++){switch(e.charCodeAt(n)){case 34:t=""";break;case 38:t="&";break;case 39:t="'";break;case 60:t="<";break;case 62:t=">";break;default:continue}r!==n&&(i+=e.substring(r,n)),r=n+1,i+=t}e=r!==n?i+e.substring(r,n):i}return e}var E=/([A-Z])/g,T=/^ms-/,O=Array.isArray,M=d("<script>"),B=d("<\/script>"),D=d('<script src="'),R=d('<script type="module" src="'),I=d('" async=""><\/script>'),P=/(<\/|<)(s)(cript)/gi;function N(e,t,n,i){return t+("s"===n?"\\u0073":"\\u0053")+i}function L(e,t){return{insertionMode:e,selectedValue:t}}var F=d("\x3c!-- --\x3e");function j(e,t,n,i){return""===t?i:(i&&e.push(F),e.push(u(S(t))),!0)}var z=new Map,V=d(' style="'),W=d(":"),H=d(";");function q(e,t,n){if("object"!=typeof n)throw Error(r(62));for(var i in t=!0,n)if(p.call(n,i)){var s=n[i];if(null!=s&&"boolean"!=typeof s&&""!==s){if(0===i.indexOf("--")){var o=u(S(i));s=u(S((""+s).trim()))}else{o=i;var l=z.get(o);void 0!==l||(l=d(S(o.replace(E,"-$1").toLowerCase().replace(T,"-ms-"))),z.set(o,l)),o=l,s="number"==typeof s?0===s||p.call(C,i)?u(""+s):u(s+"px"):u(S((""+s).trim()))}t?(t=!1,e.push(V,o,W,s)):e.push(H,o,W,s)}}t||e.push(K)}var $=d(" "),U=d('="'),K=d('"'),G=d('=""');function Y(e,t,n,i){switch(n){case"style":return void q(e,t,i);case"defaultValue":case"defaultChecked":case"innerHTML":case"suppressContentEditableWarning":case"suppressHydrationWarning":return}if(!(2<n.length)||"o"!==n[0]&&"O"!==n[0]||"n"!==n[1]&&"N"!==n[1])if(null!==(t=x.hasOwnProperty(n)?x[n]:null)){switch(typeof i){case"function":case"symbol":return;case"boolean":if(!t.acceptsBooleans)return}switch(n=u(t.attributeName),t.type){case 3:i&&e.push($,n,G);break;case 4:!0===i?e.push($,n,G):!1!==i&&e.push($,n,U,u(S(i)),K);break;case 5:isNaN(i)||e.push($,n,U,u(S(i)),K);break;case 6:!isNaN(i)&&1<=i&&e.push($,n,U,u(S(i)),K);break;default:t.sanitizeURL&&(i=""+i),e.push($,n,U,u(S(i)),K)}}else if(v(n)){switch(typeof i){case"function":case"symbol":return;case"boolean":if("data-"!==(t=n.toLowerCase().slice(0,5))&&"aria-"!==t)return}e.push($,u(n),U,u(S(i)),K)}}var J=d(">"),Q=d("/>");function X(e,t,n){if(null!=t){if(null!=n)throw Error(r(60));if("object"!=typeof t||!("__html"in t))throw Error(r(61));null!=(t=t.__html)&&e.push(u(""+t))}}var Z=d(' selected=""');function ee(e,t,n,i){e.push(re(n));var r,s=n=null;for(r in t)if(p.call(t,r)){var o=t[r];if(null!=o)switch(r){case"children":n=o;break;case"dangerouslySetInnerHTML":s=o;break;default:Y(e,i,r,o)}}return e.push(J),X(e,s,n),"string"==typeof n?(e.push(u(S(n))),null):n}var te=d("\n"),ne=/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/,ie=new Map;function re(e){var t=ie.get(e);if(void 0===t){if(!ne.test(e))throw Error(r(65,e));t=d("<"+e),ie.set(e,t)}return t}var se=d("<!DOCTYPE html>");var oe=d("</"),le=d(">"),ae=d('<template id="'),ce=d('"></template>'),he=d("\x3c!--$--\x3e"),ue=d('\x3c!--$?--\x3e<template id="'),de=d('"></template>'),fe=d("\x3c!--$!--\x3e"),pe=d("\x3c!--/$--\x3e"),ge=d("<template"),me=d('"'),Ae=d(' data-dgst="');d(' data-msg="'),d(' data-stck="');var ve=d("></template>");function be(e,t,n){if(l(e,ue),null===n)throw Error(r(395));return l(e,n),a(e,de)}var xe=d('<div hidden id="'),ye=d('">'),we=d("</div>"),Ce=d('<svg aria-hidden="true" style="display:none" id="'),ke=d('">'),_e=d("</svg>"),Se=d('<math aria-hidden="true" style="display:none" id="'),Ee=d('">'),Te=d("</math>"),Oe=d('<table hidden id="'),Me=d('">'),Be=d("</table>"),De=d('<table hidden><tbody id="'),Re=d('">'),Ie=d("</tbody></table>"),Pe=d('<table hidden><tr id="'),Ne=d('">'),Le=d("</tr></table>"),Fe=d('<table hidden><colgroup id="'),je=d('">'),ze=d("</colgroup></table>"),Ve=d('function $RS(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};$RS("'),We=d('$RS("'),He=d('","'),qe=d('")<\/script>'),$e=d('function $RC(a,b){a=document.getElementById(a);b=document.getElementById(b);b.parentNode.removeChild(b);if(a){a=a.previousSibling;var f=a.parentNode,c=a.nextSibling,e=0;do{if(c&&8===c.nodeType){var d=c.data;if("/$"===d)if(0===e)break;else e--;else"$"!==d&&"$?"!==d&&"$!"!==d||e++}d=c.nextSibling;f.removeChild(c);c=d}while(c);for(;b.firstChild;)f.insertBefore(b.firstChild,c);a.data="$";a._reactRetry&&a._reactRetry()}};$RC("'),Ue=d('$RC("'),Ke=d('","'),Ge=d('")<\/script>'),Ye=d('function $RX(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};$RX("'),Je=d('$RX("'),Qe=d('"'),Xe=d(")<\/script>"),Ze=d(","),et=/[<\u2028\u2029]/g;function tt(e){return JSON.stringify(e).replace(et,function(e){switch(e){case"<":return"\\u003c";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:throw Error("escapeJSStringsForInstructionScripts encountered a match it does not know how to replace. this means the match regex and the replacement characters are no longer in sync. This is a bug in React")}})}var nt=Object.assign,it=Symbol.for("react.element"),rt=Symbol.for("react.portal"),st=Symbol.for("react.fragment"),ot=Symbol.for("react.strict_mode"),lt=Symbol.for("react.profiler"),at=Symbol.for("react.provider"),ct=Symbol.for("react.context"),ht=Symbol.for("react.forward_ref"),ut=Symbol.for("react.suspense"),dt=Symbol.for("react.suspense_list"),ft=Symbol.for("react.memo"),pt=Symbol.for("react.lazy"),gt=Symbol.for("react.scope"),mt=Symbol.for("react.debug_trace_mode"),At=Symbol.for("react.legacy_hidden"),vt=Symbol.for("react.default_value"),bt=Symbol.iterator;function xt(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case st:return"Fragment";case rt:return"Portal";case lt:return"Profiler";case ot:return"StrictMode";case ut:return"Suspense";case dt:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case ct:return(e.displayName||"Context")+".Consumer";case at:return(e._context.displayName||"Context")+".Provider";case ht:var t=e.render;return(e=e.displayName)||(e=""!==(e=t.displayName||t.name||"")?"ForwardRef("+e+")":"ForwardRef"),e;case ft:return null!==(t=e.displayName||null)?t:xt(e.type)||"Memo";case pt:t=e._payload,e=e._init;try{return xt(e(t))}catch(e){}}return null}var yt={};function wt(e,t){if(!(e=e.contextTypes))return yt;var n,i={};for(n in e)i[n]=t[n];return i}var Ct=null;function kt(e,t){if(e!==t){e.context._currentValue=e.parentValue,e=e.parent;var n=t.parent;if(null===e){if(null!==n)throw Error(r(401))}else{if(null===n)throw Error(r(401));kt(e,n)}t.context._currentValue=t.value}}function _t(e){e.context._currentValue=e.parentValue,null!==(e=e.parent)&&_t(e)}function St(e){var t=e.parent;null!==t&&St(t),e.context._currentValue=e.value}function Et(e,t){if(e.context._currentValue=e.parentValue,null===(e=e.parent))throw Error(r(402));e.depth===t.depth?kt(e,t):Et(e,t)}function Tt(e,t){var n=t.parent;if(null===n)throw Error(r(402));e.depth===n.depth?kt(e,n):Tt(e,n),t.context._currentValue=t.value}function Ot(e){var t=Ct;t!==e&&(null===t?St(e):null===e?_t(t):t.depth===e.depth?kt(t,e):t.depth>e.depth?Et(t,e):Tt(t,e),Ct=e)}var Mt={isMounted:function(){return!1},enqueueSetState:function(e,t){null!==(e=e._reactInternals).queue&&e.queue.push(t)},enqueueReplaceState:function(e,t){(e=e._reactInternals).replace=!0,e.queue=[t]},enqueueForceUpdate:function(){}};function Bt(e,t,n,i){var r=void 0!==e.state?e.state:null;e.updater=Mt,e.props=n,e.state=r;var s={queue:[],replace:!1};e._reactInternals=s;var o=t.contextType;if(e.context="object"==typeof o&&null!==o?o._currentValue:i,"function"==typeof(o=t.getDerivedStateFromProps)&&(r=null==(o=o(n,r))?r:nt({},r,o),e.state=r),"function"!=typeof t.getDerivedStateFromProps&&"function"!=typeof e.getSnapshotBeforeUpdate&&("function"==typeof e.UNSAFE_componentWillMount||"function"==typeof e.componentWillMount))if(t=e.state,"function"==typeof e.componentWillMount&&e.componentWillMount(),"function"==typeof e.UNSAFE_componentWillMount&&e.UNSAFE_componentWillMount(),t!==e.state&&Mt.enqueueReplaceState(e,e.state,null),null!==s.queue&&0<s.queue.length)if(t=s.queue,o=s.replace,s.queue=null,s.replace=!1,o&&1===t.length)e.state=t[0];else{for(s=o?t[0]:e.state,r=!0,o=o?1:0;o<t.length;o++){var l=t[o];null!=(l="function"==typeof l?l.call(e,s,n,i):l)&&(r?(r=!1,s=nt({},s,l)):nt(s,l))}e.state=s}else s.queue=null}var Dt={id:1,overflow:""};function Rt(e,t,n){var i=e.id;e=e.overflow;var r=32-It(i)-1;i&=~(1<<r),n+=1;var s=32-It(t)+r;if(30<s){var o=r-r%5;return s=(i&(1<<o)-1).toString(32),i>>=o,r-=o,{id:1<<32-It(t)+r|n<<r|i,overflow:s+e}}return{id:1<<s|n<<r|i,overflow:e}}var It=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(Pt(e)/Nt|0)|0},Pt=Math.log,Nt=Math.LN2,Lt="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},Ft=null,jt=null,zt=null,Vt=null,Wt=!1,Ht=!1,qt=0,$t=null,Ut=0;function Kt(){if(null===Ft)throw Error(r(321));return Ft}function Gt(){if(0<Ut)throw Error(r(312));return{memoizedState:null,queue:null,next:null}}function Yt(){return null===Vt?null===zt?(Wt=!1,zt=Vt=Gt()):(Wt=!0,Vt=zt):null===Vt.next?(Wt=!1,Vt=Vt.next=Gt()):(Wt=!0,Vt=Vt.next),Vt}function Jt(){jt=Ft=null,Ht=!1,zt=null,Ut=0,Vt=$t=null}function Qt(e,t){return"function"==typeof t?t(e):t}function Xt(e,t,n){if(Ft=Kt(),Vt=Yt(),Wt){var i=Vt.queue;if(t=i.dispatch,null!==$t&&void 0!==(n=$t.get(i))){$t.delete(i),i=Vt.memoizedState;do{i=e(i,n.action),n=n.next}while(null!==n);return Vt.memoizedState=i,[i,t]}return[Vt.memoizedState,t]}return e=e===Qt?"function"==typeof t?t():t:void 0!==n?n(t):t,Vt.memoizedState=e,e=(e=Vt.queue={last:null,dispatch:null}).dispatch=en.bind(null,Ft,e),[Vt.memoizedState,e]}function Zt(e,t){if(Ft=Kt(),t=void 0===t?null:t,null!==(Vt=Yt())){var n=Vt.memoizedState;if(null!==n&&null!==t){var i=n[1];e:if(null===i)i=!1;else{for(var r=0;r<i.length&&r<t.length;r++)if(!Lt(t[r],i[r])){i=!1;break e}i=!0}if(i)return n[0]}}return e=e(),Vt.memoizedState=[e,t],e}function en(e,t,n){if(25<=Ut)throw Error(r(301));if(e===Ft)if(Ht=!0,e={action:n,next:null},null===$t&&($t=new Map),void 0===(n=$t.get(t)))$t.set(t,e);else{for(t=n;null!==t.next;)t=t.next;t.next=e}}function tn(){throw Error(r(394))}function nn(){}var rn={readContext:function(e){return e._currentValue},useContext:function(e){return Kt(),e._currentValue},useMemo:Zt,useReducer:Xt,useRef:function(e){Ft=Kt();var t=(Vt=Yt()).memoizedState;return null===t?(e={current:e},Vt.memoizedState=e):t},useState:function(e){return Xt(Qt,e)},useInsertionEffect:nn,useLayoutEffect:function(){},useCallback:function(e,t){return Zt(function(){return e},t)},useImperativeHandle:nn,useEffect:nn,useDebugValue:nn,useDeferredValue:function(e){return Kt(),e},useTransition:function(){return Kt(),[!1,tn]},useId:function(){var e=jt.treeContext,t=e.overflow;e=((e=e.id)&~(1<<32-It(e)-1)).toString(32)+t;var n=sn;if(null===n)throw Error(r(404));return t=qt++,e=":"+n.idPrefix+"R"+e,0<t&&(e+="H"+t.toString(32)),e+":"},useMutableSource:function(e,t){return Kt(),t(e._source)},useSyncExternalStore:function(e,t,n){if(void 0===n)throw Error(r(407));return n()}},sn=null,on=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentDispatcher;function ln(e){return console.error(e),null}function an(){}function cn(e,t,n,i,r,s,o,l){e.allPendingTasks++,null===n?e.pendingRootTasks++:n.pendingTasks++;var a={node:t,ping:function(){var t=e.pingedTasks;t.push(a),1===t.length&&kn(e)},blockedBoundary:n,blockedSegment:i,abortSet:r,legacyContext:s,context:o,treeContext:l};return r.add(a),a}function hn(e,t,n,i,r,s){return{status:0,id:-1,index:t,parentFlushed:!1,chunks:[],children:[],formatContext:i,boundary:n,lastPushedText:r,textEmbedded:s}}function un(e,t){if(null!=(e=e.onError(t))&&"string"!=typeof e)throw Error('onError returned something with a type other than "string". onError should return a string and may return null or undefined but must not return anything else. It received something of type "'+typeof e+'" instead');return e}function dn(e,t){var n=e.onShellError;n(t),(n=e.onFatalError)(t),null!==e.destination?(e.status=2,f(e.destination,t)):(e.status=1,e.fatalError=t)}function fn(e,t,n,i,r){for(Ft={},jt=t,qt=0,e=n(i,r);Ht;)Ht=!1,qt=0,Ut+=1,Vt=null,e=n(i,r);return Jt(),e}function pn(e,t,n,i){var s=n.render(),o=i.childContextTypes;if(null!=o){var l=t.legacyContext;if("function"!=typeof n.getChildContext)i=l;else{for(var a in n=n.getChildContext())if(!(a in o))throw Error(r(108,xt(i)||"Unknown",a));i=nt({},l,n)}t.legacyContext=i,An(e,t,s),t.legacyContext=l}else An(e,t,s)}function gn(e,t){if(e&&e.defaultProps){for(var n in t=nt({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}return t}function mn(e,t,n,s,o){if("function"==typeof n)if(n.prototype&&n.prototype.isReactComponent){o=wt(n,t.legacyContext);var l=n.contextType;Bt(l=new n(s,"object"==typeof l&&null!==l?l._currentValue:o),n,s,o),pn(e,t,l,n)}else{o=fn(e,t,n,s,l=wt(n,t.legacyContext));var a=0!==qt;if("object"==typeof o&&null!==o&&"function"==typeof o.render&&void 0===o.$$typeof)Bt(o,n,s,l),pn(e,t,o,n);else if(a){s=t.treeContext,t.treeContext=Rt(s,1,0);try{An(e,t,o)}finally{t.treeContext=s}}else An(e,t,o)}else{if("string"!=typeof n){switch(n){case At:case mt:case ot:case lt:case st:case dt:return void An(e,t,s.children);case gt:throw Error(r(343));case ut:e:{n=t.blockedBoundary,o=t.blockedSegment,l=s.fallback,s=s.children;var c={id:null,rootSegmentID:-1,parentFlushed:!1,pendingTasks:0,forceClientRender:!1,completedSegments:[],byteSize:0,fallbackAbortableTasks:a=new Set,errorDigest:null},h=hn(0,o.chunks.length,c,o.formatContext,!1,!1);o.children.push(h),o.lastPushedText=!1;var d=hn(0,0,null,o.formatContext,!1,!1);d.parentFlushed=!0,t.blockedBoundary=c,t.blockedSegment=d;try{if(bn(e,t,s),d.lastPushedText&&d.textEmbedded&&d.chunks.push(F),d.status=1,wn(c,d),0===c.pendingTasks)break e}catch(t){d.status=4,c.forceClientRender=!0,c.errorDigest=un(e,t)}finally{t.blockedBoundary=n,t.blockedSegment=o}t=cn(e,l,n,h,a,t.legacyContext,t.context,t.treeContext),e.pingedTasks.push(t)}return}if("object"==typeof n&&null!==n)switch(n.$$typeof){case ht:if(s=fn(e,t,n.render,s,o),0!==qt){n=t.treeContext,t.treeContext=Rt(n,1,0);try{An(e,t,s)}finally{t.treeContext=n}}else An(e,t,s);return;case ft:return void mn(e,t,n=n.type,s=gn(n,s),o);case at:if(o=s.children,n=n._context,s=s.value,l=n._currentValue,n._currentValue=s,Ct=s={parent:a=Ct,depth:null===a?0:a.depth+1,context:n,parentValue:l,value:s},t.context=s,An(e,t,o),null===(e=Ct))throw Error(r(403));return s=e.parentValue,e.context._currentValue=s===vt?e.context._defaultValue:s,e=Ct=e.parent,void(t.context=e);case ct:return void An(e,t,s=(s=s.children)(n._currentValue));case pt:return void mn(e,t,n=(o=n._init)(n._payload),s=gn(n,s),void 0)}throw Error(r(130,null==n?n:typeof n,""))}switch(l=function(e,t,n,s,o){switch(t){case"select":e.push(re("select"));var l=null,a=null;for(f in n)if(p.call(n,f)){var c=n[f];if(null!=c)switch(f){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;case"defaultValue":case"value":break;default:Y(e,s,f,c)}}return e.push(J),X(e,a,l),l;case"option":a=o.selectedValue,e.push(re("option"));var h=c=null,d=null,f=null;for(l in n)if(p.call(n,l)){var g=n[l];if(null!=g)switch(l){case"children":c=g;break;case"selected":d=g;break;case"dangerouslySetInnerHTML":f=g;break;case"value":h=g;default:Y(e,s,l,g)}}if(null!=a)if(n=null!==h?""+h:function(e){var t="";return i.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(c),O(a)){for(s=0;s<a.length;s++)if(""+a[s]===n){e.push(Z);break}}else""+a===n&&e.push(Z);else d&&e.push(Z);return e.push(J),X(e,f,c),c;case"textarea":for(c in e.push(re("textarea")),f=a=l=null,n)if(p.call(n,c)&&null!=(h=n[c]))switch(c){case"children":f=h;break;case"value":l=h;break;case"defaultValue":a=h;break;case"dangerouslySetInnerHTML":throw Error(r(91));default:Y(e,s,c,h)}if(null===l&&null!==a&&(l=a),e.push(J),null!=f){if(null!=l)throw Error(r(92));if(O(f)&&1<f.length)throw Error(r(93));l=""+f}return"string"==typeof l&&"\n"===l[0]&&e.push(te),null!==l&&e.push(u(S(""+l))),null;case"input":for(a in e.push(re("input")),h=f=c=l=null,n)if(p.call(n,a)&&null!=(d=n[a]))switch(a){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,"input"));case"defaultChecked":h=d;break;case"defaultValue":c=d;break;case"checked":f=d;break;case"value":l=d;break;default:Y(e,s,a,d)}return null!==f?Y(e,s,"checked",f):null!==h&&Y(e,s,"checked",h),null!==l?Y(e,s,"value",l):null!==c&&Y(e,s,"value",c),e.push(Q),null;case"menuitem":for(var m in e.push(re("menuitem")),n)if(p.call(n,m)&&null!=(l=n[m]))switch(m){case"children":case"dangerouslySetInnerHTML":throw Error(r(400));default:Y(e,s,m,l)}return e.push(J),null;case"title":for(g in e.push(re("title")),l=null,n)if(p.call(n,g)&&null!=(a=n[g]))switch(g){case"children":l=a;break;case"dangerouslySetInnerHTML":throw Error(r(434));default:Y(e,s,g,a)}return e.push(J),l;case"listing":case"pre":for(h in e.push(re(t)),a=l=null,n)if(p.call(n,h)&&null!=(c=n[h]))switch(h){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;default:Y(e,s,h,c)}if(e.push(J),null!=a){if(null!=l)throw Error(r(60));if("object"!=typeof a||!("__html"in a))throw Error(r(61));null!=(n=a.__html)&&("string"==typeof n&&0<n.length&&"\n"===n[0]?e.push(te,u(n)):e.push(u(""+n)))}return"string"==typeof l&&"\n"===l[0]&&e.push(te),l;case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":for(var A in e.push(re(t)),n)if(p.call(n,A)&&null!=(l=n[A]))switch(A){case"children":case"dangerouslySetInnerHTML":throw Error(r(399,t));default:Y(e,s,A,l)}return e.push(Q),null;case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return ee(e,n,t,s);case"html":return 0===o.insertionMode&&e.push(se),ee(e,n,t,s);default:if(-1===t.indexOf("-")&&"string"!=typeof n.is)return ee(e,n,t,s);for(d in e.push(re(t)),a=l=null,n)if(p.call(n,d)&&null!=(c=n[d]))switch(d){case"children":l=c;break;case"dangerouslySetInnerHTML":a=c;break;case"style":q(e,s,c);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":break;default:v(d)&&"function"!=typeof c&&"symbol"!=typeof c&&e.push($,u(d),U,u(S(c)),K)}return e.push(J),X(e,a,l),l}}((o=t.blockedSegment).chunks,n,s,e.responseState,o.formatContext),o.lastPushedText=!1,a=o.formatContext,o.formatContext=function(e,t,n){switch(t){case"select":return L(1,null!=n.value?n.value:n.defaultValue);case"svg":return L(2,null);case"math":return L(3,null);case"foreignObject":return L(1,null);case"table":return L(4,null);case"thead":case"tbody":case"tfoot":return L(5,null);case"colgroup":return L(7,null);case"tr":return L(6,null)}return 4<=e.insertionMode||0===e.insertionMode?L(1,null):e}(a,n,s),bn(e,t,l),o.formatContext=a,n){case"area":case"base":case"br":case"col":case"embed":case"hr":case"img":case"input":case"keygen":case"link":case"meta":case"param":case"source":case"track":case"wbr":break;default:o.chunks.push(oe,u(n),le)}o.lastPushedText=!1}}function An(e,t,n){if(t.node=n,"object"==typeof n&&null!==n){switch(n.$$typeof){case it:return void mn(e,t,n.type,n.props,n.ref);case rt:throw Error(r(257));case pt:var i=n._init;return void An(e,t,n=i(n._payload))}if(O(n))return void vn(e,t,n);if((i=null===n||"object"!=typeof n?null:"function"==typeof(i=bt&&n[bt]||n["@@iterator"])?i:null)&&(i=i.call(n))){if(!(n=i.next()).done){var s=[];do{s.push(n.value),n=i.next()}while(!n.done);vn(e,t,s)}return}throw e=Object.prototype.toString.call(n),Error(r(31,"[object Object]"===e?"object with keys {"+Object.keys(n).join(", ")+"}":e))}"string"==typeof n?(i=t.blockedSegment).lastPushedText=j(t.blockedSegment.chunks,n,e.responseState,i.lastPushedText):"number"==typeof n&&((i=t.blockedSegment).lastPushedText=j(t.blockedSegment.chunks,""+n,e.responseState,i.lastPushedText))}function vn(e,t,n){for(var i=n.length,r=0;r<i;r++){var s=t.treeContext;t.treeContext=Rt(s,i,r);try{bn(e,t,n[r])}finally{t.treeContext=s}}}function bn(e,t,n){var i=t.blockedSegment.formatContext,r=t.legacyContext,s=t.context;try{return An(e,t,n)}catch(a){if(Jt(),"object"!=typeof a||null===a||"function"!=typeof a.then)throw t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,Ot(s),a;n=a;var o=t.blockedSegment,l=hn(0,o.chunks.length,null,o.formatContext,o.lastPushedText,!0);o.children.push(l),o.lastPushedText=!1,e=cn(e,t.node,t.blockedBoundary,l,t.abortSet,t.legacyContext,t.context,t.treeContext).ping,n.then(e,e),t.blockedSegment.formatContext=i,t.legacyContext=r,t.context=s,Ot(s)}}function xn(e){var t=e.blockedBoundary;(e=e.blockedSegment).status=3,Cn(this,t,e)}function yn(e,t,n){var i=e.blockedBoundary;e.blockedSegment.status=3,null===i?(t.allPendingTasks--,2!==t.status&&(t.status=2,null!==t.destination&&t.destination.close())):(i.pendingTasks--,i.forceClientRender||(i.forceClientRender=!0,e=void 0===n?Error(r(432)):n,i.errorDigest=t.onError(e),i.parentFlushed&&t.clientRenderedBoundaries.push(i)),i.fallbackAbortableTasks.forEach(function(e){return yn(e,t,n)}),i.fallbackAbortableTasks.clear(),t.allPendingTasks--,0===t.allPendingTasks&&(i=t.onAllReady)())}function wn(e,t){if(0===t.chunks.length&&1===t.children.length&&null===t.children[0].boundary){var n=t.children[0];n.id=t.id,n.parentFlushed=!0,1===n.status&&wn(e,n)}else e.completedSegments.push(t)}function Cn(e,t,n){if(null===t){if(n.parentFlushed){if(null!==e.completedRootSegment)throw Error(r(389));e.completedRootSegment=n}e.pendingRootTasks--,0===e.pendingRootTasks&&(e.onShellError=an,(t=e.onShellReady)())}else t.pendingTasks--,t.forceClientRender||(0===t.pendingTasks?(n.parentFlushed&&1===n.status&&wn(t,n),t.parentFlushed&&e.completedBoundaries.push(t),t.fallbackAbortableTasks.forEach(xn,e),t.fallbackAbortableTasks.clear()):n.parentFlushed&&1===n.status&&(wn(t,n),1===t.completedSegments.length&&t.parentFlushed&&e.partialBoundaries.push(t)));e.allPendingTasks--,0===e.allPendingTasks&&(e=e.onAllReady)()}function kn(e){if(2!==e.status){var t=Ct,n=on.current;on.current=rn;var i=sn;sn=e.responseState;try{var r,s=e.pingedTasks;for(r=0;r<s.length;r++){var o=s[r],l=e,a=o.blockedSegment;if(0===a.status){Ot(o.context);try{An(l,o,o.node),a.lastPushedText&&a.textEmbedded&&a.chunks.push(F),o.abortSet.delete(o),a.status=1,Cn(l,o.blockedBoundary,a)}catch(e){if(Jt(),"object"==typeof e&&null!==e&&"function"==typeof e.then){var c=o.ping;e.then(c,c)}else{o.abortSet.delete(o),a.status=4;var h=o.blockedBoundary,u=e,d=un(l,u);null===h?dn(l,u):(h.pendingTasks--,h.forceClientRender||(h.forceClientRender=!0,h.errorDigest=d,h.parentFlushed&&l.clientRenderedBoundaries.push(h))),l.allPendingTasks--,0===l.allPendingTasks&&(0,l.onAllReady)()}}}}s.splice(0,r),null!==e.destination&&Mn(e,e.destination)}catch(t){un(e,t),dn(e,t)}finally{sn=i,on.current=n,n===rn&&Ot(t)}}}function _n(e,t,n){switch(n.parentFlushed=!0,n.status){case 0:var i=n.id=e.nextSegmentId++;return n.lastPushedText=!1,n.textEmbedded=!1,e=e.responseState,l(t,ae),l(t,e.placeholderPrefix),l(t,e=u(i.toString(16))),a(t,ce);case 1:n.status=2;var s=!0;i=n.chunks;var o=0;n=n.children;for(var c=0;c<n.length;c++){for(s=n[c];o<s.index;o++)l(t,i[o]);s=Sn(e,t,s)}for(;o<i.length-1;o++)l(t,i[o]);return o<i.length&&(s=a(t,i[o])),s;default:throw Error(r(390))}}function Sn(e,t,n){var i=n.boundary;if(null===i)return _n(e,t,n);if(i.parentFlushed=!0,i.forceClientRender)i=i.errorDigest,a(t,fe),l(t,ge),i&&(l(t,Ae),l(t,u(S(i))),l(t,me)),a(t,ve),_n(e,t,n);else if(0<i.pendingTasks){i.rootSegmentID=e.nextSegmentId++,0<i.completedSegments.length&&e.partialBoundaries.push(i);var s=e.responseState,o=s.nextSuspenseID++;s=d(s.boundaryPrefix+o.toString(16)),i=i.id=s,be(t,e.responseState,i),_n(e,t,n)}else if(i.byteSize>e.progressiveChunkSize)i.rootSegmentID=e.nextSegmentId++,e.completedBoundaries.push(i),be(t,e.responseState,i.id),_n(e,t,n);else{if(a(t,he),1!==(n=i.completedSegments).length)throw Error(r(391));Sn(e,t,n[0])}return a(t,pe)}function En(e,t,n){return function(e,t,n,i){switch(n.insertionMode){case 0:case 1:return l(e,xe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,ye);case 2:return l(e,Ce),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,ke);case 3:return l(e,Se),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Ee);case 4:return l(e,Oe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Me);case 5:return l(e,De),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Re);case 6:return l(e,Pe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,Ne);case 7:return l(e,Fe),l(e,t.segmentPrefix),l(e,u(i.toString(16))),a(e,je);default:throw Error(r(397))}}(t,e.responseState,n.formatContext,n.id),Sn(e,t,n),function(e,t){switch(t.insertionMode){case 0:case 1:return a(e,we);case 2:return a(e,_e);case 3:return a(e,Te);case 4:return a(e,Be);case 5:return a(e,Ie);case 6:return a(e,Le);case 7:return a(e,ze);default:throw Error(r(397))}}(t,n.formatContext)}function Tn(e,t,n){for(var i=n.completedSegments,s=0;s<i.length;s++)On(e,t,n,i[s]);if(i.length=0,e=e.responseState,i=n.id,n=n.rootSegmentID,l(t,e.startInlineScript),e.sentCompleteBoundaryFunction?l(t,Ue):(e.sentCompleteBoundaryFunction=!0,l(t,$e)),null===i)throw Error(r(395));return n=u(n.toString(16)),l(t,i),l(t,Ke),l(t,e.segmentPrefix),l(t,n),a(t,Ge)}function On(e,t,n,i){if(2===i.status)return!0;var s=i.id;if(-1===s){if(-1===(i.id=n.rootSegmentID))throw Error(r(392));return En(e,t,i)}return En(e,t,i),l(t,(e=e.responseState).startInlineScript),e.sentCompleteSegmentFunction?l(t,We):(e.sentCompleteSegmentFunction=!0,l(t,Ve)),l(t,e.segmentPrefix),l(t,s=u(s.toString(16))),l(t,He),l(t,e.placeholderPrefix),l(t,s),a(t,qe)}function Mn(e,t){s=new Uint8Array(512),o=0;try{var n=e.completedRootSegment;if(null!==n&&0===e.pendingRootTasks){Sn(e,t,n),e.completedRootSegment=null;var i=e.responseState.bootstrapChunks;for(n=0;n<i.length-1;n++)l(t,i[n]);n<i.length&&a(t,i[n])}var h,d=e.clientRenderedBoundaries;for(h=0;h<d.length;h++){var f=d[h];i=t;var p=e.responseState,g=f.id,m=f.errorDigest,A=f.errorMessage,v=f.errorComponentStack;if(l(i,p.startInlineScript),p.sentClientRenderFunction?l(i,Je):(p.sentClientRenderFunction=!0,l(i,Ye)),null===g)throw Error(r(395));if(l(i,g),l(i,Qe),(m||A||v)&&(l(i,Ze),l(i,u(tt(m||"")))),(A||v)&&(l(i,Ze),l(i,u(tt(A||"")))),v&&(l(i,Ze),l(i,u(tt(v)))),!a(i,Xe))return e.destination=null,h++,void d.splice(0,h)}d.splice(0,h);var b=e.completedBoundaries;for(h=0;h<b.length;h++)if(!Tn(e,t,b[h]))return e.destination=null,h++,void b.splice(0,h);b.splice(0,h),c(t),s=new Uint8Array(512),o=0;var x=e.partialBoundaries;for(h=0;h<x.length;h++){var y=x[h];e:{d=e,f=t;var w=y.completedSegments;for(p=0;p<w.length;p++)if(!On(d,f,y,w[p])){p++,w.splice(0,p);var C=!1;break e}w.splice(0,p),C=!0}if(!C)return e.destination=null,h++,void x.splice(0,h)}x.splice(0,h);var k=e.completedBoundaries;for(h=0;h<k.length;h++)if(!Tn(e,t,k[h]))return e.destination=null,h++,void k.splice(0,h);k.splice(0,h)}finally{c(t),0===e.allPendingTasks&&0===e.pingedTasks.length&&0===e.clientRenderedBoundaries.length&&0===e.completedBoundaries.length&&t.close()}}function Bn(e,t){try{var n=e.abortableTasks;n.forEach(function(n){return yn(n,e,t)}),n.clear(),null!==e.destination&&Mn(e,e.destination)}catch(t){un(e,t),dn(e,t)}}t.renderToReadableStream=function(e,t){return new Promise(function(n,i){var r,s,o=new Promise(function(e,t){s=e,r=t}),l=function(e,t,n,i,r,s,o,l,a){var c=[],h=new Set;return(n=hn(t={destination:null,responseState:t,progressiveChunkSize:void 0===i?12800:i,status:0,fatalError:null,nextSegmentId:0,allPendingTasks:0,pendingRootTasks:0,completedRootSegment:null,abortableTasks:h,pingedTasks:c,clientRenderedBoundaries:[],completedBoundaries:[],partialBoundaries:[],onError:void 0===r?ln:r,onAllReady:void 0===s?an:s,onShellReady:void 0===o?an:o,onShellError:void 0===l?an:l,onFatalError:void 0===a?an:a},0,null,n,!1,!1)).parentFlushed=!0,e=cn(t,e,null,n,h,yt,null,Dt),c.push(e),t}(e,function(e,t,n,i,r){e=void 0===e?"":e,t=void 0===t?M:d('<script nonce="'+S(t)+'">');var s=[];if(void 0!==n&&s.push(t,u((""+n).replace(P,N)),B),void 0!==i)for(n=0;n<i.length;n++)s.push(D,u(S(i[n])),I);if(void 0!==r)for(i=0;i<r.length;i++)s.push(R,u(S(r[i])),I);return{bootstrapChunks:s,startInlineScript:t,placeholderPrefix:d(e+"P:"),segmentPrefix:d(e+"S:"),boundaryPrefix:e+"B:",idPrefix:e,nextSuspenseID:0,sentCompleteSegmentFunction:!1,sentCompleteBoundaryFunction:!1,sentClientRenderFunction:!1}}(t?t.identifierPrefix:void 0,t?t.nonce:void 0,t?t.bootstrapScriptContent:void 0,t?t.bootstrapScripts:void 0,t?t.bootstrapModules:void 0),function(e){return L("http://www.w3.org/2000/svg"===e?2:"http://www.w3.org/1998/Math/MathML"===e?3:0,null)}(t?t.namespaceURI:void 0),t?t.progressiveChunkSize:void 0,t?t.onError:void 0,s,function(){var e=new ReadableStream({type:"bytes",pull:function(e){if(1===l.status)l.status=2,f(e,l.fatalError);else if(2!==l.status&&null===l.destination){l.destination=e;try{Mn(l,e)}catch(e){un(l,e),dn(l,e)}}},cancel:function(){Bn(l)}},{highWaterMark:0});e.allReady=o,n(e)},function(e){o.catch(function(){}),i(e)},r);if(t&&t.signal){var a=t.signal,c=function(){Bn(l,a.reason),a.removeEventListener("abort",c)};a.addEventListener("abort",c)}kn(l)})},t.version="18.3.1"},467(e,t,n){var i,r;i=n(633),r=n(911),i.version,i.renderToString,t.qV=i.renderToStaticMarkup,i.renderToNodeStream,i.renderToStaticNodeStream,r.renderToReadableStream},20(e,t,n){var i=n(649),r=Symbol.for("react.element"),s=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,l=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function c(e,t,n){var i,s={},c=null,h=null;for(i in void 0!==n&&(c=""+n),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(h=t.ref),t)o.call(t,i)&&!a.hasOwnProperty(i)&&(s[i]=t[i]);if(e&&e.defaultProps)for(i in t=e.defaultProps)void 0===s[i]&&(s[i]=t[i]);return{$$typeof:r,type:e,key:c,ref:h,props:s,_owner:l.current}}t.Fragment=s,t.jsx=c,t.jsxs=c},848(e,t,n){e.exports=n(20)},72(e){var t=[];function n(e){for(var n=-1,i=0;i<t.length;i++)if(t[i].identifier===e){n=i;break}return n}function i(e,i){for(var s={},o=[],l=0;l<e.length;l++){var a=e[l],c=i.base?a[0]+i.base:a[0],h=s[c]||0,u="".concat(c," ").concat(h);s[c]=h+1;var d=n(u),f={css:a[1],media:a[2],sourceMap:a[3],supports:a[4],layer:a[5]};if(-1!==d)t[d].references++,t[d].updater(f);else{var p=r(f,i);i.byIndex=l,t.splice(l,0,{identifier:u,updater:p,references:1})}o.push(u)}return o}function r(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,r){var s=i(e=e||[],r=r||{});return function(e){e=e||[];for(var o=0;o<s.length;o++){var l=n(s[o]);t[l].references--}for(var a=i(e,r),c=0;c<s.length;c++){var h=n(s[c]);0===t[h].references&&(t[h].updater(),t.splice(h,1))}s=a}}},659(e){var t={};e.exports=function(e,n){var i=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(n)}},540(e){e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},56(e,t,n){e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},825(e){e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var i="";n.supports&&(i+="@supports (".concat(n.supports,") {")),n.media&&(i+="@media ".concat(n.media," {"));var r=void 0!==n.layer;r&&(i+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),i+=n.css,r&&(i+="}"),n.media&&(i+="}"),n.supports&&(i+="}");var s=n.sourceMap;s&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),t.styleTagTransform(i,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},113(e){e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},649(t){t.exports=e},942(e,t){var n;!function(){var i={}.hasOwnProperty;function r(){for(var e="",t=0;t<arguments.length;t++){var n=arguments[t];n&&(e=o(e,s(n)))}return e}function s(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return r.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var n in e)i.call(e,n)&&e[n]&&(t=o(t,n));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(r.default=r,e.exports=r):void 0===(n=function(){return r}.apply(t,[]))||(e.exports=n)}()}},k={};function _(e){var t=k[e];if(void 0!==t)return t.exports;var n=k[e]={id:e,exports:{}};return C[e](n,n.exports,_),n.exports}_.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return _.d(t,{a:t}),t},_.d=(e,t)=>{for(var n in t)_.o(t,n)&&!_.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},_.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),_.nc=void 0;var S=_(649),E=_(848);function T({label:e,children:t,align:n="bottom-start",className:i,showDelay:r=250,hideDelay:o=250}){const[l,a]=(0,S.useState)(!1),c=(0,S.useRef)(void 0),h=(0,S.useRef)(void 0),u=(0,S.useRef)(null),d=(0,S.useRef)(null),f=(0,S.useCallback)((e=!1)=>{clearTimeout(c.current),clearTimeout(h.current),e?c.current=setTimeout(()=>{a(!0)},r):a(!0)},[r]),p=(0,S.useCallback)((e=!1)=>{clearTimeout(c.current),clearTimeout(h.current),e?h.current=setTimeout(()=>{a(!1)},o):a(!1)},[o]);(0,S.useEffect)(()=>()=>{clearTimeout(c.current),clearTimeout(h.current)},[]),(0,S.useEffect)(()=>{if(!l)return;const e=e=>{u.current&&!u.current.contains(e.target)&&d.current&&!d.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[l,p]);const g=({relatedTarget:e})=>{var t,n;if(e===u.current||e===d.current||null!==(t=u.current)&&void 0!==t&&t.contains(e)||null!==(n=d.current)&&void 0!==n&&n.contains(e))return;const i=window.getSelection();if(i&&i.toString().length>0)try{var r,s,o;const e=i.getRangeAt(0);if(null!==(r=d.current)&&void 0!==r&&r.contains(e.commonAncestorContainer)||null!==(s=d.current)&&void 0!==s&&s.contains(i.anchorNode)||null!==(o=d.current)&&void 0!==o&&o.contains(i.focusNode))return}catch(e){}p(!0)},m=()=>{clearTimeout(h.current)};return(0,E.jsxs)("div",{className:"task-testing-tooltip__wrapper"+(i?` ${i}`:""),ref:u,onMouseEnter:()=>f(!0),onMouseLeave:g,onFocus:e=>{e.target===u.current&&f(!1)},onBlur:e=>{var t,n;const{relatedTarget:i}=e;null!==(t=d.current)&&void 0!==t&&t.contains(i)||null!==(n=u.current)&&void 0!==n&&n.contains(i)||p(!1)},onKeyDown:e=>{"Escape"===e.code&&p(!1)},children:[t,l&&s((()=>{const t=function(e,t){if(!e)return{};const n=e.getBoundingClientRect(),i={};return t.startsWith("bottom")?i.top=n.bottom+6:t.startsWith("top")&&(i.bottom=window.innerHeight-n.top+6),t.endsWith("start")?i.left=n.left:t.endsWith("end")&&(i.right=window.innerWidth-n.right),i}(u.current,n);return(0,E.jsxs)("div",{className:`task-testing-tooltip ${n}`,role:"tooltip",style:t,ref:d,onClick:e=>e.stopPropagation(),onMouseEnter:m,onMouseLeave:g,children:[(0,E.jsx)("div",{className:"task-testing-tooltip__content",children:e}),(0,E.jsx)("div",{className:"task-testing-tooltip__arrow"})]})})(),document.body)]})}var O=_(942),M=_.n(O);const B=Object.prototype.toString,D=Object.prototype.hasOwnProperty;function R(e){return"[object Object]"===B.call(e)}function I(e){const t=B.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function P(e,t){return!(null==e)&&D.call(e,t)}function N(e,t){let n,i;if(void 0===e)return;const r=function(e){return"[object Array]"===B.call(e)}(e)?j:F;for(let s in e)if(P(e,s)&&(n=e[s],i=t(n,r(s)),!1===i))return n}function L(e,t){return!!function(e,t){const n=function(e){return I(e)?e:t=>t===e}(t);let i;return N(e,function(e,t){if(n(e,t))return i=e,!1}),i}(e,t)}function F(e){return e}function j(e){return Number(e)}function z(e,t){let n={};return N(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n}function V(e,t){var n=H(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function W(e,t){return L(t,function(t){return V(e,t)})}function H(e){return e&&e.businessObject||e}const q=["bpmn:Task","bpmn:SubProcess"],$="Select a task or subprocess to start testing.";var U=_(7),K=_.n(U);const G={input:{},output:{}},Y=["bpmn:Task","bpmn:SubProcess"];class J extends(K()){constructor(e,t,n=G){super(),this._injector=e,this._elementVariables=t,this._config={...G,...n},this._selectedElement=null,this._variablesForElements=new Map}setConfig(e){this._config=e,this.emit("config.changed")}getConfig(){return this._config}setInputConfigForElement(e,t){if(!W(e,Y))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,input:{...this._config.input,[e.id]:t}},this.emit("config.changed",{config:this._config})}resetInputConfigForElement(e){if(!W(e,Y))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,input:z(this._config.input,e.id)},this.emit("config.changed")}setOutputConfigForElement(e,t){if(!W(e,Y))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,output:{...this._config.output,[e.id]:t}},this.emit("config.changed")}resetOutputConfigForElement(e){if(!W(e,Y))throw new Error(`Unsupported element type: ${e.type}`);this._config={...this._config,output:z(this._config.output,e.id)},this.emit("config.changed")}getInputConfigForElement(e){if(!W(e,Y))throw new Error(`Unsupported element type: ${e.type}`);return t=this._config.input[e.id],"[object String]"!==B.call(t)?this._getDefaultInputConfig():this._config.input[e.id];var t}getOutputConfigForElement(e){if(!W(e,Y))throw new Error(`Unsupported element type: ${e.type}`);if(this._config.output[e.id])return this._config.output[e.id]}_getDefaultInputConfig(){return"{}"}}class Q extends(K()){constructor(e){super(),this._injector=e,this._variables={},this._variableResolver=e.get("variableResolver"),this._injector.get("eventBus").on("commandStack.changed",()=>{this._variables={},this.emit("variables.changed")})}async getVariablesForElement(e){if(this._variables[e.id])return this._variables[e.id];const t=(await this._variableResolver.getVariablesForElement(e).catch(()=>[])).filter(({origin:t})=>!(1===t.length&&t[0].id===e.id));return this._variables[e.id]=t,t}}var X=_(467);let Z=[],ee=[];function te(e){if(e<768)return!1;for(let t=0,n=Z.length;;){let i=t+n>>1;if(e<Z[i])n=i;else{if(!(e>=ee[i]))return!0;t=i+1}if(t==n)return!1}}function ne(e){return e>=127462&&e<=127487}function ie(e,t,n=!0,i=!0){return(n?re:se)(e,t,i)}function re(e,t,n){if(t==e.length)return t;t&&le(e.charCodeAt(t))&&ae(e.charCodeAt(t-1))&&t--;let i=oe(e,t);for(t+=ce(i);t<e.length;){let r=oe(e,t);if(8205==i||8205==r||n&&te(r))t+=ce(r),i=r;else{if(!ne(r))break;{let n=0,i=t-2;for(;i>=0&&ne(oe(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function se(e,t,n){for(;t>0;){let i=re(e,t-2,n);if(i<t)return i;t--}return 0}function oe(e,t){let n=e.charCodeAt(t);if(!ae(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return le(i)?i-56320+(n-55296<<10)+65536:n}function le(e){return e>=56320&&e<57344}function ae(e){return e>=55296&&e<56320}function ce(e){return e<65536?1:2}(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?ee:Z).push(n+=e[t])})();class he{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=be(this,e,t);let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),de.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=be(this,e,t);let n=[];return this.decompose(e,t,n,0),de.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new ge(this),r=new ge(e);for(let e=t,s=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new ge(this,e)}iterRange(e,t=this.length){return new me(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ae(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new ue(e):de.from(ue.split(e,[])):he.empty}}class ue extends he{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.text[r],o=i+s.length;if((t?n:o)>=e)return new ve(i,o,n,s);i=o+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new ue(pe(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=fe(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new ue(t,e.length+r.length));else{let e=t.length>>1;n.push(new ue(t.slice(0,e)),new ue(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof ue))return super.replace(e,t,n);[e,t]=be(this,e,t);let i=fe(this.text,fe(n.text,pe(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new ue(i,r):de.from(ue.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){[e,t]=be(this,e,t);let i="";for(let r=0,s=0;r<=t&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;r>e&&s&&(i+=n),e<l&&t>r&&(i+=o.slice(Math.max(0,e-r),t-r)),r=l+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new ue(n,i)),n=[],i=-1);return i>-1&&t.push(new ue(n,i)),t}}class de extends he{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.children[r],o=i+s.length,l=n+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,n,i);i=o+1,n=l+1}}decompose(e,t,n,i){for(let r=0,s=0;s<=t&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e<=l&&t>=s){let r=i&((s<=e?1:0)|(l>=t?2:0));s>=e&&l<=t&&!r?n.push(o):o.decompose(e-s,t-s,n,r)}s=l+1}}replace(e,t,n){if([e,t]=be(this,e,t),n.lines<this.lines)for(let i=0,r=0;i<this.children.length;i++){let s=this.children[i],o=r+s.length;if(e>=r&&t<=o){let l=s.replace(e-r,t-r,n),a=this.lines-s.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let r=this.children.slice();return r[i]=l,new de(r,this.length-(t-e)+n.length)}return super.replace(r,o,l)}r=o+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){[e,t]=be(this,e,t);let i="";for(let r=0,s=0;r<this.children.length&&s<=t;r++){let o=this.children[r],l=s+o.length;s>e&&r&&(i+=n),e<l&&t>s&&(i+=o.sliceString(e-s,t-s,n)),s=l+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof de))return 0;let n=0,[i,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==s||r==o)return n;let l=this.children[i],a=e.children[r];if(l!=a)return n+l.scanIdentical(a,t);n+=l.length+1}}static from(e,t=e.reduce((e,t)=>e+t.length+1,-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new ue(n,t)}let i=Math.max(32,n>>5),r=i<<1,s=i>>1,o=[],l=0,a=-1,c=[];function h(e){let t;if(e.lines>r&&e instanceof de)for(let t of e.children)h(t);else e.lines>s&&(l>s||!l)?(u(),o.push(e)):e instanceof ue&&l&&(t=c[c.length-1])instanceof ue&&e.lines+t.lines<=32?(l+=e.lines,a+=e.length+1,c[c.length-1]=new ue(t.text.concat(e.text),t.length+1+e.length)):(l+e.lines>i&&u(),l+=e.lines,a+=e.length+1,c.push(e))}function u(){0!=l&&(o.push(1==c.length?c[0]:de.from(c,a)),a=-1,l=c.length=0)}for(let t of e)h(t);return u(),1==o.length?o[0]:new de(o,t)}}function fe(e,t,n=0,i=1e9){for(let r=0,s=0,o=!0;s<e.length&&r<=i;s++){let l=e[s],a=r+l.length;a>=n&&(a>i&&(l=l.slice(0,i-r)),r<n&&(l=l.slice(n-r)),o?(t[t.length-1]+=l,o=!1):t.push(l)),r=a+1}return t}function pe(e,t,n){return fe(e,[""],t,n)}he.empty=new ue([""],0);class ge{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ue?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,o=i instanceof ue?i.text.length:i.children.length;if(s==(t>0?o:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof ue){let r=i.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[s+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof ue?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class me{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new ge(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class Ae{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(he.prototype[Symbol.iterator]=function(){return this.iter()},ge.prototype[Symbol.iterator]=me.prototype[Symbol.iterator]=Ae.prototype[Symbol.iterator]=function(){return this});class ve{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}function be(e,t,n){return[t=Math.max(0,Math.min(e.length,t)),Math.max(t,Math.min(e.length,n))]}function xe(e,t,n=!0,i=!0){return ie(e,t,n,i)}function ye(e,t){let n=e.charCodeAt(t);if(!((i=n)>=55296&&i<56320&&t+1!=e.length))return n;var i;let r=e.charCodeAt(t+1);return function(e){return e>=56320&&e<57344}(r)?r-56320+(n-55296<<10)+65536:n}function we(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function Ce(e){return e<65536?1:2}const ke=/\r\n?|\n/;var _e=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(_e||(_e={}));class Se{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,i=0;t<this.sections.length;){let r=this.sections[t++],s=this.sections[t++];s<0?(e(n,i,r),i+=r):i+=s,n+=r}}iterChangedRanges(e,t=!1){Me(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];i<0?e.push(n,i):e.push(i,n)}return new Se(e)}composeDesc(e){return this.empty?e:e.empty?this:De(this,e)}mapDesc(e,t=!1){return e.empty?this:Be(this,e,t)}mapPos(e,t=-1,n=_e.Simple){let i=0,r=0;for(let s=0;s<this.sections.length;){let o=this.sections[s++],l=this.sections[s++],a=i+o;if(l<0){if(a>e)return r+(e-i);r+=o}else{if(n!=_e.Simple&&a>=e&&(n==_e.TrackDel&&i<e&&a>e||n==_e.TrackBefore&&i<e||n==_e.TrackAfter&&a>e))return null;if(a>e||a==e&&t<0&&!o)return e==i||t<0?r:r+l;r+=l}i=a}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n<this.sections.length&&i<=t;){let r=i+this.sections[n++];if(this.sections[n++]>=0&&i<=t&&r>=e)return!(i<e&&r>t)||"cover";i=r}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],i=this.sections[t++];e+=(e?" ":"")+n+(i>=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(e=>"number"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Se(e)}static create(e){return new Se(e)}}class Ee extends Se{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Me(this,(t,n,i,r,s)=>e=e.replace(i,i+(n-t),s),!1),e}mapDesc(e,t=!1){return Be(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i<t.length;i+=2){let s=t[i],o=t[i+1];if(o>=0){t[i]=o,t[i+1]=s;let l=i>>1;for(;n.length<l;)n.push(he.empty);n.push(s?e.slice(r,r+s):he.empty)}r+=s}return new Ee(t,n)}compose(e){return this.empty?e:e.empty?this:De(this,e,!0)}map(e,t=!1){return e.empty?this:Be(this,e,t,!0)}iterChanges(e,t=!1){Me(this,e,t)}get desc(){return Se.create(this.sections)}filter(e){let t=[],n=[],i=[],r=new Re(this);e:for(let s=0,o=0;;){let l=s==e.length?1e9:e[s++];for(;o<l||o==l&&0==r.len;){if(r.done)break e;let e=Math.min(r.len,l-o);Te(i,e,-1);let s=-1==r.ins?-1:0==r.off?r.ins:0;Te(t,e,s),s>0&&Oe(n,t,r.text),r.forward(e),o+=e}let a=e[s++];for(;o<a;){if(r.done)break e;let e=Math.min(r.len,a-o);Te(t,e,-1),Te(i,e,-1==r.ins?-1:0==r.off?r.ins:0),r.forward(e),o+=e}}return{changes:new Ee(t,n),filtered:Se.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],i=this.sections[t+1];i<0?e.push(n):0==i?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],s=0,o=null;function l(e=!1){if(!e&&!i.length)return;s<t&&Te(i,t-s,-1);let n=new Ee(i,r);o=o?o.compose(n.map(o)):n,i=[],r=[],s=0}return function e(a){if(Array.isArray(a))for(let t of a)e(t);else if(a instanceof Ee){if(a.length!=t)throw new RangeError(`Mismatched change set length (got ${a.length}, expected ${t})`);l(),o=o?o.compose(a.map(o)):a}else{let{from:e,to:o=e,insert:c}=a;if(e>o||e<0||o>t)throw new RangeError(`Invalid change range ${e} to ${o} (in doc of length ${t})`);let h=c?"string"==typeof c?he.of(c.split(n||ke)):c:he.empty,u=h.length;if(e==o&&0==u)return;e<s&&l(),e>s&&Te(i,e-s,-1),Te(i,o-e,u),Oe(r,i,h),s=o}}(e),l(!o),o}static empty(e){return new Ee(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;i<e.length;i++){let r=e[i];if("number"==typeof r)t.push(r,-1);else{if(!Array.isArray(r)||"number"!=typeof r[0]||r.some((e,t)=>t&&"string"!=typeof e))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length<i;)n.push(he.empty);n[i]=he.of(r.slice(1)),t.push(r[0],n[i].length)}}}return new Ee(t,n)}static createSet(e,t){return new Ee(e,t)}}function Te(e,t,n,i=!1){if(0==t&&n<=0)return;let r=e.length-2;r>=0&&n<=0&&n==e[r+1]?e[r]+=t:r>=0&&0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function Oe(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<i;)e.push(he.empty);e.push(n)}}function Me(e,t,n){let i=e.inserted;for(let r=0,s=0,o=0;o<e.sections.length;){let l=e.sections[o++],a=e.sections[o++];if(a<0)r+=l,s+=l;else{let c=r,h=s,u=he.empty;for(;c+=l,h+=a,a&&i&&(u=u.append(i[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)l=e.sections[o++],a=e.sections[o++];t(r,c,s,h,u),r=c,s=h}}}function Be(e,t,n,i=!1){let r=[],s=i?[]:null,o=new Re(e),l=new Re(t);for(let e=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(-1==o.ins&&-1==l.ins){let e=Math.min(o.len,l.len);Te(r,e,-1),o.forward(e),l.forward(e)}else if(l.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(l.len<o.len||l.len==o.len&&!n))){let t=l.len;for(Te(r,l.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(Te(r,0,o.ins),s&&Oe(s,r,o.text),e=o.i),o.forward(n),t-=n}l.next()}else{if(!(o.ins>=0)){if(o.done&&l.done)return s?Ee.createSet(r,s):Se.create(r);throw new Error("Mismatched change set lengths")}{let t=0,n=o.len;for(;n;)if(-1==l.ins){let e=Math.min(n,l.len);t+=e,n-=e,l.forward(e)}else{if(!(0==l.ins&&l.len<n))break;n-=l.len,l.next()}Te(r,t,e<o.i?o.ins:0),s&&e<o.i&&Oe(s,r,o.text),e=o.i,o.forward(o.len-n)}}}}function De(e,t,n=!1){let i=[],r=n?[]:null,s=new Re(e),o=new Re(t);for(let e=!1;;){if(s.done&&o.done)return r?Ee.createSet(i,r):Se.create(i);if(0==s.ins)Te(i,s.len,0,e),s.next();else if(0!=o.len||o.done){if(s.done||o.done)throw new Error("Mismatched change set lengths");{let t=Math.min(s.len2,o.len),n=i.length;if(-1==s.ins){let n=-1==o.ins?-1:o.off?0:o.ins;Te(i,t,n,e),r&&n&&Oe(r,i,o.text)}else-1==o.ins?(Te(i,s.off?0:s.len,t,e),r&&Oe(r,i,s.textBit(t))):(Te(i,s.off?0:s.len,o.off?0:o.ins,e),r&&!o.off&&Oe(r,i,o.text));e=(s.ins>t||o.ins>=0&&o.len>t)&&(e||i.length>n),s.forward2(t),o.forward(t)}}else Te(i,0,o.ins,e),r&&Oe(r,i,o.text),o.next()}}class Re{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return-2==this.ins}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?he.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?he.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Ie{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 32&this.flags?this.to:this.from}get head(){return 32&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 8&this.flags?-1:16&this.flags?1:0}get bidiLevel(){let e=7&this.flags;return 7==e?null:e}get goalColumn(){let e=this.flags>>6;return 16777215==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new Ie(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Pe.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Pe.range(this.anchor,n)}eq(e,t=!1){return!(this.anchor!=e.anchor||this.head!=e.head||this.goalColumn!=e.goalColumn||t&&this.empty&&this.assoc!=e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Pe.range(e.anchor,e.head)}static create(e,t,n){return new Ie(e,t,n)}}class Pe{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Pe.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return 1==this.ranges.length?this:new Pe([this.main],0)}addRange(e,t=!0){return Pe.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,Pe.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Pe(e.ranges.map(e=>Ie.fromJSON(e)),e.main)}static single(e,t=e){return new Pe([Pe.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;i<e.length;i++){let r=e[i];if(r.empty?r.from<=n:r.from<n)return Pe.normalized(e.slice(),t);n=r.to}return new Pe(e,t)}static cursor(e,t=0,n,i){return Ie.create(e,e,(0==t?0:t<0?8:16)|(null==n?7:Math.min(6,n))|(null!=i?i:16777215)<<6)}static range(e,t,n,i){let r=(null!=n?n:16777215)<<6|(null==i?7:Math.min(6,i));return t<e?Ie.create(t,e,48|r):Ie.create(e,t,(t>e?8:0)|r)}static normalized(e,t=0){let n=e[t];e.sort((e,t)=>e.from-t.from),t=e.indexOf(n);for(let n=1;n<e.length;n++){let i=e[n],r=e[n-1];if(i.empty?i.from<=r.to:i.from<r.to){let s=r.from,o=Math.max(i.to,r.to);n<=t&&t--,e.splice(--n,2,i.anchor>i.head?Pe.range(o,s):Pe.range(s,o))}}return new Pe(e,t)}}function Ne(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Le=0;class Fe{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Le++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}get reader(){return this}static define(e={}){return new Fe(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:je),!!e.static,e.enables)}of(e){return new ze([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ze(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ze(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],n=>t(n.field(e)))}}function je(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}class ze{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Le++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,s=e[r]>>1,o=2==this.type,l=!1,a=!1,c=[];for(let n of this.dependencies)"doc"==n?l=!0:"selection"==n?a=!0:1&(null!==(t=e[n.id])&&void 0!==t?t:1)||c.push(e[n.id]);return{create:e=>(e.values[s]=n(e),1),update(e,t){if(l&&t.docChanged||a&&(t.docChanged||t.selection)||We(e,c)){let t=n(e);if(o?!Ve(t,e.values[s],i):!i(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let l,a=t.config.address[r];if(null!=a){let r=Ze(t,a);if(this.dependencies.every(n=>n instanceof Fe?t.facet(n)===e.facet(n):!(n instanceof $e)||t.field(n,!1)==e.field(n,!1))||(o?Ve(l=n(e),r,i):i(l=n(e),r)))return e.values[s]=r,0}else l=n(e);return e.values[s]=l,1}}}}function Ve(e,t,n){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++)if(!n(e[i],t[i]))return!1;return!0}function We(e,t){let n=!1;for(let i of t)1&Xe(e,i)&&(n=!0);return n}function He(e,t,n){let i=n.map(t=>e[t.id]),r=n.map(e=>e.type),s=i.filter(e=>!(1&e)),o=e[t.id]>>1;function l(e){let n=[];for(let t=0;t<i.length;t++){let s=Ze(e,i[t]);if(2==r[t])for(let e of s)n.push(e);else n.push(s)}return t.combine(n)}return{create(e){for(let t of i)Xe(e,t);return e.values[o]=l(e),1},update(e,n){if(!We(e,s))return 0;let i=l(e);return t.compare(i,e.values[o])?0:(e.values[o]=i,1)},reconfigure(e,r){let s=We(e,i),a=r.config.facets[t.id],c=r.facet(t);if(a&&!s&&je(n,a))return e.values[o]=c,0;let h=l(e);return t.compare(h,c)?(e.values[o]=c,0):(e.values[o]=h,1)}}}const qe=Fe.define({static:!0});class $e{constructor(e,t,n,i,r){this.id=e,this.createF=t,this.updateF=n,this.compareF=i,this.spec=r,this.provides=void 0}static define(e){let t=new $e(Le++,e.create,e.update,e.compare||((e,t)=>e===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(qe).find(e=>e.field==this);return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,1)},reconfigure:(e,n)=>{let i,r=e.facet(qe),s=n.facet(qe);return(i=r.find(e=>e.field==this))&&i!=s.find(e=>e.field==this)?(e.values[t]=i.create(e),1):null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}}init(e){return[this,qe.of({field:this,create:e})]}get extension(){return this}}function Ue(e){return t=>new Ge(t,e)}const Ke={highest:Ue(0),high:Ue(1),default:Ue(2),low:Ue(3),lowest:Ue(4)};class Ge{constructor(e,t){this.inner=e,this.prec=t}}class Ye{of(e){return new Je(this,e)}reconfigure(e){return Ye.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Je{constructor(e,t){this.compartment=e,this.inner=t}}class Qe{constructor(e,t,n,i,r,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return null==t?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let i=[],r=Object.create(null),s=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;return function e(s,o){let l=r.get(s);if(null!=l){if(l<=o)return;let e=i[l].indexOf(s);e>-1&&i[l].splice(e,1),s instanceof Je&&n.delete(s.compartment)}if(r.set(s,o),Array.isArray(s))for(let t of s)e(t,o);else if(s instanceof Je){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(s.compartment)||s.inner;n.set(s.compartment,i),e(i,o)}else if(s instanceof Ge)e(s.inner,s.prec);else if(s instanceof $e)i[o].push(s),s.provides&&e(s.provides,o);else if(s instanceof ze)i[o].push(s),s.facet.extensions&&e(s.facet.extensions,2);else{let t=s.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);e(t,o)}}(e,2),i.reduce((e,t)=>e.concat(t))}(e,t,s))n instanceof $e?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let o=Object.create(null),l=[],a=[];for(let e of i)o[e.id]=a.length<<1,a.push(t=>e.slot(t));let c=null==n?void 0:n.config.facets;for(let e in r){let t=r[e],i=t[0].facet,s=c&&c[e]||[];if(t.every(e=>0==e.type))if(o[i.id]=l.length<<1|1,je(s,t))l.push(n.facet(i));else{let e=i.combine(t.map(e=>e.value));l.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=l.length<<1|1,l.push(e.value)):(o[e.id]=a.length<<1,a.push(t=>e.dynamicSlot(t)));o[i.id]=a.length<<1,a.push(e=>He(e,i,t))}}let h=a.map(e=>e(o));return new Qe(e,s,h,o,l,r)}}function Xe(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function Ze(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const et=Fe.define(),tt=Fe.define({combine:e=>e.some(e=>e),static:!0}),nt=Fe.define({combine:e=>e.length?e[0]:void 0,static:!0}),it=Fe.define(),rt=Fe.define(),st=Fe.define(),ot=Fe.define({combine:e=>!!e.length&&e[0]});class lt{constructor(e,t){this.type=e,this.value=t}static define(){return new at}}class at{of(e){return new lt(this,e)}}class ct{constructor(e){this.map=e}of(e){return new ht(this,e)}}class ht{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ht(this.type,t)}is(e){return this.type==e}static define(e={}){return new ct(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}ht.reconfigure=ht.define(),ht.appendConfig=ht.define();class ut{constructor(e,t,n,i,r,s){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&&Ne(n,t.newLength),r.some(e=>e.type==ut.time)||(this.annotations=r.concat(ut.time.of(Date.now())))}static create(e,t,n,i,r,s){return new ut(e,t,n,i,r,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ut.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function dt(e,t){let n=[];for(let i=0,r=0;;){let s,o;if(i<e.length&&(r==t.length||t[r]>=e[i]))s=e[i++],o=e[i++];else{if(!(r<t.length))return n;s=t[r++],o=t[r++]}!n.length||n[n.length-1]<s?n.push(s,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function ft(e,t,n){var i;let r,s,o;return n?(r=t.changes,s=Ee.empty(t.changes.length),o=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),s=e.changes.mapDesc(t.changes,!0),o=e.changes.compose(r)),{changes:o,selection:t.selection?t.selection.map(s):null===(i=e.selection)||void 0===i?void 0:i.map(r),effects:ht.mapEffects(e.effects,r).concat(ht.mapEffects(t.effects,s)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function pt(e,t,n){let i=t.selection,r=At(t.annotations);return t.userEvent&&(r=r.concat(ut.userEvent.of(t.userEvent))),{changes:t.changes instanceof Ee?t.changes:Ee.of(t.changes||[],n,e.facet(nt)),selection:i&&(i instanceof Pe?i:Pe.single(i.anchor,i.head)),effects:At(t.effects),annotations:r,scrollIntoView:!!t.scrollIntoView}}function gt(e,t,n){let i=pt(e,t.length?t[0]:{},e.doc.length);t.length&&!1===t[0].filter&&(n=!1);for(let r=1;r<t.length;r++){!1===t[r].filter&&(n=!1);let s=!!t[r].sequential;i=ft(i,pt(e,t[r],s?i.changes.newLength:e.doc.length),s)}let r=ut.create(e,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return function(e){let t=e.startState,n=t.facet(st),i=e;for(let r=n.length-1;r>=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=ft(i,pt(t,s,e.changes.newLength),!0))}return i==e?e:ut.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(it)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:dt(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=Ee.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=ut.create(t,i,e.selection&&e.selection.map(r),ht.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(rt);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof ut?r:Array.isArray(r)&&1==r.length&&r[0]instanceof ut?r[0]:gt(t,At(r),!1)}return e}(r):r)}ut.time=lt.define(),ut.userEvent=lt.define(),ut.addToHistory=lt.define(),ut.remote=lt.define();const mt=[];function At(e){return null==e?mt:Array.isArray(e)?e:[e]}var vt=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(vt||(vt={}));const bt=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let xt;try{xt=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}class yt{constructor(e,t,n,i,r,s){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Xe(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(null!=n)return Xe(this,n),Ze(this,n);if(t)throw new RangeError("Field is not present in this state")}update(...e){return gt(this,e,!0)}applyTransaction(e){let t,n=this.config,{base:i,compartments:r}=n;for(let t of e.effects)t.is(Ye.reconfigure)?(n&&(r=new Map,n.compartments.forEach((e,t)=>r.set(t,e)),n=null),r.set(t.value.compartment,t.value.extension)):t.is(ht.reconfigure)?(n=null,i=t.value):t.is(ht.appendConfig)&&(n=null,i=At(i).concat(t.value));n?t=e.startState.values.slice():(n=Qe.resolve(i,r,this),t=new yt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let s=e.startState.facet(tt)?e.newSelection:e.newSelection.asSingle();new yt(n,e.newDoc,s,t,(t,n)=>n.update(t,e),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Pe.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],s=At(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),l=this.changes(o.changes),a=l.map(i);for(let e=0;e<n;e++)r[e]=r[e].map(a);let c=i.mapDesc(l,!0);r.push(o.range.map(c)),i=i.compose(a),s=ht.mapEffects(s,a).concat(ht.mapEffects(At(o.effects),c))}return{changes:i,selection:Pe.create(r,t.mainIndex),effects:s}}changes(e=[]){return e instanceof Ee?e:Ee.of(e,this.doc.length,this.facet(yt.lineSeparator))}toText(e){return he.of(e.split(this.facet(yt.lineSeparator)||ke))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return null==t?e.default:(Xe(this,t),Ze(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let i=e[n];i instanceof $e&&null!=this.config.address[i.id]&&(t[n]=i.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||"string"!=typeof e.doc)throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(n)for(let t in n)if(Object.prototype.hasOwnProperty.call(e,t)){let r=n[t],s=e[t];i.push(r.init(e=>r.spec.fromJSON(s,e)))}return yt.create({doc:e.doc,selection:Pe.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Qe.resolve(e.extensions||[],new Map),n=e.doc instanceof he?e.doc:he.of((e.doc||"").split(t.staticFacet(yt.lineSeparator)||ke)),i=e.selection?e.selection instanceof Pe?e.selection:Pe.single(e.selection.anchor,e.selection.head):Pe.single(0);return Ne(i,n.length),t.staticFacet(tt)||(i=i.asSingle()),new yt(t,n,i,t.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(yt.tabSize)}get lineBreak(){return this.facet(yt.lineSeparator)||"\n"}get readOnly(){return this.facet(ot)}phrase(e,...t){for(let t of this.facet(yt.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]})),e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(et))for(let s of r(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&i.push(s[e]);return i}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return n=t.length?t[0]:"",e=>{if(!/\S/.test(e))return vt.Space;if(function(e){if(xt)return xt.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||bt.test(n)))return!0}return!1}(e))return vt.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return vt.Word;return vt.Other};var n}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),s=e-n,o=e-n;for(;s>0;){let e=xe(t,s,!1);if(r(t.slice(e,s))!=vt.Word)break;s=e}for(;o<i;){let e=xe(t,o);if(r(t.slice(o,e))!=vt.Word)break;o=e}return s==o?null:Pe.range(s+n,o+n)}}function wt(e,t,n={}){let i={};for(let t of e)for(let e of Object.keys(t)){let r=t[e],s=i[e];if(void 0===s)i[e]=r;else if(s===r||void 0===r);else{if(!Object.hasOwnProperty.call(n,e))throw new Error("Config merge conflict for field "+e);i[e]=n[e](s,r)}}for(let e in t)void 0===i[e]&&(i[e]=t[e]);return i}yt.allowMultipleSelections=tt,yt.tabSize=Fe.define({combine:e=>e.length?e[0]:4}),yt.lineSeparator=nt,yt.readOnly=ot,yt.phrases=Fe.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every(n=>e[n]==t[n])}}),yt.languageData=et,yt.changeFilter=it,yt.transactionFilter=rt,yt.transactionExtender=st,Ye.reconfigure=ht.define();class Ct{eq(e){return this==e}range(e,t=e){return _t.create(e,t,this)}}function kt(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}Ct.prototype.startSide=Ct.prototype.endSide=0,Ct.prototype.point=!1,Ct.prototype.mapMode=_e.TrackDel;class _t{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new _t(e,t,n)}}function St(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class Et{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let s=i,o=r.length;;){if(s==o)return s;let i=s+o>>1,l=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==s)return l>=0?s:o;l>=0?o=i:s=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,r);r<s;r++)if(!1===i(this.from[r]+e,this.to[r]+e,this.value[r]))return!1}map(e,t){let n=[],i=[],r=[],s=-1,o=-1;for(let l=0;l<this.value.length;l++){let a,c,h=this.value[l],u=this.from[l]+e,d=this.to[l]+e;if(u==d){let e=t.mapPos(u,h.startSide,h.mapMode);if(null==e)continue;if(a=c=e,h.startSide!=h.endSide&&(c=t.mapPos(u,h.endSide),c<a))continue}else if(a=t.mapPos(u,h.startSide),c=t.mapPos(d,h.endSide),a>c||a==c&&h.startSide>0&&h.endSide<=0)continue;(c-a||h.endSide-h.startSide)<0||(s<0&&(s=a),h.point&&(o=Math.max(o,c-a)),n.push(h),i.push(a-s),r.push(c-s))}return{mapped:n.length?new Et(i,r,n,o):null,pos:s}}}class Tt{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new Tt(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,s=e.filter;if(0==t.length&&!s)return this;if(n&&(t=t.slice().sort(St)),this.isEmpty)return t.length?Tt.of(t):this;let o=new Bt(this,null,-1).goto(0),l=0,a=[],c=new Ot;for(;o.value||l<t.length;)if(l<t.length&&(o.from-t[l].from||o.startSide-t[l].value.startSide)>=0){let e=t[l++];c.addInner(e.from,e.to,e.value)||a.push(e)}else 1==o.rangeIndex&&o.chunkIndex<this.chunk.length&&(l==t.length||this.chunkEnd(o.chunkIndex)<t[l].from)&&(!s||i>this.chunkEnd(o.chunkIndex)||r<this.chunkPos[o.chunkIndex])&&c.addChunk(this.chunkPos[o.chunkIndex],this.chunk[o.chunkIndex])?o.nextChunk():((!s||i>o.to||r<o.from||s(o.from,o.to,o.value))&&(c.addInner(o.from,o.to,o.value)||a.push(_t.create(o.from,o.to,o.value))),o.next());return c.finishInner(this.nextLayer.isEmpty&&!a.length?Tt.empty:this.nextLayer.update({add:a,filter:s,filterFrom:i,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],i=-1;for(let r=0;r<this.chunk.length;r++){let s=this.chunkPos[r],o=this.chunk[r],l=e.touchesRange(s,s+o.length);if(!1===l)i=Math.max(i,o.maxPoint),t.push(o),n.push(e.mapPos(s));else if(!0===l){let{mapped:r,pos:l}=o.map(s,e);r&&(i=Math.max(i,r.maxPoint),t.push(r),n.push(l))}}let r=this.nextLayer.map(e);return 0==t.length?r:new Tt(n,t,r||Tt.empty,i)}between(e,t,n){if(!this.isEmpty){for(let i=0;i<this.chunk.length;i++){let r=this.chunkPos[i],s=this.chunk[i];if(t>=r&&e<=r+s.length&&!1===s.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Dt.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Dt.from(e).goto(t)}static compare(e,t,n,i,r=-1){let s=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r),l=Mt(s,o,n),a=new It(s,l,r),c=new It(o,l,r);n.iterGaps((e,t,n)=>Pt(a,e,c,t,n,i)),n.empty&&0==n.length&&Pt(a,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),s=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(r.length!=s.length)return!1;if(!r.length)return!0;let o=Mt(r,s),l=new It(r,o,0).goto(n),a=new It(s,o,0).goto(n);for(;;){if(l.to!=a.to||!Nt(l.active,a.active)||l.point&&(!a.point||!kt(l.point,a.point)))return!1;if(l.to>i)return!0;l.next(),a.next()}}static spans(e,t,n,i,r=-1){let s=new It(e,null,r).goto(t),o=t,l=s.openStart;for(;;){let e=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),r=s.pointFrom<t?n.length+1:s.point.startSide<0?n.length:Math.min(n.length,l);i.point(o,e,s.point,n,r,s.pointRank),l=Math.min(s.openEnd(e),n.length)}else e>o&&(i.span(o,e,s.active,l),l=s.openEnd(e));if(s.to>n)return l+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(e,t=!1){let n=new Ot;for(let i of e instanceof _t?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let i=e[n];if(St(t,i)>0)return e.slice().sort(St);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}static join(e){if(!e.length)return Tt.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let i=e[n];i!=Tt.empty;i=i.nextLayer)t=new Tt(i.chunkPos,i.chunk,t,Math.max(i.maxPoint,t.maxPoint));return t}}Tt.empty=new Tt([],[],null,-1),Tt.empty.nextLayer=Tt.empty;class Ot{finishChunk(e){this.chunks.push(new Et(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new Ot)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0||(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),0))}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Tt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=Tt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Mt(e,t,n){let i=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&i.set(t.chunk[e],t.chunkPos[e]);let r=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let s=i.get(e.chunk[t]);null==s||(n?n.mapPos(s):s)!=e.chunkPos[t]||(null==n?void 0:n.touchesRange(s,s+e.chunk[t].length))||r.add(e.chunk[t])}return r}class Bt{constructor(e,t,n,i=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=i}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let i=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<i)&&this.setRangeIndex(i)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Dt{constructor(e){this.heap=e}static from(e,t=null,n=-1){let i=[];for(let r=0;r<e.length;r++)for(let s=e[r];!s.isEmpty;s=s.nextLayer)s.maxPoint>=n&&i.push(new Bt(s,t,n,r));return 1==i.length?i[0]:new Dt(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Rt(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Rt(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Rt(this.heap,0)}}}function Rt(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1<e.length&&r.compare(e[i+1])>=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class It{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Dt.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Lt(this.active,e),Lt(this.activeTo,e),Lt(this.activeRank,e),this.minActive=jt(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||i-this.activeTo[t])>0;)t++;Ft(this.active,t,n),Ft(this.activeTo,t,i),Ft(this.activeRank,t,r),e&&Ft(e,t,this.cursor.from),this.minActive=jt(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let i=this.minActive;if(i>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Lt(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)){this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}this.cursor.next()}else this.addActive(n),this.cursor.next()}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Pt(e,t,n,i,r,s){e.goto(t),n.goto(i);let o=i+r,l=i,a=i-t,c=!!s.boundChange;for(let t=!1;;){let i=e.to+a-n.to,r=i||e.endSide-n.endSide,h=r<0?e.to+a:n.to,u=Math.min(h,o);if(e.point||n.point?(e.point&&n.point&&kt(e.point,n.point)&&Nt(e.activeForPoint(e.to),n.activeForPoint(n.to))||s.comparePoint(l,u,e.point,n.point),t=!1):(t&&s.boundChange(l),u>l&&!Nt(e.active,n.active)&&s.compareRange(l,u,e.active,n.active),c&&u<o&&(i||e.openEnd(h)!=n.openEnd(h))&&(t=!0)),h>o)break;l=h,r<=0&&e.next(),r>=0&&n.next()}}function Nt(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!kt(e[n],t[n]))return!1;return!0}function Lt(e,t){for(let n=t,i=e.length-1;n<i;n++)e[n]=e[n+1];e.pop()}function Ft(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function jt(e,t){let n=-1,i=1e9;for(let r=0;r<t.length;r++)(t[r]-i||e[r].endSide-e[n].endSide)<0&&(n=r,i=t[r]);return n}function zt(e,t,n=e.length){let i=0;for(let r=0;r<n&&r<e.length;)9==e.charCodeAt(r)?(i+=t-i%t,r++):(i++,r=xe(e,r));return i}const Vt="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Wt="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),Ht="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class qt{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function r(e,t,s,o){let l=[],a=/^@(\w+)\b/.exec(e[0]),c=a&&"keyframes"==a[1];if(a&&null==t)return s.push(e[0]+";");for(let n in t){let o=t[n];if(/&/.test(n))r(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,s);else if(o&&"object"==typeof o){if(!a)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),o,l,c)}else null!=o&&l.push(n.replace(/_.*/,"").replace(/[A-Z]/g,e=>"-"+e.toLowerCase())+": "+o+";")}(l.length||c)&&s.push((!n||a||o?e:e.map(n)).join(", ")+" {"+l.join(" ")+"}")}for(let t in e)r(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=Ht[Vt]||1;return Ht[Vt]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Wt],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Ut(e,r),i.mount(Array.isArray(t)?t:[t],e)}}let $t=new Map;class Ut{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=$t.get(n);if(t)return e[Wt]=t;this.sheet=new i.CSSStyleSheet,$t.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Wt]=this}mount(e,t){let n=this.sheet,i=0,r=0;for(let t=0;t<e.length;t++){let s=e[t],o=this.modules.indexOf(s);if(o<r&&o>-1&&(this.modules.splice(o,1),r--,o=-1),-1==o){if(this.modules.splice(r++,0,s),n)for(let e=0;e<s.rules.length;e++)n.insertRule(s.rules[e],i++)}else{for(;r<o;)i+=this.modules[r++].rules.length;i+=s.rules.length,r++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let e="";for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+"\n";this.styleTag.textContent=e;let n=t.head||t;this.styleTag.parentNode!=n&&n.insertBefore(this.styleTag,n.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Kt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Gt={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Yt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Jt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Qt=0;Qt<10;Qt++)Kt[48+Qt]=Kt[96+Qt]=String(Qt);for(Qt=1;Qt<=24;Qt++)Kt[Qt+111]="F"+Qt;for(Qt=65;Qt<=90;Qt++)Kt[Qt]=String.fromCharCode(Qt+32),Gt[Qt]=String.fromCharCode(Qt);for(var Xt in Kt)Gt.hasOwnProperty(Xt)||(Gt[Xt]=Kt[Xt]);let Zt="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},en="undefined"!=typeof document?document:{documentElement:{style:{}}};const tn=/Edge\/(\d+)/.exec(Zt.userAgent),nn=/MSIE \d/.test(Zt.userAgent),rn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Zt.userAgent),sn=!!(nn||rn||tn),on=!sn&&/gecko\/(\d+)/i.test(Zt.userAgent),ln=!sn&&/Chrome\/(\d+)/.exec(Zt.userAgent),an="webkitFontSmoothing"in en.documentElement.style,cn=!sn&&/Apple Computer/.test(Zt.vendor),hn=cn&&(/Mobile\/\w+/.test(Zt.userAgent)||Zt.maxTouchPoints>2);var un={mac:hn||/Mac/.test(Zt.platform),windows:/Win/.test(Zt.platform),linux:/Linux|X11/.test(Zt.platform),ie:sn,ie_version:nn?en.documentMode||6:rn?+rn[1]:tn?+tn[1]:0,gecko:on,gecko_version:on?+(/Firefox\/(\d+)/.exec(Zt.userAgent)||[0,0])[1]:0,chrome:!!ln,chrome_version:ln?+ln[1]:0,ios:hn,android:/Android\b/.test(Zt.userAgent),webkit:an,webkit_version:an?+(/\bAppleWebKit\/(\d+)/.exec(Zt.userAgent)||[0,0])[1]:0,safari:cn,safari_version:cn?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Zt.userAgent)||[0,0])[1]:0,tabSize:null!=en.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};function dn(e,t){for(let n in e)"class"==n&&t.class?t.class+=" "+e.class:"style"==n&&t.style?t.style+=";"+e.style:t[n]=e[n];return t}const fn=Object.create(null);function pn(e,t,n){if(e==t)return!0;e||(e=fn),t||(t=fn);let i=Object.keys(e),r=Object.keys(t);if(i.length-(n&&i.indexOf(n)>-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let s of i)if(s!=n&&(-1==r.indexOf(s)||e[s]!==t[s]))return!1;return!0}function gn(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function mn(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let i=e.attributes[n];t[i.name]=i.value}return t}class An{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var vn=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(vn||(vn={}));class bn extends Ct{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new xn(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new wn(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:r,end:s}=Cn(e,i);t=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new wn(e,t,n,i,e.widget||null,!0)}static line(e){return new yn(e)}static set(e,t=!1){return Tt.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}bn.none=Tt.empty;class xn extends bn{constructor(e){let{start:t,end:n}=Cn(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?dn(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||fn}eq(e){return this==e||e instanceof xn&&this.tagName==e.tagName&&pn(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}xn.prototype.point=!1;class yn extends bn{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof yn&&this.spec.class==e.spec.class&&pn(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}yn.prototype.mapMode=_e.TrackBefore,yn.prototype.point=!0;class wn extends bn{constructor(e,t,n,i,r,s){super(t,n,r,e),this.block=i,this.isReplace=s,this.mapMode=i?t<=0?_e.TrackBefore:_e.TrackAfter:_e.TrackDel}get type(){return this.startSide!=this.endSide?vn.WidgetRange:this.startSide<=0?vn.WidgetBefore:vn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof wn&&((t=this.widget)==(n=e.widget)||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function Cn(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function kn(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}wn.prototype.point=!0;class _n extends Ct{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof _n&&this.tagName==e.tagName&&pn(this.attributes,e.attributes)}static create(e){return new _n(e.tagName,e.attributes||fn)}static set(e,t=!1){return Tt.of(e,t)}}function Sn(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function En(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function Tn(e,t){if(!t.anchorNode)return!1;try{return En(e,t.anchorNode)}catch(e){return!1}}function On(e){return 3==e.nodeType?Hn(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function Mn(e,t,n,i){return!!n&&(Rn(e,t,n,i,-1)||Rn(e,t,n,i,1))}function Bn(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function Dn(e){return 1==e.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function Rn(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:In(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=Bn(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?In(e):0}}}function In(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Pn(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function Nn(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function Ln(e,t){let n=t.width/e.offsetWidth,i=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(t.height-e.offsetHeight)<1)&&(i=1),{scaleX:n,scaleY:i}}function Fn(e,t=!0){let n=e.ownerDocument,i=null,r=null;for(let s=e.parentNode;s&&s!=n.body&&(t&&!i||!r);)if(1==s.nodeType)!r&&s.scrollHeight>s.clientHeight&&(r=s),t&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else{if(11!=s.nodeType)break;s=s.host}return{x:i,y:r}}_n.prototype.startSide=_n.prototype.endSide=-1;class jn{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?In(t):0),n,Math.min(e.focusOffset,n?In(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let zn,Vn=null;function Wn(e){if(e.setActive)return e.setActive();if(Vn)return e.focus(Vn);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==Vn?{get preventScroll(){return Vn={preventScroll:!0},!0}}:void 0),!Vn){Vn=!1;for(let e=0;e<t.length;){let n=t[e++],i=t[e++],r=t[e++];n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}}}function Hn(e,t,n=t){let i=zn||(zn=document.createRange());return i.setEnd(e,n),i.setStart(e,t),i}function qn(e,t,n,i){let r={key:t,code:t,keyCode:n,which:n,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let s=new KeyboardEvent("keydown",r);s.synthetic=!0,e.dispatchEvent(s);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,e.dispatchEvent(o),s.defaultPrevented||o.defaultPrevented}function $n(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Un(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i>0)return{node:n,offset:i};if(1==n.nodeType&&i>0){if("false"==n.contentEditable)return null;n=n.childNodes[i-1],i=In(n)}else{if(!n.parentNode||Dn(n))return null;i=Bn(n),n=n.parentNode}}}function Kn(e,t){for(let n=e,i=t;;){if(3==n.nodeType&&i<n.nodeValue.length)return{node:n,offset:i};if(1==n.nodeType&&i<n.childNodes.length){if("false"==n.contentEditable)return null;n=n.childNodes[i],i=0}else{if(!n.parentNode||Dn(n))return null;i=Bn(n)+1,n=n.parentNode}}}un.safari&&un.safari_version>=26&&(Vn=!1);class Gn{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new Gn(e.parentNode,Bn(e),t)}static after(e,t){return new Gn(e.parentNode,Bn(e)+1,t)}}var Yn=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Yn||(Yn={}));const Jn=Yn.LTR,Qn=Yn.RTL;function Xn(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<+e[n]);return t}const Zn=Xn("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ei=Xn("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ti=Object.create(null),ni=[];for(let e of["()","[]","{}"]){let t=e.charCodeAt(0),n=e.charCodeAt(1);ti[t]=n,ti[n]=-t}function ii(e){return e<=247?Zn[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?ei[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}const ri=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class si{get dir(){return this.level%2?Qn:Jn}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,i){let r=-1;for(let s=0;s<e.length;s++){let o=e[s];if(o.from<=t&&o.to>=t){if(o.level==n)return s;(r<0||(0!=i?i<0?o.from<t:o.to>t:e[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function oi(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!oi(i.inner,r.inner))return!1}return!0}const li=[];function ai(e,t,n,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=t,c=0;a<n;){let t=!0,h=!1;if(c==s.length||a<s[c].from){let e=li[a];e!=l&&(t=!1,h=16==e)}let u=t||1!=l?null:[],d=t?i:i+1,f=a;e:for(;;)if(c<s.length&&f==s[c].from){if(h)break e;let p=s[c];if(!t)for(let e=p.to,t=c+1;;){if(e==n)break e;if(!(t<s.length&&s[t].from==e)){if(li[e]==l)break e;break}e=s[t++].to}c++,u?u.push(p):(p.from>a&&o.push(new si(a,p.from,d)),ci(e,p.direction==Jn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.to),f=p.to}else{if(f==n||(t?li[f]!=l:li[f]==l))break;f++}u?ai(e,a,f,i+1,r,u,o):a<f&&o.push(new si(a,f,d)),a=f}else for(let a=n,c=s.length;a>t;){let n=!0,h=!1;if(!c||a>s[c-1].to){let e=li[a-1];e!=l&&(n=!1,h=16==e)}let u=n||1!=l?null:[],d=n?i:i+1,f=a;e:for(;;)if(c&&f==s[c-1].to){if(h)break e;let p=s[--c];if(!n)for(let e=p.from,n=c;;){if(e==t)break e;if(!n||s[n-1].to!=e){if(li[e-1]==l)break e;break}e=s[--n].from}u?u.push(p):(p.to<a&&o.push(new si(p.to,a,d)),ci(e,p.direction==Jn!=!(d%2)?i+1:i,r,p.inner,p.from,p.to,o),a=p.from),f=p.from}else{if(f==t||(n?li[f-1]!=l:li[f-1]==l))break;f--}u?ai(e,f,a,i+1,r,u,o):f<a&&o.push(new si(f,a,d)),a=f}}function ci(e,t,n,i,r,s,o){let l=t%2?2:1;!function(e,t,n,i,r){for(let s=0;s<=i.length;s++){let o=s?i[s-1].to:t,l=s<i.length?i[s].from:n,a=s?256:r;for(let t=o,n=a,i=a;t<l;t++){let r=ii(e.charCodeAt(t));512==r?r=n:8==r&&4==i&&(r=16),li[t]=4==r?2:r,7&r&&(i=r),n=r}for(let e=o,t=a,i=a;e<l;e++){let r=li[e];if(128==r)e<l-1&&t==li[e+1]&&24&t?r=li[e]=t:li[e]=256;else if(64==r){let r=e+1;for(;r<l&&64==li[r];)r++;let s=e&&8==t||r<n&&8==li[r]?1==i?1:8:256;for(let t=e;t<r;t++)li[t]=s;e=r-1}else 8==r&&1==i&&(li[e]=1);t=r,7&r&&(i=r)}}}(e,r,s,i,l),function(e,t,n,i,r){let s=1==r?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let c=o?i[o-1].to:t,h=o<i.length?i[o].from:n;for(let t,n,i,o=c;o<h;o++)if(n=ti[t=e.charCodeAt(o)])if(n<0){for(let e=l-3;e>=0;e-=3)if(ni[e+1]==-n){let t=ni[e+2],n=2&t?r:4&t?1&t?s:r:0;n&&(li[o]=li[ni[e]]=n),l=e;break}}else{if(189==ni.length)break;ni[l++]=o,ni[l++]=t,ni[l++]=a}else if(2==(i=li[o])||1==i){let e=i==r;a=e?0:1;for(let t=l-3;t>=0;t-=3){let n=ni[t+2];if(2&n)break;if(e)ni[t+2]|=2;else{if(4&n)break;ni[t+2]|=4}}}}}(e,r,s,i,l),function(e,t,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:e,l=r<n.length?n[r].from:t;for(let a=o;a<l;){let o=li[a];if(256==o){let o=a+1;for(;;)if(o==l){if(r==n.length)break;o=n[r++].to,l=r<n.length?n[r].from:t}else{if(256!=li[o])break;o++}let c=1==s,h=c==(1==(o<t?li[o]:i))?c?1:2:i;for(let t=o,i=r,s=i?n[i-1].to:e;t>a;)t==s&&(t=n[--i].from,s=i?n[i-1].to:e),li[--t]=h;a=o}else s=o,a++}}}(r,s,i,l),ai(e,r,s,t,n,i,o)}function hi(e){return[new si(0,e,0)]}let ui="";function di(e,t,n,i,r){var s;let o=i.head-e.from,l=si.find(t,o,null!==(s=i.bidiLevel)&&void 0!==s?s:-1,i.assoc),a=t[l],c=a.side(r,n);if(o==c){let e=l+=r?1:-1;if(e<0||e>=t.length)return null;a=t[l=e],o=a.side(!r,n),c=a.side(r,n)}let h=xe(e.text,o,a.forward(r,n));(h<a.from||h>a.to)&&(h=c),ui=e.text.slice(Math.min(o,h),Math.max(o,h));let u=l==(r?t.length-1:0)?null:t[l+(r?1:-1)];return u&&h==c&&u.level+(r?0:1)<a.level?Pe.cursor(u.side(!r,n)+e.from,u.forward(r,n)?1:-1,u.level):Pe.cursor(h+e.from,a.forward(r,n)?-1:1,a.level)}function fi(e,t,n){for(let i=t;i<n;i++){let t=ii(e.charCodeAt(i));if(1==t)return Jn;if(2==t||4==t)return Qn}return Jn}const pi=Fe.define(),gi=Fe.define(),mi=Fe.define(),Ai=Fe.define(),vi=Fe.define(),bi=Fe.define(),xi=Fe.define(),yi=Fe.define(),wi=Fe.define(),Ci=Fe.define({combine:e=>e.some(e=>e)}),ki=Fe.define({combine:e=>e.some(e=>e)}),_i=Fe.define();class Si{constructor(e,t="nearest",n="nearest",i=5,r=5,s=!1){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r,this.isSnapshot=s}map(e){return e.empty?this:new Si(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Si(Pe.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Ei=ht.define({map:(e,t)=>e.map(t)}),Ti=ht.define();function Oi(e,t,n){let i=e.facet(Ai);i.length?i[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+":",t):console.error(t))}const Mi=Fe.define({combine:e=>!e.length||e[0]});let Bi=0;const Di=Fe.define({combine:e=>e.filter((t,n)=>{for(let i=0;i<n;i++)if(e[i].plugin==t.plugin)return!1;return!0})});class Ri{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(Di.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Di.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=t||{};return new Ri(Bi++,e,n,i,e=>{let t=[];return s&&t.push(Li.of(t=>{let n=t.plugin(e);return n?s(n):bn.none})),r&&t.push(r(e)),t})}static fromClass(e,t){return Ri.define((t,n)=>new e(t,n),t)}}class Ii{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Oi(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Oi(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){Oi(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Pi=Fe.define(),Ni=Fe.define(),Li=Fe.define(),Fi=Fe.define(),ji=Fe.define(),zi=Fe.define(),Vi=Fe.define();function Wi(e,t){let n=e.state.facet(Vi);if(!n.length)return n;let i=n.map(t=>t instanceof Function?t(e):t),r=[];return Tt.spans(i,t.from,t.to,{point(){},span(e,n,i,s){let o=e-t.from,l=n-t.from,a=r;for(let e=i.length-1;e>=0;e--,s--){let n,r=i[e].spec.bidiIsolate;if(null==r&&(r=fi(t.text,o,l)),s>0&&a.length&&(n=a[a.length-1]).to==o&&n.direction==r)n.to=l,a=n.inner;else{let e={from:o,to:l,direction:r,inner:[]};a.push(e),a=e.inner}}}}),r}const Hi=Fe.define();function qi(e){let t=0,n=0,i=0,r=0;for(let s of e.state.facet(Hi)){let o=s(e);o&&(null!=o.left&&(t=Math.max(t,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:i,bottom:r}}const $i=Fe.define();class Ui{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Ui(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toA<n.fromA)break;n=n.join(i),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(0==t.length)return e;let n=[];for(let i=0,r=0,s=0;;){let o=i<e.length?e[i].fromB:1e9,l=r<t.length?t[r]:1e9,a=Math.min(o,l);if(1e9==a)break;let c=a+s,h=a,u=c;for(;;)if(r<t.length&&t[r]<=h){let n=t[r+1];r+=2,h=Math.max(h,n);for(let t=i;t<e.length&&e[t].fromB<=h;t++)s=e[t].toA-e[t].toB;u=Math.max(u,n+s)}else{if(!(i<e.length&&e[i].fromB<=h))break;{let t=e[i++];h=Math.max(h,t.toB),u=Math.max(u,t.toA),s=t.toA-t.toB}}n.push(new Ui(c,u,a,h))}return n}}class Ki{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Ee.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges((e,t,n,r)=>i.push(new Ui(e,t,n,r))),this.changedRanges=i}static create(e,t,n){return new Ki(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get viewportMoved(){return(8&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(18&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return 0==this.flags&&0==this.transactions.length}}const Gi=[];class Yi{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return 1&this.flags}get children(){return Gi}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,4&this.flags){this.flags&=-5;let e=this.domAttrs;e&&function(e,t){for(let n=e.attributes.length-1;n>=0;n--){let i=e.attributes[n].name;null==t[i]&&e.removeAttribute(i)}for(let n in t){let i=t[n];"style"==n?e.style.cssText=i:e.getAttribute(n)!=i&&e.setAttribute(n,i)}}(this.dom,e)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=Bn(this.dom),i=this.length?e>0:t>0;return new Gn(this.parent.dom,n+(i?1:0),0==e||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&2&this.parent.flags&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Xi)return e;return null}static get(e){return e.cmTile}}class Ji extends Yi{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(2&this.flags)return;super.sync(e);let t,n=this.dom,i=null,r=(null==e?void 0:e.node)==n?e:null,s=0;for(let o of this.children){if(o.sync(e),s+=o.length+o.breakAfter,t=i?i.nextSibling:n.firstChild,r&&t!=o.dom&&(r.written=!0),o.dom.parentNode==n)for(;t&&t!=o.dom;)t=Qi(t);else n.insertBefore(o.dom,t);i=o.dom}for(t=i?i.nextSibling:n.firstChild,r&&t&&(r.written=!0);t;)t=Qi(t);this.length=s}}function Qi(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class Xi extends Ji{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Yi.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,i=0,r=0;;)if(i==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&r++,i=t.pop()}else{let s=n.children[i++];if(s instanceof Zi)t.push(i),n=s,i=0;else{let t=r+s.length,n=e(s,r);if(void 0!==n)return n;r=t+s.breakAfter}}}resolveBlock(e,t){let n,i,r=-1,s=-1;if(this.blockTiles((o,l)=>{let a=l+o.length;if(e>=l&&e<=a){if(o.isWidget()&&t>=-1&&t<=1){if(32&o.flags)return!0;16&o.flags&&(n=void 0)}(l<e||e==a&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-l),(a>e||e==l&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,s=e-l)}}),!n&&!i)throw new Error("No tile at position "+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:s}}}class Zi extends Ji{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return!!this.children.length&&(e<0?this.children[0].covers(-1):this.lastChild.covers(1))}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new Zi(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class er extends Ji{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let i=new er(t||document.createElement("div"),e);return t&&n||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n){let i=null,r=-1,s=null,o=-1;!function e(l,a){for(let c=0,h=0;c<l.children.length&&h<=a;c++){let u=l.children[c],d=h+u.length;d>=a&&(u.isComposite()?e(u,a-h):(!s||s.isHidden&&(t>0||n&&tr(s,u)))&&(d>a||32&u.flags)?(s=u,o=a-h):(h<a||16&u.flags&&!u.isHidden)&&(i=u,r=a-h)),h=d}}(this,e);let l=(t<0?i:s)||i||s;return l?{tile:l,offset:l==i?r:o}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):function(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=On(t);return n[n.length-1]||null}(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:i}=n;if(this.dom.contains(e.dom))return e.isText()?new Gn(e.dom,Math.min(e.dom.nodeValue.length,i)):e.domPosFor(i,16&e.flags?1:32&e.flags?-1:t);let r=n.tile.parent,s=!1;for(let e of r.children){if(s)return new Gn(e.dom,0);e==n.tile&&(s=!0)}}return new Gn(this.dom,0)}}function tr(e,t){let n=e.coordsIn(0,1),i=t.coordsIn(0,1);return n&&i&&i.top<n.bottom}class nr extends Ji{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new nr(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ir extends Yi{constructor(e,t){super(e,t.length),this.text=t}sync(e){2&this.flags||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let i=e,r=e,s=0;0==e&&t<0||e==n&&t>=0?un.chrome||un.gecko||(e?(i--,s=1):r<n&&(r++,s=-1)):t<0?i--:r<n&&r++;let o=Hn(this.dom,i,r).getClientRects();if(!o.length)return null;let l=o[(s?s<0:t>=0)?0:o.length-1];return un.safari&&!s&&0==l.width&&(l=Array.prototype.find.call(o,e=>e.width)||l),s?Pn(l,s<0):l||null}static of(e,t){let n=new ir(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class rr extends Yi{constructor(e,t,n,i){super(e,t,i),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return!(48&this.flags)&&(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let i=this.widget.coordsAt(this.dom,e,t);if(i)return i;if(n)return Pn(this.dom.getBoundingClientRect(),this.length?0==e:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let i=!!(16&this.flags)||!(32&this.flags)&&e>0;for(let r=i?t.length-1:0;n=t[r],!(e>0?0==r:r==t.length-1||n.top<n.bottom);r+=i?-1:1);return Pn(n,!i)}}get overrideDOMText(){if(!this.length)return he.empty;let{root:e}=this;if(!e)return he.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,i,r){return r||(r=e.toDOM(t),e.editable||(r.contentEditable="false")),new rr(r,n,e,i)}}class sr extends Yi{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return he.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class or{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:i,index:r,beforeBreak:s,parents:o}=this;for(;e||t>0;)if(i.isComposite())if(s){if(!e)break;n&&n.break(),e--,s=!1}else if(r==i.children.length){if(!e&&!o.length)break;n&&n.leave(i),s=!!i.breakAfter,({tile:i,index:r}=o.pop()),r++}else{let l=i.children[r],a=l.breakAfter;!(t>0?l.length<=e:l.length<e)||n&&!1===n.skip(l,0,l.length)&&l.isComposite?(o.push({tile:i,index:r}),i=l,r=0,n&&l.isComposite()&&n.enter(l)):(s=!!a,r++,e-=l.length)}else if(r==i.length)s=!!i.breakAfter,({tile:i,index:r}=o.pop()),r++;else{if(!e)break;{let t=Math.min(e,i.length-r);n&&n.skip(i,r,r+t),e-=t,r+=t}}return this.tile=i,this.index=r,this.beforeBreak=s,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class lr{constructor(e,t,n,i){this.from=e,this.to=t,this.wrapper=n,this.rank=i}}class ar{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,i){var r;this.flushBuffer();let s=this.ensureMarks(t,n),o=s.lastChild;o&&o.isText()&&!(8&o.flags)&&o.length+e.length<512?(this.cache.reused.set(o,2),(s.children[s.children.length-1]=new ir(o.dom,o.text+e)).parent=s):s.append(i||ir.of(e,null===(r=this.cache.find(ir))||void 0===r?void 0:r.dom)),this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?gr(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let i=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],r=i.lastChild;if(r instanceof nr&&r.mark.eq(n.mark))r.dom!=n.dom&&r.setDOM(gr(n.dom)),i=r;else{if(this.cache.reused.get(n)){let e=Yi.get(n.dom);e&&e.setDOM(gr(n.dom))}let e=nr.of(n.mark,n.dom);i.append(e),i=e}this.cache.reused.set(n,2)}let r=Yi.get(e.text);r&&this.cache.reused.set(r,2);let s=new ir(e.text,e.text.nodeValue);s.flags|=8,i.append(s)}addInlineWidget(e,t,n){let i=this.afterWidget&&48&e.flags&&(48&this.afterWidget.flags)==(48&e.flags);i||this.flushBuffer();let r=this.ensureMarks(t,n);i||16&e.flags||r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){(this.afterWidget||this.lastBlock).length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=pr);let i=er.start(e,t||(null===(n=this.cache.find(er))||void 0===n?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=i)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let i=this.curLine;for(let r=e.length-1;r>=0;r--){let s,o=e[r];if(t>0&&(s=i.lastChild)&&s instanceof nr&&s.mark.eq(o))i=s,t--;else{let e=nr.of(o,null===(n=this.cache.find(nr,e=>e.mark.eq(o)))||void 0===n?void 0:n.dom);i.append(e),i=e,t=0}}return i}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;e&&fr(this.curLine,!1)&&("BR"==e.dom.nodeName||!e.isWidget()||un.ios&&fr(this.curLine,!0))||this.curLine.append(this.cache.findWidget(Ar,0,32)||new rr(Ar.toDOM(),0,Ar,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new lr(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let i=t.lastChild;if(n.from<this.pos&&i instanceof Zi&&i.wrapper.eq(n.wrapper))t=i;else{let i=Zi.of(n.wrapper,null===(e=this.cache.find(Zi,e=>e.wrapper.eq(n.wrapper)))||void 0===e?void 0:e.dom);t.append(i),t=i}}return t}blockPosCovered(){let e=this.lastBlock;return null!=e&&!e.breakAfter&&(!e.isWidget()||(160&e.flags)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(sr,void 0,1);return n&&(n.flags=t),n||new sr(t)}flushBuffer(){!this.afterWidget||32&this.afterWidget.flags||(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class cr{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skipCount);if(this.skipCount=0,i)throw new Error("Ran out of text content when drawing inline views");this.text=t;let r=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,r)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const hr=[rr,er,ir,nr,sr,Zi,Xi];for(let e=0;e<hr.length;e++)hr[e].bucket=e;class ur{constructor(e){this.view=e,this.buckets=hr.map(()=>[]),this.index=hr.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let i=e.bucket,r=this.buckets[i],s=this.index[i];for(let e=r.length-1;e>=0;e--){let o=(e+s)%r.length,l=r[o];if((!t||t(l))&&!this.reused.has(l))return r.splice(o,1),o<s&&this.index[i]--,this.reused.set(l,n),l}return null}findWidget(e,t,n){let i=this.buckets[0];if(i.length)for(let r=0,s=0;;r++){if(r==i.length){if(s)return null;s=1,r=0}let o=i[r];if(!this.reused.has(o)&&(0==s?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view)))return i.splice(r,1),r<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(497&o.flags)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new rr(o.dom,t,e,-498&o.flags|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class dr{constructor(e,t,n,i,r){this.view=e,this.decorations=i,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new ur(e),this.text=new cr(e.state.doc),this.builder=new ar(this.cache,new Xi(e,e.contentDOM),Tt.iter(n)),this.cache.reused.set(t,2),this.old=new or(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let i=0,r=0,s=0;;){let o=s<e.length?e[s++]:null,l=o?o.fromA:this.old.root.length;if(l>i){let e=l-i;this.preserve(e,!s,!o),i=l,r+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(r,o.toB)),r=o.toB,i=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let i=function(e){let t=[];for(let n=e.parents.length;n>1;n--){let i=n==e.parents.length?e.tile:e.parents[n].tile;i instanceof nr&&t.push(i.mark)}return t}(this.old),r=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget())if(this.openWidget)this.builder.continueWidget(n-t);else{let s=n>0||t<e.length?rr.of(e.widget,this.view,n-t,496&e.flags,this.cache.maybeReuse(e)):this.cache.reuse(e);256&s.flags?(s.flags&=-2,this.builder.addBlockWidget(s)):(this.builder.ensureLine(null),this.builder.addInlineWidget(s,i,r),r=i.length)}else if(e.isText())this.builder.ensureLine(null),t||n!=e.length||this.cache.reused.has(e)?(this.cache.add(e),this.builder.addText(e.text.slice(t,n),i,r)):this.builder.addText(e.text,i,r,this.cache.reuse(e)),r=i.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof sr)this.cache.add(e);else{if(!(e instanceof nr))return!1;this.builder.ensureLine(null),this.builder.addMark(e,i,r),this.cache.reused.set(e,1),r=i.length}this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof nr&&i.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?i.length&&(i.length=r=0):e instanceof nr&&(i.shift(),r=Math.min(r,i.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,i=this.builder,r=0,s=Tt.spans(this.decorations,e,t,{point:(e,t,s,o,l,a)=>{if(s instanceof wn){if(this.disallowBlockEffectsFor[a]){if(s.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.view.state.doc.lineAt(e).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=o.length,l>o.length)i.continueWidget(t-e);else{let r=s.widget||(s.block?mr.block:mr.inline),a=function(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}(s),c=this.cache.findWidget(r,t-e,a)||rr.of(r,this.view,t-e,a);s.block?(s.startSide>0&&i.addLineStartIfNotCovered(n),i.addBlockWidget(c)):(i.ensureLine(n),i.addInlineWidget(c,o,l))}n=null}else n=function(e,t){let n=t.spec.attributes,i=t.spec.class;return n||i?(e||(e={class:"cm-line"}),n&&dn(n,e),i&&(e.class+=" "+i),e):e}(n,s);t>e&&this.text.skip(t-e)},span:(e,t,r,s)=>{for(let o=e;o<t;){let l=this.text.next(Math.min(512,t-o));null==l?(i.addLineStartIfNotCovered(n),i.addBreak(),o++):(i.ensureLine(n),i.addText(l,r,o==e?s:r.length),o+=l.length),n=null}}});i.addLineStartIfNotCovered(n),this.openWidget=s>r,this.openMarks=s}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let i=e.parentNode;;i=i.parentNode){let e=Yi.get(i);if(i==this.view.contentDOM)break;e instanceof nr?t.push(e):(null==e?void 0:e.isLine())?n=e:e instanceof Zi||("DIV"!=i.nodeName||n||i==this.view.contentDOM?n||t.push(nr.of(new xn({tagName:i.nodeName.toLowerCase(),attributes:mn(i)}),i)):n=new er(i,pr))}return{line:n,marks:t}}}function fr(e,t){let n=e=>{for(let i of e.children)if((t?i.isText():i.length)||n(i))return!0;return!1};return n(e)}const pr={class:"cm-line"};function gr(e){let t=Yi.get(e);return t&&t.setDOM(e.cloneNode()),e}class mr extends An{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}mr.inline=new mr("span"),mr.block=new mr("div");const Ar=new class extends An{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class vr{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=bn.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Xi(e,e.contentDOM),this.updateInner([new Ui(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let i=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;return t&&e.iterChangedRanges((e,i)=>{e<t.to&&i>t.from&&(n=!0)}),n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let r=i>-1?function(e,t,n){let i=xr(e,n);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l))return null;if(e.state.doc.sliceString(i.from,i.to)!=l)return null;let a=t.invertedDesc;return{range:new Ui(a.mapPos(s),a.mapPos(o),s,o),text:r}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){let{from:t,to:i}=this.hasComposition;n=new Ui(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(un.ie||un.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=this.decorations,o=this.blockWrappers;this.updateDeco();let l=function(e,t,n){let i=new yr;return Tt.compare(e,t,n,i),i.changes}(s,this.decorations,e.changes);l.length&&(n=Ui.extendWithRanges(n,l));let a=function(e,t,n){let i=new wr;return Tt.compare(e,t,n,i),i.changes}(o,this.blockWrappers,e.changes);return a.length&&(n=Ui.extendWithRanges(n,a)),r&&!n.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(n=r.range.addToSet(n.slice())),!(2&this.tile.flags&&0==n.length||(this.updateInner(n,r),e.transactions.length&&(this.lastUpdate=Date.now()),0))}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,i=new dr(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Yi.get(t.text)&&i.cache.reused.set(Yi.get(t.text),2),this.tile=i.run(e,t),br(n,i.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let i=un.chrome||un.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(i),!i||!i.written&&n.selectionRange.focusNode==i.node&&this.tile.dom.contains(i.node)||(this.forceSelection=!0),this.tile.dom.style.height=""});let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof Cr&&i.push(e.dom);n.updateGaps(i)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Ti)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let{dom:n}=this.tile,i=this.view.root.activeElement,r=i==n,s=!r&&!(this.view.state.facet(Mi)||n.tabIndex>-1)&&Tn(n,this.view.observer.selectionRange)&&!(i&&n.contains(i));if(!(r||t||s))return;let o=this.forceSelection;this.forceSelection=!1;let l,a,c=this.view.state.selection.main;if(c.empty?a=l=this.inlineDOMNearPos(c.anchor,c.assoc||1):(a=this.inlineDOMNearPos(c.head,c.head==c.from?1:-1),l=this.inlineDOMNearPos(c.anchor,c.anchor==c.from?1:-1)),un.gecko&&c.empty&&!this.hasComposition&&1==(h=l).node.nodeType&&h.node.firstChild&&(0==h.offset||"false"==h.node.childNodes[h.offset-1].contentEditable)&&(h.offset==h.node.childNodes.length||"false"==h.node.childNodes[h.offset].contentEditable)){let e=document.createTextNode("");this.view.observer.ignore(()=>l.node.insertBefore(e,l.node.childNodes[l.offset]||null)),l=a=new Gn(e,0),o=!0}var h;let u=this.view.observer.selectionRange;!o&&u.focusNode&&(Mn(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Mn(a.node,a.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,c))||(this.view.observer.ignore(()=>{un.android&&un.chrome&&n.contains(u.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Sn(this.view.root);if(e)if(c.empty){if(un.gecko){let e=(t=l.node,r=l.offset,1!=t.nodeType?0:(r&&"false"==t.childNodes[r-1].contentEditable?1:0)|(r<t.childNodes.length&&"false"==t.childNodes[r].contentEditable?2:0));if(e&&3!=e){let t=(1==e?Un:Kn)(l.node,l.offset);t&&(l=new Gn(t.node,t.offset))}}e.collapse(l.node,l.offset),null!=c.bidiLevel&&void 0!==e.caretBidiLevel&&(e.caretBidiLevel=c.bidiLevel)}else if(e.extend){e.collapse(l.node,l.offset);try{e.extend(a.node,a.offset)}catch(e){}}else{let t=document.createRange();c.anchor>c.head&&([l,a]=[a,l]),t.setEnd(a.node,a.offset),t.setStart(l.node,l.offset),e.removeAllRanges(),e.addRange(t)}var t,r;s&&this.view.root.activeElement==n&&(n.blur(),i&&i.focus())}),this.view.observer.setSelectionRange(l,a)),this.impreciseAnchor=l.precise?null:new Gn(u.anchorNode,u.anchorOffset),this.impreciseHead=a.precise?null:new Gn(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Mn(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Sn(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let s=this.lineAt(t.head,t.assoc);if(!s)return;let o=s.posAtStart;if(t.head==o||t.head==o+s.length)return;let l=this.coordsAt(t.head,-1),a=this.coordsAt(t.head,1);if(!l||!a||l.bottom>a.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,r)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return 2&this.tile.dom.compareDocumentPosition(e)?0:this.view.state.doc.length;let i=n.posAtStart;if(!n.isComposite())return n.isText()?e==n.dom?i+t:i+(t?n.length:0):i;{let r;if(e==n.dom)r=n.dom.childNodes[t];else{let i=0==In(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}r=i<0?e:e.nextSibling}if(r==n.dom.firstChild)return i;for(;r&&!Yi.get(r);)r=r.nextSibling;if(!r)return i+n.length;for(let e=0,t=i;;e++){let i=n.children[e];if(i.dom==r)return t;t+=i.length+i.breakAfter}}}domAtPos(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(i,t)}inlineDOMNearPos(e,t){let n,i,r=-1,s=!1,o=-1,l=!1;return this.tile.blockTiles((t,a)=>{if(t.isWidget()){if(32&t.flags&&a>=e)return!0;16&t.flags&&(s=!0)}else{let c=a+t.length;if(a<=e&&(n=t,r=e-a,s=c<e),c>=e&&!i&&(i=t,o=e-a,l=a>e),a>e&&i)return!0}}),n||i?(s&&i?n=null:l&&n&&(i=null),n&&t<0||!i?n.domIn(r,t):i.domIn(o,t)):this.domAtPos(e,t)}coordsAt(e,t){let{tile:n,offset:i}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof Cr?null:n.coordsInWidget(i,t,!0):n.coordsIn(i,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);return t.isLine()?function e(t,n){if(t.isComposite())for(let i of t.children){if(i.length>=n){let t=e(i,n);if(t)return t}if((n-=i.length)<0)break}else if(t.isText()&&n<t.length){let e=xe(t.text,n);if(e==n)return null;let i=Hn(t.dom,n,e).getClientRects();for(let e=0;e<i.length;e++){let t=i[e];if(e==i.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}(t,n):null}measureVisibleLineHeights(e){let t=[],{from:n,to:i}=e,r=this.view.contentDOM.clientWidth,s=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,l=this.view.textDirection==Yn.LTR,a=0,c=(e,h,u)=>{for(let d=0;d<e.children.length&&!(h>i);d++){let i=e.children[d],f=h+i.length,p=i.dom.getBoundingClientRect(),{height:g}=p;if(u&&!d&&(a+=p.top-u.top),i instanceof Zi)f>n&&c(i,h,p);else if(h>=n&&(a>0&&t.push(-a),t.push(g+a),a=0,s)){let e=i.dom.lastChild,t=e?On(e):[];if(t.length){let e=t[t.length-1],n=l?e.right-p.left:p.right-e.left;n>o&&(o=n,this.minWidth=r,this.minWidthFrom=h,this.minWidthTo=f)}}u&&d==e.children.length-1&&(a+=u.bottom-p.bottom),h=f+i.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return"rtl"==getComputedStyle(t.dom).direction?Yn.RTL:Yn.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t,n=0;for(let i of e.children){if(!i.isText()||/[^ -~]/.test(i.text))return;let e=On(i.dom);if(1!=e.length)return;n+=e[0].width,t=e[0].height}if(n)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:n/e.length,textHeight:t}}});if(e)return e;let t,n,i,r=document.createElement("div");return r.className="cm-line",r.style.width="99999px",r.style.position="absolute",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(r);let e=On(r.firstChild)[0];t=r.getBoundingClientRect().height,n=e&&e.width?e.width/27:7,i=e&&e.height?e.height:t,r.remove()}),{lineHeight:t,charWidth:n,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],s=r?r.from-1:this.view.state.doc.length;if(s>n){let i=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(bn.replace({widget:new Cr(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return bn.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Li).map(t=>(this.dynamicDecorationMap[e++]="function"==typeof t)?t(this.view):t),n=!1,i=this.view.state.facet(ji).map((e,t)=>{let i="function"==typeof e;return i&&(n=!0),i?e(this.view):e});for(i.length&&(this.dynamicDecorationMap[e++]=n,t.push(Tt.join(i))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Fi).map(e=>"function"==typeof e?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);return this.view.scrollDOM.scrollTop=t.top-e.yMargin,void(this.view.scrollDOM.scrollLeft=e.xMargin)}for(let t of this.view.state.facet(_i))try{if(t(this.view,e.range,e))return!0}catch(e){Oi(this.view.state,e,"scroll handler")}let t,{range:n}=e,i=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let r=qi(this.view),s={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:o,offsetHeight:l}=this.view.scrollDOM;if(function(e,t,n,i,r,s,o,l){let a=e.ownerDocument,c=a.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==a.body,f=1,p=1;if(d)e=Nn(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();({scaleX:f,scaleY:p}=Ln(h,t)),e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*p}}let g=0,m=0;if("nearest"==r)t.top<e.top?(m=t.top-(e.top+o),n>0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+o)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+o,n<0&&t.top-m<e.top&&(m=t.top-(e.top+o)));else{let i=t.bottom-t.top,s=e.bottom-e.top;m=("center"==r&&i<=s?t.top+i/2-s/2:"start"==r||"center"==r&&n<0?t.top-o:t.bottom-s+o)-e.top}if("nearest"==i?t.left<e.left?(g=t.left-(e.left+s),n>0&&t.right>e.right+g&&(g=t.right-e.right+s)):t.right>e.right&&(g=t.right-e.right+s,n<0&&t.left<e.left+g&&(g=t.left-(e.left+s))):g=("center"==i?t.left+(t.right-t.left)/2-(e.right-e.left)/2:"start"==i==l?t.left-s:t.right-(e.right-e.left)+s)-e.left,g||m)if(d)c.scrollBy(g,m);else{let e=0,n=0;if(m){let e=h.scrollTop;h.scrollTop+=m/p,n=(h.scrollTop-e)*p}if(g){let t=h.scrollLeft;h.scrollLeft+=g/f,e=(h.scrollLeft-t)*f}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-g)<1&&(i="nearest"),n&&Math.abs(n-m)<1&&(r="nearest")}if(d)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}(this.view.scrollDOM,s,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,l),-l),this.view.textDirection==Yn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(n.head,1);e&&e.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){br(this.tile)}}function br(e,t){let n=null==t?void 0:t.get(e);if(1!=n){null==n&&e.destroy();for(let n of e.children)br(n,t)}}function xr(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let i=Un(n.focusNode,n.focusOffset),r=Kn(n.focusNode,n.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let t=Yi.get(r.node);if(!t||t.isText()&&t.text!=r.node.nodeValue)s=r;else if(e.docView.lastCompositionAfterCursor){let e=Yi.get(i.node);!e||e.isText()&&e.text!=i.node.nodeValue||(s=r)}}if(e.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=t-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}let yr=class{constructor(){this.changes=[]}compareRange(e,t){kn(e,t,this.changes)}comparePoint(e,t){kn(e,t,this.changes)}boundChange(e){kn(e,e,this.changes)}};class wr{constructor(){this.changes=[]}compareRange(e,t){kn(e,t,this.changes)}comparePoint(){}boundChange(e){kn(e,e,this.changes)}}class Cr extends An{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function kr(e,t,n,i){let r=e.state.doc.lineAt(t.head),s=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let l=t,a=null;;){let t=di(r,s,o,l,n),c=ui;if(!t){if(r.number==(n?e.state.doc.lines:1))return l;c="\n",r=e.state.doc.line(r.number+(n?1:-1)),s=e.bidiSpans(r),t=e.visualLineSide(r,!n)}if(a){if(!a(c))return l}else{if(!i)return t;a=i(c)}l=t}}function _r(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,(e,r,s)=>{if(t>e&&t<r){let s=i||n||(t-e<r-t?-1:1);t=s<0?e:r,i=s}});if(!i)return t}}function Sr(e,t){let n=null;for(let i=0;i<t.ranges.length;i++){let r=t.ranges[i],s=null;if(r.empty){let t=_r(e,r.from,0);t!=r.from&&(s=Pe.cursor(t,-1))}else{let t=_r(e,r.from,-1),n=_r(e,r.to,1);t==r.from&&n==r.to||(s=Pe.range(r.from==r.anchor?t:n,r.from==r.head?t:n))}s&&(n||(n=t.ranges.slice()),n[i]=s)}return n?Pe.create(n,t.mainIndex):t}function Er(e,t,n){let i=_r(e.state.facet(zi).map(t=>t(e)),n.from,t.head>n.from?-1:1);return i==n.from?n:Pe.cursor(i,i<n.from?1:-1)}class Tr{constructor(e,t){this.pos=e,this.assoc=t}}function Or(e,t,n,i){let r,s=e.contentDOM.getBoundingClientRect(),o=s.top+e.viewState.paddingTop,{x:l,y:a}=t,c=a-o;for(;;){if(c<0)return new Tr(0,1);if(c>e.viewState.docHeight)return new Tr(e.state.doc.length,-1);if(r=e.elementAtHeight(c),null==i)break;if(r.type==vn.Text){if(i<0?r.to<e.viewport.from:r.from>e.viewport.to)break;let t=e.docView.coordsAt(i<0?r.from:r.to,i>0?-1:1);if(t&&(i<0?t.top<=c+o:t.bottom>=c+o))break}let t=e.viewState.heightOracle.textHeight/2;c=i>0?r.bottom+t:r.top-t}if(e.viewport.from>=r.to||e.viewport.to<=r.from){if(n)return null;if(r.type==vn.Text){let t=function(e,t,n,i,r){let s=Math.round((i-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;s+=Math.floor((r-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+function(e,t,n){for(let i=0,r=0;;){if(r>=t)return i;if(i==e.length)break;r+=9==e.charCodeAt(i)?n-r%n:1,i=xe(e,i)}return e.length}(o,s,e.state.tabSize)}(e,s,r,l,a);return new Tr(t,t==r.from?1:-1)}}if(r.type!=vn.Text)return c<(r.top+r.bottom)/2?new Tr(r.from,1):new Tr(r.to,-1);let h=e.docView.lineAt(r.from,2);return h&&h.length==r.length||(h=e.docView.lineAt(r.from,-2)),new Mr(e,l,a,e.textDirectionAt(r.from)).scanTile(h,r.from)}class Mr{constructor(e,t,n,i){this.view=e,this.x=t,this.y=n,this.baseDir=i,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[si.find(i,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:i}=this.bidiSpansAt(e);return i[si.find(i,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:i}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+i.from<t)}scan(e,t){let n,i,r,s=0,o=e.length-1,l=new Set,a=this.bidiIn(e[0],e[o]),c=-1,h=1e9;e:for(;s<o;){let u=o-s,d=s+o>>1;t:if(l.has(d)){let e=s+Math.floor(Math.random()*u);for(let t=0;t<u;t++){if(!l.has(e)){d=e;break t}e++,e==o&&(e=s)}break e}l.add(d);let f=t(d);if(f)for(let t=0;t<f.length;t++){let l=f[t],u=0;if(l.bottom<this.y)(!n||n.bottom<l.bottom)&&(n=l),u=1;else if(l.top>this.y)(!i||i.top>l.top)&&(i=l),u=-1;else{let e=l.left>this.x?this.x-l.left:l.right<this.x?this.x-l.right:0,t=Math.abs(e);t<h&&(c=d,h=t,r=l),e&&(u=e<0==(this.baseDir==Yn.LTR)?-1:1)}-1!=u||a&&!this.baseDirAt(e[d],1)?1!=u||a&&!this.baseDirAt(e[d+1],-1)||(s=d+1):o=d}}if(!r){let r=n&&(!i||this.y-n.bottom<i.top-this.y)?n:i;return this.y=(r.top+r.bottom)/2,this.scan(e,t)}let u=(a?this.dirAt(e[c],1):this.baseDir)==Yn.LTR;return{i:c,after:this.x>(r.left+r.right)/2==u}}scanText(e,t){let n=[];for(let i=0;i<e.length;i=xe(e.text,i))n.push(t+i);n.push(t+e.length);let i=this.scan(n,i=>{let r=n[i]-t,s=n[i+1]-t;return Hn(e.dom,r,s).getClientRects()});return i.after?new Tr(n[i.i+1],-1):new Tr(n[i.i],1)}scanTile(e,t){if(!e.length)return new Tr(t,1);if(1==e.children.length){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let i=0,r=t;i<e.children.length;i++)n.push(r+=e.children[i].length);let i=this.scan(n,t=>{let n=e.children[t];return 48&n.flags?null:(1==n.dom.nodeType?n.dom:Hn(n.dom,0,n.length)).getClientRects()}),r=e.children[i.i],s=n[i.i];return r.isText()?this.scanText(r,s):r.isComposite()?this.scanTile(r,s):i.after?new Tr(n[i.i+1],-1):new Tr(s,1)}}const Br="";class Dr{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(yt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Br}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let r=Yi.get(i),s=i.nextSibling;if(s==t){(null==r?void 0:r.breakAfter)&&!s&&n!=this.view.contentDOM&&this.lineBreak();break}let o=Yi.get(s);(r&&o?r.breakAfter:(r?r.breakAfter:Dn(i))||Dn(s)&&("BR"!=i.nodeName||(null==r?void 0:r.isWidget()))&&this.text.length>e)&&!Ir(s,t)&&this.lineBreak(),i=s}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(r=i.exec(t))&&(s=r.index,o=r[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=s+o}}readNode(e){let t=Yi.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Rr(e,n.node,n.offset)?t:0))}}function Rr(e,t,n){for(;;){if(!t||n<In(t))return!1;if(t==e)return!0;n=Bn(t)+1,t=t.parentNode}}function Ir(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=Yi.get(e);if(!(null==t?void 0:t.isWidget()))return!1;t&&(n||(n=[])).push(t)}if(n)for(let e of n){let t=e.overrideDOMText;if(null==t?void 0:t.length)return!1}return!0}class Pr{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Nr{constructor(e,t,n,i){this.typeOver=i,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Lr(e.docView.tile,t,n,0))){let t=r||s?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=e.observer.selectionRange;return n&&(t.push(new Pr(n,i)),r==n&&s==i||t.push(new Pr(r,s))),t}(e),n=new Dr(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?Pe.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!En(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=s&&s.node==t.anchorNode&&s.offset==t.anchorOffset||!En(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),o=e.viewport;if((un.ios||un.chrome)&&e.state.selection.main.empty&&n!=i&&(o.from>0||o.to<e.state.doc.length)){let t=Math.min(n,i),r=Math.max(n,i),s=o.from-t,l=o.to-r;0!=s&&1!=s&&0!=t||0!=l&&-1!=l&&r!=e.state.doc.length||(n=0,i=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Pe.range(i,n)):this.newSel=Pe.single(i,n)}}}function Lr(e,t,n,i){if(e.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let a=0,c=i,h=i;a<e.children.length;a++){let i=e.children[a],u=c+i.length;if(c<t&&u>n)return Lr(i,t,n,c);if(u>=t&&-1==r&&(r=a,s=c),c>n&&i.dom.parentNode==e.dom){o=a,l=h;break}h=u,c=u+i.breakAfter}return{from:s,to:l<0?i+e.length:l,startDOM:(r?e.children[r-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:i,to:i+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Fr(e,t){let n,{newSel:i}=t,{state:r}=e,s=r.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:i}=t.bounds,l=s.from,a=null;(8===o||un.android&&t.text.length<i-e)&&(l=s.to,a="end");let c,h,u=r.doc.sliceString(e,i,Br);!s.empty&&s.from>=e&&s.to<=i&&(t.typeOver||u!=t.text)&&u.slice(0,s.from-e)==t.text.slice(0,s.from-e)&&u.slice(s.to-e)==t.text.slice(c=t.text.length-(u.length-(s.to-e)))?n={from:s.from,to:s.to,insert:he.of(t.text.slice(s.from-e,c).split(Br))}:(h=zr(u,t.text,l-e,a))&&(un.chrome&&13==o&&h.toB==h.from+2&&t.text.slice(h.from,h.toB)==Br+Br&&h.toB--,n={from:e+h.from,to:e+h.toA,insert:he.of(t.text.slice(h.from,h.toB).split(Br))})}else i&&(!e.hasFocus&&r.facet(Mi)||Vr(i,s))&&(i=null);if(!n&&!i)return!1;if((un.mac||un.android)&&n&&n.from==n.to&&n.from==s.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Pe.single(i.main.anchor-1,i.main.head-1)),n={from:n.from,to:n.to,insert:he.of([n.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).to<s.to&&e.docView.lineHasWidget(s.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:s.from,to:s.to,insert:r.toText(e.inputState.insertingText)}:un.chrome&&n&&n.from==n.to&&n.from==s.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Pe.single(i.main.anchor-1,i.main.head-1)),n={from:s.from,to:s.to,insert:he.of([" "])}),n)return jr(e,n,i,o);if(i&&!Vr(i,s)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin,"select.pointer"==n&&(i=Sr(r.facet(zi).map(t=>t(e)),i))),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}function jr(e,t,n,i=-1){if(un.ios&&e.inputState.flushIOSKey(t))return!0;let r=e.state.selection.main;if(un.android&&(t.to==r.to&&(t.from==r.from||t.from==r.from-1&&" "==e.state.sliceDoc(t.from,r.from))&&1==t.insert.length&&2==t.insert.lines&&qn(e.contentDOM,"Enter",13)||(t.from==r.from-1&&t.to==r.to&&0==t.insert.length||8==i&&t.insert.length<t.to-t.from&&t.to>r.head)&&qn(e.contentDOM,"Backspace",8)||t.from==r.from&&t.to==r.to+1&&0==t.insert.length&&qn(e.contentDOM,"Delete",46)))return!0;let s,o=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let l=()=>s||(s=function(e,t,n){let i,r=e.state,s=r.selection.main,o=-1;if(t.from==t.to&&t.from<s.from||t.from>s.to){let n=t.from<s.from?-1:1,i=n<0?s.from:s.to,l=_r(r.facet(zi).map(t=>t(e)),i,n);t.from==l&&(o=l)}if(o>-1)i={changes:t,selection:Pe.cursor(t.from+t.insert.length,-1)};else if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=s.from<t.from?r.sliceDoc(s.from,t.from):"",o=s.to>t.to?r.sliceDoc(t.to,s.to):"";i=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=r.changes(t),l=n&&n.main.to<=o.newLength?n.main:void 0;if(r.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=s.to+10&&t.to>=s.to-10){let a,c=e.state.sliceDoc(t.from,t.to),h=n&&xr(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);a={from:h.from,to:h.to-e}}else a=e.state.doc.lineAt(s.head);let u=s.to-t.to;i=r.changeByRange(n=>{if(n.from==s.from&&n.to==s.to)return{changes:o,range:l||n.map(o)};let i=n.to-u,h=i-c.length;if(e.state.sliceDoc(h,i)!=c||i>=a.from&&h<=a.to)return{range:n};let d=r.changes({from:h,to:i,insert:t.insert}),f=n.to-s.to;return{changes:d,range:l?Pe.range(Math.max(0,l.anchor+f),Math.max(0,l.head+f)):n.map(d)}})}else i={changes:o,selection:l&&r.selection.replaceRange(l)}}let l="input.type";return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,l+=".compose",e.inputState.compositionFirstChange&&(l+=".start",e.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}(e,t,n));return e.state.facet(bi).some(n=>n(e,t.from,t.to,o,l))||e.dispatch(l()),!0}function zr(e,t,n,i){let r=Math.min(e.length,t.length),s=0;for(;s<r&&e.charCodeAt(s)==t.charCodeAt(s);)s++;if(s==r&&e.length==t.length)return null;let o=e.length,l=t.length;for(;o>0&&l>0&&e.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;return"end"==i&&(n-=o+Math.max(0,s-Math.min(o,l))-s),o<s&&e.length<t.length?(s-=n<=s&&n>=o?s-n:0,l=s+(l-o),o=s):l<s&&(s-=n<=s&&n>=l?s-n:0,o=s+(o-l),l=s),{from:s,toA:o,toB:l}}function Vr(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}class Wr{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,un.safari&&e.contentDOM.addEventListener("input",()=>null),un.gecko&&function(e){ds.has(e)||(ds.add(e),e.addEventListener("copy",()=>{}),e.addEventListener("cut",()=>{}))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=Yi.get(i))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||(0!=this.view.updateState?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e)))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=qr(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,s=n[e];s&&r!=!s.handlers.length&&(i.removeEventListener(e,this.handleEvent),s=null),s||i.addEventListener(e,this.handleEvent,{passive:r})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&27!=e.keyCode&&Kr.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),un.android&&un.chrome&&!e.synthetic&&(13==e.keyCode||8==e.keyCode))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return!un.ios||e.synthetic||e.altKey||e.metaKey||!((t=$r.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||Ur.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0)}flushIOSKey(e){let t=this.pendingIOSKey;return!!t&&!("Enter"==t.key&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString()))&&(this.pendingIOSKey=void 0,qn(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!(!/^key/.test(e.type)||e.synthetic)&&(this.composing>0||!!(un.safari&&!un.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Hr(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){Oi(n.state,e)}}}function qr(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,i=e&&e.plugin.domEventHandlers,r=e&&e.plugin.domEventObservers;if(i)for(let e in i){let r=i[e];r&&n(e).handlers.push(Hr(t.value,r))}if(r)for(let e in r){let i=r[e];i&&n(e).observers.push(Hr(t.value,i))}}for(let e in Jr)n(e).handlers.push(Jr[e]);for(let e in Qr)n(e).observers.push(Qr[e]);return t}const $r=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Ur="dthko",Kr=[16,17,18,20,91,92,224,225];function Gr(e){return.7*Math.max(0,e)+8}class Yr{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Fn(e.contentDOM),this.atoms=e.state.facet(zi).map(t=>t(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(yt.allowMultipleSelections)&&function(e,t){let n=e.state.facet(pi);return n.length?n[0](t):un.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=Sn(e.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let e=0;e<r.length;e++){let n=r[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=os(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(t=this.startEvent,n=e,Math.max(Math.abs(t.clientX-n.clientX),Math.abs(t.clientY-n.clientY))<10))return;var t,n;this.select(this.lastEvent=e);let i=0,r=0,s=0,o=0,l=this.view.win.innerWidth,a=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:l}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:a}=this.scrollParents.y.getBoundingClientRect());let c=qi(this.view);e.clientX-c.left<=s+6?i=-Gr(s-e.clientX):e.clientX+c.right>=l-6&&(i=Gr(e.clientX-l)),e.clientY-c.top<=o+6?r=-Gr(o-e.clientY):e.clientY+c.bottom>=a-6&&(r=Gr(e.clientY-a)),this.setScrollSpeed(i,r)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),!1===this.dragging&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Sr(this.atoms,this.style.get(e,this.extend,this.multiple));!this.mustSelect&&n.eq(t.state.selection,!1===this.dragging)||this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}const Jr=Object.create(null),Qr=Object.create(null),Xr=un.ie&&un.ie_version<15||un.ios&&un.webkit_version<604;function Zr(e,t,n){for(let i of e.facet(t))n=i(n,e);return n}function es(e,t){t=Zr(e.state,yi,t);let n,{state:i}=e,r=1,s=i.toText(t),o=s.lines==i.selection.ranges.length;if(null!=as&&i.selection.ranges.every(e=>e.empty)&&as==s.toString()){let e=-1;n=i.changeByRange(n=>{let l=i.doc.lineAt(n.from);if(l.from==e)return{range:n};e=l.from;let a=i.toText((o?s.line(r++).text:t)+i.lineBreak);return{changes:{from:l.from,insert:a},range:Pe.cursor(n.from+a.length)}})}else n=o?i.changeByRange(e=>{let t=s.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Pe.cursor(e.from+t.length)}}):i.replaceSelection(s);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function ts(e,t,n,i){if(1==i)return Pe.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),s=t-r.from;if(0==r.length)return Pe.cursor(t);0==s?n=1:s==r.length&&(n=-1);let o=s,l=s;n<0?o=xe(r.text,s,!1):l=xe(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let e=xe(r.text,o,!1);if(i(r.text.slice(e,o))!=a)break;o=e}for(;l<r.length;){let e=xe(r.text,l);if(i(r.text.slice(l,e))!=a)break;l=e}return Pe.range(o+r.from,l+r.from)}(e.state,t,n);{let i=e.docView.lineAt(t,n),r=e.state.doc.lineAt(i?i.posAtEnd:t),s=i?i.posAtStart:r.from,o=i?i.posAtEnd:r.to;return o<e.state.doc.length&&o==r.to&&o++,Pe.range(s,o)}}Qr.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},Qr.wheel=Qr.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},Jr.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&0!=e.inputState.tabFocusMode&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),Qr.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},Qr.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},Jr.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(mi))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),i=os(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,s,o){let l,a=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c=ts(e,a.pos,a.assoc,i);if(n.pos!=a.pos&&!s){let t=ts(e,n.pos,n.assoc,i),r=Math.min(t.from,c.from),s=Math.max(t.to,c.to);c=r<c.from?Pe.range(r,s):Pe.range(s,r)}return s?r.replaceRange(r.main.extend(c.from,c.to)):o&&1==i&&r.ranges.length>1&&(l=function(e,t){for(let n=0;n<e.ranges.length;n++){let{from:i,to:r}=e.ranges[n];if(i<=t&&r>=t)return Pe.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(r,a.pos))?l:o?r.addRange(c):Pe.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new Yr(e,t,n,i)),i&&e.observer.ignore(()=>{Wn(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}else e.inputState.setSelectionOrigin("select.pointer");return!1};const ns=un.ie&&un.ie_version<=11;let is=null,rs=0,ss=0;function os(e){if(!ns)return e.detail;let t=is,n=ss;return is=e,ss=Date.now(),rs=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(rs+1)%3:1}function ls(e,t,n,i){if(!(n=Zr(e.state,yi,n)))return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=e.inputState,o=i&&s&&function(e,t){let n=e.state.facet(gi);return n.length?n[0](t):un.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:s.from,to:s.to}:null,l={from:r,insert:n},a=e.state.changes(o?[o,l]:l);e.focus(),e.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),e.inputState.draggedContent=null}Jr.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let i=e.docView.tile.nearest(t.target);if(i&&i.isWidget()){let e=i.posAtStart,t=e+i.length;(e>=n.to||t<=n.from)&&(n=Pe.range(e,t))}}let{inputState:i}=e;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData("Text",Zr(e.state,wi,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed="copyMove"),!1},Jr.dragend=e=>(e.inputState.draggedContent=null,!1),Jr.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&ls(e,t,i.filter(e=>null!=e).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=s,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),s()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return ls(e,t,n,!0),!0}return!1},Jr.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Xr?null:t.clipboardData;return n?(es(e,n.getData("text/plain")||n.getData("text/uri-list")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{e.focus(),n.remove(),es(e,n.value)},50)}(e),!1)};let as=null;Jr.copy=Jr.cut=(e,t)=>{if(!Tn(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:i,linewise:r}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let s=e.doc.lineAt(i);s.number>r&&(t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)})),r=s.number}i=!0}return{text:Zr(e,wi,t.join(e.lineBreak)),ranges:n,linewise:i}}(e.state);if(!n&&!r)return!1;as=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Xr?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout(()=>{i.remove(),e.focus()},50)}(e,n),!1)};const cs=lt.define();function hs(e,t){let n=[];for(let i of e.facet(xi)){let r=i(e,t);r&&n.push(r)}return n.length?e.update({effects:n,annotations:cs.of(!0)}):null}function us(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=hs(e.state,t);n?e.dispatch(n):e.update([])}},10)}Qr.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),us(e)},Qr.blur=e=>{e.observer.clearSelectionRange(),us(e)},Qr.compositionstart=Qr.compositionupdate=e=>{e.observer.editContext||(null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},Qr.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,un.chrome&&un.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},Qr.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},Jr.beforeinput=(e,t)=>{var n,i;if("insertText"!=t.inputType&&"insertCompositionText"!=t.inputType||(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),"insertReplacementText"==t.inputType&&e.observer.editContext){let i=null===(n=t.dataTransfer)||void 0===n?void 0:n.getData("text/plain"),r=t.getTargetRanges();if(i&&r.length){let t=r[0],n=e.posAtDOM(t.startContainer,t.startOffset),s=e.posAtDOM(t.endContainer,t.endOffset);return jr(e,{from:n,to:s,insert:e.state.toText(i)},null),!0}}let r;if(un.chrome&&un.android&&(r=$r.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(r.key,r.keyCode),"Backspace"==r.key||"Delete"==r.key)){let t=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0;setTimeout(()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return un.ios&&"deleteContentForward"==t.inputType&&e.observer.flushSoon(),un.safari&&"insertText"==t.inputType&&e.inputState.composing>=0&&setTimeout(()=>Qr.compositionend(e,t),20),!1};const ds=new Set,fs=["pre-wrap","normal","pre-line","break-spaces"];let ps=!1;function gs(){ps=!1}class ms{constructor(e){this.lineWrapping=e,this.doc=he.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return fs.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let i=e[n];i<0?n++:this.heightSamples[Math.floor(10*i)]||(t=!0,this.heightSamples[Math.floor(10*i)]=!0)}return t}refresh(e,t,n,i,r,s){let o=fs.indexOf(e)>-1,l=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,l){this.heightSamples={};for(let e=0;e<s.length;e++){let t=s[e];t<0?e++:this.heightSamples[Math.floor(10*t)]=!0}}return l}}class As{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class vs{constructor(e,t,n,i,r){this.from=e,this.length=t,this.top=n,this.height=i,this._content=r}get type(){return"number"==typeof this._content?vn.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof wn?this._content.widget:null}get widgetLineBreaks(){return"number"==typeof this._content?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new vs(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var bs=function(e){return e[e.ByPos=0]="ByPos",e[e.ByHeight=1]="ByHeight",e[e.ByPosNoHeight=2]="ByPosNoHeight",e}(bs||(bs={}));const xs=.001;class ys{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(2&this.flags)>0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>xs&&(ps=!0),this.height=e)}replace(e,t,n){return ys.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,s=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:l,toA:a,fromB:c,toB:h}=i[o],u=r.lineAt(l,bs.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=a?u:r.lineAt(a,bs.ByPosNoHeight,n,0,0);for(h+=d.to-a,a=d.to;o>0&&u.from<=i[o-1].toA;)l=i[o-1].fromA,c=i[o-1].fromB,o--,l<u.from&&(u=r.lineAt(l,bs.ByPosNoHeight,n,0,0));c+=u.from-l,l=u.from;let f=Os.build(n.setDoc(s),e,c,h);r=ws(r,r.replace(l,a,f))}return r.updateHeight(n,0)}static empty(){return new _s(0,0,0)}static of(e){if(1==e.length)return e[0];let t=0,n=e.length,i=0,r=0;for(;;)if(t==n)if(i>2*r){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,r-=t.size}}else if(i<r){let n=e[t++];n&&(i+=n.size)}else{let t=e[--n];t&&(r+=t.size)}let s=0;return null==e[t-1]?(s=1,t--):null==e[t]&&(s=1,n++),new Es(ys.of(e.slice(0,t)),s,ys.of(e.slice(n)))}}function ws(e,t){return e==t?e:(e.constructor!=t.constructor&&(ps=!0),t)}ys.prototype.size=1;const Cs=bn.replace({});class ks extends ys{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new vs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,i){return this.spaceAbove&&e<n+this.spaceAbove?new vs(i,0,n,this.spaceAbove,Cs):this.mainBlock(n,i)}lineAt(e,t,n,i,r){let s=this.mainBlock(i,r);return this.spaceAbove?this.blockAt(0,n,i,r).join(s):s}forEachLine(e,t,n,i,r,s){e<=r+this.length&&t>=r&&s(this.lineAt(0,bs.ByPos,n,i,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setMeasuredHeight(i),this.outdated=!1,this}toString(){return`block(${this.length})`}}class _s extends ks{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new vs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof _s||i instanceof Ss&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Ss?i=new _s(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):ys.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setMeasuredHeight(i):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Ss extends ys{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*s);n=t/s,this.length>s+1&&(o=(this.height-t)/(this.length-s-1))}else n=this.height/s;return{firstLine:i,lastLine:r,perLine:n,perChar:o}}blockAt(e,t,n,i){let{firstLine:r,lastLine:s,perLine:o,perChar:l}=this.heightMetrics(t,i);if(t.lineWrapping){let r=i+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),s=t.doc.lineAt(r),a=o+s.length*l,c=Math.max(n,e-a/2);return new vs(s.from,s.length,c,a,0)}{let i=Math.max(0,Math.min(s-r,Math.floor((e-n)/o))),{from:l,length:a}=t.doc.line(r+i);return new vs(l,a,n+o*i,o,0)}}lineAt(e,t,n,i,r){if(t==bs.ByHeight)return this.blockAt(e,n,i,r);if(t==bs.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new vs(t,i-t,0,0,0)}let{firstLine:s,perLine:o,perChar:l}=this.heightMetrics(n,r),a=n.doc.lineAt(e),c=o+a.length*l,h=a.number-s,u=i+o*h+l*(a.from-r-h);return new vs(a.from,a.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,r,s){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(n,r);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-o;h+=l*n+a*(e-r-n)}let i=l+a*t.length;s(new vs(t.from,t.length,h,i,0)),h+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof Ss?n[n.length-1]=new Ss(e.length+i):n.push(null,new Ss(i-1))}if(e>0){let t=n[0];t instanceof Ss?n[0]=new Ss(e+t.length):n.unshift(new Ss(e-1),null)}return ys.of(n)}decomposeLeft(e,t){t.push(new Ss(e-1),null)}decomposeRight(e,t){t.push(null,new Ss(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],s=Math.max(t,i.from),o=-1;for(i.from>t&&n.push(new Ss(i.from-t-1).updateHeight(e,t));s<=r&&i.more;){let t=e.doc.lineAt(s).length;n.length&&n.push(null);let r=i.heights[i.index++],l=0;r<0&&(l=-r,r=i.heights[i.index++]),-1==o?o=r:Math.abs(r-o)>=xs&&(o=-2);let a=new _s(t,r,l);a.outdated=!1,n.push(a),s+=t+1}s<=r&&n.push(null,new Ss(r-s).updateHeight(e,s));let l=ys.of(n);return(o<0||Math.abs(l.height-this.height)>=xs||Math.abs(o-this.heightMetrics(e,t).perLine)>=xs)&&(ps=!0),ws(this,l)}return(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Es extends ys{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let r=n+this.left.height;return e<r?this.left.blockAt(e,t,n,i):this.right.blockAt(e,t,r,i+this.left.length+this.break)}lineAt(e,t,n,i,r){let s=i+this.left.height,o=r+this.left.length+this.break,l=t==bs.ByHeight?e<s:e<o,a=l?this.left.lineAt(e,t,n,i,r):this.right.lineAt(e,t,n,s,o);if(this.break||(l?a.to<o:a.from>o))return a;let c=t==bs.ByPosNoHeight?bs.ByPosNoHeight:bs.ByPos;return l?a.join(this.right.lineAt(o,c,n,s,o)):this.left.lineAt(o,c,n,i,r).join(a)}forEachLine(e,t,n,i,r,s){let o=i+this.left.height,l=r+this.left.length+this.break;if(this.break)e<l&&this.left.forEachLine(e,t,n,i,r,s),t>=l&&this.right.forEachLine(e,t,n,o,l,s);else{let a=this.lineAt(l,bs.ByPos,n,i,r);e<a.from&&this.left.forEachLine(e,a.from-1,n,i,r,s),a.to>=e&&a.from<=t&&s(a),t>a.to&&this.right.forEachLine(a.to+1,t,n,o,l,s)}}replace(e,t,n){let i=this.left.length+this.break;if(t<i)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];e>0&&this.decomposeLeft(e,r);let s=r.length;for(let e of n)r.push(e);if(e>0&&Ts(r,s-1),t<this.length){let e=r.length;this.decomposeRight(t,r),Ts(r,e)}return ys.of(r)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<i&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?ys.of(this.break?[e,null,t]:[e,t]):(this.left=ws(this.left,e),this.right=ws(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:r,right:s}=this,o=t+r.length+this.break,l=null;return i&&i.from<=t+r.length&&i.more?l=r=r.updateHeight(e,t,n,i):r.updateHeight(e,t,n),i&&i.from<=o+s.length&&i.more?l=s=s.updateHeight(e,o,n,i):s.updateHeight(e,o,n),l?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ts(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof Ss&&(i=e[t+1])instanceof Ss&&e.splice(t-1,3,new Ss(n.length+1+i.length))}class Os{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof _s?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new _s(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let i=n.widget?n.widget.estimatedHeight:0,r=n.widget?n.widget.lineBreaks:0;i<0&&(i=this.oracle.lineHeight);let s=t-e;n.block?this.addBlock(new ks(s,i,n)):(s||r||i>=5)&&this.addLineDeco(i,r,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new _s(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Ss(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof _s)return e;let t=new _s(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof _s||this.isCovered?(this.writtenTo<this.pos||null==t)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new _s(0,-1,0));let n=e;for(let e of this.nodes)e instanceof _s&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(e,t,n,i){let r=new Os(n,e);return Tt.spans(t,n,i,r,0),r.finish(n)}}class Ms{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,i){(e<t||n&&n.heightRelevant||i&&i.heightRelevant)&&kn(e,t,this.changes,5)}}function Bs(e,t){let n=e.getBoundingClientRect(),i=e.ownerDocument,r=i.defaultView||window,s=Math.max(0,n.left),o=Math.min(r.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(r.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=i.body;)if(1==t.nodeType){let n=t,i=window.getComputedStyle(n);if((n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();s=Math.max(s,i.left),o=Math.min(o,i.right),l=Math.max(l,i.top),a=Math.min(t==e.parentNode?r.innerHeight:a,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:s-n.left,right:Math.max(s,o)-n.left,top:l-(n.top+t),bottom:Math.max(l,a)-(n.top+t)}}function Ds(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class Rs{constructor(e,t,n,i){this.from=e,this.to=t,this.size=n,this.displaySize=i}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let i=e[n],r=t[n];if(i.from!=r.from||i.to!=r.to||i.size!=r.size)return!1}return!0}draw(e,t){return bn.replace({widget:new Is(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Is extends An{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Ps{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=js,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Yn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Ni).some(e=>"function"!=typeof e&&"cm-lineWrapping"==e.class);this.heightOracle=new ms(n),this.stateDeco=zs(t),this.heightMap=ys.empty().applyChanges(this.stateDeco,he.empty,this.heightOracle.setDoc(t.doc),[new Ui(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=bn.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>i>=e&&i<=t)){let{from:t,to:n}=this.lineBlockAt(i);e.push(new Ns(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?js:new Vs(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Ws(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=zs(this.state);let i=e.changedRanges,r=Ui.extendWithRanges(i,function(e,t,n){let i=new Ms;return Tt.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:Ee.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);gs(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=s||ps)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=s);let l=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<l.from||t.range.head>l.to)||!this.viewportIsAppropriate(l))&&(l=this.getViewport(0,t));let a=l.from!=this.viewport.from||l.to!=this.viewport.to;this.viewport=l,e.flags|=this.updateForViewport(),(a||!e.changes.empty||2&e.flags)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(ki)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Yn.RTL:Yn.LTR;let s=this.heightOracle.mustRefreshForWrapping(r)||"refresh"===this.mustMeasureContent,o=t.getBoundingClientRect(),l=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let a=0,c=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=Ln(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,a|=16,s=l=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,a|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(l=!0),this.editorWidth=e.scrollDOM.clientWidth,a|=16);let d=Fn(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let f=this.getScrollOffset();this.scrollOffset!=f&&(this.scrollAnchorHeight=-1,this.scrollOffset=f),this.scrolledToBottom=$n(this.scrollParent||e.win);let p=(this.printing?Ds:Bs)(t,this.paddingTop),g=p.top-this.pixelViewport.top,m=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let A=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(A!=this.inView&&(this.inView=A,A&&(l=!0)),!this.inView&&!this.scrollTarget&&!function(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}(e.dom))return 0;let v=o.width;if(this.contentDOMWidth==v&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,a|=16),l){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(s=!0),s||i.lineWrapping&&Math.abs(v-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:o,textHeight:l}=e.docView.measureTextSize();s=n>0&&i.refresh(r,n,o,l,Math.max(5,v/o),t),s&&(e.docView.minWidth=0,a|=16)}g>0&&m>0?c=Math.max(g,m):g<0&&m<0&&(c=Math.min(g,m)),gs();for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(s?ys.empty().applyChanges(this.stateDeco,he.empty,this.heightOracle,[new Ui(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new As(n.from,r))}ps&&(a|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return b&&(2&a&&(a|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),a|=this.updateForViewport()),(2&a||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),a|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),a}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,l=new Ns(i.lineAt(s-1e3*n,bs.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),bs.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(e<l.from||e>l.to){let n,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(e,bs.ByPos,r,0,0);n="center"==t.y?(o.top+o.bottom)/2-s/2:"start"==t.y||"nearest"==t.y&&e<l.from?o.top:o.bottom-s,l=new Ns(i.lineAt(n-500,bs.ByHeight,r,0,0).from,i.lineAt(n+s+500,bs.ByHeight,r,0,0).to)}}return l}mapViewport(e,t){let n=t.mapPos(e.from,-1),i=t.mapPos(e.to,1);return new Ns(this.heightMap.lineAt(n,bs.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(i,bs.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:i}=this.heightMap.lineAt(e,bs.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,bs.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:o}=this;return(0==e||i<=s-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||r>=o+Math.max(10,Math.min(n,250)))&&i>s-2e3&&r<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let i of e)t.touchesRange(i.from,i.to)||n.push(new Rs(t.mapPos(i.from),t.mapPos(i.to),i.size,i.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,i=n?1e4:2e3,r=i>>1,s=i<<1;if(this.defaultTextDirection!=Yn.LTR&&!n)return[];let o=[],l=(i,s,a,c)=>{if(s-i<r)return;let h=this.state.selection.main,u=[h.from];h.empty||u.push(h.to);for(let e of u)if(e>i&&e<s)return l(i,e-10,a,c),void l(e+10,s,a,c);let d=function(e,t){for(let n of e)if(t(n))return n}(e,e=>e.from>=a.from&&e.to<=a.to&&Math.abs(e.from-i)<r&&Math.abs(e.to-s)<r&&!u.some(t=>e.from<t&&e.to>t));if(!d){if(s<a.to&&t&&n&&t.visibleRanges.some(e=>e.from<=s&&e.to>=s)){let e=t.moveToLineBoundary(Pe.cursor(s),!1,!0).head;e>i&&(s=e)}let e=this.gapSize(a,i,s,c);d=new Rs(i,s,e,n||e<2e6?e:2e6)}o.push(d)},a=t=>{if(t.length<s||t.type!=vn.Text)return;let r=function(e,t,n){let i=[],r=e,s=0;return Tt.spans(n,e,t,{span(){},point(e,t){e>r&&(i.push({from:r,to:e}),s+=e-r),r=t}},20),r<t&&(i.push({from:r,to:t}),s+=t-r),{total:s,ranges:i}}(t.from,t.to,this.stateDeco);if(r.total<s)return;let o,a,c=this.scrollTarget?this.scrollTarget.range.head:null;if(n){let e,n,s=i/this.heightOracle.lineLength*this.heightOracle.lineHeight;if(null!=c){let i=Fs(r,c),o=((this.visibleBottom-this.visibleTop)/2+s)/t.height;e=i-o,n=i+o}else e=(this.visibleTop-t.top-s)/t.height,n=(this.visibleBottom-t.top+s)/t.height;o=Ls(r,e),a=Ls(r,n)}else{let n=r.total*this.heightOracle.charWidth,s=i*this.heightOracle.charWidth,l=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+l<this.pixelViewport.left&&(l=n.size-n.displaySize);let h,u,d=this.pixelViewport.left+l,f=this.pixelViewport.right+l;if(null!=c){let e=Fs(r,c),t=((f-d)/2+s)/n;h=e-t,u=e+t}else h=(d-s)/n,u=(f+s)/n;o=Ls(r,h),a=Ls(r,u)}o>t.from&&l(t.from,o,t,r),a<t.to&&l(a,t.to,t,r)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(a):a(e);return o}gapSize(e,t,n,i){let r=Fs(i,n)-Fs(i,t);return this.heightOracle.lineWrapping?e.height*r:i.total*this.heightOracle.charWidth*r}updateLineGaps(e){Rs.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=bn.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Tt.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let i=0;if(n.length!=this.visibleRanges.length)i=12;else for(let t=0;t<n.length&&!(8&i);t++){let r=this.visibleRanges[t],s=n[t];r.from==s.from&&r.to==s.to||(i|=4,e&&e.mapPos(r.from,-1)==s.from&&e.mapPos(r.to,1)==s.to||(i|=8))}return this.visibleRanges=n,i}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ws(this.heightMap.lineAt(e,bs.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Ws(this.heightMap.lineAt(this.scaler.fromDOM(e),bs.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ws(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Ns{constructor(e,t){this.from=e,this.to=t}}function Ls({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:r}=t[e],s=r-n;if(i<=s)return n+i;i-=s}}function Fs(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}const js={toDOM:e=>e,fromDOM:e=>e,scale:1,eq(e){return e==this}};function zs(e){let t=e.facet(Li).filter(e=>"function"!=typeof e),n=e.facet(ji).filter(e=>"function"!=typeof e);return n.length&&t.push(Tt.join(n)),t}class Vs{constructor(e,t,n){let i=0,r=0,s=0;this.viewports=n.map(({from:n,to:r})=>{let s=t.lineAt(n,bs.ByPos,e,0,0).top,o=t.lineAt(r,bs.ByPos,e,0,0).bottom;return i+=o-s,{from:n,to:r,top:s,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=s+(e.top-r)*this.scale,s=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return i+(e-n)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);n=r.bottom,i=r.domBottom}}fromDOM(e){for(let t=0,n=0,i=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return n+(e-i)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);n=r.bottom,i=r.domBottom}}eq(e){return e instanceof Vs&&this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to)}}function Ws(e,t){if(1==t.scale)return e;let n=t.toDOM(e.top),i=t.toDOM(e.bottom);return new vs(e.from,e.length,n,i-n,Array.isArray(e._content)?e._content.map(e=>Ws(e,t)):e._content)}const Hs=Fe.define({combine:e=>e.join(" ")}),qs=Fe.define({combine:e=>e.indexOf(!0)>-1}),$s=qt.newName(),Us=qt.newName(),Ks=qt.newName(),Gs={"&light":"."+Us,"&dark":"."+Ks};function Ys(e,t,n){return new qt(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]}):e+" "+t})}const Js=Ys("."+$s,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Gs),Qs={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Xs=un.ie&&un.ie_version<=11;class Zs{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new jn,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let e of t)this.queue.push(e);(un.ie&&un.ie_version<=11||un.ios&&e.composing)&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),!window.EditContext||!un.android||!1===e.constructor.EDIT_CONTEXT||un.chrome&&un.chrome_version<126||(this.editContext=new no(e),e.state.facet(Mi)&&(e.contentDOM.editContext=this.editContext.editContext)),Xs&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver(()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){("change"!=e.type&&e.type||e.matches)&&(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(Mi)?n.root.activeElement!=this.dom:!Tn(this.dom,i))return;let r=i.anchorNode&&n.docView.tile.nearest(i.anchorNode);r&&r.isWidget()&&r.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(un.ie&&un.ie_version<=11||un.android&&un.chrome)&&!n.state.selection.main.empty&&i.focusNode&&Mn(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Sn(e.root);if(!t)return!1;let n=un.safari&&11==e.root.nodeType&&e.root.activeElement==this.dom&&function(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return to(e,n)}let n=null;function i(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener("beforeinput",i,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",i,!0),n?to(e,n):null}(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let i=Tn(this.dom,n);return i&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&function(e,t){let n=t.focusNode,i=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=i)return!1;for(i=Math.min(i,In(n));;)if(i){if(1!=n.nodeType)return!1;let e=n.childNodes[i-1];"false"==e.contentEditable?i--:(n=e,i=In(n))}else{if(n==e)return!0;i=Bn(n),n=n.parentNode}}(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),i&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(1==n.nodeType)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else{if(11!=n.nodeType)break;n=n.host}if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Qs),Xs&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Xs&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&qn(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(null===(n=this.delayedAndroidKey)||void 0===n?void 0:n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let r of e){let e=this.readMutation(r);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Tn(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Nr(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=Fr(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!Vr(this.view.state.selection,t.newSel.main))&&this.view.update([]),i}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty("attributes"==e.type),"childList"==e.type){let n=eo(t,e.previousSibling||e.target.previousSibling,-1),i=eo(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Mi)!=e.state.facet(Mi)&&(e.view.contentDOM.editContext=e.state.facet(Mi)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function eo(e,t,n){for(;t;){let i=Yi.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}function to(e,t){let n=t.startContainer,i=t.startOffset,r=t.endContainer,s=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return Mn(o.node,o.offset,r,s)&&([n,i,r,s]=[r,s,n,i]),{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}}class no{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let i=e.state.selection.main,{anchor:r,head:s}=i,o=this.toEditorPos(n.updateRangeStart),l=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let a=l-o>n.text.length;o==this.from&&r<this.from?o=r:l==this.to&&r>this.to&&(l=r);let c=zr(e.state.sliceDoc(o,l),n.text,(a?i.from:i.to)-o,a?"end":null);if(!c){let t=Pe.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));return void(Vr(t,i)||e.dispatch({selection:t,userEvent:"select"}))}let h={from:c.from+o,to:c.toA+o,insert:he.of(n.text.slice(c.from,c.toB).split("\n"))};if((un.mac||un.android)&&h.from==s-1&&/^\. ?$/.test(n.text)&&"off"==e.contentDOM.getAttribute("autocorrect")&&(h={from:o,to:l,insert:he.of([n.text.replace("."," ")])}),this.pendingContextChange=h,!e.state.readOnly){let t=this.to-this.from+(h.to-h.from+h.insert.length);jr(e,h,Pe.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),h.from<h.to&&!h.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let i=[],r=null;for(let t=this.toEditorPos(n.rangeStart),s=this.toEditorPos(n.rangeEnd);t<s;t++){let n=e.coordsForChar(t);r=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||r||new DOMRect,i.push(r)}t.updateCharacterBounds(n.rangeStart,i)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,i=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(i)){let r=this.toEditorPos(e.rangeStart),s=this.toEditorPos(e.rangeEnd);if(r<s){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+" ":"Dashed"==t?"dashed ":"Squiggle"==t?"wavy ":""}${/thin/i.test(i)?1:2}px`;n.push(bn.mark({attributes:{style:e}}).range(r,s))}}}e.dispatch({effects:Ti.of(bn.set(n))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=Sn(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,i=this.pendingContextChange;return e.changes.iterChanges((r,s,o,l,a)=>{if(n)return;let c=a.length-(s-r);if(i&&s>=i.to){if(i.from==r&&i.to==s&&i.insert.eq(a))return i=this.pendingContextChange=null,t+=c,void(this.to+=c);i=null,this.revertPending(e.state)}if(r+=t,(s+=t)<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||s>this.to||this.to-this.from+a.length>3e4)return void(n=!0);this.editContext.updateText(this.toContextPos(r),this.toContextPos(s),a.toString()),this.to+=c}t+=c}),i&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent("input.type")&&e.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):this.applyEdits(e)&&this.rangeIsValid(e.state)?(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state):(this.pendingContextChange=null,this.reset(e.state)),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),i=this.toContextPos(t.head);this.editContext.selectionStart==n&&this.editContext.selectionEnd==i||this.editContext.updateSelection(n,i)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class io{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(e=>e.forEach(e=>n(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new Ps(this,e.state||yt.create(e)),e.scrollTo&&e.scrollTo.is(Ei)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Di).map(e=>new Ii(e));for(let e of this.plugins)e.update(this);this.observer=new Zs(this),this.inputState=new Wr(this),this.inputState.ensureHandlers(this.plugins),this.docView=new vr(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),(null===(t=document.fonts)||void 0===t?void 0:t.ready)&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=1==e.length&&e[0]instanceof ut?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,l=null;e.some(e=>e.annotation(cs))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,l=hs(r,s),l||(o=1));let a=this.observer.delayedAndroidKey,c=null;if(a?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(yt.phrases)!=this.state.facet(yt.phrases))return this.setState(r);t=Ki.create(this,r,e),t.flags|=o;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Si(e.empty?e:Pe.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Ei)&&(h=e.value.clip(this.state))}this.viewState.update(t,h),this.bidiCache=oo.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet($i)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(e=>e.isUserEvent("select.pointer")))}finally{this.updateState=0}if(t.startState.facet(Hs)!=t.state.facet(Hs)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!t.empty)for(let e of this.state.facet(vi))try{e(t)}catch(e){Oi(this.state,e,"update listener")}(l||c)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),c&&!Fr(this,c)&&a.force&&qn(this.contentDOM,a.key,a.keyCode)})}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new Ps(this,e),this.plugins=e.facet(Di).map(e=>new Ii(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new vr(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Di),n=e.state.facet(Di);if(t!=n){let i=[];for(let r of n){let n=t.indexOf(r);if(n<0)i.push(new Ii(r));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){Oi(this.state,e,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,i=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollOffset)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(s<0)if($n(n||this.win))r=-1,s=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);r=e.from,s=e.top}this.updateState=1;let o=this.viewState.measure();if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let l=[];4&o||([this.measureRequests,l]=[l,this.measureRequests]);let a=l.map(e=>{try{return e.read(this)}catch(e){return Oi(this.state,e),so}}),c=Ki.create(this,this.state,[]),h=!1;c.flags|=o,t?t.flags|=o:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c),h&&this.docViewUpdate());for(let e=0;e<l.length;e++)if(a[e]!=so)try{let t=l[e];t.write&&t.write(a[e],this)}catch(e){Oi(this.state,e)}if(h&&this.docView.updateSelection(!0),!c.viewportChanged&&0==this.measureRequests.length){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,s=-1;continue}{let e=((r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-s)/this.scaleY;if((e>1||e<-1)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){i+=e,n?n.scrollTop+=e:this.win.scrollBy(0,e),s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(vi))e(t)}get themeClasses(){return $s+" "+(this.state.facet(qs)?Ks:Us)+" "+this.state.facet(Hs)}updateAttrs(){let e=lo(this,Pi,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Mi)?"true":"false",class:"cm-content",style:`${un.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),lo(this,Ni,t);let n=this.observer.ignore(()=>{let n=gn(this.contentDOM,this.contentAttrs,t),i=gn(this.dom,this.editorAttrs,e);return n||i});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)e.is(io.announce)&&(t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value)}mountStyles(){this.styleModules=this.state.facet($i);let e=this.state.facet(io.cspNonce);qt.mount(this.root,this.styleModules.concat(Js).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key)return void(this.measureRequests[t]=e);this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(void 0===t||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Er(this,e,kr(this,e,t,n))}moveByGroup(e,t){return Er(this,e,kr(this,e,t,t=>function(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return e=>{let t=i(e);return r==vt.Space&&(r=t),r==t}}(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),i=this.textDirectionAt(e.from),r=n[t?n.length-1:0];return Pe.cursor(r.side(t,i)+e.from,r.forward(!t,i)?1:-1)}moveToLineBoundary(e,t,n=!0){return function(e,t,n,i){let r=function(e,t,n){let i=e.lineBlockAt(t);if(Array.isArray(i.type)){let e;for(let r of i.type){if(r.from>t)break;if(!(r.to<t)){if(r.from<t&&r.to>t)return r;e&&(r.type!=vn.Text||e.type==r.type&&!(n<0?r.from<t:r.to>t))||(e=r)}}return e||i}return i}(e,t.head,t.assoc||-1),s=i&&r.type==vn.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(s){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(r.from),o=e.posAtCoords({x:n==(i==Yn.LTR)?t.right-1:t.left+1,y:(s.top+s.bottom)/2});if(null!=o)return Pe.cursor(o,n?-1:1)}return Pe.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return Er(this,e,function(e,t,n,i){let r=t.head,s=n?1:-1;if(r==(n?e.state.doc.length:0))return Pe.cursor(r,t.assoc);let o,l=t.goalColumn,a=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,(t.empty?t.assoc:0)||(n?1:-1)),h=e.documentTop;if(c)null==l&&(l=c.left-a.left),o=s<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==l&&(l=Math.min(a.right-a.left,e.defaultCharacterWidth*(r-t.from))),o=(s<0?t.top:t.bottom)+h}let u=Or(e,{x:a.left+l,y:o+(null!=i?i:e.viewState.heightOracle.textHeight>>1)*s},!1,s);return Pe.cursor(u.pos,u.assoc,void 0,l)}(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Or(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Or(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let i=this.state.doc.lineAt(e),r=this.bidiSpans(i);return Pn(n,r[si.find(r,e-i.from,-1,t)].dir==Yn.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Ci)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>ro)return hi(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||oi(i.isolates,t=Wi(this,e))))return i.order;t||(t=Wi(this,e));let i=function(e,t,n){if(!e)return[new si(0,0,t==Qn?1:0)];if(t==Jn&&!n.length&&!ri.test(e))return hi(e.length);if(n.length)for(;e.length>li.length;)li[li.length]=256;let i=[],r=t==Jn?0:1;return ci(e,r,r,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new oo(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||un.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Wn(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Ei.of(new Si("number"==typeof e?Pe.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Ei.of(new Si(Pe.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){null==e?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:"boolean"==typeof e?this.inputState.tabFocusMode=e?0:-1:0!=this.inputState.tabFocusMode&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ri.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ri.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=qt.newName(),i=[Hs.of(n),$i.of(Ys(`.${n}`,e))];return t&&t.dark&&i.push(qs.of(!0)),i}static baseTheme(e){return Ke.lowest($i.of(Ys("."+$s,e,Gs)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&Yi.get(n)||Yi.get(e);return(null===(t=null==i?void 0:i.root)||void 0===t?void 0:t.view)||null}}io.styleModule=$i,io.inputHandler=bi,io.clipboardInputFilter=yi,io.clipboardOutputFilter=wi,io.scrollHandler=_i,io.focusChangeEffect=xi,io.perLineTextDirection=Ci,io.exceptionSink=Ai,io.updateListener=vi,io.editable=Mi,io.mouseSelectionStyle=mi,io.dragMovesSelection=gi,io.clickAddsSelectionRange=pi,io.decorations=Li,io.blockWrappers=Fi,io.outerDecorations=ji,io.atomicRanges=zi,io.bidiIsolatedRanges=Vi,io.scrollMargins=Hi,io.darkTheme=qs,io.cspNonce=Fe.define({combine:e=>e.length?e[0]:""}),io.contentAttributes=Ni,io.editorAttributes=Pi,io.lineWrapping=io.contentAttributes.of({class:"cm-lineWrapping"}),io.announce=ht.define();const ro=4096,so={};class oo{constructor(e,t,n,i,r,s){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=s}static update(e,t){if(t.empty&&!e.some(e=>e.fresh))return e;let n=[],i=e.length?e[e.length-1].dir:Yn.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let s=e[r];s.dir!=i||t.touchesRange(s.from,s.to)||n.push(new oo(t.mapPos(s.from,1),t.mapPos(s.to,-1),s.dir,s.isolates,!1,s.order))}return n}}function lo(e,t,n){for(let i=e.state.facet(t),r=i.length-1;r>=0;r--){let t=i[r],s="function"==typeof t?t(e):t;s&&dn(s,n)}return n}const ao=un.mac?"mac":un.windows?"win":un.linux?"linux":"key";function co(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const ho=Ke.default(io.domEventHandlers({keydown:(e,t)=>function(e,t,n,i){mo=t;let r=function(e){var t=!(Yt&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Jt&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Gt:Kt)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),s=Ce(ye(r,0))==r.length&&" "!=r,o="",l=!1,a=!1,c=!1;po&&po.view==n&&po.scope==i&&(o=po.prefix+" ",Kr.indexOf(t.keyCode)<0&&(a=!0,po=null));let h,u,d=new Set,f=e=>{if(e){for(let t of e.run)if(!d.has(t)&&(d.add(t),t(n)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),a=!0)}return!1},p=e[i];return p&&(f(p[o+co(r,t,!s)])?l=!0:!s||!(t.altKey||t.metaKey||t.ctrlKey)||un.windows&&t.ctrlKey&&t.altKey||un.mac&&t.altKey&&!t.ctrlKey&&!t.metaKey||!(h=Kt[t.keyCode])||h==r?s&&t.shiftKey&&f(p[o+co(r,t,!0)])&&(l=!0):(f(p[o+co(h,t,!0)])||t.shiftKey&&(u=Gt[t.keyCode])!=r&&u!=h&&f(p[o+co(u,t,!1)]))&&(l=!0),!l&&f(p._any)&&(l=!0)),a&&(l=!0),l&&c&&t.stopPropagation(),mo=null,l}(function(e){let t=e.facet(uo),n=fo.get(t);return n||fo.set(t,n=function(e,t=ao){let n=Object.create(null),i=Object.create(null),r=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},s=(e,i,s,o,l)=>{var a,c;let h=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map(e=>function(e,t){const n=e.split(/-(?!$)/);let i,r,s,o,l=n[n.length-1];"Space"==l&&(l=" ");for(let e=0;e<n.length-1;++e){const l=n[e];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))i=!0;else if(/^(c|ctrl|control)$/i.test(l))r=!0;else if(/^s(hift)?$/i.test(l))s=!0;else{if(!/^mod$/i.test(l))throw new Error("Unrecognized modifier name: "+l);"mac"==t?o=!0:r=!0}}return i&&(l="Alt-"+l),r&&(l="Ctrl-"+l),o&&(l="Meta-"+l),s&&(l="Shift-"+l),l}(e,t));for(let t=1;t<u.length;t++){let n=u.slice(0,t).join(" ");r(n,!0),h[n]||(h[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let i=po={view:t,prefix:n,scope:e};return setTimeout(()=>{po==i&&(po=null)},go),!0}]})}let d=u.join(" ");r(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(a=h._any)||void 0===a?void 0:a.run)||void 0===c?void 0:c.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),l&&(f.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:r}=i;for(let t in e)e[t].run.push(e=>r(e,mo))}let r=i[t]||i.key;if(r)for(let t of e)s(t,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&s(t,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce((e,t)=>e.concat(t),[]))),n}(t.state),e,t,"editor")})),uo=Fe.define({enables:ho}),fo=new WeakMap;let po=null;const go=4e3;let mo=null;class Ao extends An{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild("string"==typeof this.content?document.createTextNode(this.content):"function"==typeof this.content?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?On(e.firstChild):[];if(!t.length)return null;let n=window.getComputedStyle(e.parentNode),i=Pn(t[0],"rtl"!=n.direction),r=parseInt(n.lineHeight);return i.bottom-i.top>1.5*r?{left:i.left,right:i.right,top:i.top,bottom:i.top+r}:i}ignoreEvent(){return!1}}function vo(e){let t=Ri.fromClass(class{constructor(t){this.view=t,this.placeholder=e?bn.set([bn.widget({widget:new Ao(e),side:1}).range(0)]):bn.none}get decorations(){return this.view.state.doc.length?bn.none:this.placeholder}},{decorations:e=>e.decorations});return"string"==typeof e?[t,io.contentAttributes.of({"aria-placeholder":e})]:t}const bo="-10000px";class xo{constructor(e,t,n,i){this.facet=t,this.createTooltipView=n,this.removeTooltipView=i,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let r=null;this.tooltipViews=this.tooltips.map(e=>r=n(e,r))}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter(e=>e);if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let s=[],o=t?[]:null;for(let n=0;n<r.length;n++){let i=r[n],l=-1;if(i){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==i.create&&(l=e)}if(l<0)s[n]=this.createTooltipView(i,n?s[n-1]:null),o&&(o[n]=!!i.above);else{let i=s[n]=this.tooltipViews[l];o&&(o[n]=t[l]),i.update&&i.update(e)}}}for(let e of this.tooltipViews)s.indexOf(e)<0&&(this.removeTooltipView(e),null===(n=e.destroy)||void 0===n||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=i,this.tooltips=r,this.tooltipViews=s,!0}}function yo(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const wo=Fe.define({combine:e=>{var t,n,i;return{position:un.ios?"absolute":(null===(t=e.find(e=>e.position))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find(e=>e.parent))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find(e=>e.tooltipSpace))||void 0===i?void 0:i.tooltipSpace)||yo}}}),Co=new WeakMap,ko=Ri.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(wo);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver="function"==typeof ResizeObserver?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new xo(e,To,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(wo);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),i=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=bo,n.dom.style.left="0px",this.container.insertBefore(n.dom,i),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),null===(n=this.intersectionObserver)||void 0===n||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(un.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||"absolute"==this.position)if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=qi(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(wo).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{visible:n,space:i,scaleX:r,scaleY:s}=e,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],c=this.manager.tooltipViews[l],{dom:h}=c,u=e.pos[l],d=e.size[l];if(!u||!1!==a.clip&&(u.bottom<=Math.max(n.top,i.top)||u.top>=Math.min(n.bottom,i.bottom)||u.right<Math.max(n.left,i.left)-.1||u.left>Math.min(n.right,i.right)+.1)){h.style.top=bo;continue}let f=a.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=d.right-d.left,m=null!==(t=Co.get(c))&&void 0!==t?t:d.bottom-d.top,A=c.offset||Eo,v=this.view.textDirection==Yn.LTR,b=d.width>i.right-i.left?v?i.left:i.right-d.width:v?Math.max(i.left,Math.min(u.left-(f?14:0)+A.x,i.right-g)):Math.min(Math.max(i.left,u.left-g+(f?14:0)-A.x),i.right-g),x=this.above[l];!a.strictSide&&(x?u.top-m-p-A.y<i.top:u.bottom+m+p+A.y>i.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[l]=!x);let y=(x?u.top-i.top:i.bottom-u.bottom)-p;if(y<m&&!1!==c.resize){if(y<this.view.defaultLineHeight){h.style.top=bo;continue}Co.set(c,m),h.style.height=(m=y)/s+"px"}else h.style.height&&(h.style.height="");let w=x?u.top-m-p-A.y:u.bottom+p+A.y,C=b+g;if(!0!==c.overlap)for(let e of o)e.left<C&&e.right>b&&e.top<w+m&&e.bottom>w&&(w=x?e.top-m-2-p:e.bottom+p+2);if("absolute"==this.position?(h.style.top=(w-e.parent.top)/s+"px",_o(h,(b-e.parent.left)/r)):(h.style.top=w/s+"px",_o(h,b/r)),f){let e=u.left+(v?A.x:-A.x)-(b+14-7);f.style.left=e/r+"px"}!0!==c.overlap&&o.push({left:b,top:w,right:C,bottom:w+m}),h.classList.toggle("cm-tooltip-above",x),h.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=bo}},{eventObservers:{scroll(){this.maybeMeasure()}}});function _o(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const So=io.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Eo={x:0,y:0},To=Fe.define({enables:[ko,So]}),Oo=Fe.define({combine:e=>e.reduce((e,t)=>e.concat(t),[])});class Mo{static create(e){return new Mo(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new xo(e,Oo,(e,t)=>this.createHostedView(e,t),e=>e.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let i=n[e];if(void 0!==i)if(void 0===t)t=i;else if(t!==i)return}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Bo=To.compute([Oo],e=>{let t=e.facet(Oo);return 0===t.length?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var t;return null!==(t=e.end)&&void 0!==t?t:e.pos})),create:Mo.create,above:t[0].above,arrow:t.some(e=>e.arrow)}});class Do{constructor(e,t,n,i,r){this.view=e,this.source=t,this.field=n,this.setHover=i,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let i,r=1;if(n.isWidget())i=n.posAtStart;else{if(i=e.posAtCoords(t),null==i)return;let n=e.coordsAtPos(i);if(!n||t.y<n.top||t.y>n.bottom||t.x<n.left-e.defaultCharacterWidth||t.x>n.right+e.defaultCharacterWidth)return;let s=e.bidiSpans(e.state.doc.lineAt(i)).find(e=>e.from<=i&&e.to>=i),o=s&&s.dir==Yn.RTL?-1:1;r=t.x<n.left?-o:o}let s=this.source(e,i,r);if(null==s?void 0:s.then){let t=this.pending={pos:i};s.then(n=>{this.pending==t&&(this.pending=null,!n||Array.isArray(n)&&!n.length||e.dispatch({effects:this.setHover.of(Array.isArray(n)?n:[n])}))},t=>Oi(e.state,t,"hover tooltip"))}else!s||Array.isArray(s)&&!s.length||e.dispatch({effects:this.setHover.of(Array.isArray(s)?s:[s])})}get tooltip(){let e=this.view.plugin(ko),t=e?e.manager.tooltips.findIndex(e=>e.create==Mo.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:r}=this;if(i.length&&r&&!function(e,t){let n,{left:i,right:r,top:s,bottom:o}=e.getBoundingClientRect();if(n=e.querySelector(".cm-tooltip-arrow")){let e=n.getBoundingClientRect();s=Math.min(e.top,s),o=Math.max(e.bottom,o)}return t.clientX>=i-Ro&&t.clientX<=r+Ro&&t.clientY>=s-Ro&&t.clientY<=o+Ro}(r.dom,e)||this.pending){let{pos:r}=i[0]||this.pending,s=null!==(n=null===(t=i[0])||void 0===t?void 0:t.end)&&void 0!==n?n:r;(r==s?this.view.posAtCoords(this.lastMove)==r:function(e,t,n,i,r){let s=e.scrollDOM.getBoundingClientRect(),o=e.documentTop+e.documentPadding.top+e.contentHeight;if(s.left>i||s.right<i||s.top>r||Math.min(s.bottom,o)<r)return!1;let l=e.posAtCoords({x:i,y:r},!1);return l>=t&&l<=n}(this.view,r,s,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:t}=this;t&&t.dom.contains(e.relatedTarget)?this.watchTooltipLeave(t.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ro=4;function Io(e,t={}){let n=ht.define(),i=$e.define({create:()=>[],update(e,i){if(e.length&&(t.hideOnChange&&(i.docChanged||i.selection)?e=[]:t.hideOn&&(e=e.filter(e=>!t.hideOn(i,e))),i.docChanged)){let t=[];for(let n of e){let e=i.changes.mapPos(n.pos,-1,_e.TrackDel);if(null!=e){let r=Object.assign(Object.create(null),n);r.pos=e,null!=r.end&&(r.end=i.changes.mapPos(r.end)),t.push(r)}}e=t}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(No)&&(e=[]);return e},provide:e=>Oo.from(e)});return{active:i,extension:[i,Ri.define(r=>new Do(r,e,i,n,t.hoverTime||300)),Bo]}}function Po(e,t){let n=e.plugin(ko);if(!n)return null;let i=n.manager.tooltips.indexOf(t);return i<0?null:n.manager.tooltipViews[i]}const No=ht.define(),Lo=Fe.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}}),Fo=Ri.fromClass(class{constructor(e){this.input=e.state.facet(Vo),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(Lo);this.top=new jo(e,!0,t.topContainer),this.bottom=new jo(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Lo);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new jo(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new jo(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Vo);if(n!=this.input){let t=n.filter(e=>e),i=[],r=[],s=[],o=[];for(let n of t){let t,l=this.specs.indexOf(n);l<0?(t=n(e.view),o.push(t)):(t=this.panels[l],t.update&&t.update(e)),i.push(t),(t.top?r:s).push(t)}this.specs=t,this.panels=i,this.top.sync(r),this.bottom.sync(s);for(let e of o)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>io.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class jo{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=zo(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=zo(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function zo(e){let t=e.nextSibling;return e.remove(),t}const Vo=Fe.define({enables:Fo});class Wo extends Ct{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Wo.prototype.elementClass="",Wo.prototype.toDOM=void 0,Wo.prototype.mapMode=_e.TrackBefore,Wo.prototype.startSide=Wo.prototype.endSide=-1,Wo.prototype.point=!0;const Ho=Fe.define(),qo=Fe.define(),$o={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Tt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Uo=Fe.define();function Ko(e){return[Yo(),Uo.of({...$o,...e})]}const Go=Fe.define({combine:e=>e.some(e=>e)});function Yo(e){let t=[Jo];return e&&!1===e.fixed&&t.push(Go.of(!0)),t}const Jo=Ri.fromClass(class{constructor(e){this.view=e,this.domAfter=null,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Uo).map(t=>new el(e,t)),this.fixed=!e.state.facet(Go);for(let e of this.gutters)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}if(e.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(Go)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=Tt.iter(this.view.state.facet(Ho),this.view.viewport.from),i=[],r=this.gutters.map(e=>new Zo(e,this.view.viewport,-this.view.documentPadding.top));for(let e of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(e.type)){let t=!0;for(let s of e.type)if(s.type==vn.Text&&t){Xo(n,i,s.from);for(let e of r)e.line(this.view,s,i);t=!1}else if(s.widget)for(let e of r)e.widget(this.view,s)}else if(e.type==vn.Text){Xo(n,i,e.from);for(let t of r)t.line(this.view,e,i)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&(this.view.scrollDOM.insertBefore(this.dom,t),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(e){let t=e.startState.facet(Uo),n=e.state.facet(Uo),i=e.docChanged||e.heightChanged||e.viewportChanged||!Tt.eq(e.startState.facet(Ho),e.state.facet(Ho),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(i=!0);else{i=!0;let r=[];for(let i of n){let n=t.indexOf(i);n<0?r.push(new el(this.view,i)):(this.gutters[n].update(e),r.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),r.indexOf(e)<0&&e.destroy();for(let e of r)"after"==e.config.side?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.gutters=r}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:e=>io.scrollMargins.of(t=>{let n=t.plugin(e);if(!n||0==n.gutters.length||!n.fixed)return null;let i=n.dom.offsetWidth*t.scaleX,r=n.domAfter?n.domAfter.offsetWidth*t.scaleX:0;return t.textDirection==Yn.LTR?{left:i,right:r}:{right:i,left:r}})});function Qo(e){return Array.isArray(e)?e:[e]}function Xo(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class Zo{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Tt.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,r=(t.top-this.height)/e.scaleY,s=t.height/e.scaleY;if(this.i==i.elements.length){let t=new tl(e,s,r,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,s,r,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];Xo(this.cursor,i,t.from),n.length&&(i=i.concat(n));let r=this.gutter.config.lineMarker(e,t,i);r&&i.unshift(r);let s=this.gutter;(0!=i.length||s.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),i=n?[n]:null;for(let n of e.state.facet(qo)){let r=n(e,t.widget,t);r&&(i||(i=[])).push(r)}i&&this.addElement(e,t,i)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class el{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,i=>{let r,s=i.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let e=s.getBoundingClientRect();r=(e.top+e.bottom)/2}else r=i.clientY;let o=e.lineBlockAtHeight(r-e.documentTop);t.domEventHandlers[n](e,o,i)&&i.preventDefault()});this.markers=Qo(t.markers(e)),t.initialSpacer&&(this.spacer=new tl(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Qo(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!Tt.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class tl{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}(this.markers,i)||this.setMarkers(e,i)}setMarkers(e,t){let n="cm-gutterElement",i=this.dom.firstChild;for(let r=0,s=0;;){let o=s,l=r<t.length?t[r++]:null,a=!1;if(l){let e=l.elementClass;e&&(n+=" "+e);for(let e=s;e<this.markers.length;e++)if(this.markers[e].compare(l)){o=e,a=!0;break}}else o=this.markers.length;for(;s<o;){let e=this.markers[s++];if(e.toDOM){e.destroy(i);let t=i.nextSibling;i.remove(),i=t}}if(!l)break;l.toDOM&&(a?i=i.nextSibling:this.dom.insertBefore(l.toDOM(e),i)),a&&s++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}const nl=1024;let il=0;class rl{constructor(e,t){this.from=e,this.to=t}}class sl{constructor(e={}){this.id=il++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=al.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}sl.closedBy=new sl({deserialize:e=>e.split(" ")}),sl.openedBy=new sl({deserialize:e=>e.split(" ")}),sl.group=new sl({deserialize:e=>e.split(" ")}),sl.isolate=new sl({deserialize:e=>{if(e&&"rtl"!=e&&"ltr"!=e&&"auto"!=e)throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}}),sl.contextHash=new sl({perNode:!0}),sl.lookAhead=new sl({perNode:!0}),sl.mounted=new sl({perNode:!0});class ol{constructor(e,t,n,i=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=i}static get(e){return e&&e.props&&e.props[sl.mounted.id]}}const ll=Object.create(null);class al{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):ll,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new al(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(sl.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(sl.group),i=-1;i<(n?n.length:0);i++){let r=t[i<0?e.name:n[i]];if(r)return r}}}}al.none=new al("",Object.create(null),0,8);class cl{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let i=null;for(let t of e){let e=t(n);if(e){i||(i=Object.assign({},n.props));let t=e[1],r=e[0];r.combine&&r.id in i&&(t=r.combine(i[r.id],t)),i[r.id]=t}}t.push(i?new al(n.name,i,n.id,n.flags):n)}return new cl(t)}}const hl=new WeakMap,ul=new WeakMap;var dl;!function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays",e[e.EnterBracketed=16]="EnterBracketed"}(dl||(dl={}));class fl{constructor(e,t,n,i,r){if(this.type=e,this.children=t,this.positions=n,this.length=i,this.props=null,r&&r.length){this.props=Object.create(null);for(let[e,t]of r)this.props["number"==typeof e?e:e.id]=t}}toString(){let e=ol.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let e of this.children){let n=e.toString();n&&(t&&(t+=","),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Sl(this.topNode,e)}cursorAt(e,t=0,n=0){let i=hl.get(this)||this.topNode,r=new Sl(i);return r.moveTo(e,t),hl.set(this,r._tree),r}get topNode(){return new bl(this,0,0,null)}resolve(e,t=0){let n=Al(hl.get(this)||this.topNode,e,t,!1);return hl.set(this,n),n}resolveInner(e,t=0){let n=Al(ul.get(this)||this.topNode,e,t,!0);return ul.set(this,n),n}resolveStack(e,t=0){return function(e,t,n){let i=e.resolveInner(t,n),r=null;for(let e=i instanceof bl?i:i.context.parent;e;e=e.parent)if(e.index<0){let s=e.parent;(r||(r=[i])).push(s.resolve(t,n)),e=s}else{let s=ol.get(e.tree);if(s&&s.overlay&&s.overlay[0].from<=t&&s.overlay[s.overlay.length-1].to>=t){let o=new bl(s.tree,s.overlay[0].from+e.from,-1,e);(r||(r=[i])).push(Al(o,t,n,!1))}}return r?kl(r):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,s=e.mode||0,o=(s&dl.IncludeAnonymous)>0;for(let e=this.cursor(s|dl.IncludeAnonymous);;){let s=!1;if(e.from<=r&&e.to>=i&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Ml(al.none,this.children,this.positions,0,this.children.length,0,this.length,(e,t,n)=>new fl(this.type,e,t,n,this.propValues),e.makeTree||((e,t,n)=>new fl(al.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=nl,reused:s=[],minRepeatType:o=i.types.length}=e,l=Array.isArray(n)?new pl(n,n.length):n,a=i.types,c=0,h=0;function u(e,t,n,m,A,v){let{id:b,start:x,end:y,size:w}=l,C=h,k=c;if(w<0){if(l.next(),-1==w){let t=s[b];return n.push(t),void m.push(x-e)}if(-3==w)return void(c=b);if(-4==w)return void(h=b);throw new RangeError(`Unrecognized record size: ${w}`)}let _,S,E=a[b],T=x-e;if(y-x<=r&&(S=function(e,t){let n=l.fork(),i=0,s=0,a=0,c=n.end-r,h={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){h.size=i,h.start=s,h.skip=a,a+=4,i+=4,n.next();continue}let l=n.pos-e;if(e<0||l<r||n.start<c)break;let u=n.id>=o?4:0,d=n.start;for(n.next();n.pos>l;){if(n.size<0){if(-3!=n.size&&-4!=n.size)break e;u+=4}else n.id>=o&&(u+=4);n.next()}s=d,i+=e,a+=u}return(t<0||i==e)&&(h.size=i,h.start=s,h.skip=a),h.size>4?h:void 0}(l.pos-t,A))){let t=new Uint16Array(S.size-S.skip),n=l.pos-S.size,r=t.length;for(;l.pos>n;)r=g(S.start,t,r);_=new gl(t,y-S.start,i),T=S.start-e}else{let e=l.pos-w;l.next();let t=[],n=[],i=b>=o?b:-1,s=0,a=y;for(;l.pos>e;)i>=0&&l.id==i&&l.size>=0?(l.end<=a-r&&(f(t,n,x,s,l.end,a,i,C,k),s=t.length,a=l.end),l.next()):v>2500?d(x,e,t,n):u(x,e,t,n,i,v+1);if(i>=0&&s>0&&s<t.length&&f(t,n,x,s,x,a,i,C,k),t.reverse(),n.reverse(),i>-1&&s>0){let e=function(e,t){return(n,i,r)=>{let s,o,l=0,a=n.length-1;if(a>=0&&(s=n[a])instanceof fl){if(!a&&s.type==e&&s.length==r)return s;(o=s.prop(sl.lookAhead))&&(l=i[a]+s.length+o)}return p(e,n,i,r,l,t)}}(E,k);_=Ml(E,t,n,0,t.length,0,y-x,e,e)}else _=p(E,t,n,y-x,C-y,k)}n.push(_),m.push(T)}function d(e,t,n,s){let o=[],a=0,c=-1;for(;l.pos>t;){let{id:e,start:t,end:n,size:i}=l;if(i>4)l.next();else{if(c>-1&&t<c)break;c<0&&(c=n-r),o.push(e,t,n),a++,l.next()}}if(a){let t=new Uint16Array(4*a),r=o[o.length-2];for(let e=o.length-3,n=0;e>=0;e-=3)t[n++]=o[e],t[n++]=o[e+1]-r,t[n++]=o[e+2]-r,t[n++]=n;n.push(new gl(t,o[2]-r,i)),s.push(r-e)}}function f(e,t,n,r,s,o,l,a,c){let h=[],u=[];for(;e.length>r;)h.push(e.pop()),u.push(t.pop()+n-s);e.push(p(i.types[l],h,u,o-s,a-o,c)),t.push(s-n)}function p(e,t,n,i,r,s,o){if(s){let e=[sl.contextHash,s];o=o?[e].concat(o):[e]}if(r>25){let e=[sl.lookAhead,r];o=o?[e].concat(o):[e]}return new fl(e,t,n,i,o)}function g(e,t,n){let{id:i,start:r,end:s,size:a}=l;if(l.next(),a>=0&&i<o){let o=n;if(a>4){let i=l.pos-(a-4);for(;l.pos>i;)n=g(e,t,n)}t[--n]=o,t[--n]=s-e,t[--n]=r-e,t[--n]=i}else-3==a?c=i:-4==a&&(h=i);return n}let m=[],A=[];for(;l.pos>0;)u(e.start||0,e.bufferStart||0,m,A,-1,0);let v=null!==(t=e.length)&&void 0!==t?t:m.length?A[0]+m[0].length:0;return new fl(a[e.topID],m.reverse(),A.reverse(),v)}(e)}}fl.empty=new fl(al.none,[],[],0);class pl{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new pl(this.buffer,this.index)}}class gl{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return al.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],i=this.set.types[t],r=i.name;if(/\W/.test(r)&&!i.isError&&(r=JSON.stringify(r)),n==(e+=4))return r;let s=[];for(;e<n;)s.push(this.childString(e)),e=this.buffer[e+3];return r+"("+s.join(",")+")"}findChild(e,t,n,i,r){let{buffer:s}=this,o=-1;for(let l=e;l!=t&&!(ml(r,i,s[l+1],s[l+2])&&(o=l,n>0));l=s[l+3]);return o}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),s=0;for(let o=e,l=0;o<t;){r[l++]=i[o++],r[l++]=i[o++]-n;let t=r[l++]=i[o++]-n;r[l++]=i[o++]-e,s=Math.max(s,t)}return new gl(r,s,this.set)}}function ml(e,t,n,i){switch(e){case-2:return n<t;case-1:return i>=t&&n<t;case 0:return n<t&&i>t;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function Al(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!i&&e instanceof bl&&e.index<0?null:e.parent;if(!t)return e;e=t}let s=i?0:dl.IgnoreOverlays;if(i)for(let i=e,o=i.parent;o;i=o,o=i.parent)i instanceof bl&&i.index<0&&(null===(r=o.enter(t,n,s))||void 0===r?void 0:r.from)!=i.from&&(e=o);for(;;){let i=e.enter(t,n,s);if(!i)return e;e=i}}class vl{cursor(e=0){return new Sl(this,e)}getChild(e,t=null,n=null){let i=xl(this,e,t,n);return i.length?i[0]:null}getChildren(e,t=null,n=null){return xl(this,e,t,n)}resolve(e,t=0){return Al(this,e,t,!1)}resolveInner(e,t=0){return Al(this,e,t,!0)}matchContext(e){return yl(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}}class bl extends vl{constructor(e,t,n,i){super(),this._tree=e,this.from=t,this.index=n,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,i,r=0){for(let s=this;;){for(let{children:o,positions:l}=s._tree,a=t>0?o.length:-1;e!=a;e+=t){let a,c=o[e],h=l[e]+s.from;if(r&dl.EnterBracketed&&c instanceof fl&&(a=ol.get(c))&&!a.overlay&&a.bracketed&&n>=h&&n<=h+c.length||ml(i,n,h,h+c.length))if(c instanceof gl){if(r&dl.ExcludeBuffers)continue;let o=c.findChild(0,c.buffer.length,t,n-h,i);if(o>-1)return new Cl(new wl(s,c,e,h),null,o)}else if(r&dl.IncludeAnonymous||!c.type.isAnonymous||El(c)){let o;if(!(r&dl.IgnoreMounts)&&(o=ol.get(c))&&!o.overlay)return new bl(o.tree,h,e,s);let l=new bl(c,h,e,s);return r&dl.IncludeAnonymous||!l.type.isAnonymous?l:l.nextChild(t<0?c.children.length-1:0,t,n,i,r)}}if(r&dl.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let i;if(!(n&dl.IgnoreOverlays)&&(i=ol.get(this._tree))&&i.overlay){let r=e-this.from,s=n&dl.EnterBracketed&&i.bracketed;for(let{from:e,to:n}of i.overlay)if((t>0||s?e<=r:e<r)&&(t<0||s?n>=r:n>r))return new bl(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function xl(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(null!=n)for(let e=!1;!e;)if(e=r.type.is(n),!r.nextSibling())return s;for(;;){if(null!=i&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return null==i?s:[]}}function yl(e,t,n=t.length-1){for(let i=e;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class wl{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class Cl extends vl{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new Cl(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&dl.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Cl(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Cl(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Cl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let s=n.buffer[this.index+1];e.push(n.slice(i,r,s)),t.push(0)}return new fl(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function kl(e){if(!e.length)return null;let t=0,n=e[0];for(let i=1;i<e.length;i++){let r=e[i];(r.from>n.from||r.to<n.to)&&(n=r,t=i)}let i=n instanceof bl&&n.index<0?null:n.parent,r=e.slice();return i?r[t]=i:r.splice(t,1),new _l(r,n)}class _l{constructor(e,t){this.heads=e,this.node=t}get next(){return kl(this.heads)}}class Sl{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~dl.EnterBracketed,e instanceof bl)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return!!e&&(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0)}yieldBuf(e,t){this.index=e;let{start:n,buffer:i}=this.buffer;return this.type=t||i.set.types[i.buffer[e]],this.from=n+i.buffer[e+1],this.to=n+i.buffer[e+2],!0}yield(e){return!!e&&(e instanceof bl?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)))}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:i}=this.buffer,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.buffer.start,n);return!(r<0)&&(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?!(n&dl.ExcludeBuffers)&&this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&dl.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&dl.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return!!this._tree._parent&&this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode));let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:i}=this;if(i){if(e>0){if(this.index<i.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(i.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=i)}else({index:t,_parent:n}=this._tree);for(;n;({index:t,_parent:n}=n))if(t>-1)for(let i=t+e,r=e<0?-1:n._tree.children.length;i!=r;i+=e){let e=n._tree.children[i];if(this.mode&dl.IncludeAnonymous||e instanceof gl||!e.type.isAnonymous||El(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let i=this.index,r=this.stack.length;r>=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,n=r+1;break e}i=this.stack[--r]}for(let e=n;e<this.stack.length;e++)t=new Cl(this.buffer,t,this.stack[e]);return this.bufferNode=new Cl(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let i=!1;if(this.type.isAnonymous||!1!==e(this)){if(this.firstChild()){n++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&t&&t(this),i=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,i=!0}}}matchContext(e){if(!this.buffer)return yl(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let i=e.length-1,r=this.stack.length-1;i>=0;r--){if(r<0)return yl(this._tree,e,i);let s=n[t.buffer[this.stack[r]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function El(e){return e.children.some(e=>e instanceof gl||!e.type.isAnonymous||El(e))}const Tl=new WeakMap;function Ol(e,t){if(!e.isAnonymous||t instanceof gl||t.type!=e)return 1;let n=Tl.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof fl)){n=1;break}n+=Ol(e,i)}Tl.set(t,n)}return n}function Ml(e,t,n,i,r,s,o,l,a){let c=0;for(let n=i;n<r;n++)c+=Ol(e,t[n]);let h=Math.ceil(1.5*c/8),u=[],d=[];return function t(n,i,r,o,l){for(let c=r;c<o;){let r=c,f=i[c],p=Ol(e,n[c]);for(c++;c<o;c++){let t=Ol(e,n[c]);if(p+t>=h)break;p+=t}if(c==r+1){if(p>h){let e=n[r];t(e.children,e.positions,0,e.children.length,i[r]+l);continue}u.push(n[r])}else{let t=i[c-1]+n[c-1].length-f;u.push(Ml(e,n,i,r,c,f,t,null,a))}d.push(f+l-s)}}(t,n,i,r,0),(l||a)(u,d,o)}class Bl{constructor(e,t,n,i,r=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new Bl(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,s=e.length?e[0]:null;for(let o=0,l=0,a=0;;o++){let c=o<t.length?t[o]:null,h=c?c.fromA:1e9;if(h-l>=n)for(;s&&s.from<h;){let t=s;if(l>=t.from||h<=t.to||a){let e=Math.max(t.from,l)-a,n=Math.min(t.to,h)-a;t=e>=n?null:new Bl(e,n,t.tree,t.offset+a,o>0,!!c)}if(t&&i.push(t),s.to>h)break;s=r<e.length?e[r++]:null}if(!c)break;l=c.toA,a=c.toA-c.toB}return i}}class Dl{startParse(e,t,n){return"string"==typeof e&&(e=new Rl(e)),n=n?n.length?n.map(e=>new rl(e.from,e.to)):[new rl(0,0)]:[new rl(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class Rl{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new sl({perNode:!0});let Il=0;class Pl{constructor(e,t,n,i){this.name=e,this.set=t,this.base=n,this.modified=i,this.id=Il++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n="string"==typeof e?e:"?";if(e instanceof Pl&&(t=e),null==t?void 0:t.base)throw new Error("Can not derive from a modified tag");let i=new Pl(n,[],null,[]);if(i.set.push(i),t)for(let e of t.set)i.set.push(e);return i}static defineModifier(e){let t=new Ll(e);return e=>e.modified.indexOf(t)>-1?e:Ll.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}}let Nl=0;class Ll{constructor(e){this.name=e,this.instances=[],this.id=Nl++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(n=>{return n.base==e&&(i=t,r=n.modified,i.length==r.length&&i.every((e,t)=>e==r[t]));var i,r});if(n)return n;let i=[],r=new Pl(e.name,i,e,t);for(let e of t)e.instances.push(r);let s=function(e){let t=[[]];for(let n=0;n<e.length;n++)for(let i=0,r=t.length;i<r;i++)t.push(t[i].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)i.push(Ll.get(t,e));return r}}function Fl(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],r=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);s=e.slice(t)}let o=n.length-1,l=n[o];if(!l)throw new RangeError("Invalid path: "+e);let a=new zl(i,r,o>0?n.slice(0,o):null);t[l]=a.sort(t[l])}}return jl.add(t)}const jl=new sl({combine(e,t){let n,i,r;for(;e||t;){if(!e||t&&e.depth>=t.depth?(r=t,t=t.next):(r=e,e=e.next),n&&n.mode==r.mode&&!r.context&&!n.context)continue;let s=new zl(r.tags,r.mode,r.context);n?n.next=s:i=s,n=s}return i}});class zl{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}function Vl(e,t){let n=Object.create(null);for(let t of e)if(Array.isArray(t.tag))for(let e of t.tag)n[e.id]=t.class;else n[t.tag.id]=t.class;let{scope:i,all:r=null}=t||{};return{style:e=>{let t=r;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function Wl(e,t,n,i=0,r=e.length){let s=new Hl(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}zl.empty=new zl([],2,null);class Hl{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,r){let{type:s,from:o,to:l}=e;if(o>=n||l<=t)return;s.isTop&&(r=this.highlighters.filter(e=>!e.scope||e.scope(s)));let a=i,c=function(e){let t=e.type.prop(jl);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||zl.empty,h=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(h&&(a&&(a+=" "),a+=h,1==c.mode&&(i+=(i?" ":"")+h)),this.startSpan(Math.max(t,o),a),c.opaque)return;let u=e.tree&&e.tree.prop(sl.mounted);if(u&&u.overlay){let s=e.node.enter(u.overlay[0].from+o,1),c=this.highlighters.filter(e=>!e.scope||e.scope(u.tree.type)),h=e.firstChild();for(let d=0,f=o;;d++){let p=d<u.overlay.length?u.overlay[d]:null,g=p?p.from+o:l,m=Math.max(t,f),A=Math.min(n,g);if(m<A&&h)for(;e.from<A&&(this.highlightRange(e,m,A,i,r),this.startSpan(Math.min(A,e.to),a),!(e.to>=g)&&e.nextSibling()););if(!p||g>n)break;f=p.to+o,f>t&&(this.highlightRange(s.cursor(),Math.max(t,p.from+o),Math.min(n,f),"",c),this.startSpan(Math.min(n,f),a))}h&&e.parent()}else if(e.firstChild()){u&&(i="");do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,r),this.startSpan(Math.min(n,e.to),a)}}while(e.nextSibling());e.parent()}}}const ql=Pl.define,$l=ql(),Ul=ql(),Kl=ql(Ul),Gl=ql(Ul),Yl=ql(),Jl=ql(Yl),Ql=ql(Yl),Xl=ql(),Zl=ql(Xl),ea=ql(),ta=ql(),na=ql(),ia=ql(na),ra=ql(),sa={comment:$l,lineComment:ql($l),blockComment:ql($l),docComment:ql($l),name:Ul,variableName:ql(Ul),typeName:Kl,tagName:ql(Kl),propertyName:Gl,attributeName:ql(Gl),className:ql(Ul),labelName:ql(Ul),namespace:ql(Ul),macroName:ql(Ul),literal:Yl,string:Jl,docString:ql(Jl),character:ql(Jl),attributeValue:ql(Jl),number:Ql,integer:ql(Ql),float:ql(Ql),bool:ql(Yl),regexp:ql(Yl),escape:ql(Yl),color:ql(Yl),url:ql(Yl),keyword:ea,self:ql(ea),null:ql(ea),atom:ql(ea),unit:ql(ea),modifier:ql(ea),operatorKeyword:ql(ea),controlKeyword:ql(ea),definitionKeyword:ql(ea),moduleKeyword:ql(ea),operator:ta,derefOperator:ql(ta),arithmeticOperator:ql(ta),logicOperator:ql(ta),bitwiseOperator:ql(ta),compareOperator:ql(ta),updateOperator:ql(ta),definitionOperator:ql(ta),typeOperator:ql(ta),controlOperator:ql(ta),punctuation:na,separator:ql(na),bracket:ia,angleBracket:ql(ia),squareBracket:ql(ia),paren:ql(ia),brace:ql(ia),content:Xl,heading:Zl,heading1:ql(Zl),heading2:ql(Zl),heading3:ql(Zl),heading4:ql(Zl),heading5:ql(Zl),heading6:ql(Zl),contentSeparator:ql(Xl),list:ql(Xl),quote:ql(Xl),emphasis:ql(Xl),strong:ql(Xl),link:ql(Xl),monospace:ql(Xl),strikethrough:ql(Xl),inserted:ql(),deleted:ql(),changed:ql(),invalid:ql(),meta:ra,documentMeta:ql(ra),annotation:ql(ra),processingInstruction:ql(ra),definition:Pl.defineModifier("definition"),constant:Pl.defineModifier("constant"),function:Pl.defineModifier("function"),standard:Pl.defineModifier("standard"),local:Pl.defineModifier("local"),special:Pl.defineModifier("special")};for(let e in sa){let t=sa[e];t instanceof Pl&&(t.name=e)}var oa;Vl([{tag:sa.link,class:"tok-link"},{tag:sa.heading,class:"tok-heading"},{tag:sa.emphasis,class:"tok-emphasis"},{tag:sa.strong,class:"tok-strong"},{tag:sa.keyword,class:"tok-keyword"},{tag:sa.atom,class:"tok-atom"},{tag:sa.bool,class:"tok-bool"},{tag:sa.url,class:"tok-url"},{tag:sa.labelName,class:"tok-labelName"},{tag:sa.inserted,class:"tok-inserted"},{tag:sa.deleted,class:"tok-deleted"},{tag:sa.literal,class:"tok-literal"},{tag:sa.string,class:"tok-string"},{tag:sa.number,class:"tok-number"},{tag:[sa.regexp,sa.escape,sa.special(sa.string)],class:"tok-string2"},{tag:sa.variableName,class:"tok-variableName"},{tag:sa.local(sa.variableName),class:"tok-variableName tok-local"},{tag:sa.definition(sa.variableName),class:"tok-variableName tok-definition"},{tag:sa.special(sa.variableName),class:"tok-variableName2"},{tag:sa.definition(sa.propertyName),class:"tok-propertyName tok-definition"},{tag:sa.typeName,class:"tok-typeName"},{tag:sa.namespace,class:"tok-namespace"},{tag:sa.className,class:"tok-className"},{tag:sa.macroName,class:"tok-macroName"},{tag:sa.propertyName,class:"tok-propertyName"},{tag:sa.operator,class:"tok-operator"},{tag:sa.comment,class:"tok-comment"},{tag:sa.meta,class:"tok-meta"},{tag:sa.invalid,class:"tok-invalid"},{tag:sa.punctuation,class:"tok-punctuation"}]);const la=new sl;const aa=new sl;class ca{constructor(e,t,n=[],i=""){this.data=e,this.name=i,yt.prototype.hasOwnProperty("tree")||Object.defineProperty(yt.prototype,"tree",{get(){return da(this)}}),this.parser=t,this.extension=[ya.of(this),yt.languageData.of((e,t,n)=>{let i=ha(e,t,n),r=i.type.prop(la);if(!r)return[];let s=e.facet(r),o=i.type.prop(aa);if(o){let r=i.resolve(t-i.from,n);for(let t of o)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(s)}}return s})].concat(n)}isActiveAt(e,t,n=-1){return ha(e,t,n).type.prop(la)==this.data}findRegions(e){let t=e.facet(ya);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(la)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(sl.mounted);if(r){if(r.tree.prop(la)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let r=e.children[n];r instanceof fl&&i(r,e.positions[n]+t)}};return i(da(e),0),n}get allowsNesting(){return!0}}function ha(e,t,n){let i=e.facet(ya),r=da(e).topNode;if(!i||i.allowsNesting)for(let e=r;e;e=e.enter(t,n,dl.ExcludeBuffers|dl.EnterBracketed))e.type.isTop&&(r=e);return r}ca.setState=ht.define();class ua extends ca{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=(n=e.languageData,Fe.define({combine:n?e=>e.concat(n):void 0}));var n;return new ua(t,e.parser.configure({props:[la.add(e=>e.isTop?t:void 0)]}),e.name)}configure(e,t){return new ua(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function da(e){let t=e.field(ca.state,!1);return t?t.tree:fl.empty}class fa{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let pa=null;class ga{constructor(e,t,n=[],i,r,s,o,l){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new ga(e,t,[],fl.empty,0,n,[],null)}startParse(){return this.parser.startParse(new fa(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=fl.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let i=this.parse.advance();if(i){if(this.fragments=this.withoutTempSkipped(Bl.addTree(i,this.fragments,null!=this.parse.stoppedAt)),this.treeLen=null!==(n=this.parse.stoppedAt)&&void 0!==n?n:this.state.doc.length,this.tree=i,this.parse=null,!(this.treeLen<(null!=t?t:this.state.doc.length)))return!0;this.parse=this.startParse()}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Bl.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=pa;pa=this;try{return e()}finally{pa=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ma(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges((e,n,i,r)=>t.push({fromA:e,toA:n,fromB:i,toB:r})),n=Bl.applyChanges(n,t),i=fl.empty,r=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){o=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);n<i&&o.push({from:n,to:i})}}}return new ga(this.parser,t,n,i,r,s,o,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:i}=this.skipped[t];n<e.to&&i>e.from&&(this.fragments=ma(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t||(this.reset(),0))}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Dl{createParse(t,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let t=pa;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new fl(al.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return pa}}function ma(e,t,n){return Bl.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Aa{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Aa(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=ga.create(e.facet(ya).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Aa(n)}}ca.state=$e.define({create:Aa.init,update(e,t){for(let e of t.effects)if(e.is(ca.setState))return e.value;return t.startState.facet(ya)!=t.state.facet(ya)?Aa.init(t.state):e.apply(t)}});let va=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(va=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const ba="undefined"!=typeof navigator&&(null===(oa=navigator.scheduling)||void 0===oa?void 0:oa.isInputPending)?()=>navigator.scheduling.isInputPending():null,xa=Ri.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(ca.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(ca.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=va(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:i}}=this.view,r=n.field(ca.state);if(r.tree==r.context.tree&&r.context.isDone(i+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!ba?Math.max(25,e.timeRemaining()-5):1e9),o=r.context.treeLen<i&&n.doc.length>i+1e3,l=r.context.work(()=>ba&&ba()||Date.now()>s,i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(l||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:ca.setState.of(new Aa(r.context))})),this.chunkBudget>0&&(!l||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Oi(this.view.state,e)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ya=Fe.define({combine:e=>e.length?e[0]:null,enables:e=>[ca.state,xa,io.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class wa{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Ca=Fe.define(),ka=Fe.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function _a(e){let t=e.facet(ka);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function Sa(e,t){let n="",i=e.tabSize,r=e.facet(ka)[0];if("\t"==r){for(;t>=i;)n+="\t",t-=i;r=" "}for(let e=0;e<t;e++)n+=r;return n}function Ea(e,t){e instanceof yt&&(e=new Ta(e));for(let n of e.state.facet(Ca)){let i=n(e,t);if(void 0!==i)return i}let n=da(e.state);return n.length>=t?function(e,t,n){let i=t.resolveStack(n),r=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(r!=i.node){let e=[];for(let t=r;t&&!(t.from<i.node.from||t.to>i.node.to||t.from==i.node.from&&t.type==i.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return Ma(i,e,n)}(e,n,t):null}class Ta{constructor(e,t={}){this.state=e,this.options=t,this.unit=_a(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==e?{text:"",from:e}:(t<0?i<e:i<=e)?{text:n.text.slice(i-n.from),from:i}:{text:n.text.slice(0,i-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:i}=this.lineAt(e,t);return n.slice(e-i,Math.min(n.length,e+100-i))}column(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.countColumn(n,e-i),s=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return s>-1&&(r+=s-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return zt(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Oa=new sl;function Ma(e,t,n){for(let i=e;i;i=i.next){let e=Ba(i.node);if(e)return e(Ra.create(t,n,i))}return 0}function Ba(e){let t=e.type.prop(Oa);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(sl.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>function(e,t,n,i,r){let s=e.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==e.pos+o,a=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==i)return null;if(!r.type.isSkipped){if(r.from>=o)return null;let e=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+e}}e=r.to}}(e):null;return a?l?e.column(a.from):e.column(a.to):e.baseIndent+(l?0:e.unit*n)}(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?Da:null}function Da(){return 0}class Ra extends Ta{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Ra(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Ia(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Ma(this.context.next,this.base,this.pos)}}function Ia(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Pa({except:e,units:t=1}={}){return n=>{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const Na=Fe.define(),La=new sl;function Fa(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function ja(e,t,n){for(let i of e.facet(Na)){let r=i(e,t,n);if(r)return r}return function(e,t,n){let i=da(e);if(i.length<n)return null;let r=null;for(let s=i.resolveStack(n,1);s;s=s.next){let o=s.node;if(o.to<=n||o.from>n)continue;if(r&&o.from<t)break;let l=o.type.prop(La);if(l&&(o.to<i.length-50||i.length==e.doc.length||!Fa(o))){let i=l(o,e);i&&i.from<=n&&i.from>=t&&i.to>n&&(r=i)}}return r}(e,t,n)}function za(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const Va=ht.define({map:za}),Wa=ht.define({map:za});function Ha(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}const qa=$e.define({create:()=>bn.none,update(e,t){t.isUserEvent("delete")&&t.changes.iterChangedRanges((t,n)=>e=$a(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is(Va)&&!Ka(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(Xa),r=i?bn.replace({widget:new nc(i(t.state,n.value))}):tc;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(Wa)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=$a(e,t.selection.main.head)),e},provide:e=>io.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let i=e[n++],r=e[n++];if("number"!=typeof i||"number"!=typeof r)throw new RangeError("Invalid JSON for fold state");t.push(tc.range(i,r))}return bn.set(t,!0)}});function $a(e,t,n=t){let i=!1;return e.between(t,n,(e,r)=>{e<n&&r>t&&(i=!0)}),i?e.update({filterFrom:t,filterTo:n,filter:(e,i)=>e>=n||i<=t}):e}function Ua(e,t,n){var i;let r=null;return null===(i=e.field(qa,!1))||void 0===i||i.between(t,n,(e,t)=>{(!r||r.from>e)&&(r={from:e,to:t})}),r}function Ka(e,t,n){let i=!1;return e.between(t,t,(e,r)=>{e==t&&r==n&&(i=!0)}),i}function Ga(e,t){return e.field(qa,!1)?t:t.concat(ht.appendConfig.of(Za()))}function Ya(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return io.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${r}.`)}const Ja=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of Ha(e)){let n=ja(e.state,t.from,t.to);if(n)return e.dispatch({effects:Ga(e.state,[Va.of(n),Ya(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(qa,!1))return!1;let t=[];for(let n of Ha(e)){let i=Ua(e.state,n.from,n.to);i&&t.push(Wa.of(i),Ya(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let i=0;i<t.doc.length;){let r=e.lineBlockAt(i),s=ja(t,r.from,r.to);s&&n.push(Va.of(s)),i=(s?e.lineBlockAt(s.to):r).to+1}return n.length&&e.dispatch({effects:Ga(e.state,n)}),!!n.length}},{key:"Ctrl-Alt-]",run:e=>{let t=e.state.field(qa,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(e,t)=>{n.push(Wa.of({from:e,to:t}))}),e.dispatch({effects:n}),!0}}],Qa={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Xa=Fe.define({combine:e=>wt(e,Qa)});function Za(e){let t=[qa,oc];return e&&t.push(Xa.of(e)),t}function ec(e,t){let{state:n}=e,i=n.facet(Xa),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=Ua(e.state,n.from,n.to);i&&e.dispatch({effects:Wa.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const tc=bn.replace({widget:new class extends An{toDOM(e){return ec(e,null)}}});class nc extends An{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return ec(e,this.value)}}const ic={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class rc extends Wo{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function sc(e={}){let t={...ic,...e},n=new rc(t,!0),i=new rc(t,!1),r=Ri.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(ya)!=e.state.facet(ya)||e.startState.field(qa,!1)!=e.state.field(qa,!1)||da(e.startState)!=da(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new Ot;for(let r of e.viewportLineBlocks){let s=Ua(e.state,r.from,r.to)?i:ja(e.state,r.from,r.to)?n:null;s&&t.add(r.from,r.from,s)}return t.finish()}}),{domEventHandlers:s}=t;return[r,Ko({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.markers)||Tt.empty},initialSpacer:()=>new rc(t,!1),domEventHandlers:{...s,click:(e,t,n)=>{if(s.click&&s.click(e,t,n))return!0;let i=Ua(e.state,t.from,t.to);if(i)return e.dispatch({effects:Wa.of(i)}),!0;let r=ja(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:Va.of(r)}),!0)}}}),Za()]}const oc=io.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class lc{constructor(e,t){let n;function i(e){let t=qt.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?i(t.all):void 0,s=t.scope;this.scope=s instanceof ca?e=>e.prop(la)==s.data:s?e=>e==s:void 0,this.style=Vl(e.map(e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))})),{all:r}).style,this.module=n?new qt(n):null,this.themeType=t.themeType}static define(e,t){return new lc(e,t||{})}}const ac=Fe.define(),cc=Fe.define({combine:e=>e.length?[e[0]]:null});function hc(e){let t=e.facet(ac);return t.length?t:e.facet(cc)}class uc{constructor(e){this.markCache=Object.create(null),this.tree=da(e.state),this.decorations=this.buildDeco(e,hc(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=da(e.state),n=hc(e.state),i=n!=hc(e.startState),{viewport:r}=e.view,s=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!i&&t.type==this.tree.type&&s>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=s):(t!=this.tree||e.viewportChanged||i)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return bn.none;let n=new Ot;for(let{from:i,to:r}of e.visibleRanges)Wl(this.tree,t,(e,t,i)=>{n.add(e,t,this.markCache[i]||(this.markCache[i]=bn.mark({class:i})))},i,r);return n.finish()}}const dc=Ke.high(Ri.fromClass(uc,{decorations:e=>e.decorations})),fc=(sa.meta,sa.link,sa.heading,sa.emphasis,sa.strong,sa.strikethrough,sa.keyword,sa.atom,sa.bool,sa.url,sa.contentSeparator,sa.labelName,sa.literal,sa.inserted,sa.string,sa.deleted,sa.regexp,sa.escape,sa.string,sa.variableName,sa.variableName,sa.typeName,sa.namespace,sa.className,sa.variableName,sa.macroName,sa.propertyName,sa.comment,sa.invalid,io.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}})),pc="()[]{}",gc=Fe.define({combine:e=>wt(e,{afterCursor:!0,brackets:pc,maxScanDistance:1e4,renderMatch:vc})}),mc=bn.mark({class:"cm-matchingBracket"}),Ac=bn.mark({class:"cm-nonmatchingBracket"});function vc(e){let t=[],n=e.matched?mc:Ac;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}function bc(e){let t=[],n=e.facet(gc);for(let i of e.selection.ranges){if(!i.empty)continue;let r=_c(e,i.head,-1,n)||i.head>0&&_c(e,i.head-1,1,n)||n.afterCursor&&(_c(e,i.head,1,n)||i.head<e.doc.length&&_c(e,i.head+1,-1,n));r&&(t=t.concat(n.renderMatch(r,e)))}return bn.set(t,!0)}const xc=[Ri.fromClass(class{constructor(e){this.paused=!1,this.decorations=bc(e.state)}update(e){(e.docChanged||e.selectionSet||this.paused)&&(e.view.composing?(this.decorations=this.decorations.map(e.changes),this.paused=!0):(this.decorations=bc(e.state),this.paused=!1))}},{decorations:e=>e.decorations}),fc];function yc(e={}){return[gc.of(e),xc]}const wc=new sl;function Cc(e,t,n){let i=e.prop(t<0?sl.openedBy:sl.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function kc(e){let t=e.type.prop(wc);return t?t(e.node):e}function _c(e,t,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||pc,o=da(e),l=o.resolveInner(t,n);for(let e=l;e;e=e.parent){let i=Cc(e.type,n,s);if(i&&e.from<e.to){let r=kc(e);if(r&&(n>0?t>=r.from&&t<r.to:t>r.from&&t<=r.to))return Sc(0,0,n,e,r,i,s)}}return function(e,t,n,i,r,s,o){let l=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),a=o.indexOf(l);if(a<0||a%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=s;){let s=h.value;n<0&&(e+=s.length);let l=t+e*n;for(let e=n>0?0:s.length-1,t=n>0?s.length:-1;e!=t;e+=n){let t=o.indexOf(s[e]);if(!(t<0||i.resolveInner(l+e,1).type!=r))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:l+e,to:l+e+1},matched:t>>1==a>>1};u--}}n>0&&(e+=s.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,o,l.type,r,s)}function Sc(e,t,n,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},c=0,h=null==l?void 0:l.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==c&&s.indexOf(h.type.name)>-1&&h.from<h.to){let e=kc(h);return{start:a,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(Cc(h.type,n,o))c++;else if(Cc(h.type,-n,o)){if(0==c){let e=kc(h);return{start:a,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}c--}}}while(n<0?h.prevSibling():h.nextSibling());return{start:a,matched:!1}}const Ec=Object.create(null),Tc=[al.none],Oc=[],Mc=Object.create(null),Bc=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])Bc[e]=Rc(Ec,t);function Dc(e,t){Oc.indexOf(e)>-1||(Oc.push(e),console.warn(t))}function Rc(e,t){let n=[];for(let i of t.split(" ")){let t=[];for(let n of i.split(".")){let i=e[n]||sa[n];i?"function"==typeof i?t.length?t=t.map(i):Dc(n,`Modifier ${n} used at start of tag`):t.length?Dc(n,`Tag ${n} used as modifier`):t=Array.isArray(i)?i:[i]:Dc(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let i=t.replace(/ /g,"_"),r=i+" "+n.map(e=>e.id),s=Mc[r];if(s)return s.id;let o=Mc[r]=al.define({id:Tc.length,name:i,props:[Fl({[i]:n})]});return Tc.push(o),o.id}Yn.RTL,Yn.LTR;class Ic{constructor(e,t,n,i){this.state=e,this.pos=t,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=da(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(Fc(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t,n){"abort"==e&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function Pc(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}class Nc{constructor(e,t,n,i){this.completion=e,this.source=t,this.match=n,this.score=i}}function Lc(e){return e.selection.main.from}function Fc(e,t){var n;let{source:i}=e,r=t&&"^"!=i[0],s="$"!=i[i.length-1];return r||s?new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const jc=lt.define();function zc(e,t,n,i){let{main:r}=e.selection,s=n-r.from,o=i-r.from;return{...e.changeByRange(l=>{if(l!=r&&n!=i&&e.sliceDoc(l.from+s,l.from+o)!=e.sliceDoc(n,i))return{range:l};let a=e.toText(t);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:Pe.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const Vc=new WeakMap;function Wc(e){if(!Array.isArray(e))return e;let t=Vc.get(e);return t||Vc.set(e,t=function(e){let t=e.map(e=>"string"==typeof e?{label:e}:e),[n,i]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e<i.length;e++)n[i[e]]=!0}let i=Pc(t)+Pc(n)+"*$";return[new RegExp("^"+i),new RegExp(i)]}(t);return e=>{let r=e.matchBefore(i);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}(e)),t}const Hc=ht.define(),qc=ht.define();class $c{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=ye(e,t),i=Ce(n);this.chars.push(n);let r=e.slice(t,t+i),s=r.toUpperCase();this.folded.push(ye(s==r?r.toLowerCase():s,0)),t+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(0==this.pattern.length)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:i,precise:r,byWord:s}=this;if(1==t.length){let i=ye(e,0),r=Ce(i),s=r==e.length?0:-100;if(i==t[0]);else{if(i!=n[0])return null;s+=-200}return this.ret(s,[0,r])}let o=e.indexOf(this.pattern);if(0==o)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=t.length,a=0;if(o<0){for(let r=0,s=Math.min(e.length,200);r<s&&a<l;){let s=ye(e,r);s!=t[a]&&s!=n[a]||(i[a++]=r),r+=Ce(s)}if(a<l)return null}let c=0,h=0,u=!1,d=0,f=-1,p=-1,g=/[a-z]/.test(e),m=!0;for(let i=0,a=Math.min(e.length,200),A=0;i<a&&h<l;){let a=ye(e,i);o<0&&(c<l&&a==t[c]&&(r[c++]=i),d<l&&(a==t[d]||a==n[d]?(0==d&&(f=i),p=i+1,d++):d=0));let v,b=a<255?a>=48&&a<=57||a>=97&&a<=122?2:a>=65&&a<=90?1:0:(v=we(a))!=v.toLowerCase()?1:v!=v.toUpperCase()?2:0;(!i||1==b&&g||0==A&&0!=b)&&(t[h]==a||n[h]==a&&(u=!0)?s[h++]=i:s.length&&(m=!1)),A=b,i+=Ce(a)}return h==l&&0==s[0]&&m?this.result((u?-200:0)-100,s,e):d==l&&0==f?this.ret(-200-e.length+(p==e.length?0:-100),[0,p]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):d==l?this.ret(-900-e.length,[f,p]):h==l?this.result((u?-200:0)-100-700+(m?0:-1100),s,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[],r=0;for(let e of t){let t=e+(this.astral?Ce(ye(n,e)):1);r&&i[r-1]==e?i[r-1]=t:(i[r++]=e,i[r++]=t)}return this.ret(e-n.length,i)}}class Uc{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return null==n?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Kc=Fe.define({combine:e=>wt(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Yc,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>Gc(e(n),t(n)),optionClass:(e,t)=>n=>Gc(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})});function Gc(e,t){return e?t?e+" "+t:e:t}function Yc(e,t,n,i,r,s){let o,l,a=e.textDirection==Yn.RTL,c=a,h=!1,u="top",d=t.left-r.left,f=r.right-t.right,p=i.right-i.left,g=i.bottom-i.top;if(c&&d<Math.min(p,f)?c=!1:!c&&f<Math.min(p,d)&&(c=!0),p<=(c?d:f))o=Math.max(r.top,Math.min(n.top,r.bottom-g))-t.top,l=Math.min(400,c?d:f);else{h=!0,l=Math.min(400,(a?t.right:r.right-t.left)-30);let e=r.bottom-t.bottom;e>=g||e>t.top?o=n.bottom-t.top:(u="bottom",o=t.bottom-n.top)}return{style:`${u}: ${o/((t.bottom-t.top)/s.offsetHeight)}px; max-width: ${l/((t.right-t.left)/s.offsetWidth)}px`,class:"cm-completionInfo-"+(h?a?"left-narrow":"right-narrow":c?"left":"right")}}const Jc=ht.define();function Qc(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class Xc{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass="";let i=e.state.field(t),{options:r,selected:s}=i.open,o=e.state.facet(Kc);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>"cm-completionIcon-"+e)),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n,i){let r=document.createElement("span");r.className="cm-completionLabel";let s=e.displayLabel||e.label,o=0;for(let e=0;e<i.length;){let t=i[e++],n=i[e++];t>o&&r.appendChild(document.createTextNode(s.slice(o,t)));let l=r.appendChild(document.createElement("span"));l.appendChild(document.createTextNode(s.slice(t,n))),l.className="cm-completionMatchedText",o=n}return o<s.length&&r.appendChild(document.createTextNode(s.slice(o))),r},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");return t.className="cm-completionDetail",t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Qc(r.length,s,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",n=>{let{options:i}=e.state.field(t).open;for(let t,r=n.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(t=/-(\d+)$/.exec(r.id))&&+t[1]<i.length)return this.applyCompletion(e,i[+t[1]]),void n.preventDefault();if(n.target==this.list){let t=this.list.classList.contains("cm-completionListIncompleteTop")&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;null!=t&&(e.dispatch({effects:Jc.of(t)}),n.preventDefault())}}),this.dom.addEventListener("focusout",t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(Kc).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:qc.of(null)})}),this.showOptions(r,i.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:r,selected:s,disabled:o}=n.open;i.open&&i.open.options==r||(this.range=Qc(r.length,s,e.state.facet(Kc).maxRenderedOptions),this.showOptions(r,n.id)),this.updateSel(),o!=(null===(t=i.open)||void 0===t?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Qc(t.options.length,t.selected,this.view.state.facet(Kc).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:i}=t.options[t.selected],{info:r}=i;if(!r)return;let s="string"==typeof r?document.createTextNode(r):r(i);if(!s)return;"then"in s?s.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,i)}).catch(e=>Oi(this.view.state,e,"completion info")):(this.addInfoPane(s,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(65535*Math.random()).toString(16),null!=e.nodeType)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:i}=e;n.appendChild(t),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)"LI"==n.nodeName&&n.id?i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby")):i--;return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),r=n.height/e.offsetHeight;i.top<n.top?e.scrollTop-=(n.top-i.top)/r:i.bottom>n.bottom&&(e.scrollTop+=(i.bottom-n.bottom)/r)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return i.top>Math.min(r.bottom,t.bottom)-10||i.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(Kc).positionInfo(this.view,t,i,n,r,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",e=>{e.target==i&&e.preventDefault()});let r=null;for(let s=n.from;s<n.to;s++){let{completion:o,match:l}=e[s],{section:a}=o;if(a){let e="string"==typeof a?a:a.name;e!=r&&(s>n.from||0==n.from)&&(r=e,"string"!=typeof a&&a.header?i.appendChild(a.header(a)):i.appendChild(document.createElement("completion-section")).textContent=e)}const c=i.appendChild(document.createElement("li"));c.id=t+"-"+s,c.setAttribute("role","option");let h=this.optionClass(o);h&&(c.className=h);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,l);t&&c.appendChild(t)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Zc(e,t){return n=>new Xc(n,e,t)}function eh(e){return 100*(e.boost||0)+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}class th{constructor(e,t,n,i,r,s){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=i,this.selected=r,this.disabled=s}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new th(this.options,sh(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r,s){if(i&&!s&&e.some(e=>e.isPending))return i.setDisabled();let o=function(e,t){let n=[],i=null,r=null,s=e=>{n.push(e);let{section:t}=e.completion;if(t){i||(i=[]);let e="string"==typeof t?t:t.name;i.some(t=>t.name==e)||i.push("string"==typeof t?{name:e}:t)}},o=t.facet(Kc);for(let i of e)if(i.hasResult()){let e=i.result.getMatch;if(!1===i.result.filter)for(let t of i.result.options)s(new Nc(t,i.source,e?e(t):[],1e9-n.length));else{let n,l=t.sliceDoc(i.from,i.to),a=o.filterStrict?new Uc(l):new $c(l);for(let t of i.result.options)if(n=a.match(t.label)){let o=t.displayLabel?e?e(t,n.matched):[]:n.matched,l=n.score+(t.boost||0);if(s(new Nc(t,i.source,o,l)),"object"==typeof t.section&&"dynamic"===t.section.rank){let{name:e}=t.section;r||(r=Object.create(null)),r[e]=Math.max(l,r[e]||-1e9)}}}}if(i){let e=Object.create(null),t=0,s=(e,t)=>("dynamic"===e.rank&&"dynamic"===t.rank?r[t.name]-r[e.name]:0)||("number"==typeof e.rank?e.rank:1e9)-("number"==typeof t.rank?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of i.sort(s))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e["string"==typeof n?n:n.name])}}let l=[],a=null,c=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||c(e.completion,t.completion))){let t=e.completion;!a||a.label!=t.label||a.detail!=t.detail||null!=a.type&&null!=t.type&&a.type!=t.type||a.apply!=t.apply||a.boost!=t.boost?l.push(e):eh(e.completion)>eh(a)&&(l[l.length-1]=e),a=e.completion}return l}(e,t);if(!o.length)return i&&e.some(e=>e.isPending)?i.setDisabled():null;let l=t.facet(Kc).selectOnOpen?0:-1;if(i&&i.selected!=l&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;t<o.length;t++)if(o[t].completion==e){l=t;break}}return new th(o,sh(n,l),{pos:e.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:fh,above:r.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new th(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new th(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class nh{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new nh(oh,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Kc),i=(n.override||t.languageDataAt("autocomplete",Lc(t)).map(Wc)).map(t=>(this.active.find(e=>e.source==t)||new ah(t,this.active.some(e=>0!=e.state)?1:0)).update(e,n));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let r=this.open,s=e.effects.some(e=>e.is(hh));r&&e.docChanged&&(r=r.map(e.changes)),e.selection||i.some(t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;i<t.length&&!t[i].hasResult();)i++;let r=n==e.length,s=i==t.length;if(r||s)return r==s;if(e[n++].result!=t[i++].result)return!1}}(i,this.active)||s?r=th.build(i,t,this.id,r,n,s):r&&r.disabled&&!i.some(e=>e.isPending)&&(r=null),!r&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new ah(e.source,0):e));for(let t of e.effects)t.is(Jc)&&(r=r&&r.setSelected(t.value,this.id));return i==this.active&&r==this.open?this:new nh(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?ih:rh}}const ih={"aria-autocomplete":"list"},rh={};function sh(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const oh=[];function lh(e,t){if(e.isUserEvent("input.complete")){let n=e.annotation(jc);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class ah{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return 1==this.state}update(e,t){let n=lh(e,t),i=this;(8&n||16&n&&this.touches(e))&&(i=new ah(i.source,0)),4&n&&0==i.state&&(i=new ah(this.source,1)),i=i.updateFor(e,n);for(let t of e.effects)if(t.is(Hc))i=new ah(i.source,1,t.value);else if(t.is(qc))i=new ah(i.source,0);else if(t.is(hh))for(let e of t.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Lc(e.state))}}class ch extends ah{constructor(e,t,n,i,r,s){super(e,3,t),this.limit=n,this.result=i,this.from=r,this.to=s}hasResult(){return!0}updateFor(e,t){var n;if(!(3&t))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let r=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),o=Lc(e.state);if(o>s||!i||2&t&&(Lc(e.startState)==this.from||o<this.limit))return new ah(this.source,4&t?1:0);let l=e.changes.mapPos(this.limit);return function(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return"function"==typeof e?e(r,n,i,t):Fc(e,!0).test(r)}(i.validFor,e.state,r,s)?new ch(this.source,this.explicit,l,i,r,s):i.update&&(i=i.update(i,r,s,new Ic(e.state,o,!1)))?new ch(this.source,this.explicit,l,i,i.from,null!==(n=i.to)&&void 0!==n?n:Lc(e.state)):new ah(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new ch(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new ah(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}const hh=ht.define({map:(e,t)=>e.map(e=>e.map(t))}),uh=$e.define({create:()=>nh.start(),update:(e,t)=>e.update(t),provide:e=>[To.from(e,e=>e.tooltip),io.contentAttributes.from(e,e=>e.attrs)]});function dh(e,t){const n=t.completion.apply||t.completion.label;let i=e.state.field(uh).active.find(e=>e.source==t.source);return i instanceof ch&&("string"==typeof n?e.dispatch({...zc(e.state,n,i.from,i.to),annotations:jc.of(t.completion)}):n(e,t.completion,i.from,i.to),!0)}const fh=Zc(uh,dh);function ph(e,t="option"){return n=>{let i=n.state.field(uh,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<n.state.facet(Kc).interactionDelay)return!1;let r,s=1;"page"==t&&(r=Po(n,i.open.tooltip))&&(s=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(e?1:-1):e?0:o-1;return l<0?l="page"==t?0:o-1:l>=o&&(l="page"==t?o-1:0),n.dispatch({effects:Jc.of(l)}),!0}}const gh=e=>!!e.state.field(uh,!1)&&(e.dispatch({effects:Hc.of(!0)}),!0);class mh{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const Ah=Ri.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(uh).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(uh),n=e.state.facet(Kc);if(!e.selectionSet&&!e.docChanged&&e.startState.field(uh)==t)return;let i=e.transactions.some(e=>{let t=lh(e,n);return 8&t||(e.selection||e.docChanged)&&!(3&t)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(i||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>50&&Date.now()-n.time>1e3){for(let e of n.context.abortListeners)try{e()}catch(e){Oi(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(Hc)))&&(this.pendingStart=!0);let r=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),r):-1,0!=this.composing)for(let t of e.transactions)t.isUserEvent("input.type")?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(uh);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Kc).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Lc(t),i=new Ic(t,n,e.explicit,this.view),r=new mh(e,i);this.running.push(r),Promise.resolve(e.source(i)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:qc.of(null)}),Oi(this.view.state,e)})}scheduleAccept(){this.running.every(e=>void 0!==e.done)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Kc).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Kc),i=this.view.state.field(uh);for(let r=0;r<this.running.length;r++){let s=this.running[r];if(void 0===s.done)continue;if(this.running.splice(r--,1),s.done){let i=Lc(s.updates.length?s.updates[0].startState:this.view.state),r=Math.min(i,s.done.from+(s.active.explicit?0:1)),o=new ch(s.active.source,s.active.explicit,r,s.done,s.done.from,null!==(e=s.done.to)&&void 0!==e?e:i);for(let e of s.updates)o=o.update(e,n);if(o.hasResult()){t.push(o);continue}}let o=i.active.find(e=>e.source==s.active.source);if(o&&o.isPending)if(null==s.done){let e=new ah(s.active.source,0);for(let t of s.updates)e=e.update(t,n);e.isPending||t.push(e)}else this.startQuery(o)}(t.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:hh.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(uh,!1);if(t&&t.tooltip&&this.view.state.facet(Kc).closeOnBlur){let n=t.open&&Po(this.view,t.open.tooltip);n&&n.dom.contains(e.relatedTarget)||setTimeout(()=>this.view.dispatch({effects:qc.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout(()=>this.view.dispatch({effects:Hc.of(!1)}),20),this.composing=0}}}),vh="object"==typeof navigator&&/Win/.test(navigator.platform),bh=Ke.highest(io.domEventHandlers({keydown(e,t){let n=t.state.field(uh,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&(!vh||!e.altKey)||e.metaKey)return!1;let i=n.open.options[n.open.selected],r=n.active.find(e=>e.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&dh(t,i),!1}})),xh=io.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),yh={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},wh=ht.define({map(e,t){let n=t.mapPos(e,-1,_e.TrackAfter);return null==n?void 0:n}}),Ch=new class extends Ct{};Ch.startSide=1,Ch.endSide=-1;const kh=$e.define({create:()=>Tt.empty,update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is(wh)&&(e=e.update({add:[Ch.range(n.value,n.value+1)]}));return e}}),_h="()[]{}<>«»»«[]{}";function Sh(e){for(let t=0;t<16;t+=2)if(_h.charCodeAt(t)==e)return _h.charAt(t+1);return we(e<128?e:e+1)}const Eh="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),Th=io.inputHandler.of((e,t,n,i)=>{if((Eh?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||2==i.length&&1==Ce(ye(i,0))||t!=r.from||n!=r.to)return!1;let s=function(e,t){let n=function(e,t){return e.languageDataAt("closeBrackets",t)[0]||yh}(e,e.selection.main.head),i=n.brackets||yh.brackets;for(let r of i){let s=Sh(ye(r,0));if(t==r)return s==r?Rh(e,r,i.indexOf(r+r+r)>-1,n):Bh(e,r,s,n.before||yh.before);if(t==s&&Oh(e,e.selection.main.from))return Dh(e,0,s)}return null}(e.state,i);return!!s&&(e.dispatch(s),!0)});function Oh(e,t){let n=!1;return e.field(kh).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function Mh(e,t){let n=e.sliceString(t,t+2);return n.slice(0,Ce(ye(n,0)))}function Bh(e,t,n,i){let r=null,s=e.changeByRange(s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:wh.of(s.to+t.length),range:Pe.range(s.anchor+t.length,s.head+t.length)};let o=Mh(e.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:t+n,from:s.head},effects:wh.of(s.head+t.length),range:Pe.cursor(s.head+t.length)}:{range:r=s}});return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Dh(e,t,n){let i=null,r=e.changeByRange(t=>t.empty&&Mh(e.doc,t.head)==n?{changes:{from:t.head,to:t.head+n.length,insert:n},range:Pe.cursor(t.head+n.length)}:i={range:t});return i?null:e.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Rh(e,t,n,i){let r=i.stringPrefixes||yh.stringPrefixes,s=null,o=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:wh.of(i.to+t.length),range:Pe.range(i.anchor+t.length,i.head+t.length)};let o,l=i.head,a=Mh(e.doc,l);if(a==t){if(Ih(e,l))return{changes:{insert:t+t,from:l},effects:wh.of(l+t.length),range:Pe.cursor(l+t.length)};if(Oh(e,l)){let i=n&&e.sliceDoc(l,l+3*t.length)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+i.length,insert:i},range:Pe.cursor(l+i.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(o=Ph(e,l-2*t.length,r))>-1&&Ih(e,o))return{changes:{insert:t+t+t+t,from:l},effects:wh.of(l+t.length),range:Pe.cursor(l+t.length)};if(e.charCategorizer(l)(a)!=vt.Word&&Ph(e,l,r)>-1&&!function(e,t,n,i){let r=da(e).resolveInner(t,-1),s=i.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),l=o.indexOf(n);if(!l||l>-1&&i.indexOf(o.slice(0,l))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+l;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let a=r.to==t&&r.parent;if(!a)break;r=a}return!1}(e,l,t,r))return{changes:{insert:t+t,from:l},effects:wh.of(l+t.length),range:Pe.cursor(l+t.length)}}return{range:s=i}});return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ih(e,t){let n=da(e).resolveInner(t+1);return n.parent&&n.from==t}function Ph(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=vt.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&i(e.sliceDoc(n-1,n))!=vt.Word)return n}return-1}function Nh(e={}){return[bh,uh,Kc.of(e),Ah,Fh,xh]}const Lh=[{key:"Ctrl-Space",run:gh},{mac:"Alt-`",run:gh},{mac:"Alt-i",run:gh},{key:"Escape",run:e=>{let t=e.state.field(uh,!1);return!(!t||!t.active.some(e=>0!=e.state)||(e.dispatch({effects:qc.of(null)}),0))}},{key:"ArrowDown",run:ph(!0)},{key:"ArrowUp",run:ph(!1)},{key:"PageDown",run:ph(!0,"page")},{key:"PageUp",run:ph(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(uh,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Kc).interactionDelay)&&dh(e,t.open.options[t.open.selected])}}],Fh=Ke.highest(uo.computeN([Kc],e=>e.facet(Kc).defaultKeymap?[Lh]:[]));function jh(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(i(n.update(r)),!0)}}const zh=jh(Uh,0),Vh=jh($h,0),Wh=jh((e,t)=>$h(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to);r.from>i.from&&r.from==n.to&&(r=n.to==i.to+1?i:e.doc.lineAt(n.to-1));let s=t.length-1;s>=0&&t[s].to>i.from?t[s].to=r.to:t.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return t}(t)),0);function Hh(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}const qh=50;function $h(e,t,n=t.selection.ranges){let i=n.map(e=>Hh(t,e.from).block);if(!i.every(e=>e))return null;let r=n.map((e,n)=>function(e,{open:t,close:n},i,r){let s,o,l=e.sliceDoc(i-qh,i),a=e.sliceDoc(r,r+qh),c=/\s*$/.exec(l)[0].length,h=/^\s*/.exec(a)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&a.slice(h,h+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};r-i<=2*qh?s=o=e.sliceDoc(i,r):(s=e.sliceDoc(i,i+qh),o=e.sliceDoc(r-qh,r));let d=/^\s*/.exec(s)[0].length,f=/\s*$/.exec(o)[0].length,p=o.length-f-n.length;return s.slice(d,d+t.length)==t&&o.slice(p,p+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(s.charAt(d+t.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(o.charAt(p-1))?1:0}}:null}(t,i[n],e.from,e.to));if(2!=e&&!r.every(e=>e))return{changes:t.changes(n.map((e,t)=>r[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}]))};if(1!=e&&r.some(e=>e)){let e=[];for(let t,n=0;n<r.length;n++)if(t=r[n]){let r=i[n],{open:s,close:o}=t;e.push({from:s.pos-r.open.length,to:s.pos+s.margin},{from:o.pos-o.margin,to:o.pos+r.close.length})}return{changes:e}}return null}function Uh(e,t,n=t.selection.ranges){let i=[],r=-1;e:for(let{from:e,to:s}of n){let n,o=i.length,l=1e9;for(let o=e;o<=s;){let a=t.doc.lineAt(o);if(null==n&&(n=Hh(t,a.from).line,!n))continue e;if(a.from>r&&(e==s||s>a.from)){r=a.from;let e=/^\s*/.exec(a.text)[0].length,t=e==a.length,s=a.text.slice(e,e+n.length)==n?e:-1;e<a.text.length&&e<l&&(l=e),i.push({line:a,comment:s,token:n,indent:e,empty:t,single:!1})}o=a.to+1}if(l<1e9)for(let e=o;e<i.length;e++)i[e].indent<i[e].line.text.length&&(i[e].indent=l);i.length==o+1&&(i[o].single=!0)}if(2!=e&&i.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:r,empty:s,single:o}of i)!o&&s||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:r}of i)if(n>=0){let i=t.from+n,s=i+r.length;" "==t.text[s-t.from]&&s++,e.push({from:i,to:s})}return{changes:e}}return null}const Kh=lt.define(),Gh=Fe.define();class Yh{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new Yh(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new Yh(e.changes&&Ee.fromJSON(e.changes),[],e.mapped&&Se.fromJSON(e.mapped),e.startSelection&&Pe.fromJSON(e.startSelection),e.selectionsAfter.map(Pe.fromJSON))}static fromTransaction(e,t){let n=Xh;for(let t of e.startState.facet(Gh)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new Yh(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Xh)}static selection(e){return new Yh(void 0,Xh,void 0,void 0,e)}}function Jh(e,t,n,i){let r=t+1>n+20?t-n-1:0,s=e.slice(r,t);return s.push(i),s}function Qh(e,t){return e.length?t.length?e.concat(t):e:t}const Xh=[];function Zh(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function eu(e,t){if(!e.length)return e;let n=e.length,i=Xh;for(;n;){let r=tu(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,i=r.selectionsAfter}return i.length?[Yh.selection(i)]:Xh}function tu(e,t,n){let i=Qh(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Xh,n);if(!e.changes)return Yh.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new Yh(r,ht.mapEffects(e.effects,t),o,e.startSelection.map(s),i)}const nu=/^(input\.type|delete)($|\.)/;class iu{constructor(e,t,n=0,i=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new iu(this.done,this.undone):this}addChanges(e,t,n,i,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&e.changes&&(!n||nu.test(n))&&(!o.selectionsAfter.length&&t-this.prevTime<i.newGroupDelay&&i.joinToEvent(r,function(e,t){let n=[],i=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,r,s)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];s>=t&&r<=o&&(i=!0)}}),i}(o.changes,e.changes))||"input.type.compose"==n)?Jh(s,s.length-1,i.minDepth,new Yh(e.changes.compose(o.changes),Qh(ht.mapEffects(e.effects,o.changes),o.effects),o.mapped,o.startSelection,Xh)):Jh(s,s.length,i.minDepth,e),new iu(s,Xh,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Xh;return r.length>0&&t-this.prevTime<i&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(s=r[r.length-1],o=e,s.ranges.length==o.ranges.length&&0===s.ranges.filter((e,t)=>e.empty!=o.ranges[t].empty).length)?this:new iu(function(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),Jh(e,e.length-1,1e9,n.setSelAfter(i)))}return[Yh.selection([t])]}(this.done,e),this.undone,t,n);var s,o}addMapping(e){return new iu(eu(this.done,e),eu(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1],s=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Kh.of({side:e,rest:Zh(i),selection:s}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?Xh:i.slice(0,i.length-1);return r.mapped&&(n=eu(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Kh.of({side:e,rest:n,selection:s}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}function ru(e,t){return Pe.create(e.ranges.map(t),e.mainIndex)}function su(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function ou({state:e,dispatch:t},n){let i=ru(e.selection,n);return!i.eq(e.selection,!0)&&(t(su(e,i)),!0)}function lu(e,t){return Pe.cursor(t?e.to:e.from)}function au(e,t){return ou(e,n=>n.empty?e.moveByChar(n,t):lu(n,t))}function cu(e){return e.textDirectionAt(e.state.selection.main.head)==Yn.LTR}iu.empty=new iu(Xh,Xh);const hu=e=>au(e,!cu(e)),uu=e=>au(e,cu(e));function du(e,t){return ou(e,n=>n.empty?e.moveByGroup(n,t):lu(n,t))}function fu(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function pu(e,t,n){let i,r,s=da(e).resolveInner(t.head),o=n?sl.closedBy:sl.openedBy;for(let i=t.head;;){let t=n?s.childAfter(i):s.childBefore(i);if(!t)break;fu(e,t,o)?s=t:i=n?t.to:t.from}return r=s.type.prop(o)&&(i=n?_c(e,s.from,1):_c(e,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,Pe.cursor(r,n?-1:1)}function gu(e,t){return ou(e,n=>{if(!n.empty)return lu(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)})}"undefined"!=typeof Intl&&Intl.Segmenter;const mu=e=>gu(e,!1),Au=e=>gu(e,!0);function vu(e){let t,n=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,i=0,r=0;if(n){for(let t of e.state.facet(io.scrollMargins)){let n=t(e);(null==n?void 0:n.top)&&(i=Math.max(null==n?void 0:n.top,i)),(null==n?void 0:n.bottom)&&(r=Math.max(null==n?void 0:n.bottom,r))}t=e.scrollDOM.clientHeight-i-r}else t=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:i,marginBottom:r,selfScroll:n,height:Math.max(e.defaultLineHeight,t-5)}}function bu(e,t){let n,i=vu(e),{state:r}=e,s=ru(r.selection,n=>n.empty?e.moveVertically(n,t,i.height):lu(n,t));if(s.eq(r.selection))return!1;if(i.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+i.marginTop,a=o.bottom-i.marginBottom;t&&t.top>l&&t.bottom<a&&(n=io.scrollIntoView(s.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(su(r,s),{effects:n}),!0}const xu=e=>bu(e,!1),yu=e=>bu(e,!0);function wu(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(r=Pe.cursor(i.from+n))}return r}function Cu(e,t){let n=ru(e.state.selection,e=>{let n=t(e);return Pe.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return!n.eq(e.state.selection)&&(e.dispatch(su(e.state,n)),!0)}function ku(e,t){return Cu(e,n=>e.moveByChar(n,t))}const _u=e=>ku(e,!cu(e)),Su=e=>ku(e,cu(e));function Eu(e,t){return Cu(e,n=>e.moveByGroup(n,t))}function Tu(e,t){return Cu(e,n=>e.moveVertically(n,t))}const Ou=e=>Tu(e,!1),Mu=e=>Tu(e,!0);function Bu(e,t){return Cu(e,n=>e.moveVertically(n,t,vu(e).height))}const Du=e=>Bu(e,!1),Ru=e=>Bu(e,!0),Iu=({state:e,dispatch:t})=>(t(su(e,{anchor:0})),!0),Pu=({state:e,dispatch:t})=>(t(su(e,{anchor:e.doc.length})),!0),Nu=({state:e,dispatch:t})=>(t(su(e,{anchor:e.selection.main.anchor,head:0})),!0),Lu=({state:e,dispatch:t})=>(t(su(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function Fu(e,t){let{state:n}=e,i=n.selection,r=n.selection.ranges.slice();for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head);if(t?s.to<e.state.doc.length:s.from>0)for(let n=i;;){let i=e.moveVertically(n,t);if(i.head<s.from||i.head>s.to){r.some(e=>e.head==i.head)||r.push(i);break}if(i.head==n.head)break;n=i}}return r.length!=i.ranges.length&&(e.dispatch(su(n,Pe.create(r,r.length-1))),!0)}function ju(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange(i=>{let{from:r,to:s}=i;if(r==s){let o=t(i);o<r?(n="delete.backward",o=zu(e,o,!1)):o>r&&(n="delete.forward",o=zu(e,o,!0)),r=Math.min(r,o),s=Math.max(s,o)}else r=zu(e,r,!1),s=zu(e,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:Pe.cursor(r,r<i.head?-1:1)}});return!r.changes.empty&&(e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?io.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function zu(e,t,n){if(e instanceof io)for(let i of e.state.facet(io.atomicRanges).map(t=>t(e)))i.between(t,t,(e,i)=>{e<t&&i>t&&(t=n?i:e)});return t}const Vu=(e,t,n)=>ju(e,i=>{let r,s,o=i.from,{state:l}=e,a=l.doc.lineAt(o);if(n&&!t&&o>a.from&&o<a.from+200&&!/[^ \t]/.test(r=a.text.slice(0,o-a.from))){if("\t"==r[r.length-1])return o-1;let e=zt(r,l.tabSize)%_a(l)||_a(l);for(let t=0;t<e&&" "==r[r.length-1-t];t++)o--;s=o}else s=xe(a.text,o-a.from,t,t)+a.from,s==o&&a.number!=(t?l.doc.lines:1)?s+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(a.text.slice(s-a.from,o-a.from))&&(s=xe(a.text,s-a.from,!1,!1)+a.from);return s}),Wu=e=>Vu(e,!1,!0),Hu=e=>Vu(e,!0,!1),qu=(e,t)=>ju(e,n=>{let i=n.head,{state:r}=e,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let e=null;;){if(i==(t?s.to:s.from)){i==n.head&&s.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let l=xe(s.text,i-s.from,t)+s.from,a=s.text.slice(Math.min(i,l)-s.from,Math.max(i,l)-s.from),c=o(a);if(null!=e&&c!=e)break;" "==a&&i==n.head||(e=c),i=l}return i}),$u=e=>qu(e,!1);function Uu(e){let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.from),s=e.doc.lineAt(i.to);if(i.empty||i.to!=s.from||(s=e.doc.lineAt(i.to-1)),n>=r.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function Ku(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let t of Uu(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),o=s.length+1;if(n){i.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)r.push(Pe.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{i.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)r.push(Pe.range(e.anchor-o,e.head-o))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:Pe.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Gu(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of Uu(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let r=e.changes(i);return t(e.update({changes:r,selection:e.selection.map(r,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Yu=Ju(!1);function Ju(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange(n=>{let{from:i,to:r}=n,s=t.doc.lineAt(i),o=!e&&i==r&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=da(e).resolveInner(t),r=i.childBefore(t),s=i.childAfter(t);return r&&s&&r.to<=t&&s.from>=t&&(n=r.type.prop(sl.closedBy))&&n.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from&&!/\S/.test(e.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}(t,i);e&&(i=r=(r<=s.to?s:t.doc.lineAt(r)).to);let l=new Ta(t,{simulateBreak:i,simulateDoubleBreak:!!o}),a=Ea(l,i);for(null==a&&(a=zt(/^\s*/.exec(t.doc.lineAt(i).text)[0],t.tabSize));r<s.to&&/\s/.test(s.text[r-s.from]);)r++;o?({from:i,to:r}=o):i>s.from&&i<s.from+100&&!/\S/.test(s.text.slice(0,i))&&(i=s.from);let c=["",Sa(t,a)];return o&&c.push(Sa(t,l.lineIndent(s.from,-1))),{changes:{from:i,to:r,insert:he.of(c)},range:Pe.cursor(i+1+c[1].length)}});return n(t.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Qu(e,t){let n=-1;return e.changeByRange(i=>{let r=[];for(let s=i.from;s<=i.to;){let o=e.doc.lineAt(s);o.number>n&&(i.empty||i.to>o.from)&&(t(o,r,i),n=o.number),s=o.to+1}let s=e.changes(r);return{changes:r,range:Pe.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const Xu=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>ou(e,t=>pu(e.state,t,!cu(e))),shift:e=>Cu(e,t=>pu(e.state,t,!cu(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>ou(e,t=>pu(e.state,t,cu(e))),shift:e=>Cu(e,t=>pu(e.state,t,cu(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Ku(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Gu(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Ku(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Gu(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>Fu(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>Fu(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=Pe.create([n.main]):n.main.empty||(i=Pe.create([Pe.cursor(n.main.head)])),!!i&&(t(su(e,i)),!0)}},{key:"Mod-Enter",run:Ju(!0)},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Uu(e).map(({from:t,to:n})=>Pe.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:Pe.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=ru(e.selection,t=>{let n=da(e),i=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return Pe.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(su(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Qu(e,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let r=zt(i,e.tabSize),s=0,o=Sa(e,Math.max(0,r-_a(e)));for(;s<i.length&&s<o.length&&i.charCodeAt(s)==o.charCodeAt(s);)s++;n.push({from:t.from+s,to:t.from+i.length,insert:o.slice(s)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Qu(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ka)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new Ta(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=Qu(e,(t,r,s)=>{let o=Ea(i,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let l=/^\s*/.exec(t.text)[0],a=Sa(e,o);(l!=a||s.from<t.from+l.length)&&(n[t.from]=o,r.push({from:t.from,to:t.from+l.length,insert:a}))});return r.changes.empty||t(e.update(r,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Uu(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),i=ru(t.selection,t=>{let n;if(e.lineWrapping){let i=e.lineBlockAt(t.head),r=e.coordsAtPos(t.head,t.assoc||1);r&&(n=i.bottom+e.documentTop-r.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let i=!1,r=ru(e.selection,t=>{let r=_c(e,t.head,-1)||_c(e,t.head,1)||t.head>0&&_c(e,t.head-1,1)||t.head<e.doc.length&&_c(e,t.head+1,-1);if(!r||!r.end)return t;i=!0;let s=r.start.from==t.head?r.end.to:r.end.from;return n?Pe.range(t.anchor,s):Pe.cursor(s)});return!!i&&(t(su(e,r)),!0)}(e,t,!1)},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),i=Hh(e.state,n.from);return i.line?zh(e):!!i.block&&Wh(e)}},{key:"Alt-A",run:Vh},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:hu,shift:_u,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>du(e,!cu(e)),shift:e=>Eu(e,!cu(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>ou(e,t=>wu(e,t,!cu(e))),shift:e=>Cu(e,t=>wu(e,t,!cu(e))),preventDefault:!0},{key:"ArrowRight",run:uu,shift:Su,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>du(e,cu(e)),shift:e=>Eu(e,cu(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>ou(e,t=>wu(e,t,cu(e))),shift:e=>Cu(e,t=>wu(e,t,cu(e))),preventDefault:!0},{key:"ArrowUp",run:mu,shift:Ou,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Iu,shift:Nu},{mac:"Ctrl-ArrowUp",run:xu,shift:Du},{key:"ArrowDown",run:Au,shift:Mu,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Pu,shift:Lu},{mac:"Ctrl-ArrowDown",run:yu,shift:Ru},{key:"PageUp",run:xu,shift:Du},{key:"PageDown",run:yu,shift:Ru},{key:"Home",run:e=>ou(e,t=>wu(e,t,!1)),shift:e=>Cu(e,t=>wu(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:Iu,shift:Nu},{key:"End",run:e=>ou(e,t=>wu(e,t,!0)),shift:e=>Cu(e,t=>wu(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:Pu,shift:Lu},{key:"Enter",run:Yu,shift:Yu},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Wu,shift:Wu,preventDefault:!0},{key:"Delete",run:Hu,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:$u,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>qu(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>ju(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>ju(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat([{key:"Ctrl-b",run:hu,shift:_u,preventDefault:!0},{key:"Ctrl-f",run:uu,shift:Su},{key:"Ctrl-p",run:mu,shift:Ou},{key:"Ctrl-n",run:Au,shift:Mu},{key:"Ctrl-a",run:e=>ou(e,t=>Pe.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>Cu(e,t=>Pe.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>ou(e,t=>Pe.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>Cu(e,t=>Pe.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:Hu},{key:"Ctrl-h",run:Wu},{key:"Ctrl-k",run:e=>ju(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:$u},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:he.of(["",""])},range:Pe.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),r=n==i.from?n-1:xe(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:xe(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(r,n))},range:Pe.cursor(s)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:yu}].map(e=>({mac:e.key,run:e.run,shift:e.shift}))));function Zu(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?e.setAttribute(i,r):null!=r&&(e[i]=r)}t++}for(;t<arguments.length;t++)ed(e,arguments[t]);return e}function ed(e,t){if("string"==typeof t)e.appendChild(document.createTextNode(t));else if(null==t);else if(null!=t.nodeType)e.appendChild(t);else{if(!Array.isArray(t))throw new RangeError("Unsupported child node: "+t);for(var n=0;n<t.length;n++)ed(e,t[n])}}class td{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class nd{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=n.facet(pd).markerFilter;i&&(e=i(e,n));let r=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),s=new Ot,o=[],l=0,a=n.doc.iter(),c=0,h=n.doc.length;for(let e=0;;){let t,n,i=e==r.length?null:r[e];if(!i&&!o.length)break;if(o.length)t=l,n=o.reduce((e,t)=>Math.min(e,t.to),i&&i.from>t?i.from:1e8);else{if(t=i.from,t>h)break;n=i.to,o.push(i),e++}for(;e<r.length;){let i=r[e];if(i.from!=t||!(i.to>i.from||i.to==t)){n=Math.min(i.from,n);break}o.push(i),e++,n=Math.min(i.to,n)}n=Math.min(n,h);let u=!1;if(o.some(e=>e.from==t&&(e.to==n||n==h))&&(u=t==n,!u&&n-t<10)){let e=t-(c+a.value.length);e>0&&(a.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!a.lineBreak&&c+a.value.length>e)break;e=c+a.value.length,c+=a.value.length,a.next()}}let d=_d(o);if(u)s.add(t,t,bn.widget({widget:new bd(d),diagnostics:o.slice()}));else{let e=o.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");s.add(t,n,bn.mark({class:"cm-lintRange cm-lintRange-"+d+e,diagnostics:o.slice(),inclusiveEnd:o.some(e=>e.to>n)}))}if(l=n,l==h)break;for(let e=0;e<o.length;e++)o[e].to<=l&&o.splice(e--,1)}let u=s.finish();return new nd(u,t,id(u))}}function id(e,t=null,n=0){let i=null;return e.between(n,1e9,(e,n,{spec:r})=>{if(!(t&&r.diagnostics.indexOf(t)<0))if(i){if(r.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new td(i.from,n,i.diagnostic)}else i=new td(e,n,t||r.diagnostics[0])}),i}function rd(e,t){return e.field(ad,!1)?t:t.concat(ht.appendConfig.of(Sd))}const sd=ht.define(),od=ht.define(),ld=ht.define(),ad=$e.define({create:()=>new nd(bn.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),i=null,r=e.panel;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);i=id(n,e.selected.diagnostic,r)||id(n,null,r)}!n.size&&r&&t.state.facet(pd).autoPanel&&(r=null),e=new nd(n,r,i)}for(let n of t.effects)if(n.is(sd)){let i=t.state.facet(pd).autoPanel?n.value.length?yd.open:null:e.panel;e=nd.init(n.value,i,t.state)}else n.is(od)?e=new nd(e.diagnostics,n.value?yd.open:null,e.selected):n.is(ld)&&(e=new nd(e.diagnostics,e.panel,n.value));return e},provide:e=>[Vo.from(e,e=>e.panel),io.decorations.from(e,e=>e.diagnostics)]}),cd=bn.mark({class:"cm-lintRange cm-lintRange-active"});function hd(e,t,n){let i,{diagnostics:r}=e.state.field(ad),s=-1,o=-1;r.between(t-(n<0?1:0),t+(n>0?1:0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=l.diagnostics,s=e,o=r,!1});let l=e.state.facet(pd).tooltipFilter;return i&&l&&(i=l(i,e.state)),i?{pos:s,end:o,above:e.state.doc.lineAt(s).to<o,create:()=>({dom:ud(e,i)})}:null}function ud(e,t){return Zu("ul",{class:"cm-tooltip-lint"},t.map(t=>vd(e,t,!1)))}const dd=e=>{let t=e.state.field(ad,!1);return!(!t||!t.panel||(e.dispatch({effects:od.of(!1)}),0))},fd=Ri.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(pd);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){clearTimeout(this.timeout);let e=Date.now();if(e<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-e);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(pd);t.length&&function(e,t,n){let i=[],r=-1;for(let s of e)s.then(n=>{i.push(n),clearTimeout(r),i.length==e.length?t(i):r=setTimeout(()=>t(i),200)},n)}(t.map(e=>Promise.resolve(e(this.view))),t=>{this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:rd(e,[sd.of(t)])}}(this.view.state,t.reduce((e,t)=>e.concat(t))))},e=>{Oi(this.view.state,e)})}}update(e){let t=e.state.facet(pd);(e.docChanged||t!=e.startState.facet(pd)||t.needsRefresh&&t.needsRefresh(e))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),pd=Fe.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...wt(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:gd,tooltipFilter:gd,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,i,r)=>e(n,i,r)||t(n,i,r):e:t,autoPanel:(e,t)=>e||t})})});function gd(e,t){return e?t?(n,i)=>t(e(n,i),i):e:t}function md(e,t={}){return[pd.of({source:e,config:t}),fd,Sd]}function Ad(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;e<n.length;e++){let i=n[e];if(/[a-zA-Z]/.test(i)&&!t.some(e=>e.toLowerCase()==i.toLowerCase())){t.push(i);continue e}}t.push("")}return t}function vd(e,t,n){var i;let r=n?Ad(t.actions):[];return Zu("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Zu("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null===(i=t.actions)||void 0===i?void 0:i.map((n,i)=>{let s=!1,o=i=>{if(i.preventDefault(),s)return;s=!0;let r=id(e.state.field(ad).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:l}=n,a=r[i]?l.indexOf(r[i]):-1,c=a<0?l:[l.slice(0,a),Zu("u",l.slice(a,a+1)),l.slice(a+1)];return Zu("button",{type:"button",class:"cm-diagnosticAction"+(n.markClass?" "+n.markClass:""),onclick:o,onmousedown:o,"aria-label":` Action: ${l}${a<0?"":` (access key "${r[i]})"`}.`},c)}),t.source&&Zu("div",{class:"cm-diagnosticSource"},t.source))}class bd extends An{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Zu("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class xd{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=vd(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class yd{constructor(e){this.view=e,this.items=[],this.list=Zu("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(!(t.ctrlKey||t.altKey||t.metaKey)){if(27==t.keyCode)dd(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=Ad(n.actions);for(let r=0;r<i.length;r++)if(i[r].toUpperCase().charCodeAt(0)==t.keyCode){let t=id(this.view.state.field(ad).diagnostics,n);t&&n.actions[r].apply(e,t.from,t.to)}}}t.preventDefault()}},onclick:e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)}}),this.dom=Zu("div",{class:"cm-panel-lint"},this.list,Zu("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>dd(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ad).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(ad),n=0,i=!1,r=null,s=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:l})=>{for(let e of l.diagnostics){if(s.has(e))continue;s.add(e);let o,l=-1;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){l=t;break}l<0?(o=new xd(this.view,e),this.items.splice(n,0,o),i=!0):(o=this.items[l],l>n&&(this.items.splice(n,l-n),i=!0)),t&&o.diagnostic==t.diagnostic?o.dom.hasAttribute("aria-selected")||(o.dom.setAttribute("aria-selected","true"),r=o):o.dom.hasAttribute("aria-selected")&&o.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)i=!0,this.items.pop();0==this.items.length&&(this.items.push(new xd(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),i=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=id(this.view.state.field(ad).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:ld.of(t)})}static open(e){return new yd(e)}}function wd(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Cd=io.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:wd("#d11")},".cm-lintRange-warning":{backgroundImage:wd("orange")},".cm-lintRange-info":{backgroundImage:wd("#999")},".cm-lintRange-hint":{backgroundImage:wd("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function kd(e){return"error"==e?4:"warning"==e?3:"info"==e?2:1}function _d(e){let t="hint",n=1;for(let i of e){let e=kd(i.severity);e>n&&(n=e,t=i.severity)}return t}const Sd=[ad,io.decorations.compute([ad],e=>{let{selected:t,panel:n}=e.field(ad);return t&&n&&t.from!=t.to?bn.set([cd.range(t.from,t.to)]):bn.none}),Io(hd,{hideOn:function(e,t){let n=t.pos,i=t.end||n,r=e.state.facet(pd).hideOn(e,n,i);if(null!=r)return r;let s=e.startState.doc.lineAt(t.pos);return!(!e.effects.some(e=>e.is(sd))&&!e.changes.touchesRange(s.from,Math.max(s.to,i)))}}),Cd];class Ed{constructor(e,t,n,i,r,s,o,l,a,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=l,this.curContext=a,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new Ed(e,[],t,n,n,0,[],0,i?new Td(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:r}=this.p,s=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),o=r.dynamicPrecedence(i);if(o&&(this.score+=o),0==n)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i<r.minRepeatTerm&&this.storeNode(i,this.reducePos,this.reducePos,s?8:4,!0),void this.reduceContext(i,this.reducePos);let l=this.stack.length-3*(n-1)-(262144&e?6:0),a=l?this.stack[l-2]:this.p.ranges[0].from,c=this.reducePos-a;c>=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=c));let h=l?this.stack[l-1]:0,u=this.bufferBase+this.buffer.length-h;if(i<r.minRepeatTerm||131072&e){let e=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(i,a,e,u+4,!0)}if(262144&e)this.state=this.stack[l];else{let e=this.stack[l-3];this.state=r.getGoto(e,i,!0)}for(;this.stack.length>l;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,t,n,i=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let e=this,i=this.buffer.length;if(0==i&&e.parent&&(i=e.bufferBase-e.parent.bufferBase,e=e.parent),i>0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&(0!=this.buffer[r-4]||this.buffer[r-1]<0)){let e=!1;for(let t=r;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4)}this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(262144&e)this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4);else{let r=e,{parser:s}=this.p;this.pos=i;let o=s.stateFlag(r,1);!o&&(i>n||t<=s.maxNode)&&(this.reducePos=i),this.pushState(r,o?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,i,4)}}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new Ed(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new Od(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(!(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r<t.length;r+=2)(i=t[r+1])!=this.state&&this.p.parser.hasAction(i,e)&&n.push(t[r],i);if(this.stack.length<120)for(let e=0;n.length<8&&e<t.length;e+=2){let i=t[e+1];n.some((e,t)=>1&t&&e==i)||n.push(t[e],i)}t=n}let n=[];for(let e=0;e<t.length&&n.length<4;e+=2){let i=t[e+1];if(i==this.state)continue;let r=this.split();r.pushState(i,this.pos),r.storeNode(0,r.pos,r.pos,4,!0),r.shiftContext(t[e],this.pos),r.reducePos=this.pos,r.score-=200,n.push(r)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if(!(65536&t))return!1;if(!e.validAction(this.state,t)){let n=t>>19,i=65535&t,r=this.stack.length-3*n;if(r<0||e.getGoto(this.stack[r],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,r)=>{if(!t.includes(i))return t.push(i),e.allActions(i,t=>{if(393216&t);else if(65536&t){let n=(t>>19)-r;if(n>1){let i=65535&t,r=this.stack.length-3*n;if(r>=0&&e.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,r+1);if(null!=e)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||-3!=this.buffer[e])&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||-4!=this.buffer[e])&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Td(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return!(e<=this.lookAhead||(this.emitLookAhead(),this.lookAhead=e,0))}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Td{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class Od{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Md{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Md(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,0==this.index&&this.maybeNext()}fork(){return new Md(this.stack,this.pos,this.index)}}function Bd(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,r=0;i<e.length;){let s=0;for(;;){let t=e.charCodeAt(i++),n=!1;if(126==t){s=65535;break}t>=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,n=!0),s+=r,n)break;s*=46}n?n[r++]=s:n=new t(s)}return n}class Dd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Rd=new Dd;class Id{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Rd,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,r=this.pos+e;for(;r<n.from;){if(!i)return null;let e=this.ranges[--i];r-=n.from-e.to,n=e}for(;t<0?r>n.to:r>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];r+=e.from-n.to,n=e}return r}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i<this.chunk.length)t=this.pos+e,n=this.chunk.charCodeAt(i);else{let i=this.resolveOffset(e,1);if(null==i)return-1;if(t=i,t>=this.chunk2Pos&&t<this.chunk2Pos+this.chunk2.length)n=this.chunk2.charCodeAt(t-this.chunk2Pos);else{let e=this.rangeIndex,i=this.range;for(;i.to<=t;)i=this.ranges[++e];this.chunk2=this.input.chunk(this.chunk2Pos=t),t+this.chunk2.length>i.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Rd,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Pd{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;!function(e,t,n,i,r,s){let o=0,l=1<<i,{dialect:a}=n.p.parser;e:for(;0!=(l&e[o]);){let n=e[o+1];for(let i=o+3;i<n;i+=2)if((e[i+1]&l)>0){let n=e[i];if(a.allows(n)&&(-1==t.token.value||t.token.value==n||Ld(n,t.token.value,r,s))){t.acceptToken(n);break}}let i=t.next,c=0,h=e[o+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3])){for(;c<h;){let r=c+h>>1,s=n+r+(r<<1),l=e[s],a=e[s+1]||65536;if(i<l)h=r;else{if(!(i>=a)){o=e[s+2],t.advance();continue e}c=r+1}}break}o=e[n+3*h-1]}}(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}function Nd(e,t,n){for(let i,r=t;65535!=(i=e[r]);r++)if(i==n)return r-t;return-1}function Ld(e,t,n,i){let r=Nd(n,i,t);return r<0||Nd(n,i,e)<r}Pd.prototype.contextual=Pd.prototype.fallback=Pd.prototype.extend=!1,Pd.prototype.fallback=Pd.prototype.extend=!1;const Fd="undefined"!=typeof process&&process.env&&/\bparse\b/.test(process.env.LOG);let jd=null;function zd(e,t,n){let i=e.cursor(dl.IncludeAnonymous);for(i.moveTo(t);;)if(!(n<0?i.childBefore(t):i.childAfter(t)))for(;;){if((n<0?i.to<t:i.from>t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class Vd{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?zd(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?zd(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],i=this.index[t];if(i==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=n.children[i],s=this.start[t]+n.positions[i];if(s>e)return this.nextStart=s,null;if(r instanceof fl){if(s==e){if(s<this.safeFrom)return null;let e=s+r.length;if(e<=this.safeTo){let t=r.prop(sl.lookAhead);if(!t||e+t<this.fragment.to)return r}}this.index[t]++,s+r.length>=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+r.length}}}class Wd{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new Dd)}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:r}=i,s=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let i=0;i<r.length;i++){if(!(1<<i&s))continue;let a=r[i],c=this.tokens[i];if((!n||a.fallback)&&((a.contextual||c.start!=e.pos||c.mask!=s||c.context!=o)&&(this.updateCachedToken(c,a,e),c.mask=s,c.context=o),c.lookAhead>c.end+25&&(l=Math.max(c.lookAhead,l)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!a.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return l&&e.setLookAhead(l),n||e.pos!=this.stream.end||(n=new Dd,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Dd,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i<t.specialized.length;i++)if(t.specialized[i]==e.value){let r=t.specializers[i](this.stream.read(e.start,e.end),n);if(r>=0&&n.p.parser.dialect.allows(r>>1)){1&r?e.extended=r>>1:e.value=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t<i;t+=3)if(this.actions[t]==e)return i;return this.actions[i++]=e,this.actions[i++]=t,this.actions[i++]=n,i}addActions(e,t,n,i){let{state:r}=e,{parser:s}=e.p,{data:o}=s;for(let e=0;e<2;e++)for(let l=s.stateSlot(r,e?2:1);;l+=3){if(65535==o[l]){if(1!=o[l+1]){0==i&&2==o[l+1]&&(i=this.putAction(Kd(o,l+2),t,n,i));break}l=Kd(o,l+2)}o[l]==t&&(i=this.putAction(Kd(o,l+1),t,n,i))}return i}}class Hd{constructor(e,t,n,i){this.parser=e,this.input=t,this.ranges=i,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new Id(t,i),this.tokens=new Wd(e,this.stream),this.topTerm=e.top[1];let{from:r}=i[0];this.stacks=[Ed.start(this,e.top[0],r)],this.fragments=n.length&&this.stream.end-r>4*e.bufferLength?new Vd(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;s<n.length;s++){let o=n[s];for(;;){if(this.tokens.mainToken=null,o.pos>i)r.push(o);else{if(this.advanceStack(o,r,n))continue;{e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);t.push(n.value,n.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.score<n.score)&&(t=n)}return t}(e);if(t)return Fd&&console.log("Finish with "+this.stackID(t)),this.stackToTree(t);if(this.parser.strict)throw Fd&&e&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+i);this.recovering||(this.recovering=5)}if(this.recovering&&e){let n=null!=this.stoppedAt&&e[0].pos>this.stoppedAt?e[0]:this.runRecovery(e,t,r);if(n)return Fd&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort((e,t)=>t.score-e.score);r.length>e;)r.pop();r.some(e=>e.reducePos>i)&&this.recovering--}else if(r.length>1){e:for(let e=0;e<r.length-1;e++){let t=r[e];for(let n=e+1;n<r.length;n++){let i=r[n];if(t.sameState(i)||t.buffer.length>500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(n--,1)}}}r.length>12&&(r.sort((e,t)=>t.score-e.score),r.splice(12,r.length-12))}this.minStackPos=r[0].pos;for(let e=1;e<r.length;e++)r[e].pos<this.minStackPos&&(this.minStackPos=r[e].pos);return null}stopAt(e){if(null!=this.stoppedAt&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let i=e.pos,{parser:r}=this,s=Fd?this.stackID(e)+" -> ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(i);o;){let i=this.parser.nodeSet.types[o.type.id]==o.type?r.getGoto(e.state,o.type.id):-1;if(i>-1&&o.length&&(!t||(o.prop(sl.contextHash)||0)==n))return e.useNode(o,i),Fd&&console.log(s+this.stackID(e)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof fl)||0==o.children.length||o.positions[0]>0)break;let l=o.children[0];if(!(l instanceof fl&&0==o.positions[0]))break;o=l}}let o=r.stateSlot(e.state,4);if(o>0)return e.reduce(o),Fd&&console.log(s+this.stackID(e)+` (via always-reduce ${r.getName(65535&o)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let o=0;o<l.length;){let a=l[o++],c=l[o++],h=l[o++],u=o==l.length||!n,d=u?e:e.split(),f=this.tokens.mainToken;if(d.apply(a,c,f?f.start:d.pos,h),Fd&&console.log(s+this.stackID(d)+` (via ${65536&a?`reduce of ${r.getName(65535&a)}`:"shift"} for ${r.getName(c)} @ ${i}${d==e?"":", split"})`),u)return!0;d.pos>i?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return qd(e,t),!0}}runRecovery(e,t,n){let i=null,r=!1;for(let s=0;s<e.length;s++){let o=e[s],l=t[s<<1],a=t[1+(s<<1)],c=Fd?this.stackID(o)+" -> ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),Fd&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let h=o.split(),u=c;for(let e=0;e<10&&h.forceReduce()&&(Fd&&console.log(u+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));e++)Fd&&(u=this.stackID(h)+" -> ");for(let e of o.recoverByInsert(l))Fd&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>o.pos?(a==o.pos&&(a++,l=0),o.recoverByDelete(l,a),Fd&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),qd(o,n)):(!i||i.score<h.score)&&(i=h)}return i}stackToTree(e){return e.close(),fl.build({buffer:Md.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(jd||(jd=new WeakMap)).get(e);return t||jd.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function qd(e,t){for(let n=0;n<t.length;n++){let i=t[n];if(i.pos==e.pos&&i.sameState(e))return void(t[n].score<e.score&&(t[n]=e))}t.push(e)}class $d{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||0==this.disabled[e]}}class Ud extends Dl{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;n<e.repeatNodeCount;n++)t.push("");let n=Object.keys(e.topRules).map(t=>e.topRules[t][1]),i=[];for(let e=0;e<t.length;e++)i.push([]);function r(e,t,n){i[e].push([t,t.deserialize(String(n))])}if(e.nodeProps)for(let t of e.nodeProps){let e=t[0];"string"==typeof e&&(e=sl[e]);for(let n=1;n<t.length;){let i=t[n++];if(i>=0)r(i,e,t[n++]);else{let s=t[n+-i];for(let o=-i;o>0;o--)r(t[n++],e,s);n++}}}this.nodeSet=new cl(t.map((t,r)=>al.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=nl;let s=Bd(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e<this.specializerSpecs.length;e++)this.specialized[e]=this.specializerSpecs[e].term;this.specializers=this.specializerSpecs.map(Gd),this.states=Bd(e.states,Uint32Array),this.data=Bd(e.stateData),this.goto=Bd(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(e=>"number"==typeof e?new Pd(s,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let i=new Hd(this,e,t,n);for(let r of this.wrappers)i=r(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let r=i[t+1];;){let t=i[r++],s=1&t,o=i[r++];if(s&&n)return o;for(let n=r+(t>>1);r<n;r++)if(i[r]==e)return o;if(s)return-1}}hasAction(e,t){let n=this.data;for(let i=0;i<2;i++)for(let r,s=this.stateSlot(e,i?2:1);;s+=3){if(65535==(r=n[s])){if(1!=n[s+1]){if(2==n[s+1])return Kd(n,s+2);break}r=n[s=Kd(n,s+2)]}if(r==t||0==r)return Kd(n,s+1)}return 0}stateSlot(e,t){return this.states[6*e+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,e=>e==t||null)}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Kd(this.data,n+2)}i=t(Kd(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Kd(this.data,n+2)}if(!(1&this.data[n+2])){let e=this.data[n+1];t.some((t,n)=>1&n&&t==e)||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(Ud.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(t=>{let n=e.tokenizers.find(e=>e.from==t);return n?n.to:t})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,i)=>{let r=e.specializers.find(e=>e.from==n.external);if(!r)return n;let s=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[i]=Gd(s),s})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;e<t.length;e++)if(!n[e])for(let n,r=this.dialects[t[e]];65535!=(n=this.data[r++]);)(i||(i=new Uint8Array(this.maxTerm+1)))[n]=1;return new $d(e,n,i)}static deserialize(e){return new Ud(e)}}function Kd(e,t){return e[t]|e[t+1]<<16}function Gd(e){if(e.external){let t=e.extend?1:0;return(n,i)=>e.external(n,i)<<1|t}return e.get}const Yd=Fl({String:sa.string,Number:sa.number,"True False":sa.bool,PropertyName:sa.propertyName,Null:sa.null,", :":sa.separator,"[ ]":sa.squareBracket,"{ }":sa.brace}),Jd=Ud.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Yd],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Qd=ua.define({name:"json",parser:Jd.configure({props:[Oa.add({Object:Pa({except:/^\s*\}/}),Array:Pa({except:/^\s*\]/})}),La.add({"Object Array":function(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Xd(){return new wa(Qd)}const Zd=[io.theme({"&":{height:"100%",width:"100%"},".cm-scroller":{overflow:"auto"},"& .cm-content":{padding:"0px"},"& .cm-line":{padding:"0px"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-completionInfo":{whiteSpace:"pre-wrap",overflow:"hidden",textOverflow:"ellipsis"},"&.cm-editor":{height:"100%"},"& .cm-completionInfo > *":{whiteSpace:"normal"},"& .cm-completionInfo ul":{margin:0,paddingLeft:"15px"},"& .cm-completionInfo pre":{marginBottom:0,whiteSpace:"pre-wrap"},"& .cm-completionInfo p":{marginTop:0},"& .cm-completionInfo p:not(:last-of-type)":{marginBottom:0},"& .cm-completionDetail":{float:"right",fontStyle:"normal"}}),io.baseTheme({"& .variableName":{color:"#10f"},"& .number":{color:"#164"},"& .string":{color:"#a11"},"& .bool":{color:"#219"},"& .function":{color:"#aa3731",fontWeight:"bold"},"& .control":{color:"#708"}}),function(e){let t,n=[dc];return e instanceof lc&&(e.module&&n.push(io.styleModule.of(e.module)),t=e.themeType),t?n.push(ac.computeN([io.darkTheme],n=>n.facet(io.darkTheme)==("dark"==t)?[e]:[])):n.push(ac.of(e)),n}(lc.define([{tag:sa.variableName,class:"variableName"},{tag:sa.name,class:"variableName"},{tag:sa.number,class:"number"},{tag:sa.string,class:"string"},{tag:sa.bool,class:"bool"},{tag:sa.function(sa.variableName),class:"function"},{tag:sa.function(sa.special(sa.variableName)),class:"function"},{tag:sa.controlKeyword,class:"control"},{tag:sa.operatorKeyword,class:"control"}]))];function ef(e){return[tf(e),io.updateListener.of(e=>{if(e.selectionSet||e.docChanged){const{state:t}=e,n=t.selection.main.head;if(!nf(da(t).resolve(n,-1)))return null;""===t.doc.lineAt(n).text.trim()&&setTimeout(()=>{gh(e.view)},100)}})]}function tf(e){return Nh({override:[t=>function(e,t){const{state:n,pos:i}=e,r=n.doc.lineAt(i),s=i-r.from;if(r.text.slice(0,s).includes(":"))return null;const o=da(n).resolve(i,-1);if(!nf(o))return null;const l=n.sliceDoc(o.from,i).startsWith('"'),a='"'===r.text[s],c=t.map(e=>({label:e.label,type:e.type,info:e.info,apply:(t,n,i,r)=>{const s=t.state.sliceDoc(i-1,r+1);s.startsWith('"')&&(i-=1),s.endsWith('"')&&(r+=1);let o=`"${e.label}": ,`,l=i+o.length-1,a=l;(function(e,t){const n=e.sliceDoc(t).trimStart();return n&&'"'===n[0]})(t.state,r)||(o=o.slice(0,-1));const c=t.state.update({changes:{from:i,to:r,insert:o},selection:{anchor:l,head:a}});t.dispatch(c)}})),h="Object"===o.name?i:o.from;return{from:l?h+1:h,to:a?r.to-1:r.to,options:c}}(t,e)]})}function nf(e){return!!function(e){let t=0,n=e;for(;n.parent;){if("Object"===n.name&&t++,t>1)return!1;n=n.parent}return!0}(e)&&["Object","PropertyName","⚠"].includes(e.name)}const rf="LOCAL",sf="PROCESS";function of(e,t,n,i){const r={};for(const s of e){const{name:e,value:o,variableKey:l}=s,a=lf(s,t,n,i);try{r[l]={name:e,value:JSON.parse(o),scope:a}}catch{r[l]={name:e,value:o,scope:a}}}return r}function lf(e,t,n,i){const{scopeKey:r}=e;return t.find(e=>e.elementInstanceKey===r&&e.elementId===i)?rf:r===n?sf:null}function af(e,t){return Object.values(e).reduce((e,n)=>(R(n)&&P(n,"name")&&t===n.scope&&(e[n.name]=n.value),e),{})}const cf=lt.define(),hf=new Ye,uf="JSON contains errors",df={},ff=[];function pf({allOutputs:e=df,value:n,onChange:i,onClear:r,onErrorChange:s,variablesForElement:o=ff}){const l=(0,S.useMemo)(()=>{const t=o.map(({name:e,detail:t,info:n})=>({label:e,type:"variable",info:()=>gf(0,"Process variable"),detail:t,value:n||void 0})),n=function(e){const t=[];for(const n in e)if(e[n]){const{variables:i={}}=e[n];N(i,e=>{if(!R(e)||!P(e,"name"))return;const{name:i,value:r,scope:s}=e;s===sf&&t.push({name:i,value:r,origin:n})})}return t}(e),i=n.map(({name:e,value:t,origin:n})=>({label:e,type:"variable",info:()=>gf(0,`Output variable from ${n}`),detail:mf(t),value:t}));return[...t,...i]},[e,o]),a=(0,S.useRef)(null),[c,h]=(0,S.useState)(),[u,d]=(0,S.useState)();return(0,S.useEffect)(()=>{if(!a.current)return;const e=yt.create({doc:n,extensions:[Nh(),[Th,kh],yc(),yt.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return e;let s=n.sliceString(r.from,i);if(!t.some(e=>e.test(s)))return e;let{state:o}=e,l=-1,a=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==l)continue;l=t.from;let n=Ea(o,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],r=Sa(o,n);i!=r&&a.push({from:t.from,to:t.from+i.length,insert:r})}return a.length?[e,{changes:a,sequential:!0}]:e}),uo.of([...Xu]),(new Ye).of(Xd()),(new Ye).of(yt.tabSize.of(2)),io.contentAttributes.of({"aria-label":"JSON editor",tabindex:"0"}),md(e=>{const t=(e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;const n=function(e,t){let n;return(n=e.message.match(/at position (\d+)/))?Math.min(+n[1],t.length):(n=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+n[1]).from+ +n[2]-1,t.length):0}(t,e.state.doc);return[{from:n,message:t.message,severity:"error",to:n}]}return[]})(e),n=t&&t.length>0;return s(n?uf:null),d(n?uf:null),t},{delay:300}),hf.of(ef(l)),vo("Enter process variables in JSON format"),sc(),uo.of(Ja),Zd,io.lineWrapping,io.updateListener.of(e=>{if(e.docChanged){if(e.transactions.some(e=>e.annotation(cf)))return;const t=e.state.doc.toString();i(t)}})]}),t=new io({state:e,parent:a.current});return h(t),()=>{t.destroy()}},[i]),(0,S.useEffect)(()=>{c&&c.dispatch({effects:hf.reconfigure(ef(l))})},[l,c]),(0,S.useEffect)(()=>{if(!c)return;const e=c.state.doc.toString();n!==e&&c.dispatch({changes:{from:0,to:e.length,insert:n},annotations:cf.of(!0)})},[c,n]),(0,E.jsxs)("div",{className:M()("code__editor",{"code__editor--error":u}),children:[(0,E.jsx)(t,{className:"code__editor-clear-button",renderIcon:f,iconDescription:"Clear editor",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:r}),(0,E.jsx)("div",{className:"code__editor-codemirror",children:(0,E.jsx)("div",{ref:a,className:"code__editor-codemirror-inner"})}),u&&(0,E.jsx)("div",{className:"code__editor-error",children:u})]})}function gf(e,t){const n=document.createElement("div"),i=(0,X.qV)((0,E.jsx)("div",{className:"info",children:(0,E.jsx)("span",{children:t})}));return n.innerHTML=i,n}function mf(e){const t=typeof e;return"object"===t?Array.isArray(e)?"Array":null===e?"null":"Object":t.charAt(0).toUpperCase()+t.slice(1)}function Af({allOutputs:e,input:t="",onErrorChange:n,onResetInput:r,onSetInput:s,variablesForElement:o}){return(0,E.jsxs)("div",{className:"input",children:[(0,E.jsx)("div",{className:"input__header",children:(0,E.jsx)("div",{className:"input__header--title",children:(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsxs)("span",{children:["Variables the process instance will be started with. ",(0,E.jsx)(i,{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),align:"bottom-start",children:(0,E.jsx)("span",{children:"Process variables"})})})}),(0,E.jsx)(pf,{allOutputs:e,value:t,onChange:s,onClear:()=>{r()},onErrorChange:n,variablesForElement:o}),(0,E.jsxs)("div",{className:"input__footer",children:[(0,E.jsx)("div",{className:"input__footer--icon",children:(0,E.jsx)(g,{})}),(0,E.jsx)("div",{className:"input__footer--text",children:"Optionally define process variables to start the process instance with."})]})]})}function vf({value:e}){const n=(0,S.useRef)(null),[i,r]=(0,S.useState)();return(0,S.useEffect)(()=>{if(!n.current)return;const t=yt.create({doc:e,extensions:[Xd(),yt.tabSize.of(2),yt.readOnly.of(!0),io.editable.of(!1),io.lineWrapping,sc(),uo.of(Ja),Zd]}),i=new io({state:t,parent:n.current});return r(i),()=>{i.destroy()}},[]),(0,S.useEffect)(()=>{if(!i)return;const t=i.state.doc.toString();e!==t&&i.dispatch({changes:{from:0,to:t.length,insert:e}})},[i,e]),(0,E.jsxs)("div",{className:"code__editor",children:[(0,E.jsx)(t,{className:"code__editor-copy-button",renderIcon:h,iconDescription:"Copy to clipboard",size:"sm",kind:"ghost",hasIconOnly:!0,onClick:()=>{navigator.clipboard.writeText(e)}}),(0,E.jsx)("div",{className:"code__editor-codemirror",children:(0,E.jsx)("div",{ref:n,className:"code__editor-codemirror-inner"})})]})}const bf="status",xf="job",yf="user-task",wf="message-subscription",Cf="element-instance",kf="deployed",_f="instance-started";function Sf(e){if(!e)return null;const t=new Date(e).getTime();return isNaN(t)?null:t}function Ef(e,t){return{state:e.state,type:e.type,elementId:e.elementId,kind:e.kind,listenerEventType:e.listenerEventType,jobKey:e.jobKey,creationTime:e.creationTime,endTime:e.endTime,...t}}function Tf(e,t){return{state:e.state||"",name:e.name,userTaskKey:e.userTaskKey,creationDate:e.creationDate,completionDate:e.completionDate,...t}}function Of(e,t){return{type:e.type,state:e.state,elementId:e.elementId,elementName:e.elementName,startDate:e.startDate,endDate:e.endDate,elementInstanceKey:e.elementInstanceKey,...t}}function Mf(e,t){return{messageName:e.messageName,elementId:e.elementId,messageSubscriptionState:e.messageSubscriptionState,messageSubscriptionKey:e.messageSubscriptionKey,...t}}function Bf(e,t,n){return{type:xf,data:Ef(e,n),timestamp:t}}class Df{constructor(e){var t;this._state=null,this._deployResponse=null,this._startInstanceResponse=null,this._polledResult=null,this._finishedResult=null,this._entries=[],this._elementRegistry=(null==e||null===(t=e.get)||void 0===t?void 0:t.call(e,"elementRegistry"))||null}setState(e,t=Date.now()){this._state={type:e,timestamp:t},this._updateEntries()}setDeployResponse(e,t=Date.now()){this._deployResponse={response:e,timestamp:t},this._updateEntries()}setStartInstanceResponse(e,t=Date.now()){this._startInstanceResponse={response:e,timestamp:t},this._updateEntries()}setPolledResult(e,t=Date.now()){this._polledResult={result:e,timestamp:t},this._updateEntries()}setFinishedResult(e,t=Date.now()){this._finishedResult={result:e,timestamp:t},this._updateEntries()}getEntries(){return this._entries}reset(){this._state=null,this._deployResponse=null,this._startInstanceResponse=null,this._polledResult=null,this._finishedResult=null,this._entries=[]}_updateEntries(){const e=[];if(this._deployResponse){const n=this._deployResponse.response;let i;if(!1!==n.success){var t;const e=n.response||n,r=null===(t=e.deployments)||void 0===t?void 0:t[0],s=r&&"processDefinition"in r?r.processDefinition:void 0;i={processDefinitionId:null==s?void 0:s.processDefinitionId,processDefinitionKey:null==s?void 0:s.processDefinitionKey,processDefinitionVersion:null==s?void 0:s.processDefinitionVersion,deploymentKey:e.deploymentKey}}e.push({type:bf,status:kf,data:i,timestamp:this._deployResponse.timestamp})}if(this._startInstanceResponse){const t=this._startInstanceResponse.response;let n;if(!1!==t.success){const e=t.response||t;n={processInstanceKey:e.processInstanceKey,processDefinitionId:e.processDefinitionId,processDefinitionKey:e.processDefinitionKey}}e.push({type:bf,status:_f,data:n,timestamp:this._startInstanceResponse.timestamp})}if(this._polledResult){var n,i,r,s;const{result:t,timestamp:o}=this._polledResult;let l=[];if(null!==(n=t.elementInstancesResponse)&&void 0!==n&&n.success&&(l=t.elementInstancesResponse.response.items||[],e.push(...function(e,t){const n=[];for(const i of e){const e=Sf(i.startDate);if(n.push({type:Cf,data:Of(i,{state:"ACTIVE"}),timestamp:e||t}),"ACTIVE"===i.state)continue;const r=Sf(i.endDate);n.push({type:Cf,data:Of(i),timestamp:r||t})}return n}(l,o))),null!==(i=t.jobsResponse)&&void 0!==i&&i.success){const n=t.jobsResponse.response.items||[];e.push(...function(e,t,n){const i=[];for(const r of e){let e=Sf(r.creationTime);if(!e&&r.elementInstanceKey&&t){const n=t.find(e=>e.elementInstanceKey===r.elementInstanceKey);if(null!=n&&n.startDate){const t=new Date(n.startDate).getTime();isNaN(t)||(e=t)}}if(i.push(Bf(r,e||n,{state:"CREATED"})),"CREATED"===r.state)continue;const s=Sf(r.endTime);i.push(Bf(r,s||n,{state:r.state}))}return i}(n,l,o))}if(null!==(r=t.userTasksResponse)&&void 0!==r&&r.success){const n=t.userTasksResponse.response.items||[];e.push(...function(e,t){const n=[];for(const i of e){const e=Sf(i.creationDate);if(n.push({type:yf,data:Tf(i,{state:"CREATED"}),timestamp:e||t}),"CREATED"===i.state)continue;const r=Sf(i.completionDate);n.push({type:yf,data:Tf(i),timestamp:r||t})}return n}(n,o))}if(null!==(s=t.messageSubscriptionsResponse)&&void 0!==s&&s.success){const n=t.messageSubscriptionsResponse.response.items||[];e.push(...function(e,t,n){const i=[];for(const r of e){let e=n,s=n;if(r.elementInstanceKey&&t){const n=t.find(e=>e.elementInstanceKey===r.elementInstanceKey);if(null!=n&&n.startDate){const t=new Date(n.startDate).getTime();isNaN(t)||(e=t)}if(null!=n&&n.endDate&&"CORRELATED"===r.messageSubscriptionState){const e=new Date(n.endDate).getTime();isNaN(e)||(s=e)}}i.push({type:wf,data:Mf(r,{messageSubscriptionState:"CREATED"}),timestamp:e}),"CORRELATED"===r.messageSubscriptionState&&i.push({type:wf,data:Mf(r),timestamp:s})}return i}(n,l,o))}}if(this._finishedResult){const{result:t,timestamp:n}=this._finishedResult;e.push(function(e,t){var n,i;if(e.success)return{type:bf,status:"completed",data:{processInstanceKey:e.processInstanceKey},timestamp:t};switch(e.reason){case"incident":return{type:bf,status:"incident",data:{processInstanceKey:e.processInstanceKey,errorType:null===(n=e.incident)||void 0===n?void 0:n.errorType,errorMessage:null===(i=e.incident)||void 0===i?void 0:i.errorMessage},timestamp:t};case"terminated":return{type:bf,status:"terminated",data:{processInstanceKey:e.processInstanceKey},timestamp:t};default:return{type:bf,status:"canceled",data:"error"in e?{error:e.error}:void 0,timestamp:t}}}(t,n))}this._state&&("deploying"===this._state.type&&!this._deployResponse||"starting-instance"===this._state.type&&!this._startInstanceResponse||"executing"===this._state.type&&!this._polledResult&&!this._finishedResult)&&e.push({type:bf,status:this._state.type,timestamp:this._state.timestamp}),e.sort((e,t)=>e.timestamp-t.timestamp),this._entries=e}}function Rf(e){let t=e.length;for(;t>0&&"/"===e[t-1];)t--;return e.slice(0,t)}const If={deploying:"Deploying process",deployed:"Process deployed","starting-instance":"Starting process instance","instance-started":"Process instance started",executing:null,completed:"Process instance completed",terminated:"Process instance terminated",incident:"Incident",canceled:"Test canceled"},Pf="CREATED",Nf="CREATED",Lf="ACTIVE";function Ff(e){const t=e.data;if(!t)return[];const n=[];return e.status===kf&&(t.processDefinitionId&&n.push({label:"Process",value:t.processDefinitionId}),t.processDefinitionKey&&n.push({label:"Definition Key",value:t.processDefinitionKey}),t.processDefinitionVersion&&n.push({label:"Version",value:String(t.processDefinitionVersion)}),t.deploymentKey&&n.push({label:"Deployment Key",value:t.deploymentKey})),e.status===_f&&(t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),t.processDefinitionId&&n.push({label:"Process",value:t.processDefinitionId}),t.processDefinitionKey&&n.push({label:"Definition Key",value:t.processDefinitionKey})),"completed"!==e.status&&"terminated"!==e.status||t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),"incident"===e.status&&(t.processInstanceKey&&n.push({label:"Instance Key",value:t.processInstanceKey}),t.errorType&&n.push({label:"Error Type",value:t.errorType}),t.errorMessage&&n.push({label:"Error",value:t.errorMessage})),n}function jf(e){return e<1e3?`${e}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.floor(e/6e4)}m ${Math.round(e%6e4/1e3)}s`}function zf({entries:e,tasklistBaseUrl:t,currentOperateUrl:n,isTaskExecuting:i}){if(!e.length)return(0,E.jsx)("div",{className:"execution-log",children:(0,E.jsxs)("div",{className:"execution-log__empty",children:["No log entries yet. Click ",(0,E.jsx)("span",{className:"execution-log__empty-action",children:"Test"})," to execute the task."]})});const r=function(e,t){if(!t)return[];const n=[];for(const t of e)t.type===xf&&t.data.state===Pf?n.push({label:"Waiting for job to be completed",secondaryLabel:t.data.type}):t.type===yf&&t.data.state===Nf?n.push({label:"Waiting for user task to be completed",secondaryLabel:t.data.name||t.data.elementId}):t.type===wf&&"CREATED"===t.data.messageSubscriptionState&&n.push({label:"Waiting for message to be correlated",secondaryLabel:t.data.messageName});return n}(e,i);return(0,E.jsxs)("div",{className:"execution-log",children:[(0,E.jsxs)("ol",{className:"execution-log__entries",children:[e.map((e,t)=>e.type===bf?(0,E.jsx)(Vf,{entry:e},t):(0,E.jsx)(Wf,{entry:e},t)),r.map((e,t)=>(0,E.jsx)("li",{className:"execution-log__entry-wrapper execution-log__entry-wrapper--active",children:(0,E.jsx)("div",{className:"execution-log__entry-content",children:(0,E.jsx)("div",{className:"execution-log__entry",children:(0,E.jsxs)("div",{className:"execution-log__labels",children:[(0,E.jsx)("div",{className:"execution-log__label-row",children:(0,E.jsx)("span",{className:"execution-log__label",children:e.label})}),(0,E.jsx)("span",{className:"execution-log__secondary-label",children:e.secondaryLabel})]})})})},`waiting-${t}`))]}),(0,E.jsx)(Hf,{entries:e,currentOperateUrl:n,isTaskExecuting:i}),(0,E.jsx)(qf,{entries:e,currentOperateUrl:n,isTaskExecuting:i}),(0,E.jsx)($f,{entries:e,tasklistBaseUrl:t,isTaskExecuting:i})]})}function Vf({entry:e}){const[t,n]=(0,S.useState)(!1),i=If[e.status];if(!i)return null;const r=Ff(e),s=r.length>0,o=s,l=()=>{o&&n(!t)};return(0,E.jsx)("li",{className:"execution-log__entry-wrapper",children:(0,E.jsxs)("div",{className:"execution-log__entry-content",children:[(0,E.jsxs)("div",{className:M()("execution-log__entry",{"execution-log__entry--expandable":o}),onClick:o?l:void 0,children:[(0,E.jsx)("span",{className:"execution-log__label",children:i}),o&&(0,E.jsx)("span",{className:"execution-log__toggle",onClick:e=>{e.stopPropagation(),l()},children:t?(0,E.jsx)(a,{size:16,className:"execution-log__chevron execution-log__chevron--open"}):(0,E.jsx)(c,{size:16,className:"execution-log__chevron"})})]}),t&&s&&(0,E.jsx)("dl",{className:"execution-log__details",children:r.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"execution-log__details-row",children:[(0,E.jsx)("dt",{className:"execution-log__details-label",children:e}),(0,E.jsx)("dd",{className:"execution-log__details-value",children:t})]},n))})]})})}function Wf({entry:e}){const[t,n]=(0,S.useState)(!1),i=function(e){switch(e.type){case bf:return If[e.status]||null;case xf:return"CANCELED"===(t=e.data).state?"Job canceled":"COMPLETED"===t.state?"Job completed":t.state===Pf?"Job created":"ERROR_THROWN"===t.state?"Job threw an error":"FAILED"===t.state?"Job failed":"MIGRATED"===t.state?"Job migrated":"RETRIES_UPDATED"===t.state?"Job retries updated":"TIMED_OUT"===t.state?"Job timed out":void 0;case yf:return function(e){return"COMPLETED"===e.state?"User task completed":"CANCELED"===e.state?"User task canceled":e.state===Nf?"User task created":void 0}(e.data);case wf:return function(e){return"CREATED"===e.messageSubscriptionState?"Message subscription created":"CORRELATED"===e.messageSubscriptionState?"Message correlated":"CANCELED"===e.messageSubscriptionState?"Message subscription canceled":void 0}(e.data);case Cf:return function(e){const{type:t,state:n}=e;if("BOUNDARY_EVENT"===t)return n===Lf?"Boundary event triggered":"Boundary event completed";if("EVENT_SUB_PROCESS"===t)return n===Lf?"Event sub-process triggered":"Event sub-process completed";const i=function(e){return(e||"").toLowerCase().replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase())}(t);return n===Lf?`${i} activated`:`${i} completed`}(e.data);default:return null}var t}(e),r=function(e){var t,n,i,r,s;switch(e.type){case Cf:return(null===(t=e.data)||void 0===t?void 0:t.elementName)||(null===(n=e.data)||void 0===n?void 0:n.elementId)||null;case xf:return(null===(i=e.data)||void 0===i?void 0:i.type)||null;case wf:return(null===(r=e.data)||void 0===r?void 0:r.messageName)||null;case yf:return(null===(s=e.data)||void 0===s?void 0:s.name)||null;default:return null}}(e),s=function(e){const{data:t,type:n}=e;if(n===Cf){const{endDate:e,startDate:n,state:i}=t;if(["COMPLETED","TERMINATED"].includes(i)&&n&&e)return jf(new Date(e).getTime()-new Date(n).getTime())}else if(n===xf){const{creationTime:e,endTime:n,state:i}=t;if(["COMPLETED","FAILED"].includes(i)&&e&&n)return jf(new Date(n).getTime()-new Date(e).getTime())}else if(n===yf){const{completionDate:e,creationDate:n,state:i}=t;if(["CANCELED","COMPLETED","FAILED"].includes(i)&&n&&e)return jf(new Date(e).getTime()-new Date(n).getTime())}return null}(e),o=function(e){if(e.type===bf)return Ff(e);if(e.type===xf){const t=e.data,n=[];t.type&&n.push({label:"Type",value:t.type}),t.elementId&&n.push({label:"Element",value:t.elementId});const i=function(e){if(!e)return null;const{kind:t,listenerEventType:n}=e;return"EXECUTION_LISTENER"!==t?null:"START"===n?"Start execution listener":"END"===n?"End execution listener":null}(t);return i&&n.push({label:"Kind",value:i}),t.state&&n.push({label:"State",value:t.state}),t.jobKey&&n.push({label:"Job Key",value:t.jobKey}),n}if(e.type===wf){const t=e.data,n=[];return t.messageName&&n.push({label:"Message",value:t.messageName}),t.elementId&&n.push({label:"Element",value:t.elementId}),t.messageSubscriptionState&&n.push({label:"State",value:t.messageSubscriptionState}),t.messageSubscriptionKey&&n.push({label:"Subscription Key",value:t.messageSubscriptionKey}),n}if(e.type===Cf){const t=e.data,n=[];return t.elementId&&n.push({label:"Element",value:t.elementId}),t.elementName&&n.push({label:"Name",value:t.elementName}),t.state&&n.push({label:"State",value:t.state}),t.startDate&&n.push({label:"Started",value:new Date(t.startDate).toLocaleTimeString()}),t.elementInstanceKey&&n.push({label:"Instance Key",value:t.elementInstanceKey}),n}return[]}(e),l=o.length>0,h=l;if(!i)return null;const u=()=>{h&&n(!t)},d=["execution-log__entry",h?"execution-log__entry--expandable":""].filter(Boolean).join(" ");return(0,E.jsx)("li",{className:"execution-log__entry-wrapper",children:(0,E.jsxs)("div",{className:"execution-log__entry-content",children:[(0,E.jsxs)("div",{className:d,onClick:h?u:void 0,children:[(0,E.jsxs)("div",{className:"execution-log__labels",children:[(0,E.jsxs)("div",{className:"execution-log__label-row",children:[(0,E.jsx)("span",{className:"execution-log__label",children:i}),s&&(0,E.jsx)("span",{className:"execution-log__duration",children:s})]}),r&&(0,E.jsx)("span",{className:"execution-log__secondary-label",children:r})]}),h&&(0,E.jsx)("span",{className:"execution-log__toggle",onClick:e=>{e.stopPropagation(),u()},children:t?(0,E.jsx)(a,{size:16,className:"execution-log__chevron execution-log__chevron--open"}):(0,E.jsx)(c,{size:16,className:"execution-log__chevron"})})]}),t&&l&&(0,E.jsx)("dl",{className:"execution-log__details",children:o.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"execution-log__details-row",children:[(0,E.jsx)("dt",{className:"execution-log__details-label",children:e}),(0,E.jsx)("dd",{className:"execution-log__details-value",children:t})]},n))})]})})}function Hf({entries:e,currentOperateUrl:t,isTaskExecuting:n}){return n&&e.some(e=>e.type===xf&&"COMPLETED"!==e.data.state)?(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(d,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for job completion"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Ensure the corresponding job is completed to continue the test execution."}),t&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:t,target:"_blank",renderIcon:m,children:"Open in Operate"})]}):null}function qf({entries:e,currentOperateUrl:t,isTaskExecuting:n}){return n&&e.some(e=>e.type===wf&&"CREATED"===e.data.messageSubscriptionState)?(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(d,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for message correlation"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Ensure the required message is correlated to continue the test execution."}),t&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:t,target:"_blank",renderIcon:m,children:"Open in Operate"})]}):null}function $f({entries:e,tasklistBaseUrl:t,isTaskExecuting:n}){if(!n)return null;const r=e.find(e=>e.type===yf&&e.data.state===Nf);if(!r)return null;const s=function(e,t){try{const n=Rf(e);return new URL(t,`${n}/`).toString()}catch(e){return null}}(t,r.data.userTaskKey);return(0,E.jsxs)("div",{className:"execution-log__cta",children:[(0,E.jsxs)("div",{className:"execution-log__cta-header",children:[(0,E.jsx)(x,{size:16}),(0,E.jsx)("span",{className:"execution-log__cta-title",children:"Waiting for user task completion"})]}),(0,E.jsx)("p",{className:"execution-log__cta-description",children:"Complete the user task to continue the test execution."}),s&&(0,E.jsx)(i,{className:"execution-log__cta-link",href:s,target:"_blank",renderIcon:m,children:"Open in Tasklist"})]})}const Uf={plugins:[],registerPlugin:e=>{},unregisterPlugin:e=>{},getPlugins:e=>[]},Kf=(0,S.createContext)(Uf),Gf=[];function Yf({element:e,isConnectionConfigured:t,isTaskExecuting:n,output:i,currentOperateUrl:r,onResetOutput:s,taskExecutionState:l,executionLog:a,tasklistBaseUrl:c,currentVariables:h}){const u=(null==i?void 0:i.error)||(null==i?void 0:i.incident),d=(null==i?void 0:i.success)&&!u,f=null==i?void 0:i.terminated,g=null==i?void 0:i.canceled,m=(0,S.useMemo)(()=>u?"error":d?"success":f?"warning":g?"canceled":null,[u,d,f,g]),A=(0,S.useMemo)(()=>u?(0,E.jsx)(w,{}):d?(0,E.jsx)(o,{}):f?(0,E.jsx)(b,{}):g?(0,E.jsx)(p,{}):null,[u,d,f,g]),v=(0,S.useMemo)(()=>{if(null==i||!i.startedAt||null==i||!i.finishedAt)return null;const e=i.finishedAt-i.startedAt;return e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`},[i]);return(0,E.jsxs)("div",{className:"output",children:[n&&(0,E.jsx)(np,{currentOperateUrl:r}),!n&&i&&(0,E.jsx)(ip,{bannerVariant:m,statusIcon:A,timingText:v,onResetOutput:s,isConnectionConfigured:t,currentOperateUrl:r,element:e,output:i,isTaskExecuting:n}),n||i?(0,E.jsxs)("div",{className:"output__body",children:[(0,E.jsx)(sp,{title:"Log",defaultOpen:!0,isExecuting:n,children:(null==a?void 0:a.length)>0?(0,E.jsx)(zf,{entries:a,tasklistBaseUrl:c,currentOperateUrl:r,isTaskExecuting:n}):(0,E.jsx)("div",{className:"output__section-empty",children:"Result does not have a log."})}),(0,E.jsx)(op,{title:"Process Variables",tooltip:(0,E.jsxs)("span",{children:["Variables in the process scope. ",(0,E.jsx)("a",{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),scope:sf,output:i,currentVariables:h,isTaskExecuting:n}),(0,E.jsx)(op,{title:"Local Variables",tooltip:(0,E.jsxs)("span",{children:["Variables in the scope of the executed element. ",(0,E.jsx)("a",{href:"https://docs.camunda.io/docs/components/concepts/variables/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),scope:rf,output:i,currentVariables:h,isTaskExecuting:n})]}):(0,E.jsx)(tp,{})]})}const Jf=e=>{const{getPlugins:t}=(0,S.useContext)(Kf),n=t("output.header.link").reduce((t,n)=>{var i;const r=t=>I(t)?t(e):t;if(!(r(n.visible)??1))return t;const s=(null===(i=n.render)||void 0===i?void 0:i.call(n,e))||n.children;return t.push({content:s,href:r(n.href),target:r(n.target),className:r(n.className),onClick:r(n.onClick),renderIcon:r(n.renderIcon),role:r(n.role),tooltip:r(n.tooltip)}),t},[]);return(0,E.jsx)(E.Fragment,{children:n.map(({content:e,href:t,target:n,className:r,onClick:s,renderIcon:o,role:l,tooltip:a},c)=>{const h=(0,E.jsx)(i,{href:t,target:n,className:r,onClick:s,renderIcon:o,role:l,children:e},c);return a?(0,E.jsx)(T,{className:"has-tooltip",label:a,align:"bottom-start",children:h},c):h})})},Qf=()=>null,Xf=({children:e=null,render:t=Qf,visible:n,href:i,target:r,className:s,onClick:o,renderIcon:l,role:a,tooltip:c,priority:h=100})=>{const{registerPlugin:u,unregisterPlugin:d}=(0,S.useContext)(Kf);return(0,S.useEffect)(()=>{const f={children:e,render:t,visible:n,href:i,target:r,className:s,onClick:o,renderIcon:l,role:a,tooltip:c,priority:h,type:"output.header.link"};return u(f),()=>{d(f)}},[e,t,n,i,r,s,o,l,a,c,h,u,d]),null},Zf=()=>{const e=(0,S.useCallback)(()=>"Open in Operate",[]),t=(0,S.useCallback)(({output:e,isConnectionConfigured:t,currentOperateUrl:n})=>t&&(n||e&&!e.error),[]),n=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl),[]),i=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl)?void 0:"link--disabled",[]),r=(0,S.useCallback)(({output:e,currentOperateUrl:t})=>t||(null==e?void 0:e.operateUrl)?null:"Operate URL not found",[]);return(0,E.jsx)(Xf,{priority:1/0,render:e,visible:t,href:n,target:"_blank",className:i,tooltip:r,renderIcon:m})};function ep(){return(0,E.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,E.jsx)("mask",{id:"mask0_191_9328",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"24",height:"24",children:(0,E.jsx)("path",{d:"M24 0H0V24H24V0Z",fill:"white"})}),(0,E.jsxs)("g",{mask:"url(#mask0_191_9328)",children:[(0,E.jsx)("path",{d:"M19.3852 2.40472C21.2873 2.50108 22.8 4.07389 22.8 6.00002V13.2H21.3V6.00002C21.3 4.84022 20.3598 3.90002 19.2 3.90002H4.80001C3.64021 3.90002 2.70001 4.84022 2.70001 6.00002V15.6C2.70001 16.7598 3.64021 17.7 4.80001 17.7H13.2V19.2H4.80001C2.87388 19.2 1.30106 17.6873 1.2047 15.7852L1.20001 15.6V6.00002C1.20001 4.0118 2.81179 2.40002 4.80001 2.40002H19.2L19.3852 2.40472Z",fill:"currentColor"}),(0,E.jsx)("path",{d:"M15.9273 22.8C15.8405 22.8 15.7572 22.7579 15.6959 22.6829C15.6345 22.6079 15.6 22.5061 15.6 22.4V13.6001C15.6 13.5305 15.6148 13.4622 15.643 13.4018C15.6712 13.3415 15.7118 13.2911 15.7607 13.2557C15.8097 13.2203 15.8654 13.2011 15.9222 13.2C15.9791 13.1989 16.0352 13.216 16.0851 13.2496L22.6305 17.6495C22.6818 17.684 22.7247 17.7348 22.7544 17.7964C22.7843 17.858 22.8 17.9284 22.8 18C22.8 18.0716 22.7843 18.142 22.7544 18.2036C22.7247 18.2652 22.6818 18.316 22.6305 18.3505L16.0851 22.7504C16.0367 22.783 15.9825 22.8 15.9273 22.8Z",fill:"currentColor"})]})]})}function tp(){return(0,E.jsxs)("div",{className:"output__empty-state",children:[(0,E.jsx)("span",{className:"output__empty-state-icon",children:(0,E.jsx)(ep,{})}),(0,E.jsx)("span",{className:"output__empty-state-text",children:"Result will appear here after you run the test."})]})}function np({currentOperateUrl:e}){return(0,E.jsx)("div",{className:"output__banner output__banner--executing",children:(0,E.jsxs)("div",{className:"output__banner-header",children:[(0,E.jsxs)("div",{className:"output__banner-main",children:[(0,E.jsx)(n,{className:"output__banner-loader"}),(0,E.jsx)("span",{className:"output__banner-text",children:"Running test..."})]}),e&&(0,E.jsx)(i,{className:"output__banner-operate-link",href:e,target:"_blank",renderIcon:m,children:"Open in Operate"})]})})}function ip({bannerVariant:e,statusIcon:t,timingText:n,output:r,onResetOutput:s,isConnectionConfigured:o,currentOperateUrl:l,element:h,isTaskExecuting:u}){var d,f,p,g,m;const A=(0,S.useMemo)(()=>{if(r){var e;if(r.error)return r.error?`Error: ${null==r||null===(e=r.error)||void 0===e?void 0:e.message}`:"Error";if(r.incident)return r.incident.errorType?`Incident: ${r.incident.errorType}`:"Incident";if(r.success)return"Test completed";if(r.terminated)return"Process instance terminated";if(r.canceled)return"Test canceled"}return null},[r]),v=(0,S.useMemo)(()=>null!=r&&r.success?"See output variables below.":null!=r&&r.terminated?"The process instance was terminated before the test could complete. This might be the expected behavior.":null!=r&&r.canceled?"The test was manually canceled.":null,[r]),b=(0,S.useMemo)(()=>null!=r&&r.incident?function(e){const{errorType:t,errorMessage:n,creationTime:i,...r}=e,s=[];return t&&s.push({label:"Type",value:t}),i&&s.push({label:"Creation Time",value:new Date(i).toLocaleString()}),n&&s.push({label:"Message",value:n}),Object.entries(r).forEach(([e,t])=>{s.push({label:rp(e),value:String(t)})}),s}(r.incident):null,[r]),x=(null==r?void 0:r.error)||(null==r?void 0:r.incident),[y,w]=(0,S.useState)(!0);return(0,E.jsxs)("div",{className:`output__banner output__banner--${e}`,children:[(0,E.jsxs)("div",{className:"output__banner-header",onClick:x?()=>w(!y):void 0,children:[(0,E.jsxs)("div",{className:"output__banner-main",children:[(0,E.jsx)("span",{className:"output__banner-icon",children:t}),(0,E.jsx)("span",{className:"output__banner-text",children:A})]}),n&&(0,E.jsx)("span",{className:"output__banner-timing",children:n}),x&&(y?(0,E.jsx)(a,{size:16,className:"output__banner-chevron output__banner-chevron--open"}):(0,E.jsx)(c,{size:16,className:"output__banner-chevron"}))]}),y&&v&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsx)("div",{className:"output__banner-details-content",children:v})}),y&&(null==r?void 0:r.error)&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsxs)("div",{className:"output__banner-error",children:[(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsx)("span",{children:"Details about the error that occurred during task execution"}),align:"bottom-start",children:(0,E.jsx)("span",{className:"output__banner-error-heading",children:"Error details"})}),(0,E.jsxs)("div",{className:"output__banner-details-content",children:[(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Message"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:(null===(d=r.error)||void 0===d?void 0:d.message)||"No error message available"})]}),(null===(f=r.error)||void 0===f?void 0:f.detail)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Detail"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.detail})]}),(null===(p=r.error)||void 0===p?void 0:p.errorType)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Error type"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.errorType})]}),null!=(null===(g=r.error)||void 0===g?void 0:g.status)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Status"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.status})]}),(null===(m=r.error)||void 0===m?void 0:m.response)&&(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:"Response"}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:r.error.response})]})]})]})}),y&&b&&(0,E.jsx)("div",{className:"output__banner-details",children:(0,E.jsxs)("div",{className:"output__banner-incident",children:[(0,E.jsx)(T,{className:"has-tooltip",label:(0,E.jsxs)("span",{children:["Details about the incident that occurred during task execution ",(0,E.jsx)(i,{href:"https://docs.camunda.io/docs/components/concepts/incidents/",target:"_blank",rel:"noopener noreferrer",children:"Learn more."})]}),align:"bottom-start",children:(0,E.jsx)("span",{className:"output__banner-incident-heading",children:"Incident details"})}),(0,E.jsx)("div",{className:"output__banner-details-content",children:b.map(({label:e,value:t},n)=>(0,E.jsxs)("div",{className:"output__banner-details-row",children:[(0,E.jsx)("dt",{className:"output__banner-details-label",children:e}),(0,E.jsx)("dd",{className:"output__banner-details-value",children:t})]},n))})]})}),(0,E.jsxs)("div",{className:"output__banner-actions",children:[(0,E.jsx)(Zf,{}),(0,E.jsx)(Jf,{onResetOutput:s,isConnectionConfigured:o,currentOperateUrl:l,element:h,output:r,isTaskExecuting:u})]})]})}function rp(e){return e.replace(/([A-Z])/g," $1").replace(/^./,e=>e.toUpperCase())}function sp({title:e,tooltip:t,defaultOpen:n=!0,isExecuting:i=!1,children:r}){const[s,o]=(0,S.useState)(n),[l,h]=(0,S.useState)(!1),u=(0,S.useRef)(null);return(0,S.useEffect)(()=>{const e=u.current;if(!e)return;const t=e.closest(".task-testing-tabs__panel")||e.closest(".task-testing__container--body-executing");if(!t)return;const n=new IntersectionObserver(([e])=>{h(!e.isIntersecting)},{root:t,threshold:0});return n.observe(e),()=>n.disconnect()},[]),(0,E.jsxs)("div",{className:"output__collapsible"+(s?" output__collapsible--open":""),children:[(0,E.jsx)("div",{ref:u,className:"output__collapsible-sentinel"}),(0,E.jsxs)("button",{className:"output__collapsible-header"+(l?" stuck":""),onClick:()=>o(!s),children:[s?(0,E.jsx)(a,{size:16,className:"output__chevron output__chevron--open"}):(0,E.jsx)(c,{size:16,className:"output__chevron"}),t?(0,E.jsx)(T,{className:"has-tooltip",label:t,align:"bottom-start",children:(0,E.jsx)("span",{className:"output__collapsible-title",children:e})}):(0,E.jsx)("span",{className:"output__collapsible-title",children:e})]}),s&&(0,E.jsx)("div",{className:"output__collapsible-content",children:r})]})}function op({title:e,tooltip:t,scope:n,output:i,currentVariables:s,isTaskExecuting:o}){const l=o&&!s,a=(0,S.useMemo)(()=>o&&s&&Object.keys(s).length>0?af(s,n):i&&i.variables?af(i.variables,n):null,[o,s,i,n]),c=!a||0===Object.keys(a).length,h=c?"":JSON.stringify(a,null,2);return(0,E.jsx)(sp,{title:e,tooltip:t,defaultOpen:!0,isExecuting:o,children:l?(0,E.jsx)("div",{className:"output__variables--skeleton",children:(0,E.jsx)(r,{})}):(0,E.jsx)(vf,{value:c?"{}":h})})}function lp(e,t){return{message:e,response:null==t?void 0:t.error,errorType:null==t?void 0:t.errorType,status:null==t?void 0:t.status,detail:null==t?void 0:t.detail,operationId:null==t?void 0:t.operationId}}const ap="idle",cp="error",hp="incident",up="terminated",dp="user.cancel",fp="user.selectionChanged",pp="taskExecution.state.changed",gp="taskExecution.deployed",mp="taskExecution.instanceStarted",Ap="taskExecution.polled",vp="taskExecution.finished";class bp extends(K()){constructor(e,t){super(),this._api=t,this._interval=null,this._executionId=null,this._state=ap,this._lastPolledResult=null,e.get("eventBus").on("selection.changed",()=>{this._cancelTaskExecution(fp)})}async executeTask(e,t){const n=function(e){let t=H(e);for(;t;){if(V(t,"bpmn:Process"))return t.get("id");t=t.$parent}return null}(e);if(!n)return;this._lastPolledResult=null;const i=Symbol();this._executionId=i,this._changeState("deploying");const r=await this._api.deploy();if(this._executionId!==i)return;if(!r.success){const e=lp("Failed to deploy process definition",r);return void this._cancelTaskExecution(cp,e)}const s=function(e,t){const{deployments:n=[]}=e;for(const e of n)if(e.processDefinition){const{processDefinition:n}=e;if(n.processDefinitionId===t)return n.processDefinitionKey}return null}(r.response,n);if(!s){const e=lp("Failed to retrieve process definition key from deployment response");return void this._cancelTaskExecution(cp,e)}this.emit(gp,r),this._changeState("starting-instance");const o=await this._api.startInstance(s,e.id,t);if(this._executionId!==i)return;if(!o.success){const e=lp("Failed to start process instance",o);return void this._cancelTaskExecution(cp,e)}const l=function(e){const{processInstanceKey:t}=e;return t||null}(o.response);if(!l){const e=lp("Failed to retrieve process instance key from start instance response");return void this._cancelTaskExecution(cp,e)}this.emit(mp,o),this._changeState("executing"),this._interval=setInterval(async()=>{const t=await this._api.getProcessInstance(l);if(this._executionId!==i)return;if(!t.success)return void this._cancelTaskExecution(cp,lp("Failed to get process instance",t));if(!xp(t.response,l))return;const n=await Promise.all([this._api.getProcessInstanceElementInstances(l),this._api.getProcessInstanceJobs(l,e.id),this._api.getProcessInstanceMessageSubscriptions(l,e.id),this._api.getProcessInstanceUserTasks(l,e.id),this._api.getProcessInstanceVariables(l)]);if(this._executionId!==i)return;const r=n.find(e=>!e.success);if(r)return void this._cancelTaskExecution(cp,lp("Failed to poll process instance data",r));const[s,o,a,c,h]=n,u={elementId:e.id,processInstanceKey:l,elementInstancesResponse:s,jobsResponse:o,messageSubscriptionsResponse:a,processInstanceResponse:t,userTasksResponse:c,variablesResponse:h};this._lastPolledResult=u,this.emit(Ap,u);const d=function(e,t){const n=xp(e,t);return n&&n.hasIncident||!1}(t.response,l);if(d){const e=await this._api.getProcessInstanceIncident(l);if(this._executionId!==i)return;if(!e.success)return void this._cancelTaskExecution(cp,lp("Failed to get process instance incident",e));const t=function(e){const{items:t=[]}=e;return t.length?t[0]:null}(e.response);return this.emit(vp,{incident:t,lastPolledResult:this._lastPolledResult,processInstanceKey:l,reason:hp,success:!1}),void this._cancelTaskExecution()}const f=function(e,t){const n=xp(e,t);return n?n.state:null}(t.response,l);if("COMPLETED"===f||"TERMINATED"===f){const t=s.success?function(e,t){const{items:n=[]}=e;return n.find(e=>e.elementId===t.id)||null}(s.response,e):null;t&&"COMPLETED"===t.state?this.emit(vp,{lastPolledResult:this._lastPolledResult,processInstanceKey:l,success:!0}):this.emit(vp,{lastPolledResult:this._lastPolledResult,processInstanceKey:l,reason:up,success:!1}),this._cancelTaskExecution()}},1e3)}async cancelTaskExecution(){this._cancelTaskExecution(dp)}_cancelTaskExecution(e,t){if(!this._isIdle()){if(this._interval&&clearInterval(this._interval),this._executionId=null,this._changeState(ap),e){var n,i;const r=e===cp?{success:!1,reason:e,error:t,processInstanceKey:(null===(n=this._lastPolledResult)||void 0===n?void 0:n.processInstanceKey)??null,lastPolledResult:this._lastPolledResult}:{success:!1,reason:e,processInstanceKey:(null===(i=this._lastPolledResult)||void 0===i?void 0:i.processInstanceKey)??null,lastPolledResult:this._lastPolledResult};this.emit(vp,r)}this._lastPolledResult=null}}_changeState(e){this._state!==e&&(this._state=e,this.emit(pp,e))}_isIdle(){return this._state===ap}}function xp(e,t){const{items:n=[]}=e;return n.length&&n.find(e=>e.processInstanceKey===t)||null}var yp=_(72),wp=_.n(yp),Cp=_(825),kp=_.n(Cp),_p=_(659),Sp=_.n(_p),Ep=_(56),Tp=_.n(Ep),Op=_(540),Mp=_.n(Op),Bp=_(113),Dp=_.n(Bp),Rp=_(520),Ip={};Ip.styleTagTransform=Dp(),Ip.setAttributes=Tp(),Ip.insert=Sp().bind(null,"head"),Ip.domAPI=kp(),Ip.insertStyleElement=Mp(),wp()(Rp.A,Ip),Rp.A&&Rp.A.locals&&Rp.A.locals;const Pp=()=>null;function Np({injector:e,api:r,isConnectionConfigured:s,configureConnectionBannerTitle:o="Connection required",configureConnectionBannerDescription:l="Configure a connection to start testing.",configureConnectionLabel:a="Configure",onConfigureConnection:c,onTestTask:h,config:d,onConfigChanged:p=()=>{},operateBaseUrl:g,tasklistBaseUrl:m,documentationUrl:x,onTaskExecutionStarted:y=()=>{},onTaskExecutionFinished:w=()=>{},children:C=[]}){const k=(0,S.useRef)(null),_=(0,S.useRef)(null),[O,M]=(0,S.useState)([]),[B,D]=(0,S.useState)(ap),[R,I]=(0,S.useState)(),[P,N]=(0,S.useState)(),[L,F]=(0,S.useState)({}),[j,z]=(0,S.useState)(null),[V,H]=(0,S.useState)(null),[U,K]=function(e){const[t,n]=(0,S.useState)(null),[i,r]=(0,S.useState)($);(0,S.useEffect)(()=>{const t=e.get("selection");s({newSelection:t.get()});const n=e.get("eventBus");return n.on("selection.changed",s),()=>{n.off("selection.changed",s)}},[e]);const s=({newSelection:e})=>{const t=1!==(i=e).length?$:W(i[0],q)?null:"Task testing is only supported for tasks and subprocesses. Select one to start testing.";var i;if(t)return n(null),void r(t);n(e[0]),r(null)};return[t,i]}(e),G=(0,S.useRef)(null),[Y,X]=(0,S.useState)(!0),[Z,ee]=(0,S.useState)([]),te=(0,S.useRef)(new Df),ne=(0,S.useRef)(null),[ie,re]=(0,S.useState)(null),[se,oe]=(0,S.useState)(0);(0,S.useEffect)(()=>{const t=new Q(e);k.current=t;const n=new J(e,t,d);_.current=n;const i=new bp(e,r);return G.current=i,te.current=new Df(e),()=>{var e;null===(e=G.current)||void 0===e||e.cancelTaskExecution()}},[e]),(0,S.useEffect)(()=>{U&&k.current&&k.current.getVariablesForElement(U).then(e=>M(e))},[U]),(0,S.useEffect)(()=>{if(!k.current)return;const e=async()=>{if(!U||!k.current)return;const e=await k.current.getVariablesForElement(U);M(e)};return k.current.on("variables.changed",e),()=>{k.current&&k.current.off("variables.changed",e)}},[U]),(0,S.useEffect)(()=>{if(!_.current)return;const e=()=>{_.current&&(p(_.current.getConfig()),U&&(I(_.current.getInputConfigForElement(U)),N(_.current.getOutputConfigForElement(U)),F(_.current.getConfig().output)))};return _.current.on("config.changed",e),()=>{_.current&&_.current.off("config.changed",e)}},[U,p,F,I,N]),(0,S.useEffect)(()=>{var e,t,n,i,r;const s=e=>{D(e),te.current.setState(e,Date.now()),ee(te.current.getEntries())},o=e=>{te.current.setDeployResponse(e),ee(te.current.getEntries())},l=e=>{if(e.success){const t=g?function(e,t){try{const n=Rf(e),i=`processes/${t}`;return new URL(i,`${n}/`).toString()}catch(e){return null}}(g,e.response.processInstanceKey):null;H(t)}te.current.setStartInstanceResponse(e),ee(te.current.getEntries())},a=e=>{var t,n;if(null!==(t=e.variablesResponse)&&void 0!==t&&t.success&&null!==(n=e.elementInstancesResponse)&&void 0!==n&&n.success){const t=of(e.variablesResponse.response.items,e.elementInstancesResponse.response.items||[],e.processInstanceKey,U.id);re(t)}te.current.setPolledResult(e),ee(te.current.getEntries())},c=e=>{te.current.setFinishedResult(e,Date.now()),ee(te.current.getEntries());const t=te.current.getEntries(),n=function(e,t){var n,i;const r=e.lastPolledResult;if(null!=r&&null!==(n=r.variablesResponse)&&void 0!==n&&n.success&&null!=r&&null!==(i=r.elementInstancesResponse)&&void 0!==i&&i.success)return of(r.variablesResponse.response.items,r.elementInstancesResponse.response.items||[],r.processInstanceKey,t.id)}(e,U);var i;if(e.success)null==_||null===(i=_.current)||void 0===i||i.setOutputConfigForElement(U,{success:!0,variables:n,operateUrl:V,executionLog:t,startedAt:ne.current,finishedAt:Date.now()});else if(function(e){return!e.success&&e.reason===hp}(e)){var r;null==_||null===(r=_.current)||void 0===r||r.setOutputConfigForElement(U,{success:!1,variables:n,incident:e.incident,operateUrl:V,executionLog:t,startedAt:ne.current,finishedAt:Date.now()})}else if(function(e){return!e.success&&e.reason===cp}(e)){var s;null==_||null===(s=_.current)||void 0===s||s.setOutputConfigForElement(U,{success:!1,error:e.error,executionLog:t,startedAt:ne.current,finishedAt:Date.now()})}else if(function(e){return!e.success&&e.reason===up}(e)){var o;null==_||null===(o=_.current)||void 0===o||o.setOutputConfigForElement(U,{success:!1,terminated:!0,variables:n,operateUrl:V,executionLog:t,startedAt:ne.current,finishedAt:Date.now()})}else if(e.reason===dp||e.reason===fp){var l;null==_||null===(l=_.current)||void 0===l||l.setOutputConfigForElement(U,{success:!1,canceled:!0,variables:n,operateUrl:V,executionLog:t,startedAt:ne.current,finishedAt:Date.now()})}w(U,e)};return null==G||null===(e=G.current)||void 0===e||e.on(vp,c),null==G||null===(t=G.current)||void 0===t||t.on(gp,o),null==G||null===(n=G.current)||void 0===n||n.on(mp,l),null==G||null===(i=G.current)||void 0===i||i.on(Ap,a),null==G||null===(r=G.current)||void 0===r||r.on(pp,s),()=>{G.current&&(G.current.off(pp,s),G.current.off(gp,o),G.current.off(mp,l),G.current.off(Ap,a),G.current.off(vp,c))}},[U,g,V,w]),(0,S.useEffect)(()=>{d&&_.current&&JSON.stringify(d)!==JSON.stringify(_.current.getConfig())&&_.current.setConfig(d)},[d]),(0,S.useEffect)(()=>{var e,t;U?(I(null==_||null===(e=_.current)||void 0===e?void 0:e.getInputConfigForElement(U)),N(null==_||null===(t=_.current)||void 0===t?void 0:t.getOutputConfigForElement(U))):I(void 0)},[U]);const le=((e=Gf)=>{const[t,n]=(0,S.useState)(e),i=(0,S.useCallback)(e=>{n(t=>[...t,e])},[]),r=(0,S.useCallback)(e=>{n(t=>t.filter(t=>t!==e))},[]),s=(0,S.useCallback)(e=>t.filter(t=>t.type===e).sort((e,t)=>(t.priority||0)-(e.priority||0)),[t]);return(0,S.useMemo)(()=>({plugins:t,registerPlugin:i,unregisterPlugin:r,getPlugins:s}),[t,i,r,s])})(),ae=(0,S.useCallback)(e=>{U&&_.current&&_.current.setInputConfigForElement(U,e)},[U]),ce=(0,S.useCallback)(()=>{U&&_.current&&_.current.resetInputConfigForElement(U)},[U]),he=async()=>{if(j||!U||!G.current||!_.current)return;y(U),oe(1),ee([]),te.current.reset(),re(null),ne.current=Date.now();const e=_.current.getInputConfigForElement(U);_.current.setOutputConfigForElement(U,null),G.current.executeTask(U,JSON.parse(e))},ue=(0,S.useCallback)(()=>{U&&_.current&&(_.current.resetOutputConfigForElement(U),oe(1))},[U]);if(!d)return(0,E.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,E.jsxs)("div",{className:"task-testing__container-no-config",children:[(0,E.jsx)(n,{})," ",(0,E.jsx)("span",{children:"Configuring..."})]})});if(!U)return(0,E.jsx)("div",{className:"task-testing__container task-testing__container--empty",children:(0,E.jsxs)("div",{className:"task-testing__container-no-element",children:[(0,E.jsx)(u,{}),(0,E.jsx)("span",{children:K}),x&&(0,E.jsx)(i,{href:x,target:"_blank",children:"Learn more"})]})});const de=!s||!!j,fe=s?j:o,pe=B!==ap,ge=async()=>{var e;pe?null==G||null===(e=G.current)||void 0===e||e.cancelTaskExecution():h?(X(!1),await h()&&he(),X(!0)):s&&he()};return(0,E.jsxs)(Kf.Provider,{value:le,children:[(0,E.jsxs)("div",{className:"task-testing__container",children:[(0,E.jsxs)("div",{className:`task-testing__container--header ${Lp({isTaskExecuting:pe,isConnectionConfigured:s,inputError:j,output:P})}`,children:[(0,E.jsx)("div",{className:"task-testing__header-actions",children:de?(0,E.jsx)(T,{label:fe,align:"bottom-start",children:(0,E.jsx)(t,{"data-testid":"test-task-btn",className:"btn-execute",kind:"secondary",size:"sm",renderIcon:pe?b:A,iconDescription:pe?"Stop test":"Run test",onClick:ge,disabled:!Y,children:pe?"Stop test":"Run test"})}):(0,E.jsx)(t,{"data-testid":"test-task-btn",className:"btn-execute",kind:pe?"secondary":"primary",size:"sm",renderIcon:pe?b:A,iconDescription:pe?"Stop test":"Run test",onClick:ge,disabled:!Y,children:pe?"Stop test":"Run test"})}),(0,E.jsxs)("div",{className:"task-testing__header-status",children:[(0,E.jsx)(Fp,{isTaskExecuting:pe,isConnectionConfigured:s,inputError:j,output:P}),(0,E.jsx)("span",{className:"task-testing__header-status-text",children:(0,E.jsx)(jp,{configureConnectionBannerTitle:o,isConnectionConfigured:s,inputError:j,output:P})})]}),(0,E.jsxs)("div",{className:"task-testing__header-actions-right",children:[(0,E.jsx)(T,{label:"Clear result",align:"bottom-end",children:(0,E.jsx)(t,{kind:"ghost",size:"sm",hasIconOnly:!0,renderIcon:f,iconDescription:"Clear result",onClick:ue,disabled:!P||pe})}),c&&(0,E.jsx)(T,{label:s?"Configure connection":a,align:"bottom-end",children:(0,E.jsx)(t,{"data-testid":"configure-connection-btn",kind:"ghost",size:"sm",hasIconOnly:!0,renderIcon:v,iconDescription:a,onClick:()=>c(),disabled:pe})})]})]}),(0,E.jsx)("div",{className:"task-testing__container--body"+(pe?" task-testing__container--body-executing":""),children:(0,E.jsx)(zp,{selectedIndex:se,setSelectedIndex:oe,tabs:[{label:"Input",disabled:pe,children:(0,E.jsx)(Af,{allOutputs:L,input:R,onErrorChange:z,onResetInput:ce,onSetInput:ae,variablesForElement:O})},{label:"Result",children:(0,E.jsx)(Yf,{element:U,isConnectionConfigured:s,isTaskExecuting:pe,currentVariables:ie,output:P,currentOperateUrl:V,onResetOutput:ue,taskExecutionState:B,executionLog:pe?Z:(null==P?void 0:P.executionLog)||[],tasklistBaseUrl:m})},...le.getPlugins("output.body.tab").map(e=>{var t;return{label:e.label,disabled:pe,children:(null===(t=e.render)||void 0===t?void 0:t.call(e,{element:U,output:P,isTaskExecuting:pe,executionLog:Z}))||e.children}}).filter(e=>e.children)]})})]}),C]})}function Lp({isTaskExecuting:e,isConnectionConfigured:t,inputError:n,output:i}){return e?"task-testing__container--header-executing":null!=i&&i.error||null!=i&&i.incident||!t||n?"task-testing__container--header-error":null!=i&&i.success?"task-testing__container--header-success":null!=i&&i.terminated?"task-testing__container--header-terminated":null!=i&&i.canceled?"task-testing__container--header-canceled":""}function Fp({isTaskExecuting:e,isConnectionConfigured:t,inputError:n,output:i}){return null!=i&&i.error||null!=i&&i.incident||!t||n?(0,E.jsx)(y,{size:16,className:"task-testing__status-icon--error"}):null!=i&&i.success?(0,E.jsx)(l,{size:16,className:"task-testing__status-icon--success"}):null!=i&&i.terminated?(0,E.jsx)(b,{size:16,className:"task-testing__status-icon--terminated"}):null!=i&&i.canceled?(0,E.jsx)(p,{size:16,className:"task-testing__status-icon--canceled"}):null}function jp({isConnectionConfigured:e,configureConnectionBannerTitle:t,inputError:n,output:i}){if(!e)return t;if(n)return"Input error";if(i){if(i.error)return"Error";if(i.incident)return"Incident";if(i.success)return"Completed";if(i.terminated)return"Terminated";if(i.canceled)return"Canceled"}return null}function zp({selectedIndex:e=0,setSelectedIndex:t=()=>{},tabs:n}){var i;return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("div",{className:"task-testing-tabs__list",role:"tablist",children:n.map((n,i)=>(0,E.jsx)("button",{type:"button",role:"tab",className:M()("task-testing-tabs__tab",{"task-testing-tabs__tab--active":i===e,"task-testing-tabs__tab--disabled":n.disabled}),"aria-selected":i===e,onClick:()=>t(i),disabled:n.disabled,children:n.label},i))}),(0,E.jsx)("div",{className:"task-testing-tabs__panel",children:null===(i=n[e])||void 0===i?void 0:i.children})]})}Np.Tab=({children:e=null,render:t=Pp,label:n,priority:i=1e3})=>{const{registerPlugin:r,unregisterPlugin:s}=(0,S.useContext)(Kf);return(0,S.useEffect)(()=>{const o={label:n,render:t,children:e,priority:i,type:"output.body.tab"};return r(o),()=>{s(o)}},[e,t,n,i,r,s]),null},Np.Link=Xf;export{Np as default};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|