@grapecity-software/spread-sheets-formula-panel 19.0.3 → 19.1.1

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * SpreadJS Library 19.0.3
3
+ * SpreadJS Library 19.1.1
4
4
  *
5
5
  * Copyright(c) GrapeCity Software inc. All rights reserved.
6
6
  *
@@ -9,4 +9,4 @@
9
9
  * https://www.grapecity.com.cn/developer/spreadjs
10
10
  *
11
11
  */
12
- !function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@grapecity-software/spread-sheets")):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@grapecity-software/spread-sheets")):t(GC)}((function(t){!function(){"use strict";var n,i={33:function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.insertTab=void 0,e=i(338),r=function(t){if(t.state.readOnly)return!1;if(t.state.selection.ranges.some((function(t){return!t.empty})))return!1;var n=(0,e.getOneIndentSpaceByState)(t.state);return t.dispatch(t.state.update(t.state.replaceSelection(n),{scrollIntoView:!0,userEvent:"input"})),!0},n.insertTab=r},35:function(n){n.exports=t.Spread.CalcEngine},47:function(t,n,i){var e,r,u,o,s;function h(t,n,i,r,o,s){var h=(0,u.parseToExpressionTree)(t,n);return h.isFullColumn||h.isFullRow?(0,e.lmt)(h,i,r,!0,!0):h.hmt()?(0,e.dmt)(h,i,r):(0,e.lmt)(h,i,r,o,s),(0,u.unparseToText)(h,n)}function f(t,n,i){return(0,r.includeToken)(t,n,i)||(0,r.isInToken)(t,n,!0,!0)||(0,r.isInToken)(t,i,!0,!0)}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleAbsoluteRelativeReferencesCommand=void 0,e=i(648),r=i(129),u=i(338),o=i(367),s=function(t){var n,i,e,r,s,a,c,l,v,d,y,p,k,m=t.state.field(o.isFormulaField);return!!m&&(n=t.state,i=(0,u.getTokensByState)(n),e=n.selection.main,r=e.from,s=e.to,a=n.field(o.activeCellField),c=a.row,l=a.col,v=!1,d=0,y=r,p=s,(k=i.filter((function(t){return f(t,r,s)&&(0,u.isValidReferenceToken)(t,n)}))).forEach((function(i){var e,u,o=i.text.indexOf(":"),f=-1!==o,a=!f||r<=i.index+o,k=!f||s>i.index+o,m=h(i.text,n,c,l,a,k);m&&(t.dispatch({changes:{from:i.index+d,to:i.endIndex+1+d,insert:m}}),d+=m.length-i.text.length,e=i.index,u=i.endIndex+1,!f||a&&k||(a?u=i.index+o:k&&(e=i.index+o+1)),y=Math.min(y,e),p=Math.max(p,u),t.dispatch({selection:{anchor:y,head:p+d}}),v=!0)})),v)},n.toggleAbsoluteRelativeReferencesCommand=s},58:function(t,n,i){var e,r,u,o,s,h,f,a=this&&this.mJr||function(){return a=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},a.apply(this,arguments)};function c(t,n){var i,e,o,s=(0,r.getSignatureStatus)((0,u.getTokensByState)(n.state),n.pos);s&&(i=(0,u.getFunctionResourceByState)(n.state,s.functionName))&&(e=(0,r.getActiveParameterInSignatureTip)(s.activeParameter,i),(o=i.parameters&&i.parameters[e])&&o.enum&&o.enum.forEach((function(n){t.push({label:n.value,detail:n.description,type:"enum",apply:n.value})})))}function l(t,n){var i=n.state,e=n.pos,o=(0,r.getLocalSymbol)((0,u.getTokensByState)(i),e);o.forEach((function(n){t.push({label:n,type:"variable",apply:n})}))}function v(t,n){var i;(0,u.getCustomNamesByState)(n.state).forEach((function(n){t.push({label:n.getName(),detail:n.getComment()||"",type:"constant",apply:n.getName()})}))}function d(t,n){var i;(0,u.getFunctionResourcesByState)(n.state).forEach((function(n){n.description&&t.push({label:n.name,detail:n.description,type:"function",apply:y})}))}function y(t,n,i,r){var u=t.state,s=u.selection.main,h=i-s.from,f=r-s.from,c=n.label,l=u.changeByRange((function(t){var n=t.from+h,o=t.from+f;return t!==s&&i!==r&&u.sliceDoc(n,o)!==u.sliceDoc(i,r)?{range:t}:{changes:{from:n,to:r===s.from?t.to:o,insert:c+"()"},range:e.State.EditorSelection.cursor(n+c.length+1)}}));t.dispatch(a(a({},l),{userEvent:"input.complete",effects:o.triggerSignatureTooltip.of(null)}))}function p(t){return(0,u.getStructReferencesByState)(t.state).map(m)}function k(t,n){var i,e,r=t.selection.main.head,o=n.text.substring(0,r-n.index);return o&&"["===o[o.length-1]?(i=o.substring(0,o.length-1),(e=(0,u.getStructReferencesByState)(t).find((function(t){return t.name===i})))?e.getColumns().map(m):[]):[]}function m(t){return{label:t.name,detail:t.description,type:"variable"}}function g(t){var n=t.state.selection.main.head,i=(0,u.getTokensByState)(t.state);return(0,r.getTokenByPos)(i,n,!1,!0)}function w(t){var n,i,e,r=t.state.field(s.isFormulaField);return r?(n=g(t))&&n.type===h.TokenType.StringConst?null:(i=t.matchBefore(/[\w.]*/),(e=[]).push.apply(e,k(t.state,n)),c(e,t),i&&i.from===i.to||(l(e,t),d(e,t),v(e,t),e.push.apply(e,p(t))),{from:i?i.from:t.pos,options:e}):null}Object.defineProperty(n,"__esModule",{value:!0}),n.autoCompletionExtensions=void 0,e=i(833),r=i(129),u=i(338),o=i(888),s=i(367),h=i(465),f=e.Autocomplete.autocompletion,n.autoCompletionExtensions=f({override:[w]})},86:function(t,n,i){var e,r;function u(t,n){t.dispatch({effects:r.reconfigure(e.State.EditorState.readOnly.of(n))})}Object.defineProperty(n,"__esModule",{value:!0}),n.reconfigureReadOnly=n.readOnlyExtension=void 0,e=i(833),r=new e.State.Compartment,n.readOnlyExtension=r.of(e.State.EditorState.readOnly.of(!1)),n.reconfigureReadOnly=u},129:function(t,n,i){var e,r,u,o,s;function h(t,n,i,e,r){var u,o,s,h,f;void 0===r&&(r=!0),u=i.culture,o=i.ignoreError,s=i.Wve,h=i.Jde,i.ignoreError=e,i.culture=!0,i.Wve=r,i.Jde=!0;try{f=n.parse(i,t)}catch(t){}return i.culture=u,i.ignoreError=o,i.Wve=s,i.Jde=h,f}function f(t,n,i){if(t){var e;try{e=n.unparse(i,t)}catch(t){}return e}}function a(t,n,i,r,o){var s,h,f,a=new e.Parser,c=!0;return n.Mf?s=(0,u.Vgt)(a,t,n.Mf,i,r,c):(a.setParserOption(c),o.ignoreError=!0,h=t.split(""),f=a.parseToTokens(o,h,!1),f=(0,u.fillBlankToTokens)(f,h),s=(0,u.getExpressTokenImp)(a,n,o,null,f,h,i,r)),H(s,n)}function c(){return{arrayListSeparator:e.Parser.arrayListSeparator||s.COMMA,arrayGroupSeparator:e.Parser.arrayGroupSeparator||s.SEMICOLON,listSeparator:e.Parser.listSeparator||s.COMMA,numberDecimalSeparator:e.Parser.numberDecimalSeparator||s.FULL_STOP}}function l(t,n){var i,e,r,u,o;for(t=t.filter((function(t){return t.endIndex<n})),i=[],e=[],r="",u=0;u<t.length;u++)w(o=t[u])?r=o.text:b(o)?(i.push(r),e.push(0)):M(o)&&(r="",i.pop(),e.pop()),i.length>0&&g(o)&&e[e.length-1]++;if(i.length>0)return{functionName:i.pop(),activeParameter:e.pop()}}function v(t,n){var i,e,r,u,o,s=n.parameters||[],h=s.length||0;for(r=0;r<s.length;r++)if(s[r].repeatable)void 0===i&&(i=r);else if(void 0!==i){e=r-1;break}return void 0!==i&&(void 0===e&&(e=s.length-1),t>=i&&(t=e+(o=(t-i)%(u=e-i+1))+1<h?e+o+1:i+o)),t}function d(t,n){t=v(t,n);var i=n.parameters?n.parameters.length:0;return Math.min(t,i-1)}function y(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),t.find((function(t){return p(t,n,i,e)}))}function p(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),(i?n>=t.index:n>t.index)&&(e?n<=t.endIndex+1:n<t.endIndex+1)}function k(t,n,i){return n<=t.index&&i>=t.endIndex+1}function m(t,n){var i,e,r,u,o,h,f,a,c;for(t=t.filter((function(t){return t.endIndex<n})),i=[],e=[],r=[],u=0;u<t.length;u++)w(o=t[u])?(i.push(o.text.toUpperCase()),e.push([]),r.push(0)):M(o)?(i.pop(),e.pop(),r.pop()):g(o)&&(h=(0,s.lastItem)(i),f=(0,s.lastItem)(r),a=(0,s.lastItem)(e),c=t[u-1],("LAMBDA"===h||"LET"===h&&f%2==0)&&j(c)&&a.push(c.text),r[r.length-1]=f+1);return e.filter((function(t){return t.length>0})).reduce((function(t,n){return t.concat(n)}),[])}function g(t){return t.type===o.TokenType.FunctionArgumentSeparator}function w(t){return t.type===o.TokenType.FunctionName}function b(t){return t.type===o.TokenType.FunctionCallStart}function M(t){return t.type===o.TokenType.FunctionCallEnd}function x(t){return t.type===o.TokenType.SubExpressionStart}function S(t){return t.type===o.TokenType.SubExpressionEnd}function C(t){return t.type===o.TokenType.FormulaStart}function O(t){return t.type===o.TokenType.Unknown}function A(t){return O(t)&&F(t.text)===s.LEFT_PARENTHESES}function D(t){return O(t)&&F(t.text)===s.RIGHT_PARENTHESES}function E(t){return j(t)||B(t)}function I(t){return t.type===o.TokenType.OperatorInfix}function R(t){return t.type===o.TokenType.OperatorPrefix}function L(t){return t.type===o.TokenType.Whitespace}function j(t){return t.type===o.TokenType.Name}function T(t){return t.type===o.TokenType.OperatorPostfix&&"#"===t.text}function B(t){return t.type===o.TokenType.CellReference}function _(t){return E(t)&&t.ranges&&t.ranges.length>0}function N(t){var n,i=0;for(n=0;n<t.length&&t[n]===s.WHITESPACE;n++)i++;return i}function P(t,n,i){var e,r,u,o,s,h;for(void 0===i&&(i=4),e=N(t),r=[],u=function(){return 0===r.length},o=function(){return r[r.length-1]},s=0;s<n.length;s++)b(h=n[s])||x(h)?r.push(h):M(h)?!u()&&b(o())&&r.pop():S(h)&&!u()&&x(o())&&r.pop();return r.length>0&&(e+=i),e}function F(t){return t.replace(/\s+/g,"")}function H(t,n){var i,e,r,u=[],h=[],f=c(),a=!1;for(i=0;i<t.length;i++)(r=z(e=t[i],a,f))===o.TokenType.ArrayConstStart?(h.push(r),a=!0):r===o.TokenType.FunctionCallStart?(h.push(r),a=!1):r!==o.TokenType.FunctionCallEnd&&r!==o.TokenType.ArrayConstEnd||(h.pop(),a=(0,s.lastItem)(h)===o.TokenType.ArrayConstStart),u.push({type:r,index:e.index,endIndex:e.endIndex,text:e.text,ranges:e.ranges,canDrag:e.canDrag,colorIndex:e.colorIndex});return W(V(u),n)}function z(t,n,i){var e=t.type,u=t.subType,h=t.text.trim();if(1===e){if(1===u)return"ARRAY"===h?o.TokenType.ArrayConstStart:"@"===h||h===s.LEFT_PARENTHESES?o.TokenType.FunctionCallStart:o.TokenType.FunctionName;if(2===u)return h===s.RIGHT_PARENTHESES?o.TokenType.FunctionCallEnd:n?o.TokenType.ArrayConstEnd:o.TokenType.FunctionCallEnd;if((0,r.Df)(h))return o.TokenType.FormulaStart}else if(3===e){if(0===u)return n&&h===i.arrayListSeparator?o.TokenType.ArrayConstItemSeparator:n&&h===i.arrayGroupSeparator?o.TokenType.ArrayConstRowSeparator:o.TokenType.FunctionArgumentSeparator}else{if(4===e)return o.TokenType.OperatorPrefix;if(5===e)return o.TokenType.OperatorInfix;if(6===e)return o.TokenType.OperatorPostfix;if(0===e)return 5===u?o.TokenType.LogicalConst:4===u?o.TokenType.NumberConst:3===u?o.TokenType.StringConst:6===u?o.TokenType.ErrorConst:7===u||12===u?t.isName?o.TokenType.Name:o.TokenType.CellReference:o.TokenType.StringConst;if(2!==e)return 7===e?o.TokenType.Whitespace:o.TokenType.Unknown;if(1===u)return o.TokenType.SubExpressionStart;if(2===u)return o.TokenType.SubExpressionEnd}}function W(t,n){var i,r,u,o;for(i=t.length-2;i>0;i--)r=t[i],T(u=t[i+1])&&B(r)&&_(r)&&(o=new e.CalcReference(n,r.ranges).getSpillRef())&&o.$gt&&(r.text+=u.text,r.endIndex=u.endIndex,r.ranges=o.$gt,t.splice(i+1,1));return t}function V(t){var n,i,e,r,u,o,s,h=[];for(n=0;n<t.length;n++)U((i=t[n]).type)&&(e=i.text.match(/^(\s*)(\S+)(\s*)$/))&&4===e.length?(r=e[0],u=e[1],o=e[2],s=e[3],u||s?(u&&(i.index+=u.length,i.text=i.text.substring(u.length),h.push($(i.index,u))),h.push(i),s&&(i.endIndex-=s.length,i.text=i.text.substring(0,o.length),h.push($(i.endIndex+1,s)))):h.push(i)):h.push(i);return h}function U(t){return t===o.TokenType.FunctionCallStart||t===o.TokenType.FunctionCallEnd||t===o.TokenType.ArrayConstStart||t===o.TokenType.ArrayConstEnd}function $(t,n){return{type:o.TokenType.Whitespace,index:t,endIndex:t+n.length-1,text:n}}function q(){return e.Functions.findGlobalFunctions()}Object.defineProperty(n,"__esModule",{value:!0}),n.getGlobalFunctions=n.removeWhiteSpace=n.getIndentByPreviousText=n.getLineIndent=n.hasReferenceRanges=n.isReferenceToken=n.isAnchorOperatorToken=n.isNameToken=n.isWhitespaceToken=n.isPrefixOperatorToken=n.isInfixOperatorToken=n.isReferenceOrNameToken=n.isRightParenthesesToken=n.isLeftParenthesesToken=n.isNothingOperandToken=n.isFormulaStartToken=n.isSubExpressionEndToken=n.isSubExpressionStartToken=n.isFunctionCallEndToken=n.isFunctionCallStartToken=n.isFunctionCallToken=n.isFunctionArgumentSeparator=n.getLocalSymbol=n.includeToken=n.isInToken=n.getTokenByPos=n.getActiveParameterInSignatureTip=n.getActiveParameterInParameterResources=n.getSignatureStatus=n.getCultureInfo=n.parseToTokens=n.unparse=n.parse=void 0,e=i(35),r=i(376),u=i(789),o=i(465),s=i(348),n.parse=h,n.unparse=f,n.parseToTokens=a,n.getCultureInfo=c,n.getSignatureStatus=l,n.getActiveParameterInParameterResources=v,n.getActiveParameterInSignatureTip=d,n.getTokenByPos=y,n.isInToken=p,n.includeToken=k,n.getLocalSymbol=m,n.isFunctionArgumentSeparator=g,n.isFunctionCallToken=w,n.isFunctionCallStartToken=b,n.isFunctionCallEndToken=M,n.isSubExpressionStartToken=x,n.isSubExpressionEndToken=S,n.isFormulaStartToken=C,n.isNothingOperandToken=O,n.isLeftParenthesesToken=A,n.isRightParenthesesToken=D,n.isReferenceOrNameToken=E,n.isInfixOperatorToken=I,n.isPrefixOperatorToken=R,n.isWhitespaceToken=L,n.isNameToken=j,n.isAnchorOperatorToken=T,n.isReferenceToken=B,n.hasReferenceRanges=_,n.getLineIndent=N,n.getIndentByPreviousText=P,n.removeWhiteSpace=F,n.getGlobalFunctions=q},203:function(t,n,i){var e,r,u,o,s,h,f,a;function c(t,n,i){var e=i.parent;t&&t.zQt===n||(i.Bde=new s.FormulaEditorReferencedRangesContext(n),(0,s.setWorkbookFocusStatus)(e,i.Bde.Dvt()))}function l(t,n,i){if((0,s.isFormulaEditorReferencedRangesContext)(t)){var e=i.parent;v(t,n,e)?(0,s.closeFormulaReferencedRanges)(n.state):document.activeElement!==n.contentDOM&&setTimeout((function(){n.focus()}),10)}}function v(t,n,i){var e=document.activeElement;return e!==n.contentDOM&&(!e.hasAttribute("data-gc-formula-editor-additional-element")&&!(t.Dvt()&&i&&i.Ti&&i.Ti.contains(e)))}function d(t,n){var i,e;y(t.keyCode)&&(e=(i=(0,u.getActiveSheetByState)(n.state))&&i.Bde,(0,s.isFormulaEditorReferencedRangesContext)(e)&&i.rt.yk(t))}function y(t){return 16===t||17===t||18===t}function p(t,n){var i,r=n.oldSheet,u=n.newSheet;r&&u&&r!==u&&(i=r.Bde,(0,s.isFormulaEditorReferencedRangesContext)(i)&&(i.Dvt()||e.Hde.DJ)&&(n.needTriggerSheetChange=!1,u.Bde=i,r.Bde=h))}function k(t,n){var i,r,u=n.oldSheet,f=n.newSheet;if(f&&!f.xT&&u!==f&&(i=f.Bde,(0,s.isFormulaEditorReferencedRangesContext)(i)&&(i.Dvt()||e.Hde.DJ)))return i.cve()!==f?e.Hde.DJ=new s.FormulaEditorReferencedRangesAcrossSheetContext(i):(r=e.Hde.DJ,(0,s.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(r.d5(),e.Hde.DJ=h)),(0,o.paintFormulaReferencedRanges)(f),!0}Object.defineProperty(n,"__esModule",{value:!0}),n.uve=n.ave=n.isMetaKeyForAppendingRange=n.formulaReferencedRangesExtension=void 0,e=i(648),r=i(833),u=i(338),o=i(390),s=i(341),h=void 0,f=r.View.EditorView.updateListener.of((function(t){var n,i,r,h=(0,u.getActiveSheetByState)(t.state);h&&(n=h.parent,i=h.Bde,r=e.Hde.Ude(),!i&&(0,s.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(i=r.lve),t.focusChanged?(t.view.hasFocus?c(i,t.view,h):l(i,t.view,h),(0,o.paintFormulaReferencedRanges)(h)):(t.selectionSet||t.docChanged)&&i&&(t.transactions.some((function(t){return!t.annotation(s.appendingRangeAnnotation)}))&&i.qD(),(0,s.setWorkbookFocusStatus)(n,i.Dvt()),(0,o.paintFormulaReferencedRanges)(h)))})),a=r.View.ViewPlugin.define((function(){return null}),{eventHandlers:{keydown:d,keyup:d}}),n.formulaReferencedRangesExtension=[f,a],n.isMetaKeyForAppendingRange=y,n.ave=p,n.uve=k},231:function(t,n,i){var e,r,u,o,s;function h(t){var n=t.autocompletionStyle,i=t.errorStyle;return o.theme({"& .cm-tooltip-autocomplete":{color:n.color,font:n.font,background:n.backgroundColor,border:n.border,"margin-left":"1em"},"& .cm-tooltip-autocomplete ul li":{padding:"5px"},"& .cm-tooltip-autocomplete ul li .cm-completionIcon-function":{color:n.function_icon.color,font:n.function_icon.font},"& .cm-tooltip-autocomplete ul li .cm-completionLabel":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li .cm-completionDetail":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-function":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected]":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip .cm-tooltip-lint .cm-diagnostic ":{color:i.color,font:i.font,background:i.backgroundColor}})}function f(t){var n={},i=function(t,i,e){var r=(0,u.syntaxHighlightingTokenClassName)(t),o=isNaN(e)?"":"[".concat(u.TOKEN_INDEX_ATTRIBUTE_NAME,'="').concat(e,'"]');n["& .".concat(r).concat(o)]=i};return t.forEach((function(t){Array.isArray(t.color)?(i(t.token,{color:t.color[0]}),t.color.forEach((function(n,e){i(t.token,{color:n},e)}))):i(t.token,{color:t.color})})),o.theme(n)}function a(t,n){return o.theme({"& .cm-scroller":{"background-color":t.backgroundColor,color:t.color,font:t.font},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caretColor},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackColor},"& .cm-activeLine":{"background-color":t.activeLineBackColor},"& .cm-gutters":{"background-color":n.backgroundColor,color:n.color,font:n.font,"user-select":"none"},"& .cm-lineNumbers ":{width:"30px"},'& .cm-foldGutter span[title="Fold line"] ':{"padding-bottom":"8px"},"& .cm-gutterElement":{display:"flex","align-items":"center","justify-content":"flex-end"},"& .cm-activeLineGutter":{"background-color":t.activeLineBackColor},"& .cm-tooltip":{border:"none"}})}function c(t){var n=t.rules,i=t.editorContentStyle,e=t.editorGuttersStyle,r=[s];return i&&e&&(r=r.concat([a(i,e),h(i)])),n&&(r=r.concat(f(n))),r}Object.defineProperty(n,"__esModule",{value:!0}),n.themeExtension=n.createThemeExtension=n.themeCompartment=n.createSyntaxHighlightingTheme=void 0,e=i(833),r=i(753),u=i(307),o=e.View.EditorView,s=o.theme({"&":{height:"100%"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-line":{"line-height":1.35}}),n.createSyntaxHighlightingTheme=f,n.themeCompartment=new e.State.Compartment,n.createThemeExtension=c,n.themeExtension=n.themeCompartment.of(c(r.defaultTheme))},234:function(n){n.exports=t.Spread},236:function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var e=i(564);n.SR={en:e}},284:function(t,n,i){var e,r,u,o,s;Object.defineProperty(n,"__esModule",{value:!0}),n.hoverTooltipExtension=void 0,e=i(833),r=i(129),u=i(348),o=i(338),s=i(367),n.hoverTooltipExtension=e.View.hoverTooltip((function(t,n){var i,e,h,f,a=t.state.field(s.isFormulaField);return a?(i=(0,o.getTokensByState)(t.state),(e=(0,r.getTokenByPos)(i,n))?(h=[],f=(0,o.getFunctionResourceByState)(t.state,e.text),(0,r.isFunctionCallToken)(e)&&f&&(h.push((0,u.getFunctionHoverTitle)(f)),f.description&&h.push(f.description)),0===h.length?null:{pos:e.index,end:e.endIndex+1,above:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,u.createHelpFunctionTitleDom)(f)),f.description&&t.appendChild((0,u.createHelpFunctionDescriptionDom)(f.description)),{dom:t}}}):null):null}))},307:function(t,n,i){var e,r,u,o,s,h,f;function a(t){return"gc-formula-editor-token_"+r.SyntaxHighlightingTokenType[t]}function c(t){var n;return t.field(o.isFormulaField)?f.of(v(t)):f.of([])}function l(t,i){var e={};return isNaN(i)||(e[n.TOKEN_INDEX_ATTRIBUTE_NAME]=i),{class:a(t),attributes:e}}function v(t){var n=(0,u.getTokensByState)(t);return d(n,t),n.map((function(t){var n=k(t);return e.View.Decoration.mark(l(n,t.colorIndex)).range(t.index,t.endIndex+1)}))}function d(t,n){var i,e=[];t.forEach((function(t){if((0,s.isReferenceToken)(t)||(0,s.isNameToken)(t)&&(0,s.hasReferenceRanges)(t)){var n=e.find((function(n){return y(n,t)}));t.colorIndex=n?n.colorIndex:p(e),e.push(t)}})),i=(0,u.getReferenceTokenColors)(n).length,e.forEach((function(t){t.colorIndex=t.colorIndex%i}))}function y(t,n){return(0,s.removeWhiteSpace)(t.text).toUpperCase()===(0,s.removeWhiteSpace)(n.text).toUpperCase()}function p(t){return t&&0!==t.length?Math.max.apply(Math,t.map((function(t){return t.colorIndex})))+1:0}function k(t){var n=t.type,i=r.SyntaxHighlightingTokenType.unknown;return n===r.TokenType.NumberConst?i=r.SyntaxHighlightingTokenType.numberConst:n===r.TokenType.StringConst?i=r.SyntaxHighlightingTokenType.stringConst:n===r.TokenType.LogicalConst?i=r.SyntaxHighlightingTokenType.booleanConst:n===r.TokenType.ErrorConst?i=r.SyntaxHighlightingTokenType.errorConst:n===r.TokenType.CellReference?i=r.SyntaxHighlightingTokenType.reference:n===r.TokenType.Name?i=(0,s.hasReferenceRanges)(t)?r.SyntaxHighlightingTokenType.reference:r.SyntaxHighlightingTokenType.name:n===r.TokenType.OperatorPrefix?i=r.SyntaxHighlightingTokenType.operatorPrefix:n===r.TokenType.OperatorInfix?i=r.SyntaxHighlightingTokenType.operatorInfix:n===r.TokenType.OperatorPostfix?i=r.SyntaxHighlightingTokenType.operatorPostfix:n===r.TokenType.Whitespace?i=r.SyntaxHighlightingTokenType.whitespace:n===r.TokenType.FunctionName||n===r.TokenType.FunctionCallStart||n===r.TokenType.FunctionCallEnd?i=r.SyntaxHighlightingTokenType.function:n===r.TokenType.FunctionArgumentSeparator||n===r.TokenType.ArrayConstRowSeparator||n===r.TokenType.ArrayConstItemSeparator?i=r.SyntaxHighlightingTokenType.argumentSeparator:n!==r.TokenType.SubExpressionStart&&n!==r.TokenType.SubExpressionEnd||(i=r.SyntaxHighlightingTokenType.subExpression),i}Object.defineProperty(n,"__esModule",{value:!0}),n.markReferenceTokenColorIndex=n.syntaxHighlightingTokenClassName=n.syntaxHighlightingField=n.TOKEN_INDEX_ATTRIBUTE_NAME=void 0,e=i(833),r=i(465),u=i(338),o=i(367),s=i(129),h=e.State.StateField,f=e.State.RangeSet,n.TOKEN_INDEX_ATTRIBUTE_NAME="data-token-index",n.syntaxHighlightingField=h.define({create:c,update:function(t,n){return c(n.state)},provide:function(t){return e.View.EditorView.decorations.from(t)}}),n.syntaxHighlightingTokenClassName=a,n.markReferenceTokenColorIndex=d},338:function(t,n,i){var e,r,u,o,s,h,f,a,c,l;function v(t){return t.field(o.tokenField)}function d(t){return t.doc.toJSON().join("\n")}function y(t){return t.field(o.providerField).getFunctions()}function p(t,n){return(0,s.findFunction)(y(t),n)}function k(t){return y(t).map(s.convertToFunctionResource)}function m(t,n){return(0,s.findFunctionResource)(k(t),n)}function g(t){return t.field(o.customNamesField)}function w(t,n){return n=n.toUpperCase(),g(t).find((function(t){return t.getName().toUpperCase()===n}))}function b(t){var n=t.field(o.themeField),i=n.rules.find((function(t){return t.token===u.SyntaxHighlightingTokenType.reference})),e=i?i.color:"black";return Array.isArray(e)?e:[e]}function M(t,n,i){return t.find((function(t){return(0,h.isInToken)(t,n,!0,!0)&&x(t,i)}))}function x(t,n){var i=O(t.text,n);return i&&i.type===r.ExpressionType.reference}function S(t){var n=t.field(o.calcServiceField),i=t.field(o.calcSourceField),e=t.field(o.activeCellField),r=n.getParserContext(i);return r.row=e.row,r.column=e.col,r}function C(t,n){var i,e,r,u;return t.field(o.isFormulaField)?(i=t.field(o.calcSourceField),r=(e=t.field(o.activeCellField)).row,u=e.col,(0,h.parseToTokens)(n,i,r,u,S(t))):[]}function O(t,n,i){void 0===i&&(i=!1);var e=S(n);return(0,h.parse)(t,new r.Parser,e,!i)}function A(t,n){var i=S(n);return(0,h.unparse)(t,new r.Parser,i)}function D(t){return t.field(o.optionsField)}function E(t){var n=D(t);return l(n.tabSize)?c.DEFAULT_TAB_SIZE:n.tabSize}function I(t){var n=D(t);return l(n.formatWidthLimit)?c.DEFAULT_FORMAT_WIDTH_LIMIT:n.formatWidthLimit}function R(t){return s.WHITESPACE.repeat(E(t))}function L(t){var n=t.field(o.calcSourceField).Mf;if(n)return(0,f.Kde)(n.parent)||n}function j(t){return t.selection.main}function T(t){return t.field(o.providerField).getStructReferences()}function B(t,n,i){var e,u,o,s;return n===i||!(!(0,a.kf)(n)||!(0,a.kf)(i))&&(e=new r.Parser,u=S(t),o=(0,h.unparse)((0,h.parse)(n,e,u,!1,!1),e,u),s=(0,h.unparse)((0,h.parse)(i,e,u,!1,!1),e,u),!(!o||!s)&&o===s)}Object.defineProperty(n,"__esModule",{value:!0}),n.isSameFormula=n.getStructReferencesByState=n.getSelection=n.getActiveSheetByState=n.getOneIndentSpaceByState=n.getFormatWidthLimitByState=n.getTabSizeByState=n.getOptionsByState=n.unparseToText=n.parseToExpressionTree=n.parseToTokens=n.getParseContextByState=n.isValidReferenceToken=n.getValidReferenceTokenByPos=n.getReferenceTokenColors=n.getCustomNameByState=n.getCustomNamesByState=n.getFunctionResourceByState=n.getFunctionResourcesByState=n.getFunctionByState=n.getFunctionsByState=n.getTextByState=n.getTokensByState=void 0,e=i(234),r=i(35),u=i(465),o=i(367),s=i(348),h=i(129),f=i(607),a=i(376),c=i(753),l=e.Common.lt.ht,n.getTokensByState=v,n.getTextByState=d,n.getFunctionsByState=y,n.getFunctionByState=p,n.getFunctionResourcesByState=k,n.getFunctionResourceByState=m,n.getCustomNamesByState=g,n.getCustomNameByState=w,n.getReferenceTokenColors=b,n.getValidReferenceTokenByPos=M,n.isValidReferenceToken=x,n.getParseContextByState=S,n.parseToTokens=C,n.parseToExpressionTree=O,n.unparseToText=A,n.getOptionsByState=D,n.getTabSizeByState=E,n.getFormatWidthLimitByState=I,n.getOneIndentSpaceByState=R,n.getActiveSheetByState=L,n.getSelection=j,n.getStructReferencesByState=T,n.isSameFormula=B},341:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p;function k(t){var n,i,e=(0,h.getActiveSheetByState)(t);e&&(g(n=u.Hde.Ude())&&(n.zde(e),e=(0,h.getActiveSheetByState)(t)),m(i=e.Bde)&&(i.dispose(),e.Bde=d,w(e.parent,!1)))}function m(t){return t instanceof y}function g(t){return t instanceof p}function w(t,n){var i=function(t){t&&(t.rt.X6=n)};t.sheets.forEach(i),t.mp.forEach((function(t){i(t.Mf)}))}function b(t,n){void 0===n&&(n=!0),t.parent.e3(t,n)}Object.defineProperty(n,"__esModule",{value:!0}),n.setWorkbookFocusStatus=n.isFormulaEditorReferencedRangesAcrossSheetContext=n.isFormulaEditorReferencedRangesContext=n.closeFormulaReferencedRanges=n.FormulaEditorReferencedRangesAcrossSheetContext=n.FormulaEditorReferencedRangesContext=n.appendingRangeAnnotation=void 0,e=i(234),r=i(376),u=i(648),o=i(833),s=i(129),h=i(338),f=i(348),a=i(367),c=i(888),l=i(307),v=i(636),d=void 0,n.appendingRangeAnnotation=o.State.Annotation.define(),y=function(){function t(t){this.cmt=!0,this.rl=!1,this.Xvt=r.SelectionUnit.cell,this.Ivt=!1,this.xmt=!0,this.qMi=!1,this.XD=!1,this.umt=-1,this.zQt=t}return t.prototype.smt=function(){var t,n,i,e,u,o;if(!this.isFormula())return[];for(t=this.zQt.state,n=(0,h.getTokensByState)(t),(0,l.markReferenceTokenColorIndex)(n,t),i=[],e=0;e<n.length;e++)u=n[e],((0,s.isReferenceToken)(u)||(0,s.isNameToken)(u)&&(0,s.hasReferenceRanges)(u))&&i.push({index:i.length,textOffset:u.index,text:u.text,ranges:u.ranges,allowDrag:u.canDrag,sheetArea:r.SheetArea.viewport,tag:{colorIndex:u.colorIndex}});return(o=this.Fvt)&&i.push({textOffset:-1,text:"",ranges:[o],index:i.length,allowDrag:!1,isPivotClickCell:!0,tag:{colorIndex:0}}),i},t.prototype.pmt=function(t){var n,i=(0,h.getReferenceTokenColors)(this.zQt.state),e=this.smt()[t];return i[(null===(n=null==e?void 0:e.tag)||void 0===n?void 0:n.colorIndex)||0]},t.prototype.ymt=function(t){var n=this.zQt.state.selection.main.head;return t.textOffset<=n&&t.textOffset+t.text.length>=n},t.prototype.bmt=function(t){var n,i;return!!this.XD&&(n=this.zQt.state.selection.main.head,i=this.umt,t.textOffset>=i&&t.textOffset+t.text.length<=n)},t.prototype.Qvt=function(){return r.SheetArea.viewport},t.prototype.Dvt=function(){var t,n=this.zQt.state;return!n.readOnly&&(!(!this.XD&&!(0,r.Df)(this.text()))||!!this.isFormula()&&(!!(t=(0,s.getTokenByPos)((0,h.getTokensByState)(n),(0,h.getSelection)(n).from-1))&&((0,s.isFormulaStartToken)(t)||(0,s.isFunctionCallStartToken)(t)||(0,s.isSubExpressionStartToken)(t)||(0,s.isFunctionArgumentSeparator)(t)||(0,s.isLeftParenthesesToken)(t)||(0,s.isInfixOperatorToken)(t)||(0,s.isPrefixOperatorToken)(t)||(0,s.isWhitespaceToken)(t))))},t.prototype.text=function(){return(0,h.getTextByState)(this.zQt.state)},t.prototype.caret=function(){return this.zQt.state.selection.main.head},t.prototype.close=function(){},t.prototype.mmt=function(){},t.prototype.Vde=function(t,n){var i,e,r,u,o,s;n&&(i=this.zQt,(r=(e=this.smt())[t])&&(o=(u=r.textOffset)+r.text.length,s=u+n.length,i.dispatch({changes:{from:u,to:o,insert:n},selection:{anchor:s,head:s},annotations:c.notTriggerSignatureTooltip.of(!0)})))},t.prototype.Gvt=function(t,i,e,u,o){var s,f,a,l,v,d,y,p;if(void 0===o&&(o=r.SheetArea.viewport),t){if(a=(f=(s=this).zQt).state,!s.XD){if(!s.Dvt())return;i=!1,s.XD=!0,s.umt=(0,h.getSelection)(a).from}l=s.umt,v=(0,h.getSelection)(a).to,d=(0,h.getTokensByState)(a),y=(0,h.getValidReferenceTokenByPos)(d,v,a),e?(p=l+t.length,f.dispatch({changes:{from:l,to:v,insert:t},selection:{anchor:p,head:p},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]})):i?y&&y.index>=l&&v>=y.index&&(p=y.index+t.length,f.dispatch({changes:{from:y.index,to:v,insert:t},selection:{anchor:p,head:p},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]})):(v>l&&(t=s.fgt()+t),p=v+t.length,f.dispatch({changes:{from:v,to:v,insert:t},selection:{anchor:p,head:p},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]}))}},t.prototype.qD=function(){var t=this;t.XD&&(t.XD=!1,t.umt=-1)},t.prototype.onRangeMoved=function(){},t.prototype.onRangeResized=function(){},t.prototype.onRangeAppend=function(){},t.prototype.fgt=function(){var t=e.Common.CultureManager.Fe().NumberFormat;return t&&t.listSeparator||f.COMMA},t.prototype.cve=function(){return this.zQt.state.field(a.calcSourceField).Mf},t.prototype.fve=function(){return this.zQt.state.field(a.activeCellField)},t.prototype.isFormula=function(){return this.zQt.state.field(a.isFormulaField)},t.prototype.Ak=function(t){t&&(this.Dmt=[t])},t.prototype.Hce=function(){this.Dmt=d},t.prototype.Ymt=function(){return this.Dmt},t.prototype.dispose=function(){this.zQt=d},t.prototype.dve=function(){var t=this.zQt;t&&(k(t.state),t.hasFocus&&t.contentDOM.blur(),this.dispose())},t}(),n.FormulaEditorReferencedRangesContext=y,p=function(){function t(t){this.lve=t}return Object.defineProperty(t.prototype,"Ivt",{get:function(){return this.lve.Ivt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Mf",{get:function(){return this.lve.cve()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_text",{get:function(){return this.lve.text()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bZ",{get:function(){return this.lve.fve().row},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mvt",{get:function(){return this.lve.fve().col},enumerable:!1,configurable:!0}),t.prototype.zde=function(t){var n=!1,i=this.Mf,e=this.bZ,r=this.mvt,u=this._text;return i!==t&&(b(i),n=!0),(0,v.executeCommitContextToCellCommand)(i,e,r,u),this.d5(),n},t.prototype.d5=function(){this.lve=d,u.Hde.DJ=d},t}(),n.FormulaEditorReferencedRangesAcrossSheetContext=p,n.closeFormulaReferencedRanges=k,n.isFormulaEditorReferencedRangesContext=m,n.isFormulaEditorReferencedRangesAcrossSheetContext=g,n.setWorkbookFocusStatus=w},348:function(t,n,i){var e,r,u,o,s=this&&this.mJr||function(){return s=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},s.apply(this,arguments)};function h(t){var n=t.description();return n&&(n=f(n)),{name:t.name,description:null==n?void 0:n.description,parameters:null==n?void 0:n.parameters}}function f(t){var n,i,e,r=[],u=t.parameters||[];for(n=0;n<u.length;n++)(e=(i=s({},u[n])).name.length>2&&i.name.startsWith("[")&&i.name.endsWith("]"))&&(i.optional=!0,i.name=i.name.substring(1,i.name.length-1)),i.repeatable&&(i.optional=!0),r.push(i);return s(s({},t),{parameters:r})}function a(t,n){return n=n.toUpperCase(),(t||[]).find((function(t){return t.name.toUpperCase()===n}))}function c(t,n){return n=n.toUpperCase(),(t||[]).find((function(t){return t.name.toUpperCase()===n}))}function l(t){return t&&0!==t.length?t.map(v).join(", "):""}function v(t){var n=t.name;return t.optional&&(n="["+n+"]"),t.repeatable&&(n="..."+n),n}function d(t){var n=t.name;return t.repeatable&&(n+=", ..."),t.optional&&(n="["+n+"]"),n}function y(t){return"".concat(t.name,"(").concat(l(t.parameters),")")}function p(t){return"(".concat(o().FORMULA," ").concat(y(t))}function k(t){return t[t.length-1]}function m(t){return"gc-formula-editor-tooltip-help-function-"+t}function g(t,n){var i,e,r,u,o,s=document.createElement("p");for(s.className=m("title"),i=function(t,n){var i=document.createElement("span");return i.className=n,i.textContent=t,s.appendChild(i),i},e=function(t){return m("title-"+t)},i(t.name,e("function-name")),i("(",e("parentheses")),r=t.parameters||[],u=0;u<r.length;u++)o=e("parameter"),void 0!==n&&n===u&&(o+=" "+e("active-parameter")),i(d(r[u]),o),u!==r.length-1&&i(",",e("parameter-separator"));return i(")",e("parentheses")),s}function w(t){var n=document.createElement("p");return n.textContent=t,n.className=m("description"),n}Object.defineProperty(n,"__esModule",{value:!0}),n.createHelpFunctionDescriptionDom=n.createHelpFunctionTitleDom=n.lastItem=n.getFunctionHoverTitle=n.getFunctionSignatureString=n.getParameterString=n.getParameterListString=n.findFunctionResource=n.findFunction=n.normalizeFunctionDescription=n.convertToFunctionResource=n.END_OF_LINE=n.WHITESPACE=n.RIGHT_CURLY_BRACKETS=n.LEFT_CURLY_BRACKETS=n.RIGHT_PARENTHESES=n.LEFT_PARENTHESES=n.SEMICOLON=n.COMMA=n.FULL_STOP=n.EQUAL=void 0,e=i(234),r=i(236),u=new e.Common.ResourceManager(r.SR,"formulaEditor"),o=u.getResource.bind(u),n.EQUAL="=",n.FULL_STOP=".",n.COMMA=",",n.SEMICOLON=";",n.LEFT_PARENTHESES="(",n.RIGHT_PARENTHESES=")",n.LEFT_CURLY_BRACKETS="{",n.RIGHT_CURLY_BRACKETS="}",n.WHITESPACE=" ",n.END_OF_LINE="\r\n",n.convertToFunctionResource=h,n.normalizeFunctionDescription=f,n.findFunction=a,n.findFunctionResource=c,n.getParameterListString=l,n.getParameterString=v,n.getFunctionSignatureString=y,n.getFunctionHoverTitle=p,n.lastItem=k,n.createHelpFunctionTitleDom=g,n.createHelpFunctionDescriptionDom=w},357:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g;function w(t,n,i){if(M(t,n,i))return!0;if(x(t,n,i))return!0;if(!b(t,n,i))return!0;var e={r:d};return r.Worksheet.et(t,"formulaPanelCheckIsReadOnly",e),!!e.r}function b(t,n,i){var e=t.getActualStyle(n,i);return!e||!1!==e.allowEditInCell}function M(t,n,i){return t.isActualProtected()&&!1!==t.l0(n,i,"locked")}function x(t,n,i){var e,u=t.$go(n,i);return!(!u||(e={sheet:t,sheetName:t.name(),sheetArea:r.SheetArea.viewport,row:n,col:i},!(e=u.lfe(e,v)).readonly))}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaEditor=n.CONST_FORMULA_EDITOR=void 0,e=i(234),r=i(376),u=i(910),o=i(753),s=i(636),h=i(203),f=i(390),a=i(607),c=i(338),l=i(752),n.CONST_FORMULA_EDITOR="formula-editor",v=void 0,d=null,y=r.mt.b0,p=r.GC$.extend,k=r.GC$.each,m=[h.formulaReferencedRangesExtension],g=function(){function t(i,h){var f,a;"string"==typeof i&&(i=document.getElementById(i)),f=this,a={container:i},t.et(f,"onCreate",a),i=a.container,f.Wc=i,f.li=new u.FormulaEditorCore(i,m),f.e$r(),f.Qy=new e.Commands.CommandManager(f),f.Zde=f.Zde.bind(f),f.spe=f.spe.bind(f),f.Yde=f.Yde.bind(f),f.$ve=f.$ve.bind(f),f.ove=f.ove.bind(f),f.tve=f.tve.bind(f),f.Rve=f.Rve.bind(f),f.hme=f.hme.bind(f),f.qve=f.qve.bind(f),f.yme=f.yme.bind(f),f.kme=f.kme.bind(f),f.LEt=y(o.DEFAULT_FORMULA_EDITOR_OPTIONS,f.kme),f.Zp(h),f.wme(),i.addEventListener("keydown",f.Zde),(0,s.registerDefaultCommands)(f.Qy),(0,r.GC$)(i).data(n.CONST_FORMULA_EDITOR,f)}return t.prototype.e$r=function(){var n=this;n.li.initTheme(),t.et(n,"onThemeChange",n.li.getTheme())},Object.defineProperty(t.prototype,"options",{get:function(){return this.LEt},set:function(t){if(t&&"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(this.LEt[n]=t[n])},enumerable:!1,configurable:!0}),t.prototype.text=function(t){if(0===arguments.length)return this.li.getText();this.li.setText(t+"")},t.prototype.workbook=function(){return this.Vv},t.prototype.attach=function(n){var i=this;i.Vv!==n&&(i.detach(),i.Vv=n,i._6(),i.Vv.D3(r.Events.EnterCellInternal,i.spe),i.Vv.D3(r.Events.CellChanged,i.Yde),i.Vv.D3(r.Events.RangeChanged,i.$ve),i.Vv.D3(r.Events.RangeFiltered,i.yme),i.Vv.D3(r.Events.RangeFilterCleared,i.yme),i.Vv.D3(r.Events.ActiveSheetChangingInternal,i.ove),i.Vv.D3(r.Events.ActiveSheetChangedInternal,i.tve),i.Vv.D3(r.Events.SheetOptionsChangedInternal,i.Rve),i.Vv.D3(r.Events.WorkbookOptionsChangedInternal,i.hme),i.Vv.D3(r.Events.CustomNameChangedInternal,i.qve),t.et(i,"onAttach"))},t.prototype.detach=function(){var t=this,n=t.Vv;n&&(n._3(r.Events.EnterCellInternal,t.spe),n._3(r.Events.CellChanged,t.Yde),n._3(r.Events.RangeChanged,t.$ve),n._3(r.Events.RangeFiltered,t.yme),n._3(r.Events.RangeFilterCleared,t.yme),n._3(r.Events.ActiveSheetChangingInternal,t.ove),n._3(r.Events.ActiveSheetChangedInternal,t.tve),n._3(r.Events.SheetOptionsChangedInternal,t.Rve),n._3(r.Events.WorkbookOptionsChangedInternal,t.hme),n._3(r.Events.CustomNameChangedInternal,t.qve),t.Vv=v,t._6())},t.prototype.format=function(){this.li.format()},t.prototype.commandManager=function(){return this.Qy},t.prototype.destroy=function(){var i=this;t.et(i,"onDestroy"),i.detach(),i.li.destroy(),i.Wc.removeEventListener("keydown",i.Zde),(0,r.GC$)(i.Wc).data(n.CONST_FORMULA_EDITOR,d)},t.prototype.refresh=function(){var t=this;t.e$r(),t._6()},t.prototype.getActiveCellInfo=function(){var t=this.li.getActiveCellInfo(),n=t.row,i=t.col,e=this.li.getCalcSource().Mf;return{sheet:e,row:n,col:i}},t.prototype.isFormattedFormula=function(){return this.li.isFormattedFormula()},t.prototype.Qde=function(){return this.li.getView().hasFocus},t.prototype.Xde=function(){var t,n,i=this.getActiveCellInfo(),e=i.sheet,u=i.row,o=i.col;e&&(t=this.li,n=(0,f.getEditText)(e,u,o),e.options.showFormulas&&e.hasFormula(u,o)&&r.mt.HRe(u,o,e)&&(n=""),(0,c.isSameFormula)(t.getView().state,t.getText(),n)||t.setText(n),t.format())},t.prototype.Zp=function(t){var n=this.LEt,i=t||{};i=p(!0,{},o.DEFAULT_FORMULA_EDITOR_OPTIONS,i),k(i,(function(t,i){n.hasOwnProperty(t)&&(n[t]=i)})),this.li.setOptions(n)},t.prototype.wme=function(){var t=this;t.li.setProvider({getStructReferences:function(){return(0,l.getStructReferencesByWorkbook)(t.Vv)},getFunctions:function(){return(0,a.getFunctionsByWorkbook)(t.Vv)}})},t.prototype.Zde=function(t){this.hve(t)},t.prototype.spe=function(){var t=this;t.tpe()?t.ope():(t.Xde(),t.Ove())},t.prototype.Yde=function(t,n){var i=this.getActiveCellInfo(),e=i.sheet,r=i.row,u=i.col;e===n.sheet&&r===n.row&&u===n.col&&("[styleinfo]"===n.propertyName&&this.Ove(),this.Xde())},t.prototype.$ve=function(t,n){if(n){var i=this.getActiveCellInfo(),e=i.sheet,u=i.row,o=i.col;e===n.sheet&&new r.Range(n.row,n.col,n.rowCount,n.colCount).contains(u,o)&&this.Xde()}},t.prototype.ove=function(t,n){(0,h.ave)(t,n)},t.prototype.tve=function(t,n){var i;(0,h.uve)(t,n)||this._6()},t.prototype.Rve=function(t,n){var i=n.propertyName;"isProtected"===i&&this.Ove(),"showFormulas"===i&&this.Xde()},t.prototype.hme=function(t,n){var i;"allowDynamicArray"===n.propertyName&&this.li.rebuildFormula()},t.prototype.qve=function(){this.sve()},t.prototype.yme=function(t,n){var i,e=null===(i=this.Vv)||void 0===i?void 0:i.getSheetTab(n.sheetName),r=this.li.getCalcSource().Mf;e&&e.Mf===r&&this.Xde()},t.prototype.kme=function(t,n,i){var e=this;n!==i&&this.li.setOptions(e.LEt)},t.prototype._6=function(){var t=this;t.eve(),t.rve(),t.sve(),t.ope()},t.prototype.eve=function(){var t,n=(null===(t=this.Vv)||void 0===t?void 0:t.getCalcService())||o.defaultCalcService;this.li.setCalcService(n)},t.prototype.rve=function(){var t=(0,a.Kde)(this.Vv);t?this.li.setCalcSource(t.Uw()):this.li.setCalcSource(o.defaultCalcSource),this.epe()},t.prototype.sve=function(){var t,n=[],i=this.Vv;i&&(n.push.apply(n,i.getCustomNames()),(t=(0,a.Kde)(i))&&n.push.apply(n,t.getCustomNames())),this.li.setCustomNames(n)},t.prototype.ope=function(){var t=this,n=t.rpe();t.li.setActiveCellInfo(n),t.Xde(),t.Ove(),t.li.clearHistory(),t.epe()},t.prototype.Ove=function(){var t=(0,a.Kde)(this.Vv);t?this.li.setReadOnly(w(t,t.getActiveRowIndex(),t.getActiveColumnIndex())):this.li.setReadOnly(!1)},t.prototype.tpe=function(){var t=this.li.getActiveCellInfo(),n=this.rpe();return t.row!==n.row||t.col!==n.col},t.prototype.rpe=function(){var t,n,i=(0,a.Kde)(this.Vv);return i?{row:t=i.getActiveRowIndex(),col:n=i.getActiveColumnIndex()}:o.DEFAULT_ACTIVE_CELL_INFO},t.prototype.epe=function(){this.options.onActiveCellChanged&&this.options.onActiveCellChanged()},t.prototype.hve=function(t){var n,i,e,u=this,o=u.Qy.getShortcutKey(t.keyCode,t.ctrlKey,t.shiftKey,t.altKey,t.metaKey),s=u.Qy.getCommands(o);if(s)for(n={cmds:s,r:d},r.Worksheet.et(this.Vv.getActiveSheet(),"beforeExecuteShortcut",n),s=n.cmds,i=0;i<s.length;i++)if(e=s[i].execute(u,{}))return e.ignoreCancelDefault||r.mt.vi(t),!0},t}(),n.FormulaEditor=g,(0,r.$e)(g)},367:function(t,n,i){var e,r,u,o,s,h,f;function a(t,n){return h.define({create:t,update:function(t,i){var e,r,u;for(e=0,r=i.effects;e<r.length;e++)if((u=r[e]).is(n))return u.value;return t}})}function c(t){return!!t.docChanged||t.effects.some((function(t){return t.is(n.setCalcServiceField)||t.is(n.setCalcSourceField)||t.is(n.setCustomNamesField)||t.is(n.setProviderField)||t.is(n.setActiveCellField)||t.is(n.rebuildFormulaEffect)}))}Object.defineProperty(n,"__esModule",{value:!0}),n.needRebuildToken=n.customFields=n.isFormattedFormulaField=n.isFormulaField=n.themeField=n.setThemeField=n.optionsField=n.setOptionsField=n.tokenField=n.rebuildFormulaEffect=n.providerField=n.setProviderField=n.customNamesField=n.setCustomNamesField=n.activeCellField=n.setActiveCellField=n.calcSourceField=n.setCalcSourceField=n.calcServiceField=n.setCalcServiceField=void 0,e=i(376),r=i(833),u=i(338),o=i(753),s=i(744),h=r.State.StateField,f=r.State.StateEffect,n.setCalcServiceField=f.define(),n.calcServiceField=a((function(){return o.defaultCalcService}),n.setCalcServiceField),n.setCalcSourceField=f.define(),n.calcSourceField=a((function(){return o.defaultCalcSource}),n.setCalcSourceField),n.setActiveCellField=f.define(),n.activeCellField=a((function(){return o.DEFAULT_ACTIVE_CELL_INFO}),n.setActiveCellField),n.setCustomNamesField=f.define(),n.customNamesField=a((function(){return[]}),n.setCustomNamesField),n.setProviderField=f.define(),n.providerField=a((function(){return o.DEFAULT_PROVIDER}),n.setProviderField),n.rebuildFormulaEffect=f.define(),n.tokenField=h.define({create:function(t){return(0,u.parseToTokens)(t,(0,u.getTextByState)(t))},update:function(t,n){return c(n)?(0,u.parseToTokens)(n.state,(0,u.getTextByState)(n.state)):t}}),n.setOptionsField=f.define(),n.optionsField=a((function(){return o.DEFAULT_FORMULA_EDITOR_OPTIONS}),n.setOptionsField),n.setThemeField=f.define(),n.themeField=a((function(){return o.defaultTheme}),n.setThemeField),n.isFormulaField=h.define({create:function(t){return(0,e.kf)((0,u.getTextByState)(t))},update:function(t,n){return n.docChanged?(0,e.kf)((0,u.getTextByState)(n.state)):t}}),n.isFormattedFormulaField=h.define({create:function(){return!0},update:function(t,n){return n.docChanged?!!n.annotation(s.formatDocumentAnnotation):t}}),n.customFields=[n.optionsField,n.themeField,n.isFormulaField,n.isFormattedFormulaField,n.activeCellField,n.calcServiceField,n.calcSourceField,n.customNamesField,n.providerField,n.tokenField],n.needRebuildToken=c},376:function(n){n.exports=t.Spread.Sheets},390:function(t,n,i){var e,r,u,o,s,h;function f(t){t.Dn.Fde()}function a(t){var n=t.Bde;if((0,o.isFormulaEditorReferencedRangesContext)(n)&&n.zQt.hasFocus)return!0}function c(t,n,i){var e,r,o,s,h,f="";if(t)if(r=(e=t.parent)&&e.options,(o=t.getFormulaInformation(n,i,3))&&o.hasFormula&&!u.mt.HRe(n,i,t)){if(f="="+o.formulaWithCulture,o.isDynamicArray)return"";o.isArrayFormula&&(f="{"+f+"}")}else s=t.getActualStyle(n,i),f="string"==typeof(h=t.getValue(n,i))&&(s.quotePrefix||h.length>1&&"="===h[0]&&r&&r.allowUserEditFormula&&!r.allowInvalidFormula)?"'"+h:u.mt.formatValue2Text(s,h,t,{sheet:t,row:n,col:i,sheetArea:3})||"";return f}Object.defineProperty(n,"__esModule",{value:!0}),n.getEditText=n.paintFormulaReferencedRanges=void 0,e=i(234),r=i(236),u=i(376),o=i(341),n.paintFormulaReferencedRanges=f,s=new e.Common.ResourceManager(r.SR,"formulaEditor"),h=s.getResource.bind(s),u.Worksheet.ch("formulaEditor",{preProcessKeyDown:function(t){a(this)&&(t.r=!0)},processCompositionStart:function(t){a(this)&&(t.r=!0)}}),n.getEditText=c,u.Workbook.ch("formulaEditor",{onCultureChanged:function(){h()}})},413:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v;function d(t,n){return v().NO_MATCHED_ARGUMENTS.replace("$1",t+"").replace("$2",n+"")}function y(t){return v().UNKNOWN_SHEET.replace("$1",t)}function p(t){return v().DUPLICATE_IDENTIFIER.replace("$1",t)}function k(t){var n,i,e,r=[],u=t.field(c.isFormulaField);return u?(n=(0,f.getTextByState)(t),D(r,i=(0,f.getTokensByState)(t),t,n),R(r)||((e=(0,f.parseToExpressionTree)(n,t))?b(r,e,t):E(r,i,t,n),(0,f.parseToExpressionTree)(n,t,!0)||R(r)||m(r,0,n.length,v().INVALID_FORMULA)),r):[]}function m(t,n,i,e,r){void 0===r&&(r="error"),t.push({from:n,to:i,message:e,severity:r})}function g(t,n,i,e){void 0===e&&(e="error"),m(t,n.index,n.endIndex+1,i,e)}function w(t,n,i,e){void 0===e&&(e="error"),m(t,n.lit,n.ywt,i,e)}function b(t,n,i){if(n){for(;n.type===o.ExpressionType.parentheses;){if(!n.value)return void w(t,n,v().INVALID_EXPRESSION);n=n.value}var e=n.type;e===o.ExpressionType.name?(0,f.getCustomNameByState)(i,n.value)||w(t,n,v().UNKNOWN_NAME,"warning"):e===o.ExpressionType.operator?(n.value&&b(t,n.value,i),n.value2&&b(t,n.value2,i)):e===o.ExpressionType.function?M(t,n,i):e===o.ExpressionType.reference&&A(t,n)}}function M(t,n,i){var e,r,u,s=n.functionName;if("LET"===s)x(t,n,i);else if("LAMBDA"===s)S(t,n,i);else for((0,o.isExpression)(n.function)?b(t,n.function,i):(e=(0,f.getFunctionByState)(i,s))?C(t,n,e):(0,f.getCustomNameByState)(i,s)||m(t,n.lit,n.lit+s.length,v().UNKNOWN_NAME,"warning"),r=n.arguments||[],u=0;u<r.length;u++)b(t,r[u],i)}function x(t,n,i){var e,r,u=n.lit,o=n.ywt,s=n.arguments||[];for(s.length<3&&m(t,u,o,d(3,s.length)),s.length>=3&&s.length%2==0&&m(t,u,o,v().MISS_LET_FUNCTION_BODY),e=[],r=0;r<s.length-1;r++)r%2==0?(O(t,s[r],e),e.push(s[r].value)):b(t,s[r],i);b(t,s[s.length-1],i)}function S(t,n,i){var e,r,u=n.lit,o=n.ywt,s=n.arguments||[];for(s.length<1&&m(t,u,o,d(1,s.length)),e=[],r=0;r<s.length-1;r++)O(t,s[r],e),e.push(s[r].value);b(t,s[s.length-1],i)}function C(t,n,i){var e=n.lit,r=n.ywt,u=i.minArgs||0,o=i.maxArgs!==a?i.maxArgs:Number.MAX_SAFE_INTEGER,s=n.arguments||[];s.length<u?m(t,e,r,d(u,s.length)):s.length>o&&m(t,e,r,d(o,s.length))}function O(t,n,i){var e=n.lit,r=n.ywt;!n||8!==n.type&&100!==n.type||n.value.indexOf(".")>-1?m(t,e,r,v().INVALID_IDENTIFIER_ARGUMENT):-1!==i.indexOf(n.value)&&m(t,e,r,p(n.value))}function A(t,n){var i=n.source,e=i&&i.getName();i instanceof o.ErrorSource&&e&&m(t,n.lit,n.lit+e.length,y(e),"warning")}function D(t,n,i,e){var r,u,o=[],h=function(t){return(0,s.isFunctionCallStartToken)(t)||(0,s.isSubExpressionStartToken)(t)||(0,s.isLeftParenthesesToken)(t)},f=function(t){return(0,s.isFunctionCallEndToken)(t)||(0,s.isSubExpressionEndToken)(t)||(0,s.isRightParenthesesToken)(t)};for(r=0;r<n.length;r++)h(u=n[r])?o.push(u):f(u)&&(o.length>0?o.pop():g(t,u,v().NO_MATH_PARENTHESES));o.length>0&&m(t,e.length,e.length,v().MISS_RIGHT_PARENTHESES)}function E(t,n,i,e){var r,u,o,f,a=[],c=[],l=[];for(r=0;r<n.length;r++)u=n[r],(0,s.isFunctionCallToken)(u)?(a.push({token:u}),l.push([])):(0,s.isSubExpressionStartToken)(u)?c.push({token:u}):(0,s.isFunctionCallEndToken)(u)?0===a.length?g(t,u,v().NO_MATH_PARENTHESES):(o=(0,h.lastItem)(a),a.pop(),l.pop(),o.hasError||(f=I(i,e,o.token,u),t.push.apply(t,f),R(f)&&(a.forEach((function(t){t.hasError=!0})),c.forEach((function(t){t.hasError=!0}))))):(0,s.isSubExpressionEndToken)(u)?0===c.length?g(t,u,v().NO_MATH_PARENTHESES):c.pop():(0,s.isFunctionArgumentSeparator)(u)?0!==a.length&&(0,h.lastItem)(l).push(u):(0,s.isRightParenthesesToken)(u)&&g(t,u,v().NO_MATH_PARENTHESES);(a.length>0||c.length>0)&&m(t,e.length,e.length,v().MISS_RIGHT_PARENTHESES)}function I(t,n,i,e){var r=[],u=i.index,o=e.endIndex+1,s=n.substring(u,o),h=(0,f.parseToExpressionTree)(s,t);return h?(M(r,h,t),r.forEach((function(t){t.from+=u,t.to+=u})),(0,f.parseToExpressionTree)(s,t,!0)||R(r)||m(r,u,o,v().INVALID_EXPRESSION),r):(m(r,u,o,v().INVALID_EXPRESSION),r)}function R(t){return t.some((function(t){return"error"===t.severity}))}Object.defineProperty(n,"__esModule",{value:!0}),n.getDiagnostic=n.linterExtension=void 0,e=i(833),r=i(234),u=i(236),o=i(35),s=i(129),h=i(348),f=i(338),a=void 0,c=i(367),l=new r.Common.ResourceManager(u.SR,"formulaEditor"),v=l.getResource.bind(l),n.linterExtension=e.Lint.linter((function(t){return k(t.state)}),{needsRefresh:function(t){return t.transactions.some(c.needRebuildToken)}}),n.getDiagnostic=k},465:function(t,n){var i,e;Object.defineProperty(n,"__esModule",{value:!0}),n.TokenType=n.SyntaxHighlightingTokenType=void 0,function(t){t[t.subExpression=0]="subExpression",t[t.function=1]="function",t[t.argumentSeparator=2]="argumentSeparator",t[t.operatorPrefix=3]="operatorPrefix",t[t.operatorInfix=4]="operatorInfix",t[t.operatorPostfix=5]="operatorPostfix",t[t.stringConst=6]="stringConst",t[t.errorConst=7]="errorConst",t[t.numberConst=8]="numberConst",t[t.booleanConst=9]="booleanConst",t[t.name=10]="name",t[t.reference=11]="reference",t[t.whitespace=12]="whitespace",t[t.unknown=13]="unknown"}(i=n.SyntaxHighlightingTokenType||(n.SyntaxHighlightingTokenType={})),function(t){t[t.ErrorConst=0]="ErrorConst",t[t.LogicalConst=1]="LogicalConst",t[t.NumberConst=2]="NumberConst",t[t.StringConst=3]="StringConst",t[t.ArrayConstStart=4]="ArrayConstStart",t[t.ArrayConstEnd=5]="ArrayConstEnd",t[t.ArrayConstRowSeparator=6]="ArrayConstRowSeparator",t[t.ArrayConstItemSeparator=7]="ArrayConstItemSeparator",t[t.OperatorPrefix=8]="OperatorPrefix",t[t.OperatorInfix=9]="OperatorInfix",t[t.OperatorPostfix=10]="OperatorPostfix",t[t.FunctionName=11]="FunctionName",t[t.FunctionCallStart=12]="FunctionCallStart",t[t.FunctionCallEnd=13]="FunctionCallEnd",t[t.FunctionArgumentSeparator=14]="FunctionArgumentSeparator",t[t.SubExpressionStart=15]="SubExpressionStart",t[t.SubExpressionEnd=16]="SubExpressionEnd",t[t.CellReference=17]="CellReference",t[t.Name=18]="Name",t[t.FormulaStart=19]="FormulaStart",t[t.Whitespace=20]="Whitespace",t[t.Unknown=21]="Unknown"}(e=n.TokenType||(n.TokenType={}))},564:function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.FORMULA=n.INVALID_FORMULA=n.INVALID_EXPRESSION=n.DUPLICATE_IDENTIFIER=n.INVALID_IDENTIFIER_ARGUMENT=n.NO_MATCHED_ARGUMENTS=n.UNKNOWN_SHEET=n.UNKNOWN_NAME=n.MISS_LET_FUNCTION_BODY=n.MISS_RIGHT_PARENTHESES=n.NO_MATH_PARENTHESES=void 0,n.NO_MATH_PARENTHESES="No match parentheses",n.MISS_RIGHT_PARENTHESES="')' is expected.",n.MISS_LET_FUNCTION_BODY="Missing body of LET expression.",n.UNKNOWN_NAME="Unknown name",n.UNKNOWN_SHEET='Unknown sheet "$1"',n.NO_MATCHED_ARGUMENTS="Expected $1 arguments, but got $2",n.INVALID_IDENTIFIER_ARGUMENT="This argument must be an identifier to bind.",n.DUPLICATE_IDENTIFIER="Duplicate identifier $1",n.INVALID_EXPRESSION="Invalid EXPRESSION",n.INVALID_FORMULA="Invalid Formula",n.FORMULA="Formula"},607:function(t,n,i){var e,r;function u(t){if(t)return(0,e.jf)(t)}function o(t){var n,i=(0,r.getGlobalFunctions)(),e=function(t){Object.keys(t).forEach((function(n){i.push(t[n])}))};return t&&(e(t.Amt),(n=u(t))&&e(n.Amt),t.options.allowDynamicArray||(i=i.filter((function(t){return!t.isDynamicArrayFunction})))),i}Object.defineProperty(n,"__esModule",{value:!0}),n.getFunctionsByWorkbook=n.Kde=void 0,e=i(376),r=i(129),n.Kde=u,n.getFunctionsByWorkbook=o},636:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m;function g(t,n){return void 0===n&&(n=!1),{canUndo:n,execute:t}}function w(t,n){return void 0===n&&(n=!1),g((function(n){return t(n.li.getView())}),n)}function b(t){var i=e.mt.Qf(),r=!i,u=i;t.register(y,n.Commands[y],27),t.register(a,n.Commands[a],32,r,!0,!1,u),t.register(c,n.Commands[c],27),t.register(l,n.Commands[l],115),t.register(v,n.Commands[v],70,!1,!0,!0),t.register(d,n.Commands[d],83,r,!1,!1,u)}Object.defineProperty(n,"__esModule",{value:!0}),n.registerDefaultCommands=n.Commands=n.executeCommitContextToCellCommand=void 0,e=i(376),r=i(648),u=i(607),o=i(744),s=i(888),h=i(47),f=i(341),a="showHints",c="closeHints",l="toggleAbsoluteRelativeReferences",v="formatDocument",d="commitContentToActiveCell",y="exitEdit",p=function(t,n,i,r,u){var o,s,h,f;void 0===u&&(u=e.SheetArea.viewport),o=r.length>0?r:null,s={cmd:"editCell",sheetName:t.name(),row:n,col:i,sheetArea:u,newValue:o},t.dataRanges&&(h=t.dataRanges.getByPosition(n,i))&&(f=h.convertContext({sheet:t,row:n,col:i,sheetArea:u}))&&f.sheet!==t&&(s.sheetName=f.sheet.name(),s.row=f.row,s.col=f.col),t.Qy().execute(s)},n.executeCommitContextToCellCommand=p,k=g((function(t){var i,e,o,s,h=(0,u.Kde)(t.Vv);return!!h&&(i=r.Hde.Ude(),(0,f.isFormulaEditorReferencedRangesAcrossSheetContext)(i)?(i.zde(h),!0):(e=t.text(),o=h.getActiveRowIndex(),s=h.getActiveColumnIndex(),(0,n.executeCommitContextToCellCommand)(h,o,s,e),!0))})),m=g((function(t){var n,i=t.workbook();return!(!t.Qde()||!i)&&((n=t.li.getView()).contentDOM.blur(),(0,f.closeFormulaReferencedRanges)(n.state),i.focus(!1),i.focus(),t.Xde(),!0)})),n.Commands={},n.Commands[a]=w(s.triggerParameterHintsCommand),n.Commands[c]=w(s.closeParameterHintsCommand),n.Commands[v]=w(o.formatDocumentCommand),n.Commands[l]=w(h.toggleAbsoluteRelativeReferencesCommand),n.Commands[d]=k,n.Commands[y]=m,n.registerDefaultCommands=b},648:function(n){n.exports=t.Spread.Sheets.FormulaTextBox},710:function(t,n,i){var e,r,u;Object.defineProperty(n,"__esModule",{value:!0}),n.indentExtension=void 0,e=i(833),r=i(129),u=i(338),n.indentExtension=e.Language.indentService.of((function(t,n){if(n<=0)return 0;var i=t.lineAt(n-1);return i&&i.text?(0,r.getIndentByPreviousText)(i.text,(0,u.getTokensByState)(t.state)):0}))},744:function(t,n,i){var e,r,u,o,s,h,f;function a(t,n,i,e){var r=c(t),u=c(n),o=n.length,s=function(t,n){var i,e;for(t-=r[t],i=0;i<u.length;i++){if((e=i-u[i])===t&&!n){t=i;break}if(e>t){t=i-1;break}}return t<=o&&t>=0?t:0};return i===e?i=e=s(e,!1):(i=s(i,!0),e=s(e,!1)),[i,e]}function c(t){var n,i,e=function(t){return" "===t||"\n"===t},r=[0];for(n=1;n<=t.length;n++)i=r[n-1],r.push(i+(e(t[n-1])?1:0));return r}function l(t){var n,i=t.scrollDOM.getBoundingClientRect(),e=t.contentDOM.getBoundingClientRect(),r=v(i,e),u=t.contentDOM.querySelector(".cm-line");return u&&(n=window.getComputedStyle(u),r-=parseInt(n.paddingLeft,10)+parseInt(n.paddingRight,10)),r}function v(t,n){var i=Math.max(t.left,n.left),e=Math.min(t.right,n.right),r=e-i;return r>=0?r:0}function d(t){var n=window.getComputedStyle(t.contentDOM),i=n.font,e=document.createElement("canvas"),r=e.getContext("2d");return r.font=i,function(t){return r.measureText(t).width}}Object.defineProperty(n,"__esModule",{value:!0}),n.formatDocumentCommand=n.formatDocumentAnnotation=void 0,e=i(833),r=i(338),u=i(967),o=i(367),s=i(888),h=Number.MAX_SAFE_INTEGER,n.formatDocumentAnnotation=e.State.Annotation.define(),f=function(t){var i,e,f,c,v,y,p,k,m,g,w=t.state.field(o.isFormulaField);return!!w&&(i=(0,r.getTabSizeByState)(t.state),e=(0,r.getFormatWidthLimitByState)(t.state),f=h,c=function(t){return 0},"auto"===e&&(f=l(t),e=h,c=d(t)),v=t.state.selection.main,p={absoluteReference:!1,parseContext:y=(0,r.getParseContextByState)(t.state),tabSize:i,widthLimit:e,lineWidthLimit:f,measureTextFunc:c},k=(0,r.getTextByState)(t.state),void 0!==(m=(0,u.format)(k,p))&&(k===m||(g=a(k,m,v.from,v.to),t.dispatch({changes:{from:0,to:t.state.doc.length,insert:m},selection:{anchor:g[0],head:g[1]},annotations:[s.notTriggerSignatureTooltip.of(!0),n.formatDocumentAnnotation.of(!0)]})),!0))},n.formatDocumentCommand=f},752:function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.getStructReferencesByWorkbook=void 0;var e=i(35);function r(t){return t?u(t).concat(s(t)):[]}function u(t){var n=[];return t.sheets.forEach((function(t){var i;(t.tables&&t.tables.all()||[]).forEach((function(t){n.push({name:t.name(),description:(0,e.sR)().Fbx_TableName_Description+t.name(),getColumns:function(){return o(t)}})}))})),n}function o(t){for(var n,i,r=[],u=0,o="";null!==o;)o=t.getColumnName(u),u++,null!==o&&r.push({name:o,description:""});return n=(0,e.sR)().d2t,i=(0,e.getMapping)()&&(0,e.getMapping)().tableFunctionsMapping,Object.keys(n).forEach((function(t){var e=n[t],u=e.name,o=e.description;u=i&&i[u]||u,r.push({name:u,description:o})})),r}function s(t){var n=[];return t.mp.forEach((function(t){n.push({name:t.name(),description:(0,e.sR)().Fbx_TableSheetName_Description+t.name(),getColumns:function(){return h(t)}})})),n}function h(t){var n,i=[],e=t.getColumnCount();for(n=0;n<e;n++)i.push({name:t.getColumnName(n),description:""});return i}n.getStructReferencesByWorkbook=r},753:function(t,n,i){var e,r,u,o;function s(){var t=new e.CalcService;return t.addResolver(new r.SheetReferenceResolver),t.addResolver(new r.StructureReferenceResolver),t}Object.defineProperty(n,"__esModule",{value:!0}),n.defaultTheme=n.defaultSyntaxHighlighRules=n.DEFAULT_ACTIVE_CELL_INFO=n.DEFAULT_FORMULA_EDITOR_OPTIONS=n.defaultCalcSource=n.defaultCalcService=n.DEFAULT_PROVIDER=n.DEFAULT_FORMAT_WIDTH_LIMIT=n.DEFAULT_TAB_SIZE=void 0,e=i(35),r=i(789),u=i(465),o=i(129),n.DEFAULT_TAB_SIZE=4,n.DEFAULT_FORMAT_WIDTH_LIMIT="auto",n.DEFAULT_PROVIDER={getStructReferences:function(){return[]},getFunctions:o.getGlobalFunctions},n.defaultCalcService=s(),n.defaultCalcSource=new e.CalcSource(n.defaultCalcService),n.DEFAULT_FORMULA_EDITOR_OPTIONS={formatWidthLimit:n.DEFAULT_FORMAT_WIDTH_LIMIT,tabSize:n.DEFAULT_TAB_SIZE},n.DEFAULT_ACTIVE_CELL_INFO={row:0,col:0},n.defaultSyntaxHighlighRules=[{token:u.SyntaxHighlightingTokenType.stringConst,color:"#CC1C1C"},{token:u.SyntaxHighlightingTokenType.errorConst,color:"#CC1C1C"},{token:u.SyntaxHighlightingTokenType.numberConst,color:"#088000"},{token:u.SyntaxHighlightingTokenType.booleanConst,color:"#088000"},{token:u.SyntaxHighlightingTokenType.function,color:"#1C1CFF"},{token:u.SyntaxHighlightingTokenType.argumentSeparator,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.operatorPrefix,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.operatorInfix,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.operatorPostfix,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.reference,color:["#0000ff","#008000","#9900cc","#800000","#00cc33","#cc6600","#cc0099"]}],n.defaultTheme={rules:n.defaultSyntaxHighlighRules}},789:function(n){n.exports=t.Spread.Sheets.CalcEngine},833:function(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T,B,_,N,P,F,H,z,W,V,U,$,q,G,J,K,Q,X,Z,Y,tt,nt,it,et,rt,ut,ot,st,ht,ft,at,ct,lt,vt,dt,yt,pt,kt,mt,gt,wt,bt,Mt,xt,St,Ct,Ot,At,Dt,Et,It,Rt,Lt,jt,Tt,Bt,_t,Nt,Pt,Ft,Ht,zt,Wt,Vt,Ut,$t,qt,Gt,Jt,Kt,Qt,Xt,Zt,Yt,tn,nn,en,rn,un,on,sn,hn,fn,an,cn,ln,vn,dn,yn,pn,kn,mn,gn,wn,bn,Mn,xn,Sn,Cn,On,An,Dn,En,In,Rn,Ln,jn,Tn,Bn,_n,Nn,Pn,Fn,Hn,zn,Wn,Vn,Un,$n,qn,Gn,Jn,Kn,Qn,Xn,Zn,Yn,ti,ni,ii,ei,ri,ui,oi,si,hi,fi,ai,ci,li,vi,di,yi,pi,ki,mi,gi,wi,bi,Mi,xi,Si,Ci,Oi,Ai,Di,Ei,Ii,Ri,Li,ji,Ti,Bi,_i,Ni,Pi,Fi,Hi,zi,Wi,Vi,Ui,$i,qi,Gi,Ji,Ki,Qi,Xi,Zi,Yi,te,ne,ie,ee,re,ue,oe,se,he,fe,ae,ce,le,ve,de,ye,pe,ke,me,ge,we,be,Me,xe,Se,Ce,Oe,Ae,De,Ee,Ie,Re,Le,je,Te,Be,_e,Ne,Pe,Fe,He,ze,We,Ve,Ue,$e,qe,Ge,Je,Ke,Qe,Xe,Ze,Ye,tr,nr,ir,er,rr,ur,or,sr,hr,fr,ar,cr,lr,vr,dr,yr,pr,kr,mr,gr,wr,br,Mr,xr,Sr,Cr,Or,Ar,Dr,Er,Ir,Rr,Lr,jr,Tr,Br,_r,Nr,Pr,Fr,Hr,zr,Wr,Vr,Ur,$r,qr,Gr,Jr,Kr,Qr,Xr,Zr,Yr,tu,nu,iu,eu,ru,uu,ou,su,hu,fu,au,cu,lu,vu,du,yu,pu,ku,mu,gu,wu,bu,Mu,xu,Su,Cu,Ou,Au,Du,Eu,Iu,Ru,Lu,ju,Tu,Bu,_u,Nu,Pu,Fu,Hu,zu,Wu,Vu,Uu,$u,qu,Gu,Ju,Ku,Qu,Xu,Zu,Yu,to,no,io,eo,ro,uo,oo,so,ho,fo,ao,co,lo,vo,yo,po,ko,mo,go,wo,bo,Mo,xo,So,Co,Oo,Ao,Do,Eo,Io,Ro,Lo,jo,To,Bo,_o,No,Po,Fo,Ho,zo,Wo,Vo,Uo,$o,qo,Go,Jo,Ko,Qo,Xo,Zo,Yo,ts,ns,is,es,rs,us,os,ss,hs,fs,as,cs,ls,vs,ds,ys,ps,ks,ms,gs,ws,bs,Ms,xs,Ss,Cs,Os,As,Ds,Es,Is,Rs,Ls,js,Ts,Bs,_s,Ns,Ps,Fs,Hs,zs,Ws,Vs,Us,$s,qs,Gs,Js,Ks,Qs,Xs,Zs,Ys,th,nh,ih,eh,rh,uh,oh,sh,hh,fh,ah,ch,lh,vh,dh,yh,ph,kh,mh,gh,wh,bh,Mh,xh,Sh,Ch,Oh,Ah,Dh,Eh,Ih,Rh,Lh,jh,Th,Bh,_h,Nh,Ph,Fh,Hh,zh,Wh,Vh,Uh,$h,qh,Gh,Jh,Kh,Qh,Xh,Zh,Yh,tf,nf,ef,rf,uf,of,sf,hf,ff,af,cf,lf,vf,df,yf,pf,kf,mf,gf,wf,bf,Mf,xf,Sf,Cf,Of,Af,Df,Ef,If,Rf,Lf,jf,Tf,Bf,_f,Nf,Pf,Ff,Hf,zf,Wf,Vf,Uf,$f,qf,Gf,Jf,Kf,Qf,Xf,Zf,Yf,ta,na,ia,ea,ra,ua,oa,sa,ha,fa,aa,ca,la,va,da,ya,pa,ka,ma,ga,wa,ba,Ma,xa,Sa,Ca,Oa,Aa,Da,Ea,Ia,Ra,La,ja,Ta,Ba,_a,Na,Pa,Fa,Ha,za,Wa,Va,Ua,$a,qa;function Ga(t,n,i){return(n=mc(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function Ja(t){return Xa(t)||Qa(t)||ec(t)||Ka()}function Ka(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Qa(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function Xa(t){if(Array.isArray(t))return rc(t)}function Za(t,n){return nc(t)||tc(t,n)||ec(t,n)||Ya()}function Ya(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function tc(t,n){var i,e,r,u,o,s,h,f=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=f){o=[],s=!0,h=!1;try{if(r=(f=f.call(t)).next,0===n){if(Object(f)!==f)return;s=!1}else for(;!(s=(i=r.call(f)).done)&&(o.push(i.value),o.length!==n);s=!0);}catch(t){h=!0,e=t}finally{try{if(!s&&null!=f.return&&(u=f.return(),Object(u)!==u))return}finally{if(h)throw e}}return o}}function nc(t){if(Array.isArray(t))return t}function ic(t,n){var i,e,r,u,o,s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!s){if(Array.isArray(t)||(s=ec(t))||n&&t&&"number"==typeof t.length)return s&&(t=s),i=0,{s:e=function t(){},n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function t(n){throw n},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return r=!0,u=!1,{s:function n(){s=s.call(t)},n:function t(){var n=s.next();return r=n.done,n},e:function t(n){u=!0,o=n},f:function t(){try{r||null==s.return||s.return()}finally{if(u)throw o}}}}function ec(t,n){if(t){if("string"==typeof t)return rc(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?rc(t,n):void 0}}function rc(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);i<n;i++)e[i]=t[i];return e}function uc(){return uc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function t(n,i,e){var r,u=oc(n,i);if(u)return(r=Object.getOwnPropertyDescriptor(u,i)).get?r.get.call(arguments.length<3?n:e):r.value},uc.apply(this,arguments)}function oc(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=vc(t)););return t}function sc(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&hc(t,n)}function hc(t,n){return hc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function t(n,i){return n.__proto__=i,n},hc(t,n)}function fc(t){var n=lc();return function i(){var e,r,u=vc(t);return n?(r=vc(this).constructor,e=Reflect.construct(u,arguments,r)):e=u.apply(this,arguments),ac(this,e)}}function ac(t,n){if(n&&("object"===dc(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return cc(t)}function cc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function vc(t){return vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function t(n){return n.__proto__||Object.getPrototypeOf(n)},vc(t)}function dc(t){return dc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dc(t)}function yc(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function pc(t,n){var i,e;for(i=0;i<n.length;i++)(e=n[i]).enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,mc(e.key),e)}function kc(t,n,i){return n&&pc(t.prototype,n),i&&pc(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function mc(t){var n=gc(t,"string");return"symbol"===dc(n)?n:String(n)}function gc(t,n){var i,e;if("object"!==dc(t)||null===t)return t;if(void 0!==(i=t[Symbol.toPrimitive])){if("object"!==dc(e=i.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}function wc(t){var n,i,e=-1,r=ic(t);try{for(r.s();!(n=r.n()).done;)e+=(i=n.value).length+1}catch(t){r.e(t)}finally{r.f()}return e}function bc(t,n){var i,e,r,u,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9;for(i=0,e=0,r=!0;e<t.length&&i<=h;e++)(o=i+(u=t[e]).length)>=s&&(o>h&&(u=u.slice(0,h-i)),i<s&&(u=u.slice(s-i)),r?(n[n.length-1]+=u,r=!1):n.push(u)),i=o+1;return n}function Mc(t,n,i){return bc(t,[""],n,i)}for(Object.defineProperty(n,"__esModule",{value:!0}),n.basicSetup=n.View=n.State=n.Search=n.Lint=n.Language=n.Commands=n.Autocomplete=void 0,i=function(){function t(){yc(this,t)}return kc(t,[{key:"lineAt",value:function t(n){if(n<0||n>this.length)throw new RangeError("Invalid position ".concat(n," in document of length ").concat(this.length));return this.lineInner(n,!1,1,0)}},{key:"line",value:function t(n){if(n<1||n>this.lines)throw new RangeError("Invalid line number ".concat(n," in ").concat(this.lines,"-line document"));return this.lineInner(n,!0,1,0)}},{key:"replace",value:function t(n,i,e){var u=[];return this.decompose(0,n,u,2),e.length&&e.decompose(0,e.length,u,3),this.decompose(i,this.length,u,1),r.from(u,this.length-(i-n)+e.length)}},{key:"append",value:function t(n){return this.replace(this.length,this.length,n)}},{key:"slice",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,e=[];return this.decompose(n,i,e,0),r.from(e,i-n)}},{key:"eq",value:function t(n){var i,e,r,o,s,h;if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;for(i=this.scanIdentical(n,1),e=this.length-this.scanIdentical(n,-1),r=new u(this),o=new u(n),s=i,h=i;;){if(r.next(s),o.next(s),s=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(h+=r.value.length,r.done||h>=e)return!0}}},{key:"iter",value:function t(){var n;return new u(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new o(this,n,i)}},{key:"iterLines",value:function t(n,i){var e,r;return null==n?e=this.iter():(null==i&&(i=this.lines+1),r=this.line(n).from,e=this.iterRange(r,Math.max(r,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))),new s(e)}},{key:"toString",value:function t(){return this.sliceString(0)}},{key:"toJSON",value:function t(){var n=[];return this.flatten(n),n}}],[{key:"of",value:function n(i){if(0==i.length)throw new RangeError("A document must have at least one line");return 1!=i.length||i[0]?i.length<=32?new e(i):r.from(e.split(i,[])):t.empty}}]),t}(),e=function(t){sc(i,t);var n=fc(i);function i(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wc(t);return yc(this,i),(e=n.call(this)).text=t,e.length=r,e}return kc(i,[{key:"lines",get:function t(){return this.text.length}},{key:"children",get:function t(){return null}},{key:"lineInner",value:function t(n,i,e,r){var u,o,s;for(u=0;;u++){if(s=r+(o=this.text[u]).length,(i?e:s)>=n)return new h(r,s,e,o);r=s+1,e++}}},{key:"decompose",value:function t(n,e,r,u){var o,s,h,f=n<=0&&e>=this.length?this:new i(Mc(this.text,n,e),Math.min(e,this.length)-Math.max(0,n));1&u?(o=r.pop(),(s=bc(f.text,o.text.slice(),0,f.length)).length<=32?r.push(new i(s,o.length+f.length)):(h=s.length>>1,r.push(new i(s.slice(0,h)),new i(s.slice(h))))):r.push(f)}},{key:"replace",value:function t(n,e,u){var o,s;return u instanceof i?(o=bc(this.text,bc(u.text,Mc(this.text,0,n)),e),s=this.length+u.length-(e-n),o.length<=32?new i(o,s):r.from(i.split(o,[]),s)):uc(vc(i.prototype),"replace",this).call(this,n,e,u)}},{key:"sliceString",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",h="";for(i=0,e=0;i<=o&&e<this.text.length;e++)i>n&&e&&(h+=s),n<(u=i+(r=this.text[e]).length)&&o>i&&(h+=r.slice(Math.max(0,n-i),o-i)),i=u+1;return h}},{key:"flatten",value:function t(n){var i,e,r=ic(this.text);try{for(r.s();!(i=r.n()).done;)e=i.value,n.push(e)}catch(t){r.e(t)}finally{r.f()}}},{key:"scanIdentical",value:function t(){return 0}}],[{key:"split",value:function t(n,e){var r,u,o=[],s=-1,h=ic(n);try{for(h.s();!(r=h.n()).done;)u=r.value,o.push(u),s+=u.length+1,32==o.length&&(e.push(new i(o,s)),o=[],s=-1)}catch(t){h.e(t)}finally{h.f()}return s>-1&&e.push(new i(o,s)),e}}]),i}(i),r=function(t){sc(i,t);var n=fc(i);function i(t,e){var r,u,o,s;yc(this,i),(r=n.call(this)).children=t,r.length=e,r.lines=0,u=ic(t);try{for(u.s();!(o=u.n()).done;)s=o.value,r.lines+=s.lines}catch(t){u.e(t)}finally{u.f()}return r}return kc(i,[{key:"lineInner",value:function t(n,i,e,r){var u,o,s,h;for(u=0;;u++){if(s=r+(o=this.children[u]).length,h=e+o.lines-1,(i?h:s)>=n)return o.lineInner(n,i,e,r);r=s+1,e=h+1}}},{key:"decompose",value:function t(n,i,e,r){var u,o,s,h,f;for(u=0,o=0;o<=i&&u<this.children.length;u++)n<=(h=o+(s=this.children[u]).length)&&i>=o&&(f=r&((o<=n?1:0)|(h>=i?2:0)),o>=n&&h<=i&&!f?e.push(s):s.decompose(n-o,i-o,e,f)),o=h+1}},{key:"replace",value:function t(n,e,r){var u,o,s,h,f,a,c;if(r.lines<this.lines)for(u=0,o=0;u<this.children.length;u++){if(h=o+(s=this.children[u]).length,n>=o&&e<=h)return f=s.replace(n-o,e-o,r),a=this.lines-s.lines+f.lines,f.lines<a>>4&&f.lines>a>>6?((c=this.children.slice())[u]=f,new i(c,this.length-(e-n)+r.length)):uc(vc(i.prototype),"replace",this).call(this,o,h,f);o=h+1}return uc(vc(i.prototype),"replace",this).call(this,n,e,r)}},{key:"sliceString",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",h="";for(i=0,e=0;i<this.children.length&&e<=o;i++)e>n&&i&&(h+=s),n<(u=e+(r=this.children[i]).length)&&o>e&&(h+=r.sliceString(n-e,o-e,s)),e=u+1;return h}},{key:"flatten",value:function t(n){var i,e,r=ic(this.children);try{for(r.s();!(i=r.n()).done;)(e=i.value).flatten(n)}catch(t){r.e(t)}finally{r.f()}}},{key:"scanIdentical",value:function t(n,e){var r,u,o,s,h,f,a,c,l;if(!(n instanceof i))return 0;for(r=0,s=(o=Za(u=e>0?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1],4))[0],h=o[1],f=o[2],a=o[3];;s+=e,h+=e){if(s==f||h==a)return r;if((c=this.children[s])!=(l=n.children[h]))return r+c.scanIdentical(l,e);r+=c.length+1}}}],[{key:"from",value:function t(n){var r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.reduce((function(t,n){return t+n.length+1}),-1),b=0,M=ic(n);try{for(M.s();!(r=M.n()).done;)b+=(u=r.value).lines}catch(t){M.e(t)}finally{M.f()}if(b<32){o=[],s=ic(n);try{for(s.s();!(h=s.n()).done;)(f=h.value).flatten(o)}catch(t){s.e(t)}finally{s.f()}return new e(o,w)}function x(t){var n,r,u,o;if(t.lines>c&&t instanceof i){r=ic(t.children);try{for(r.s();!(u=r.n()).done;)x(o=u.value)}catch(t){r.e(t)}finally{r.f()}}else t.lines>l&&(d>l||!d)?(S(),v.push(t)):t instanceof e&&d&&(n=p[p.length-1])instanceof e&&t.lines+n.lines<=32?(d+=t.lines,y+=t.length+1,p[p.length-1]=new e(n.text.concat(t.text),n.length+1+t.length)):(d+t.lines>a&&S(),d+=t.lines,y+=t.length+1,p.push(t))}function S(){0!=d&&(v.push(1==p.length?p[0]:i.from(p,y)),y=-1,d=p.length=0)}a=Math.max(32,b>>5),c=a<<1,l=a>>1,v=[],d=0,y=-1,p=[],k=ic(n);try{for(k.s();!(m=k.n()).done;)x(g=m.value)}catch(t){k.e(t)}finally{k.f()}return S(),1==v.length?v[0]:new i(v,w)}}]),i}(i),i.empty=new e([""],0),u=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;yc(this,t),this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[n],this.offsets=[i>0?1:(n instanceof e?n.text.length:n.children.length)<<1]}return kc(t,[{key:"nextInner",value:function t(n,i){var r,u,o,s,h,f,a;for(this.done=this.lineBreak=!1;;)if(r=this.nodes.length-1,u=this.nodes[r],s=(o=this.offsets[r])>>1,h=u instanceof e?u.text.length:u.children.length,s==(i>0?h:0)){if(0==r)return this.done=!0,this.value="",this;i>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(i>0?0:1)){if(this.offsets[r]+=i,0==n)return this.lineBreak=!0,this.value="\n",this;n--}else if(u instanceof e){if(f=u.text[s+(i<0?-1:0)],this.offsets[r]+=i,f.length>Math.max(0,n))return this.value=0==n?f:i>0?f.slice(n):f.slice(0,f.length-n),this;n-=f.length}else n>(a=u.children[s+(i<0?-1:0)]).length?(n-=a.length,this.offsets[r]+=i):(i<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(i>0?1:(a instanceof e?a.text.length:a.children.length)<<1))}},{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}]),t}(),o=function(){function t(n,i,e){yc(this,t),this.value="",this.done=!1,this.cursor=new u(n,i>e?-1:1),this.pos=i>e?n.length:0,this.from=Math.min(i,e),this.to=Math.max(i,e)}return kc(t,[{key:"nextInner",value:function t(n,i){var e,r,u;return(i<0?this.pos<=this.from:this.pos>=this.to)?(this.value="",this.done=!0,this):((n+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos))>(e=i<0?this.pos-this.from:this.to-this.pos)&&(n=e),e-=n,u=(r=this.cursor.next(n)).value,this.pos+=(u.length+n)*i,this.value=u.length<=e?u:i<0?u.slice(u.length-e):u.slice(0,e),this.done=!this.value,this)}},{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return n<0?n=Math.max(n,this.from-this.pos):n>0&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}},{key:"lineBreak",get:function t(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),s=function(){function t(n){yc(this,t),this.inner=n,this.afterBreak=!0,this.value="",this.done=!1}return kc(t,[{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=this.inner.next(n),e=i.done,r=i.lineBreak,u=i.value;return e?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=u,this.afterBreak=!1),this}},{key:"lineBreak",get:function t(){return!1}}]),t}(),"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.iter()},u.prototype[Symbol.iterator]=o.prototype[Symbol.iterator]=s.prototype[Symbol.iterator]=function(){return this}),h=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.number=e,this.text=r}return kc(t,[{key:"length",get:function t(){return this.to-this.from}}]),t}(),f="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((function(t){return t?parseInt(t,36):1})),a=1;a<f.length;a++)f[a]+=f[a-1];function xc(t){for(var n=1;n<f.length;n+=2)if(f[n]>t)return f[n-1]<=t;return!1}function Sc(t){return t>=127462&&t<=127487}function Cc(t,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],e=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return(i?Oc:Ac)(t,n,e)}function Oc(t,n,i){var e,r,u,o;if(n==t.length)return n;for(n&&Dc(t.charCodeAt(n))&&Ec(t.charCodeAt(n-1))&&n--,n+=Lc(e=Ic(t,n));n<t.length;)if(r=Ic(t,n),e==c||r==c||i&&xc(r))n+=Lc(r),e=r;else{if(!Sc(r))break;for(u=0,o=n-2;o>=0&&Sc(Ic(t,o));)u++,o-=2;if(u%2==0)break;n+=2}return n}function Ac(t,n,i){for(;n>0;){var e=Oc(t,n-2,i);if(e<n)return e;n--}return 0}function Dc(t){return t>=56320&&t<57344}function Ec(t){return t>=55296&&t<56320}function Ic(t,n){var i,e=t.charCodeAt(n);return Ec(e)&&n+1!=t.length&&Dc(i=t.charCodeAt(n+1))?i-56320+(e-55296<<10)+65536:e}function Rc(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Lc(t){return t<65536?1:2}function jc(t,n,i){var e,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];0==n&&i<=0||((e=t.length-2)>=0&&i<=0&&i==t[e+1]?t[e]+=n:0==n&&0==t[e]?t[e+1]+=i:r?(t[e]+=n,t[e+1]+=i):t.push(n,i))}function Tc(t,n,e){if(0!=e.length){var r=n.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(e);else{for(;t.length<r;)t.push(i.empty);t.push(e)}}}function Bc(t,n,e){var r,u,o,s,h,f,a,c,l=t.inserted;for(r=0,u=0,o=0;o<t.sections.length;)if(s=t.sections[o++],(h=t.sections[o++])<0)r+=s,u+=s;else{for(f=r,a=u,c=i.empty;f+=s,a+=h,h&&l&&(c=c.append(l[o-2>>1])),!(e||o==t.sections.length||t.sections[o+1]<0);)s=t.sections[o++],h=t.sections[o++];n(r,f,u,a,c),r=f,u=a}}function _c(t,n,i){var e,r,u,o,s,h,f,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=[],l=a?[]:null,v=new p(t),k=new p(n);for(e=-1;;)if(-1==v.ins&&-1==k.ins)jc(c,r=Math.min(v.len,k.len),-1),v.forward(r),k.forward(r);else if(k.ins>=0&&(v.ins<0||e==v.i||0==v.off&&(k.len<v.len||k.len==v.len&&!i))){for(u=k.len,jc(c,k.ins,-1);u;)o=Math.min(v.len,u),v.ins>=0&&e<v.i&&v.len<=o&&(jc(c,0,v.ins),l&&Tc(l,c,v.text),e=v.i),v.forward(o),u-=o;k.next()}else{if(!(v.ins>=0)){if(v.done&&k.done)return l?y.createSet(c,l):d.create(c);throw new Error("Mismatched change set lengths")}for(s=0,h=v.len;h;)if(-1==k.ins)s+=f=Math.min(h,k.len),h-=f,k.forward(f);else{if(!(0==k.ins&&k.len<h))break;h-=k.len,k.next()}jc(c,s,e<v.i?v.ins:0),l&&e<v.i&&Tc(l,c,v.text),e=v.i,v.forward(v.len-h)}}function Nc(t,n){var i,e,r,u,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=[],h=o?[]:null,f=new p(t),a=new p(n);for(i=!1;;){if(f.done&&a.done)return h?y.createSet(s,h):d.create(s);if(0==f.ins)jc(s,f.len,0,i),f.next();else if(0!=a.len||a.done){if(f.done||a.done)throw new Error("Mismatched change set lengths");e=Math.min(f.len2,a.len),r=s.length,-1==f.ins?(jc(s,e,u=-1==a.ins?-1:a.off?0:a.ins,i),h&&u&&Tc(h,s,a.text)):-1==a.ins?(jc(s,f.off?0:f.len,e,i),h&&Tc(h,s,f.textBit(e))):(jc(s,f.off?0:f.len,a.off?0:a.ins,i),h&&!a.off&&Tc(h,s,a.text)),i=(f.ins>e||a.ins>=0&&a.len>e)&&(i||s.length>r),f.forward2(e),a.forward(e)}else jc(s,0,a.ins,i),h&&Tc(h,s,a.text),a.next()}}function Pc(t,n){var i,e,r=ic(t.ranges);try{for(r.s();!(i=r.n()).done;)if((e=i.value).to>n)throw new RangeError("Selection points outside of document")}catch(t){r.e(t)}finally{r.f()}}function Fc(t,n){return t==n||t.length==n.length&&t.every((function(t,i){return t===n[i]}))}function Hc(t,n,i){if(t.length!=n.length)return!1;for(var e=0;e<t.length;e++)if(!i(t[e],n[e]))return!1;return!0}function zc(t,n){var i,e,r=!1,u=ic(n);try{for(u.s();!(i=u.n()).done;)1&$c(t,e=i.value)&&(r=!0)}catch(t){u.e(t)}finally{u.f()}return r}function Wc(t,n,i){var e=i.map((function(n){return t[n.id]})),r=i.map((function(t){return t.type})),u=e.filter((function(t){return!(1&t)})),o=t[n.id]>>1;function s(t){var i,u,o,s,h,f=[];for(i=0;i<e.length;i++)if(u=qc(t,e[i]),2==r[i]){o=ic(u);try{for(o.s();!(s=o.n()).done;)h=s.value,f.push(h)}catch(t){o.e(t)}finally{o.f()}}else f.push(u);return n.combine(f)}return{create:function t(n){var i,r,u=ic(e);try{for(u.s();!(i=u.n()).done;)$c(n,r=i.value)}catch(t){u.e(t)}finally{u.f()}return n.values[o]=s(n),1},update:function t(i,e){if(!zc(i,u))return 0;var r=s(i);return n.compare(r,i.values[o])?0:(i.values[o]=r,1)},reconfigure:function t(r,u){var h,f=zc(r,e),a=u.config.facets[n.id],c=u.facet(n);return a&&!f&&Fc(i,a)?(r.values[o]=c,0):(h=s(r),n.compare(h,c)?(r.values[o]=c,0):(r.values[o]=h,1))}}}function Vc(t){return function(n){return new I(n,t)}}function Uc(t,n,i){var e=[[],[],[],[],[]],r=new Map;function u(t,o){var s,h,f,a,c,l,v=r.get(t);if(null!=v){if(v<=o)return;(s=e[v].indexOf(t))>-1&&e[v].splice(s,1),t instanceof L&&i.delete(t.compartment)}if(r.set(t,o),Array.isArray(t)){h=ic(t);try{for(h.s();!(f=h.n()).done;)u(a=f.value,o)}catch(t){h.e(t)}finally{h.f()}}else if(t instanceof L){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");c=n.get(t.compartment)||t.inner,i.set(t.compartment,c),u(c,o)}else if(t instanceof I)u(t.inner,t.prec);else if(t instanceof x)e[o].push(t),t.provides&&u(t.provides,o);else if(t instanceof b)e[o].push(t),t.facet.extensions&&u(t.facet.extensions,O);else{if(!(l=t.extension))throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));u(l,o)}}return u(t,O),e.reduce((function(t,n){return t.concat(n)}))}function $c(t,n){var i,e,r;if(1&n)return 2;if(i=n>>1,4==(e=t.status[i]))throw new Error("Cyclic dependency between fields and/or facets");return 2&e?e:(t.status[i]=4,r=t.computeSlot(t,t.config.dynamicSlots[i]),t.status[i]=2|r)}function qc(t,n){return 1&n?t.config.staticValues[n>>1]:t.values[n>>1]}function Gc(t,n){var i,e,r,u,o=[];for(i=0,e=0;;){if(r=void 0,u=void 0,i<t.length&&(e==n.length||n[e]>=t[i]))r=t[i++],u=t[i++];else{if(!(e<n.length))return o;r=n[e++],u=n[e++]}!o.length||o[o.length-1]<r?o.push(r,u):o[o.length-1]<u&&(o[o.length-1]=u)}}function Jc(t,n,i){var e,r,u,o;return i?(r=n.changes,u=y.empty(n.changes.length),o=t.changes.compose(n.changes)):(r=n.changes.map(t.changes),u=t.changes.mapDesc(n.changes,!0),o=t.changes.compose(r)),{changes:o,selection:n.selection?n.selection.map(u):null===(e=t.selection)||void 0===e?void 0:e.map(r),effects:U.mapEffects(t.effects,r).concat(U.mapEffects(n.effects,u)),annotations:t.annotations.length?t.annotations.concat(n.annotations):n.annotations,scrollIntoView:t.scrollIntoView||n.scrollIntoView}}function Kc(t,n,i){var e=n.selection,r=Yc(n.annotations);return n.userEvent&&(r=r.concat($.userEvent.of(n.userEvent))),{changes:n.changes instanceof y?n.changes:y.of(n.changes||[],i,t.facet(_)),selection:e&&(e instanceof m?e:m.single(e.anchor,e.head)),effects:Yc(n.effects),annotations:r,scrollIntoView:!!n.scrollIntoView}}function Qc(t,n,i){var e,r,u,o=Kc(t,n.length?n[0]:{},t.doc.length);for(n.length&&!1===n[0].filter&&(i=!1),e=1;e<n.length;e++)!1===n[e].filter&&(i=!1),r=!!n[e].sequential,o=Jc(o,Kc(t,n[e],r?o.changes.newLength:t.doc.length),r);return u=$.create(t,o.changes,o.selection,o.effects,o.annotations,o.scrollIntoView),Zc(i?Xc(u):u)}function Xc(t){var n,i,e,r,u,o,s,h,f,a=t.startState,c=!0,l=ic(a.facet(N));try{for(l.s();!(n=l.n()).done;){if(!1===(e=(i=n.value)(t))){c=!1;break}Array.isArray(e)&&(c=!0===c?e:Gc(c,e))}}catch(t){l.e(t)}finally{l.f()}for(!0!==c&&(!1===c?(u=t.changes.invertedDesc,r=y.empty(a.doc.length)):(r=(o=t.changes.filter(c)).changes,u=o.filtered.mapDesc(o.changes).invertedDesc),t=$.create(a,r,t.selection&&t.selection.map(u),U.mapEffects(t.effects,u),t.annotations,t.scrollIntoView)),h=(s=a.facet(P)).length-1;h>=0;h--)t=(f=s[h](t))instanceof $?f:Array.isArray(f)&&1==f.length&&f[0]instanceof $?f[0]:Qc(a,Yc(f),!1);return t}function Zc(t){var n,i,e=t.startState,r=e.facet(F),u=t;for(n=r.length-1;n>=0;n--)(i=r[n](t))&&Object.keys(i).length&&(u=Jc(u,Kc(e,i,t.changes.newLength),!0));return u==t?t:$.create(e,t.changes,t.selection,u.effects,u.annotations,u.scrollIntoView)}function Yc(t){return null==t?q:Array.isArray(t)?t:[t]}c=8205,l=/\r\n?|\n/,v=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(v||(v={})),d=function(){function t(n){yc(this,t),this.sections=n}return kc(t,[{key:"length",get:function t(){var n,i=0;for(n=0;n<this.sections.length;n+=2)i+=this.sections[n];return i}},{key:"newLength",get:function t(){var n,i,e=0;for(n=0;n<this.sections.length;n+=2)e+=(i=this.sections[n+1])<0?this.sections[n]:i;return e}},{key:"empty",get:function t(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function t(n){var i,e,r,u,o;for(i=0,e=0,r=0;i<this.sections.length;)u=this.sections[i++],(o=this.sections[i++])<0?(n(e,r,u),r+=u):r+=o,e+=u}},{key:"iterChangedRanges",value:function t(n){var i;Bc(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function n(){var i,e,r,u=[];for(i=0;i<this.sections.length;)e=this.sections[i++],(r=this.sections[i++])<0?u.push(e,r):u.push(r,e);return new t(u)}},{key:"composeDesc",value:function t(n){return this.empty?n:n.empty?this:Nc(this,n)}},{key:"mapDesc",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.empty?this:_c(this,n,i)}},{key:"mapPos",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v.Simple,h=0,f=0;for(i=0;i<this.sections.length;){if(u=h+(e=this.sections[i++]),(r=this.sections[i++])<0){if(u>n)return f+(n-h);f+=e}else{if(s!=v.Simple&&u>=n&&(s==v.TrackDel&&h<n&&u>n||s==v.TrackBefore&&h<n||s==v.TrackAfter&&u>n))return null;if(u>n||u==n&&o<0&&!e)return n==h||o<0?f:f+r;f+=r}h=u}if(n>h)throw new RangeError("Position ".concat(n," is out of range for changeset of length ").concat(h));return f}},{key:"touchesRange",value:function t(n){var i,e,r,u,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;for(i=0,e=0;i<this.sections.length&&e<=s;){if(o=e+(r=this.sections[i++]),(u=this.sections[i++])>=0&&e<=s&&o>=n)return!(e<n&&o>s)||"cover";e=o}return!1}},{key:"toString",value:function t(){var n,i,e,r="";for(n=0;n<this.sections.length;)r+=(r?" ":"")+(i=this.sections[n++])+((e=this.sections[n++])>=0?":"+e:"");return r}},{key:"toJSON",value:function t(){return this.sections}}],[{key:"fromJSON",value:function n(i){if(!Array.isArray(i)||i.length%2||i.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(i)}},{key:"create",value:function n(i){return new t(i)}}]),t}(),y=function(t){sc(e,t);var n=fc(e);function e(t,i){var r;return yc(this,e),(r=n.call(this,t)).inserted=i,r}return kc(e,[{key:"apply",value:function t(n){if(this.length!=n.length)throw new RangeError("Applying change set to a document with the wrong length");return Bc(this,(function(t,i,e,r,u){return n=n.replace(e,e+(i-t),u)}),!1),n}},{key:"mapDesc",value:function t(n){var i;return _c(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function t(n){var r,u,o,s,h,f=this.sections.slice(),a=[];for(r=0,u=0;r<f.length;r+=2){if(o=f[r],(s=f[r+1])>=0){for(f[r]=s,f[r+1]=o,h=r>>1;a.length<h;)a.push(i.empty);a.push(o?n.slice(u,u+o):i.empty)}u+=o}return new e(f,a)}},{key:"compose",value:function t(n){return this.empty?n:n.empty?this:Nc(this,n,!0)}},{key:"map",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.empty?this:_c(this,n,i,!0)}},{key:"iterChanges",value:function t(n){var i;Bc(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function t(){return d.create(this.sections)}},{key:"filter",value:function t(n){var i,r,u,o,s,h,f,a=[],c=[],l=[],v=new p(this);t:for(i=0,r=0;;){for(u=i==n.length?1e9:n[i++];r<u||r==u&&0==v.len;){if(v.done)break t;jc(l,o=Math.min(v.len,u-r),-1),jc(a,o,s=-1==v.ins?-1:0==v.off?v.ins:0),s>0&&Tc(c,a,v.text),v.forward(o),r+=o}for(h=n[i++];r<h;){if(v.done)break t;jc(a,f=Math.min(v.len,h-r),-1),jc(l,f,-1==v.ins?-1:0==v.off?v.ins:0),v.forward(f),r+=f}}return{changes:new e(a,c),filtered:d.create(l)}}},{key:"toJSON",value:function t(){var n,i,e,r=[];for(n=0;n<this.sections.length;n+=2)i=this.sections[n],(e=this.sections[n+1])<0?r.push(i):0==e?r.push([i]):r.push([i].concat(this.inserted[n>>1].toJSON()));return r}}],[{key:"of",value:function t(n,r,u){var o=[],s=[],h=0,f=null;function a(){var t,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(n||o.length)&&(h<r&&jc(o,r-h,-1),t=new e(o,s),f=f?f.compose(t.map(f)):t,o=[],s=[],h=0)}function c(t){var n,v,d,y,p,k,m,g,w;if(Array.isArray(t)){n=ic(t);try{for(n.s();!(v=n.n()).done;)c(d=v.value)}catch(t){n.e(t)}finally{n.f()}}else if(t instanceof e){if(t.length!=r)throw new RangeError("Mismatched change set length (got ".concat(t.length,", expected ").concat(r,")"));a(),f=f?f.compose(t.map(f)):t}else{if(y=t.from,k=void 0===(p=t.to)?y:p,m=t.insert,y>k||y<0||k>r)throw new RangeError("Invalid change range ".concat(y," to ").concat(k," (in doc of length ").concat(r,")"));if(w=(g=m?"string"==typeof m?i.of(m.split(u||l)):m:i.empty).length,y==k&&0==w)return;y<h&&a(),y>h&&jc(o,y-h,-1),jc(o,k-y,w),Tc(s,o,g),h=k}}return c(n),a(!f),f}},{key:"empty",value:function t(n){return new e(n?[n,-1]:[],[])}},{key:"fromJSON",value:function t(n){var r,u,o,s;if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");for(r=[],u=[],o=0;o<n.length;o++)if("number"==typeof(s=n[o]))r.push(s,-1);else{if(!Array.isArray(s)||"number"!=typeof s[0]||s.some((function(t,n){return n&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)r.push(s[0],0);else{for(;u.length<o;)u.push(i.empty);u[o]=i.of(s.slice(1)),r.push(s[0],u[o].length)}}return new e(r,u)}},{key:"createSet",value:function t(n,i){return new e(n,i)}}]),e}(d),p=function(){function t(n){yc(this,t),this.set=n,this.i=0,this.next()}return kc(t,[{key:"next",value:function t(){var n=this.set.sections;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}},{key:"done",get:function t(){return-2==this.ins}},{key:"len2",get:function t(){return this.ins<0?this.len:this.ins}},{key:"text",get:function t(){var n=this.set.inserted,e=this.i-2>>1;return e>=n.length?i.empty:n[e]}},{key:"textBit",value:function t(n){var e=this.set.inserted,r=this.i-2>>1;return r>=e.length&&!n?i.empty:e[r].slice(this.off,null==n?void 0:this.off+n)}},{key:"forward",value:function t(n){n==this.len?this.next():(this.len-=n,this.off+=n)}},{key:"forward2",value:function t(n){-1==this.ins?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}]),t}(),k=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.flags=e}return kc(t,[{key:"anchor",get:function t(){return 16&this.flags?this.to:this.from}},{key:"head",get:function t(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function t(){return this.from==this.to}},{key:"assoc",get:function t(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function t(){var n=3&this.flags;return 3==n?null:n}},{key:"goalColumn",get:function t(){var n=this.flags>>5;return 33554431==n?void 0:n}},{key:"map",value:function n(i){var e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?e=r=i.mapPos(this.from,u):(e=i.mapPos(this.from,1),r=i.mapPos(this.to,-1)),e==this.from&&r==this.to?this:new t(e,r,this.flags)}},{key:"extend",value:function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return n<=this.anchor&&e>=this.anchor?m.range(n,e):(i=Math.abs(n-this.anchor)>Math.abs(e-this.anchor)?n:e,m.range(this.anchor,i))}},{key:"eq",value:function t(n){return this.anchor==n.anchor&&this.head==n.head}},{key:"toJSON",value:function t(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function t(n){if(!n||"number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid JSON representation for SelectionRange");return m.range(n.anchor,n.head)}},{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),m=function(){function t(n,i){yc(this,t),this.ranges=n,this.mainIndex=i}return kc(t,[{key:"map",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return i.empty?this:t.create(this.ranges.map((function(t){return t.map(i,e)})),this.mainIndex)}},{key:"eq",value:function t(n){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(var i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i]))return!1;return!0}},{key:"main",get:function t(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function n(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function n(i){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([i].concat(this.ranges),e?0:this.mainIndex+1)}},{key:"replaceRange",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,r=this.ranges.slice();return r[e]=i,t.create(r,this.mainIndex)}},{key:"toJSON",value:function t(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function n(i){if(!i||!Array.isArray(i.ranges)||"number"!=typeof i.main||i.main>=i.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(i.ranges.map((function(t){return k.fromJSON(t)})),i.main)}},{key:"single",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;return new t([t.range(i,e)],0)}},{key:"create",value:function n(i){var e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==i.length)throw new RangeError("A selection needs at least one range");for(e=0,r=0;r<i.length;r++){if((u=i[r]).empty?u.from<=e:u.from<e)return t.normalized(i.slice(),o);e=u.to}return new t(i,o)}},{key:"cursor",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return k.create(n,n,(0==i?0:i<0?4:8)|(null==e?3:Math.min(2,e))|(null!=r?r:33554431)<<5)}},{key:"range",value:function t(n,i,e,r){var u=(null!=e?e:33554431)<<5|(null==r?3:Math.min(2,r));return i<n?k.create(i,n,24|u):k.create(n,i,(i>n?4:0)|u)}},{key:"normalized",value:function n(i){var e,r,u,o,s,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,f=i[h];for(i.sort((function(t,n){return t.from-n.from})),h=i.indexOf(f),e=1;e<i.length;e++)r=i[e],u=i[e-1],(r.empty?r.from<=u.to:r.from<u.to)&&(o=u.from,s=Math.max(r.to,u.to),e<=h&&h--,i.splice(--e,2,r.anchor>r.head?t.range(s,o):t.range(o,s)));return new t(i,h)}}]),t}(),g=0,w=function(){function t(n,i,e,r,u){yc(this,t),this.combine=n,this.compareInput=i,this.compare=e,this.isStatic=r,this.id=g++,this.default=n([]),this.extensions="function"==typeof u?u(this):u}return kc(t,[{key:"of",value:function t(n){return new b([],this,0,n)}},{key:"compute",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new b(n,this,1,i)}},{key:"computeN",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new b(n,this,2,i)}},{key:"from",value:function t(n,i){return i||(i=function t(n){return n}),this.compute([n],(function(t){return i(t.field(n))}))}}],[{key:"define",value:function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(i.combine||function(t){return t},i.compareInput||function(t,n){return t===n},i.compare||(i.combine?function(t,n){return t===n}:Fc),!!i.static,i.enables)}}]),t}(),b=function(){function t(n,i,e,r){yc(this,t),this.dependencies=n,this.facet=i,this.type=e,this.value=r,this.id=g++}return kc(t,[{key:"dynamicSlot",value:function t(n){var i,e,r,u=this,o=this.value,s=this.facet.compareInput,h=this.id,f=n[h]>>1,a=2==this.type,c=!1,l=!1,v=[],d=ic(this.dependencies);try{for(d.s();!(e=d.n()).done;)"doc"==(r=e.value)?c=!0:"selection"==r?l=!0:1&(null!==(i=n[r.id])&&void 0!==i?i:1)||v.push(n[r.id])}catch(t){d.e(t)}finally{d.f()}return{create:function t(n){return n.values[f]=o(n),1},update:function t(n,i){if(c&&i.docChanged||l&&(i.docChanged||i.selection)||zc(n,v)){var e=o(n);if(a?!Hc(e,n.values[f],s):!s(e,n.values[f]))return n.values[f]=e,1}return 0},reconfigure:function t(n,i){var e,r,c=i.config.address[h];if(null!=c){if(r=qc(i,c),u.dependencies.every((function(t){return t instanceof w?i.facet(t)===n.facet(t):!(t instanceof x)||i.field(t,!1)==n.field(t,!1)}))||(a?Hc(e=o(n),r,s):s(e=o(n),r)))return n.values[f]=r,0}else e=o(n);return n.values[f]=e,1}}}}]),t}(),M=w.define({static:!0}),x=function(){function t(n,i,e,r,u){yc(this,t),this.id=n,this.createF=i,this.updateF=e,this.compareF=r,this.spec=u,this.provides=void 0}return kc(t,[{key:"create",value:function t(n){var i=this,e=n.facet(M).find((function(t){return t.field==i}));return((null==e?void 0:e.create)||this.createF)(n)}},{key:"slot",value:function t(n){var i=this,e=n[this.id]>>1;return{create:function t(n){return n.values[e]=i.create(n),1},update:function t(n,r){var u=n.values[e],o=i.updateF(u,r);return i.compareF(u,o)?0:(n.values[e]=o,1)},reconfigure:function t(n,r){return null!=r.config.address[i.id]?(n.values[e]=r.field(i),0):(n.values[e]=i.create(n),1)}}}},{key:"init",value:function t(n){return[this,M.of({field:this,create:n})]}},{key:"extension",get:function t(){return this}}],[{key:"define",value:function n(i){var e=new t(g++,i.create,i.update,i.compare||function(t,n){return t===n},i);return i.provide&&(e.provides=i.provide(e)),e}}]),t}(),S=4,C=3,O=2,A=1,E={highest:Vc(D=0),high:Vc(A),default:Vc(O),low:Vc(C),lowest:Vc(S)},I=kc((function t(n,i){yc(this,t),this.inner=n,this.prec=i})),R=function(){function t(){yc(this,t)}return kc(t,[{key:"of",value:function t(n){return new L(this,n)}},{key:"reconfigure",value:function n(i){return t.reconfigure.of({compartment:this,extension:i})}},{key:"get",value:function t(n){return n.config.compartments.get(this)}}]),t}(),L=kc((function t(n,i){yc(this,t),this.compartment=n,this.inner=i})),j=function(){function t(n,i,e,r,u,o){for(yc(this,t),this.base=n,this.compartments=i,this.dynamicSlots=e,this.address=r,this.staticValues=u,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<e.length;)this.statusTemplate.push(0)}return kc(t,[{key:"staticFacet",value:function t(n){var i=this.address[n.id];return null==i?n.default:this.staticValues[i>>1]}}],[{key:"resolve",value:function n(i,e,r){var u,o,s,h,f,a,c,l,v,d,y,p,k=[],m=Object.create(null),g=new Map,w=ic(Uc(i,e,g));try{for(w.s();!(u=w.n()).done;)(o=u.value)instanceof x?k.push(o):(m[o.facet.id]||(m[o.facet.id]=[])).push(o)}catch(t){w.e(t)}finally{w.f()}for(s=Object.create(null),h=[],f=[],a=function t(){var n=l[c];s[n.id]=f.length<<1,f.push((function(t){return n.slot(t)}))},c=0,l=k;c<l.length;c++)a();for(y in v=null==r?void 0:r.config.facets,d=function t(){var n,i,e,u,o=m[y],a=o[0].facet,c=v&&v[y]||[];if(o.every((function(t){return 0==t.type})))s[a.id]=h.length<<1|1,Fc(c,o)?h.push(r.facet(a)):(n=a.combine(o.map((function(t){return t.value}))),h.push(r&&a.compare(n,r.facet(a))?r.facet(a):n));else{i=ic(o);try{for(u=function t(){var n=e.value;0==n.type?(s[n.id]=h.length<<1|1,h.push(n.value)):(s[n.id]=f.length<<1,f.push((function(t){return n.dynamicSlot(t)})))},i.s();!(e=i.n()).done;)u()}catch(t){i.e(t)}finally{i.f()}s[a.id]=f.length<<1,f.push((function(t){return Wc(t,a,o)}))}},m)d();return new t(i,g,p=f.map((function(t){return t(s)})),s,h,m)}}]),t}(),T=w.define(),B=w.define({combine:function t(n){return n.some((function(t){return t}))},static:!0}),_=w.define({combine:function t(n){return n.length?n[0]:void 0},static:!0}),N=w.define(),P=w.define(),F=w.define(),H=w.define({combine:function t(n){return!!n.length&&n[0]}}),z=function(){function t(n,i){yc(this,t),this.type=n,this.value=i}return kc(t,null,[{key:"define",value:function t(){return new W}}]),t}(),W=function(){function t(){yc(this,t)}return kc(t,[{key:"of",value:function t(n){return new z(this,n)}}]),t}(),V=function(){function t(n){yc(this,t),this.map=n}return kc(t,[{key:"of",value:function t(n){return new U(this,n)}}]),t}(),U=function(){function t(n,i){yc(this,t),this.type=n,this.value=i}return kc(t,[{key:"map",value:function n(i){var e=this.type.map(this.value,i);return void 0===e?void 0:e==this.value?this:new t(this.type,e)}},{key:"is",value:function t(n){return this.type==n}}],[{key:"define",value:function t(){var n;return new V((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function t(n,i){var e,r,u,o,s;if(!n.length)return n;e=[],r=ic(n);try{for(r.s();!(u=r.n()).done;)(s=(o=u.value).map(i))&&e.push(s)}catch(t){r.e(t)}finally{r.f()}return e}}]),t}(),U.reconfigure=U.define(),U.appendConfig=U.define(),$=function(){function t(n,i,e,r,u,o){yc(this,t),this.startState=n,this.changes=i,this.selection=e,this.effects=r,this.annotations=u,this.scrollIntoView=o,this.Qae=null,this.Kh=null,e&&Pc(e,i.newLength),u.some((function(n){return n.type==t.time}))||(this.annotations=u.concat(t.time.of(Date.now())))}return kc(t,[{key:"newDoc",get:function t(){return this.Qae||(this.Qae=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function t(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function t(){return this.Kh||this.startState.applyTransaction(this),this.Kh}},{key:"annotation",value:function t(n){var i,e,r=ic(this.annotations);try{for(r.s();!(i=r.n()).done;)if((e=i.value).type==n)return e.value}catch(t){r.e(t)}finally{r.f()}}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"reconfigured",get:function t(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function n(i){var e=this.annotation(t.userEvent);return!(!e||!(e==i||e.length>i.length&&e.slice(0,i.length)==i&&"."==e[i.length]))}}],[{key:"create",value:function n(i,e,r,u,o,s){return new t(i,e,r,u,o,s)}}]),t}(),$.time=z.define(),$.userEvent=z.define(),$.addToHistory=z.define(),$.remote=z.define(),q=[],G=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(G||(G={})),J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{K=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function tl(t){var n,i;if(K)return K.test(t);for(n=0;n<t.length;n++)if(i=t[n],/\w/.test(i)||i>"\x80"&&(i.toUpperCase()!=i.toLowerCase()||J.test(i)))return!0;return!1}function nl(t){return function(n){if(!/\S/.test(n))return G.Space;if(tl(n))return G.Word;for(var i=0;i<t.length;i++)if(n.indexOf(t[i])>-1)return G.Word;return G.Other}}function il(t,n){var i,e,r,u,o,s,h,f,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c={},l=ic(t);try{for(l.s();!(i=l.n()).done;)for(e=i.value,r=0,u=Object.keys(e);r<u.length;r++)if(s=e[o=u[r]],void 0===(h=c[o]))c[o]=s;else if(h===s||void 0===s);else{if(!Object.hasOwnProperty.call(a,o))throw new Error("Config merge conflict for field "+o);c[o]=a[o](h,s)}}catch(t){l.e(t)}finally{l.f()}for(f in n)void 0===c[f]&&(c[f]=n[f]);return c}function el(t,n){return t.from-n.from||t.value.startSide-n.value.startSide}function rl(t){var n,i,e;if(t.length>1)for(n=t[0],i=1;i<t.length;i++){if(el(n,e=t[i])>0)return t.slice().sort(el);n=e}return t}function ul(t,n,i){var e,r,u,o,s,h,f,a,c,l=new Map,v=ic(t);try{for(v.s();!(e=v.n()).done;)for(r=e.value,u=0;u<r.chunk.length;u++)r.chunk[u].maxPoint<=0&&l.set(r.chunk[u],r.chunkPos[u])}catch(t){v.e(t)}finally{v.f()}o=new Set,s=ic(n);try{for(s.s();!(h=s.n()).done;)for(f=h.value,a=0;a<f.chunk.length;a++)null==(c=l.get(f.chunk[a]))||(i?i.mapPos(c):c)!=f.chunkPos[a]||(null==i?void 0:i.touchesRange(c,c+f.chunk[a].length))||o.add(f.chunk[a])}catch(t){s.e(t)}finally{s.f()}return o}function ol(t,n){var i,e,r;for(i=t[n];!((e=1+(n<<1))>=t.length)&&(r=t[e],e+1<t.length&&r.compare(t[e+1])>=0&&(r=t[e+1],e++),!(i.compare(r)<0));)t[e]=i,t[n]=r,n=e}function sl(t,n,i,e,r,u){var o,s,h,f,a,c;for(t.goto(n),i.goto(e),o=e+r,s=e,h=e-n;a=(f=t.to+h-i.to||t.endSide-i.endSide)<0?t.to+h:i.to,c=Math.min(a,o),t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&hl(t.activeForPoint(t.to),i.activeForPoint(i.to))||u.comparePoint(s,c,t.point,i.point):c>s&&!hl(t.active,i.active)&&u.compareRange(s,c,t.active,i.active),!(a>o);)s=a,f<=0&&t.next(),f>=0&&i.next()}function hl(t,n){if(t.length!=n.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!=n[i]&&!t[i].eq(n[i]))return!1;return!0}function fl(t,n){for(var i=n,e=t.length-1;i<e;i++)t[i]=t[i+1];t.pop()}function al(t,n,i){for(var e=t.length-1;e>=n;e--)t[e+1]=t[e];t[n]=i}function cl(t,n){var i,e=-1,r=1e9;for(i=0;i<n.length;i++)(n[i]-r||t[i].endSide-t[e].endSide)<0&&(e=i,r=n[i]);return e}function ll(t,n){var i,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=0;for(i=0;i<e;)9==t.charCodeAt(i)?(r+=n-r%n,i++):(r++,i=Cc(t,i));return r}function vl(t,n,i,e){for(var r=0,u=0;;){if(u>=n)return r;if(r==t.length)break;u+=9==t.charCodeAt(r)?i-u%i:1,r=Cc(t,r)}return!0===e?-1:t.length}for(Q=function(){function t(n,i,e,r,u,o){yc(this,t),this.config=n,this.doc=i,this.selection=e,this.values=r,this.status=n.statusTemplate.slice(),this.computeSlot=u,o&&(o.Kh=this);for(var s=0;s<this.config.dynamicSlots.length;s++)$c(this,s<<1);this.computeSlot=null}return kc(t,[{key:"field",value:function t(n){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=this.config.address[n.id];if(null!=e)return $c(this,e),qc(this,e);if(i)throw new RangeError("Field is not present in this state")}},{key:"update",value:function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];return Qc(this,i,!0)}},{key:"applyTransaction",value:function n(i){var e,r,u,o,s=this,h=this.config,f=h,a=f.base,c=f.compartments,l=ic(i.effects);try{for(l.s();!(e=l.n()).done;)(r=e.value).is(R.reconfigure)?(h&&(c=new Map,h.compartments.forEach((function(t,n){return c.set(n,t)})),h=null),c.set(r.value.compartment,r.value.extension)):r.is(U.reconfigure)?(h=null,a=r.value):r.is(U.appendConfig)&&(h=null,a=Yc(a).concat(r.value))}catch(t){l.e(t)}finally{l.f()}u=h?i.startState.values.slice():(o=new t(h=j.resolve(a,c,this),this.doc,this.selection,h.dynamicSlots.map((function(){return null})),(function(t,n){return n.reconfigure(t,s)}),null)).values,new t(h,i.newDoc,i.newSelection,u,(function(t,n){return n.update(t,i)}),i)}},{key:"replaceSelection",value:function t(n){return"string"==typeof n&&(n=this.toText(n)),this.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:n},range:m.cursor(t.from+n.length)}}))}},{key:"changeByRange",value:function t(n){var i,e,r,u,o,s,h=this.selection,f=n(h.ranges[0]),a=this.changes(f.changes),c=[f.range],l=Yc(f.effects);for(i=1;i<h.ranges.length;i++){for(e=n(h.ranges[i]),u=(r=this.changes(e.changes)).map(a),o=0;o<i;o++)c[o]=c[o].map(u);s=a.mapDesc(r,!0),c.push(e.range.map(s)),a=a.compose(u),l=U.mapEffects(l,u).concat(U.mapEffects(Yc(e.effects),s))}return{changes:a,selection:m.create(c,h.mainIndex),effects:l}}},{key:"changes",value:function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return i instanceof y?i:y.of(i,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function n(e){return i.of(e.split(this.facet(t.lineSeparator)||l))}},{key:"sliceDoc",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(n,i,this.lineBreak)}},{key:"facet",value:function t(n){var i=this.config.address[n.id];return null==i?n.default:($c(this,i),qc(this,i))}},{key:"toJSON",value:function t(n){var i,e,r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(i in n)(e=n[i])instanceof x&&null!=this.config.address[e.id]&&(r[i]=e.spec.toJSON(this.field(n[i]),this));return r}},{key:"tabSize",get:function n(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function n(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function t(){return this.facet(H)}},{key:"phrase",value:function n(i){var e,r,u,o,s,h;for(e=arguments.length,r=new Array(e>1?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];o=ic(this.facet(t.phrases));try{for(o.s();!(s=o.n()).done;)if(h=s.value,Object.prototype.hasOwnProperty.call(h,i)){i=h[i];break}}catch(t){o.e(t)}finally{o.f()}return r.length&&(i=i.replace(/\$(\$|\d*)/g,(function(t,n){if("$"==n)return"$";var i=+(n||1);return!i||i>r.length?t:r[i-1]}))),i}},{key:"languageDataAt",value:function t(n,i){var e,r,u,o,s,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,f=[],a=ic(this.facet(T));try{for(a.s();!(e=a.n()).done;){u=ic((r=e.value)(this,i,h));try{for(u.s();!(o=u.n()).done;)s=o.value,Object.prototype.hasOwnProperty.call(s,n)&&f.push(s[n])}catch(t){u.e(t)}finally{u.f()}}}catch(t){a.e(t)}finally{a.f()}return f}},{key:"charCategorizer",value:function t(n){return nl(this.languageDataAt("wordChars",n).join(""))}},{key:"wordAt",value:function t(n){for(var i,e,r=this.doc.lineAt(n),u=r.text,o=r.from,s=r.length,h=this.charCategorizer(n),f=n-o,a=n-o;f>0&&(i=Cc(u,f,!1),h(u.slice(i,f))==G.Word);)f=i;for(;a<s&&(e=Cc(u,a),h(u.slice(a,e))==G.Word);)a=e;return f==a?null:m.range(f+o,a+o)}}],[{key:"fromJSON",value:function n(i){var e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(!i||"string"!=typeof i.doc)throw new RangeError("Invalid JSON representation for EditorState");if(e=[],s)for(u in r=function t(){if(Object.prototype.hasOwnProperty.call(i,u)){var n=s[u],r=i[u];e.push(n.init((function(t){return n.spec.fromJSON(r,t)})))}},s)r();return t.create({doc:i.doc,selection:m.fromJSON(i.selection),extensions:o.extensions?e.concat([o.extensions]):e})}},{key:"create",value:function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=j.resolve(e.extensions||[],new Map),u=e.doc instanceof i?e.doc:i.of((e.doc||"").split(r.staticFacet(t.lineSeparator)||l)),o=e.selection?e.selection instanceof m?e.selection:m.single(e.selection.anchor,e.selection.head):m.single(0);return Pc(o,u.length),r.staticFacet(B)||(o=o.asSingle()),new t(r,u,o,r.dynamicSlots.map((function(){return null})),(function(t,n){return n.create(t)}),null)}}]),t}(),Q.allowMultipleSelections=B,Q.tabSize=w.define({combine:function t(n){return n.length?n[0]:4}}),Q.lineSeparator=_,Q.readOnly=H,Q.phrases=w.define({compare:function t(n,i){var e=Object.keys(n),r=Object.keys(i);return e.length==r.length&&e.every((function(t){return n[t]==i[t]}))}}),Q.languageData=T,Q.changeFilter=N,Q.transactionFilter=P,Q.transactionExtender=F,R.reconfigure=U.define(),X=function(){function t(){yc(this,t)}return kc(t,[{key:"eq",value:function t(n){return this==n}},{key:"range",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return Z.create(n,i,this)}}]),t}(),X.prototype.startSide=X.prototype.endSide=0,X.prototype.point=!1,X.prototype.mapMode=v.TrackDel,Z=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.value=e}return kc(t,null,[{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),Y=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.value=e,this.maxPoint=r}return kc(t,[{key:"length",get:function t(){return this.to[this.to.length-1]}},{key:"findIndex",value:function t(n,i,e){var r,u,o,s,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,f=e?this.to:this.from;for(r=h,u=f.length;;){if(r==u)return r;if(s=f[o=r+u>>1]-n||(e?this.value[o].endSide:this.value[o].startSide)-i,o==r)return s>=0?r:u;s>=0?u=o:r=o+1}}},{key:"between",value:function t(n,i,e,r){for(var u=this.findIndex(i,-1e9,!0),o=this.findIndex(e,1e9,!1,u);u<o;u++)if(!1===r(this.from[u]+n,this.to[u]+n,this.value[u]))return!1}},{key:"map",value:function n(i,e){var r,u,o,s,h,f,a,c=[],l=[],v=[],d=-1,y=-1;for(r=0;r<this.value.length;r++){if(u=this.value[r],h=void 0,f=void 0,(o=this.from[r]+i)==(s=this.to[r]+i)){if(null==(a=e.mapPos(o,u.startSide,u.mapMode)))continue;if(h=f=a,u.startSide!=u.endSide&&(f=e.mapPos(o,u.endSide))<h)continue}else if((h=e.mapPos(o,u.startSide))>(f=e.mapPos(s,u.endSide))||h==f&&u.startSide>0&&u.endSide<=0)continue;(f-h||u.endSide-u.startSide)<0||(d<0&&(d=h),u.point&&(y=Math.max(y,f-h)),c.push(u),l.push(h-d),v.push(f-d))}return{mapped:c.length?new t(l,v,c,y):null,pos:d}}}]),t}(),tt=function(){function t(n,i,e,r){yc(this,t),this.chunkPos=n,this.chunk=i,this.nextLayer=e,this.maxPoint=r}return kc(t,[{key:"length",get:function t(){var n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}},{key:"size",get:function t(){var n,i,e,r;if(this.isEmpty)return 0;n=this.nextLayer.size,i=ic(this.chunk);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).value.length}catch(t){i.e(t)}finally{i.f()}return n}},{key:"chunkEnd",value:function t(n){return this.chunkPos[n]+this.chunk[n].length}},{key:"update",value:function n(i){var e,r,u,o,s,h=i.add,f=void 0===h?[]:h,a=i.sort,c=void 0!==a&&a,l=i.filterFrom,v=void 0===l?0:l,d=i.filterTo,y=void 0===d?this.length:d,p=i.filter;if(0==f.length&&!p)return this;if(c&&(f=f.slice().sort(el)),this.isEmpty)return f.length?t.of(f):this;for(e=new it(this,null,-1).goto(0),r=0,u=[],o=new nt;e.value||r<f.length;)r<f.length&&(e.from-f[r].from||e.startSide-f[r].value.startSide)>=0?(s=f[r++],o.addInner(s.from,s.to,s.value)||u.push(s)):1==e.rangeIndex&&e.chunkIndex<this.chunk.length&&(r==f.length||this.chunkEnd(e.chunkIndex)<f[r].from)&&(!p||v>this.chunkEnd(e.chunkIndex)||y<this.chunkPos[e.chunkIndex])&&o.addChunk(this.chunkPos[e.chunkIndex],this.chunk[e.chunkIndex])?e.nextChunk():((!p||v>e.to||y<e.from||p(e.from,e.to,e.value))&&(o.addInner(e.from,e.to,e.value)||u.push(Z.create(e.from,e.to,e.value))),e.next());return o.finishInner(this.nextLayer.isEmpty&&!u.length?t.empty:this.nextLayer.update({add:u,filter:p,filterFrom:v,filterTo:y}))}},{key:"map",value:function n(i){var e,r,u,o,s,h,f,a,c,l,v;if(i.empty||this.isEmpty)return this;for(e=[],r=[],u=-1,o=0;o<this.chunk.length;o++)s=this.chunkPos[o],h=this.chunk[o],!1===(f=i.touchesRange(s,s+h.length))?(u=Math.max(u,h.maxPoint),e.push(h),r.push(i.mapPos(s))):!0===f&&(c=(a=h.map(s,i)).mapped,l=a.pos,c&&(u=Math.max(u,c.maxPoint),e.push(c),r.push(l)));return v=this.nextLayer.map(i),0==e.length?v:new t(r,e,v||t.empty,u)}},{key:"between",value:function t(n,i,e){var r,u,o;if(!this.isEmpty){for(r=0;r<this.chunk.length;r++)if(u=this.chunkPos[r],o=this.chunk[r],i>=u&&n<=u+o.length&&!1===o.between(u,n-u,i-u,e))return;this.nextLayer.between(n,i,e)}}},{key:"iter",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return et.from([this]).goto(n)}},{key:"isEmpty",get:function t(){return this.nextLayer==this}}],[{key:"create",value:function n(i,e,r,u){return new t(i,e,r,u)}},{key:"iter",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return et.from(n).goto(i)}},{key:"compare",value:function t(n,i,e,r){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=n.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=u})),s=i.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=u})),h=ul(o,s,e),f=new rt(o,h,u),a=new rt(s,h,u);e.iterGaps((function(t,n,i){return sl(f,t,a,n,i,r)})),e.empty&&0==e.length&&sl(f,0,a,0,0,r)}},{key:"eq",value:function t(n,i){var e,r,u,o,s,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,f=arguments.length>3?arguments[3]:void 0;if(null==f&&(f=999999999),e=n.filter((function(t){return!t.isEmpty&&i.indexOf(t)<0})),r=i.filter((function(t){return!t.isEmpty&&n.indexOf(t)<0})),e.length!=r.length)return!1;if(!e.length)return!0;for(u=ul(e,r),o=new rt(e,u,0).goto(h),s=new rt(r,u,0).goto(h);;){if(o.to!=s.to||!hl(o.active,s.active)||o.point&&(!s.point||!o.point.eq(s.point)))return!1;if(o.to>f)return!0;o.next(),s.next()}}},{key:"spans",value:function t(n,i,e,r){for(var u,o,s,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,f=new rt(n,null,h).goto(i),a=i,c=f.openStart;;){if(u=Math.min(f.to,e),f.point?(o=f.activeForPoint(f.to),s=f.pointFrom<i?o.length+1:Math.min(o.length,c),r.point(a,u,f.point,o,s,f.pointRank),c=Math.min(f.openEnd(u),o.length)):u>a&&(r.span(a,u,f.active,c),c=f.openEnd(u)),f.to>e)return c+(f.point&&f.to>e?1:0);a=f.to,f.next()}}},{key:"of",value:function t(n){var i,e,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],u=new nt,o=ic(n instanceof Z?[n]:r?rl(n):n);try{for(o.s();!(i=o.n()).done;)e=i.value,u.add(e.from,e.to,e.value)}catch(t){o.e(t)}finally{o.f()}return u.finish()}}]),t}(),tt.empty=new tt([],[],null,-1),tt.empty.nextLayer=tt.empty,nt=function(){function t(){yc(this,t),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}return kc(t,[{key:"finishChunk",value:function t(n){this.chunks.push(new Y(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,n&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function n(i,e,r){this.addInner(i,e,r)||(this.nextLayer||(this.nextLayer=new t)).add(i,e,r)}},{key:"addInner",value:function t(n,i,e){var r=n-this.lastTo||e.startSide-this.last.endSide;if(r<=0&&(n-this.lastFrom||e.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(i-this.chunkStart),this.last=e,this.lastFrom=n,this.lastTo=i,this.value.push(e),e.point&&(this.maxPoint=Math.max(this.maxPoint,i-n)),!0)}},{key:"addChunk",value:function t(n,i){if((n-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(n);var e=i.value.length-1;return this.last=i.value[e],this.lastFrom=i.from[e]+n,this.lastTo=i.to[e]+n,!0}},{key:"finish",value:function t(){return this.finishInner(tt.empty)}},{key:"finishInner",value:function t(n){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return n;var i=tt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint);return this.from=null,i}}]),t}(),it=function(){function t(n,i,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;yc(this,t),this.layer=n,this.skip=i,this.minPoint=e,this.rank=r}return kc(t,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"endSide",get:function t(){return this.value?this.value.endSide:0}},{key:"goto",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,i,!1),this}},{key:"gotoInner",value:function t(n,i,e){for(var r,u;this.chunkIndex<this.layer.chunk.length&&(r=this.layer.chunk[this.chunkIndex],this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<n||r.maxPoint<this.minPoint);)this.chunkIndex++,e=!1;this.chunkIndex<this.layer.chunk.length&&(u=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],i,!0),(!e||this.rangeIndex<u)&&this.setRangeIndex(u)),this.next()}},{key:"forward",value:function t(n,i){(this.to-n||this.endSide-i)<0&&this.gotoInner(n,i,!0)}},{key:"next",value:function t(){for(var n,i,e;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}if(e=(n=this.layer.chunkPos[this.chunkIndex])+(i=this.layer.chunk[this.chunkIndex]).from[this.rangeIndex],this.from=e,this.to=n+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function t(n){if(n==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=n}},{key:"nextChunk",value:function t(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function t(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}]),t}(),et=function(){function t(n){yc(this,t),this.heap=n}return kc(t,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"goto",value:function t(n){var i,e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,o=ic(this.heap);try{for(o.s();!(i=o.n()).done;)(e=i.value).goto(n,u)}catch(t){o.e(t)}finally{o.f()}for(r=this.heap.length>>1;r>=0;r--)ol(this.heap,r);return this.next(),this}},{key:"forward",value:function t(n,i){var e,r,u,o=ic(this.heap);try{for(o.s();!(e=o.n()).done;)(r=e.value).forward(n,i)}catch(t){o.e(t)}finally{o.f()}for(u=this.heap.length>>1;u>=0;u--)ol(this.heap,u);(this.to-n||this.value.endSide-i)<0&&this.next()}},{key:"next",value:function t(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var n=this.heap[0];this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),ol(this.heap,0)}}}],[{key:"from",value:function n(i){var e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,s=[];for(e=0;e<i.length;e++)for(r=i[e];!r.isEmpty;r=r.nextLayer)r.maxPoint>=o&&s.push(new it(r,u,o,e));return 1==s.length?s[0]:new t(s)}}]),t}(),rt=function(){function t(n,i,e){yc(this,t),this.minPoint=e,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=et.from(n,i,e)}return kc(t,[{key:"goto",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(n,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=i,this.openStart=-1,this.next(),this}},{key:"forward",value:function t(n,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(n,i)}},{key:"removeActive",value:function t(n){fl(this.active,n),fl(this.activeTo,n),fl(this.activeRank,n),this.minActive=cl(this.active,this.activeTo)}},{key:"addActive",value:function t(n){for(var i=0,e=this.cursor,r=e.value,u=e.to,o=e.rank;i<this.activeRank.length&&this.activeRank[i]<=o;)i++;al(this.active,i,r),al(this.activeTo,i,u),al(this.activeRank,i,o),n&&al(n,i,this.cursor.from),this.minActive=cl(this.active,this.activeTo)}},{key:"next",value:function t(){var n,i,e,r,u=this.to,o=this.point;for(this.point=null,n=this.openStart<0?[]:null;;)if((i=this.minActive)>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>u){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&fl(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>u){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}if((e=this.cursor.value).point){if(!(o&&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)for(this.openStart=0,r=n.length-1;r>=0&&n[r]<u;r--)this.openStart++}},{key:"activeForPoint",value:function t(n){var i,e;if(!this.active.length)return this.active;for(i=[],e=this.active.length-1;e>=0&&!(this.activeRank[e]<this.pointRank);e--)(this.activeTo[e]>n||this.activeTo[e]==n&&this.active[e].endSide>=this.point.endSide)&&i.push(this.active[e]);return i.reverse()}},{key:"openEnd",value:function t(n){var i,e=0;for(i=this.activeTo.length-1;i>=0&&this.activeTo[i]>n;i--)e++;return e}}]),t}(),ut=n.State=Object.freeze({__proto__:null,Annotation:z,AnnotationType:W,ChangeDesc:d,ChangeSet:y,get CharCategory(){return G},Compartment:R,EditorSelection:m,EditorState:Q,Facet:w,Line:h,get MapMode(){return v},Prec:E,Range:Z,RangeSet:tt,RangeSetBuilder:nt,RangeValue:X,SelectionRange:k,StateEffect:U,StateEffectType:V,StateField:x,Text:i,Transaction:$,codePointAt:Ic,codePointSize:Lc,combineConfig:il,countColumn:ll,findClusterBreak:Cc,findColumn:vl,fromCodePoint:Rc}),ot="\u037c",st="undefined"==typeof Symbol?"__"+ot:Symbol.for(ot),ht="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),ft="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},at=function(){function t(n,i){var e,r,u;function o(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,n,i,e){var u,h,f=[],a=/^@(\w+)\b/.exec(t[0]),c=a&&"keyframes"==a[1];if(a&&null==n)return i.push(t[0]+";");for(u in n)if(h=n[u],/&/.test(u))s(u.split(/,\s*/).map((function(n){return t.map((function(t){return n.replace(/&/,t)}))})).reduce((function(t,n){return t.concat(n)})),h,i);else if(h&&"object"==dc(h)){if(!a)throw new RangeError("The value of a property ("+u+") should be a primitive value.");s(o(u),h,f,c)}else null!=h&&f.push(u.replace(/_.*/,"").replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))+": "+h+";");(f.length||c)&&i.push((!r||a||e?t:t.map(r)).join(", ")+" {"+f.join(" ")+"}")}for(u in yc(this,t),this.rules=[],r=(e=i||{}).finish,n)s(o(u),n[u],this.rules)}return kc(t,[{key:"getRules",value:function t(){return this.rules.join("\n")}}],[{key:"newName",value:function t(){var n=ft[st]||1;return ft[st]=n+1,ot+n.toString(36)}},{key:"mount",value:function t(n,i){(n[ht]||new lt(n)).mount(Array.isArray(i)?i:[i])}}]),t}(),ct=new Map,lt=function(){function t(n){var i,e,r,u;if(yc(this,t),e=(i=n.ownerDocument||n).defaultView,!n.head&&n.adoptedStyleSheets&&e.CSSStyleSheet){if(r=ct.get(i))return n.adoptedStyleSheets=[r.sheet].concat(Ja(n.adoptedStyleSheets)),n[ht]=r;this.sheet=new e.CSSStyleSheet,n.adoptedStyleSheets=[this.sheet].concat(Ja(n.adoptedStyleSheets)),ct.set(i,this)}else this.styleTag=i.createElement("style"),(u=n.head||n).insertBefore(this.styleTag,u.firstChild);this.modules=[],n[ht]=this}return kc(t,[{key:"mount",value:function t(n){var i,e,r,u,o,s,h=this.sheet,f=0,a=0;for(i=0;i<n.length;i++)if(e=n[i],(r=this.modules.indexOf(e))<a&&r>-1&&(this.modules.splice(r,1),a--,r=-1),-1==r){if(this.modules.splice(a++,0,e),h)for(u=0;u<e.rules.length;u++)h.insertRule(e.rules[u],f++)}else{for(;a<r;)f+=this.modules[a++].rules.length;f+=e.rules.length,a++}if(!h){for(o="",s=0;s<this.modules.length;s++)o+=this.modules[s].getRules()+"\n";this.styleTag.textContent=o}}}]),t}(),vt={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:"'"},dt={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&&/Chrome\/(\d+)/.exec(navigator.userAgent),pt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),kt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mt=pt||yt&&+yt[1]<57,gt=0;gt<10;gt++)vt[48+gt]=vt[96+gt]=String(gt);for(gt=1;gt<=24;gt++)vt[gt+111]="F"+gt;for(gt=65;gt<=90;gt++)vt[gt]=String.fromCharCode(gt+32),dt[gt]=String.fromCharCode(gt);for(wt in vt)dt.hasOwnProperty(wt)||(dt[wt]=vt[wt]);function dl(t){var n=mt&&(t.ctrlKey||t.altKey||t.metaKey)||kt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key,i=!n&&t.key||(t.shiftKey?dt:vt)[t.keyCode]||t.key||"Unidentified";return"Esc"==i&&(i="Escape"),"Del"==i&&(i="Delete"),"Left"==i&&(i="ArrowLeft"),"Up"==i&&(i="ArrowUp"),"Right"==i&&(i="ArrowRight"),"Down"==i&&(i="ArrowDown"),i}function yl(t){var n;return(n=11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function pl(t,n){return!!n&&(t==n||t.contains(1!=n.nodeType?n.parentNode:n))}function kl(t){for(var n=t.activeElement;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ml(t,n){if(!n.anchorNode)return!1;try{return pl(t,n.anchorNode)}catch(t){return!1}}function gl(t){return 3==t.nodeType?El(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function wl(t,n,i,e){return!!i&&(Ml(t,n,i,e,-1)||Ml(t,n,i,e,1))}function bl(t){for(var n=0;;n++)if(!(t=t.previousSibling))return n}function Ml(t,n,i,e,r){for(;;){if(t==i&&n==e)return!0;if(n==(r<0?0:xl(t))){if("DIV"==t.nodeName)return!1;var u=t.parentNode;if(!u||1!=u.nodeType)return!1;n=bl(t)+(r<0?0:1),t=u}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[n+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;n=r<0?xl(t):0}}}function xl(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Sl(t,n){var i=n?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function Cl(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Ol(t,n,i,e,r,u,o,s){var h,f,a,c,l,v,d,y,p,k,m,g,w,b,M=t.ownerDocument,x=M.defaultView||window;for(h=t;h;)if(1==h.nodeType){if(f=void 0,a=h==M.body)f=Cl(x);else{if(h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}f={left:(c=h.getBoundingClientRect()).left,right:c.left+h.clientWidth,top:c.top,bottom:c.top+h.clientHeight}}if(l=0,v=0,"nearest"==r?n.top<f.top?(v=-(f.top-n.top+o),i>0&&n.bottom>f.bottom+v&&(v=n.bottom-f.bottom+v+o)):n.bottom>f.bottom&&(v=n.bottom-f.bottom+o,i<0&&n.top-v<f.top&&(v=-(f.top+v-n.top+o))):(d=n.bottom-n.top,y=f.bottom-f.top,v=(p="center"==r&&d<=y?n.top+d/2-y/2:"start"==r||"center"==r&&i<0?n.top-o:n.bottom-y+o)-f.top),"nearest"==e?n.left<f.left?(l=-(f.left-n.left+u),i>0&&n.right>f.right+l&&(l=n.right-f.right+l+u)):n.right>f.right&&(l=n.right-f.right+u,i<0&&n.left<f.left+l&&(l=-(f.left+l-n.left+u))):l=(k="center"==e?n.left+(n.right-n.left)/2-(f.right-f.left)/2:"start"==e==s?n.left-u:n.right-(f.right-f.left)+u)-f.left,(l||v)&&(a?x.scrollBy(l,v):(m=0,g=0,v&&(w=h.scrollTop,h.scrollTop+=v,g=h.scrollTop-w),l&&(b=h.scrollLeft,h.scrollLeft+=l,m=h.scrollLeft-b),n={left:n.left-m,top:n.top-g,right:n.right-m,bottom:n.bottom-g},m&&Math.abs(m-l)<1&&(e="nearest"),g&&Math.abs(g-v)<1&&(r="nearest"))),a)break;h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}function Al(t){var n,i=t.ownerDocument;for(n=t.parentNode;n&&n!=i.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}function Dl(t){var n,i,e,r,u,o;if(t.setActive)return t.setActive();if(Mt)return t.focus(Mt);for(n=[],i=t;i&&(n.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Mt?{get preventScroll(){return Mt={preventScroll:!0},!0}}:void 0),!Mt)for(Mt=!1,e=0;e<n.length;)r=n[e++],u=n[e++],o=n[e++],r.scrollTop!=u&&(r.scrollTop=u),r.scrollLeft!=o&&(r.scrollLeft=o)}function El(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n,e=xt||(xt=document.createRange());return e.setEnd(t,i),e.setStart(t,n),e}function Il(t,n,i){var e,r={key:n,code:n,keyCode:i,which:i,cancelable:!0},u=new KeyboardEvent("keydown",r);return u.synthetic=!0,t.dispatchEvent(u),(e=new KeyboardEvent("keyup",r)).synthetic=!0,t.dispatchEvent(e),u.defaultPrevented||e.defaultPrevented}function Rl(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Ll(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function jl(t,n){var i,e=n.focusNode,r=n.focusOffset;if(!e||n.anchorNode!=e||n.anchorOffset!=r)return!1;for(r=Math.min(r,xl(e));;)if(r){if(1!=e.nodeType)return!1;"false"==(i=e.childNodes[r-1]).contentEditable?r--:r=xl(e=i)}else{if(e==t)return!0;r=bl(e),e=e.parentNode}}function Tl(t){var n=t.nextSibling;return t.parentNode.removeChild(t),n}function Bl(t,n,i,e,r,u,o,s,h){var f,a=t.children,c=a.length?a[n]:null,l=u.length?u[u.length-1]:null,v=l?l.breakAfter:o;if(!(n==e&&c&&!o&&!v&&u.length<2&&c.merge(i,r,u.length?l:null,0==i,s,h))){for(e<a.length&&((f=a[e])&&r<f.length?(n==e&&(f=f.split(r),r=0),!v&&l&&f.merge(0,r,l,!0,0,h)?u[u.length-1]=f:(r&&f.merge(0,r,null,!1,0,h),u.push(f))):(null==f?void 0:f.breakAfter)&&(l?l.breakAfter=1:o=1),e++),c&&(c.breakAfter=o,i>0&&(!o&&u.length&&c.merge(i,c.length,u[0],!1,s,0)?c.breakAfter=u.shift().breakAfter:(i<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(i,c.length,null,!1,s,0),n++));n<e&&u.length;)if(a[e-1].become(u[u.length-1]))e--,u.pop(),h=u.length?0:s;else{if(!a[n].become(u[0]))break;n++,u.shift(),s=u.length?0:h}!u.length&&n&&e<a.length&&!a[n-1].breakAfter&&a[e].merge(0,0,a[n-1],!1,s,h)&&n--,(n<e||u.length)&&t.replaceChildren(n,e,u)}}function _l(t,n,i,e,r,u){var o,s,h=t.childCursor(),f=h.findPos(i,1),a=f.i,c=f.off,l=h.findPos(n,-1),v=l.i,d=l.off,y=n-i,p=ic(e);try{for(p.s();!(o=p.n()).done;)y+=(s=o.value).length}catch(t){p.e(t)}finally{p.f()}t.length+=y,Bl(t,v,d,a,c,e,0,r,u)}function Nl(t,n,i){var e,r,u,o,s,h=t.nodeValue.length;return n>h&&(n=h),e=n,r=n,u=0,0==n&&i<0||n==h&&i>=0?Ft.chrome||Ft.gecko||(n?(e--,u=1):r<h&&(r++,u=-1)):i<0?e--:r<h&&r++,(o=El(t,e,r).getClientRects()).length?(s=o[(u?u<0:i>=0)?0:o.length-1],Ft.safari&&!u&&0==s.width&&(s=Array.prototype.find.call(o,(function(t){return t.width}))||s),u?Sl(s,u<0):s||null):null}function Pl(t,n,i,e,r,u,o){var s,h,f,a,c;if(i instanceof Wt){for(s=i.dom.firstChild;s;s=s.nextSibling)if(h=Ot.get(s)){if(a=pl(s,e),t<(c=h.length+(a?r:0))||t==c&&h.getSide()<=0)return a?Pl(t,n,h,e,r,u,o):u(h,t,n);t-=c}else{if("number"!=typeof(f=Fl(t,n,s,o)))return f;t=f}return u(i,i.length,-1)}return i.dom==e?o(e,t,n):u(i,t,n)}function Fl(t,n,i,e){var r,u,o;if(3==i.nodeType){if(t<=(r=i.nodeValue.length))return e(i,t,n);t-=r}else if(1==i.nodeType&&"false"!=i.contentEditable)for(u=i.firstChild;u;u=u.nextSibling){if("number"!=typeof(o=Fl(t,n,u,e)))return o;t=o}return t}function Hl(t,n,i,e,r){var u,o,s,h,f;if(i instanceof Wt)for(u=0,o=i.dom.firstChild;o;o=o.nextSibling)if(s=Ot.get(o)){if(h=pl(o,e),pl(o,t))return u+(h?Hl(t,n,s,e,r):s.localPosFromDOM(t,n));u+=s.length+(h?r:0)}else{if(null!=(f=zl(t,n,o)).result)return u+f.result;u+=f.size}else if(i.dom==e)return Math.min(n,e.nodeValue.length);return i.localPosFromDOM(t,n)}function zl(t,n,i){var e,r,u,o;if(3==i.nodeType)return t==i?{result:n}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};for(e=0,r=i.firstChild,u=0;;r=r.nextSibling,u++){if(t==i&&u==n)return{result:e};if(!r)return{size:e};if(null!=(o=zl(t,n,r)).result)return{result:n+o.result};e+=o.size}}function Wl(t,n){var i,e,r,u,o,s,h,f=t.dom,a=t.children,c=0;for(i=0;c<a.length;c++)if(!((r=i+(e=a[c]).length)==i&&e.getSide()<=0)){if(n>i&&n<r&&e.dom.parentNode==f)return e.domAtPos(n-i);if(n<=i)break;i=r}for(u=c;u>0;u--)if((o=a[u-1]).dom.parentNode==f)return o.domAtPos(o.length);for(s=c;s<a.length;s++)if((h=a[s]).dom.parentNode==f)return h.domAtPos(0);return new St(f,0)}function Vl(t,n,i){var e,r=t.children;i>0&&n instanceof Wt&&r.length&&(e=r[r.length-1])instanceof Wt&&e.mark.eq(n.mark)?Vl(e,n.children[0],i-1):(r.push(n),n.setParent(t)),t.length+=n.length}function Ul(t,n,i){var e,r=null,u=-1,o=null,s=-1;function h(t,n){var e,f,a,c;for(e=0,f=0;e<t.children.length&&f<=n;e++)(c=f+(a=t.children[e]).length)>=n&&(a.children.length?h(a,n-f):(!o||o.isHidden&&i>0)&&(c>n||f==c&&a.getSide()>0)?(o=a,s=n-f):(f<n||f==c&&a.getSide()<0&&!a.isHidden)&&(r=a,u=n-f)),f=c}return h(t,n),(e=(i<0?r:o)||r||o)?e.coordsAt(Math.max(0,e==r?u:s),i):$l(t)}function $l(t){var n,i=t.dom.lastChild;return i?(n=gl(i))[n.length-1]||null:t.dom.getBoundingClientRect()}function ql(t,n){for(var i in t)"class"==i&&n.class?n.class+=" "+t.class:"style"==i&&n.style?n.style+=";"+t.style:n[i]=t[i];return n}function Gl(t,n){var i,e,r,u,o;if(t==n)return!0;if(!t||!n)return!1;if(i=Object.keys(t),e=Object.keys(n),i.length!=e.length)return!1;for(r=0,u=i;r<u.length;r++)if(o=u[r],-1==e.indexOf(o)||t[o]!==n[o])return!1;return!0}function Jl(t,n,i){var e,r,u=null;if(n)for(e in n)i&&e in i||t.removeAttribute(u=e);if(i)for(r in i)n&&n[r]==i[r]||t.setAttribute(u=r,i[r]);return!!u}function Kl(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t.inclusiveStart,e=t.inclusiveEnd;return null==i&&(i=t.inclusive),null==e&&(e=t.inclusive),{start:null!=i?i:n,end:null!=e?e:n}}function Ql(t,n){return t==n||!!(t&&n&&t.compare(n))}function Xl(t,n,i){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=i.length-1;r>=0&&i[r]+e>=t?i[r]=Math.max(i[r],n):i.push(t,n)}function Zl(t,n){var i,e,r=ic(n);try{for(r.s();!(i=r.n()).done;)e=i.value,t=new Wt(e,[t],t.length)}catch(t){r.e(t)}finally{r.f()}return t}function Yl(t,n,i){var e=t.facet(on);e.length?e[0](n):window.onerror?window.onerror(String(n),i,void 0,void 0,n):i?console.error(i+":",n):console.error(n)}function tv(t){var n,i,e,r=0,u=0,o=0,s=0,h=ic(t.state.facet(xn));try{for(h.s();!(n=h.n()).done;)(e=(i=n.value)(t))&&(null!=e.left&&(r=Math.max(r,e.left)),null!=e.right&&(u=Math.max(u,e.right)),null!=e.top&&(o=Math.max(o,e.top)),null!=e.bottom&&(s=Math.max(s,e.bottom)))}catch(t){h.e(t)}finally{h.f()}return{left:r,right:u,top:o,bottom:s}}function nv(t){var n,i=[];for(n=0;n<t.length;n++)i.push(1<<+t[n]);return i}bt=function(){function t(){yc(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return kc(t,[{key:"eq",value:function t(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}},{key:"setRange",value:function t(n){var i=n.anchorNode,e=n.focusNode;this.set(i,Math.min(n.anchorOffset,i?xl(i):0),e,Math.min(n.focusOffset,e?xl(e):0))}},{key:"set",value:function t(n,i,e,r){this.anchorNode=n,this.anchorOffset=i,this.focusNode=e,this.focusOffset=r}}]),t}(),Mt=null,St=function(){function t(n,i){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];yc(this,t),this.node=n,this.offset=i,this.precise=e}return kc(t,null,[{key:"before",value:function n(i,e){return new t(i.parentNode,bl(i),e)}},{key:"after",value:function n(i,e){return new t(i.parentNode,bl(i)+1,e)}}]),t}(),Ct=[],Ot=function(){function t(){yc(this,t),this.parent=null,this.dom=null,this.dirty=2}return kc(t,[{key:"overrideDOMText",get:function t(){return null}},{key:"posAtStart",get:function t(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function t(){return this.posAtStart+this.length}},{key:"posBefore",value:function t(n){var i,e,r=this.posAtStart,u=ic(this.children);try{for(u.s();!(i=u.n()).done;){if((e=i.value)==n)return r;r+=e.length+e.breakAfter}}catch(t){u.e(t)}finally{u.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function t(n){return this.posBefore(n)+n.length}},{key:"sync",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v;if(2&this.dirty){r=this.dom,u=null,s=ic(this.children);try{for(s.s();!(h=s.n()).done;){if((f=h.value).dirty&&(!f.dom&&(o=u?u.nextSibling:r.firstChild)&&(!(a=t.get(o))||!a.parent&&a.canReuseDOM(f))&&f.reuseDOM(o),f.sync(i,e),f.dirty=0),o=u?u.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&o!=f.dom&&(e.written=!0),f.dom.parentNode==r)for(;o&&o!=f.dom;)o=Tl(o);else r.insertBefore(f.dom,o);u=f.dom}}catch(t){s.e(t)}finally{s.f()}for((o=u?u.nextSibling:r.firstChild)&&e&&e.node==r&&(e.written=!0);o;)o=Tl(o)}else if(1&this.dirty){c=ic(this.children);try{for(c.s();!(l=c.n()).done;)(v=l.value).dirty&&(v.sync(i,e),v.dirty=0)}catch(t){c.e(t)}finally{c.f()}}}},{key:"reuseDOM",value:function t(n){}},{key:"localPosFromDOM",value:function n(i,e){var r,u,o,s,h,f;if(i==this.dom)r=this.dom.childNodes[e];else{for(u=0==xl(i)?0:0==e?-1:1;(o=i.parentNode)!=this.dom;)0==u&&o.firstChild!=o.lastChild&&(u=i==o.firstChild?-1:1),i=o;r=u<0?i:i.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!t.get(r);)r=r.nextSibling;if(!r)return this.length;for(s=0,h=0;;s++){if((f=this.children[s]).dom==r)return h;h+=f.length+f.breakAfter}}},{key:"domBoundsAround",value:function t(n,i){var e,r,u,o,s,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,f=-1,a=-1,c=-1,l=-1;for(e=0,r=h,u=h;e<this.children.length;e++){if(s=r+(o=this.children[e]).length,r<n&&s>i)return o.domBoundsAround(n,i,r);if(s>=n&&-1==f&&(f=e,a=r),r>i&&o.dom.parentNode==this.dom){c=e,l=u;break}u=s,r=s+o.breakAfter}return{from:a,to:l<0?h+this.length:l,startDOM:(f?this.children[f-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:c<this.children.length&&c>=0?this.children[c].dom:null}}},{key:"markDirty",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(n)}},{key:"markParentsDirty",value:function t(n){for(var i=this.parent;i;i=i.parent){if(n&&(i.dirty|=2),1&i.dirty)return;i.dirty|=1,n=!1}}},{key:"setParent",value:function t(n){this.parent!=n&&(this.parent=n,this.dirty&&this.markParentsDirty(!0))}},{key:"setDOM",value:function t(n){this.dom&&(this.dom.cmView=null),this.dom=n,n.cmView=this}},{key:"rootView",get:function t(){var n,i;for(n=this;;){if(!(i=n.parent))return n;n=i}}},{key:"replaceChildren",value:function t(n,i){var e,r,u,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ct;for(this.markDirty(),r=n;r<i;r++)(u=this.children[r]).parent==this&&u.destroy();for((e=this.children).splice.apply(e,[n,i-n].concat(Ja(s))),o=0;o<s.length;o++)s[o].setParent(this)}},{key:"ignoreMutation",value:function t(n){return!1}},{key:"ignoreEvent",value:function t(n){return!1}},{key:"childCursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new At(this.children,n,this.children.length)}},{key:"childPos",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(n,i)}},{key:"toString",value:function t(){var n=this.constructor.name.replace("View","");return n+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==n?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function t(){return!0}},{key:"isWidget",get:function t(){return!1}},{key:"isHidden",get:function t(){return!1}},{key:"merge",value:function t(n,i,e,r,u,o){return!1}},{key:"become",value:function t(n){return!1}},{key:"canReuseDOM",value:function t(n){return n.constructor==this.constructor}},{key:"getSide",value:function t(){return 0}},{key:"destroy",value:function t(){this.parent=null}}],[{key:"get",value:function t(n){return n.cmView}}]),t}(),Ot.prototype.breakAfter=0,At=function(){function t(n,i,e){yc(this,t),this.children=n,this.pos=i,this.i=e,this.off=0}return kc(t,[{key:"findPos",value:function t(n){for(var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){if(n>this.pos||n==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=n-this.pos,this;i=this.children[--this.i],this.pos-=i.length+i.breakAfter}}}]),t}(),Dt="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Et="undefined"!=typeof document?document:{documentElement:{style:{}}},It=/Edge\/(\d+)/.exec(Dt.userAgent),Rt=/MSIE \d/.test(Dt.userAgent),Lt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt.userAgent),Tt=!(jt=!!(Rt||Lt||It))&&/gecko\/(\d+)/i.test(Dt.userAgent),Bt=!jt&&/Chrome\/(\d+)/.exec(Dt.userAgent),_t="webkitFontSmoothing"in Et.documentElement.style,Pt=(Nt=!jt&&/Apple Computer/.test(Dt.vendor))&&(/Mobile\/\w+/.test(Dt.userAgent)||Dt.maxTouchPoints>2),Ft={mac:Pt||/Mac/.test(Dt.platform),windows:/Win/.test(Dt.platform),linux:/Linux|X11/.test(Dt.platform),ie:jt,ie_version:Rt?Et.documentMode||6:Lt?+Lt[1]:It?+It[1]:0,gecko:Tt,gecko_version:Tt?+(/Firefox\/(\d+)/.exec(Dt.userAgent)||[0,0])[1]:0,chrome:!!Bt,chrome_version:Bt?+Bt[1]:0,ios:Pt,android:/Android\b/.test(Dt.userAgent),webkit:_t,safari:Nt,webkit_version:_t?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Et.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},Ht=256,zt=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).text=t,e}return kc(i,[{key:"length",get:function t(){return this.text.length}},{key:"createDOM",value:function t(n){this.setDOM(n||document.createTextNode(this.text))}},{key:"sync",value:function t(n,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function t(n){3==n.nodeType&&this.createDOM(n)}},{key:"merge",value:function t(n,e,r){return(!r||r instanceof i&&!(this.length-(e-n)+r.length>Ht))&&(this.text=this.text.slice(0,n)+(r?r.text:"")+this.text.slice(e),this.markDirty(),!0)}},{key:"split",value:function t(n){var e=new i(this.text.slice(n));return this.text=this.text.slice(0,n),this.markDirty(),e}},{key:"localPosFromDOM",value:function t(n,i){return n==this.dom?i:i?this.text.length:0}},{key:"domAtPos",value:function t(n){return new St(this.dom,n)}},{key:"domBoundsAround",value:function t(n,i,e){return{from:e,to:e+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function t(n,i){return Nl(this.dom,n,i)}}]),i}(Ot),Wt=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,u,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;yc(this,i),(e=n.call(this)).mark=t,e.children=s,e.length=h,r=ic(s);try{for(r.s();!(u=r.n()).done;)(o=u.value).setParent(cc(e))}catch(t){r.e(t)}finally{r.f()}return e}return kc(i,[{key:"setAttrs",value:function t(n){if(Ll(n),this.mark.class&&(n.className=this.mark.class),this.mark.attrs)for(var i in this.mark.attrs)n.setAttribute(i,this.mark.attrs[i]);return n}},{key:"reuseDOM",value:function t(n){n.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,e){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),uc(vc(i.prototype),"sync",this).call(this,n,e)}},{key:"merge",value:function t(n,e,r,u,o,s){return(!r||!(!(r instanceof i&&r.mark.eq(this.mark))||n&&o<=0||e<this.length&&s<=0))&&(_l(this,n,e,r?r.children:[],o-1,s-1),this.markDirty(),!0)}},{key:"split",value:function t(n){var e,r,u,o,s=[],h=0,f=-1,a=0,c=ic(this.children);try{for(c.s();!(e=c.n()).done;)(u=h+(r=e.value).length)>n&&s.push(h<n?r.split(n-h):r),f<0&&h>=n&&(f=a),h=u,a++}catch(t){c.e(t)}finally{c.f()}return o=this.length-n,this.length=n,f>-1&&(this.children.length=f,this.markDirty()),new i(this.mark,s,o)}},{key:"domAtPos",value:function t(n){return Wl(this,n)}},{key:"coordsAt",value:function t(n,i){return Ul(this,n,i)}}]),i}(Ot),Vt=function(t){sc(e,t);var n=fc(e);function e(t,i,r){var u;return yc(this,e),(u=n.call(this)).widget=t,u.length=i,u.side=r,u.prevWidget=null,u}return kc(e,[{key:"split",value:function t(n){var i=e.create(this.widget,this.length-n,this.side);return this.length-=n,i}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"getSide",value:function t(){return this.side}},{key:"merge",value:function t(n,i,r,u,o,s){return!(r&&(!(r instanceof e&&this.widget.compare(r.widget))||n>0&&o<=0||i<this.length&&s<=0))&&(this.length=n+(r?r.length:0)+(this.length-i),!0)}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side&&this.widget.constructor==n.widget.constructor&&(this.widget.compare(n.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"overrideDOMText",get:function t(){var n,e,r,u,o;if(0==this.length)return i.empty;for(n=this;n.parent;)n=n.parent;return u=(r=(e=n).view)&&r.state.doc,o=this.posAtStart,u?u.slice(o,o+this.length):i.empty}},{key:"domAtPos",value:function t(n){return(this.length?0==n:this.side>0)?St.before(this.dom):St.after(this.dom,n==this.length)}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e,r,u,o=this.widget.coordsAt(this.dom,n,i);if(o)return o;if(r=null,!(e=this.dom.getClientRects()).length)return null;for(u=n>0?e.length-1:0;r=e[u],!(n>0?0==u:u==e.length-1||r.top<r.bottom);u+=n>0?-1:1);return this.length?r:Sl(r,this.side>0)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"isHidden",get:function t(){return this.widget.isHidden}},{key:"destroy",value:function t(){uc(vc(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function t(n,i,r){return new(n.customView||e)(n,i,r)}}]),e}(Ot),Ut=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"domAtPos",value:function t(n){var i=this.widget,e=i.topView,r=i.text;return e?Pl(n,0,e,r,this.length-e.length,(function(t,n){return t.domAtPos(n)}),(function(t,n){return new St(t,Math.min(n,t.nodeValue.length))})):new St(r,Math.min(n,r.nodeValue.length))}},{key:"sync",value:function t(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function t(n,i){var e=this.widget,r=e.topView,u=e.text;return r?Hl(n,i,r,u,this.length-r.length):Math.min(i,this.length)}},{key:"ignoreMutation",value:function t(){return!1}},{key:"overrideDOMText",get:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e=this.widget,r=e.topView,u=e.text;return r?Pl(n,i,r,u,this.length-r.length,(function(t,n,i){return t.coordsAt(n,i)}),(function(t,n,i){return Nl(t,n,i)})):Nl(u,n,i)}},{key:"destroy",value:function t(){var n;uc(vc(i.prototype),"destroy",this).call(this),null===(n=this.widget.topView)||void 0===n||n.destroy()}},{key:"isEditable",get:function t(){return!0}},{key:"canReuseDOM",value:function t(){return!0}}]),i}(Vt),$t=function(t){sc(e,t);var n=fc(e);function e(t){var i;return yc(this,e),(i=n.call(this)).side=t,i}return kc(e,[{key:"length",get:function t(){return 0}},{key:"merge",value:function t(){return!1}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side}},{key:"split",value:function t(){return new e(this.side)}},{key:"sync",value:function t(){if(!this.dom){var n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),this.setDOM(n)}}},{key:"getSide",value:function t(){return this.side}},{key:"domAtPos",value:function t(n){return this.side>0?St.before(this.dom):St.after(this.dom)}},{key:"localPosFromDOM",value:function t(){return 0}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function t(){return i.empty}},{key:"isHidden",get:function t(){return!0}}]),e}(Ot),zt.prototype.children=Vt.prototype.children=$t.prototype.children=Ct,qt=function(){function t(){yc(this,t)}return kc(t,[{key:"eq",value:function t(n){return!1}},{key:"updateDOM",value:function t(n,i){return!1}},{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"estimatedHeight",get:function t(){return-1}},{key:"ignoreEvent",value:function t(n){return!0}},{key:"coordsAt",value:function t(n,i,e){return null}},{key:"customView",get:function t(){return null}},{key:"isHidden",get:function t(){return!1}},{key:"destroy",value:function t(n){}}]),t}(),Gt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Gt||(Gt={})),Jt=function(t){sc(i,t);var n=fc(i);function i(t,e,r,u){var o;return yc(this,i),(o=n.call(this)).startSide=t,o.endSide=e,o.widget=r,o.spec=u,o}return kc(i,[{key:"heightRelevant",get:function t(){return!1}},{key:"hasHeight",value:function t(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function t(n){return new Kt(n)}},{key:"widget",value:function t(n){var i=n.side||0,e=!!n.block;return new Xt(n,i+=e?i>0?3e8:-4e8:i>0?1e8:-1e8,i,e,n.widget||null,!1)}},{key:"replace",value:function t(n){var i,e,r,u,o,s=!!n.block;return n.isBlockGap?(i=-5e8,e=4e8):(i=((u=(r=Kl(n,s)).start)?s?-3e8:-1:5e8)-1,e=1+((o=r.end)?s?2e8:1:-6e8)),new Xt(n,i,e,s,n.widget||null,!0)}},{key:"line",value:function t(n){return new Qt(n)}},{key:"set",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return tt.of(n,i)}}]),i}(X),Jt.none=tt.empty,Kt=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,u,o;return yc(this,i),u=(r=Kl(t)).start,o=r.end,(e=n.call(this,u?-1:5e8,o?1:-6e8,null,t)).tagName=t.tagName||"span",e.class=t.class||"",e.attrs=t.attributes||null,e}return kc(i,[{key:"eq",value:function t(n){return this==n||n instanceof i&&this.tagName==n.tagName&&this.class==n.class&&Gl(this.attrs,n.attrs)}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(n>=e)throw new RangeError("Mark decorations may not be empty");return uc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Kt.prototype.point=!1,Qt=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,-2e8,-2e8,null,t)}return kc(i,[{key:"eq",value:function t(n){return n instanceof i&&this.spec.class==n.spec.class&&Gl(this.spec.attributes,n.spec.attributes)}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(e!=n)throw new RangeError("Line decoration ranges must be zero-length");return uc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Qt.prototype.mapMode=v.TrackBefore,Qt.prototype.point=!0,Xt=function(t){sc(i,t);var n=fc(i);function i(t,e,r,u,o,s){var h;return yc(this,i),(h=n.call(this,e,r,o,t)).block=u,h.isReplace=s,h.mapMode=u?e<=0?v.TrackBefore:v.TrackAfter:v.TrackDel,h}return kc(i,[{key:"type",get:function t(){return this.startSide<this.endSide?Gt.WidgetRange:this.startSide<=0?Gt.WidgetBefore:Gt.WidgetAfter}},{key:"heightRelevant",get:function t(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}},{key:"eq",value:function t(n){return n instanceof i&&Ql(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(this.isReplace&&(n>e||n==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=n)throw new RangeError("Widget decorations can only have zero-length ranges");return uc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Xt.prototype.point=!0,Zt=function(t){sc(i,t);var n=fc(i);function i(){var t;return yc(this,i),(t=n.apply(this,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return kc(i,[{key:"merge",value:function t(n,e,r,u,o,s){if(r){if(!(r instanceof i))return!1;this.dom||r.transferDOM(this)}return u&&this.setDeco(r?r.attrs:null),_l(this,n,e,r?r.children:[],o,s),!0}},{key:"split",value:function t(n){var e,r,u,o,s=new i;if(s.breakAfter=this.breakAfter,0==this.length)return s;for(r=(e=this.childPos(n)).i,(u=e.off)&&(s.append(this.children[r].split(u),0),this.children[r].merge(u,this.children[r].length,null,!1,0,0),r++),o=r;o<this.children.length;o++)s.append(this.children[o],0);for(;r>0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=n,s}},{key:"transferDOM",value:function t(n){this.dom&&(this.markDirty(),n.setDOM(this.dom),n.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function t(n){Gl(this.attrs,n)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=n)}},{key:"append",value:function t(n,i){Vl(this,n,i)}},{key:"addLineDeco",value:function t(n){var i=n.spec.attributes,e=n.spec.class;i&&(this.attrs=ql(i,this.attrs||{})),e&&(this.attrs=ql({class:e},this.attrs||{}))}},{key:"domAtPos",value:function t(n){return Wl(this,n)}},{key:"reuseDOM",value:function t(n){"DIV"==n.nodeName&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,e){var r,u,o;for(this.dom?4&this.dirty&&(Ll(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),uc(vc(i.prototype),"sync",this).call(this,n,e),u=this.dom.lastChild;u&&Ot.get(u)instanceof Wt;)u=u.lastChild;u&&this.length&&("BR"==u.nodeName||0!=(null===(r=Ot.get(u))||void 0===r?void 0:r.isEditable)||Ft.ios&&this.children.some((function(t){return t instanceof zt})))||((o=document.createElement("BR")).cmIgnore=!0,this.dom.appendChild(o))}},{key:"measureTextSize",value:function t(){var n,i,e,r,u,o;if(0==this.children.length||this.length>20)return null;n=0,e=ic(this.children);try{for(e.s();!(r=e.n()).done;){if(!((u=r.value)instanceof zt)||/[^ -~]/.test(u.text))return null;if(1!=(o=gl(u.dom)).length)return null;n+=o[0].width,i=o[0].height}}catch(t){e.e(t)}finally{e.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:i}:null}},{key:"coordsAt",value:function t(n,i){var e,r,u,o=Ul(this,n,i);return!this.children.length&&o&&this.parent&&(e=this.parent.view.viewState.heightOracle,r=o.bottom-o.top,Math.abs(r-e.lineHeight)<2&&e.textHeight<r)?(u=(r-e.textHeight)/2,{top:o.top+u,bottom:o.bottom-u,left:o.left,right:o.left}):o}},{key:"become",value:function t(n){return!1}},{key:"type",get:function t(){return Gt.Text}}],[{key:"find",value:function t(n,e){var r,u,o,s;for(r=0,u=0;r<n.children.length;r++){if((s=u+(o=n.children[r]).length)>=e){if(o instanceof i)return o;if(s>e)break}u=s+o.breakAfter}return null}}]),i}(Ot),Yt=function(t){sc(e,t);var n=fc(e);function e(t,i,r){var u;return yc(this,e),(u=n.call(this)).widget=t,u.length=i,u.type=r,u.breakAfter=0,u.prevWidget=null,u}return kc(e,[{key:"merge",value:function t(n,i,r,u,o,s){return!(r&&(!(r instanceof e&&this.widget.compare(r.widget))||n>0&&o<=0||i<this.length&&s<=0))&&(this.length=n+(r?r.length:0)+(this.length-i),!0)}},{key:"domAtPos",value:function t(n){return 0==n?St.before(this.dom):St.after(this.dom,n==this.length)}},{key:"split",value:function t(n){var i,r=this.length-n;return this.length=n,(i=new e(this.widget,r,this.type)).breakAfter=this.breakAfter,i}},{key:"children",get:function t(){return Ct}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function t(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):i.empty}},{key:"domBoundsAround",value:function t(){return null}},{key:"become",value:function t(n){return n instanceof e&&n.widget.constructor==this.widget.constructor&&(n.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,this.type=n.type,this.breakAfter=n.breakAfter,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"coordsAt",value:function t(n,i){return this.widget.coordsAt(this.dom,n,i)}},{key:"destroy",value:function t(){uc(vc(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),e}(Ot),tn=function(){function t(n,i,e,r){yc(this,t),this.doc=n,this.pos=i,this.end=e,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=n.iter(),this.skip=i}return kc(t,[{key:"posCovered",value:function t(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var n=this.content[this.content.length-1];return!(n.breakAfter||n instanceof Yt&&n.type==Gt.WidgetBefore)}},{key:"getLine",value:function t(){return this.curLine||(this.content.push(this.curLine=new Zt),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(Zl(new $t(-1),n),n.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function t(n){this.flushBuffer(),this.curLine=null,this.content.push(n)}},{key:"finish",value:function t(n){this.pendingBuffer&&n<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function t(n,i,e){for(var r,u,o,s,h;n>0;){if(this.textOff==this.text.length){if(u=(r=this.cursor.next(this.skip)).value,o=r.lineBreak,s=r.done,this.skip=0,s)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,n--;continue}this.text=u,this.textOff=0}h=Math.min(this.text.length-this.textOff,n,512),this.flushBuffer(i.slice(i.length-e)),this.getLine().append(Zl(new zt(this.text.slice(this.textOff,this.textOff+h)),i),e),this.atCursorPos=!0,this.textOff+=h,n-=h,e=0}}},{key:"span",value:function t(n,i,e,r){this.buildText(i-n,e,r),this.pos=i,this.openStart<0&&(this.openStart=r)}},{key:"point",value:function t(n,i,e,r,u,o){var s,h,f,a,c,l;if(this.disallowBlockEffectsFor[o]&&e instanceof Xt){if(e.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}s=i-n,e instanceof Xt?e.block?((h=e.type)!=Gt.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new Yt(e.widget||new nn("div"),s,h))):(f=Vt.create(e.widget||new nn("span"),s,s?0:e.startSide),a=this.atCursorPos&&!f.isEditable&&u<=r.length&&(n<i||e.startSide>0),c=!f.isEditable&&(n<i||u>r.length||e.startSide<=0),l=this.getLine(),2!=this.pendingBuffer||a||f.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(l.append(Zl(new $t(1),r),u),u=r.length+Math.max(0,u-r.length)),l.append(Zl(f,r),u),this.atCursorPos=c,this.pendingBuffer=c?n<i||u>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())):this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(e),s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=u)}}],[{key:"build",value:function n(i,e,r,u,o){var s=new t(i,e,r,o);return s.openEnd=tt.spans(u,e,r,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}]),t}(),nn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).tag=t,e}return kc(i,[{key:"eq",value:function t(n){return n.tag==this.tag}},{key:"toDOM",value:function t(){return document.createElement(this.tag)}},{key:"updateDOM",value:function t(n){return n.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function t(){return!0}}]),i}(qt),en=w.define(),rn=w.define(),un=w.define(),on=w.define(),sn=w.define(),hn=w.define(),fn=w.define(),an=w.define({combine:function t(n){return n.some((function(t){return t}))}}),cn=w.define({combine:function t(n){return n.some((function(t){return t}))}}),ln=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;yc(this,t),this.range=n,this.y=i,this.x=e,this.yMargin=r,this.xMargin=u}return kc(t,[{key:"map",value:function n(i){return i.empty?this:new t(this.range.map(i),this.y,this.x,this.yMargin,this.xMargin)}}]),t}(),vn=U.define({map:function t(n,i){return n.map(i)}}),dn=w.define({combine:function t(n){return!n.length||n[0]}}),yn=0,pn=w.define(),kn=function(){function t(n,i,e,r){yc(this,t),this.id=n,this.create=i,this.domEventHandlers=e,this.extension=r(this)}return kc(t,null,[{key:"define",value:function n(i,e){var r=e||{},u=r.eventHandlers,o=r.provide,s=r.decorations;return new t(yn++,i,u,(function(t){var n=[pn.of(t)];return s&&n.push(bn.of((function(n){var i=n.plugin(t);return i?s(i):Jt.none}))),o&&n.push(o(t)),n}))}},{key:"fromClass",value:function n(i,e){return t.define((function(t){return new i(t)}),e)}}]),t}(),mn=function(){function t(n){yc(this,t),this.spec=n,this.mustUpdate=null,this.value=null}return kc(t,[{key:"update",value:function t(n){if(this.value){if(this.mustUpdate){var t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Yl(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(n)}catch(t){Yl(n.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function t(n){var i;if(null===(i=this.value)||void 0===i?void 0:i.destroy)try{this.value.destroy()}catch(t){Yl(n.state,t,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function t(){this.spec=this.value=null}}]),t}(),gn=w.define(),wn=w.define(),bn=w.define(),Mn=w.define(),xn=w.define(),Sn=w.define(),Cn=function(){function t(n,i,e,r){yc(this,t),this.fromA=n,this.toA=i,this.fromB=e,this.toB=r}return kc(t,[{key:"join",value:function n(i){return new t(Math.min(this.fromA,i.fromA),Math.max(this.toA,i.toA),Math.min(this.fromB,i.fromB),Math.max(this.toB,i.toB))}},{key:"addToSet",value:function t(n){for(var i,e=n.length,r=this;e>0;e--)if(!((i=n[e-1]).fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),n.splice(e-1,1)}return n.splice(e,0,r),n}}],[{key:"extendWithRanges",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v,d,y;if(0==e.length)return i;for(r=[],u=0,o=0,s=0,h=0;;u++){for(a=s-h,c=(f=u==i.length?null:i[u])?f.fromB:1e9;o<e.length&&e[o]<c&&(l=e[o],v=e[o+1],(d=Math.max(h,l))<=(y=Math.min(c,v))&&new t(d+a,y+a,d,y).addToSet(r),!(v>c));)o+=2;if(!f)return r;new t(f.fromA,f.toA,f.fromB,f.toB).addToSet(r),s=f.toA,h=f.toB}}}]),t}(),On=function(){function t(n,i,e){var r,u,o,s;yc(this,t),this.view=n,this.state=i,this.transactions=e,this.flags=0,this.startState=n.state,this.changes=y.empty(this.startState.doc.length),r=ic(e);try{for(r.s();!(u=r.n()).done;)o=u.value,this.changes=this.changes.compose(o.changes)}catch(t){r.e(t)}finally{r.f()}s=[],this.changes.iterChangedRanges((function(t,n,i,e){return s.push(new Cn(t,n,i,e))})),this.changedRanges=s}return kc(t,[{key:"viewportChanged",get:function t(){return(4&this.flags)>0}},{key:"heightChanged",get:function t(){return(2&this.flags)>0}},{key:"geometryChanged",get:function t(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function t(){return(1&this.flags)>0}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"selectionSet",get:function t(){return this.transactions.some((function(t){return t.selection}))}},{key:"empty",get:function t(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),An=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(An||(An={})),Dn=An.LTR,En=An.RTL,In=nv("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Rn=nv("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Ln=Object.create(null),jn=[];for(Tn=0,Bn=["()","[]","{}"];Tn<Bn.length;Tn++)Nn=(_n=Bn[Tn]).charCodeAt(0),Pn=_n.charCodeAt(1),Ln[Nn]=Pn,Ln[Pn]=-Nn;function iv(t){return t<=247?In[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Rn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}function ev(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T,B,_,N,P,F,H,z=t.length,W=n==Dn?1:2,V=n==Dn?2:1;if(!t||1==W&&!Fn.test(t))return rv(z);for(i=0,e=W,r=W;i<z;i++)512==(u=iv(t.charCodeAt(i)))?u=e:8==u&&4==r&&(u=16),zn[i]=4==u?2:u,7&u&&(r=u),e=u;for(o=0,s=W,h=W;o<z;o++){if(128==(f=zn[o]))o<z-1&&s==zn[o+1]&&24&s?f=zn[o]=s:zn[o]=256;else if(64==f){for(a=o+1;a<z&&64==zn[a];)a++;for(c=o&&8==s||a<z&&8==zn[a]?1==h?1:8:256,l=o;l<a;l++)zn[l]=c;o=a-1}else 8==f&&1==h&&(zn[o]=1);s=f,7&f&&(h=f)}for(v=0,d=0,y=0;v<z;v++)if(k=Ln[p=t.charCodeAt(v)])if(k<0){for(g=d-3;g>=0;g-=3)if(jn[g+1]==-k){(b=2&(w=jn[g+2])?W:4&w?1&w?V:W:0)&&(zn[v]=zn[jn[g]]=b),d=g;break}}else{if(189==jn.length)break;jn[d++]=v,jn[d++]=p,jn[d++]=y}else if(2==(m=zn[v])||1==m)for(y=(M=m==W)?0:1,x=d-3;x>=0&&!(2&(S=jn[x+2]));x-=3)if(M)jn[x+2]|=2;else{if(4&S)break;jn[x+2]|=4}for(C=0;C<z;C++)if(256==zn[C]){for(O=C+1;O<z&&256==zn[O];)O++;for(E=(A=1==(C?zn[C-1]:W))==(D=1==(O<z?zn[O]:W))?A?1:2:W,I=C;I<O;I++)zn[I]=E;C=O-1}if(R=[],1==W)for(L=0;L<z;){for(j=L,T=1!=zn[L++];L<z&&T==(1!=zn[L]);)L++;if(T)for(B=L;B>j;){for(_=B,N=2!=zn[--B];B>j&&N==(2!=zn[B-1]);)B--;R.push(new Hn(B,_,N?2:1))}else R.push(new Hn(j,L,0))}else for(P=0;P<z;){for(F=P,H=2==zn[P++];P<z&&H==(2==zn[P]);)P++;R.push(new Hn(F,P,H?1:2))}return R}function rv(t){return[new Hn(0,t,0)]}function uv(t,n,i,e,r){var u,o,s,h,f,a,c=e.head-t.from,l=-1;if(0==c){if(!r||!t.length)return null;n[0].level!=i&&(c=n[0].side(!1,i),l=0)}else if(c==t.length){if(r)return null;(o=n[n.length-1]).level!=i&&(c=o.side(!0,i),l=n.length-1)}return l<0&&(l=Hn.find(n,c,null!==(u=e.bidiLevel)&&void 0!==u?u:-1,e.assoc)),c==(s=n[l]).side(r,i)&&(c=(s=n[l+=r?1:-1]).side(!r,i)),h=r==(s.dir==i),f=Cc(t.text,c,h),Wn=t.text.slice(Math.min(c,f),Math.max(c,f)),f!=s.side(r,i)?m.cursor(f+t.from,h?-1:1,s.level):(a=l==(r?n.length-1:0)?null:n[l+(r?1:-1)])||s.level==i?a&&a.level<s.level?m.cursor(a.side(!r,i)+t.from,r?1:-1,a.level):m.cursor(f+t.from,r?-1:1,s.level):m.cursor(r?t.to:t.from,r?-1:1,i)}function ov(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function sv(t){return 1==t.node.nodeType&&t.node.firstChild&&(0==t.offset||"false"==t.node.childNodes[t.offset-1].contentEditable)&&(t.offset==t.node.childNodes.length||"false"==t.node.childNodes[t.offset].contentEditable)}function hv(t){var n,i,e,r,u,o,s,h=t.observer.selectionRange,f=h.focusNode&&av(h.focusNode,h.focusOffset,0);if(!f)return null;if(!(n=t.docView.nearest(f)))return null;if(n instanceof Zt){for(i=f;i.parentNode!=n.dom;)i=i.parentNode;for(e=i.previousSibling;e&&!Ot.get(e);)e=e.previousSibling;return{from:r=e?Ot.get(e).posAtEnd:n.posAtStart,to:r,node:i,text:f}}for(;;){if(!(o=(u=n).parent))return null;if(o instanceof Zt)break;n=o}return{from:s=n.posAtStart,to:s+n.length,node:n.dom,text:f}}function fv(t,n){var i,e,r,u,o,s,h,f,a,c=hv(t);if(!c)return Jt.none;if(i=c.from,e=c.to,r=c.node,u=c.text,o=n.mapPos(i,1),s=Math.max(o,n.mapPos(e,-1)),h=t.state,(f=3==r.nodeType?r.nodeValue:new Un([],h).readRange(r.firstChild,null).text).indexOf(Vn)>-1)return Jt.none;if(s-o<f.length)if(h.doc.sliceString(o,Math.min(h.doc.length,o+f.length))==f)s=o+f.length;else{if(h.doc.sliceString(Math.max(0,s-f.length),s)!=f)return Jt.none;o=s-f.length}else if(h.doc.sliceString(o,s)!=f)return Jt.none;return(a=Ot.get(r))instanceof Ut?a=a.widget.topView:a&&(a.parent=null),Jt.set(Jt.replace({widget:new Jn(r,u,a),inclusive:!0}).range(o,s))}function av(t,n,i){var e,r,u,o;if(i<=0)for(e=t,r=n;;){if(3==e.nodeType)return e;if(!(1==e.nodeType&&r>0))break;r=xl(e=e.childNodes[r-1])}if(i>=0)for(u=t,o=n;;){if(3==u.nodeType)return u;if(!(1==u.nodeType&&o<u.childNodes.length&&i>=0))break;u=u.childNodes[o],o=0}return null}function cv(t,n){return 1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable?2:0)}function lv(t,n,i){var e=new Kn;return tt.compare(t,n,i,e),e.changes}function vv(t,n){for(var i=t;i&&i!=n;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}function dv(t,n){var i,e,r,u,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,h=t.charCategorizer(n),f=t.doc.lineAt(n),a=n-f.from;if(0==f.length)return m.cursor(n);for(0==a?s=1:a==f.length&&(s=-1),i=a,e=a,s<0?i=Cc(f.text,a,!1):e=Cc(f.text,a),r=h(f.text.slice(i,e));i>0&&(u=Cc(f.text,i,!1),h(f.text.slice(u,i))==r);)i=u;for(;e<f.length&&(o=Cc(f.text,e),h(f.text.slice(e,o))==r);)e=o;return m.range(i+f.from,e+f.from)}function yv(t,n){return n.left>t?n.left-t:Math.max(0,t-n.right)}function pv(t,n){return n.top>t?n.top-t:Math.max(0,t-n.bottom)}function kv(t,n){return t.top<n.bottom-1&&t.bottom>n.top+1}function mv(t,n){return n<t.top?{top:n,left:t.left,right:t.right,bottom:t.bottom}:t}function gv(t,n){return n>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:n}:t}function wv(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=!1;for(c=t.firstChild;c;c=c.nextSibling)for(l=gl(c),v=0;v<l.length;v++){if(d=l[v],r&&kv(r,d)&&(d=mv(gv(d,r.bottom),r.top)),y=yv(n,d),p=pv(i,d),0==y&&0==p)return 3==c.nodeType?bv(c,n,i):wv(c,n,i);(!e||o>p||o==p&&u>y)&&(e=c,r=d,u=y,o=p,w=!(k=p?i<d.top?-1:1:y?n<d.left?-1:1:0)||(k>0?v<l.length-1:v>0)),0==y?i>d.bottom&&(!f||f.bottom<d.bottom)?(s=c,f=d):i<d.top&&(!a||a.top>d.top)&&(h=c,a=d):f&&kv(f,d)?f=gv(f,d.bottom):a&&kv(a,d)&&(a=mv(a,d.top))}return f&&f.bottom>=i?(e=s,r=f):a&&a.top<=i&&(e=h,r=a),e?(m=Math.max(r.left,Math.min(r.right,n)),3==e.nodeType?bv(e,m,i):w&&"false"!=e.contentEditable?wv(e,m,i):{node:t,offset:g=Array.prototype.indexOf.call(t.childNodes,e)+(n>=(r.left+r.right)/2?1:0)}):{node:t,offset:0}}function bv(t,n,i){var e,r,u,o,s,h,f,a,c=t.nodeValue.length,l=-1,v=1e9,d=0;for(e=0;e<c;e++)for(r=El(t,e,e+1).getClientRects(),u=0;u<r.length;u++)if((o=r[u]).top!=o.bottom&&(d||(d=n-o.left),s=(o.top>i?o.top-i:i-o.bottom)-1,o.left-1<=n&&o.right+1>=n&&s<v)){if(f=h=n>=(o.left+o.right)/2,(Ft.chrome||Ft.gecko)&&(a=El(t,e).getBoundingClientRect()).left==o.right&&(f=!h),s<=0)return{node:t,offset:e+(f?1:0)};l=e+(f?1:0),v=s}return{node:t,offset:l>-1?l:d>0?t.nodeValue.length:0}}function Mv(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,b=t.contentDOM.getBoundingClientRect(),M=b.top+t.viewState.paddingTop,x=t.viewState.docHeight,S=n.x,C=n.y,O=C-M;if(O<0)return 0;if(O>x)return t.state.doc.length;for(o=t.defaultLineHeight/2,s=!1;(u=t.elementAtHeight(O)).type!=Gt.Text;)for(;!((O=w>0?u.bottom+o:u.top-o)>=0&&O<=x);){if(s)return i?null:0;s=!0,w=-w}if(C=M+O,(h=u.from)<t.viewport.from)return 0==t.viewport.from?0:i?null:xv(t,b,u,S,C);if(h>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:xv(t,b,u,S,C);if(f=t.dom.ownerDocument,(c=(a=t.root.elementFromPoint?t.root:f).elementFromPoint(S,C))&&!t.contentDOM.contains(c)&&(c=null),c||(S=Math.max(b.left+1,Math.min(b.right-1,S)),(c=a.elementFromPoint(S,C))&&!t.contentDOM.contains(c)&&(c=null)),v=-1,c&&0!=(null===(e=t.docView.nearest(c))||void 0===e?void 0:e.isEditable)&&(f.caretPositionFromPoint?(d=f.caretPositionFromPoint(S,C))&&(l=d.offsetNode,v=d.offset):f.caretRangeFromPoint&&(y=f.caretRangeFromPoint(S,C))&&(l=y.startContainer,v=y.startOffset,(!t.contentDOM.contains(l)||Ft.safari&&Sv(l,v,S)||Ft.chrome&&Cv(l,v,S))&&(l=void 0))),!l||!t.docView.dom.contains(l)){if(!(p=Zt.find(t.docView,h)))return O>u.top+u.height/2?u.to:u.from;l=(k=wv(p.dom,S,C)).node,v=k.offset}return(m=t.docView.nearest(l))?m.isWidget&&1==(null===(r=m.dom)||void 0===r?void 0:r.nodeType)?(g=m.dom.getBoundingClientRect(),n.y<g.top||n.y<=g.bottom&&n.x<=(g.left+g.right)/2?m.posAtStart:m.posAtEnd):m.localPosFromDOM(l,v)+m.posAtStart:null}function xv(t,n,i,e,r){var u,o,s=Math.round((e-n.left)*t.defaultCharacterWidth);return t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(s+=(u=Math.floor((r-i.top)/t.defaultLineHeight))*t.viewState.heightOracle.lineLength),o=t.state.sliceDoc(i.from,i.to),i.from+vl(o,s,t.state.tabSize)}function Sv(t,n,i){var e,r;if(3!=t.nodeType||n!=(e=t.nodeValue.length))return!1;for(r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return El(t,e-1,e).getBoundingClientRect().left>i}function Cv(t,n,i){var e,r,u;if(0!=n)return!1;for(e=t;;){if(!(r=e.parentNode)||1!=r.nodeType||r.firstChild!=e)return!1;if(r.classList.contains("cm-line"))break;e=r}return i-(u=1==t.nodeType?t.getBoundingClientRect():El(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}function Ov(t,n,i,e){var r,u,o,s,h,f=t.state.doc.lineAt(n.head),a=e&&t.lineWrapping?t.coordsAtPos(n.assoc<0&&n.head>f.from?n.head-1:n.head):null;return a&&(r=t.dom.getBoundingClientRect(),u=t.textDirectionAt(f.from),null!=(o=t.posAtCoords({x:i==(u==An.LTR)?r.right-1:r.left+1,y:(a.top+a.bottom)/2})))?m.cursor(o,i?-1:1):(h=(s=Zt.find(t.docView,n.head))?i?s.posAtEnd:s.posAtStart:i?f.to:f.from,m.cursor(h,i?-1:1))}function Av(t,n,i,e){var r,u,o,s,h=t.state.doc.lineAt(n.head),f=t.bidiSpans(h),a=t.textDirectionAt(h.from);for(r=n,u=null;;){if(o=uv(h,f,a,r,i),s=Wn,!o){if(h.number==(i?t.state.doc.lines:1))return r;s="\n",h=t.state.doc.line(h.number+(i?1:-1)),f=t.bidiSpans(h),o=m.cursor(i?h.from:h.to)}if(u){if(!u(s))return r}else{if(!e)return o;u=e(s)}r=o}}function Dv(t,n,i){var e=t.state.charCategorizer(n),r=e(i);return function(t){var n=e(t);return r==G.Space&&(r=n),r==n}}function Ev(t,n,i,e){var r,u,o,s,h,f,a,c,l,v,d,y=n.head,p=i?1:-1;if(y==(i?t.state.doc.length:0))return m.cursor(y,n.assoc);for(r=n.goalColumn,o=t.contentDOM.getBoundingClientRect(),s=t.coordsAtPos(y),h=t.documentTop,s?(null==r&&(r=s.left-o.left),u=p<0?s.top:s.bottom):(f=t.viewState.lineBlockAt(y),null==r&&(r=Math.min(o.right-o.left,t.defaultCharacterWidth*(y-f.from))),u=(p<0?f.top:f.bottom)+h),a=o.left+r,c=null!=e?e:t.defaultLineHeight>>1,l=0;;l+=10)if(d=Mv(t,{x:a,y:v=u+(c+l)*p},!1,p),v<o.top||v>o.bottom||(p<0?d<y:d>y))return m.cursor(d,n.assoc,void 0,r)}function Iv(t,n,i){for(var e=function e(){var r,u,o=0,s=ic(t);try{for(s.s();!(r=s.n()).done;)(u=r.value).between(n-1,n+1,(function(t,e,r){if(n>t&&n<e){var u=o||i||(n-t<e-n?-1:1);n=u<0?t:e,o=u}}))}catch(t){s.e(t)}finally{s.f()}if(!o)return{v:n}},r;;)if(r=e())return r.v}function Rv(t,n,i){var e=Iv(t.state.facet(Mn).map((function(n){return n(t)})),i.from,n.head>i.from?-1:1);return e==i.from?i:m.cursor(e,e<i.from?1:-1)}function Lv(t){return.7*Math.max(0,t)+8}function jv(t,n){var i=t.state.facet(en);return i.length?i[0](n):Ft.mac?n.metaKey:n.ctrlKey}function Tv(t,n){var i=t.state.facet(rn);return i.length?i[0](n):Ft.mac?!n.altKey:!n.ctrlKey}function Bv(t,n){var i,e,r,u,o=t.state.selection.main;if(o.empty)return!1;if(!(i=yl(t.root))||0==i.rangeCount)return!0;for(e=i.getRangeAt(0).getClientRects(),r=0;r<e.length;r++)if((u=e[r]).left<=n.clientX&&u.right>=n.clientX&&u.top<=n.clientY&&u.bottom>=n.clientY)return!0;return!1}function _v(t,n){if(!n.bubbles)return!0;if(n.defaultPrevented)return!1;for(var i=n.target,e;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(e=Ot.get(i))&&e.ignoreEvent(n))return!1;return!0}function Nv(t){var n,i=t.dom.parentNode;i&&((n=i.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((function(){t.focus(),n.remove(),Pv(t,n.value)}),50))}function Pv(t,n){var i,e,r=t.state,u=1,o=r.toText(n),s=o.lines==r.selection.ranges.length,h=null!=ci&&r.selection.ranges.every((function(t){return t.empty}))&&ci==o.toString();h?(e=-1,i=r.changeByRange((function(t){var i,h=r.doc.lineAt(t.from);return h.from==e?{range:t}:(e=h.from,i=r.toText((s?o.line(u++).text:n)+r.lineBreak),{changes:{from:h.from,insert:i},range:m.cursor(t.from+i.length)})}))):i=s?r.changeByRange((function(t){var n=o.line(u++);return{changes:{from:t.from,to:t.to,insert:n.text},range:m.cursor(t.from+n.length)}})):r.replaceSelection(o),t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Fv(t,n,i,e){var r,u,o,s;return 1==e?m.cursor(n,i):2==e?dv(t.state,n,i):(r=Zt.find(t.docView,n),u=t.state.doc.lineAt(r?r.posAtEnd:n),o=r?r.posAtStart:u.from,(s=r?r.posAtEnd:u.to)<t.state.doc.length&&s==u.to&&s++,m.range(o,s))}function Hv(t,n,i,e){var r,u,o,s=Zt.find(t.docView,n);return s?0==(r=n-s.posAtStart)?1:r==s.length||(u=s.coordsAt(r,-1))&&oi(i,e,u)?-1:(o=s.coordsAt(r,1))&&oi(i,e,o)?1:u&&ui(e,u)?-1:1:1}function zv(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1);return{pos:i,bias:Hv(t,i,n.clientX,n.clientY)}}function Wv(t){if(!si)return t.detail;var n=hi,i=ai;return hi=t,ai=Date.now(),fi=!n||i>Date.now()-400&&Math.abs(n.clientX-t.clientX)<2&&Math.abs(n.clientY-t.clientY)<2?(fi+1)%3:1}function Vv(t,n){var i=zv(t,n),e=Wv(n),r=t.state.selection;return{update:function t(n){n.docChanged&&(i.pos=n.changes.mapPos(i.pos),r=r.map(n.changes))},get:function n(u,o,s){var h,f,a,c,l=zv(t,u),v=Fv(t,l.pos,l.bias,e);return i.pos==l.pos||o||(f=Fv(t,i.pos,i.bias,e),a=Math.min(f.from,v.from),c=Math.max(f.to,v.to),v=a<v.from?m.range(a,c):m.range(c,a)),o?r.replaceRange(r.main.extend(v.from,v.to)):s&&1==e&&r.ranges.length>1&&(h=Uv(r,l.pos))?h:s?r.addRange(v):m.create([v])}}}function Uv(t,n){var i,e,r,u;for(i=0;i<t.ranges.length;i++)if(r=(e=t.ranges[i]).from,u=e.to,r<=n&&u>=n)return m.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0));return null}function $v(t,n,i,e){var r,u,o,s,h;i&&(r=t.posAtCoords({x:n.clientX,y:n.clientY},!1),n.preventDefault(),u=t.inputState.mouseSelection,o=e&&u&&u.dragging&&u.dragMove?{from:u.dragging.from,to:u.dragging.to}:null,s={from:r,insert:i},h=t.state.changes(o?[o,s]:s),t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}))}function qv(t,n){var i,e=t.dom.parentNode;e&&((i=e.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",i.value=n,i.focus(),i.selectionEnd=n.length,i.selectionStart=0,setTimeout((function(){i.remove(),t.focus()}),50))}function Gv(t){var n,i,e,r,u,o,s,h=[],f=[],a=!1,c=ic(t.selection.ranges);try{for(c.s();!(n=c.n()).done;)(i=n.value).empty||(h.push(t.sliceDoc(i.from,i.to)),f.push(i))}catch(t){c.e(t)}finally{c.f()}if(!h.length){e=-1,r=ic(t.selection.ranges);try{for(r.s();!(u=r.n()).done;)o=u.value.from,(s=t.doc.lineAt(o)).number>e&&(h.push(s.text),f.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),e=s.number}catch(t){r.e(t)}finally{r.f()}a=!0}return{text:h.join(t.lineBreak),ranges:f,linewise:a}}function Jv(t,n){var i,e,r,u=[],o=ic(t.facet(fn));try{for(o.s();!(i=o.n()).done;)(r=(e=i.value)(t,n))&&u.push(r)}catch(t){o.e(t)}finally{o.f()}return u?t.update({effects:u,annotations:li.of(!0)}):null}function Kv(t){setTimeout((function(){var n,i=t.hasFocus;i!=t.inputState.notifiedFocused&&((n=Jv(t.state,i))?t.dispatch(n):t.update([]))}),10)}function Qv(t,n){var i,e;null==t[n]&&(i=t[n-1])instanceof Mi&&(e=t[n+1])instanceof Mi&&t.splice(n-1,3,new Mi(i.length+1+e.length))}function Xv(t,n,i){var e=new Oi;return tt.compare(t,n,i,e,0),e.changes}function Zv(t,n){var i,e,r,u,o=t.getBoundingClientRect(),s=t.ownerDocument,h=s.defaultView||window,f=Math.max(0,o.left),a=Math.min(h.innerWidth,o.right),c=Math.max(0,o.top),l=Math.min(h.innerHeight,o.bottom);for(i=t.parentNode;i&&i!=s.body;)if(1==i.nodeType)e=i,r=window.getComputedStyle(e),(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)&&"visible"!=r.overflow&&(u=e.getBoundingClientRect(),f=Math.max(f,u.left),a=Math.min(a,u.right),c=Math.max(c,u.top),l=i==t.parentNode?u.bottom:Math.min(l,u.bottom)),i="absolute"==r.position||"fixed"==r.position?e.offsetParent:e.parentNode;else{if(11!=i.nodeType)break;i=i.host}return{left:f-o.left,right:Math.max(f,a)-o.left,top:c-(o.top+n),bottom:Math.max(c,l)-(o.top+n)}}function Yv(t,n){var i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:n,bottom:i.bottom-(i.top+n)}}function td(t,n,i){var e=[],r=t,u=0;return tt.spans(i,t,n,{span:function t(){},point:function t(n,i){n>r&&(e.push({from:r,to:n}),u+=n-r),r=i}},20),r<n&&(e.push({from:r,to:n}),u+=n-r),{total:u,ranges:e}}function nd(t,n){var i,e,r,u,o,s,h=t.total,f=t.ranges;if(n<=0)return f[0].from;if(n>=1)return f[f.length-1].to;for(i=Math.floor(h*n),e=0;;e++){if(u=(r=f[e]).from,i<=(s=(o=r.to)-u))return u+i;i-=s}}function id(t,n){var i,e,r,u,o=0,s=ic(t.ranges);try{for(s.s();!(i=s.n()).done;){if(r=(e=i.value).from,n<=(u=e.to)){o+=n-r;break}o+=u-r}}catch(t){s.e(t)}finally{s.f()}return o/t.total}function ed(t,n){var i,e,r=ic(t);try{for(r.s();!(i=r.n()).done;)if(n(e=i.value))return e}catch(t){r.e(t)}finally{r.f()}}function rd(t,n){if(1==n.scale)return t;var i=n.toDOM(t.top),e=n.toDOM(t.bottom);return new pi(t.from,t.length,i,e-i,t.children&&t.children.map((function(t){return rd(t,n)})),t.deco)}function ud(t,n,i){return new at(n,{finish:function n(e){return/&/.test(e)?e.replace(/&\w*/,(function(n){if("&"==n)return t;if(!i||!i[n])throw new RangeError("Unsupported selector: ".concat(n));return i[n]})):t+" "+e}})}function od(t,n){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,g,w,b,M,x,S,C=n.newSel,O=t.state.selection.main,A=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;return n.bounds?(u=(r=n.bounds).from,o=r.to,s=O.from,h=null,(8===A||Ft.android&&n.text.length<o-u)&&(s=O.to,h="end"),(f=sd(t.state.doc.sliceString(u,o,Vn),n.text,s-u,h))&&(Ft.chrome&&13==A&&f.toB==f.from+2&&n.text.slice(f.from,f.toB)==Vn+Vn&&f.toB--,e={from:u+f.from,to:u+f.toA,insert:i.of(n.text.slice(f.from,f.toB).split(Vn))})):C&&(!t.hasFocus&&t.state.facet(dn)||C.main.eq(O))&&(C=null),!(!e&&!C)&&(!e&&n.typeOver&&!O.empty&&C&&C.main.empty?e={from:O.from,to:O.to,insert:t.state.doc.slice(O.from,O.to)}:e&&e.from>=O.from&&e.to<=O.to&&(e.from!=O.from||e.to!=O.to)&&O.to-O.from-(e.to-e.from)<=4?e={from:O.from,to:O.to,insert:t.state.doc.slice(O.from,e.from).append(e.insert).append(t.state.doc.slice(e.to,O.to))}:(Ft.mac||Ft.android)&&e&&e.from==e.to&&e.from==O.head-1&&/^\. ?$/.test(e.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(C&&2==e.insert.length&&(C=m.single(C.main.anchor-1,C.main.head-1)),e={from:O.from,to:O.to,insert:i.of([" "])}):Ft.chrome&&e&&e.from==e.to&&e.from==O.head&&"\n "==e.insert.toString()&&t.lineWrapping&&(C&&(C=m.single(C.main.anchor-1,C.main.head-1)),e={from:O.from,to:O.to,insert:i.of([" "])}),e?(a=t.state,!(!Ft.ios||!t.inputState.flushIOSKey(t))||(!(!Ft.android||!(e.from==O.from&&e.to==O.to&&1==e.insert.length&&2==e.insert.lines&&Il(t.contentDOM,"Enter",13)||(e.from==O.from-1&&e.to==O.to&&0==e.insert.length||8==A&&e.insert.length<e.to-e.from)&&Il(t.contentDOM,"Backspace",8)||e.from==O.from&&e.to==O.to+1&&0==e.insert.length&&Il(t.contentDOM,"Delete",46)))||(c=e.insert.toString(),t.state.facet(hn).some((function(n){return n(t,e.from,e.to,c)}))||(t.inputState.composing>=0&&t.inputState.composing++,e.from>=O.from&&e.to<=O.to&&e.to-e.from>=(O.to-O.from)/3&&(!C||C.main.empty&&C.main.from==e.from+e.insert.length)&&t.inputState.composing<0?(v=O.from<e.from?a.sliceDoc(O.from,e.from):"",d=O.to>e.to?a.sliceDoc(e.to,O.to):"",l=a.replaceSelection(t.state.toText(v+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))):(y=a.changes(e),p=C&&C.main.to<=y.newLength?C.main:void 0,a.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=O.to&&e.to>=O.to-10?(k=t.state.sliceDoc(e.from,e.to),g=hv(t)||t.state.doc.lineAt(O.head),w=O.to-e.to,b=O.to-O.from,l=a.changeByRange((function(n){var i,r,u,o;return n.from==O.from&&n.to==O.to?{changes:y,range:p||n.map(y)}:(r=(i=n.to-w)-k.length,n.to-n.from!=b||t.state.sliceDoc(r,i)!=k||g&&n.to>=g.from&&n.from<=g.to?{range:n}:(u=a.changes({from:r,to:i,insert:e.insert}),o=n.to-O.to,{changes:u,range:p?m.range(Math.max(0,p.anchor+o),Math.max(0,p.head+o)):n.map(u)}))}))):l={changes:y,selection:p&&a.selection.replaceRange(p)}),M="input.type",(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,M+=".compose",t.inputState.compositionFirstChange&&(M+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(l,{scrollIntoView:!0,userEvent:M})),!0))):!(!C||C.main.eq(O))&&(x=!1,S="select",t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(x=!0),S=t.inputState.lastSelectionOrigin),t.dispatch({selection:C,scrollIntoView:x,userEvent:S}),!0))}function sd(t,n,i,e){for(var r,u,o,s,h,f=Math.min(t.length,n.length),a=0;a<f&&t.charCodeAt(a)==n.charCodeAt(a);)a++;if(a==f&&t.length==n.length)return null;for(r=t.length,u=n.length;r>0&&u>0&&t.charCodeAt(r-1)==n.charCodeAt(u-1);)r--,u--;return"end"==e&&(i-=r+(o=Math.max(0,a-Math.min(r,u)))-a),r<a&&t.length<n.length?(u=(a-=s=i<=a&&i>=r?a-i:0)+(u-r),r=a):u<a&&(r=(a-=h=i<=a&&i>=u?a-i:0)+(r-u),u=a),{from:a,toA:r,toB:u}}function hd(t){var n,i,e,r,u,o=[];return t.root.activeElement!=t.contentDOM||(i=(n=t.observer.selectionRange).anchorNode,e=n.anchorOffset,r=n.focusNode,u=n.focusOffset,i&&(o.push(new $n(i,e)),r==i&&u==e||o.push(new $n(r,u)))),o}function fd(t,n){if(0==t.length)return null;var i=t[0].pos,e=2==t.length?t[1].pos:i;return i>-1&&e>-1?m.single(i+n,e+n):null}function ad(t,n,i){for(var e,r;n;){if((e=Ot.get(n))&&e.parent==t)return e;n=(r=n.parentNode)!=t.dom?r:i>0?n.nextSibling:n.previousSibling}return null}function cd(t){var n,i,e,r,u,o,s=null;function h(t){t.preventDefault(),t.stopImmediatePropagation(),s=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",h,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",h,!0),s?(n=s.startContainer,i=s.startOffset,e=s.endContainer,r=s.endOffset,wl((u=t.docView.domAtPos(t.state.selection.main.anchor)).node,u.offset,e,r)&&(n=(o=[e,r,n,i])[0],i=o[1],e=o[2],r=o[3]),{anchorNode:n,anchorOffset:i,focusNode:e,focusOffset:r}):null}function ld(t,n,i){var e,r,u,o;for(r=(e=t.state.facet(n)).length-1;r>=0;r--)(o="function"==typeof(u=e[r])?u(t):u)&&ql(o,i);return i}function vd(t,n){var i,e,r,u,o,s,h=t.split(/-(?!$)/),f=h[h.length-1];for("Space"==f&&(f=" "),o=0;o<h.length-1;++o)if(s=h[o],/^(cmd|meta|m)$/i.test(s))u=!0;else if(/^a(lt)?$/i.test(s))i=!0;else if(/^(c|ctrl|control)$/i.test(s))e=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);"mac"==n?u=!0:e=!0}return i&&(f="Alt-"+f),e&&(f="Ctrl-"+f),u&&(f="Meta-"+f),r&&(f="Shift-"+f),f}function dd(t,n,i){return n.altKey&&(t="Alt-"+t),n.ctrlKey&&(t="Ctrl-"+t),n.metaKey&&(t="Meta-"+t),!1!==i&&n.shiftKey&&(t="Shift-"+t),t}function yd(t){var n=t.facet(Qi),i=Xi.get(n);return i||Xi.set(n,i=kd(n.reduce((function(t,n){return t.concat(n)}),[]))),i}function pd(t,n,i){return md(yd(t.state),n,t,i)}function kd(t){var n,i,e,r,u,o,s,h,f,a,c,l,v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji,d=Object.create(null),y=Object.create(null),p=function t(n,i){var e=y[n];if(null==e)y[n]=i;else if(e!=i)throw new Error("Key binding "+n+" is used both as a regular binding and as a multi-stroke prefix")},k=function t(n,i,e,r){var u,o,s,h,f,a=d[n]||(d[n]=Object.create(null)),c=i.split(/ (?!$)/).map((function(t){return vd(t,v)})),l=function t(){var i=c.slice(0,s).join(" ");p(i,!0),a[i]||(a[i]={preventDefault:!0,run:[function(t){var e=Zi={view:t,prefix:i,scope:n};return setTimeout((function(){Zi==e&&(Zi=null)}),Yi),!0}]})};for(s=1;s<c.length;s++)l();h=c.join(" "),p(h,!1),f=a[h]||(a[h]={preventDefault:!1,run:(null===(o=null===(u=a.Wde)||void 0===u?void 0:u.run)||void 0===o?void 0:o.slice())||[]}),e&&f.run.push(e),r&&(f.preventDefault=!0)},m=ic(t);try{for(m.s();!(n=m.n()).done;){if(e=(i=n.value).scope?i.scope.split(" "):["editor"],i.any){r=ic(e);try{for(r.s();!(u=r.n()).done;)for(h in o=u.value,(s=d[o]||(d[o]=Object.create(null))).Wde||(s.Wde={preventDefault:!1,run:[]}),s)s[h].run.push(i.any)}catch(t){r.e(t)}finally{r.f()}}if(f=i[v]||i.key){a=ic(e);try{for(a.s();!(c=a.n()).done;)k(l=c.value,f,i.run,i.preventDefault),i.shift&&k(l,"Shift-"+f,i.shift,i.preventDefault)}catch(t){a.e(t)}finally{a.f()}}}}catch(t){m.e(t)}finally{m.f()}return d}function md(t,n,i,e){var r,u,o,s,h,f=dl(n),a=Ic(f,0),c=Lc(a)==f.length&&" "!=f,l="",v=!1;if(Zi&&Zi.view==i&&Zi.scope==e&&(l=Zi.prefix+" ",(v=Yn.indexOf(n.keyCode)<0)&&(Zi=null)),r=new Set,u=function t(e){var u,o,s;if(e){u=ic(e.run);try{for(u.s();!(o=u.n()).done;)if(s=o.value,!r.has(s)&&(r.add(s),s(i,n)))return!0}catch(t){u.e(t)}finally{u.f()}e.preventDefault&&(v=!0)}return!1},o=t[e]){if(u(o[l+dd(f,n,!c)]))return!0;if(c&&(n.altKey||n.metaKey||n.ctrlKey)&&!(Ft.windows&&n.ctrlKey&&n.altKey)&&(s=vt[n.keyCode])&&s!=f){if(u(o[l+dd(s,n,!0)]))return!0;if(n.shiftKey&&(h=dt[n.keyCode])!=f&&h!=s&&u(o[l+dd(h,n,!1)]))return!0}else if(c&&n.shiftKey&&u(o[l+dd(f,n,!0)]))return!0;if(u(o.Wde))return!0}return v}function gd(t){var n=t.scrollDOM.getBoundingClientRect(),i=t.textDirection==An.LTR?n.left:n.right-t.scrollDOM.clientWidth;return{left:i-t.scrollDOM.scrollLeft,top:n.top-t.scrollDOM.scrollTop}}function wd(t,n,i){var e=m.cursor(n);return{from:Math.max(i.from,t.moveToLineBoundary(e,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(e,!0,!0).from),type:Gt.Text}}function bd(t,n){var i,e,r,u=t.lineBlockAt(n);if(Array.isArray(u.type)){i=ic(u.type);try{for(i.s();!(e=i.n()).done;)if((r=e.value).to>n||r.to==n&&(r.to==u.to||r.type==Gt.Text))return r}catch(t){i.e(t)}finally{i.f()}}return u}function Md(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g;return i.to<=t.viewport.from||i.from>=t.viewport.to?[]:(e=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),u=t.textDirection==An.LTR,o=t.contentDOM,s=o.getBoundingClientRect(),h=gd(t),a=(f=o.querySelector(".cm-line"))&&window.getComputedStyle(f),c=s.left+(a?parseInt(a.paddingLeft)+Math.min(0,parseInt(a.textIndent)):0),l=s.right-(a?parseInt(a.paddingRight):0),v=bd(t,e),d=bd(t,r),y=v.type==Gt.Text?v:null,p=d.type==Gt.Text?d:null,t.lineWrapping&&(y&&(y=wd(t,e,y)),p&&(p=wd(t,r,p))),y&&p&&y.from==p.from?b(M(i.from,i.to,y)):(k=y?M(i.from,null,y):x(v,!1),m=p?M(null,i.to,p):x(d,!0),g=[],(y||v).to<(p||d).from-(y&&p?1:0)?g.push(w(c,k.bottom,l,m.top)):k.bottom<m.top&&t.elementAtHeight((k.bottom+m.top)/2).type==Gt.Text&&(k.bottom=m.top=(k.bottom+m.top)/2),b(k).concat(g).concat(b(m))));function w(t,i,e,r){return new te(n,t-h.left,i-h.top-.01,e-t,r-i+.01)}function b(t){var n,i=t.top,e=t.bottom,r=t.horizontal,u=[];for(n=0;n<r.length;n+=2)u.push(w(r[n],i,r[n+1],e));return u}function M(n,i,e){var r,o,s,h,f,a,v,d,y,p,k,m,g,w=1e9,b=-1e9,M=[];function x(n,i,r,o,s){var h=t.coordsAtPos(n,n==e.to?-2:2),f=t.coordsAtPos(r,r==e.from?2:-2);h&&f&&(w=Math.min(h.top,f.top,w),b=Math.max(h.bottom,f.bottom,b),s==An.LTR?M.push(u&&i?c:h.left,u&&o?l:f.right):M.push(!u&&o?c:f.left,!u&&i?l:h.right))}r=null!=n?n:e.from,o=null!=i?i:e.to,s=ic(t.visibleRanges);try{for(s.s();!(h=s.n()).done;)if((f=h.value).to>r&&f.from<o)for(a=Math.max(f.from,r),v=Math.min(f.to,o);;){d=t.state.doc.lineAt(a),y=ic(t.bidiSpans(d));try{for(y.s();!(p=y.n()).done&&(m=(k=p.value).from+d.from,g=k.to+d.from,!(m>=v));)g>a&&x(Math.max(m,a),null==n&&m<=r,Math.min(g,v),null==i&&g>=o,k.dir)}catch(t){y.e(t)}finally{y.f()}if((a=d.to+1)>=v)break}}catch(t){s.e(t)}finally{s.f()}return 0==M.length&&x(r,null==n,o,null==i,t.textDirection),{top:w,bottom:b,horizontal:M}}function x(t,n){var i=s.top+(n?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}function xd(t,n){return t.constructor==n.constructor&&t.eq(n)}function Sd(t){return[kn.define((function(n){return new ne(n,t)})),ie.of(t)]}function Cd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[re.of(t),ue,oe,he,cn.of(!0)]}function Od(t){return t.startState.facet(re)!=t.state.facet(re)}function Ad(t,n){n.style.animationDuration=t.facet(re).cursorBlinkRate+"ms"}function Dd(){return[ae,ce]}function Ed(t,n,i,e,r){n.lastIndex=0;for(var u=t.iterRange(i,e),o=i,s;!u.next().done;o+=u.value.length)if(!u.lineBreak)for(;s=n.exec(u.value);)r(o+s.index,s)}function Id(t,n){var i,e,r,u,o,s,h=t.visibleRanges;if(1==h.length&&h[0].from==t.viewport.from&&h[0].to==t.viewport.to)return h;i=[],e=ic(h);try{for(e.s();!(r=e.n()).done;)o=(u=r.value).from,s=u.to,o=Math.max(t.state.doc.lineAt(o).from,o-n),s=Math.min(t.state.doc.lineAt(s).to,s+n),i.length&&i[i.length-1].to>=o?i[i.length-1].to=s:i.push({from:o,to:s})}catch(t){e.e(t)}finally{e.f()}return i}function Rd(){var t,n;return null==pe&&"undefined"!=typeof document&&document.body&&(n=document.body.style,pe=null!=(null!==(t=n.tabSize)&&void 0!==t?t:n.MozTabSize)),pe||!1}function Ld(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[ke.of(t),jd()]}function jd(){return me||(me=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.decorations=Jt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ke)),this.decorations=this.decorator.createDeco(n)}return kc(t,[{key:"makeDecorator",value:function t(n){var i=this;return new le({regexp:n.specialChars,decoration:function t(e,r,u){var o,s,h,f=r.state.doc,a=Ic(e[0],0);return 9==a?(o=f.lineAt(u),s=r.state.tabSize,h=ll(o.text,s,u-o.from),Jt.replace({widget:new be((s-h%s)*i.view.defaultCharacterWidth)})):i.decorationCache[a]||(i.decorationCache[a]=Jt.replace({widget:new we(n,a)}))},boundary:n.replaceTabs?void 0:/[^]/})}},{key:"update",value:function t(n){var i=n.state.facet(ke);n.startState.facet(ke)!=i?(this.decorator=this.makeDecorator(i),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}}]),t}(),{decorations:function t(n){return n.decorations}}))}function Td(t){return t>=32?ge:10==t?"\u2424":String.fromCharCode(9216+t)}function Bd(){return[Me,wn.of((function(t){var n;return(null===(n=t.plugin(Me))||void 0===n?void 0:n.attrs)||null}))]}function _d(){return Se}function Nd(t){return kn.fromClass(function(){function n(i){yc(this,n),this.view=i,this.placeholder=Jt.set([Jt.widget({widget:new Ce(t),side:1}).range(0)])}return kc(n,[{key:"decorations",get:function t(){return this.view.state.doc.length?Jt.none:this.placeholder}}]),n}(),{decorations:function t(n){return n.decorations}})}function Pd(t,n,i){var e,r,u,o,s,h,f,a,c,l,v=Math.min(n.line,i.line),d=Math.max(n.line,i.line),y=[];if(n.off>Oe||i.off>Oe||n.col<0||i.col<0)for(e=Math.min(n.off,i.off),r=Math.max(n.off,i.off),u=v;u<=d;u++)(o=t.doc.line(u)).length<=r&&y.push(m.range(o.from+e,o.to+r));else for(s=Math.min(n.col,i.col),h=Math.max(n.col,i.col),f=v;f<=d;f++)(c=vl((a=t.doc.line(f)).text,s,t.tabSize,!0))<0?y.push(m.cursor(a.to)):(l=vl(a.text,h,t.tabSize),y.push(m.range(a.from+c,a.from+l)));return y}function Fd(t,n){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-n)/t.defaultCharacterWidth)):-1}function Hd(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1),e=t.state.doc.lineAt(i),r=i-e.from,u=r>Oe?-1:r==e.length?Fd(t,n.clientX):ll(e.text,t.state.tabSize,i-e.from);return{line:e.number,col:u,off:r}}function zd(t,n){var i=Hd(t,n),e=t.state.selection;return i?{update:function t(n){var r,u;n.docChanged&&(r=n.changes.mapPos(n.startState.doc.line(i.line).from),u=n.state.doc.lineAt(r),i={line:u.number,col:i.col,off:Math.min(i.off,u.length)},e=e.map(n.changes))},get:function n(r,u,o){var s,h=Hd(t,r);return h&&(s=Pd(t.state,i,h)).length?o?m.create(s.concat(e.ranges)):m.create(s):e}}:null}function Wd(t){var n=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return Ui.mouseSelectionStyle.of((function(t,i){return n(i)?zd(t,i):null}))}function Vd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Za(Ae[t.key||"Alt"],2),i=n[0],e=n[1],r=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.isDown=!1}return kc(t,[{key:"set",value:function t(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}}]),t}(),{eventHandlers:{keydown:function t(n){this.set(n.keyCode==i||e(n))},keyup:function t(n){n.keyCode!=i&&e(n)||this.set(!1)},mousemove:function t(n){this.set(e(n))}}});return[r,Ui.contentAttributes.of((function(t){var n;return(null===(n=t.plugin(r))||void 0===n?void 0:n.isDown)?De:null}))]}function Ud(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Re.of(t)}function $d(t){var n=t.win;return{top:0,left:0,bottom:n.innerHeight,right:n.innerWidth}}function qd(t){for(var n=t;n;n=n.parentNode)if(1==n.nodeType&&n.classList.contains("cm-tooltip"))return!0;return!1}function Gd(t,n,i,e,r,u){var o,s,h,f,a=document.createRange(),c=t.domAtPos(n),l=t.domAtPos(i);for(a.setEnd(l.node,l.offset),a.setStart(c.node,c.offset),o=a.getClientRects(),a.detach(),s=0;s<o.length;s++)if(h=o[s],(f=Math.max(h.top-r,r-h.bottom,h.left-e,e-h.right))<=u)return!0;return!1}function Jd(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=U.define(),e=x.define({create:function t(){return null},update:function t(e,r){var u,o,s,h,f;if(e&&(n.hideOnChange&&(r.docChanged||r.selection)||n.hideOn&&n.hideOn(r,e)))return null;if(e&&r.docChanged){if(null==(u=r.changes.mapPos(e.pos,-1,v.TrackDel)))return null;(o=Object.assign(Object.create(null),e)).pos=u,null!=e.end&&(o.end=r.changes.mapPos(e.end)),e=o}s=ic(r.effects);try{for(s.s();!(h=s.n()).done;)(f=h.value).is(i)&&(e=f.value),f.is(ze)&&(e=null)}catch(t){s.e(t)}finally{s.f()}return e},provide:function t(n){return Ne.from(n)}});return[e,kn.define((function(r){return new He(r,t,e,i,n.hoverTime||300)})),Fe]}function Kd(t,n){var i,e=t.plugin(je);return e?(i=e.manager.tooltips.indexOf(n))<0?null:e.manager.tooltipViews[i]:null}function Qd(t){return t.facet(Ne).some((function(t){return t}))}function Xd(t){var n;null===(n=t.plugin(je))||void 0===n||n.maybeMeasure()}function Zd(t){return t?[Ve.of(t)]:[]}function Yd(t,n){var i=t.plugin(Ue),e=i?i.specs.indexOf(n):-1;return e>-1?i.panels[e]:null}function ty(t){var n=t.nextSibling;return t.remove(),n}function ny(t){return[iy(),Qe.of(Object.assign(Object.assign({},Ke),t))]}function iy(t){var n=[Ze];return t&&!1===t.fixed&&n.push(Xe.of(!0)),n}function ey(t){return Array.isArray(t)?t:[t]}function ry(t,n,i){for(;t.value&&t.from<=i;)t.from==i&&n.push(t.value),t.next()}function uy(t,n){if(t.length!=n.length)return!1;for(var i=0;i<t.length;i++)if(!t[i].compare(n[i]))return!1;return!0}function oy(t,n){return t.state.facet(er).formatNumber(n,t.state)}function sy(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[er.of(t),iy(),ur]}function hy(t){for(var n=9;n<t;)n=10*n+9;return n}function fy(){return sr}function ay(t){var n=hr.get(t);return n||hr.set(t,n=Jt.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xb7")}})),n}function cy(t){return kn.define((function(n){return{decorations:t.createDeco(n),update:function n(i){this.decorations=t.updateDeco(i,this.decorations)}}}),{decorations:function t(n){return n.decorations}})}function ly(){return fr}function vy(){return ar}function dy(t,n,i,e){switch(t){case-2:return i<n;case-1:return e>=n&&i<n;case 0:return i<n&&e>n;case 1:return i<=n&&e>n;case 2:return e>n;case 4:return!0}}function yy(t,n){for(var i,e=t.childBefore(n);e&&(i=e.lastChild)&&i.to==e.to;)i.type.isError&&i.from==i.to?(t=e,e=i.prevSibling):e=i;return t}function py(t,n,i,e){for(var r,u,o,s,h,f;t.from==t.to||(i<1?t.from>=n:t.from>n)||(i>-1?t.to<=n:t.to<n);){if(!(u=!e&&t instanceof Or&&t.index<0?null:t.parent))return t;t=u}if(o=e?0:Mr.IgnoreOverlays,e)for(h=(s=t).parent;h;h=(s=h).parent)s instanceof Or&&s.index<0&&(null===(r=h.enter(n,i,o))||void 0===r?void 0:r.from)!=s.from&&(t=h);for(;;){if(!(f=t.enter(n,i,o)))return t;t=f}}function ky(t,n,i,e){var r=t.cursor(),u=[];if(!r.firstChild())return u;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return u;for(;;){if(null!=e&&r.type.is(e))return u;if(r.type.is(n)&&u.push(r.node),!r.nextSibling())return null==e?u:[]}}function my(t,n){var i,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.length-1;for(i=t.parent;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(n[e]&&n[e]!=i.name)return!1;e--}}return!0}function gy(t){return t.children.some((function(t){return t instanceof Cr||!t.type.isAnonymous||gy(t)}))}function wy(t){var n,i,e,r,u=t.buffer,o=t.nodeSet,s=t.maxBufferLength,h=void 0===s?vr:s,f=t.reused,a=void 0===f?[]:f,c=t.minRepeatType,l=void 0===c?o.types.length:c,v=Array.isArray(u)?new Sr(u,u.length):u,d=o.types,y=0,p=0;function k(t,n,i,e,r){for(var u,s,f,c,x,S,C,O,A,D,E,I,R,L,j,T=v.id,B=v.start,_=v.end,N=v.size,P=p;N<0;){if(v.next(),-1==N)return u=a[T],i.push(u),void e.push(B-t);if(-3==N)return void(y=T);if(-4==N)return void(p=T);throw new RangeError("Unrecognized record size: ".concat(N))}if(s=d[T],x=B-t,_-B<=h&&(c=b(v.pos-n,r))){for(S=new Uint16Array(c.size-c.skip),C=v.pos-c.size,O=S.length;v.pos>C;)O=M(c.start,S,O);f=new Cr(S,_-c.start,o),x=c.start-t}else{for(A=v.pos-N,v.next(),D=[],E=[],I=T>=l?T:-1,R=0,L=_;v.pos>A;)I>=0&&v.id==I&&v.size>=0?(v.end<=L-h&&(g(D,E,B,R,v.end,L,I,P),R=D.length,L=v.end),v.next()):k(B,A,D,E,I);I>=0&&R>0&&R<D.length&&g(D,E,B,R,B,L,I,P),D.reverse(),E.reverse(),I>-1&&R>0?(j=m(s),f=My(s,D,E,0,D.length,0,_-B,j,j)):f=w(s,D,E,_-B,P-_)}i.push(f),e.push(x)}function m(t){return function(n,i,e){var r=0,u=n.length-1,o,s;if(u>=0&&(o=n[u])instanceof xr){if(!u&&o.type==t&&o.length==e)return o;(s=o.prop(pr.lookAhead))&&(r=i[u]+o.length+s)}return w(t,n,i,e,r)}}function g(t,n,i,e,r,u,s,h){for(var f=[],a=[];t.length>e;)f.push(t.pop()),a.push(n.pop()+i-r);t.push(w(o.types[s],f,a,u-r,h-u)),n.push(r-i)}function w(t,n,i,e){var r,u,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5?arguments[5]:void 0;return y&&(r=[pr.contextHash,y],s=s?[r].concat(s):[r]),o>25&&(u=[pr.lookAhead,o],s=s?[u].concat(s):[u]),new xr(t,n,i,e,s)}function b(t,n){var i,e,r,u,o,s=v.fork(),f=0,a=0,c=0,d=s.end-h,y={size:0,start:0,skip:0};t:for(i=s.pos-t;s.pos>i;)if(e=s.size,s.id==n&&e>=0)y.size=f,y.start=a,y.skip=c,c+=4,f+=4,s.next();else{if(r=s.pos-e,e<0||r<i||s.start<d)break;for(u=s.id>=l?4:0,o=s.start,s.next();s.pos>r;){if(s.size<0){if(-3!=s.size)break t;u+=4}else s.id>=l&&(u+=4);s.next()}a=o,f+=e,c+=u}return(n<0||f==t)&&(y.size=f,y.start=a,y.skip=c),y.size>4?y:void 0}function M(t,n,i){var e,r,u=v.id,o=v.start,s=v.end,h=v.size;if(v.next(),h>=0&&u<l){if(e=i,h>4)for(r=v.pos-(h-4);v.pos>r;)i=M(t,n,i);n[--i]=e,n[--i]=s-t,n[--i]=o-t,n[--i]=u}else-3==h?y=u:-4==h&&(p=u);return i}for(i=[],e=[];v.pos>0;)k(t.start||0,t.bufferStart||0,i,e,-1);return r=null!==(n=t.length)&&void 0!==n?n:i.length?e[0]+i[0].length:0,new xr(d[t.topID],i.reverse(),e.reverse(),r)}function by(t,n){var i,e,r,u;if(!t.isAnonymous||n instanceof Cr||n.type!=t)return 1;if(null==(i=Ir.get(n))){i=1,e=ic(n.children);try{for(e.s();!(r=e.n()).done;){if((u=r.value).type!=t||!(u instanceof xr)){i=1;break}i+=by(t,u)}}catch(t){e.e(t)}finally{e.f()}Ir.set(n,i)}return i}function My(t,n,i,e,r,u,o,s,h){var f,a,c,l,v=0;for(f=e;f<r;f++)v+=by(t,n[f]);function d(n,i,e,r,o){var s,f,v,y,p,k,m;for(s=e;s<r;){for(f=s,v=i[s],y=by(t,n[s]),s++;s<r&&!(y+(p=by(t,n[s]))>=a);s++)y+=p;if(s==f+1){if(y>a){d((k=n[f]).children,k.positions,0,k.children.length,i[f]+o);continue}c.push(n[f])}else m=i[s-1]+n[s-1].length-v,c.push(My(t,n,i,f,s,v,m,null,h));l.push(v+o-u)}}return a=Math.ceil(1.5*v/8),c=[],l=[],d(n,i,e,r,0),(s||h)(c,l,o)}function xy(t,n){return t.length==n.length&&t.every((function(t,i){return t==n[i]}))}function Sy(t){var n,i,e,r=[[]];for(n=0;n<t.length;n++)for(i=0,e=r.length;i<e;i++)r.push(r[i].concat(t[n]));return r.sort((function(t,n){return n.length-t.length}))}function Cy(t){var n,i,e,r,u,o,s,h,f,a,c,l,v,d,y=Object.create(null);for(n in t){i=t[n],Array.isArray(i)||(i=[i]),e=ic(n.split(" "));try{for(e.s();!(r=e.n()).done;)if(u=r.value){for(o=[],s=2,h=u,f=0;;){if("..."==h&&f>0&&f+3==u.length){s=1;break}if(!(a=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(h)))throw new RangeError("Invalid path: "+u);if(o.push("*"==a[0]?"":'"'==a[0][0]?JSON.parse(a[0]):a[0]),(f+=a[0].length)==u.length)break;if(c=u[f++],f==u.length&&"!"==c){s=0;break}if("/"!=c)throw new RangeError("Invalid path: "+u);h=u.slice(f)}if(!(v=o[l=o.length-1]))throw new RangeError("Invalid path: "+u);d=new Fr(i,s,l>0?o.slice(0,l):null),y[v]=d.sort(y[v])}}catch(t){e.e(t)}finally{e.f()}}return Pr.add(y)}function Oy(t,n){var i,e,r,u,o,s,h,f,a,c=Object.create(null),l=ic(t);try{for(l.s();!(i=l.n()).done;)if(e=i.value,Array.isArray(e.tag)){r=ic(e.tag);try{for(r.s();!(u=r.n()).done;)o=u.value,c[o.id]=e.class}catch(t){r.e(t)}finally{r.f()}}else c[e.tag.id]=e.class}catch(t){l.e(t)}finally{l.f()}return h=(s=n||{}).scope,f=s.all,a=void 0===f?null:f,{style:function t(n){var i,e,r,u,o,s,h=a,f=ic(n);try{for(f.s();!(i=f.n()).done;){r=ic((e=i.value).set);try{for(r.s();!(u=r.n()).done;)if(o=u.value,s=c[o.id]){h=h?h+" "+s:s;break}}catch(t){r.e(t)}finally{r.f()}}}catch(t){f.e(t)}finally{f.f()}return h},scope:h}}function Ay(t,n){var i,e,r,u=null,o=ic(t);try{for(o.s();!(i=o.n()).done;)(r=(e=i.value).style(n))&&(u=u?u+" "+r:r)}catch(t){o.e(t)}finally{o.f()}return u}function Dy(t,n,i){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length,u=new Hr(e,Array.isArray(n)?n:[n],i);u.highlightRange(t.cursor(),e,r,"",u.highlighters),u.flush(r)}function Ey(t){for(var n=t.type.prop(Pr);n&&n.context&&!t.matchContext(n.context);)n=n.next;return n||null}function Iy(t){return w.define({combine:t?function(n){return n.concat(t)}:void 0})}function Ry(t,n,i){var e,r=t.facet(yu),u=Ly(t).topNode;if(!r||r.allowsNesting)for(e=u;e;e=e.enter(n,i,Mr.ExcludeBuffers))e.type.isTop&&(u=e);return u}function Ly(t){var n=t.field(ou.state,!1);return n?n.tree:xr.empty}function jy(t,n){var i,e,r,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,o=null===(i=t.field(ou.state,!1))||void 0===i?void 0:i.context;return o?(e=o.viewport,o.updateViewport({from:0,to:n}),r=o.isDone(n)||o.work(u,n)?o.tree:null,o.updateViewport(e),r):null}function Ty(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.doc.length;return(null===(n=t.field(ou.state,!1))||void 0===n?void 0:n.context.isDone(i))||!1}function By(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.viewport.to,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,e=jy(t.state,n,i);return e!=Ly(t.state)&&t.dispatch({}),!!e}function _y(t){var n;return(null===(n=t.plugin(du))||void 0===n?void 0:n.isWorking())||!1}function Ny(t,n,i){return Rr.applyChanges(t,[{fromA:n,toA:i,fromB:n,toB:i}])}function Py(t){var n=t.facet(gu);return 9==n.charCodeAt(0)?t.tabSize*n.length:n.length}function Fy(t,n){var i,e="",r=t.tabSize,u=t.facet(gu)[0];if("\t"==u){for(;n>=r;)e+="\t",n-=r;u=" "}for(i=0;i<n;i++)e+=u;return e}function Hy(t,n){var i,e,r,u,o;t instanceof Q&&(t=new wu(t)),i=ic(t.state.facet(mu));try{for(i.s();!(e=i.n()).done;)if(void 0!==(u=(r=e.value)(t,n)))return u}catch(t){i.e(t)}finally{i.f()}return(o=Ly(t.state))?Wy(t,o,n):null}function zy(t,n,i){var e,r,u,o,s,h=Object.create(null),f=new wu(t,{overrideIndentation:function t(n){var i;return null!==(i=h[n])&&void 0!==i?i:-1}}),a=[];for(e=n;e<=i;)e=(r=t.doc.lineAt(e)).to+1,null!=(u=Hy(f,r.from))&&(/\S/.test(r.text)||(u=0),(o=/^\s*/.exec(r.text)[0])!=(s=Fy(t,u))&&(h[r.from]=u,a.push({from:r.from,to:r.from+o.length,insert:s})));return t.changes(a)}function Wy(t,n,i){return $y(n.resolveInner(i).enterUnfinishedNodesBefore(i),i,t)}function Vy(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Uy(t){var n,i,e,r,u=t.type.prop(bu);return u||((n=t.firstChild)&&(i=n.type.prop(pr.closedBy))?(e=t.lastChild,r=e&&i.indexOf(e.name)>-1,function(t){return Qy(t,!0,1,void 0,r&&!Vy(t)?e.from:void 0)}):null==t.parent?qy:null)}function $y(t,n,i){for(;t;t=t.parent){var e=Uy(t);if(e)return e(Mu.create(i,n,t))}return null}function qy(){return 0}function Gy(t,n){for(var i=n;i;i=i.parent)if(t==i)return!0;return!1}function Jy(t){var n,i,e,r,u,o=t.node,s=o.childAfter(o.from),h=o.lastChild;if(!s)return null;for(n=t.options.simulateBreak,i=t.state.doc.lineAt(s.from),e=null==n||n<=i.from?i.to:Math.min(i.to,n),r=s.to;;){if(!(u=o.childAfter(r))||u==h)return null;if(!u.type.isSkipped)return u.from<e?s:null;r=u.to}}function Ky(t){var n=t.closing,i=t.align,e=void 0===i||i,r=t.units,u=void 0===r?1:r;return function(t){return Qy(t,e,u,n)}}function Qy(t,n,i,e,r){var u=t.textAfter,o=u.match(/^\s*/)[0].length,s=e&&u.slice(o,o+e.length)==e||r==t.pos+o,h=n?Jy(t):null;return h?s?t.column(h.from):t.column(h.to):t.baseIndent+(s?0:t.unit*i)}function Xy(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.except,i=t.units,e=void 0===i?1:i;return function(t){var i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}function Zy(){return Q.transactionFilter.of((function(t){var n,i,e,r,u,o,s,h,f,a,c,l,v,d,y;if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;if(!(n=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head)).length)return t;if(i=t.newDoc,(e=t.newSelection.main.head)>(r=i.lineAt(e)).from+Su)return t;if(u=i.sliceString(r.from,e),!n.some((function(t){return t.test(u)})))return t;s=-1,h=[],f=ic((o=t.state).selection.ranges);try{for(f.s();!(a=f.n()).done;)c=a.value.head,(l=o.doc.lineAt(c)).from!=s&&(s=l.from,null!=(v=Hy(o,l.from))&&(d=/^\s*/.exec(l.text)[0])!=(y=Fy(o,v))&&h.push({from:l.from,to:l.from+d.length,insert:y}))}catch(t){f.e(t)}finally{f.f()}return h.length?[t,{changes:h,sequential:!0}]:t}))}function Yy(t){var n=t.firstChild,i=t.lastChild;return n&&n.to<i.from?{from:n.to,to:i.type.isError?t.to:i.from}:null}function tp(t,n,i){var e,r,u,o,s,h=Ly(t);if(h.length<i)return null;for(r=null,u=e=h.resolveInner(i,1);u;u=u.parent)if(!(u.to<=i||u.from>i)){if(r&&u.from<n)break;(o=u.type.prop(Ou))&&(u.to<h.length-50||h.length==t.doc.length||!np(u))&&(s=o(u,t))&&s.from<=i&&s.from>=n&&s.to>i&&(r=s)}return r}function np(t){var n=t.lastChild;return n&&n.to==t.to&&n.type.isError}function ip(t,n,i){var e,r,u,o=ic(t.facet(Cu));try{for(o.s();!(e=o.n()).done;)if(u=(r=e.value)(t,n,i))return u}catch(t){o.e(t)}finally{o.f()}return tp(t,n,i)}function ep(t,n){var i=n.mapPos(t.from,1),e=n.mapPos(t.to,-1);return i>=e?void 0:{from:i,to:e}}function rp(t){var n,i,e=[],r=ic(t.state.selection.ranges);try{for(i=function i(){var r=n.value.head;if(e.some((function(t){return t.from<=r&&t.to>=r})))return 1;e.push(t.lineBlockAt(r))},r.s();!(n=r.n()).done;)i()}catch(t){r.e(t)}finally{r.f()}return e}function up(t){return t.field(Eu,!1)||tt.empty}function op(t,n,i){var e,r=null;return null===(e=t.field(Eu,!1))||void 0===e||e.between(n,i,(function(t,n){(!r||r.from>t)&&(r={from:t,to:n})})),r}function sp(t,n,i){var e=!1;return t.between(n,n,(function(t,r){t==n&&r==i&&(e=!0)})),e}function hp(t,n){return t.field(Eu,!1)?n:n.concat(U.appendConfig.of(cp()))}function fp(t,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],e=t.state.doc.lineAt(n.from).number,r=t.state.doc.lineAt(n.to).number;return Ui.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(e," ").concat(t.state.phrase("to")," ").concat(r,"."))}function ap(t,n){var i,e;for(i=n;;){if((e=ip(t.state,i.from,i.to))&&e.to>n.from)return e;if(!i.from)return null;i=t.lineBlockAt(i.from-1)}}function cp(t){var n=[Eu,zu];return t&&n.push(Nu.of(t)),n}function lp(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign(Object.assign({},Fu),t),i=new Hu(n,!0),e=new Hu(n,!1),r=kn.fromClass(function(){function t(n){yc(this,t),this.from=n.viewport.from,this.markers=this.buildMarkers(n)}return kc(t,[{key:"update",value:function t(i){(i.docChanged||i.viewportChanged||i.startState.facet(yu)!=i.state.facet(yu)||i.startState.field(Eu,!1)!=i.state.field(Eu,!1)||Ly(i.startState)!=Ly(i.state)||n.foldingChanged(i))&&(this.markers=this.buildMarkers(i.view))}},{key:"buildMarkers",value:function t(n){var r,u,o,s=new nt,h=ic(n.viewportLineBlocks);try{for(h.s();!(r=h.n()).done;)u=r.value,(o=op(n.state,u.from,u.to)?e:ip(n.state,u.from,u.to)?i:null)&&s.add(u.from,u.from,o)}catch(t){h.e(t)}finally{h.f()}return s.finish()}}]),t}()),u=n.domEventHandlers;return[r,ny({class:"cm-foldGutter",markers:function t(n){var i;return(null===(i=n.plugin(r))||void 0===i?void 0:i.markers)||tt.empty},initialSpacer:function t(){return new Hu(n,!1)},domEventHandlers:Object.assign(Object.assign({},u),{click:function t(n,i,e){var r,o;return!(!u.click||!u.click(n,i,e))||((r=op(n.state,i.from,i.to))?(n.dispatch({effects:Du.of(r)}),!0):!!(o=ip(n.state,i.from,i.to))&&(n.dispatch({effects:Au.of(o)}),!0))}})}),cp()]}function vp(t){var n=t.facet(Vu);return n.length?n:t.facet(Uu)}function dp(t,n){var i=[qu],e;return t instanceof Wu&&(t.module&&i.push(Ui.styleModule.of(t.module)),e=t.themeType),(null==n?void 0:n.fallback)?i.push(Uu.of(t)):e?i.push(Vu.computeN([Ui.darkTheme],(function(n){return n.facet(Ui.darkTheme)==("dark"==e)?[t]:[]}))):i.push(Vu.of(t)),i}function yp(t,n,i){var e,r,u,o,s=vp(t),h=null;if(s){e=ic(s);try{for(e.s();!(r=e.n()).done;)(!(u=r.value).scope||i&&u.scope(i))&&(o=u.style(n))&&(h=h?h+" "+o:o)}catch(t){e.e(t)}finally{e.f()}}return h}function pp(t){var n=[],i=t.matched?Zu:Yu;return n.push(i.range(t.start.from,t.start.to)),t.end&&n.push(i.range(t.end.from,t.end.to)),n}function kp(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Xu.of(t),no]}function mp(t,n,i){var e,r=t.prop(n<0?pr.openedBy:pr.closedBy);return r||(1==t.name.length&&(e=i.indexOf(t.name))>-1&&e%2==(n<0?1:0)?[i[e+n]]:null)}function gp(t){var n=t.type.prop(io);return n?n(t.node):t}function wp(t,n,i){var e,r,u,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=o.maxScanDistance||Ku,h=o.brackets||Qu,f=Ly(t),a=f.resolveInner(n,i);for(e=a;e;e=e.parent)if((r=mp(e.type,i,h))&&e.from<e.to&&(u=gp(e))&&(i>0?n>=u.from&&n<u.to:n>u.from&&n<=u.to))return bp(t,n,i,e,u,r,h);return Mp(t,n,i,f,a.type,s,h)}function bp(t,n,i,e,r,u,o){var s,h,f=e.parent,a={from:r.from,to:r.to},c=0,l=null==f?void 0:f.cursor();if(l&&(i<0?l.childBefore(e.from):l.childAfter(e.to)))do{if(i<0?l.to<=e.from:l.from>=e.to){if(0==c&&u.indexOf(l.type.name)>-1&&l.from<l.to)return{start:a,end:(s=gp(l))?{from:s.from,to:s.to}:void 0,matched:!0};if(mp(l.type,i,o))c++;else if(mp(l.type,-i,o)){if(0==c)return{start:a,end:(h=gp(l))&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1};c--}}}while(i<0?l.prevSibling():l.nextSibling());return{start:a,matched:!1}}function Mp(t,n,i,e,r,u,o){var s,h,f,a,c,l,v,d,y,p=i<0?t.sliceDoc(n-1,n):t.sliceDoc(n,n+1),k=o.indexOf(p);if(k<0||k%2==0!=i>0)return null;for(s={from:i<0?n-1:n,to:i>0?n+1:n},h=t.doc.iterRange(n,i>0?t.doc.length:0),f=0,a=0;!h.next().done&&a<=u;){for(c=h.value,i<0&&(a+=c.length),l=n+a*i,v=i>0?0:c.length-1,d=i>0?c.length:-1;v!=d;v+=i)if(!((y=o.indexOf(c[v]))<0||e.resolveInner(l+v,1).type!=r))if(y%2==0==i>0)f++;else{if(1==f)return{start:s,end:{from:l+v,to:l+v+1},matched:y>>1==k>>1};f--}i>0&&(a+=c.length)}return h.done?{start:s,matched:!1}:null}function xp(t,n,i){var e,r,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;for(null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length),e=o,r=u;r<n;r++)9==t.charCodeAt(r)?e+=i-e%i:e++;return e}function Sp(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||function(){},startState:t.startState||function(){return!0},copyState:t.copyState||Cp,indent:t.indent||function(){return null},languageData:t.languageData||{},tokenTable:t.tokenTable||so}}function Cp(t){var n,i,e;if("object"!=dc(t))return t;for(i in n={},t)e=t[i],n[i]=e instanceof Array?e.slice():e;return n}function Op(t,n,i,e,r){var u,o,s,h,f=i>=e&&i+n.length<=r&&n.prop(t.stateAfter);if(f)return{state:t.streamParser.copyState(f),pos:i+n.length};for(u=n.children.length-1;u>=0;u--)if(o=n.children[u],s=i+n.positions[u],h=o instanceof xr&&s<r&&Op(t,o,s,e,r))return h;return null}function Ap(t,n,i,e,r){var u,o,s,h;if(r&&i<=0&&e>=n.length)return n;for(r||n.type!=t.topNode||(r=!0),u=n.children.length-1;u>=0;u--)if(o=n.positions[u],s=n.children[u],h=void 0,o<e&&s instanceof xr){if(!(h=Ap(t,s,i-o,e-o,r)))break;return r?new xr(n.type,n.children.slice(0,u).concat(h),n.positions.slice(0,u+1),o+h.length):h}return null}function Dp(t,n,i,e){var r,u,o,s,h,f,a=ic(n);try{for(a.s();!(r=a.n()).done;)if(o=(u=r.value).from+(u.openStart?25:0),s=u.to-(u.openEnd?25:0),h=o<=i&&s>i&&Op(t,u.tree,0-u.offset,i,s),f=void 0,h&&(f=Ap(t,u.tree,i+u.offset,h.pos+u.offset,!1)))return{state:h.state,tree:f}}catch(t){a.e(t)}finally{a.f()}return{state:t.streamParser.startState(e?Py(e):4),tree:xr.empty}}function Ep(t,n,i){var e,r;for(n.start=n.pos,e=0;e<10;e++)if(r=t(n,i),n.pos>n.start)return r;throw new Error("Stream parser failed to advance stream.")}for(Fn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Hn=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.level=e}return kc(t,[{key:"dir",get:function t(){return this.level%2?En:Dn}},{key:"side",value:function t(n,i){return this.dir==i==n?this.to:this.from}}],[{key:"find",value:function t(n,i,e,r){var u,o,s=-1;for(u=0;u<n.length;u++)if((o=n[u]).from<=i&&o.to>=i){if(o.level==e)return u;(s<0||(0!=r?r<0?o.from<i:o.to>i:n[s].level>o.level))&&(s=u)}if(s<0)throw new RangeError("Index out of range");return s}}]),t}(),zn=[],Wn="",Vn="\uffff",Un=function(){function t(n,i){yc(this,t),this.points=n,this.text="",this.lineSeparator=i.facet(Q.lineSeparator)}return kc(t,[{key:"append",value:function t(n){this.text+=n}},{key:"lineBreak",value:function t(){this.text+=Vn}},{key:"readRange",value:function t(n,i){var e,r,u,o,s,h;if(!n)return this;for(e=n.parentNode,r=n;this.findPointBefore(e,r),u=this.text.length,this.readNode(r),(o=r.nextSibling)!=i;)s=Ot.get(r),h=Ot.get(o),(s&&h?s.breakAfter:(s?s.breakAfter:ov(r))||ov(o)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>u)&&this.lineBreak(),r=o;return this.findPointBefore(e,i),this}},{key:"readTextNode",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l=n.nodeValue,v=ic(this.points);try{for(v.s();!(i=v.n()).done;)(e=i.value).node==n&&(e.pos=this.text.length+Math.min(e.offset,l.length))}catch(t){v.e(t)}finally{v.f()}for(r=0,u=this.lineSeparator?null:/\r\n?|\n/g;o=-1,s=1,h=void 0,this.lineSeparator?(o=l.indexOf(this.lineSeparator,r),s=this.lineSeparator.length):(h=u.exec(l))&&(o=h.index,s=h[0].length),this.append(l.slice(r,o<0?l.length:o)),!(o<0);){if(this.lineBreak(),s>1){f=ic(this.points);try{for(f.s();!(a=f.n()).done;)(c=a.value).node==n&&c.pos>this.text.length&&(c.pos-=s-1)}catch(t){f.e(t)}finally{f.f()}}r=o+s}}},{key:"readNode",value:function t(n){var i,e,r;if(!n.cmIgnore)if(null!=(e=(i=Ot.get(n))&&i.overrideDOMText))for(this.findPointInside(n,e.length),r=e.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value);else 3==n.nodeType?this.readTextNode(n):"BR"==n.nodeName?n.nextSibling&&this.lineBreak():1==n.nodeType&&this.readRange(n.firstChild,null)}},{key:"findPointBefore",value:function t(n,i){var e,r,u=ic(this.points);try{for(u.s();!(e=u.n()).done;)(r=e.value).node==n&&n.childNodes[r.offset]==i&&(r.pos=this.text.length)}catch(t){u.e(t)}finally{u.f()}}},{key:"findPointInside",value:function t(n,i){var e,r,u=ic(this.points);try{for(u.s();!(e=u.n()).done;)r=e.value,(3==n.nodeType?r.node==n:n.contains(r.node))&&(r.pos=this.text.length+Math.min(i,r.offset))}catch(t){u.e(t)}finally{u.f()}}}]),t}(),$n=kc((function t(n,i){yc(this,t),this.node=n,this.offset=i,this.pos=-1})),qn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).view=t,e.compositionDeco=Jt.none,e.decorations=[],e.dynamicDecorationMap=[],e.minWidth=0,e.minWidthFrom=0,e.minWidthTo=0,e.impreciseAnchor=null,e.impreciseHead=null,e.forceSelection=!1,e.lastUpdate=Date.now(),e.setDOM(t.contentDOM),e.children=[new Zt],e.children[0].setParent(cc(e)),e.updateDeco(),e.updateInner([new Cn(0,0,0,t.state.doc.length)],0),e}return kc(i,[{key:"length",get:function t(){return this.view.state.doc.length}},{key:"update",value:function t(n){var i,e,r,u=this,o=n.changedRanges;return this.minWidth>0&&o.length&&(o.every((function(t){var n=t.fromA,i;return t.toA<u.minWidthFrom||n>u.minWidthTo}))?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=Jt.none:(n.transactions.length||this.dirty)&&(this.compositionDeco=fv(this.view,n.changes)),(Ft.ie||Ft.chrome)&&!this.compositionDeco.size&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0),r=lv(i=this.decorations,e=this.updateDeco(),n.changes),o=Cn.extendWithRanges(o,r),(0!=this.dirty||0!=o.length)&&(this.updateInner(o,n.startState.doc.length),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function t(n,i){var e,r,u,o,s,h=this;if(this.view.viewState.mustMeasureContent=!0,this.updateChildren(n,i),(e=this.view.observer).ignore((function(){h.dom.style.height=h.view.viewState.contentHeight+"px",h.dom.style.flexBasis=h.minWidth?h.minWidth+"px":"";var t=Ft.chrome||Ft.ios?{node:e.selectionRange.focusNode,written:!1}:void 0;h.sync(h.view,t),h.dirty=0,t&&(t.written||e.selectionRange.focusNode!=t.node)&&(h.forceSelection=!0),h.dom.style.height=""})),r=[],this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){u=ic(this.children);try{for(u.s();!(o=u.n()).done;)(s=o.value)instanceof Yt&&s.widget instanceof Gn&&r.push(s.dom)}catch(t){u.e(t)}finally{u.f()}}e.updateGaps(r)}},{key:"updateChildren",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=this.childCursor(i);for(e=n.length-1;r=e>=0?n[e]:null;e--)u=r.fromA,o=r.toA,s=r.fromB,h=r.toB,a=(f=tn.build(this.view.state.doc,s,h,this.decorations,this.dynamicDecorationMap)).content,c=f.breakAtStart,l=f.openStart,v=f.openEnd,y=(d=w.findPos(o,1)).i,p=d.off,Bl(this,m=(k=w.findPos(u,-1)).i,g=k.off,y,p,a,c,l,v)}},{key:"updateSelection",value:function t(){var n,i,e,r,u,o,s,h,f,a=this,c=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!c&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange(),i=(n=this.view.root.activeElement)==this.dom,e=!i&&ml(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n)),(i||l||e)&&(r=this.forceSelection,this.forceSelection=!1,u=this.view.state.selection.main,o=this.domAtPos(u.anchor),s=u.empty?o:this.domAtPos(u.head),Ft.gecko&&u.empty&&!this.compositionDeco.size&&sv(o)&&(h=document.createTextNode(""),this.view.observer.ignore((function(){return o.node.insertBefore(h,o.node.childNodes[o.offset]||null)})),o=s=new St(h,0),r=!0),f=this.view.observer.selectionRange,!r&&f.focusNode&&wl(o.node,o.offset,f.anchorNode,f.anchorOffset)&&wl(s.node,s.offset,f.focusNode,f.focusOffset)||(this.view.observer.ignore((function(){var t,i,r,h,c;if(Ft.android&&Ft.chrome&&a.dom.contains(f.focusNode)&&vv(f.focusNode,a.dom)&&(a.dom.blur(),a.dom.focus({preventScroll:!0})),t=yl(a.view.root))if(u.empty)Ft.gecko&&(i=cv(o.node,o.offset))&&3!=i&&(r=av(o.node,o.offset,1==i?1:-1))&&(o=new St(r,1==i?0:r.nodeValue.length)),t.collapse(o.node,o.offset),null!=u.bidiLevel&&null!=f.cursorBidiLevel&&(f.cursorBidiLevel=u.bidiLevel);else if(t.extend){t.collapse(o.node,o.offset);try{t.extend(s.node,s.offset)}catch(t){}}else h=document.createRange(),u.anchor>u.head&&(o=(c=[s,o])[0],s=c[1]),h.setEnd(s.node,s.offset),h.setStart(o.node,o.offset),t.removeAllRanges(),t.addRange(h);else;e&&a.view.root.activeElement==a.dom&&(a.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(o,s)),this.impreciseAnchor=o.precise?null:new St(f.anchorNode,f.anchorOffset),this.impreciseHead=s.precise?null:new St(f.focusNode,f.focusOffset))}},{key:"enforceCursorAssoc",value:function t(){var n,i,e,r,u,o,s,h,f,a,c,l;this.compositionDeco.size||(i=(n=this.view).state.selection.main,e=yl(n.root),u=(r=n.observer.selectionRange).anchorNode,o=r.anchorOffset,e&&i.empty&&i.assoc&&e.modify&&(s=Zt.find(this,i.head))&&(h=s.posAtStart,i.head!=h&&i.head!=h+s.length&&(f=this.coordsAt(i.head,-1),a=this.coordsAt(i.head,1),!f||!a||f.bottom>a.top||(c=this.domAtPos(i.head+i.assoc),e.collapse(c.node,c.offset),e.modify("move",i.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange(),l=n.observer.selectionRange,n.docView.posFromDOM(l.anchorNode,l.anchorOffset)!=i.from&&e.collapse(u,o)))))}},{key:"nearest",value:function t(n){var i,e;for(i=n;i;){if((e=Ot.get(i))&&e.rootView==this)return e;i=i.parentNode}return null}},{key:"posFromDOM",value:function t(n,i){var e=this.nearest(n);if(!e)throw new RangeError("Trying to find position for a DOM position outside of the document");return e.localPosFromDOM(n,i)+e.posAtStart}},{key:"domAtPos",value:function t(n){for(var i,e=this.childCursor().findPos(n,-1),r=e.i,u=e.off;r<this.children.length-1&&!(u<(i=this.children[r]).length||i instanceof Zt);)r++,u=0;return this.children[r].domAtPos(u)}},{key:"coordsAt",value:function t(n,i){var e,r,u,o;for(e=this.length,r=this.children.length-1;;r--){if(n>(o=e-(u=this.children[r]).breakAfter-u.length)||n==o&&u.type!=Gt.WidgetBefore&&u.type!=Gt.WidgetAfter&&(!r||2==i||this.children[r-1].breakAfter||this.children[r-1].type==Gt.WidgetBefore&&i>-2))return u.coordsAt(n-o,i);e=o}}},{key:"measureVisibleLineHeights",value:function t(n){var i,e,r,u,o,s,h,f,a,c=[],l=n.from,v=n.to,d=this.view.contentDOM.clientWidth,y=d>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,p=-1,k=this.view.textDirection==An.LTR;for(i=0,e=0;e<this.children.length&&!((u=i+(r=this.children[e]).length)>v);e++)i>=l&&(o=r.dom.getBoundingClientRect(),c.push(o.height),y&&(h=(s=r.dom.lastChild)?gl(s):[]).length&&(f=h[h.length-1],(a=k?f.right-o.left:o.right-f.left)>p&&(p=a,this.minWidth=d,this.minWidthFrom=i,this.minWidthTo=u))),i=u+r.breakAfter;return c}},{key:"textDirectionAt",value:function t(n){var i,e=this.childPos(n,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?An.RTL:An.LTR}},{key:"measureTextSize",value:function t(){var n,i,e,r,u,o,s,h=this,f=ic(this.children);try{for(f.s();!(n=f.n()).done;)if((i=n.value)instanceof Zt&&(e=i.measureTextSize()))return e}catch(t){f.e(t)}finally{f.f()}return(r=document.createElement("div")).className="cm-line",r.style.width="99999px",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){h.dom.appendChild(r);var t=gl(r.firstChild)[0];u=r.getBoundingClientRect().height,o=t?t.width/27:7,s=t?t.height:u,r.remove()})),{lineHeight:u,charWidth:o,textHeight:s}}},{key:"childCursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,i=this.children.length;return i&&(n-=this.children[--i].length),new At(this.children,n,i)}},{key:"computeBlockGapDeco",value:function t(){var n,i,e,r,u,o=[],s=this.view.viewState;for(n=0,i=0;(r=(e=i==s.viewports.length?null:s.viewports[i])?e.from-1:this.length)>n&&(u=s.lineBlockAt(r).bottom-s.lineBlockAt(n).top,o.push(Jt.replace({widget:new Gn(u),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))),e;i++)n=e.to+1;return Jt.set(o)}},{key:"updateDeco",value:function t(){var n,i=this,e=this.view.state.facet(bn).map((function(t,n){var e;return(i.dynamicDecorationMap[n]="function"==typeof t)?t(i.view):t}));for(n=e.length;n<e.length+3;n++)this.dynamicDecorationMap[n]=!1;return this.decorations=[].concat(Ja(e),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function t(n){var i,e,r,u=n.range,o=this.coordsAt(u.head,u.empty?u.assoc:u.head>u.anchor?-1:1);o&&(!u.empty&&(i=this.coordsAt(u.anchor,u.anchor>u.head?-1:1))&&(o={left:Math.min(o.left,i.left),top:Math.min(o.top,i.top),right:Math.max(o.right,i.right),bottom:Math.max(o.bottom,i.bottom)}),e=tv(this.view),r={left:o.left-e.left,top:o.top-e.top,right:o.right+e.right,bottom:o.bottom+e.bottom},Ol(this.view.scrollDOM,r,u.head<u.anchor?-1:1,n.x,n.y,n.xMargin,n.yMargin,this.view.textDirection==An.LTR))}}]),i}(Ot),Gn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).height=t,e}return kc(i,[{key:"toDOM",value:function t(){var n=document.createElement("div");return this.updateDOM(n),n}},{key:"eq",value:function t(n){return n.height==this.height}},{key:"updateDOM",value:function t(n){return n.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function t(){return this.height}}]),i}(qt),Jn=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this)).top=t,u.text=e,u.topView=r,u}return kc(i,[{key:"eq",value:function t(n){return this.top==n.top&&this.text==n.text}},{key:"toDOM",value:function t(){return this.top}},{key:"ignoreEvent",value:function t(){return!1}},{key:"customView",get:function t(){return Ut}}]),i}(qt),Kn=function(){function t(){yc(this,t),this.changes=[]}return kc(t,[{key:"compareRange",value:function t(n,i){Xl(n,i,this.changes)}},{key:"comparePoint",value:function t(n,i){Xl(n,i,this.changes)}}]),t}(),Qn=function(){function t(n){var i,e,r,u=this;for(r in yc(this,t),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,i=function t(i,e){u.ignoreDuringComposition(e)||"keydown"==e.type&&u.keydown(n,e)||(u.mustFlushObserver(e)&&n.observer.forceFlush(),u.runCustomHandlers(e.type,n,e)?e.preventDefault():i(n,e))},e=function t(){var e=ii[r];n.contentDOM.addEventListener(r,(function(t){_v(n,t)&&i(e,t)}),ei[r]),u.registeredEvents.push(r)},ii)e();n.scrollDOM.addEventListener("mousedown",(function(t){if(t.target==n.scrollDOM&&t.clientY>n.contentDOM.getBoundingClientRect().bottom&&(i(ii.mousedown,t),!t.defaultPrevented&&2==t.button)){var e=n.contentDOM.style.minHeight;n.contentDOM.style.minHeight="100%",setTimeout((function(){return n.contentDOM.style.minHeight=e}),200)}})),n.scrollDOM.addEventListener("drop",(function(t){t.target==n.scrollDOM&&t.clientY>n.contentDOM.getBoundingClientRect().bottom&&i(ii.drop,t)})),Ft.chrome&&102==Ft.chrome_version&&n.scrollDOM.addEventListener("wheel",(function(){u.chromeScrollHack<0?n.contentDOM.style.pointerEvents="none":window.clearTimeout(u.chromeScrollHack),u.chromeScrollHack=setTimeout((function(){u.chromeScrollHack=-1,n.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=n.hasFocus,Ft.safari&&n.contentDOM.addEventListener("input",(function(){return null}))}return kc(t,[{key:"setSelectionOrigin",value:function t(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function t(n,i){var e,r,u,o,s,h,f,a=this;this.customHandlers=[],u=ic(i);try{for(u.s();!(o=u.n()).done;)if(r=null===(e=(s=o.value).update(n).spec)||void 0===e?void 0:e.domEventHandlers)for(f in this.customHandlers.push({plugin:s.value,handlers:r}),h=function t(i){a.registeredEvents.indexOf(i)<0&&"scroll"!=i&&(a.registeredEvents.push(i),n.contentDOM.addEventListener(i,(function(t){_v(n,t)&&a.runCustomHandlers(i,n,t)&&t.preventDefault()})))},r)h(f)}catch(t){u.e(t)}finally{u.f()}}},{key:"runCustomHandlers",value:function t(n,i,e){var r,u,o,s=ic(this.customHandlers);try{for(s.s();!(r=s.n()).done;)if(o=(u=r.value).handlers[n])try{if(o.call(u.plugin,e,i)||e.defaultPrevented)return!0}catch(t){Yl(i.state,t)}}catch(t){s.e(t)}finally{s.f()}return!1}},{key:"runScrollHandlers",value:function t(n,i){var e,r,u,o;this.lastScrollTop=n.scrollDOM.scrollTop,this.lastScrollLeft=n.scrollDOM.scrollLeft,e=ic(this.customHandlers);try{for(e.s();!(r=e.n()).done;)if(o=(u=r.value).handlers.scroll)try{o.call(u.plugin,i,n)}catch(t){Yl(n.state,t)}}catch(t){e.e(t)}finally{e.f()}}},{key:"keydown",value:function t(n,i){var e,r=this;return this.lastKeyCode=i.keyCode,this.lastKeyTime=Date.now(),9==i.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=i.keyCode&&Yn.indexOf(i.keyCode)<0&&(n.inputState.lastEscPress=0),!Ft.android||!Ft.chrome||i.synthetic||13!=i.keyCode&&8!=i.keyCode?!(!Ft.ios||i.synthetic||i.altKey||i.metaKey||!((e=Xn.find((function(t){return t.keyCode==i.keyCode})))&&!i.ctrlKey||Zn.indexOf(i.key)>-1&&i.ctrlKey&&!i.shiftKey))&&(this.pendingIOSKey=e||i,setTimeout((function(){return r.flushIOSKey(n)}),250),!0):(n.observer.delayAndroidKey(i.key,i.keyCode),!0))}},{key:"flushIOSKey",value:function t(n){var i=this.pendingIOSKey;return!!i&&(this.pendingIOSKey=void 0,Il(n.contentDOM,i.key,i.keyCode))}},{key:"ignoreDuringComposition",value:function t(n){return!!/^key/.test(n.type)&&(this.composing>0||!!(Ft.safari&&!Ft.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"mustFlushObserver",value:function t(n){return"keydown"==n.type&&229!=n.keyCode}},{key:"startMouseSelection",value:function t(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}},{key:"update",value:function t(n){this.mouseSelection&&this.mouseSelection.update(n),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function t(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}(),Xn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Zn="dthko",Yn=[16,17,18,20,91,92,224,225],ti=6,ni=function(){function t(n,i,e,r){yc(this,t),this.view=n,this.style=e,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParent=Al(n.contentDOM),this.atoms=n.state.facet(Mn).map((function(t){return t(n)}));var u=n.contentDOM.ownerDocument;u.addEventListener("mousemove",this.move=this.move.bind(this)),u.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=n.state.facet(Q.allowMultipleSelections)&&jv(n,i),this.dragMove=Tv(n,i),this.dragging=!(!Bv(n,i)||1!=Wv(i))&&null}return kc(t,[{key:"start",value:function t(n){!1===this.dragging&&(n.preventDefault(),this.select(n))}},{key:"move",value:function t(n){var i,e,r,u,o;if(0==n.buttons)return this.destroy();!1===this.dragging&&(this.select(this.lastEvent=n),e=0,r=0,u=(null===(i=this.scrollParent)||void 0===i?void 0:i.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=tv(this.view),n.clientX-o.left<=u.left+ti?e=-Lv(u.left-n.clientX):n.clientX+o.right>=u.right-ti&&(e=Lv(n.clientX-u.right)),n.clientY-o.top<=u.top+ti?r=-Lv(u.top-n.clientY):n.clientY+o.bottom>=u.bottom-ti&&(r=Lv(n.clientY-u.bottom)),this.setScrollSpeed(e,r))}},{key:"up",value:function t(n){null==this.dragging&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}},{key:"destroy",value:function t(){this.setScrollSpeed(0,0);var n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function t(n,i){var e=this;this.scrollSpeed={x:n,y:i},n||i?this.scrolling<0&&(this.scrolling=setInterval((function(){return e.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function t(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function t(n){var i,e,r,u,o,s,h=null;for(i=0;i<n.ranges.length;i++)r=null,(e=n.ranges[i]).empty?(u=Iv(this.atoms,e.from,0))!=e.from&&(r=m.cursor(u,-1)):(o=Iv(this.atoms,e.from,-1),s=Iv(this.atoms,e.to,1),o==e.from&&s==e.to||(r=m.range(e.from==e.anchor?o:s,e.from==e.head?o:s))),r&&(h||(h=n.ranges.slice()),h[i]=r);return h?m.create(h,n.mainIndex):n}},{key:"select",value:function t(n){var i=this.view,e=this.skipAtoms(this.style.get(n,this.extend,this.multiple));!this.mustSelect&&e.eq(i.state.selection)&&e.main.assoc==i.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function t(n){var i=this;n.docChanged&&this.dragging&&(this.dragging=this.dragging.map(n.changes)),this.style.update(n)&&setTimeout((function(){return i.select(i.lastEvent)}),20)}}]),t}(),ii=Object.create(null),ei=Object.create(null),ri=Ft.ie&&Ft.ie_version<15||Ft.ios&&Ft.webkit_version<604,ii.keydown=function(t,n){t.inputState.setSelectionOrigin("select"),27==n.keyCode&&(t.inputState.lastEscPress=Date.now())},ii.touchstart=function(t,n){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},ii.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},ei.touchstart=ei.touchmove={passive:!0},ii.mousedown=function(t,n){var i,e,r,u,o;if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){i=null,e=ic(t.state.facet(un));try{for(e.s();!(r=e.n()).done&&!(i=(u=r.value)(t,n)););}catch(t){e.e(t)}finally{e.f()}i||0!=n.button||(i=Vv(t,n)),i&&(o=t.root.activeElement!=t.contentDOM,t.inputState.startMouseSelection(new ni(t,n,i,o)),o&&t.observer.ignore((function(){return Dl(t.contentDOM)})),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(n))}},ui=function t(n,i){return n>=i.top&&n<=i.bottom},oi=function t(n,i,e){return ui(i,e)&&n>=e.left&&n<=e.right},si=Ft.ie&&Ft.ie_version<=11,hi=null,fi=0,ai=0,ii.dragstart=function(t,n){var i=t.state.selection.main,e=t.inputState.mouseSelection;e&&(e.dragging=i),n.dataTransfer&&(n.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),n.dataTransfer.effectAllowed="copyMove")},ii.drop=function(t,n){var i,e,r,u,o,s;if(n.dataTransfer){if(t.state.readOnly)return n.preventDefault();if((i=n.dataTransfer.files)&&i.length)for(n.preventDefault(),e=Array(i.length),r=0,u=function u(){++r==i.length&&$v(t,n,e.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},o=function t(n){var r=new FileReader;r.onerror=u,r.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(e[n]=r.result),u()},r.readAsText(i[n])},s=0;s<i.length;s++)o(s);else $v(t,n,n.dataTransfer.getData("Text"),!0)}},ii.paste=function(t,n){if(t.state.readOnly)return n.preventDefault();t.observer.flush();var i=ri?null:n.clipboardData;i?(Pv(t,i.getData("text/plain")||i.getData("text/uri-text")),n.preventDefault()):Nv(t)},ci=null,ii.copy=ii.cut=function(t,n){var i,e=Gv(t.state),r=e.text,u=e.ranges,o=e.linewise;(r||o)&&(ci=o?r:null,(i=ri?null:n.clipboardData)?(n.preventDefault(),i.clearData(),i.setData("text/plain",r)):qv(t,r),"cut"!=n.type||t.state.readOnly||t.dispatch({changes:u,scrollIntoView:!0,userEvent:"delete.cut"}))},li=z.define(),ii.focus=function(t){t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Kv(t)},ii.blur=function(t){t.observer.clearSelectionRange(),Kv(t)},ii.compositionstart=ii.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},ii.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ft.chrome&&Ft.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((function(){return t.observer.flush()})):setTimeout((function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},ii.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},ii.beforeinput=function(t,n){var i,e,r;Ft.chrome&&Ft.android&&(e=Xn.find((function(t){return t.inputType==n.inputType})))&&(t.observer.delayAndroidKey(e.key,e.keyCode),"Backspace"!=e.key&&"Delete"!=e.key||(r=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0,setTimeout((function(){var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)))},vi=["pre-wrap","normal","pre-line","break-spaces"],di=function(){function t(n){yc(this,t),this.lineWrapping=n,this.doc=i.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return kc(t,[{key:"heightForGap",value:function t(n,i){var e=this.doc.lineAt(i).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(e+=Math.max(0,Math.ceil((i-n-e*this.lineLength*.5)/this.lineLength))),this.lineHeight*e}},{key:"heightForLine",value:function t(n){return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight;var i}},{key:"setDoc",value:function t(n){return this.doc=n,this}},{key:"mustRefreshForWrapping",value:function t(n){return vi.indexOf(n)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function t(n){var i,e,r=!1;for(i=0;i<n.length;i++)(e=n[i])<0?i++:this.heightSamples[Math.floor(10*e)]||(r=!0,this.heightSamples[Math.floor(10*e)]=!0);return r}},{key:"refresh",value:function t(n,i,e,r,u,o){var s,h,f=vi.indexOf(n)>-1,a=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=f;if(this.lineWrapping=f,this.lineHeight=i,this.charWidth=e,this.textHeight=r,this.lineLength=u,a)for(this.heightSamples={},s=0;s<o.length;s++)(h=o[s])<0?s++:this.heightSamples[Math.floor(10*h)]=!0;return a}}]),t}(),yi=function(){function t(n,i){yc(this,t),this.from=n,this.heights=i,this.index=0}return kc(t,[{key:"more",get:function t(){return this.index<this.heights.length}}]),t}(),pi=function(){function t(n,i,e,r,u,o){yc(this,t),this.from=n,this.length=i,this.top=e,this.height=r,this.children=u,this.deco=o}return kc(t,[{key:"type",get:function t(){var n,i,e;return null!==(e=null!==(n=this.children)&&void 0!==n?n:null===(i=this.deco)||void 0===i?void 0:i.type)&&void 0!==e?e:Gt.Text}},{key:"widget",get:function t(){return this.deco&&this.deco.widget}},{key:"to",get:function t(){return this.from+this.length}},{key:"bottom",get:function t(){return this.top+this.height}},{key:"join",value:function n(i){var e=(this.children||[this]).concat(i.children||[i]);return new t(this.from,this.length+i.length,this.top,this.height+i.height,e,null)}}]),t}(),ki=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(ki||(ki={})),mi=.001,gi=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;yc(this,t),this.length=n,this.height=i,this.flags=e}return kc(t,[{key:"outdated",get:function t(){return(2&this.flags)>0},set:function t(n){this.flags=(n?2:0)|-3&this.flags}},{key:"setHeight",value:function t(n,i){this.height!=i&&(Math.abs(this.height-i)>mi&&(n.heightChanged=!0),this.height=i)}},{key:"replace",value:function n(i,e,r){return t.of(r)}},{key:"decomposeLeft",value:function t(n,i){i.push(this)}},{key:"decomposeRight",value:function t(n,i){i.push(this)}},{key:"applyChanges",value:function t(n,i,e,r){var u,o,s,h,f,a,c,l,v,d=this,y=e.doc;for(u=r.length-1;u>=0;u--){for(s=(o=r[u]).fromA,h=o.toA,f=o.fromB,a=o.toB,a+=(l=(c=d.lineAt(s,ki.ByPosNoHeight,e.setDoc(i),0,0)).to>=h?c:d.lineAt(h,ki.ByPosNoHeight,e,0,0)).to-h,h=l.to;u>0&&c.from<=r[u-1].toA;)s=r[u-1].fromA,f=r[u-1].fromB,u--,s<c.from&&(c=d.lineAt(s,ki.ByPosNoHeight,e,0,0));f+=c.from-s,s=c.from,v=Ci.build(e.setDoc(y),n,f,a),d=d.replace(s,h,v)}return d.updateHeight(e,0)}}],[{key:"empty",value:function t(){return new bi(0,0)}},{key:"of",value:function n(i){var e,r,u,o,s,h,f,a,c;if(1==i.length)return i[0];for(e=0,r=i.length,u=0,o=0;;)if(e==r)if(u>2*o)(s=i[e-1]).break?i.splice(--e,1,s.left,null,s.right):i.splice(--e,1,s.left,s.right),r+=1+s.break,u-=s.size;else{if(!(o>2*u))break;(h=i[r]).break?i.splice(r,1,h.left,null,h.right):i.splice(r,1,h.left,h.right),r+=2+h.break,o-=h.size}else u<o?(f=i[e++])&&(u+=f.size):(a=i[--r])&&(o+=a.size);return c=0,null==i[e-1]?(c=1,e--):null==i[e]&&(c=1,r++),new xi(t.of(i.slice(0,e)),c,t.of(i.slice(r)))}}]),t}(),gi.prototype.size=1,wi=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t,e)).deco=r,u}return kc(i,[{key:"blockAt",value:function t(n,i,e,r){return new pi(r,this.length,e,this.height,null,this.deco)}},{key:"lineAt",value:function t(n,i,e,r,u){return this.blockAt(0,e,r,u)}},{key:"forEachLine",value:function t(n,i,e,r,u,o){n<=u+this.length&&i>=u&&o(this.blockAt(0,e,r,u))}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return r&&r.from<=i&&r.more&&this.setHeight(n,r.heights[r.index++]),this.outdated=!1,this}},{key:"toString",value:function t(){return"block(".concat(this.length,")")}}]),i}(gi),bi=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this,t,e,null)).collapsed=0,r.widgetHeight=0,r}return kc(i,[{key:"replace",value:function t(n,e,r){var u=r[0];return 1==r.length&&(u instanceof i||u instanceof Mi&&4&u.flags)&&Math.abs(this.length-u.length)<10?(u instanceof Mi?u=new i(u.length,this.height):u.height=this.height,this.outdated||(u.outdated=!1),u):gi.of(r)}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return r&&r.from<=i&&r.more?this.setHeight(n,r.heights[r.index++]):(e||this.outdated)&&this.setHeight(n,Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}},{key:"toString",value:function t(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),i}(wi),Mi=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,t,0)}return kc(i,[{key:"heightMetrics",value:function t(n,i){var e,r,u=n.doc.lineAt(i).number,o=n.doc.lineAt(i+this.length).number,s=o-u+1,h=0;return n.lineWrapping?(e=(r=Math.min(this.height,n.lineHeight*s))/s,this.length>s+1&&(h=(this.height-r)/(this.length-s-1))):e=this.height/s,{firstLine:u,lastLine:o,perLine:e,perChar:h}}},{key:"blockAt",value:function t(n,i,e,r){var u,o,s,h,f,a,c,l,v=this.heightMetrics(i,r),d=v.firstLine,y=v.lastLine,p=v.perLine,k=v.perChar;return i.lineWrapping?(u=r+Math.round(Math.max(0,Math.min(1,(n-e)/this.height))*this.length),s=p+(o=i.doc.lineAt(u)).length*k,h=Math.max(e,n-s/2),new pi(o.from,o.length,h,s,null,null)):(f=Math.max(0,Math.min(y-d,Math.floor((n-e)/p))),c=(a=i.doc.line(d+f)).from,l=a.length,new pi(c,l,e+p*f,p,null,null))}},{key:"lineAt",value:function t(n,i,e,r,u){var o,s,h,f,a,c,l,v,d,y,p;return i==ki.ByHeight?this.blockAt(n,e,r,u):i==ki.ByPosNoHeight?(s=(o=e.doc.lineAt(n)).from,h=o.to,new pi(s,h-s,0,0,null,null)):(a=(f=this.heightMetrics(e,u)).firstLine,c=f.perLine,l=f.perChar,d=c+(v=e.doc.lineAt(n)).length*l,p=r+c*(y=v.number-a)+l*(v.from-u-y),new pi(v.from,v.length,Math.max(r,Math.min(p,r+this.height-d)),d,null,null))}},{key:"forEachLine",value:function t(n,i,e,r,u,o){var s,h,f,a,c,l,v,d,y;for(n=Math.max(n,u),i=Math.min(i,u+this.length),h=(s=this.heightMetrics(e,u)).firstLine,f=s.perLine,a=s.perChar,c=n,l=r;c<=i;)v=e.doc.lineAt(c),c==n&&(l+=f*(d=v.number-h)+a*(n-u-d)),y=f+a*v.length,o(new pi(v.from,v.length,l,y,null,null)),l+=y,c=v.to+1}},{key:"replace",value:function t(n,e,r){var u,o,s=this.length-e;return s>0&&((u=r[r.length-1])instanceof i?r[r.length-1]=new i(u.length+s):r.push(null,new i(s-1))),n>0&&((o=r[0])instanceof i?r[0]=new i(n+o.length):r.unshift(new i(n-1),null)),gi.of(r)}},{key:"decomposeLeft",value:function t(n,e){e.push(new i(n-1),null)}},{key:"decomposeRight",value:function t(n,e){e.push(null,new i(this.length-n-1))}},{key:"updateHeight",value:function t(n){var e,r,u,o,s,h,f,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=arguments.length>3?arguments[3]:void 0,v=a+this.length;if(l&&l.from<=a+this.length&&l.more){for(e=[],r=Math.max(a,l.from),u=-1,l.from>a&&e.push(new i(l.from-a-1).updateHeight(n,a));r<=v&&l.more;)o=n.doc.lineAt(r).length,e.length&&e.push(null),s=l.heights[l.index++],-1==u?u=s:Math.abs(s-u)>=mi&&(u=-2),(h=new bi(o,s)).outdated=!1,e.push(h),r+=o+1;return r<=v&&e.push(null,new i(v-r).updateHeight(n,r)),f=gi.of(e),(u<0||Math.abs(f.height-this.height)>=mi||Math.abs(u-this.heightMetrics(n,a).perLine)>=mi)&&(n.heightChanged=!0),f}return(c||this.outdated)&&(this.setHeight(n,n.heightForGap(a,a+this.length)),this.outdated=!1),this}},{key:"toString",value:function t(){return"gap(".concat(this.length,")")}}]),i}(gi),xi=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0))).left=t,u.right=r,u.size=t.size+r.size,u}return kc(i,[{key:"break",get:function t(){return 1&this.flags}},{key:"blockAt",value:function t(n,i,e,r){var u=e+this.left.height;return n<u?this.left.blockAt(n,i,e,r):this.right.blockAt(n,i,u,r+this.left.length+this.break)}},{key:"lineAt",value:function t(n,i,e,r,u){var o,s=r+this.left.height,h=u+this.left.length+this.break,f=i==ki.ByHeight?n<s:n<h,a=f?this.left.lineAt(n,i,e,r,u):this.right.lineAt(n,i,e,s,h);return this.break||(f?a.to<h:a.from>h)?a:(o=i==ki.ByPosNoHeight?ki.ByPosNoHeight:ki.ByPos,f?a.join(this.right.lineAt(h,o,e,s,h)):this.left.lineAt(h,o,e,r,u).join(a))}},{key:"forEachLine",value:function t(n,i,e,r,u,o){var s,h=r+this.left.height,f=u+this.left.length+this.break;this.break?(n<f&&this.left.forEachLine(n,i,e,r,u,o),i>=f&&this.right.forEachLine(n,i,e,h,f,o)):(n<(s=this.lineAt(f,ki.ByPos,e,r,u)).from&&this.left.forEachLine(n,s.from-1,e,r,u,o),s.to>=n&&s.from<=i&&o(s),i>s.to&&this.right.forEachLine(s.to+1,i,e,h,f,o))}},{key:"replace",value:function t(n,i,e){var r,u,o,s,h,f,a=this.left.length+this.break;if(i<a)return this.balanced(this.left.replace(n,i,e),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-a,i-a,e));r=[],n>0&&this.decomposeLeft(n,r),u=r.length,o=ic(e);try{for(o.s();!(s=o.n()).done;)h=s.value,r.push(h)}catch(t){o.e(t)}finally{o.f()}return n>0&&Qv(r,u-1),i<this.length&&(f=r.length,this.decomposeRight(i,r),Qv(r,f)),gi.of(r)}},{key:"decomposeLeft",value:function t(n,i){var e=this.left.length;if(n<=e)return this.left.decomposeLeft(n,i);i.push(this.left),this.break&&n>=++e&&i.push(null),n>e&&this.right.decomposeLeft(n-e,i)}},{key:"decomposeRight",value:function t(n,i){var e=this.left.length,r=e+this.break;if(n>=r)return this.right.decomposeRight(n-r,i);n<e&&this.left.decomposeRight(n,i),this.break&&n<r&&i.push(null),i.push(this.right)}},{key:"balanced",value:function t(n,i){return n.size>2*i.size||i.size>2*n.size?gi.of(this.break?[n,null,i]:[n,i]):(this.left=n,this.right=i,this.height=n.height+i.height,this.outdated=n.outdated||i.outdated,this.size=n.size+i.size,this.length=n.length+this.break+i.length,this)}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,u=this.left,o=this.right,s=i+u.length+this.break,h=null;return r&&r.from<=i+u.length&&r.more?h=u=u.updateHeight(n,i,e,r):u.updateHeight(n,i,e),r&&r.from<=s+o.length&&r.more?h=o=o.updateHeight(n,s,e,r):o.updateHeight(n,s,e),h?this.balanced(u,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function t(){return this.left+(this.break?" ":"-")+this.right}}]),i}(gi),Si=5,Ci=function(){function t(n,i){yc(this,t),this.pos=n,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=n}return kc(t,[{key:"isCovered",get:function t(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function t(n,i){if(this.lineStart>-1){var e=Math.min(i,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof bi?r.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new bi(e-this.pos,-1)),this.writtenTo=e,i>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}},{key:"point",value:function t(n,i,e){var r,u;n<i||e.heightRelevant?((r=e.widget?e.widget.estimatedHeight:0)<0&&(r=this.oracle.lineHeight),u=i-n,e.block?this.addBlock(new wi(u,r,e)):(u||r>=Si)&&this.addLineDeco(r,u)):i>n&&this.span(n,i),this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}},{key:"enterLine",value:function t(){if(!(this.lineStart>-1)){var n=this.oracle.doc.lineAt(this.pos),i=n.from,e=n.to;this.lineStart=i,this.lineEnd=e,this.writtenTo<i&&((this.writtenTo<i-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,i-1)),this.nodes.push(null)),this.pos>i&&this.nodes.push(new bi(this.pos-i,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function t(n,i){var e=new Mi(i-n);return this.oracle.doc.lineAt(n).to==i&&(e.flags|=4),e}},{key:"ensureLine",value:function t(){var n,i;return this.enterLine(),(n=this.nodes.length?this.nodes[this.nodes.length-1]:null)instanceof bi?n:(i=new bi(0,-1),this.nodes.push(i),i)}},{key:"addBlock",value:function t(n){var i,e;this.enterLine(),(e=null===(i=n.deco)||void 0===i?void 0:i.type)!=Gt.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,e!=Gt.WidgetBefore&&(this.covering=n)}},{key:"addLineDeco",value:function t(n,i){var e=this.ensureLine();e.length+=i,e.collapsed+=i,e.widgetHeight=Math.max(e.widgetHeight,n),this.writtenTo=this.pos=this.pos+i}},{key:"finish",value:function t(n){var i,e,r,u,o=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||o instanceof bi||this.isCovered?(this.writtenTo<this.pos||null==o)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new bi(0,-1)),i=n,e=ic(this.nodes);try{for(e.s();!(r=e.n()).done;)(u=r.value)instanceof bi&&u.updateHeight(this.oracle,i),i+=u?u.length:1}catch(t){e.e(t)}finally{e.f()}return this.nodes}}],[{key:"build",value:function n(i,e,r,u){var o=new t(r,i);return tt.spans(e,r,u,o,0),o.finish(r)}}]),t}(),Oi=function(){function t(){yc(this,t),this.changes=[]}return kc(t,[{key:"compareRange",value:function t(){}},{key:"comparePoint",value:function t(n,i,e,r){(n<i||e&&e.heightRelevant||r&&r.heightRelevant)&&Xl(n,i,this.changes,5)}}]),t}(),Ai=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.size=e}return kc(t,[{key:"draw",value:function t(n){return Jt.replace({widget:new Di(this.size,n)}).range(this.from,this.to)}}],[{key:"same",value:function t(n,i){var e,r,u;if(n.length!=i.length)return!1;for(e=0;e<n.length;e++)if(r=n[e],u=i[e],r.from!=u.from||r.to!=u.to||r.size!=u.size)return!1;return!0}}]),t}(),Di=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).size=t,r.vertical=e,r}return kc(i,[{key:"eq",value:function t(n){return n.size==this.size&&n.vertical==this.vertical}},{key:"toDOM",value:function t(){var n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}},{key:"estimatedHeight",get:function t(){return this.vertical?this.size:-1}}]),i}(qt),Ei=function(){function t(n){yc(this,t),this.state=n,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.scaler=Ri,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=An.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var e=n.facet(wn).some((function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class}));this.heightOracle=new di(e),this.stateDeco=n.facet(bn).filter((function(t){return"function"!=typeof t})),this.heightMap=gi.empty().applyChanges(this.stateDeco,i.empty,this.heightOracle.setDoc(n.doc),[new Cn(0,0,0,n.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Jt.set(this.lineGaps.map((function(t){return t.draw(!1)}))),this.computeVisibleRanges()}return kc(t,[{key:"updateForViewport",value:function t(){var n,i=this,e=[this.viewport],r=this.state.selection.main,u=function t(){var u,o,s,h=n?r.head:r.anchor;e.some((function(t){var n=t.from,i=t.to;return h>=n&&h<=i}))||(o=(u=i.lineBlockAt(h)).from,s=u.to,e.push(new Ii(o,s)))};for(n=0;n<=1;n++)u();this.viewports=e.sort((function(t,n){return t.from-n.from})),this.scaler=this.heightMap.height<=7e6?Ri:new Li(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function t(){var n=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(t){n.viewportLines.push(1==n.scaler.scale?t:rd(t,n.scaler))}))}},{key:"update",value:function t(n){var i,e,r,u,o,s,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=n.state,i=this.stateDeco,this.stateDeco=this.state.facet(bn).filter((function(t){return"function"!=typeof t})),e=n.changedRanges,r=Cn.extendWithRanges(e,Xv(i,this.stateDeco,n?n.changes:y.empty(this.state.doc.length))),u=this.heightMap.height,this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=u&&(n.flags|=2),o=r.length?this.mapViewport(this.viewport,n.changes):this.viewport,(h&&(h.range.head<o.from||h.range.head>o.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,h)),s=!n.changes.empty||2&n.flags||o.from!=this.viewport.from||o.to!=this.viewport.to,this.viewport=o,this.updateForViewport(),s&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(),h&&(this.scrollTarget=h),!this.mustEnforceCursorAssoc&&n.selectionSet&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(cn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function t(n){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C=n.contentDOM,O=window.getComputedStyle(C),A=this.heightOracle,D=O.whiteSpace;if(this.defaultTextDirection="rtl"==O.direction?An.RTL:An.LTR,e=this.heightOracle.mustRefreshForWrapping(D),r=C.getBoundingClientRect(),u=e||this.mustMeasureContent||this.contentDOMHeight!=r.height,this.contentDOMHeight=r.height,this.mustMeasureContent=!1,o=0,s=0,h=parseInt(O.paddingTop)||0,f=parseInt(O.paddingBottom)||0,this.paddingTop==h&&this.paddingBottom==f||(this.paddingTop=h,this.paddingBottom=f,o|=10),this.editorWidth!=n.scrollDOM.clientWidth&&(A.lineWrapping&&(u=!0),this.editorWidth=n.scrollDOM.clientWidth,o|=8),c=(a=(this.printing?Yv:Zv)(C,this.paddingTop)).top-this.pixelViewport.top,l=a.bottom-this.pixelViewport.bottom,this.pixelViewport=a,(v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left)!=this.inView&&(this.inView=v,v&&(u=!0)),!this.inView&&!this.scrollTarget)return 0;if(d=r.width,this.contentDOMWidth==d&&this.editorHeight==n.scrollDOM.clientHeight||(this.contentDOMWidth=r.width,this.editorHeight=n.scrollDOM.clientHeight,o|=8),u){y=n.docView.measureVisibleLineHeights(this.viewport),A.mustRefreshForHeights(y)&&(e=!0),(e||A.lineWrapping&&Math.abs(d-this.contentDOMWidth)>A.charWidth)&&(k=(p=n.docView.measureTextSize()).lineHeight,m=p.charWidth,g=p.textHeight,(e=k>0&&A.refresh(D,k,m,g,d/m,y))&&(n.docView.minWidth=0,o|=8)),c>0&&l>0?s=Math.max(c,l):c<0&&l<0&&(s=Math.min(c,l)),A.heightChanged=!1,w=ic(this.viewports);try{for(w.s();!(b=w.n()).done;)x=(M=b.value).from==this.viewport.from?y:n.docView.measureVisibleLineHeights(M),this.heightMap=(e?gi.empty().applyChanges(this.stateDeco,i.empty,this.heightOracle,[new Cn(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(A,0,e,new yi(M.from,x))}catch(t){w.e(t)}finally{w.f()}A.heightChanged&&(o|=2)}return(S=!this.viewportIsAppropriate(this.viewport,s)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to))&&(this.viewport=this.getViewport(s,this.scrollTarget)),this.updateForViewport(),(2&o||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(e?[]:this.lineGaps,n)),o|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),o}},{key:"visibleTop",get:function t(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function t(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function t(n,i){var e,r,u,o,s=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),h=this.heightMap,f=this.heightOracle,a=this.visibleTop,c=this.visibleBottom,l=new Ii(h.lineAt(a-1e3*s,ki.ByHeight,f,0,0).from,h.lineAt(c+1e3*(1-s),ki.ByHeight,f,0,0).to);return i&&((e=i.range.head)<l.from||e>l.to)&&(r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=h.lineAt(e,ki.ByPos,f,0,0),o="center"==i.y?(u.top+u.bottom)/2-r/2:"start"==i.y||"nearest"==i.y&&e<l.from?u.top:u.bottom-r,l=new Ii(h.lineAt(o-500,ki.ByHeight,f,0,0).from,h.lineAt(o+r+500,ki.ByHeight,f,0,0).to)),l}},{key:"mapViewport",value:function t(n,i){var e=i.mapPos(n.from,-1),r=i.mapPos(n.to,1);return new Ii(this.heightMap.lineAt(e,ki.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,ki.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function t(n){var i,e,r,u,o,s,h=n.from,f=n.to,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!this.inView||(e=(i=this.heightMap.lineAt(h,ki.ByPos,this.heightOracle,0,0)).top,u=(r=this.heightMap.lineAt(f,ki.ByPos,this.heightOracle,0,0)).bottom,o=this.visibleTop,s=this.visibleBottom,(0==h||e<=o-Math.max(10,Math.min(-a,250)))&&(f==this.state.doc.length||u>=s+Math.max(10,Math.min(a,250)))&&e>o-2e3&&u<s+2e3)}},{key:"mapLineGaps",value:function t(n,i){var e,r,u,o;if(!n.length||i.empty)return n;e=[],r=ic(n);try{for(r.s();!(u=r.n()).done;)o=u.value,i.touchesRange(o.from,o.to)||e.push(new Ai(i.mapPos(o.from),i.mapPos(o.to),o.size))}catch(t){r.e(t)}finally{r.f()}return e}},{key:"ensureLineGaps",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,g,w,b,M,x,S=this,C=this.heightOracle.lineWrapping,O=C?1e4:2e3,A=O>>1,D=O<<1;if(this.defaultTextDirection!=An.LTR&&!C)return[];e=[],r=function t(r,u,o,s){var h,f,a,c,l,v,d;if(!(u-r<A)){for(h=S.state.selection.main,f=[h.from],h.empty||f.push(h.to),a=0,c=f;a<c.length;a++)if((l=c[a])>r&&l<u)return t(r,l-10,o,s),void t(l+10,u,o,s);v=ed(n,(function(t){return t.from>=o.from&&t.to<=o.to&&Math.abs(t.from-r)<A&&Math.abs(t.to-u)<A&&!f.some((function(n){return t.from<n&&t.to>n}))})),v||(u<o.to&&i&&C&&i.visibleRanges.some((function(t){return t.from<=u&&t.to>=u}))&&(d=i.moveToLineBoundary(m.cursor(u),!1,!0).head)>r&&(u=d),v=new Ai(r,u,S.gapSize(o,r,u,s))),e.push(v)}},u=ic(this.viewportLines);try{for(u.s();!(o=u.n()).done;)(s=o.value).length<D||(h=td(s.from,s.to,this.stateDeco)).total<D||(f=this.scrollTarget?this.scrollTarget.range.head:null,a=void 0,c=void 0,C?(l=O/this.heightOracle.lineLength*this.heightOracle.lineHeight,v=void 0,d=void 0,null!=f?(v=(y=id(h,f))-(p=((this.visibleBottom-this.visibleTop)/2+l)/s.height),d=y+p):(v=(this.visibleTop-s.top-l)/s.height,d=(this.visibleBottom-s.top+l)/s.height),a=nd(h,v),c=nd(h,d)):(k=h.total*this.heightOracle.charWidth,g=O*this.heightOracle.charWidth,w=void 0,b=void 0,null!=f?(w=(M=id(h,f))-(x=((this.pixelViewport.right-this.pixelViewport.left)/2+g)/k),b=M+x):(w=(this.pixelViewport.left-g)/k,b=(this.pixelViewport.right+g)/k),a=nd(h,w),c=nd(h,b)),a>s.from&&r(s.from,a,s,h),c<s.to&&r(c,s.to,s,h))}catch(t){u.e(t)}finally{u.f()}return e}},{key:"gapSize",value:function t(n,i,e,r){var u=id(r,e)-id(r,i);return this.heightOracle.lineWrapping?n.height*u:r.total*this.heightOracle.charWidth*u}},{key:"updateLineGaps",value:function t(n){var i=this;Ai.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=Jt.set(n.map((function(t){return t.draw(i.heightOracle.lineWrapping)}))))}},{key:"computeVisibleRanges",value:function t(){var n,i,e=this.stateDeco;return this.lineGaps.length&&(e=e.concat(this.lineGapDeco)),n=[],tt.spans(e,this.viewport.from,this.viewport.to,{span:function t(i,e){n.push({from:i,to:e})},point:function t(){}},20),i=n.length!=this.visibleRanges.length||this.visibleRanges.some((function(t,i){return t.from!=n[i].from||t.to!=n[i].to})),this.visibleRanges=n,i?4:0}},{key:"lineBlockAt",value:function t(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find((function(t){return t.from<=n&&t.to>=n}))||rd(this.heightMap.lineAt(n,ki.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function t(n){return rd(this.heightMap.lineAt(this.scaler.fromDOM(n),ki.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function t(n){return rd(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function t(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function t(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),t}(),Ii=kc((function t(n,i){yc(this,t),this.from=n,this.to=i})),Ri={toDOM:function t(n){return n},fromDOM:function t(n){return n},scale:1},Li=function(){function t(n,i,e){var r,u,o,s,h,f;yc(this,t),r=0,u=0,o=0,this.viewports=e.map((function(t){var e=t.from,u=t.to,o=i.lineAt(e,ki.ByPos,n,0,0).top,s=i.lineAt(u,ki.ByPos,n,0,0).bottom;return r+=s-o,{from:e,to:u,top:o,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-r)/(i.height-r),s=ic(this.viewports);try{for(s.s();!(h=s.n()).done;)(f=h.value).domTop=o+(f.top-u)*this.scale,o=f.domBottom=f.domTop+(f.bottom-f.top),u=f.bottom}catch(t){s.e(t)}finally{s.f()}}return kc(t,[{key:"toDOM",value:function t(n){var i,e,r,u;for(i=0,e=0,r=0;;i++){if(!(u=i<this.viewports.length?this.viewports[i]:null)||n<u.top)return r+(n-e)*this.scale;if(n<=u.bottom)return u.domTop+(n-u.top);e=u.bottom,r=u.domBottom}}},{key:"fromDOM",value:function t(n){var i,e,r,u;for(i=0,e=0,r=0;;i++){if(!(u=i<this.viewports.length?this.viewports[i]:null)||n<u.domTop)return e+(n-r)/this.scale;if(n<=u.domBottom)return u.top+(n-u.domTop);e=u.bottom,r=u.domBottom}}}]),t}(),ji=w.define({combine:function t(n){return n.join(" ")}}),Ti=w.define({combine:function t(n){return n.indexOf(!0)>-1}}),Fi=ud("."+(Bi=at.newName()),{"&":{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},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",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:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&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",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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},"&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-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".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"}},Pi={"&light":"."+(_i=at.newName()),"&dark":"."+(Ni=at.newName())}),Hi=kc((function t(n,i,e,r){var u,o,s,h,f,a,c,l;yc(this,t),this.typeOver=r,this.bounds=null,this.text="",o=(u=n.docView).impreciseHead,s=u.impreciseAnchor,n.state.readOnly&&i>-1?this.newSel=null:i>-1&&(this.bounds=n.docView.domBoundsAround(i,e,0))?(h=o||s?[]:hd(n),(f=new Un(h,n.state)).readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=f.text,this.newSel=fd(h,this.bounds.from)):(a=n.observer.selectionRange,c=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!pl(n.contentDOM,a.focusNode)?n.state.selection.main.head:n.docView.posFromDOM(a.focusNode,a.focusOffset),l=s&&s.node==a.anchorNode&&s.offset==a.anchorOffset||!pl(n.contentDOM,a.anchorNode)?n.state.selection.main.anchor:n.docView.posFromDOM(a.anchorNode,a.anchorOffset),this.newSel=m.single(l,c))})),zi={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Wi=Ft.ie&&Ft.ie_version<=11,Vi=function(){function t(n){var i=this;yc(this,t),this.view=n,this.active=!1,this.selectionRange=new bt,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.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=n.contentDOM,this.observer=new MutationObserver((function(t){var e,r,u=ic(t);try{for(u.s();!(e=u.n()).done;)r=e.value,i.queue.push(r)}catch(t){u.e(t)}finally{u.f()}(Ft.ie&&Ft.ie_version<=11||Ft.ios&&n.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?i.flushSoon():i.flush()})),Wi&&(this.onCharData=function(t){i.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),i.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),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=i.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&i.onResize()})),this.resizeScroll.observe(n.scrollDOM),this.resizeContent=new ResizeObserver((function(){return i.view.requestMeasure()})),this.resizeContent.observe(n.contentDOM)),this.addWindowListeners(this.win=n.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(t){i.parentCheck<0&&(i.parentCheck=setTimeout(i.listenForScroll.bind(i),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=i.intersecting&&(i.intersecting=!i.intersecting,i.intersecting!=i.view.inView&&i.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&i.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return kc(t,[{key:"onScrollChanged",value:function t(n){this.view.inputState.runScrollHandlers(this.view,n),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function t(n){this.intersecting&&this.flush(!1),this.onScrollChanged(n)}},{key:"onResize",value:function t(){var n=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){n.resizeTimeout=-1,n.view.requestMeasure()}),50))}},{key:"onPrint",value:function t(){var n=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){n.view.viewState.printing=!1,n.view.requestMeasure()}),500)}},{key:"updateGaps",value:function t(n){var i,e,r;if(this.gapIntersection&&(n.length!=this.gaps.length||this.gaps.some((function(t,i){return t!=n[i]})))){this.gapIntersection.disconnect(),i=ic(n);try{for(i.s();!(e=i.n()).done;)r=e.value,this.gapIntersection.observe(r)}catch(t){i.e(t)}finally{i.f()}this.gaps=n}}},{key:"onSelectionChange",value:function t(n){var i,e,r,u=this.selectionChanged;this.readSelectionRange()&&!this.delayedAndroidKey&&(i=this.view,e=this.selectionRange,(i.state.facet(dn)?i.root.activeElement==this.dom:ml(i.dom,e))&&((r=e.anchorNode&&i.docView.nearest(e.anchorNode))&&r.ignoreEvent(n)?u||(this.selectionChanged=!1):(Ft.ie&&Ft.ie_version<=11||Ft.android&&Ft.chrome)&&!i.state.selection.main.empty&&e.focusNode&&wl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)?this.flushSoon():this.flush(!1)))}},{key:"readSelectionRange",value:function t(){var n,i=this.view,e=Ft.safari&&11==i.root.nodeType&&kl(this.dom.ownerDocument)==this.dom&&cd(this.view)||yl(i.root);return!(!e||this.selectionRange.eq(e))&&((n=ml(this.dom,e))&&!this.selectionChanged&&i.inputState.lastFocusTime>Date.now()-200&&i.inputState.lastTouchTime<Date.now()-300&&jl(this.dom,e)?(this.view.inputState.lastFocusTime=0,i.docView.updateSelection(),!1):(this.selectionRange.setRange(e),n&&(this.selectionChanged=!0),!0))}},{key:"setSelectionRange",value:function t(n,i){this.selectionRange.set(n.node,n.offset,i.node,i.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function t(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function t(){var n,i,e,r,u,o,s,h,f;for(this.parentCheck=-1,n=0,i=null,e=this.dom;e;)if(1==e.nodeType)!i&&n<this.scrollTargets.length&&this.scrollTargets[n]==e?n++:i||(i=this.scrollTargets.slice(0,n)),i&&i.push(e),e=e.assignedSlot||e.parentNode;else{if(11!=e.nodeType)break;e=e.host}if(n<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,n)),i){r=ic(this.scrollTargets);try{for(r.s();!(u=r.n()).done;)(o=u.value).removeEventListener("scroll",this.onScroll)}catch(t){r.e(t)}finally{r.f()}s=ic(this.scrollTargets=i);try{for(s.s();!(h=s.n()).done;)(f=h.value).addEventListener("scroll",this.onScroll)}catch(t){s.e(t)}finally{s.f()}}}},{key:"ignore",value:function t(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}},{key:"start",value:function t(){this.active||(this.observer.observe(this.dom,zi),Wi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function t(){this.active&&(this.active=!1,this.observer.disconnect(),Wi&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}},{key:"clear",value:function t(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function t(n,i){var e,r,u=this;this.delayedAndroidKey||(r=function t(){var n,i=u.delayedAndroidKey;i&&(u.clearDelayedAndroidKey(),u.view.inputState.lastKeyCode=i.keyCode,u.view.inputState.lastKeyTime=Date.now(),!(n=u.flush())&&i.force&&Il(u.dom,i.key,i.keyCode))},this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)),this.delayedAndroidKey&&"Enter"!=n||(this.delayedAndroidKey={key:n,keyCode:i,force:this.lastChange<Date.now()-50||!!(null===(e=this.delayedAndroidKey)||void 0===e?void 0:e.force)})}},{key:"clearDelayedAndroidKey",value:function t(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function t(){var n=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((function(){n.delayedFlush=-1,n.flush()})))}},{key:"forceFlush",value:function t(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function t(){var n,i,e=ic(this.observer.takeRecords());try{for(e.s();!(n=e.n()).done;)i=n.value,this.queue.push(i)}catch(t){e.e(t)}finally{e.f()}return this.queue}},{key:"processRecords",value:function t(){var n,i,e,r,u,o,s,h=this.pendingRecords();h.length&&(this.queue=[]),n=-1,i=-1,e=!1,r=ic(h);try{for(r.s();!(u=r.n()).done;)o=u.value,(s=this.readMutation(o))&&(s.typeOver&&(e=!0),-1==n?(n=s.from,i=s.to):(n=Math.min(s.from,n),i=Math.max(s.to,i)))}catch(t){r.e(t)}finally{r.f()}return{from:n,to:i,typeOver:e}}},{key:"readChange",value:function t(){var n=this.processRecords(),i=n.from,e=n.to,r=n.typeOver,u=this.selectionChanged&&ml(this.dom,this.selectionRange);return i<0&&!u?null:(i>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Hi(this.view,i,e,r))}},{key:"flush",value:function t(){var n,i,e,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return!(this.delayedFlush>=0||this.delayedAndroidKey)&&(r&&this.readSelectionRange(),!!(n=this.readChange())&&(i=this.view.state,e=od(this.view,n),this.view.state==i&&this.view.update([]),e))}},{key:"readMutation",value:function t(n){var i,e,r=this.view.docView.nearest(n.target);return!r||r.ignoreMutation(n)?null:(r.markDirty("attributes"==n.type),"attributes"==n.type&&(r.dirty|=4),"childList"==n.type?(i=ad(r,n.previousSibling||n.target.previousSibling,-1),e=ad(r,n.nextSibling||n.target.nextSibling,1),{from:i?r.posAfter(i):r.posAtStart,to:e?r.posBefore(e):r.posAtEnd,typeOver:!1}):"characterData"==n.type?{from:r.posAtStart,to:r.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null)}},{key:"setWindow",value:function t(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function t(n){n.addEventListener("resize",this.onResize),n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function t(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function t(){var n,i,e,r,u,o,s;this.stop(),null===(n=this.intersection)||void 0===n||n.disconnect(),null===(i=this.gapIntersection)||void 0===i||i.disconnect(),null===(e=this.resizeScroll)||void 0===e||e.disconnect(),null===(r=this.resizeContent)||void 0===r||r.disconnect(),u=ic(this.scrollTargets);try{for(u.s();!(o=u.n()).done;)(s=o.value).removeEventListener("scroll",this.onScroll)}catch(t){u.e(t)}finally{u.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}(),Ui=function(){function t(){var n,i,e,r=this,u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};yc(this,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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this.$de=u.dispatch||function(t){return r.update([t])},this.dispatch=this.dispatch.bind(this),this.Nkt=u.root||Rl(u.parent)||document,this.viewState=new Ei(u.state||Q.create(u)),this.plugins=this.state.facet(pn).map((function(t){return new mn(t)})),n=ic(this.plugins);try{for(n.s();!(i=n.n()).done;)(e=i.value).update(this)}catch(t){n.e(t)}finally{n.f()}this.observer=new Vi(this),this.inputState=new Qn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new qn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),u.parent&&u.parent.appendChild(this.dom)}return kc(t,[{key:"state",get:function t(){return this.viewState.state}},{key:"viewport",get:function t(){return this.viewState.viewport}},{key:"visibleRanges",get:function t(){return this.viewState.visibleRanges}},{key:"inView",get:function t(){return this.viewState.inView}},{key:"composing",get:function t(){return this.inputState.composing>0}},{key:"compositionStarted",get:function t(){return this.inputState.composing>=0}},{key:"root",get:function t(){return this.Nkt}},{key:"win",get:function t(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function t(){var n,i=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof $?arguments.length<=0?void 0:arguments[0]:(n=this.state).update.apply(n,arguments);this.$de(i,this)}},{key:"update",value:function t(n){var i,e,t,r,u,o,s,h,f,a,c,l,v,d,y,p,k,g,w,b,M,x,S,C=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");i=!1,e=!1,r=this.state,u=ic(n);try{for(u.s();!(o=u.n()).done;){if((s=o.value).startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=s.state}}catch(t){u.e(t)}finally{u.f()}if(this.destroyed)this.viewState.state=r;else{if(h=this.hasFocus,f=0,a=null,n.some((function(t){return t.annotation(li)}))?(this.inputState.notifiedFocused=h,f=1):h!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=h,(a=Jv(r,h))||(f=1)),c=this.observer.delayedAndroidKey,l=null,c?(this.observer.clearDelayedAndroidKey(),((l=this.observer.readChange())&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(l=null)):this.observer.clear(),r.facet(Q.phrases)!=this.state.facet(Q.phrases))return this.setState(r);t=On.create(this,r,n),t.flags|=f,v=this.viewState.scrollTarget;try{this.updateState=2,d=ic(n);try{for(d.s();!(y=d.n()).done;){p=y.value,v&&(v=v.map(p.changes)),p.scrollIntoView&&(k=p.state.selection.main,v=new ln(k.empty?k:m.cursor(k.head,k.head>k.anchor?-1:1))),g=ic(p.effects);try{for(g.s();!(w=g.n()).done;)(b=w.value).is(vn)&&(v=b.value)}catch(t){g.e(t)}finally{g.f()}}}catch(t){d.e(t)}finally{d.f()}this.viewState.update(t,v),this.bidiCache=Gi.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),i=this.docView.update(t),this.state.facet(Sn)!=this.styleModules&&this.mountStyles(),e=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(i,n.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(t.startState.facet(ji)!=t.state.facet(ji)&&(this.viewState.mustMeasureContent=!0),(i||e||v||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty){M=ic(this.state.facet(sn));try{for(M.s();!(x=M.n()).done;)(S=x.value)(t)}catch(t){M.e(t)}finally{M.f()}}(a||l)&&Promise.resolve().then((function(){a&&C.state==a.startState&&C.dispatch(a),l&&!od(C,l)&&c.force&&Il(C.contentDOM,c.key,c.keyCode)}))}}},{key:"setState",value:function t(n){var i,e,r,u,o,s,h;if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=n;else{this.updateState=2,i=this.hasFocus;try{e=ic(this.plugins);try{for(e.s();!(r=e.n()).done;)(u=r.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.viewState=new Ei(n),this.plugins=n.facet(pn).map((function(t){return new mn(t)})),this.pluginMap.clear(),o=ic(this.plugins);try{for(o.s();!(s=o.n()).done;)(h=s.value).update(this)}catch(t){o.e(t)}finally{o.f()}this.docView=new qn(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y=n.startState.facet(pn),p=n.state.facet(pn);if(y!=p){i=[],e=ic(p);try{for(e.s();!(r=e.n()).done;)u=r.value,(o=y.indexOf(u))<0?i.push(new mn(u)):((s=this.plugins[o]).mustUpdate=n,i.push(s))}catch(t){e.e(t)}finally{e.f()}h=ic(this.plugins);try{for(h.s();!(f=h.n()).done;)(a=f.value).mustUpdate!=n&&a.destroy(this)}catch(t){h.e(t)}finally{h.f()}this.plugins=i,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{c=ic(this.plugins);try{for(c.s();!(l=c.n()).done;)(v=l.value).mustUpdate=n}catch(t){c.e(t)}finally{c.f()}}for(d=0;d<this.plugins.length;d++)this.plugins[d].update(this)}},{key:"measure",value:function t(){var n,i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x=this,S=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,S&&this.observer.forceFlush(),n=null,e=(i=this.scrollDOM).scrollHeight,o=(r=i.scrollTop)>e-(u=i.clientHeight)-4?e:r;try{for(s=0;this.updateState=1,h=this.viewport,f=this.viewState.lineBlockAtHeight(o),(a=this.viewState.measure(this))||this.measureRequests.length||null!=this.viewState.scrollTarget;s++){if(s>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}for(c=[],4&a||(l=[c,this.measureRequests],this.measureRequests=l[0],c=l[1]),v=c.map((function(t){try{return t.read(x)}catch(t){return Yl(x.state,t),qi}})),d=On.create(this,this.state,[]),y=!1,p=!1,d.flags|=a,n?n.flags|=a:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),y=this.docView.update(d)),k=0;k<c.length;k++)if(v[k]!=qi)try{(m=c[k]).write&&m.write(v[k],this)}catch(t){Yl(this.state,t)}if(this.viewState.editorHeight&&(this.viewState.scrollTarget?(this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,p=!0):((g=this.viewState.lineBlockAt(f.from).top-f.top)>1||g<-1)&&(this.scrollDOM.scrollTop+=g,p=!0)),y&&this.docView.updateSelection(!0),this.viewport.from==h.from&&this.viewport.to==h.to&&!p&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){w=ic(this.state.facet(sn));try{for(w.s();!(b=w.n()).done;)(M=b.value)(n)}catch(t){w.e(t)}finally{w.f()}}}}},{key:"themeClasses",get:function t(){return Bi+" "+(this.state.facet(Ti)?Ni:_i)+" "+this.state.facet(ji)}},{key:"updateAttrs",value:function t(){var n,i=this,e=ld(this,gn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(dn)?"true":"false",class:"cm-content",style:"".concat(Ft.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};return this.state.readOnly&&(r["aria-readonly"]="true"),ld(this,wn,r),n=this.observer.ignore((function(){var t=Jl(i.contentDOM,i.contentAttrs,r),n=Jl(i.dom,i.editorAttrs,e);return t||n})),this.editorAttrs=e,this.contentAttrs=r,n}},{key:"showAnnouncements",value:function n(i){var e,r,u,o,s,h,f=!0,a=ic(i);try{for(a.s();!(e=a.n()).done;){u=ic((r=e.value).effects);try{for(u.s();!(o=u.n()).done;)(s=o.value).is(t.announce)&&(f&&(this.announceDOM.textContent=""),f=!1,(h=this.announceDOM.appendChild(document.createElement("div"))).textContent=s.value)}catch(t){u.e(t)}finally{u.f()}}}catch(t){a.e(t)}finally{a.f()}}},{key:"mountStyles",value:function t(){this.styleModules=this.state.facet(Sn),at.mount(this.root,this.styleModules.concat(Fi).reverse())}},{key:"readMeasured",value:function t(){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)}},{key:"requestMeasure",value:function t(n){var i,e=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return e.measure()}))),n){if(this.measureRequests.indexOf(n)>-1)return;if(null!=n.key)for(i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===n.key)return void(this.measureRequests[i]=n);this.measureRequests.push(n)}}},{key:"plugin",value:function t(n){var i=this.pluginMap.get(n);return(void 0===i||i&&i.spec!=n)&&this.pluginMap.set(n,i=this.plugins.find((function(t){return t.spec==n}))||null),i&&i.update(this).value}},{key:"documentTop",get:function t(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function t(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function t(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}},{key:"lineBlockAtHeight",value:function t(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}},{key:"viewportLineBlocks",get:function t(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function t(n){return this.viewState.lineBlockAt(n)}},{key:"contentHeight",get:function t(){return this.viewState.contentHeight}},{key:"moveByChar",value:function t(n,i,e){return Rv(this,n,Av(this,n,i,e))}},{key:"moveByGroup",value:function t(n,i){var e=this;return Rv(this,n,Av(this,n,i,(function(t){return Dv(e,n.head,t)})))}},{key:"moveToLineBoundary",value:function t(n,i){var e;return Ov(this,n,i,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function t(n,i,e){return Rv(this,n,Ev(this,n,i,e))}},{key:"domAtPos",value:function t(n){return this.docView.domAtPos(n)}},{key:"posAtDOM",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(n,i)}},{key:"posAtCoords",value:function t(n){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),Mv(this,n,i)}},{key:"coordsAtPos",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.readMeasured(),(i=this.docView.coordsAt(n,o))&&i.left!=i.right?(e=this.state.doc.lineAt(n),Sl(i,(u=(r=this.bidiSpans(e))[Hn.find(r,n-e.from,-1,o)]).dir==An.LTR==o>0)):i}},{key:"defaultCharacterWidth",get:function t(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function t(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function t(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function t(n){var i;return!this.state.facet(an)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}},{key:"lineWrapping",get:function t(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function t(n){var i,e,r,u,o;if(n.length>$i)return rv(n.length);i=this.textDirectionAt(n.from),e=ic(this.bidiCache);try{for(e.s();!(r=e.n()).done;)if((u=r.value).from==n.from&&u.dir==i)return u.order}catch(t){e.e(t)}finally{e.f()}return o=ev(n.text,i),this.bidiCache.push(new Gi(n.from,n.to,i,o)),o}},{key:"hasFocus",get:function t(){var n;return(this.dom.ownerDocument.hasFocus()||Ft.safari&&(null===(n=this.inputState)||void 0===n?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function t(){var n=this;this.observer.ignore((function(){Dl(n.contentDOM),n.docView.updateSelection()}))}},{key:"setRoot",value:function t(n){this.Nkt!=n&&(this.Nkt=n,this.observer.setWindow((9==n.nodeType?n:n.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function t(){var n,i,e=ic(this.plugins);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return vn.of(new ln("number"==typeof n?m.cursor(n):n,i.y,i.x,i.yMargin,i.xMargin))}},{key:"domEventHandlers",value:function t(n){return kn.define((function(){return{}}),{eventHandlers:n})}},{key:"theme",value:function t(n,i){var e=at.newName(),r=[ji.of(e),Sn.of(ud(".".concat(e),n))];return i&&i.dark&&r.push(Ti.of(!0)),r}},{key:"baseTheme",value:function t(n){return E.lowest(Sn.of(ud("."+Bi,n,Pi)))}},{key:"findFromDOM",value:function t(n){var i,e=n.querySelector(".cm-content"),r=e&&Ot.get(e)||Ot.get(n);return(null===(i=null==r?void 0:r.rootView)||void 0===i?void 0:i.view)||null}}]),t}(),Ui.styleModule=Sn,Ui.inputHandler=hn,Ui.focusChangeEffect=fn,Ui.perLineTextDirection=an,Ui.exceptionSink=on,Ui.updateListener=sn,Ui.editable=dn,Ui.mouseSelectionStyle=un,Ui.dragMovesSelection=rn,Ui.clickAddsSelectionRange=en,Ui.decorations=bn,Ui.atomicRanges=Mn,Ui.scrollMargins=xn,Ui.darkTheme=Ti,Ui.contentAttributes=wn,Ui.editorAttributes=gn,Ui.lineWrapping=Ui.contentAttributes.of({class:"cm-lineWrapping"}),Ui.announce=U.define(),$i=4096,qi={},Gi=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.dir=e,this.order=r}return kc(t,null,[{key:"update",value:function n(i,e){var r,u,o,s;if(e.empty)return i;for(r=[],u=i.length?i[i.length-1].dir:An.LTR,o=Math.max(0,i.length-10);o<i.length;o++)(s=i[o]).dir!=u||e.touchesRange(s.from,s.to)||r.push(new t(e.mapPos(s.from,1),e.mapPos(s.to,-1),s.dir,s.order));return r}}]),t}(),Ji=Ft.mac?"mac":Ft.windows?"win":Ft.linux?"linux":"key",Ki=E.default(Ui.domEventHandlers({keydown:function t(n,i){return md(yd(i.state),n,i,"editor")}})),Qi=w.define({enables:Ki}),Xi=new WeakMap,Zi=null,Yi=4e3,te=function(){function t(n,i,e,r,u){yc(this,t),this.className=n,this.left=i,this.top=e,this.width=r,this.height=u}return kc(t,[{key:"draw",value:function t(){var n=document.createElement("div");return n.className=this.className,this.adjust(n),n}},{key:"update",value:function t(n,i){return i.className==this.className&&(this.adjust(n),!0)}},{key:"adjust",value:function t(n){n.style.left=this.left+"px",n.style.top=this.top+"px",null!=this.width&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}},{key:"eq",value:function t(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}}],[{key:"forRange",value:function n(i,e,r){var u,o;return r.empty?(u=i.coordsAtPos(r.head,r.assoc||1))?(o=gd(i),[new t(e,u.left-o.left,u.top-o.top,null,u.bottom-u.top)]):[]:Md(i,e,r)}}]),t}(),ne=function(){function t(n,i){yc(this,t),this.view=n,this.layer=i,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=n.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(n.state),n.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,n)}return kc(t,[{key:"update",value:function t(n){n.startState.facet(ie)!=n.state.facet(ie)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&n.view.requestMeasure(this.measureReq)}},{key:"setOrder",value:function t(n){for(var i=0,e=n.facet(ie);i<e.length&&e[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}},{key:"measure",value:function t(){return this.layer.markers(this.view)}},{key:"draw",value:function t(n){var i,e,r,u,o,s,h=this;if(n.length!=this.drawn.length||n.some((function(t,n){return!xd(t,h.drawn[n])}))){i=this.dom.firstChild,e=0,r=ic(n);try{for(r.s();!(u=r.n()).done;)(o=u.value).update&&i&&o.constructor&&this.drawn[e].constructor&&o.update(i,this.drawn[e])?(i=i.nextSibling,e++):this.dom.insertBefore(o.draw(),i)}catch(t){r.e(t)}finally{r.f()}for(;i;)s=i.nextSibling,i.remove(),i=s;this.drawn=n}}},{key:"destroy",value:function t(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}]),t}(),ie=w.define(),ee=!Ft.ios,re=w.define({combine:function t(n){return il(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function t(n,i){return Math.min(n,i)},drawRangeCursor:function t(n,i){return n||i}})}}),ue=Sd({above:!0,markers:function t(n){var i,e,r,u,o,s,h,f,a=n.state,c=a.facet(re),l=[],v=ic(a.selection.ranges);try{for(v.s();!(i=v.n()).done;)if(r=(e=i.value)==a.selection.main,e.empty?!r||ee:c.drawRangeCursor){u=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=e.empty?e:m.cursor(e.head,e.head>e.anchor?-1:1),s=ic(te.forRange(n,u,o));try{for(s.s();!(h=s.n()).done;)f=h.value,l.push(f)}catch(t){s.e(t)}finally{s.f()}}}catch(t){v.e(t)}finally{v.f()}return l},update:function t(n,i){n.transactions.some((function(t){return t.selection}))&&(i.style.animationName="cm-blink"==i.style.animationName?"cm-blink2":"cm-blink");var e=Od(n);return e&&Ad(n.state,i),n.docChanged||n.selectionSet||e},mount:function t(n,i){Ad(i.state,n)},class:"cm-cursorLayer"}),oe=Sd({above:!1,markers:function t(n){return n.state.selection.ranges.map((function(t){return t.empty?[]:te.forRange(n,"cm-selectionBackground",t)})).reduce((function(t,n){return t.concat(n)}))},update:function t(n,i){return n.docChanged||n.selectionSet||n.viewportChanged||Od(n)},class:"cm-selectionLayer"}),se={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}},ee&&(se[".cm-line"].caretColor="transparent !important"),he=E.highest(Ui.theme(se)),fe=U.define({map:function t(n,i){return null==n?null:i.mapPos(n)}}),ae=x.define({create:function t(){return null},update:function t(n,i){return null!=n&&(n=i.changes.mapPos(n)),i.effects.reduce((function(t,n){return n.is(fe)?n.value:t}),n)}}),ce=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return kc(t,[{key:"update",value:function t(n){var i,e=n.state.field(ae);null==e?null!=this.cursor&&(null===(i=this.cursor)||void 0===i||i.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ae)!=e||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function t(){var n,i=this.view.state.field(ae),e=null!=i&&this.view.coordsAtPos(i);return e?(n=this.view.scrollDOM.getBoundingClientRect(),{left:e.left-n.left+this.view.scrollDOM.scrollLeft,top:e.top-n.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}):null}},{key:"drawCursor",value:function t(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}},{key:"destroy",value:function t(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function t(n){this.view.state.field(ae)!=n&&this.view.dispatch({effects:fe.of(n)})}}]),t}(),{eventHandlers:{dragover:function t(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave:function t(n){n.target!=this.view.contentDOM&&this.view.contentDOM.contains(n.relatedTarget)||this.setDropPos(null)},dragend:function t(){this.setDropPos(null)},drop:function t(){this.setDropPos(null)}}}),le=function(){function t(n){yc(this,t);var i=n.regexp,e=n.decoration,r=n.decorate,u=n.boundary,o=n.maxLength,s=void 0===o?1e3:o;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,r)this.addMatch=function(t,n,i,e){return r(e,i,i+t[0].length,t,n)};else if("function"==typeof e)this.addMatch=function(t,n,i,r){var u=e(t,n,i);u&&r(i,i+t[0].length,u)};else{if(!e)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,n,i,r){return r(i,i+t[0].length,e)}}this.boundary=u,this.maxLength=s}return kc(t,[{key:"createDeco",value:function t(n){var i,e,r,u,o=this,s=new nt,h=s.add.bind(s),f=ic(Id(n,this.maxLength));try{for(f.s();!(i=f.n()).done;)r=(e=i.value).from,u=e.to,Ed(n.state.doc,this.regexp,r,u,(function(t,i){return o.addMatch(i,n,t,h)}))}catch(t){f.e(t)}finally{f.f()}return s.finish()}},{key:"updateDeco",value:function t(n,i){var e=1e9,r=-1;return n.docChanged&&n.changes.iterChanges((function(t,i,u,o){o>n.view.viewport.from&&u<n.view.viewport.to&&(e=Math.min(u,e),r=Math.max(o,r))})),n.viewportChanged||r-e>1e3?this.createDeco(n.view):r>-1?this.updateRange(n.view,i.map(n.changes),e,r):i}},{key:"updateRange",value:function t(n,i,e,r){var u,o,s=this,h=ic(n.visibleRanges);try{for(o=function t(){var o,h,f,a,c,l,v,d=u.value,y=Math.max(d.from,e),p=Math.min(d.to,r);if(p>y){if(h=(o=n.state.doc.lineAt(y)).to<p?n.state.doc.lineAt(p):o,f=Math.max(d.from,o.from),a=Math.min(d.to,h.to),s.boundary){for(;y>o.from;y--)if(s.boundary.test(o.text[y-1-o.from])){f=y;break}for(;p<h.to;p++)if(s.boundary.test(h.text[p-h.from])){a=p;break}}if(c=[],v=function t(n,i,e){return c.push(e.range(n,i))},o==h)for(s.regexp.lastIndex=f-o.from;(l=s.regexp.exec(o.text))&&l.index<a-o.from;)s.addMatch(l,n,l.index+o.from,v);else Ed(n.state.doc,s.regexp,f,a,(function(t,i){return s.addMatch(i,n,t,v)}));i=i.update({filterFrom:f,filterTo:a,filter:function t(n,i){return n<f||i>a},add:c})}},h.s();!(u=h.n()).done;)o()}catch(t){h.e(t)}finally{h.f()}return i}}]),t}(),ve=null!=/x/.unicode?"gu":"g",de=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]",ve),ye={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},pe=null,ke=w.define({combine:function t(n){var i=il(n,{render:null,specialChars:de,addSpecialChars:null});return(i.replaceTabs=!Rd())&&(i.specialChars=new RegExp("\t|"+i.specialChars.source,ve)),i.addSpecialChars&&(i.specialChars=new RegExp(i.specialChars.source+"|"+i.addSpecialChars.source,ve)),i}}),me=null,ge="\u2022",we=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).options=t,r.code=e,r}return kc(i,[{key:"eq",value:function t(n){return n.code==this.code}},{key:"toDOM",value:function t(n){var i,e=Td(this.code),r=n.state.phrase("Control character")+" "+(ye[this.code]||"0x"+this.code.toString(16)),u=this.options.render&&this.options.render(this.code,r,e);return u||((i=document.createElement("span")).textContent=e,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i)}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),be=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).width=t,e}return kc(i,[{key:"eq",value:function t(n){return n.width==this.width}},{key:"toDOM",value:function t(){var n=document.createElement("span");return n.textContent="\t",n.className="cm-tab",n.style.width=this.width+"px",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),Me=kn.fromClass(function(){function t(){yc(this,t),this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}return kc(t,[{key:"update",value:function t(n){var i=n.view,e=i.viewState.editorHeight-i.defaultLineHeight-i.documentPadding.top-.5;e!=this.height&&(this.height=e,this.attrs={style:"padding-bottom: ".concat(e,"px")})}}]),t}()),xe=Jt.line({class:"cm-activeLine"}),Se=kn.fromClass(function(){function t(n){yc(this,t),this.decorations=this.getDeco(n)}return kc(t,[{key:"update",value:function t(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,u=-1,o=[],s=ic(n.state.selection.ranges);try{for(s.s();!(i=s.n()).done;)e=i.value,(r=n.lineBlockAt(e.head)).from>u&&(o.push(xe.range(r.from)),u=r.from)}catch(t){s.e(t)}finally{s.f()}return Jt.set(o)}}]),t}(),{decorations:function t(n){return n.decorations}}),Ce=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).content=t,e}return kc(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?n.setAttribute("aria-label","placeholder "+this.content):n.setAttribute("aria-hidden","true"),n}},{key:"coordsAt",value:function t(n){var i,e,r,u=n.firstChild?gl(n.firstChild):[];return u.length?(i=window.getComputedStyle(n.parentNode),e=Sl(u[0],"rtl"!=i.direction),r=parseInt(i.lineHeight),e.bottom-e.top>1.5*r?{left:e.left,right:e.right,top:e.top,bottom:e.top+r}:e):null}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),Oe=2e3,Ae={Alt:[18,function(t){return!!t.altKey}],Control:[17,function(t){return!!t.ctrlKey}],Shift:[16,function(t){return!!t.shiftKey}],Meta:[91,function(t){return!!t.metaKey}]},De={style:"cursor: crosshair"},Ee="-10000px",Ie=function(){function t(n,i,e){yc(this,t),this.facet=i,this.createTooltipView=e,this.input=n.state.facet(i),this.tooltips=this.input.filter((function(t){return t})),this.tooltipViews=this.tooltips.map(e)}return kc(t,[{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p=n.state.facet(this.facet),k=p.filter((function(t){return t}));if(p===this.input){e=ic(this.tooltipViews);try{for(e.s();!(r=e.n()).done;)(u=r.value).update&&u.update(n)}catch(t){e.e(t)}finally{e.f()}return!1}for(o=[],s=0;s<k.length;s++)if(f=-1,h=k[s]){for(a=0;a<this.tooltips.length;a++)(c=this.tooltips[a])&&c.create==h.create&&(f=a);f<0?o[s]=this.createTooltipView(h):(l=o[s]=this.tooltipViews[f]).update&&l.update(n)}v=ic(this.tooltipViews);try{for(v.s();!(d=v.n()).done;)y=d.value,o.indexOf(y)<0&&(y.dom.remove(),null===(i=y.destroy)||void 0===i||i.call(y))}catch(t){v.e(t)}finally{v.f()}return this.input=p,this.tooltips=k,this.tooltipViews=o,!0}}]),t}(),Re=w.define({combine:function t(n){var i,e,r;return{position:Ft.ios?"absolute":(null===(i=n.find((function(t){return t.position})))||void 0===i?void 0:i.position)||"fixed",parent:(null===(e=n.find((function(t){return t.parent})))||void 0===e?void 0:e.parent)||null,tooltipSpace:(null===(r=n.find((function(t){return t.tooltipSpace})))||void 0===r?void 0:r.tooltipSpace)||$d}}}),Le=new WeakMap,je=kn.fromClass(function(){function t(n){var i,e=this;yc(this,t),this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1,i=n.state.facet(Re),this.position=i.position,this.parent=i.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Ie(n,_e,(function(t){return e.createTooltip(t)})),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((function(t){Date.now()>e.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&e.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return kc(t,[{key:"createContainer",value:function t(){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}},{key:"observeIntersection",value:function t(){var n,i,e;if(this.intersectionObserver){this.intersectionObserver.disconnect(),n=ic(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)e=i.value,this.intersectionObserver.observe(e.dom)}catch(t){n.e(t)}finally{n.f()}}}},{key:"measureSoon",value:function t(){var n=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout((function(){n.measureTimeout=-1,n.maybeMeasure()}),50))}},{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a;if(n.transactions.length&&(this.lastTransaction=Date.now()),(i=this.manager.update(n))&&this.observeIntersection(),e=i||n.geometryChanged,(r=n.state.facet(Re)).position!=this.position){this.position=r.position,u=ic(this.manager.tooltipViews);try{for(u.s();!(o=u.n()).done;)(s=o.value).dom.style.position=this.position}catch(t){u.e(t)}finally{u.f()}e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer(),h=ic(this.manager.tooltipViews);try{for(h.s();!(f=h.n()).done;)a=f.value,this.container.appendChild(a.dom)}catch(t){h.e(t)}finally{h.f()}e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}},{key:"createTooltip",value:function t(n){var i,e=n.create(this.view);return e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")&&((i=document.createElement("div")).className="cm-tooltip-arrow",e.dom.appendChild(i)),e.dom.style.position=this.position,e.dom.style.top=Ee,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}},{key:"destroy",value:function t(){var n,i,e,r,u;this.view.win.removeEventListener("resize",this.measureSoon),e=ic(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(u=r.value).dom.remove(),null===(n=u.destroy)||void 0===n||n.call(u)}catch(t){e.e(t)}finally{e.f()}null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function t(){var n=this,i=this.view.dom.getBoundingClientRect();return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((function(t,i){var e=n.manager.tooltipViews[i];return e.getCoords?e.getCoords(t.pos):n.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((function(t){var n;return t.dom.getBoundingClientRect()})),space:this.view.state.facet(Re).tooltipSpace(this.view)}}},{key:"writeMeasure",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x=n.editor,S=n.space,C=[];for(e=0;e<this.manager.tooltips.length;e++)if(r=this.manager.tooltips[e],o=(u=this.manager.tooltipViews[e]).dom,s=n.pos[e],h=n.size[e],!s||s.bottom<=Math.max(x.top,S.top)||s.top>=Math.min(x.bottom,S.bottom)||s.right<Math.max(x.left,S.left)-.1||s.left>Math.min(x.right,S.right)+.1)o.style.top=Ee;else{if(a=(f=r.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null)?7:0,c=h.right-h.left,l=null!==(i=Le.get(u))&&void 0!==i?i:h.bottom-h.top,v=u.offset||Be,d=this.view.textDirection==An.LTR,y=h.width>S.right-S.left?d?S.left:S.right-h.width:d?Math.min(s.left-(f?14:0)+v.x,S.right-c):Math.max(S.left,s.left-c+(f?14:0)-v.x),p=!!r.above,!r.strictSide&&(p?s.top-(h.bottom-h.top)-v.y<S.top:s.bottom+(h.bottom-h.top)+v.y>S.bottom)&&p==S.bottom-s.bottom>s.top-S.top&&(p=!p),(k=(p?s.top-S.top:S.bottom-s.bottom)-a)<l&&!1!==u.resize){if(k<this.view.defaultLineHeight){o.style.top=Ee;continue}Le.set(u,l),o.style.height=(l=k)+"px"}else o.style.height&&(o.style.height="");if(m=p?s.top-l-a-v.y:s.bottom+a+v.y,g=y+c,!0!==u.overlap){w=ic(C);try{for(w.s();!(b=w.n()).done;)(M=b.value).left<g&&M.right>y&&M.top<m+l&&M.bottom>m&&(m=p?M.top-l-2-a:M.bottom+a+2)}catch(t){w.e(t)}finally{w.f()}}"absolute"==this.position?(o.style.top=m-n.parent.top+"px",o.style.left=y-n.parent.left+"px"):(o.style.top=m+"px",o.style.left=y+"px"),f&&(f.style.left="".concat(s.left+(d?v.x:-v.x)-(y+14-7),"px")),!0!==u.overlap&&C.push({left:y,top:m,right:g,bottom:m+l}),o.classList.toggle("cm-tooltip-above",p),o.classList.toggle("cm-tooltip-below",!p),u.positioned&&u.positioned(n.space)}}},{key:"maybeMeasure",value:function t(){var n,i,e;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))){n=ic(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)(e=i.value).dom.style.top=Ee}catch(t){n.e(t)}finally{n.f()}}}}]),t}(),{eventHandlers:{scroll:function t(){this.maybeMeasure()}}}),Te=Ui.baseTheme({".cm-tooltip":{zIndex:100,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:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Be={x:0,y:0},_e=w.define({enables:[je,Te]}),Ne=w.define(),Pe=function(){function t(n){var i=this;yc(this,t),this.view=n,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ie(n,Ne,(function(t){return i.createHostedView(t)}))}return kc(t,[{key:"createHostedView",value:function t(n){var i=n.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(i.dom),this.mounted&&i.mount&&i.mount(this.view),i}},{key:"mount",value:function t(n){var i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)(e=i.value).mount&&e.mount(n)}catch(t){r.e(t)}finally{r.f()}this.mounted=!0}},{key:"positioned",value:function t(n){var i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)(e=i.value).positioned&&e.positioned(n)}catch(t){r.e(t)}finally{r.f()}}},{key:"update",value:function t(n){this.manager.update(n)}},{key:"destroy",value:function t(){var n,i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)null===(n=(e=i.value).destroy)||void 0===n||n.call(e)}catch(t){r.e(t)}finally{r.f()}}}],[{key:"create",value:function n(i){return new t(i)}}]),t}(),Fe=_e.compute([Ne],(function(t){var n=t.facet(Ne).filter((function(t){return t}));return 0===n.length?null:{pos:Math.min.apply(Math,Ja(n.map((function(t){return t.pos})))),end:Math.max.apply(Math,Ja(n.filter((function(t){return null!=t.end})).map((function(t){return t.end})))),create:Pe.create,above:n[0].above,arrow:n.some((function(t){return t.arrow}))}})),He=function(){function t(n,i,e,r,u){yc(this,t),this.view=n,this.source=i,this.field=e,this.setHover=r,this.hoverTime=u,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:n.dom,time:0},this.checkHover=this.checkHover.bind(this),n.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),n.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return kc(t,[{key:"update",value:function t(){var n=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((function(){return n.startHover()}),20))}},{key:"active",get:function t(){return this.view.state.field(this.field)}},{key:"checkHover",value:function t(){if(this.hoverTimeout=-1,!this.active){var n=Date.now()-this.lastMove.time;n<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover()}}},{key:"startHover",value:function t(){var n,i,e,r,u,o,s,h=this;clearTimeout(this.restartTimeout),n=this.lastMove,null!=(i=this.view.contentDOM.contains(n.target)?this.view.posAtCoords(n):null)&&(null==(e=this.view.coordsAtPos(i))||n.y<e.top||n.y>e.bottom||n.x<e.left-this.view.defaultCharacterWidth||n.x>e.right+this.view.defaultCharacterWidth||(u=(r=this.view.bidiSpans(this.view.state.doc.lineAt(i)).find((function(t){return t.from<=i&&t.to>=i})))&&r.dir==An.RTL?-1:1,(null==(o=this.source(this.view,i,n.x<e.left?-u:u))?void 0:o.then)?(s=this.pending={pos:i},o.then((function(t){h.pending==s&&(h.pending=null,t&&h.view.dispatch({effects:h.setHover.of(t)}))}),(function(t){return Yl(h.view.state,t,"hover tooltip")}))):o&&this.view.dispatch({effects:this.setHover.of(o)})))}},{key:"mousemove",value:function t(n){var i,e,r,u,o;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime)),((e=this.active)&&!qd(this.lastMove.target)||this.pending)&&(((u=(r=e||this.pending).pos)==(o=null!==(i=null==e?void 0:e.end)&&void 0!==i?i:u)?this.view.posAtCoords(this.lastMove)==u:Gd(this.view,u,o,n.clientX,n.clientY,6))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null))}},{key:"mouseleave",value:function t(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!qd(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}},{key:"destroy",value:function t(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),t}(),We=(ze=U.define()).of(null),Ve=w.define({combine:function t(n){var i,e,r,u,o=ic(n);try{for(o.s();!(r=o.n()).done;)u=r.value,i=i||u.topContainer,e=e||u.bottomContainer}catch(t){o.e(t)}finally{o.f()}return{topContainer:i,bottomContainer:e}}}),Ue=kn.fromClass(function(){function t(n){var i,e,r,u;yc(this,t),this.input=n.state.facet(qe),this.specs=this.input.filter((function(t){return t})),this.panels=this.specs.map((function(t){return t(n)})),i=n.state.facet(Ve),this.top=new $e(n,!0,i.topContainer),this.bottom=new $e(n,!1,i.bottomContainer),this.top.sync(this.panels.filter((function(t){return t.top}))),this.bottom.sync(this.panels.filter((function(t){return!t.top}))),e=ic(this.panels);try{for(e.s();!(r=e.n()).done;)(u=r.value).dom.classList.add("cm-panel"),u.mount&&u.mount()}catch(t){e.e(t)}finally{e.f()}}return kc(t,[{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g=n.state.facet(Ve);if(this.top.container!=g.topContainer&&(this.top.sync([]),this.top=new $e(n.view,!0,g.topContainer)),this.bottom.container!=g.bottomContainer&&(this.bottom.sync([]),this.bottom=new $e(n.view,!1,g.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses(),(i=n.state.facet(qe))!=this.input){r=[],u=[],o=[],s=[],h=ic(e=i.filter((function(t){return t})));try{for(h.s();!(f=h.n()).done;)a=f.value,c=this.specs.indexOf(a),l=void 0,c<0?(l=a(n.view),s.push(l)):(l=this.panels[c]).update&&l.update(n),r.push(l),(l.top?u:o).push(l)}catch(t){h.e(t)}finally{h.f()}for(this.specs=e,this.panels=r,this.top.sync(u),this.bottom.sync(o),v=0,d=s;v<d.length;v++)(y=d[v]).dom.classList.add("cm-panel"),y.mount&&y.mount()}else{p=ic(this.panels);try{for(p.s();!(k=p.n()).done;)(m=k.value).update&&m.update(n)}catch(t){p.e(t)}finally{p.f()}}}},{key:"destroy",value:function t(){this.top.sync([]),this.bottom.sync([])}}]),t}(),{provide:function t(n){return Ui.scrollMargins.of((function(t){var i=t.plugin(n);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))}}),$e=function(){function t(n,i,e){yc(this,t),this.view=n,this.top=i,this.container=e,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}return kc(t,[{key:"sync",value:function t(n){var i,e,r=ic(this.panels);try{for(r.s();!(i=r.n()).done;)(e=i.value).destroy&&n.indexOf(e)<0&&e.destroy()}catch(t){r.e(t)}finally{r.f()}this.panels=n,this.syncDOM()}},{key:"syncDOM",value:function t(){var n,i,e,r,u;if(0!=this.panels.length){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",(n=this.container||this.view.dom).insertBefore(this.dom,this.top?n.firstChild:null)),i=this.dom.firstChild,e=ic(this.panels);try{for(e.s();!(r=e.n()).done;)if((u=r.value).dom.parentNode==this.dom){for(;i!=u.dom;)i=ty(i);i=i.nextSibling}else this.dom.insertBefore(u.dom,i)}catch(t){e.e(t)}finally{e.f()}for(;i;)i=ty(i)}else this.dom&&(this.dom.remove(),this.dom=void 0)}},{key:"scrollMargin",value:function t(){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)}},{key:"syncClasses",value:function t(){var n,i,e,r,u,o;if(this.container&&this.classes!=this.view.themeClasses){n=ic(this.classes.split(" "));try{for(n.s();!(i=n.n()).done;)(e=i.value)&&this.container.classList.remove(e)}catch(t){n.e(t)}finally{n.f()}r=ic((this.classes=this.view.themeClasses).split(" "));try{for(r.s();!(u=r.n()).done;)(o=u.value)&&this.container.classList.add(o)}catch(t){r.e(t)}finally{r.f()}}}}]),t}(),qe=w.define({enables:Ue}),Ge=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"eq",value:function t(n){return!1}},{key:"destroy",value:function t(n){}}]),i}(X),Ge.prototype.elementClass="",Ge.prototype.toDOM=void 0,Ge.prototype.mapMode=v.TrackBefore,Ge.prototype.startSide=Ge.prototype.endSide=-1,Ge.prototype.point=!0,Je=w.define(),Ke={class:"",renderEmptyElements:!1,elementStyle:"",markers:function t(){return tt.empty},lineMarker:function t(){return null},widgetMarker:function t(){return null},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Qe=w.define(),Xe=w.define({combine:function t(n){return n.some((function(t){return t}))}}),Ze=kn.fromClass(function(){function t(n){var i,e,r;yc(this,t),this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(Qe).map((function(t){return new tr(n,t)})),i=ic(this.gutters);try{for(i.s();!(e=i.n()).done;)r=e.value,this.dom.appendChild(r.dom)}catch(t){i.e(t)}finally{i.f()}this.fixed=!n.state.facet(Xe),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}return kc(t,[{key:"update",value:function t(n){var i,e,r;this.updateGutters(n)&&(i=this.prevViewport,e=n.view.viewport,r=Math.min(i.to,e.to)-Math.max(i.from,e.from),this.syncGutters(r<.8*(e.to-e.from))),n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Xe)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}},{key:"syncGutters",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S=this,C=this.dom.nextSibling;n&&this.dom.remove(),i=tt.iter(this.view.state.facet(Je),this.view.viewport.from),e=[],r=this.gutters.map((function(t){return new Ye(t,S.view.viewport,-S.view.documentPadding.top)})),u=ic(this.view.viewportLineBlocks);try{for(u.s();!(o=u.n()).done;)if(s=o.value,e.length&&(e=[]),Array.isArray(s.type)){h=!0,f=ic(s.type);try{for(f.s();!(a=f.n()).done;)if((c=a.value).type==Gt.Text&&h){ry(i,e,c.from),l=ic(r);try{for(l.s();!(v=l.n()).done;)(d=v.value).line(this.view,c,e)}catch(t){l.e(t)}finally{l.f()}h=!1}else if(c.widget){y=ic(r);try{for(y.s();!(p=y.n()).done;)(k=p.value).widget(this.view,c)}catch(t){y.e(t)}finally{y.f()}}}catch(t){f.e(t)}finally{f.f()}}else if(s.type==Gt.Text){ry(i,e,s.from),m=ic(r);try{for(m.s();!(g=m.n()).done;)(w=g.value).line(this.view,s,e)}catch(t){m.e(t)}finally{m.f()}}}catch(t){u.e(t)}finally{u.f()}b=ic(r);try{for(b.s();!(M=b.n()).done;)(x=M.value).finish()}catch(t){b.e(t)}finally{b.f()}n&&this.view.scrollDOM.insertBefore(this.dom,C)}},{key:"updateGutters",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p=n.startState.facet(Qe),k=n.state.facet(Qe),m=n.docChanged||n.heightChanged||n.viewportChanged||!tt.eq(n.startState.facet(Je),n.state.facet(Je),n.view.viewport.from,n.view.viewport.to);if(p==k){i=ic(this.gutters);try{for(i.s();!(e=i.n()).done;)(r=e.value).update(n)&&(m=!0)}catch(t){i.e(t)}finally{i.f()}}else{m=!0,u=[],o=ic(k);try{for(o.s();!(s=o.n()).done;)h=s.value,(f=p.indexOf(h))<0?u.push(new tr(this.view,h)):(this.gutters[f].update(n),u.push(this.gutters[f]))}catch(t){o.e(t)}finally{o.f()}a=ic(this.gutters);try{for(a.s();!(c=a.n()).done;)(l=c.value).dom.remove(),u.indexOf(l)<0&&l.destroy()}catch(t){a.e(t)}finally{a.f()}for(v=0,d=u;v<d.length;v++)y=d[v],this.dom.appendChild(y.dom);this.gutters=u}return m}},{key:"destroy",value:function t(){var n,i,e=ic(this.gutters);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy()}catch(t){e.e(t)}finally{e.f()}this.dom.remove()}}]),t}(),{provide:function t(n){return Ui.scrollMargins.of((function(t){var i=t.plugin(n);return i&&0!=i.gutters.length&&i.fixed?t.textDirection==An.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))}}),Ye=function(){function t(n,i,e){yc(this,t),this.gutter=n,this.height=e,this.i=0,this.cursor=tt.iter(n.markers,i.from)}return kc(t,[{key:"addElement",value:function t(n,i,e){var r,u=this.gutter,o=i.top-this.height;this.i==u.elements.length?(r=new nr(n,i.height,o,e),u.elements.push(r),u.dom.appendChild(r.dom)):u.elements[this.i].update(n,i.height,o,e),this.height=i.bottom,this.i++}},{key:"line",value:function t(n,i,e){var r,u,o=[];ry(this.cursor,o,i.from),e.length&&(o=o.concat(e)),(r=this.gutter.config.lineMarker(n,i,o))&&o.unshift(r),u=this.gutter,(0!=o.length||u.config.renderEmptyElements)&&this.addElement(n,i,o)}},{key:"widget",value:function t(n,i){var e=this.gutter.config.widgetMarker(n,i.widget,i);e&&this.addElement(n,i,[e])}},{key:"finish",value:function t(){for(var n,i=this.gutter;i.elements.length>this.i;)n=i.elements.pop(),i.dom.removeChild(n.dom),n.destroy()}}]),t}(),tr=function(){function t(n,i){var e,r,u=this;for(r in yc(this,t),this.view=n,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),e=function t(e){u.dom.addEventListener(e,(function(t){var r,o,s,h=t.target;if(h!=u.dom&&u.dom.contains(h)){for(;h.parentNode!=u.dom;)h=h.parentNode;r=((o=h.getBoundingClientRect()).top+o.bottom)/2}else r=t.clientY;s=n.lineBlockAtHeight(r-n.documentTop),i.domEventHandlers[e](n,s,t)&&t.preventDefault()}))},i.domEventHandlers)e(r);this.markers=ey(i.markers(n)),i.initialSpacer&&(this.spacer=new nr(n,0,0,[i.initialSpacer(n)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return kc(t,[{key:"update",value:function t(n){var i,e,r=this.markers;return this.markers=ey(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer&&(i=this.config.updateSpacer(this.spacer.markers[0],n))!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[i]),e=n.view.viewport,!tt.eq(this.markers,r,e.from,e.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(n)}},{key:"destroy",value:function t(){var n,i,e=ic(this.elements);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy()}catch(t){e.e(t)}finally{e.f()}}}]),t}(),nr=function(){function t(n,i,e,r){yc(this,t),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(n,i,e,r)}return kc(t,[{key:"update",value:function t(n,i,e,r){this.height!=i&&(this.dom.style.height=(this.height=i)+"px"),this.above!=e&&(this.dom.style.marginTop=(this.above=e)?e+"px":""),uy(this.markers,r)||this.setMarkers(n,r)}},{key:"setMarkers",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l="cm-gutterElement",v=this.dom.firstChild;for(e=0,r=0;;){if(u=r,s=!1,o=e<i.length?i[e++]:null){for((h=o.elementClass)&&(l+=" "+h),f=r;f<this.markers.length;f++)if(this.markers[f].compare(o)){u=f,s=!0;break}}else u=this.markers.length;for(;r<u;)(a=this.markers[r++]).toDOM&&(a.destroy(v),c=v.nextSibling,v.remove(),v=c);if(!o)break;o.toDOM&&(s?v=v.nextSibling:this.dom.insertBefore(o.toDOM(n),v)),s&&r++}this.dom.className=l,this.markers=i}},{key:"destroy",value:function t(){this.setMarkers(null,[])}}]),t}(),ir=w.define(),er=w.define({combine:function t(n){return il(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function t(n,i){var e,r=Object.assign({},n),u=function t(){var n=r[e],u=i[e];r[e]=n?function(t,i,e){return n(t,i,e)||u(t,i,e)}:u};for(e in i)u();return r}})}}),rr=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).number=t,e}return kc(i,[{key:"eq",value:function t(n){return this.number==n.number}},{key:"toDOM",value:function t(){return document.createTextNode(this.number)}}]),i}(Ge),ur=Qe.compute([er],(function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function t(n){return n.state.facet(ir)},lineMarker:function t(n,i,e){return e.some((function(t){return t.toDOM}))?null:new rr(oy(n,n.state.doc.lineAt(i.from).number))},widgetMarker:function t(){return null},lineMarkerChange:function t(n){return n.startState.facet(er)!=n.state.facet(er)},initialSpacer:function t(n){return new rr(oy(n,hy(n.state.doc.lines)))},updateSpacer:function t(n,i){var e=oy(i.view,hy(i.view.state.doc.lines));return e==n.number?n:new rr(e)},domEventHandlers:t.facet(er).domEventHandlers}})),or=new(function(t){sc(i,t);var n=fc(i);function i(){var t;return yc(this,i),(t=n.apply(this,arguments)).elementClass="cm-activeLineGutter",t}return kc(i)}(Ge)),sr=Je.compute(["selection"],(function(t){var n,i,e,r=[],u=-1,o=ic(t.selection.ranges);try{for(o.s();!(n=o.n()).done;)i=n.value,(e=t.doc.lineAt(i.head).from)>u&&(u=e,r.push(or.range(e)))}catch(t){o.e(t)}finally{o.f()}return tt.of(r)})),hr=new Map,fr=cy(new le({regexp:/\t| +/g,decoration:function t(n){return ay(n[0])},boundary:/\S/})),ar=cy(new le({regexp:/\s+$/g,decoration:Jt.mark({class:"cm-trailingSpace"}),boundary:/\S/})),cr={HeightMap:gi,HeightOracle:di,MeasuredHeights:yi,QueryType:ki,ChangedRange:Cn,computeOrder:ev,moveVisually:uv},lr=n.View=Object.freeze({__proto__:null,BidiSpan:Hn,BlockInfo:pi,get BlockType(){return Gt},Decoration:Jt,get Direction(){return An},EditorView:Ui,GutterMarker:Ge,MatchDecorator:le,RectangleMarker:te,ViewPlugin:kn,ViewUpdate:On,WidgetType:qt,qde:cr,closeHoverTooltips:We,crosshairCursor:Vd,drawSelection:Cd,dropCursor:Dd,getPanel:Yd,getTooltip:Kd,gutter:ny,gutterLineClass:Je,gutters:iy,hasHoverTooltips:Qd,highlightActiveLine:_d,highlightActiveLineGutter:fy,highlightSpecialChars:Ld,highlightTrailingWhitespace:vy,highlightWhitespace:ly,hoverTooltip:Jd,keymap:Qi,layer:Sd,lineNumberMarkers:ir,lineNumbers:sy,logException:Yl,panels:Zd,placeholder:Nd,rectangularSelection:Wd,repositionTooltips:Xd,runScopeHandlers:pd,scrollPastEnd:Bd,showPanel:qe,showTooltip:_e,tooltips:Ud}),vr=1024,dr=0,yr=kc((function t(n,i){yc(this,t),this.from=n,this.to=i})),pr=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};yc(this,t),this.id=dr++,this.perNode=!!n.perNode,this.deserialize=n.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return kc(t,[{key:"add",value:function t(n){var i=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof n&&(n=mr.match(n)),function(t){var e=n(t);return void 0===e?null:[i,e]}}}]),t}(),pr.closedBy=new pr({deserialize:function t(n){return n.split(" ")}}),pr.openedBy=new pr({deserialize:function t(n){return n.split(" ")}}),pr.group=new pr({deserialize:function t(n){return n.split(" ")}}),pr.contextHash=new pr({perNode:!0}),pr.lookAhead=new pr({perNode:!0}),pr.mounted=new pr({perNode:!0}),kr=Object.create(null),mr=function(){function t(n,i,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;yc(this,t),this.name=n,this.props=i,this.id=e,this.flags=r}return kc(t,[{key:"prop",value:function t(n){return this.props[n.id]}},{key:"isTop",get:function t(){return(1&this.flags)>0}},{key:"isSkipped",get:function t(){return(2&this.flags)>0}},{key:"isError",get:function t(){return(4&this.flags)>0}},{key:"isAnonymous",get:function t(){return(8&this.flags)>0}},{key:"is",value:function t(n){if("string"==typeof n){if(this.name==n)return!0;var i=this.prop(pr.group);return!!i&&i.indexOf(n)>-1}return this.id==n}}],[{key:"define",value:function n(i){var e,r,u,o=i.props&&i.props.length?Object.create(null):kr,s=(i.top?1:0)|(i.skipped?2:0)|(i.error?4:0)|(null==i.name?8:0),h=new t(i.name||"",o,i.id,s);if(i.props){e=ic(i.props);try{for(e.s();!(r=e.n()).done;)if(u=r.value,Array.isArray(u)||(u=u(h)),u){if(u[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");o[u[0].id]=u[1]}}catch(t){e.e(t)}finally{e.f()}}return h}},{key:"match",value:function t(n){var i,e,r,u,o=Object.create(null);for(i in n){e=ic(i.split(" "));try{for(e.s();!(r=e.n()).done;)u=r.value,o[u]=n[i]}catch(t){e.e(t)}finally{e.f()}}return function(t){var n,i,e;for(n=t.prop(pr.group),i=-1;i<(n?n.length:0);i++)if(e=o[i<0?t.name:n[i]])return e}}}]),t}(),mr.none=new mr("",Object.create(null),0,8),gr=function(){function t(n){yc(this,t),this.types=n;for(var i=0;i<n.length;i++)if(n[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}return kc(t,[{key:"extend",value:function n(){var i,e,r,u,o,s,h,f,a,c,l,v=[];for(i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];u=ic(this.types);try{for(u.s();!(o=u.n()).done;){s=o.value,h=null,f=ic(e);try{for(f.s();!(a=f.n()).done;)(l=(c=a.value)(s))&&(h||(h=Object.assign({},s.props)),h[l[0].id]=l[1])}catch(t){f.e(t)}finally{f.f()}v.push(h?new mr(s.name,h,s.id,s.flags):s)}}catch(t){u.e(t)}finally{u.f()}return new t(v)}}]),t}(),wr=new WeakMap,br=new WeakMap,function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(Mr||(Mr={})),xr=function(){function t(n,i,e,r,u){var o,s,h,f,a;if(yc(this,t),this.type=n,this.children=i,this.positions=e,this.length=r,this.props=null,u&&u.length){this.props=Object.create(null),o=ic(u);try{for(o.s();!(s=o.n()).done;)f=(h=Za(s.value,2))[0],a=h[1],this.props["number"==typeof f?f:f.id]=a}catch(t){o.e(t)}finally{o.f()}}}return kc(t,[{key:"toString",value:function t(){var n,i,e,r,u,o=this.prop(pr.mounted);if(o&&!o.overlay)return o.tree.toString();n="",i=ic(this.children);try{for(i.s();!(e=i.n()).done;)(u=(r=e.value).toString())&&(n&&(n+=","),n+=u)}catch(t){i.e(t)}finally{i.f()}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}},{key:"cursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Er(this.topNode,n)}},{key:"cursorAt",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=wr.get(this)||this.topNode,u=new Er(r);return u.moveTo(n,i),wr.set(this,u.oMi),u}},{key:"topNode",get:function t(){return new Or(this,0,0,null)}},{key:"resolve",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=py(wr.get(this)||this.topNode,n,i,!1);return wr.set(this,e),e}},{key:"resolveInner",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=py(br.get(this)||this.topNode,n,i,!0);return br.set(this,e),e}},{key:"iterate",value:function t(n){var i,e,r=n.enter,u=n.leave,o=n.from,s=void 0===o?0:o,h=n.to,f=void 0===h?this.length:h,a=n.mode||0,c=(a&Mr.IncludeAnonymous)>0;for(i=this.cursor(a|Mr.IncludeAnonymous);;){if(e=!1,i.from<=f&&i.to>=s&&(!c&&i.type.isAnonymous||!1!==r(i))){if(i.firstChild())continue;e=!0}for(;e&&u&&(c||!i.type.isAnonymous)&&u(i),!i.nextSibling();){if(!i.parent())return;e=!0}}}},{key:"prop",value:function t(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}},{key:"propValues",get:function t(){var n,i=[];if(this.props)for(n in this.props)i.push([+n,this.props[n]]);return i}},{key:"balance",value:function n(){var i=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:My(mr.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,e,r){return new t(i.type,n,e,r,i.propValues)}),e.makeTree||function(n,i,e){return new t(mr.none,n,i,e)})}}],[{key:"build",value:function t(n){return wy(n)}}]),t}(),xr.empty=new xr(mr.none,[],[],0),Sr=function(){function t(n,i){yc(this,t),this.buffer=n,this.index=i}return kc(t,[{key:"id",get:function t(){return this.buffer[this.index-4]}},{key:"start",get:function t(){return this.buffer[this.index-3]}},{key:"end",get:function t(){return this.buffer[this.index-2]}},{key:"size",get:function t(){return this.buffer[this.index-1]}},{key:"pos",get:function t(){return this.index}},{key:"next",value:function t(){this.index-=4}},{key:"fork",value:function n(){return new t(this.buffer,this.index)}}]),t}(),Cr=function(){function t(n,i,e){yc(this,t),this.buffer=n,this.length=i,this.set=e}return kc(t,[{key:"type",get:function t(){return mr.none}},{key:"toString",value:function t(){var n,i=[];for(n=0;n<this.buffer.length;)i.push(this.childString(n)),n=this.buffer[n+3];return i.join(",")}},{key:"childString",value:function t(n){var i,e=this.buffer[n],r=this.buffer[n+3],u=this.set.types[e],o=u.name;if(/\W/.test(o)&&!u.isError&&(o=JSON.stringify(o)),r==(n+=4))return o;for(i=[];n<r;)i.push(this.childString(n)),n=this.buffer[n+3];return o+"("+i.join(",")+")"}},{key:"findChild",value:function t(n,i,e,r,u){var o,s=this.buffer,h=-1;for(o=n;o!=i&&!(dy(u,r,s[o+1],s[o+2])&&(h=o,e>0));o=s[o+3]);return h}},{key:"slice",value:function n(i,e,r){var u,o,s,h=this.buffer,f=new Uint16Array(e-i),a=0;for(u=i,o=0;u<e;)f[o++]=h[u++],f[o++]=h[u++]-r,s=f[o++]=h[u++]-r,f[o++]=h[u++]-i,a=Math.max(a,s);return new t(f,a,this.set)}}]),t}(),Or=function(){function t(n,i,e,r){yc(this,t),this.oMi=n,this.from=i,this.index=e,this.sft=r}return kc(t,[{key:"type",get:function t(){return this.oMi.type}},{key:"name",get:function t(){return this.oMi.type.name}},{key:"to",get:function t(){return this.from+this.oMi.length}},{key:"nextChild",value:function n(i,e,r,u){var o,s,h,f,a,c,l,v,d,y,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;for(o=this;;){for(h=(s=o.oMi).children,f=s.positions,a=e>0?h.length:-1;i!=a;i+=e)if(c=h[i],dy(u,r,l=f[i]+o.from,l+c.length))if(c instanceof Cr){if(p&Mr.ExcludeBuffers)continue;if((v=c.findChild(0,c.buffer.length,e,r-l,u))>-1)return new Dr(new Ar(o,c,i,l),null,v)}else if(p&Mr.IncludeAnonymous||!c.type.isAnonymous||gy(c))return d=void 0,p&Mr.IgnoreMounts||!c.props||!(d=c.prop(pr.mounted))||d.overlay?(y=new t(c,l,i,o),p&Mr.IncludeAnonymous||!y.type.isAnonymous?y:y.nextChild(e<0?c.children.length-1:0,e,r,u)):new t(d.tree,l,i,o);if(p&Mr.IncludeAnonymous||!o.type.isAnonymous)return null;if(i=o.index>=0?o.index+e:e<0?-1:o.sft.oMi.children.length,!(o=o.sft))return null}}},{key:"firstChild",get:function t(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function t(){return this.nextChild(this.oMi.children.length-1,-1,0,4)}},{key:"childAfter",value:function t(n){return this.nextChild(0,1,n,2)}},{key:"childBefore",value:function t(n){return this.nextChild(this.oMi.children.length-1,-1,n,-2)}},{key:"enter",value:function n(i,e){var r,u,o,s,h,f,a,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(c&Mr.IgnoreOverlays)&&(r=this.oMi.prop(pr.mounted))&&r.overlay){u=i-this.from,o=ic(r.overlay);try{for(o.s();!(s=o.n()).done;)if(f=(h=s.value).from,a=h.to,(e>0?f<=u:f<u)&&(e<0?a>=u:a>u))return new t(r.tree,r.overlay[0].from+this.from,-1,this)}catch(t){o.e(t)}finally{o.f()}}return this.nextChild(0,1,i,e,c)}},{key:"nextSignificantParent",value:function t(){for(var n=this;n.type.isAnonymous&&n.sft;)n=n.sft;return n}},{key:"parent",get:function t(){return this.sft?this.sft.nextSignificantParent():null}},{key:"nextSibling",get:function t(){return this.sft&&this.index>=0?this.sft.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function t(){return this.sft&&this.index>=0?this.sft.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function t(){var n;return new Er(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return this.oMi}},{key:"toTree",value:function t(){return this.oMi}},{key:"resolve",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return yy(this,n)}},{key:"getChild",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=ky(this,n,i,e);return r.length?r[0]:null}},{key:"getChildren",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return ky(this,n,i,e)}},{key:"toString",value:function t(){return this.oMi.toString()}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return my(this,n)}}]),t}(),Ar=kc((function t(n,i,e,r){yc(this,t),this.parent=n,this.buffer=i,this.index=e,this.start=r})),Dr=function(){function t(n,i,e){yc(this,t),this.context=n,this.sft=i,this.index=e,this.type=n.buffer.set.types[n.buffer.buffer[e]]}return kc(t,[{key:"name",get:function t(){return this.type.name}},{key:"from",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function n(i,e,r){var u=this.context.buffer,o=u.findChild(this.index+4,u.buffer[this.index+3],i,e-this.context.start,r);return o<0?null:new t(this.context,this,o)}},{key:"firstChild",get:function t(){return this.child(1,0,4)}},{key:"lastChild",get:function t(){return this.child(-1,0,4)}},{key:"childAfter",value:function t(n){return this.child(1,n,2)}},{key:"childBefore",value:function t(n){return this.child(-1,n,-2)}},{key:"enter",value:function n(i,e){var r,u,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o&Mr.ExcludeBuffers||(u=(r=this.context.buffer).findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,i-this.context.start,e))<0?null:new t(this.context,this,u)}},{key:"parent",get:function t(){return this.sft||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function t(n){return this.sft?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}},{key:"nextSibling",get:function n(){var i=this.context.buffer,e=i.buffer[this.index+3];return e<(this.sft?i.buffer[this.sft.index+3]:i.buffer.length)?new t(this.context,this.sft,e):this.externalSibling(1)}},{key:"prevSibling",get:function n(){var i=this.context.buffer,e=this.sft?this.sft.index+4:0;return this.index==e?this.externalSibling(-1):new t(this.context,this.sft,i.findChild(e,this.index,-1,0,4))}},{key:"cursor",value:function t(){var n;return new Er(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return null}},{key:"toTree",value:function t(){var n,i=[],e=[],r=this.context.buffer,u=this.index+4,o=r.buffer[this.index+3];return o>u&&(n=r.buffer[this.index+1],i.push(r.slice(u,o,n)),e.push(0)),new xr(this.type,i,e,this.to-this.from)}},{key:"resolve",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return yy(this,n)}},{key:"toString",value:function t(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=ky(this,n,i,e);return r.length?r[0]:null}},{key:"getChildren",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return ky(this,n,i,e)}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return my(this,n)}}]),t}(),Er=function(){function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(yc(this,t),this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,n instanceof Or)this.yieldNode(n);else{for(this.oMi=n.context.parent,this.buffer=n.context,i=n.sft;i;i=i.sft)this.stack.unshift(i.index);this.bufferNode=n,this.yieldBuf(n.index)}}return kc(t,[{key:"name",get:function t(){return this.type.name}},{key:"yieldNode",value:function t(n){return!!n&&(this.oMi=n,this.type=n.type,this.from=n.from,this.to=n.to,!0)}},{key:"yieldBuf",value:function t(n,i){this.index=n;var e=this.buffer,r=e.start,u=e.buffer;return this.type=i||u.set.types[u.buffer[n]],this.from=r+u.buffer[n+1],this.to=r+u.buffer[n+2],!0}},{key:"yield",value:function t(n){return!!n&&(n instanceof Or?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)))}},{key:"toString",value:function t(){return this.buffer?this.buffer.buffer.childString(this.index):this.oMi.toString()}},{key:"enterChild",value:function t(n,i,e){var r,u;return this.buffer?!((u=(r=this.buffer.buffer).findChild(this.index+4,r.buffer[this.index+3],n,i-this.buffer.start,e))<0)&&(this.stack.push(this.index),this.yieldBuf(u)):this.yield(this.oMi.nextChild(n<0?this.oMi.oMi.children.length-1:0,n,i,e,this.mode))}},{key:"firstChild",value:function t(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function t(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function t(n){return this.enterChild(1,n,2)}},{key:"childBefore",value:function t(n){return this.enterChild(-1,n,-2)}},{key:"enter",value:function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(e&Mr.ExcludeBuffers)&&this.enterChild(1,n,i):this.yield(this.oMi.enter(n,i,e))}},{key:"parent",value:function t(){if(!this.buffer)return this.yieldNode(this.mode&Mr.IncludeAnonymous?this.oMi.sft:this.oMi.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Mr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function t(n){var i,e,r,u;if(!this.buffer)return!!this.oMi.sft&&this.yield(this.oMi.index<0?null:this.oMi.sft.nextChild(this.oMi.index+n,n,0,4,this.mode));if(i=this.buffer.buffer,e=this.stack.length-1,n<0){if(r=e<0?0:this.stack[e]+4,this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else if((u=i.buffer[this.index+3])<(e<0?i.buffer.length:i.buffer[this.stack[e]+3]))return this.yieldBuf(u);return e<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode))}},{key:"nextSibling",value:function t(){return this.sibling(1)}},{key:"prevSibling",value:function t(){return this.sibling(-1)}},{key:"atLastNode",value:function t(n){var i,e,r,u,o,s,h,f,a=this.buffer;if(a){if(n>0){if(this.index<a.buffer.buffer.length)return!1}else for(r=0;r<this.index;r++)if(a.buffer.buffer[r+3]<this.index)return!1;i=a.index,e=a.parent}else i=(u=this.oMi).index,e=u.sft;for(;e;i=(o=e).index,e=o.sft,o)if(i>-1)for(s=i+n,h=n<0?-1:e.oMi.children.length;s!=h;s+=n)if(f=e.oMi.children[s],this.mode&Mr.IncludeAnonymous||f instanceof Cr||!f.type.isAnonymous||gy(f))return!1;return!0}},{key:"move",value:function t(n,i){if(i&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}},{key:"next",value:function t(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,n)}},{key:"prev",value:function t(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,n)}},{key:"moveTo",value:function t(n){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(i<1?this.from>=n:this.from>n)||(i>-1?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,i););return this}},{key:"node",get:function t(){var n,i,e,r,u,o,s;if(!this.buffer)return this.oMi;if(i=null,e=0,(n=this.bufferNode)&&n.context==this.buffer)t:for(r=this.index,u=this.stack.length;u>=0;){for(o=n;o;o=o.sft)if(o.index==r){if(r==this.index)return o;i=o,e=u+1;break t}r=this.stack[--u]}for(s=e;s<this.stack.length;s++)i=new Dr(this.buffer,i,this.stack[s]);return this.bufferNode=new Dr(this.buffer,i,this.index)}},{key:"tree",get:function t(){return this.buffer?null:this.oMi.oMi}},{key:"iterate",value:function t(n,i){var e,r;for(e=0;;){if(r=!1,this.type.isAnonymous||!1!==n(this)){if(this.firstChild()){e++;continue}this.type.isAnonymous||(r=!0)}for(;r&&i&&i(this),r=this.type.isAnonymous,!this.nextSibling();){if(!e)return;this.parent(),e--,r=!0}}}},{key:"matchContext",value:function t(n){var i,e,r,u,o;if(!this.buffer)return my(this.node,n);for(e=(i=this.buffer.buffer).set.types,r=n.length-1,u=this.stack.length-1;r>=0;u--){if(u<0)return my(this.node,n,r);if(!(o=e[i.buffer[this.stack[u]]]).isAnonymous){if(n[r]&&n[r]!=o.name)return!1;r--}}return!0}}]),t}(),Ir=new WeakMap,Rr=function(){function t(n,i,e,r){var u=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];yc(this,t),this.from=n,this.to=i,this.tree=e,this.offset=r,this.open=(u?1:0)|(o?2:0)}return kc(t,[{key:"openStart",get:function t(){return(1&this.open)>0}},{key:"openEnd",get:function t(){return(2&this.open)>0}}],[{key:"addTree",value:function n(i){var e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=[new t(0,i.length,i,0,!1,o)],h=ic(u);try{for(h.s();!(e=h.n()).done;)(r=e.value).to>i.length&&s.push(r)}catch(t){h.e(t)}finally{h.f()}return s}},{key:"applyChanges",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v,d,y=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!e.length)return i;for(r=[],u=1,o=i.length?i[0]:null,s=0,h=0,f=0;;s++){if((c=(a=s<e.length?e[s]:null)?a.fromA:1e9)-h>=y)for(;o&&o.from<c&&((h>=(l=o).from||c<=l.to||f)&&(l=(v=Math.max(l.from,h)-f)>=(d=Math.min(l.to,c)-f)?null:new t(v,d,l.tree,l.offset+f,s>0,!!a)),l&&r.push(l),!(o.to>c));)o=u<i.length?i[u++]:null;if(!a)break;h=a.toA,f=a.toA-a.toB}return r}}]),t}(),Lr=function(){function t(){yc(this,t)}return kc(t,[{key:"startParse",value:function t(n,i,e){return"string"==typeof n&&(n=new jr(n)),e=e?e.length?e.map((function(t){return new yr(t.from,t.to)})):[new yr(0,0)]:[new yr(0,n.length)],this.createParse(n,i||[],e)}},{key:"parse",value:function t(n,i,e){for(var r,t=this.startParse(n,i,e);;)if(r=t.advance())return r}}]),t}(),jr=function(){function t(n){yc(this,t),this.string=n}return kc(t,[{key:"length",get:function t(){return this.string.length}},{key:"chunk",value:function t(n){return this.string.slice(n)}},{key:"lineChunks",get:function t(){return!1}},{key:"read",value:function t(n,i){return this.string.slice(n,i)}}]),t}(),new pr({perNode:!0}),Tr=0,Br=function(){function t(n,i,e){yc(this,t),this.set=n,this.base=i,this.modified=e,this.id=Tr++}return kc(t,null,[{key:"define",value:function n(i){var e,r,u,o;if(null==i?void 0:i.base)throw new Error("Can not derive from a modified tag");if((e=new t([],null,[])).set.push(e),i){r=ic(i.set);try{for(r.s();!(u=r.n()).done;)o=u.value,e.set.push(o)}catch(t){r.e(t)}finally{r.f()}}return e}},{key:"defineModifier",value:function t(){var n=new Nr;return function(t){return t.modified.indexOf(n)>-1?t:Nr.get(t.base||t,t.modified.concat(n).sort((function(t,n){return t.id-n.id})))}}}]),t}(),_r=0,Nr=function(){function t(){yc(this,t),this.instances=[],this.id=_r++}return kc(t,null,[{key:"get",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v,d,y,p;if(!e.length)return i;if(r=e[0].instances.find((function(t){return t.base==i&&xy(e,t.modified)})),r)return r;o=new Br(u=[],i,e),s=ic(e);try{for(s.s();!(h=s.n()).done;)(f=h.value).instances.push(o)}catch(t){s.e(t)}finally{s.f()}a=Sy(e),c=ic(i.set);try{for(c.s();!(l=c.n()).done;)if(!(v=l.value).modified.length){d=ic(a);try{for(d.s();!(y=d.n()).done;)p=y.value,u.push(t.get(v,p))}catch(t){d.e(t)}finally{d.f()}}}catch(t){c.e(t)}finally{c.f()}return o}}]),t}(),Pr=new pr,Fr=function(){function t(n,i,e,r){yc(this,t),this.tags=n,this.mode=i,this.context=e,this.next=r}return kc(t,[{key:"opaque",get:function t(){return 0==this.mode}},{key:"inherit",get:function t(){return 1==this.mode}},{key:"sort",value:function t(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}},{key:"depth",get:function t(){return this.context?this.context.length:0}}]),t}(),Fr.empty=new Fr([],2,null),Hr=function(){function t(n,i,e){yc(this,t),this.at=n,this.highlighters=i,this.span=e,this.class=""}return kc(t,[{key:"startSpan",value:function t(n,i){i!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=i)}},{key:"flush",value:function t(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}},{key:"highlightRange",value:function t(n,i,e,r,u){var o,s,h,f,a,c,l,v,d,y,p,k,m,g=n.type,w=n.from,b=n.to;if(!(w>=e||b<=i||(g.isTop&&(u=this.highlighters.filter((function(t){return!t.scope||t.scope(g)}))),o=r,(h=Ay(u,(s=Ey(n)||Fr.empty).tags))&&(o&&(o+=" "),o+=h,1==s.mode&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(i,w),o),s.opaque)))if((f=n.tree&&n.tree.prop(pr.mounted))&&f.overlay){for(a=n.node.enter(f.overlay[0].from+w,1),c=this.highlighters.filter((function(t){return!t.scope||t.scope(f.tree.type)})),l=n.firstChild(),v=0,d=w;;v++){if(p=(y=v<f.overlay.length?f.overlay[v]:null)?y.from+w:b,(k=Math.max(i,d))<(m=Math.min(e,p))&&l)for(;n.from<m&&(this.highlightRange(n,k,m,r,u),this.startSpan(Math.min(m,n.to),o),!(n.to>=p)&&n.nextSibling()););if(!y||p>e)break;(d=y.to+w)>i&&(this.highlightRange(a.cursor(),Math.max(i,y.from+w),Math.min(e,d),"",c),this.startSpan(Math.min(e,d),o))}l&&n.parent()}else if(n.firstChild()){f&&(r="");do{if(!(n.to<=i)){if(n.from>=e)break;this.highlightRange(n,i,e,r,u),this.startSpan(Math.min(e,n.to),o)}}while(n.nextSibling());n.parent()}}}]),t}(),Wr=(zr=Br.define)(),Vr=zr(),Ur=zr(Vr),$r=zr(Vr),qr=zr(),Gr=zr(qr),Jr=zr(qr),Kr=zr(),Qr=zr(Kr),Xr=zr(),Zr=zr(),Yr=zr(),tu=zr(Yr),nu=zr(),Oy([{tag:(iu={comment:Wr,lineComment:zr(Wr),blockComment:zr(Wr),docComment:zr(Wr),name:Vr,variableName:zr(Vr),typeName:Ur,tagName:zr(Ur),propertyName:$r,attributeName:zr($r),className:zr(Vr),labelName:zr(Vr),namespace:zr(Vr),macroName:zr(Vr),literal:qr,string:Gr,docString:zr(Gr),character:zr(Gr),attributeValue:zr(Gr),number:Jr,integer:zr(Jr),float:zr(Jr),bool:zr(qr),regexp:zr(qr),escape:zr(qr),color:zr(qr),url:zr(qr),keyword:Xr,self:zr(Xr),null:zr(Xr),atom:zr(Xr),unit:zr(Xr),modifier:zr(Xr),operatorKeyword:zr(Xr),controlKeyword:zr(Xr),definitionKeyword:zr(Xr),moduleKeyword:zr(Xr),operator:Zr,derefOperator:zr(Zr),arithmeticOperator:zr(Zr),logicOperator:zr(Zr),bitwiseOperator:zr(Zr),compareOperator:zr(Zr),updateOperator:zr(Zr),definitionOperator:zr(Zr),typeOperator:zr(Zr),controlOperator:zr(Zr),punctuation:Yr,separator:zr(Yr),bracket:tu,angleBracket:zr(tu),squareBracket:zr(tu),paren:zr(tu),brace:zr(tu),content:Kr,heading:Qr,heading1:zr(Qr),heading2:zr(Qr),heading3:zr(Qr),heading4:zr(Qr),heading5:zr(Qr),heading6:zr(Qr),contentSeparator:zr(Kr),list:zr(Kr),quote:zr(Kr),emphasis:zr(Kr),strong:zr(Kr),link:zr(Kr),monospace:zr(Kr),strikethrough:zr(Kr),inserted:zr(),deleted:zr(),changed:zr(),invalid:zr(),meta:nu,documentMeta:zr(nu),annotation:zr(nu),processingInstruction:zr(nu),definition:Br.defineModifier(),constant:Br.defineModifier(),function:Br.defineModifier(),standard:Br.defineModifier(),local:Br.defineModifier(),special:Br.defineModifier()}).link,class:"tok-link"},{tag:iu.heading,class:"tok-heading"},{tag:iu.emphasis,class:"tok-emphasis"},{tag:iu.strong,class:"tok-strong"},{tag:iu.keyword,class:"tok-keyword"},{tag:iu.atom,class:"tok-atom"},{tag:iu.bool,class:"tok-bool"},{tag:iu.url,class:"tok-url"},{tag:iu.labelName,class:"tok-labelName"},{tag:iu.inserted,class:"tok-inserted"},{tag:iu.deleted,class:"tok-deleted"},{tag:iu.literal,class:"tok-literal"},{tag:iu.string,class:"tok-string"},{tag:iu.number,class:"tok-number"},{tag:[iu.regexp,iu.escape,iu.special(iu.string)],class:"tok-string2"},{tag:iu.variableName,class:"tok-variableName"},{tag:iu.local(iu.variableName),class:"tok-variableName tok-local"},{tag:iu.definition(iu.variableName),class:"tok-variableName tok-definition"},{tag:iu.special(iu.variableName),class:"tok-variableName2"},{tag:iu.definition(iu.propertyName),class:"tok-propertyName tok-definition"},{tag:iu.typeName,class:"tok-typeName"},{tag:iu.namespace,class:"tok-namespace"},{tag:iu.className,class:"tok-className"},{tag:iu.macroName,class:"tok-macroName"},{tag:iu.propertyName,class:"tok-propertyName"},{tag:iu.operator,class:"tok-operator"},{tag:iu.comment,class:"tok-comment"},{tag:iu.meta,class:"tok-meta"},{tag:iu.invalid,class:"tok-invalid"},{tag:iu.punctuation,class:"tok-punctuation"}]),ru=new pr,uu=new pr,ou=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";yc(this,t),this.data=n,this.name=r,Q.prototype.hasOwnProperty("tree")||Object.defineProperty(Q.prototype,"tree",{get:function t(){return Ly(this)}}),this.parser=i,this.extension=[yu.of(this),Q.languageData.of((function(t,n,i){var e,r,u,o,s,h,f,a=Ry(t,n,i),c=a.type.prop(ru);if(!c)return[];if(e=t.facet(c),r=a.type.prop(uu)){u=a.resolve(n-a.from,i),o=ic(r);try{for(o.s();!(s=o.n()).done;)if((h=s.value).test(u,t))return f=t.facet(h.facet),"replace"==h.type?f:f.concat(e)}catch(t){o.e(t)}finally{o.f()}}return e}))].concat(e)}return kc(t,[{key:"isActiveAt",value:function t(n,i){var e;return Ry(n,i,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(ru)==this.data}},{key:"findRegions",value:function t(n){var i,e,r=this,u=n.facet(yu);return(null==u?void 0:u.data)==this.data?[{from:0,to:n.doc.length}]:u&&u.allowsNesting?(i=[],(e=function t(n,e){var u,o,s,h,f,a,c;if(n.prop(ru)!=r.data){if(u=n.prop(pr.mounted)){if(u.tree.prop(ru)==r.data){if(u.overlay){o=ic(u.overlay);try{for(o.s();!(s=o.n()).done;)h=s.value,i.push({from:h.from+e,to:h.to+e})}catch(t){o.e(t)}finally{o.f()}}else i.push({from:e,to:e+n.length});return}if(u.overlay&&(f=i.length,t(u.tree,u.overlay[0].from+e),i.length>f))return}for(a=0;a<n.children.length;a++)(c=n.children[a])instanceof xr&&t(c,n.positions[a]+e)}else i.push({from:e,to:e+n.length})})(Ly(n),0),i):[]}},{key:"allowsNesting",get:function t(){return!0}}]),t}(),ou.setState=U.define(),su=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t,e,[],r)).parser=e,u}return kc(i,[{key:"configure",value:function t(n,e){return new i(this.data,this.parser.configure(n),e||this.name)}},{key:"allowsNesting",get:function t(){return this.parser.hasWrappers()}}],[{key:"define",value:function t(n){var e=Iy(n.languageData);return new i(e,n.parser.configure({props:[ru.add((function(t){return t.isTop?e:void 0}))]}),n.name)}}]),i}(ou),hu=function(){function t(n){yc(this,t),this.doc=n,this.cursorPos=0,this.string="",this.cursor=n.iter()}return kc(t,[{key:"length",get:function t(){return this.doc.length}},{key:"syncTo",value:function t(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}},{key:"chunk",value:function t(n){return this.syncTo(n),this.string}},{key:"lineChunks",get:function t(){return!0}},{key:"read",value:function t(n,i){var e=this.cursorPos-this.string.length;return n<e||i>=this.cursorPos?this.doc.sliceString(n,i):this.string.slice(n-e,i-e)}}]),t}(),fu=null,au=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0;yc(this,t),this.parser=n,this.state=i,this.fragments=e,this.tree=r,this.treeLen=u,this.viewport=o,this.skipped=s,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}return kc(t,[{key:"startParse",value:function t(){return this.parser.startParse(new hu(this.state.doc),this.fragments)}},{key:"work",value:function t(n,i){var e=this;return null!=i&&i>=this.state.doc.length&&(i=void 0),this.tree!=xr.empty&&this.isDone(null!=i?i:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var t,r,u;for("number"==typeof n&&(r=Date.now()+n,n=function t(){return Date.now()>r}),e.parse||(e.parse=e.startParse()),null!=i&&(null==e.parse.stoppedAt||e.parse.stoppedAt>i)&&i<e.state.doc.length&&e.parse.stopAt(i);;){if(u=e.parse.advance()){if(e.fragments=e.withoutTempSkipped(Rr.addTree(u,e.fragments,null!=e.parse.stoppedAt)),e.treeLen=null!==(t=e.parse.stoppedAt)&&void 0!==t?t:e.state.doc.length,e.tree=u,e.parse=null,!(e.treeLen<(null!=i?i:e.state.doc.length)))return!0;e.parse=e.startParse()}if(n())return!1}}))}},{key:"takeTree",value:function t(){var n,i,e=this;this.parse&&(n=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>n)&&this.parse.stopAt(n),this.withContext((function(){for(;!(i=e.parse.advance()););})),this.treeLen=n,this.tree=i,this.fragments=this.withoutTempSkipped(Rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function t(n){var i=fu;fu=this;try{return n()}finally{fu=i}}},{key:"withoutTempSkipped",value:function t(n){for(var i;i=this.tempSkipped.pop();)n=Ny(n,i.from,i.to);return n}},{key:"changes",value:function n(i,e){var r,u,o,s,h,f,a=this.fragments,c=this.tree,l=this.treeLen,v=this.viewport,d=this.skipped;if(this.takeTree(),!i.empty&&(r=[],i.iterChangedRanges((function(t,n,i,e){return r.push({fromA:t,toA:n,fromB:i,toB:e})})),a=Rr.applyChanges(a,r),c=xr.empty,l=0,v={from:i.mapPos(v.from,-1),to:i.mapPos(v.to,1)},this.skipped.length)){d=[],u=ic(this.skipped);try{for(u.s();!(o=u.n()).done;)s=o.value,(h=i.mapPos(s.from,1))<(f=i.mapPos(s.to,-1))&&d.push({from:h,to:f})}catch(t){u.e(t)}finally{u.f()}}return new t(this.parser,e,a,c,l,v,d,this.scheduleOn)}},{key:"updateViewport",value:function t(n){var i,e,r,u,o;if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;for(this.viewport=n,i=this.skipped.length,e=0;e<this.skipped.length;e++)u=(r=this.skipped[e]).from,o=r.to,u<n.to&&o>n.from&&(this.fragments=Ny(this.fragments,u,o),this.skipped.splice(e--,1));return!(this.skipped.length>=i)&&(this.reset(),!0)}},{key:"reset",value:function t(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function t(n,i){this.skipped.push({from:n,to:i})}},{key:"isDone",value:function t(n){n=Math.min(n,this.state.doc.length);var i=this.fragments;return this.treeLen>=n&&i.length&&0==i[0].from&&i[0].to>=n}}],[{key:"create",value:function n(i,e,r){return new t(i,e,[],xr.empty,0,r,[],null)}},{key:"getSkippingParser",value:function t(n){return new(function(t){sc(e,t);var i=fc(e);function e(){return yc(this,e),i.apply(this,arguments)}return kc(e,[{key:"createParse",value:function t(i,e,r){var u=r[0].from,o=r[r.length-1].to,s={parsedPos:u,advance:function t(){var i,e,s,h=fu;if(h){i=ic(r);try{for(i.s();!(e=i.n()).done;)s=e.value,h.tempSkipped.push(s)}catch(t){i.e(t)}finally{i.f()}n&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,n]):n)}return this.parsedPos=o,new xr(mr.none,[],[],o-u)},stoppedAt:null,stopAt:function t(){}};return s}}]),e}(Lr))}},{key:"get",value:function t(){return fu}}]),t}(),cu=function(){function t(n){yc(this,t),this.context=n,this.tree=n.tree}return kc(t,[{key:"apply",value:function n(i){var e,r;return i.docChanged||this.tree!=this.context.tree?(e=this.context.changes(i.changes,i.state),r=this.context.treeLen==i.startState.doc.length?void 0:Math.max(i.changes.mapPos(this.context.treeLen),e.viewport.to),e.work(20,r)||e.takeTree(),new t(e)):this}}],[{key:"init",value:function n(i){var e=Math.min(3e3,i.doc.length),r=au.create(i.facet(yu).parser,i,{from:0,to:e});return r.work(20,e)||r.takeTree(),new t(r)}}]),t}(),ou.state=x.define({create:cu.init,update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;)if((r=e.value).is(ou.setState))return r.value}catch(t){u.e(t)}finally{u.f()}return i.startState.facet(yu)!=i.state.facet(yu)?cu.init(i.state):n.apply(i)}}),lu=function t(n){var i=setTimeout((function(){return n()}),500);return function(){return clearTimeout(i)}},"undefined"!=typeof requestIdleCallback&&(lu=function t(n){var i=-1,e=setTimeout((function(){i=requestIdleCallback(n,{timeout:400})}),100);return function(){return i<0?clearTimeout(e):cancelIdleCallback(i)}}),vu="undefined"!=typeof navigator&&(null===(eu=navigator.scheduling)||void 0===eu?void 0:eu.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,du=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return kc(t,[{key:"update",value:function t(n){var i=this.view.state.field(ou.state).context;(i.updateViewport(n.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),n.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}},{key:"scheduleWork",value:function t(){if(!this.working){var n=this.view.state,i=n.field(ou.state);i.tree==i.context.tree&&i.context.isDone(n.doc.length)||(this.working=lu(this.work))}}},{key:"work",value:function t(n){var i,e,r,u,o,s,h,f;this.working=null,i=Date.now(),this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0||(r=(e=this.view).state,u=e.viewport.to,(o=r.field(ou.state)).tree==o.context.tree&&o.context.isDone(u+1e5)||(s=Date.now()+Math.min(this.chunkBudget,100,n&&!vu?Math.max(25,n.timeRemaining()-5):1e9),h=o.context.treeLen<u&&r.doc.length>u+1e3,f=o.context.work((function(){return vu&&vu()||Date.now()>s}),u+(h?0:1e5)),this.chunkBudget-=Date.now()-i,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:ou.setState.of(new cu(o.context))})),this.chunkBudget>0&&(!f||h)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)))}},{key:"checkAsyncSchedule",value:function t(n){var i=this;n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then((function(){return i.scheduleWork()})).catch((function(t){return Yl(i.view.state,t)})).then((function(){return i.workScheduled--})),n.scheduleOn=null)}},{key:"destroy",value:function t(){this.working&&this.working()}},{key:"isWorking",value:function t(){return!!(this.working||this.workScheduled>0)}}]),t}(),{eventHandlers:{focus:function t(){this.scheduleWork()}}}),yu=w.define({combine:function t(n){return n.length?n[0]:null},enables:function t(n){return[ou.state,du,Ui.contentAttributes.compute([n],(function(t){var i=t.facet(n);return i&&i.name?{"data-language":i.name}:{}}))]}}),pu=kc((function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];yc(this,t),this.language=n,this.support=i,this.extension=[n,i]})),ku=function(){function t(n,i,e,r,u){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;yc(this,t),this.name=n,this.alias=i,this.extensions=e,this.filename=r,this.loadFunc=u,this.support=o,this.loading=null}return kc(t,[{key:"load",value:function t(){var n=this;return this.loading||(this.loading=this.loadFunc().then((function(t){return n.support=t}),(function(t){throw n.loading=null,t})))}}],[{key:"of",value:function n(i){var e=i.load,r=i.support;if(!e){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=function t(){return Promise.resolve(r)}}return new t(i.name,(i.alias||[]).concat(i.name).map((function(t){return t.toLowerCase()})),i.extensions||[],i.filename,e,r)}},{key:"matchFilename",value:function t(n,i){var e,r,u,o,s,h,f=ic(n);try{for(f.s();!(e=f.n()).done;)if((r=e.value).filename&&r.filename.test(i))return r}catch(t){f.e(t)}finally{f.f()}if(u=/\.([^.]+)$/.exec(i)){o=ic(n);try{for(o.s();!(s=o.n()).done;)if((h=s.value).extensions.indexOf(u[1])>-1)return h}catch(t){o.e(t)}finally{o.f()}}return null}},{key:"matchLanguageName",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l,v=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];i=i.toLowerCase(),e=ic(n);try{for(e.s();!(r=e.n()).done;)if((u=r.value).alias.some((function(t){return t==i})))return u}catch(t){e.e(t)}finally{e.f()}if(v){o=ic(n);try{for(o.s();!(s=o.n()).done;){f=ic((h=s.value).alias);try{for(f.s();!(a=f.n()).done;)if(c=a.value,(l=i.indexOf(c))>-1&&(c.length>2||!/\w/.test(i[l-1])&&!/\w/.test(i[l+c.length])))return h}catch(t){f.e(t)}finally{f.f()}}}catch(t){o.e(t)}finally{o.f()}}return null}}]),t}(),mu=w.define(),gu=w.define({combine:function t(n){if(!n.length)return" ";var i=n[0];if(!i||/\S/.test(i)||Array.from(i).some((function(t){return t!=i[0]})))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return i}}),wu=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yc(this,t),this.state=n,this.options=i,this.unit=Py(n)}return kc(t,[{key:"lineAt",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=this.state.doc.lineAt(n),r=this.options,u=r.simulateBreak,o=r.simulateDoubleBreak;return null!=u&&u>=e.from&&u<=e.to?o&&u==n?{text:"",from:n}:(i<0?u<n:u<=n)?{text:e.text.slice(u-e.from),from:u}:{text:e.text.slice(0,u-e.from),from:e.from}:e}},{key:"textAfterPos",value:function t(n){var i,e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.options.simulateDoubleBreak&&n==this.options.simulateBreak?"":(e=(i=this.lineAt(n,u)).text,r=i.from,e.slice(n-r,Math.min(e.length,n+100-r)))}},{key:"column",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=this.lineAt(n,i),r=e.text,u=e.from,o=this.countColumn(r,n-u),s=this.options.overrideIndentation?this.options.overrideIndentation(u):-1;return s>-1&&(o+=s-this.countColumn(r,r.search(/\S|$/))),o}},{key:"countColumn",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.length;return ll(n,this.state.tabSize,i)}},{key:"lineIndent",value:function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=this.lineAt(n,e),u=r.text,o=r.from,s=this.options.overrideIndentation;return s&&(i=s(o))>-1?i:this.countColumn(u,u.search(/\S|$/))}},{key:"simulatedBreak",get:function t(){return this.options.simulateBreak||null}}]),t}(),bu=new pr,Mu=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t.state,t.options)).base=t,u.pos=e,u.node=r,u}return kc(i,[{key:"textAfter",get:function t(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function t(){for(var n,i=this.state.doc.lineAt(this.node.from);;){for(n=this.node.resolve(i.from);n.parent&&n.parent.from==n.from;)n=n.parent;if(Gy(n,this.node))break;i=this.state.doc.lineAt(n.from)}return this.lineIndent(i.from)}},{key:"continue",value:function t(){var n=this.node.parent;return n?$y(n,this.pos,this.base):0}}],[{key:"create",value:function t(n,e,r){return new i(n,e,r)}}]),i}(wu),xu=function t(n){return n.baseIndent},Su=200,Cu=w.define(),Ou=new pr,Au=U.define({map:ep}),Du=U.define({map:ep}),Eu=x.define({create:function t(){return Jt.none},update:function t(n,i){var e,r,u,o,s;n=n.map(i.changes),e=ic(i.effects);try{for(u=function t(){var i=r.value;i.is(Au)&&!sp(n,i.value.from,i.value.to)?n=n.update({add:[Pu.range(i.value.from,i.value.to)]}):i.is(Du)&&(n=n.update({filter:function t(n,e){return i.value.from!=n||i.value.to!=e},filterFrom:i.value.from,filterTo:i.value.to}))},e.s();!(r=e.n()).done;)u()}catch(t){e.e(t)}finally{e.f()}return i.selection&&(o=!1,s=i.selection.main.head,n.between(s,s,(function(t,n){t<s&&n>s&&(o=!0)})),o&&(n=n.update({filterFrom:s,filterTo:s,filter:function t(n,i){return i<=s||n>=s}}))),n},provide:function t(n){return Ui.decorations.from(n)},toJSON:function t(n,i){var e=[];return n.between(0,i.doc.length,(function(t,n){e.push(t,n)})),e},fromJSON:function t(n){var i,e,r,u;if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");for(i=[],e=0;e<n.length;){if(r=n[e++],u=n[e++],"number"!=typeof r||"number"!=typeof u)throw new RangeError("Invalid JSON for fold state");i.push(Pu.range(r,u))}return Jt.set(i,!0)}}),Tu=function t(n){var i,e,r,u,o=[],s=ic(rp(n));try{for(s.s();!(i=s.n()).done;)e=i.value,(r=op(n.state,e.from,e.to))?o.push(Du.of(r),fp(n,r,!1)):(u=ap(n,e))&&o.push(Au.of(u),fp(n,u))}catch(t){s.e(t)}finally{s.f()}return o.length>0&&n.dispatch({effects:hp(n.state,o)}),!!o.length},Bu=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Iu=function t(n){var i,e,r,u=ic(rp(n));try{for(u.s();!(i=u.n()).done;)if(e=i.value,r=ip(n.state,e.from,e.to))return n.dispatch({effects:hp(n.state,[Au.of(r),fp(n,r)])}),!0}catch(t){u.e(t)}finally{u.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Ru=function t(n){var i,e,r,u,o;if(!n.state.field(Eu,!1))return!1;i=[],e=ic(rp(n));try{for(e.s();!(r=e.n()).done;)u=r.value,(o=op(n.state,u.from,u.to))&&i.push(Du.of(o),fp(n,o,!1))}catch(t){e.e(t)}finally{e.f()}return i.length&&n.dispatch({effects:i}),i.length>0}},{key:"Ctrl-Alt-[",run:Lu=function t(n){var i,e,r,u=n.state,o=[];for(i=0;i<u.doc.length;)(r=ip(u,(e=n.lineBlockAt(i)).from,e.to))&&o.push(Au.of(r)),i=(r?n.lineBlockAt(r.to):e).to+1;return o.length&&n.dispatch({effects:hp(n.state,o)}),!!o.length}},{key:"Ctrl-Alt-]",run:ju=function t(n){var i,e=n.state.field(Eu,!1);return!(!e||!e.size)&&(i=[],e.between(0,n.state.doc.length,(function(t,n){i.push(Du.of({from:t,to:n}))})),n.dispatch({effects:i}),!0)}}],_u={placeholderDOM:null,placeholderText:"\u2026"},Nu=w.define({combine:function t(n){return il(n,_u)}}),Pu=Jt.replace({widget:new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"toDOM",value:function t(n){var i,e=n.state,r=e.facet(Nu),u=function t(i){var e=n.lineBlockAt(n.posAtDOM(i.target)),r=op(n.state,e.from,e.to);r&&n.dispatch({effects:Du.of(r)}),i.preventDefault()};return r.placeholderDOM?r.placeholderDOM(n,u):((i=document.createElement("span")).textContent=r.placeholderText,i.setAttribute("aria-label",e.phrase("folded code")),i.title=e.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=u,i)}}]),i}(qt))}),Fu={openText:"\u2304",closedText:"\u203a",markerDOM:null,domEventHandlers:{},foldingChanged:function t(){return!1}},Hu=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).config=t,r.open=e,r}return kc(i,[{key:"eq",value:function t(n){return this.config==n.config&&this.open==n.open}},{key:"toDOM",value:function t(n){if(this.config.markerDOM)return this.config.markerDOM(this.open);var i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=n.state.phrase(this.open?"Fold line":"Unfold line"),i}}]),i}(Ge),zu=Ui.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"}}),Wu=function(){function t(n,i){var e,r,u;function o(t){var n=at.newName();return(e||(e=Object.create(null)))["."+n]=t,n}yc(this,t),this.specs=n,r="string"==typeof i.all?i.all:i.all?o(i.all):void 0,u=i.scope,this.scope=u instanceof ou?function(t){return t.prop(ru)==u.data}:u?function(t){return t==u}:void 0,this.style=Oy(n.map((function(t){return{tag:t.tag,class:t.class||o(Object.assign({},t,{tag:null}))}})),{all:r}).style,this.module=e?new at(e):null,this.themeType=i.themeType}return kc(t,null,[{key:"define",value:function n(i,e){return new t(i,e||{})}}]),t}(),Vu=w.define(),Uu=w.define({combine:function t(n){return n.length?[n[0]]:null}}),$u=function(){function t(n){yc(this,t),this.markCache=Object.create(null),this.tree=Ly(n.state),this.decorations=this.buildDeco(n,vp(n.state))}return kc(t,[{key:"update",value:function t(n){var i=Ly(n.state),e=vp(n.state),r=e!=vp(n.startState);i.length<n.view.viewport.to&&!r&&i.type==this.tree.type?this.decorations=this.decorations.map(n.changes):(i!=this.tree||n.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(n.view,e))}},{key:"buildDeco",value:function t(n,i){var e,r,u,o,s,h,f=this;if(!i||!this.tree.length)return Jt.none;e=new nt,r=ic(n.visibleRanges);try{for(r.s();!(u=r.n()).done;)s=(o=u.value).from,h=o.to,Dy(this.tree,i,(function(t,n,i){e.add(t,n,f.markCache[i]||(f.markCache[i]=Jt.mark({class:i})))}),s,h)}catch(t){r.e(t)}finally{r.f()}return e.finish()}}]),t}(),qu=E.high(kn.fromClass($u,{decorations:function t(n){return n.decorations}})),Gu=Wu.define([{tag:iu.meta,color:"#404740"},{tag:iu.link,textDecoration:"underline"},{tag:iu.heading,textDecoration:"underline",fontWeight:"bold"},{tag:iu.emphasis,fontStyle:"italic"},{tag:iu.strong,fontWeight:"bold"},{tag:iu.strikethrough,textDecoration:"line-through"},{tag:iu.keyword,color:"#708"},{tag:[iu.atom,iu.bool,iu.url,iu.contentSeparator,iu.labelName],color:"#219"},{tag:[iu.literal,iu.inserted],color:"#164"},{tag:[iu.string,iu.deleted],color:"#a11"},{tag:[iu.regexp,iu.escape,iu.special(iu.string)],color:"#e40"},{tag:iu.definition(iu.variableName),color:"#00f"},{tag:iu.local(iu.variableName),color:"#30a"},{tag:[iu.typeName,iu.namespace],color:"#085"},{tag:iu.className,color:"#167"},{tag:[iu.special(iu.variableName),iu.macroName],color:"#256"},{tag:iu.definition(iu.propertyName),color:"#00c"},{tag:iu.comment,color:"#940"},{tag:iu.invalid,color:"#f00"}]),Ju=Ui.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ku=1e4,Qu="()[]{}",Xu=w.define({combine:function t(n){return il(n,{afterCursor:!0,brackets:Qu,maxScanDistance:Ku,renderMatch:pp})}}),Zu=Jt.mark({class:"cm-matchingBracket"}),Yu=Jt.mark({class:"cm-nonmatchingBracket"}),to=x.define({create:function t(){return Jt.none},update:function t(n,i){var e,r,u,o,s,h;if(!i.docChanged&&!i.selection)return n;e=[],r=i.state.facet(Xu),u=ic(i.state.selection.ranges);try{for(u.s();!(o=u.n()).done;)(s=o.value).empty&&(h=wp(i.state,s.head,-1,r)||s.head>0&&wp(i.state,s.head-1,1,r)||r.afterCursor&&(wp(i.state,s.head,1,r)||s.head<i.state.doc.length&&wp(i.state,s.head+1,-1,r)))&&(e=e.concat(r.renderMatch(h,i.state)))}catch(t){u.e(t)}finally{u.f()}return Jt.set(e,!0)},provide:function t(n){return Ui.decorations.from(n)}}),no=[to,Ju],io=new pr,eo=function(){function t(n,i,e,r){yc(this,t),this.string=n,this.tabSize=i,this.indentUnit=e,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}return kc(t,[{key:"eol",value:function t(){return this.pos>=this.string.length}},{key:"sol",value:function t(){return 0==this.pos}},{key:"peek",value:function t(){return this.string.charAt(this.pos)||void 0}},{key:"next",value:function t(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}},{key:"eat",value:function t(n){var i,e=this.string.charAt(this.pos);if(i="string"==typeof n?e==n:e&&(n instanceof RegExp?n.test(e):n(e)))return++this.pos,e}},{key:"eatWhile",value:function t(n){for(var i=this.pos;this.eat(n););return this.pos>i}},{key:"eatSpace",value:function t(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n}},{key:"skipToEnd",value:function t(){this.pos=this.string.length}},{key:"skipTo",value:function t(n){var i=this.string.indexOf(n,this.pos);if(i>-1)return this.pos=i,!0}},{key:"backUp",value:function t(n){this.pos-=n}},{key:"column",value:function t(){return this.lastColumnPos<this.start&&(this.lastColumnValue=xp(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}},{key:"indentation",value:function t(){var n;return null!==(n=this.overrideIndent)&&void 0!==n?n:xp(this.string,null,this.tabSize)}},{key:"match",value:function t(n,i,e){var r,u,t;return"string"==typeof n?(r=function t(n){return e?n.toLowerCase():n})(u=this.string.substr(this.pos,n.length))==r(n)?(!1!==i&&(this.pos+=n.length),!0):null:(t=this.string.slice(this.pos).match(n),t&&t.index>0?null:(t&&!1!==i&&(this.pos+=t[0].length),t))}},{key:"current",value:function t(){return this.string.slice(this.start,this.pos)}}]),t}(),ro=new WeakMap,uo=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,u,o,s;return yc(this,i),r=Iy(t.languageData),u=Sp(t),s=new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"createParse",value:function t(n,i,e){return new oo(o,n,i,e)}}]),i}(Lr)),(e=n.call(this,r,s,[mu.of((function(t,n){return e.getIndent(t,n)}))],t.name)).topNode=Lp(r),o=cc(e),e.streamParser=u,e.stateAfter=new pr({perNode:!0}),e.tokenTable=t.tokenTable?new mo(u.tokenTable):go,e}return kc(i,[{key:"getIndent",value:function t(n,i){for(var e,r,u,o,s,h,f,a,c,l,v=Ly(n.state),d=v.resolve(i);d&&d.type!=this.topNode;)d=d.parent;if(!d)return null;if(e=void 0,(r=n.options.overrideIndentation)&&null!=(e=ro.get(n.state))&&e<i-1e4&&(e=void 0),(u=Op(this,v,0,d.from,null!=e?e:i))?(s=u.state,o=u.pos+1):(s=this.streamParser.startState(n.unit),o=0),i-o>1e4)return null;for(;o<i;){if(h=n.state.doc.lineAt(o),f=Math.min(i,h.to),h.length)for(a=r?r(h.from):-1,c=new eo(h.text,n.state.tabSize,n.unit,a<0?void 0:a);c.pos<f-h.from;)Ep(this.streamParser.token,c,s);else this.streamParser.blankLine(s,n.unit);if(f==i)break;o=h.to+1}return l=n.lineAt(i),r&&null==e&&ro.set(n.state,l.from),this.streamParser.indent(s,/^\s*(.*)/.exec(l.text)[1],n)}},{key:"allowsNesting",get:function t(){return!1}}],[{key:"define",value:function t(n){return new i(n)}}]),i}(ou),oo=function(){function t(n,i,e,r){var u,o,s,h,f,a;for(yc(this,t),this.lang=n,this.input=i,this.fragments=e,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to,u=au.get(),h=(s=Dp(n,e,o=r[0].from,null==u?void 0:u.state)).state,f=s.tree,this.state=h,this.parsedPos=this.chunkStart=o+f.length,a=0;a<f.children.length;a++)this.chunks.push(f.children[a]),this.chunkPos.push(f.positions[a]);u&&this.parsedPos<u.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Py(u.state)),u.skipUntilInView(this.parsedPos,u.viewport.from),this.parsedPos=u.viewport.from),this.moveRangeIndex()}return kc(t,[{key:"advance",value:function t(){var n=au.get(),i=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),e=Math.min(i,this.chunkStart+2048);for(n&&(e=Math.min(e,n.viewport.to));this.parsedPos<e;)this.parseLine(n);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=i?this.finish():n&&this.parsedPos>=n.viewport.to?(n.skipUntilInView(this.parsedPos,i),this.finish()):null}},{key:"stopAt",value:function t(n){this.stoppedAt=n}},{key:"lineAfter",value:function t(n){var i,e=this.input.chunk(n);return this.input.lineChunks?"\n"==e&&(e=""):(i=e.indexOf("\n"))>-1&&(e=e.slice(0,i)),n+e.length<=this.to?e:e.slice(0,this.to-n)}},{key:"nextLine",value:function t(){var n,i,e,r,u=this.parsedPos,o=this.lineAfter(u),s=u+o.length;for(n=this.rangeIndex;!((i=this.ranges[n].to)>=s)&&(o=o.slice(0,i-(s-o.length)),++n!=this.ranges.length);)e=this.ranges[n].from,o+=r=this.lineAfter(e),s=e+r.length;return{line:o,end:s}}},{key:"skipGapsTo",value:function t(n,i,e){for(var r,u,o;r=this.ranges[this.rangeIndex].to,u=n+i,!(e>0?r>u:r>=u);)i+=(o=this.ranges[++this.rangeIndex].from)-r;return i}},{key:"moveRangeIndex",value:function t(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}},{key:"emitToken",value:function t(n,i,e,r,u){if(this.ranges.length>1){i+=u=this.skipGapsTo(i,u,1);var o=this.chunk.length;e+=u=this.skipGapsTo(e,u,-1),r+=this.chunk.length-o}return this.chunk.push(n,i,e,r),u}},{key:"parseLine",value:function t(n){var i,e=this.nextLine(),r=e.line,u=e.end,o=0,s=this.lang.streamParser,h=new eo(r,n?n.state.tabSize:4,n?Py(n.state):2);if(h.eol())s.blankLine(this.state,h.indentUnit);else for(;!(h.eol()||((i=Ep(s.token,h,this.state))&&(o=this.emitToken(this.lang.tokenTable.resolve(i),this.parsedPos+h.start,this.parsedPos+h.pos,4,o)),h.start>1e4)););this.parsedPos=u,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}},{key:"finishChunk",value:function t(){var n=xr.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:fo,topID:0,maxBufferLength:2048,reused:this.chunkReused});n=new xr(n.type,n.children,n.positions,n.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(n),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}},{key:"finish",value:function t(){return new xr(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}]),t}(),so=Object.create(null),ho=[mr.none],fo=new gr(ho),ao=[],co=Object.create(null),lo=0,vo=[["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"]];lo<vo.length;lo++)po=(yo=Za(vo[lo],2))[0],ko=yo[1],co[po]=Rp(so,ko);function Ip(t,n){ao.indexOf(t)>-1||(ao.push(t),console.warn(n))}function Rp(t,n){var i,e,r,u,o,s=null,h=ic(n.split("."));try{for(h.s();!(i=h.n()).done;)(r=t[e=i.value]||iu[e])?"function"==typeof r?s?s=r(s):Ip(e,"Modifier ".concat(e," used at start of tag")):s?Ip(e,"Tag ".concat(e," used as modifier")):s=r:Ip(e,"Unknown highlighting tag ".concat(e))}catch(t){h.e(t)}finally{h.f()}return s?(u=n.replace(/ /g,"_"),o=mr.define({id:ho.length,name:u,props:[Cy(Ga({},u,s))]}),ho.push(o),o.id):0}function Lp(t){var n=mr.define({id:ho.length,name:"Document",props:[ru.add((function(){return t}))]});return ho.push(n),n}function jp(t){var n=Object.keys(t).join(""),i=/\w/.test(n);return i&&(n=n.replace(/\w/g,"")),"[".concat(i?"\\w":"").concat(n.replace(/[^\w\s]/g,"\\$&"),"]")}function Tp(t){var n,i,e,r,u=Object.create(null),o=Object.create(null),s=ic(t);try{for(s.s();!(n=s.n()).done;)for(u[(i=n.value.label)[0]]=!0,e=1;e<i.length;e++)o[i[e]]=!0}catch(t){s.e(t)}finally{s.f()}return r=jp(u)+jp(o)+"*$",[new RegExp("^"+r),new RegExp(r)]}function Bp(t){var n=t.map((function(t){return"string"==typeof t?{label:t}:t})),i=n.every((function(t){return/^\w+$/.test(t.label)}))?[/\w*$/,/\w+$/]:Tp(n),e=Za(i,2),r=e[0],u=e[1];return function(t){var i=t.matchBefore(u);return i||t.explicit?{from:i?i.from:t.pos,options:n,validFor:r}:null}}function _p(t,n){return function(i){for(var e=Ly(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return n(i);if(e.type.isTop)break}return null}}function Np(t,n){return function(i){for(var e=Ly(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(i)}}function Pp(t){return t.selection.main.from}function Fp(t,n){var i,e=t.source,r=n&&"^"!=e[0],u="$"!=e[e.length-1];return r||u?new RegExp("".concat(r?"^":"","(?:").concat(e,")").concat(u?"$":""),null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}function Hp(t,n,i,e){var r=t.selection.main,u=i-r.from,o=e-r.from;return Object.assign(Object.assign({},t.changeByRange((function(s){return s!=r&&i!=e&&t.sliceDoc(s.from+u,s.from+o)!=t.sliceDoc(i,e)?{range:s}:{changes:{from:s.from+u,to:e==r.from?s.to:s.from+o,insert:n},range:m.cursor(s.from+u+n.length)}}))),{userEvent:"input.complete"})}function zp(t){if(!Array.isArray(t))return t;var n=So.get(t);return n||So.set(t,n=Bp(t)),n}function Wp(t,n){return t?n?t+" "+n:t:n}function Vp(t,n,i,e,r){var u,o,s,h=t.textDirection==An.RTL,f=h,a=!1,c="top",l=n.left-r.left,v=r.right-n.right,d=e.right-e.left,y=e.bottom-e.top;return f&&l<Math.min(d,v)?f=!1:!f&&v<Math.min(d,l)&&(f=!0),d<=(f?l:v)?(u=Math.max(r.top,Math.min(i.top,r.bottom-y))-n.top,o=Math.min(400,f?l:v)):(a=!0,o=Math.min(400,(h?n.right:r.right-n.left)-30),(s=r.bottom-n.bottom)>=y||s>n.top?u=i.bottom-n.top:(c="bottom",u=n.bottom-i.top)),{style:"".concat(c,": ").concat(u,"px; max-width: ").concat(o,"px"),class:"cm-completionInfo-"+(a?h?"left-narrow":"right-narrow":f?"left":"right")}}function Up(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return function(i){var e,r,u,o,s=i.state.field(qo,!1);return!(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<i.state.facet(Do).interactionDelay)&&(e=1,"page"==n&&(r=Kd(i,s.open.tooltip))&&(e=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1)),u=s.open.options.length,(o=s.open.selected>-1?s.open.selected+e*(t?1:-1):t?0:u-1)<0?o="page"==n?0:u-1:o>=u&&(o="page"==n?u-1:0),i.dispatch({effects:$o.of(o)}),!0)}}function $p(t,n){var i=n.completion.apply||n.completion.label,e=t.state.field(qo).active.find((function(t){return t.source==n.source}));return e instanceof Vo&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},Hp(t.state,i,e.from,e.to)),{annotations:xo.of(n.completion)})):i(t,n.completion,e.from,e.to),!0)}function qp(t){var n=t.addToOptions.slice();return t.icons&&n.push({render:function t(n){var i,e=document.createElement("div");return e.classList.add("cm-completionIcon"),n.type&&(i=e.classList).add.apply(i,Ja(n.type.split(/\s+/g).map((function(t){return"cm-completionIcon-"+t})))),e.setAttribute("aria-hidden","true"),e},position:20}),n.push({render:function t(n,i,e){var r,u,o,s,h,f,a=document.createElement("span");for(a.className="cm-completionLabel",r=n.label,u=0,o=1;o<e.length;)s=e[o++],h=e[o++],s>u&&a.appendChild(document.createTextNode(r.slice(u,s))),(f=a.appendChild(document.createElement("span"))).appendChild(document.createTextNode(r.slice(s,h))),f.className="cm-completionMatchedText",u=h;return u<r.length&&a.appendChild(document.createTextNode(r.slice(u))),a},position:50},{render:function t(n){if(!n.detail)return null;var i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),n.sort((function(t,n){return t.position-n.position})).map((function(t){return t.render}))}function Gp(t,n,i){var e,r;return t<=i?{from:0,to:t}:(n<0&&(n=0),n<=t>>1?{from:(e=Math.floor(n/i))*i,to:(e+1)*i}:{from:t-((r=Math.floor((t-n)/i))+1)*i,to:t-r*i})}function Jp(t){return function(n){return new No(n,t)}}function Kp(t,n){var i=t.getBoundingClientRect(),e=n.getBoundingClientRect();e.top<i.top?t.scrollTop-=i.top-e.top:e.bottom>i.bottom&&(t.scrollTop+=e.bottom-i.bottom)}function Qp(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Xp(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j=[],T=null,B=function t(n){var i,e;j.push(n),(i=n.completion.section)&&(T||(T=[]),e="string"==typeof i?i:i.name,T.some((function(t){return t.name==e}))||T.push("string"==typeof i?{name:e}:i))},_=ic(t);try{for(_.s();!(i=_.n()).done;)if((e=i.value).hasResult())if(!1===e.result.filter){r=e.result.getMatch,u=ic(e.result.options);try{for(u.s();!(o=u.n()).done;){if(s=o.value,h=[1e9-j.length],r){f=ic(r(s));try{for(f.s();!(a=f.n()).done;)c=a.value,h.push(c)}catch(t){f.e(t)}finally{f.f()}}B(new Mo(s,e.source,h,h[0]))}}catch(t){u.e(t)}finally{u.f()}}else{l=new Ao(n.sliceDoc(e.from,e.to)),v=void 0,d=ic(e.result.options);try{for(d.s();!(y=d.n()).done;)p=y.value,(v=l.match(p.label))&&B(new Mo(p,e.source,v,v[0]+(p.boost||0)))}catch(t){d.e(t)}finally{d.f()}}}catch(t){_.e(t)}finally{_.f()}if(T){k=Object.create(null),m=0,g=function t(n,i){var e,r;return(null!==(e=n.rank)&&void 0!==e?e:1e9)-(null!==(r=i.rank)&&void 0!==r?r:1e9)||(n.name<i.name?-1:1)},w=ic(T.sort(g));try{for(w.s();!(b=w.n()).done;)M=b.value,m-=1e5,k[M.name]=m}catch(t){w.e(t)}finally{w.f()}x=ic(j);try{for(x.s();!(S=x.n()).done;)(O=(C=S.value).completion.section)&&(C.score+=k["string"==typeof O?O:O.name])}catch(t){x.e(t)}finally{x.f()}}A=[],D=null,E=n.facet(Do).compareCompletions,I=ic(j.sort((function(t,n){return n.score-t.score||E(t.completion,n.completion)})));try{for(I.s();!(R=I.n()).done;)L=R.value,!D||D.label!=L.completion.label||D.detail!=L.completion.detail||null!=D.type&&null!=L.completion.type&&D.type!=L.completion.type||D.apply!=L.completion.apply?A.push(L):Qp(L.completion)>Qp(D)&&(A[A.length-1]=L),D=L.completion}catch(t){I.e(t)}finally{I.f()}return A}function Zp(t,n){var i,e,r,u;if(t==n)return!0;for(i=0,e=0;;){for(;i<t.length&&!t[i].hasResult;)i++;for(;e<n.length&&!n[e].hasResult;)e++;if(r=i==t.length,u=e==n.length,r||u)return r==u;if(t[i++].result!=n[e++].result)return!1}}function Yp(t,n){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return n>-1&&(i["aria-activedescendant"]=t+"-"+n),i}function tk(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}function nk(t,n,i,e){if(!t)return!1;var r=n.sliceDoc(i,e);return"function"==typeof t?t(r,i,e,n):Fp(t,!0).test(r)}function ik(t,n){return m.create(t.filter((function(t){return t.field==n})).map((function(t){return m.range(t.from,t.to)})))}function ek(t){var n=Qo.parse(t);return function(t,e,r,u){var o,s,h=n.instantiate(t.state,r),f=h.text,a=h.ranges,c={changes:{from:r,to:u,insert:i.of(f)},scrollIntoView:!0,annotations:e?xo.of(e):void 0};a.length&&(c.selection=ik(a,0)),a.length>1&&(o=new Yo(a,0),s=c.effects=[ts.of(o)],void 0===t.state.field(is,!1)&&s.push(U.appendConfig.of([is,hs,fs,Go]))),t.dispatch(t.state.update(c))}}function rk(t){return function(n){var i,e,r=n.state,u=n.dispatch,o=r.field(is,!1);return!(!o||t<0&&0==o.active)&&(i=o.active+t,e=t>0&&!o.ranges.some((function(n){return n.field==i+t})),u(r.update({selection:ik(o.ranges,i),effects:ts.of(e?null:new Yo(o.ranges,i))})),!0)}}function uk(t){var n=t.field(is,!1);return!(!n||!n.ranges.some((function(t){return t.field==n.active+1})))}function ok(t){var n=t.field(is,!1);return!!(n&&n.active>0)}function sk(t,n){return Object.assign(Object.assign({},n),{apply:ek(t)})}function hk(t){var n=t.replace(/[\\[.+*?(){|^$]/g,"\\$&");try{return new RegExp("[\\p{Alphabetic}\\p{Number}_".concat(n,"]+"),"ug")}catch(t){return new RegExp("[w".concat(n,"]"),"g")}}function fk(t,n){return new RegExp(n(t.source),t.unicode?"u":"")}function ak(t){return as[t]||(as[t]=new WeakMap)}function ck(t,n,i,e,r){var u,o,s,h;for(u=t.iterLines(),o=0;!u.next().done;){for(s=u.value,h=void 0,n.lastIndex=0;h=n.exec(s);)if(!e[h[0]]&&o+h.index!=r&&(i.push({type:"text",label:h[0]}),e[h[0]]=!0,i.length>=2e3))return;o+=s.length+1}}function lk(t,n,i,e,r){var u,o,s,h,f,a,c,l,v,d=t.length>=1e3,y=d&&n.get(t);if(y)return y;if(u=[],o=Object.create(null),t.children){s=0,h=ic(t.children);try{for(h.s();!(f=h.n()).done;){if((a=f.value).length>=1e3){c=ic(lk(a,n,i,e-s,r-s));try{for(c.s();!(l=c.n()).done;)o[(v=l.value).label]||(o[v.label]=!0,u.push(v))}catch(t){c.e(t)}finally{c.f()}}else ck(a,i,u,o,r-s);s+=a.length+1}}catch(t){h.e(t)}finally{h.f()}}else ck(t,i,u,o,r);return d&&u.length<2e3&&n.set(t,u),u}function vk(){return[ms,ys]}function dk(t){for(var n=0;n<ps.length;n+=2)if(ps.charCodeAt(n)==t)return ps.charAt(n+1);return Rc(t<128?t:t+1)}function yk(t,n){return t.languageDataAt("closeBrackets",n)[0]||ls}function pk(t,n){var i,e,r,u=yk(t,t.selection.main.head),o=u.brackets||ls.brackets,s=ic(o);try{for(s.s();!(i=s.n()).done;){if(r=dk(Ic(e=i.value,0)),n==e)return r==e?Mk(t,e,o.indexOf(e+e+e)>-1,u):wk(t,e,r,u.before||ls.before);if(n==r&&kk(t,t.selection.main.from))return bk(t,e,r)}}catch(t){s.e(t)}finally{s.f()}return null}function kk(t,n){var i=!1;return t.field(ys).between(0,t.doc.length,(function(t){t==n&&(i=!0)})),i}function mk(t,n){var i=t.sliceString(n,n+2);return i.slice(0,Lc(Ic(i,0)))}function gk(t,n){var i=t.sliceString(n-2,n);return Lc(Ic(i,0))==i.length?i:i.slice(1)}function wk(t,n,i,e){var r=null,u=t.changeByRange((function(u){if(!u.empty)return{changes:[{insert:n,from:u.from},{insert:i,from:u.to}],effects:vs.of(u.to+n.length),range:m.range(u.anchor+n.length,u.head+n.length)};var o=mk(t.doc,u.head);return!o||/\s/.test(o)||e.indexOf(o)>-1?{changes:{insert:n+i,from:u.head},effects:vs.of(u.head+n.length),range:m.cursor(u.head+n.length)}:{range:r=u}}));return r?null:t.update(u,{scrollIntoView:!0,userEvent:"input.type"})}function bk(t,n,i){var e=null,r=t.changeByRange((function(n){return n.empty&&mk(t.doc,n.head)==i?{changes:{from:n.head,to:n.head+i.length,insert:i},range:m.cursor(n.head+i.length)}:e={range:n}}));return e?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Mk(t,n,i,e){var r=e.stringPrefixes||ls.stringPrefixes,u=null,o=t.changeByRange((function(e){var o,s,h,f,a;if(!e.empty)return{changes:[{insert:n,from:e.from},{insert:n,from:e.to}],effects:vs.of(e.to+n.length),range:m.range(e.anchor+n.length,e.head+n.length)};if(o=e.head,(s=mk(t.doc,o))==n){if(xk(t,o))return{changes:{insert:n+n,from:o},effects:vs.of(o+n.length),range:m.cursor(o+n.length)};if(kk(t,o))return{changes:{from:o,to:o+(a=(f=i&&t.sliceDoc(o,o+3*n.length)==n+n+n)?n+n+n:n).length,insert:a},range:m.cursor(o+a.length)}}else{if(i&&t.sliceDoc(o-2*n.length,o)==n+n&&(h=Ck(t,o-2*n.length,r))>-1&&xk(t,h))return{changes:{insert:n+n+n+n,from:o},effects:vs.of(o+n.length),range:m.cursor(o+n.length)};if(t.charCategorizer(o)(s)!=G.Word&&Ck(t,o,r)>-1&&!Sk(t,o,n,r))return{changes:{insert:n+n,from:o},effects:vs.of(o+n.length),range:m.cursor(o+n.length)}}return{range:u=e}}));return u?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function xk(t,n){var i=Ly(t).resolveInner(n+1);return i.parent&&i.from==n}function Sk(t,n,i,e){var r,u,o,s,h,f=Ly(t).resolveInner(n,-1),a=e.reduce((function(t,n){return Math.max(t,n.length)}),0);for(r=0;r<5;r++){if(!(o=(u=t.sliceDoc(f.from,Math.min(f.to,f.from+i.length+a))).indexOf(i))||o>-1&&e.indexOf(u.slice(0,o))>-1){for(s=f.firstChild;s&&s.from==f.from&&s.to-s.from>i.length+o;){if(t.sliceDoc(s.to-i.length,s.to)==i)return!1;s=s.firstChild}return!0}if(!(h=f.to==n&&f.parent))break;f=h}return!1}function Ck(t,n,i){var e,r,u,o,s=t.charCategorizer(n);if(s(t.sliceDoc(n-1,n))!=G.Word)return n;e=ic(i);try{for(e.s();!(r=e.n()).done;)if(o=n-(u=r.value).length,t.sliceDoc(o,n)==u&&s(t.sliceDoc(o-1,o))!=G.Word)return o}catch(t){e.e(t)}finally{e.f()}return-1}function Ok(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[qo,Do.of(t),_o,Ms,Go]}function Ak(t){var n=t.field(qo,!1);return n&&n.active.some((function(t){return 1==t.state}))?"pending":n&&n.active.some((function(t){return 0!=t.state}))?"active":null}function Dk(t){var n,i,e=null===(n=t.field(qo,!1))||void 0===n?void 0:n.open;return!e||e.disabled?[]:((i=xs.get(e.options))||xs.set(e.options,i=e.options.map((function(t){return t.completion}))),i)}function Ek(t){var n,i=null===(n=t.field(qo,!1))||void 0===n?void 0:n.open;return i&&!i.disabled&&i.selected>=0?i.options[i.selected].completion:null}function Ik(t){var n,i=null===(n=t.field(qo,!1))||void 0===n?void 0:n.open;return i&&!i.disabled&&i.selected>=0?i.selected:null}function Rk(t){return $o.of(t)}function Lk(t,n){return function(i){var e,r=i.state,u=i.dispatch;return!r.readOnly&&(!!(e=t(n,r))&&(u(r.update(e)),!0))}}function jk(t,n){var i=t.languageDataAt("commentTokens",n);return i.length?i[0]:{}}function Tk(t,n,i,e){var r,u,o,s,h,f=n.open,a=n.close,c=t.sliceDoc(i-js,i),l=t.sliceDoc(e,e+js),v=/\s*$/.exec(c)[0].length,d=/^\s*/.exec(l)[0].length,y=c.length-v;return c.slice(y-f.length,y)==f&&l.slice(d,d+a.length)==a?{open:{pos:i-v,margin:v&&1},close:{pos:e+d,margin:d&&1}}:(e-i<=2*js?r=u=t.sliceDoc(i,e):(r=t.sliceDoc(i,i+js),u=t.sliceDoc(e-js,e)),o=/^\s*/.exec(r)[0].length,s=/\s*$/.exec(u)[0].length,h=u.length-s-a.length,r.slice(o,o+f.length)==f&&u.slice(h,h+a.length)==a?{open:{pos:i+o+f.length,margin:/\s/.test(r.charAt(o+f.length))?1:0},close:{pos:e-s-a.length,margin:/\s/.test(u.charAt(h-1))?1:0}}:null)}function Bk(t){var n,i,e,r,u,o=[],s=ic(t.selection.ranges);try{for(s.s();!(n=s.n()).done;)i=n.value,e=t.doc.lineAt(i.from),r=i.to<=e.to?e:t.doc.lineAt(i.to),(u=o.length-1)>=0&&o[u].to>e.from?o[u].to=r.to:o.push({from:e.from+/^\s*/.exec(e.text)[0].length,to:r.to})}catch(t){s.e(t)}finally{s.f()}return o}function _k(t,n){var i,e,r,u,o,s,h,f,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.selection.ranges,c=a.map((function(t){return jk(n,t.from).block}));if(!c.every((function(t){return t})))return null;if(i=a.map((function(t,i){return Tk(n,c[i],t.from,t.to)})),2!=t&&!i.every((function(t){return t})))return{changes:n.changes(a.map((function(t,n){return i[n]?[]:[{from:t.from,insert:c[n].open+" "},{from:t.to,insert:" "+c[n].close}]})))};if(1!=t&&i.some((function(t){return t}))){for(e=[],r=0;r<i.length;r++)(u=i[r])&&(o=c[r],h=(s=u).open,f=s.close,e.push({from:h.pos-o.open.length,to:h.pos+h.margin},{from:f.pos-f.margin,to:f.pos+o.close.length}));return{changes:e}}return null}function Nk(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.selection.ranges,B=[],_=-1,N=ic(T);try{for(N.s();!(i=N.n()).done;)if(r=(e=i.value).from,u=e.to,o=B.length,s=1e9,h=jk(n,r).line){for(f=r;f<=u;)(a=n.doc.lineAt(f)).from>_&&(r==u||u>a.from)&&(_=a.from,l=(c=/^\s*/.exec(a.text)[0].length)==a.length,v=a.text.slice(c,c+h.length)==h?c:-1,c<a.text.length&&c<s&&(s=c),B.push({line:a,comment:v,token:h,indent:c,empty:l,single:!1})),f=a.to+1;if(s<1e9)for(d=o;d<B.length;d++)B[d].indent<B[d].line.text.length&&(B[d].indent=s);B.length==o+1&&(B[o].single=!0)}}catch(t){N.e(t)}finally{N.f()}if(2!=t&&B.some((function(t){return t.comment<0&&(!t.empty||t.single)}))){y=[],p=ic(B);try{for(p.s();!(k=p.n()).done;)g=(m=k.value).line,w=m.token,b=m.indent,M=m.empty,!(x=m.single)&&M||y.push({from:g.from+b,insert:w+" "})}catch(t){p.e(t)}finally{p.f()}return{changes:S=n.changes(y),selection:n.selection.map(S,1)}}if(1!=t&&B.some((function(t){return t.comment>=0}))){C=[],O=ic(B);try{for(O.s();!(A=O.n()).done;)E=(D=A.value).line,I=D.comment,R=D.token,I>=0&&(j=(L=E.from+I)+R.length," "==E.text[j-E.from]&&j++,C.push({from:L,to:j}))}catch(t){O.e(t)}finally{O.f()}return{changes:C}}return null}function Pk(t){var n=0;return t.iterChangedRanges((function(t,i){return n=i})),n}function Fk(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Ps,Ns.of(t),Ui.domEventHandlers({beforeinput:function t(n,i){var e="historyUndo"==n.inputType?Hs:"historyRedo"==n.inputType?zs:null;return!!e&&(n.preventDefault(),e(i))}})]}function Hk(t,n){return function(i){var e,r,u=i.state,o=i.dispatch;return!(!n&&u.readOnly)&&(!!(e=u.field(Ps,!1))&&(!!(r=e.pop(t,u,n))&&(o(r),!0)))}}function zk(t){return function(n){var i,e=n.field(Ps,!1);return e?(i=0==t?e.done:e.undone).length-(i.length&&!i[0].changes?1:0):0}}function Wk(t,n,i,e){var r=n+1>i+20?n-i-1:0,u=t.slice(r,n);return u.push(e),u}function Vk(t,n){var i=[],e=!1;return t.iterChangedRanges((function(t,n){return i.push(t,n)})),n.iterChangedRanges((function(t,n,r,u){var o,s,h;for(o=0;o<i.length;)s=i[o++],h=i[o++],u>=s&&r<=h&&(e=!0)})),e}function Uk(t,n){return t.ranges.length==n.ranges.length&&0===t.ranges.filter((function(t,i){return t.empty!=n.ranges[i].empty})).length}function $k(t,n){return t.length?n.length?t.concat(n):t:n}function qk(t,n){var i,e;return t.length?(e=(i=t[t.length-1]).selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Js))).length&&e[e.length-1].eq(n)?t:(e.push(n),Wk(t,t.length-1,1e9,i.setSelAfter(e))):[qs.selection([n])]}function Gk(t){var n=t[t.length-1],i=t.slice();return i[t.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),i}function Jk(t,n){var i,e,r,u;if(!t.length)return t;for(i=t.length,e=Gs;i;){if((r=Kk(t[i-1],n,e)).changes&&!r.changes.empty||r.effects.length)return(u=t.slice(0,i))[i-1]=r,u;n=r.mapped,i--,e=r.selectionsAfter}return e.length?[qs.selection(e)]:Gs}function Kk(t,n,i){var e,r,u,o=$k(t.selectionsAfter.length?t.selectionsAfter.map((function(t){return t.map(n)})):Gs,i);return t.changes?(e=t.changes.map(n),r=n.mapDesc(t.changes,!0),u=t.mapped?t.mapped.composeDesc(r):r,new qs(e,U.mapEffects(t.effects,n),u,t.startSelection.map(r),o)):qs.selection(o)}function Qk(t,n){return m.create(t.ranges.map(n),t.mainIndex)}function Xk(t,n){return t.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function Zk(t,n){var i=t.state,e=t.dispatch,r=Qk(i.selection,n);return!r.eq(i.selection)&&(e(Xk(i,r)),!0)}function Yk(t,n){return m.cursor(n?t.to:t.from)}function tm(t,n){return Zk(t,(function(i){return i.empty?t.moveByChar(i,n):Yk(i,n)}))}function nm(t){return t.textDirectionAt(t.state.selection.main.head)==An.LTR}function im(t,n){return Zk(t,(function(i){return i.empty?t.moveByGroup(i,n):Yk(i,n)}))}function em(t,n,i){var e=t.state.charCategorizer(n.from);return t.moveByChar(n,i,(function(r){var u=G.Space,o=n.from,s=!1,h=!1,f=!1,a=function n(r){if(s)return!1;o+=i?r.length:-r.length;var a=e(r),c;if(a==G.Word&&r.charCodeAt(0)<128&&/[\W_]/.test(r)&&(a=-1),u==G.Space&&(u=a),u!=a)return!1;if(u==G.Word)if(r.toLowerCase()==r){if(!i&&h)return!1;f=!0}else if(f){if(i)return!1;s=!0}else{if(h&&i&&e(c=t.state.sliceDoc(o,o+1))==G.Word&&c.toLowerCase()==c)return!1;h=!0}return!0};return a(r),a}))}function rm(t,n){return Zk(t,(function(i){return i.empty?em(t,i,n):Yk(i,n)}))}function um(t,n,i){if(n.type.prop(i))return!0;var e=n.to-n.from;return e&&(e>2||/[^\s,.;:]/.test(t.sliceDoc(n.from,n.to)))||n.firstChild}function om(t,n,i){var e,r,u,o,s,h=Ly(t).resolveInner(n.head),f=i?pr.closedBy:pr.openedBy;for(e=n.head;r=i?h.childAfter(e):h.childBefore(e);)um(t,r,f)?h=r:e=i?r.to:r.from;return s=(u=h.type.prop(f))&&(o=i?wp(t,h.from,1):wp(t,h.to,-1))&&o.matched?i?o.end.to:o.end.from:i?h.to:h.from,m.cursor(s,i?-1:1)}function sm(t,n){return Zk(t,(function(i){if(!i.empty)return Yk(i,n);var e=t.moveVertically(i,n);return e.head!=i.head?e:t.moveToLineBoundary(i,n)}))}function hm(t){var n,i,e,r,u,o=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,s=0,h=0;if(o){i=ic(t.state.facet(Ui.scrollMargins));try{for(i.s();!(e=i.n()).done;)(null==(u=(r=e.value)(t))?void 0:u.top)&&(s=Math.max(null==u?void 0:u.top,s)),(null==u?void 0:u.bottom)&&(h=Math.max(null==u?void 0:u.bottom,h))}catch(t){i.e(t)}finally{i.f()}n=t.scrollDOM.clientHeight-s-h}else n=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:s,marginBottom:h,selfScroll:o,height:Math.max(t.defaultLineHeight,n-5)}}function fm(t,n){var i,e,r,u,o,s=hm(t),h=t.state,f=Qk(h.selection,(function(i){return i.empty?t.moveVertically(i,n,s.height):Yk(i,n)}));return!f.eq(h.selection)&&(s.selfScroll&&(e=t.coordsAtPos(h.selection.main.head),u=(r=t.scrollDOM.getBoundingClientRect()).top+s.marginTop,o=r.bottom-s.marginBottom,e&&e.top>u&&e.bottom<o&&(i=Ui.scrollIntoView(f.main.head,{y:"start",yMargin:e.top-u}))),t.dispatch(Xk(h,f),{effects:i}),!0)}function am(t,n,i){var e,r=t.lineBlockAt(n.head),u=t.moveToLineBoundary(n,i);return u.head==n.head&&u.head!=(i?r.to:r.from)&&(u=t.moveToLineBoundary(n,i,!1)),!i&&u.head==r.from&&r.length&&(e=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length)&&n.head!=r.from+e&&(u=m.cursor(r.from+e)),u}function cm(t,n,i){var e=!1,r=Qk(t.selection,(function(n){var r,u=wp(t,n.head,-1)||wp(t,n.head,1)||n.head>0&&wp(t,n.head-1,1)||n.head<t.doc.length&&wp(t,n.head+1,-1);return u&&u.end?(e=!0,r=u.start.from==n.head?u.end.to:u.end.from,i?m.range(n.anchor,r):m.cursor(r)):n}));return!!e&&(n(Xk(t,r)),!0)}function lm(t,n){var i=Qk(t.state.selection,(function(t){var i=n(t);return m.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Xk(t.state,i)),!0)}function vm(t,n){return lm(t,(function(i){return t.moveByChar(i,n)}))}function dm(t,n){return lm(t,(function(i){return t.moveByGroup(i,n)}))}function ym(t,n){return lm(t,(function(i){return em(t,i,n)}))}function pm(t,n){return lm(t,(function(i){return t.moveVertically(i,n)}))}function km(t,n){return lm(t,(function(i){return t.moveVertically(i,n,hm(t).height)}))}function mm(t,n){var i,e,r;return!t.state.readOnly&&(i="delete.selection",!(r=(e=t.state).changeByRange((function(e){var r,u=e.from,o=e.to;return u==o?((r=n(u))<u?(i="delete.backward",r=gm(t,r,!1)):r>u&&(i="delete.forward",r=gm(t,r,!0)),u=Math.min(u,r),o=Math.max(o,r)):(u=gm(t,u,!1),o=gm(t,o,!0)),u==o?{range:e}:{changes:{from:u,to:o},range:m.cursor(u)}}))).changes.empty&&(t.dispatch(e.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ui.announce.of(e.phrase("Selection deleted")):void 0})),!0))}function gm(t,n,i){var e,r,u;if(t instanceof Ui){e=ic(t.state.facet(Ui.atomicRanges).map((function(n){return n(t)})));try{for(e.s();!(r=e.n()).done;)(u=r.value).between(n,n,(function(t,e){t<n&&e>n&&(n=i?e:t)}))}catch(t){e.e(t)}finally{e.f()}}return n}function wm(t){var n,i,e,r,u,o=[],s=-1,h=ic(t.selection.ranges);try{for(h.s();!(n=h.n()).done;)i=n.value,e=t.doc.lineAt(i.from),r=t.doc.lineAt(i.to),i.empty||i.to!=r.from||(r=t.doc.lineAt(i.to-1)),s>=e.number?((u=o[o.length-1]).to=r.to,u.ranges.push(i)):o.push({from:e.from,to:r.to,ranges:[i]}),s=r.number+1}catch(t){h.e(t)}finally{h.f()}return o}function bm(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y;if(t.readOnly)return!1;e=[],r=[],u=ic(wm(t));try{for(u.s();!(o=u.n()).done;)if(s=o.value,i?s.to!=t.doc.length:0!=s.from)if(f=(h=t.doc.lineAt(i?s.to+1:s.from-1)).length+1,i){e.push({from:s.to,to:h.to},{from:s.from,insert:h.text+t.lineBreak}),a=ic(s.ranges);try{for(a.s();!(c=a.n()).done;)l=c.value,r.push(m.range(Math.min(t.doc.length,l.anchor+f),Math.min(t.doc.length,l.head+f)))}catch(t){a.e(t)}finally{a.f()}}else{e.push({from:h.from,to:s.from},{from:s.to,insert:t.lineBreak+h.text}),v=ic(s.ranges);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(m.range(y.anchor-f,y.head-f))}catch(t){v.e(t)}finally{v.f()}}}catch(t){u.e(t)}finally{u.f()}return!!e.length&&(n(t.update({changes:e,scrollIntoView:!0,selection:m.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Mm(t,n,i){var e,r,u,o;if(t.readOnly)return!1;e=[],r=ic(wm(t));try{for(r.s();!(u=r.n()).done;)o=u.value,i?e.push({from:o.from,insert:t.doc.slice(o.from,o.to)+t.lineBreak}):e.push({from:o.to,insert:t.lineBreak+t.doc.slice(o.from,o.to)})}catch(t){r.e(t)}finally{r.f()}return n(t.update({changes:e,scrollIntoView:!0,userEvent:"input.copyline"})),!0}function xm(t,n){var i,e,r,u;return/\(\)|\[\]|\{\}/.test(t.sliceDoc(n-1,n+1))?{from:n,to:n}:(e=(i=Ly(t).resolveInner(n)).childBefore(n),r=i.childAfter(n),e&&r&&e.to<=n&&r.from>=n&&(u=e.type.prop(pr.closedBy))&&u.indexOf(r.name)>-1&&t.doc.lineAt(e.to).from==t.doc.lineAt(r.from).from?{from:e.to,to:r.from}:null)}function Sm(t){return function(n){var e,r=n.state,u=n.dispatch;return!r.readOnly&&(e=r.changeByRange((function(n){var e,u,o,s=n.from,h=n.to,f=r.doc.lineAt(s),a=!t&&s==h&&xm(r,s);for(t&&(s=h=(h<=f.to?f:r.doc.lineAt(h)).to),null==(u=Hy(e=new wu(r,{simulateBreak:s,simulateDoubleBreak:!!a}),s))&&(u=/^\s*/.exec(r.doc.lineAt(s).text)[0].length);h<f.to&&/\s/.test(f.text[h-f.from]);)h++;return a?(s=a.from,h=a.to):s>f.from&&s<f.from+100&&!/\S/.test(f.text.slice(0,s))&&(s=f.from),o=["",Fy(r,u)],a&&o.push(Fy(r,e.lineIndent(f.from,-1))),{changes:{from:s,to:h,insert:i.of(o)},range:m.cursor(s+1+o[1].length)}})),u(r.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)}}function Cm(t,n){var i=-1;return t.changeByRange((function(e){var r,u,o,s=[];for(r=e.from;r<=e.to;)(u=t.doc.lineAt(r)).number>i&&(e.empty||e.to>u.from)&&(n(u,s,e),i=u.number),r=u.to+1;return o=t.changes(s),{changes:s,range:m.range(o.mapPos(e.anchor,1),o.mapPos(e.head,1))}}))}function Om(){var t,n,i,e,r=arguments[0];if("string"==typeof r&&(r=document.createElement(r)),t=1,(n=arguments[1])&&"object"==dc(n)&&null==n.nodeType&&!Array.isArray(n)){for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&("string"==typeof(e=n[i])?r.setAttribute(i,e):null!=e&&(r[i]=e));t++}for(;t<arguments.length;t++)Am(r,arguments[t]);return r}function Am(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null==n);else if(null!=n.nodeType)t.appendChild(n);else{if(!Array.isArray(n))throw new RangeError("Unsupported child node: "+n);for(var i=0;i<n.length;i++)Am(t,n[i])}}function Dm(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,e=null;return t.between(i,1e9,(function(t,i,r){var u=r.spec;if(!n||u.diagnostic==n)return e=new Af(t,i,u.diagnostic),!1})),e}function Em(t,n){return!(!t.effects.some((function(t){return t.is(Ef)}))&&!t.changes.touchesRange(n.pos))}function Im(t,n){return t.field(Lf,!1)?n:n.concat(U.appendConfig.of(Qf))}function Rm(t,n){return{effects:Im(t,[Ef.of(n)])}}function Lm(t){var n=t.field(Lf,!1);return n?n.diagnostics.size:0}function jm(t,n,i){var e,r=t.state.field(Lf),u=r.diagnostics,o=[],s=2e8,h=0;return u.between(n-(i<0?1:0),n+(i>0?1:0),(function(t,e,r){var u=r.spec;n>=t&&n<=e&&(t==e||(n>t||i>0)&&(n<e||i<0))&&(o.push(u.diagnostic),s=Math.min(t,s),h=Math.max(e,h))})),(e=t.state.facet(Ff).tooltipFilter)&&(o=e(o)),o.length?{pos:s,end:h,above:t.state.doc.lineAt(s).to<h,create:function n(){return{dom:Tm(t,o)}}}:null}function Tm(t,n){return Om("ul",{class:"cm-tooltip-lint"},n.map((function(n){return Pm(t,n,!1)})))}function Bm(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[Ff.of({source:t,config:n}),Pf,Qf]}function _m(t){var n=t.plugin(Pf);n&&n.force()}function Nm(t){var n,i,e,r,u,o=[];if(t){n=ic(t);try{t:for(n.s();!(i=n.n()).done;){for(e=i.value.name,r=function t(){var n=e[u];if(/[a-zA-Z]/.test(n)&&!o.some((function(t){return t.toLowerCase()==n.toLowerCase()})))return o.push(n),1},u=0;u<e.length;u++)if(r())continue t;o.push("")}}catch(t){n.e(t)}finally{n.f()}}return o}function Pm(t,n,i){var e,r=i?Nm(n.actions):[];return Om("li",{class:"cm-diagnostic cm-diagnostic-"+n.severity},Om("span",{class:"cm-diagnosticText"},n.renderMessage?n.renderMessage():n.message),null===(e=n.actions)||void 0===e?void 0:e.map((function(i,e){var u=!1,o=function e(r){if(r.preventDefault(),!u){u=!0;var o=Dm(t.state.field(Lf).diagnostics,n);o&&i.apply(t,o.from,o.to)}},s=i.name,h=r[e]?s.indexOf(r[e]):-1,f=h<0?s:[s.slice(0,h),Om("u",s.slice(h,h+1)),s.slice(h+1)];return Om("button",{type:"button",class:"cm-diagnosticAction",onclick:o,onmousedown:o,"aria-label":" Action: ".concat(s).concat(h<0?"":' (access key "'.concat(r[e],')"'),".")},f)})),n.source&&Om("div",{class:"cm-diagnosticSource"},n.source))}function Fm(t){var n;return'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" '.concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(t),"</svg>')")}function Hm(t){return Fm('<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="'.concat(t,'" fill="none" stroke-width=".7"/>'),'width="6" height="3"')}function zm(t,n){var i=function i(e){var r,u=n.getBoundingClientRect();if(!(e.clientX>u.left-10&&e.clientX<u.right+10&&e.clientY>u.top-10&&e.clientY<u.bottom+10)){for(r=e.target;r;r=r.parentNode)if(1==r.nodeType&&r.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",i),t.state.field(Jf)&&t.dispatch({effects:Gf.of(null)})}};window.addEventListener("mousemove",i)}function Wm(t,n,i){var e,r,u;function o(){var e=t.elementAtHeight(n.getBoundingClientRect().top+5-t.documentTop),r=t.coordsAtPos(e.from);r&&t.dispatch({effects:Gf.of({pos:e.from,above:!1,create:function e(){return{dom:Tm(t,i),getCoords:function t(){return n.getBoundingClientRect()}}}})}),n.onmouseout=n.onmousemove=null,zm(t,n)}e=t.state.facet(Xf),r=e.hoverTime,u=setTimeout(o,r),n.onmouseout=function(){clearTimeout(u),n.onmouseout=n.onmousemove=null},n.onmousemove=function(){clearTimeout(u),u=setTimeout(o,r)}}function Vm(t,n){var i,e,r,u,o,s=Object.create(null),h=ic(n);try{for(h.s();!(i=h.n()).done;)e=i.value,(s[(r=t.lineAt(e.from)).from]||(s[r.from]=[])).push(e)}catch(t){h.e(t)}finally{h.f()}for(o in u=[],s)u.push(new Uf(s[o]).range(+o));return tt.of(u,!0)}function Um(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Xf.of(t),qf,$f,Kf,Jf]}function $m(t,n){var i,e=t.field(Lf,!1);if(e&&e.diagnostics.size)for(i=tt.iter([e.diagnostics]);i.value;i.next())n(i.value.spec.diagnostic,i.from,i.to)}function qm(t){try{return new RegExp(t,ia),!0}catch(t){return!1}}function Gm(t,n){if(n>=t.length)return n;for(var i=t.lineAt(n),e;n<i.to&&(e=i.text.charCodeAt(n-i.from))>=56320&&e<57344;)n++;return n}function Jm(t){var n=Om("input",{class:"cm-textfield",name:"line"}),i=Om("form",{class:"cm-gotoLine",onkeydown:function n(i){27==i.keyCode?(i.preventDefault(),t.dispatch({effects:sa.of(!1)}),t.focus()):13==i.keyCode&&(i.preventDefault(),e())},onsubmit:function t(n){n.preventDefault(),e()}},Om("label",t.state.phrase("Go to line"),": ",n)," ",Om("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function e(){var i,e,r,u,o,s,h,f,a,c,l,v=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);v&&(e=(i=t.state).doc.lineAt(i.selection.main.head),u=(r=Za(v,5))[1],o=r[2],s=r[3],h=r[4],f=s?+s.slice(1):0,a=o?+o:e.number,o&&h?(c=a/100,u&&(c=c*("-"==u?-1:1)+e.number/i.doc.lines),a=Math.round(i.doc.lines*c)):o&&u&&(a=a*("-"==u?-1:1)+e.number),l=i.doc.line(Math.max(1,Math.min(i.doc.lines,a))),t.dispatch({effects:sa.of(!1),selection:m.cursor(l.from+Math.max(0,Math.min(f,l.length))),scrollIntoView:!0}),t.focus())}return{dom:i}}function Km(t){var n=[pa,ya];return t&&n.push(la.of(t)),n}function Qm(t,n,i,e){return!(0!=i&&t(n.sliceDoc(i-1,i))==G.Word||e!=n.doc.length&&t(n.sliceDoc(e,e+1))==G.Word)}function Xm(t,n,i,e){return t(n.sliceDoc(i,i+1))==G.Word&&t(n.sliceDoc(e-1,e))==G.Word}function Zm(t,n){var i,e,r,u=t.selection,o=u.main,s=u.ranges,h=t.wordAt(o.head),f=h&&h.from==o.from&&h.to==o.to,a=function i(u,o){if(o.next(),!o.done){if(u&&s.some((function(t){return t.from==o.value.from})))return e=u,r=o,0;if(f){var h=t.wordAt(o.value.from);if(!h||h.from!=o.value.from||h.to!=o.value.to)return e=u,r=o,0}return{v:o.value}}if(u)return{v:null};o=new ta(t.doc,n,0,Math.max(0,s[s.length-1].from-1)),e=u=!0,r=o};for(e=!1,r=new ta(t.doc,n,s[s.length-1].to);;)if(0!==(i=a(e,r))&&i)return i.v}function Ym(t){return t?[ga.of(t),Ua]:Ua}function tg(t,n,i,e){return new ta(n.doc,t.unquoted,i,e,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?ng(n.doc,n.charCategorizer(n.selection.main.head)):void 0)}function ng(t,n){return function(i,e,r,u){return(u>i||u+r.length<e)&&(u=Math.max(0,i-2),r=t.sliceString(u,Math.min(t.length,e+2))),!(n(eg(r,i-u))==G.Word&&n(rg(r,i-u))==G.Word||n(rg(r,e-u))==G.Word&&n(eg(r,e-u))==G.Word)}}function ig(t,n,i,e){return new ea(n.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?ug(n.charCategorizer(n.selection.main.head)):void 0},i,e)}function eg(t,n){return t.slice(Cc(t,n,!1),n)}function rg(t,n){return t.slice(n,Cc(t,n))}function ug(t){return function(n,i,e){return!e[0].length||(t(eg(e.input,e.index))!=G.Word||t(rg(e.input,e.index))!=G.Word)&&(t(rg(e.input,e.index+e[0].length))!=G.Word||t(eg(e.input,e.index+e[0].length))!=G.Word)}}function og(t){var n=t.field(Oa,!1);return n?n.query.spec:ag(t)}function sg(t){var n;return null!=(null===(n=t.field(Oa,!1))||void 0===n?void 0:n.panel)}function hg(t){return function(n){var i=n.state.field(Oa,!1);return i&&i.query.spec.valid?t(n,i):Na(n)}}function fg(t){return t.state.facet(ga).createPanel(t)}function ag(t,n){var i,e,r,u,o,s=t.selection.main,h=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);return n&&!h?n:(o=t.facet(ga),new wa({search:(null!==(i=null==n?void 0:n.literal)&&void 0!==i?i:o.literal)?h:h.replace(/\n/g,"\\n"),caseSensitive:null!==(e=null==n?void 0:n.caseSensitive)&&void 0!==e?e:o.caseSensitive,literal:null!==(r=null==n?void 0:n.literal)&&void 0!==r?r:o.literal,wholeWord:null!==(u=null==n?void 0:n.wholeWord)&&void 0!==u?u:o.wholeWord}))}function cg(t){var n=Yd(t,fg);return n&&n.dom.querySelector("[main-field]")}function lg(t){var n=cg(t);n&&n==t.root.activeElement&&n.select()}function vg(t,n){return t.state.phrase(n)}function dg(t,n){var i,e,r=n.from,u=n.to,o=t.state.doc.lineAt(r),s=t.state.doc.lineAt(u).to,h=Math.max(o.from,r-za),f=Math.min(s,u+za),a=t.state.sliceDoc(h,f);if(h!=o.from)for(i=0;i<za;i++)if(!Wa.test(a[i+1])&&Wa.test(a[i])){a=a.slice(i);break}if(f!=s)for(e=a.length-1;e>a.length-za;e--)if(!Wa.test(a[e-1])&&Wa.test(a[e])){a=a.slice(0,e);break}return Ui.announce.of("".concat(t.state.phrase("current match"),". ").concat(a," ").concat(t.state.phrase("on line")," ").concat(o.number,"."))}go=new(mo=function(){function t(n){yc(this,t),this.extra=n,this.table=Object.assign(Object.create(null),co)}return kc(t,[{key:"resolve",value:function t(n){return n?this.table[n]||(this.table[n]=Rp(this.extra,n)):0}}]),t}())(so),wo=n.Language=Object.freeze({__proto__:null,DocInput:hu,HighlightStyle:Wu,IndentContext:wu,LRLanguage:su,Language:ou,LanguageDescription:ku,LanguageSupport:pu,ParseContext:au,StreamLanguage:uo,StringStream:eo,TreeIndentContext:Mu,bracketMatching:kp,bracketMatchingHandle:io,codeFolding:cp,continuedIndent:Xy,defaultHighlightStyle:Gu,defineLanguageFacet:Iy,delimitedIndent:Ky,ensureSyntaxTree:jy,flatIndent:xu,foldAll:Lu,foldCode:Iu,foldEffect:Au,foldGutter:lp,foldInside:Yy,foldKeymap:Bu,foldNodeProp:Ou,foldService:Cu,foldState:Eu,foldable:ip,foldedRanges:up,forceParsing:By,getIndentUnit:Py,getIndentation:Hy,highlightingFor:yp,indentNodeProp:bu,indentOnInput:Zy,indentRange:zy,indentService:mu,indentString:Fy,indentUnit:gu,language:yu,languageDataProp:ru,matchBrackets:wp,sublanguageProp:uu,syntaxHighlighting:dp,syntaxParserRunning:_y,syntaxTree:Ly,syntaxTreeAvailable:Ty,toggleFold:Tu,unfoldAll:ju,unfoldCode:Ru,unfoldEffect:Du}),bo=function(){function t(n,i,e){yc(this,t),this.state=n,this.pos=i,this.explicit=e,this.abortListeners=[]}return kc(t,[{key:"tokenBefore",value:function t(n){for(var i=Ly(this.state).resolveInner(this.pos,-1);i&&n.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}},{key:"matchBefore",value:function t(n){var i=this.state.doc.lineAt(this.pos),e=Math.max(i.from,this.pos-250),r=i.text.slice(e-i.from,this.pos-i.from),u=r.search(Fp(n,!1));return u<0?null:{from:e+u,to:this.pos,text:r.slice(u)}}},{key:"aborted",get:function t(){return null==this.abortListeners}},{key:"addEventListener",value:function t(n,i){"abort"==n&&this.abortListeners&&this.abortListeners.push(i)}}]),t}(),Mo=kc((function t(n,i,e,r){yc(this,t),this.completion=n,this.source=i,this.match=e,this.score=r})),xo=z.define(),So=new WeakMap,Co=U.define(),Oo=U.define(),Ao=function(){function t(n){var i,e,r,u,o;for(yc(this,t),this.pattern=n,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],i=0;i<n.length;)r=Lc(e=Ic(n,i)),this.chars.push(e),o=(u=n.slice(i,i+r)).toUpperCase(),this.folded.push(Ic(o==u?u.toLowerCase():o,0)),i+=r;this.astral=n.length!=this.chars.length}return kc(t,[{key:"match",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E;if(0==this.pattern.length)return[-100];if(n.length<this.pattern.length)return null;if(i=this.chars,e=this.folded,r=this.any,u=this.precise,o=this.byWord,1==i.length){if(f=(h=Lc(s=Ic(n,0)))==n.length?0:-100,s==i[0]);else{if(s!=e[0])return null;f+=-200}return[f,0,h]}if(0==(a=n.indexOf(this.pattern)))return[n.length==this.pattern.length?0:-100,0,this.pattern.length];if(c=i.length,l=0,a<0){for(v=0,d=Math.min(n.length,200);v<d&&l<c;)(y=Ic(n,v))!=i[l]&&y!=e[l]||(r[l++]=v),v+=Lc(y);if(l<c)return null}for(p=0,k=0,m=!1,g=0,w=-1,b=-1,M=/[a-z]/.test(n),x=!0,S=0,C=Math.min(n.length,200),O=0;S<C&&k<c;)A=Ic(n,S),a<0&&(p<c&&A==i[p]&&(u[p++]=S),g<c&&(A==i[g]||A==e[g]?(0==g&&(w=S),b=S+1,g++):g=0)),D=void 0,E=A<255?A>=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(D=Rc(A))!=D.toLowerCase()?1:D!=D.toUpperCase()?2:0,(!S||1==E&&M||0==O&&0!=E)&&(i[k]==A||e[k]==A&&(m=!0)?o[k++]=S:o.length&&(x=!1)),O=E,S+=Lc(A);return k==c&&0==o[0]&&x?this.result((m?-200:0)-100,o,n):g==c&&0==w?[-200-n.length+(b==n.length?0:-100),0,b]:a>-1?[-700-n.length,a,a+this.pattern.length]:g==c?[-900-n.length,w,b]:k==c?this.result((m?-200:0)-100-700+(x?0:-1100),o,n):2==i.length?null:this.result((r[0]?-700:0)-200-1100,r,n)}},{key:"result",value:function t(n,i,e){var r,u,o,t=[n-e.length],s=1,h=ic(i);try{for(h.s();!(r=h.n()).done;)o=(u=r.value)+(this.astral?Lc(Ic(e,u)):1),s>1&&t[s-1]==u?t[s-1]=o:(t[s++]=u,t[s++]=o)}catch(t){h.e(t)}finally{h.f()}return t}}]),t}(),Do=w.define({combine:function t(n){return il(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function t(){return""},optionClass:function t(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Vp,compareCompletions:function t(n,i){return n.label.localeCompare(i.label)},interactionDelay:75},{defaultKeymap:function t(n,i){return n&&i},closeOnBlur:function t(n,i){return n&&i},icons:function t(n,i){return n&&i},tooltipClass:function t(n,i){return function(t){return Wp(n(t),i(t))}},optionClass:function t(n,i){return function(t){return Wp(n(t),i(t))}},addToOptions:function t(n,i){return n.concat(i)}})}}),Eo=function t(n){var i=n.state.field(qo,!1);return!(n.state.readOnly||!i||!i.open||i.open.selected<0||Date.now()-i.open.timestamp<n.state.facet(Do).interactionDelay)&&(!!i.open.disabled||$p(n,i.open.options[i.open.selected]))},Io=function t(n){var i;return!!n.state.field(qo,!1)&&(n.dispatch({effects:Co.of(!0)}),!0)},Ro=function t(n){var i=n.state.field(qo,!1);return!(!i||!i.active.some((function(t){return 0!=t.state})))&&(n.dispatch({effects:Oo.of(null)}),!0)},Lo=kc((function t(n,i){yc(this,t),this.active=n,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0})),jo=50,To=50,Bo=1e3,_o=kn.fromClass(function(){function t(n){var i,e,r;yc(this,t),this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0,i=ic(n.state.field(qo).active);try{for(i.s();!(e=i.n()).done;)1==(r=e.value).state&&this.startQuery(r)}catch(t){i.e(t)}finally{i.f()}}return kc(t,[{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l=this,v=n.state.field(qo);if(n.selectionSet||n.docChanged||n.startState.field(qo)!=v){for(i=n.transactions.some((function(t){return(t.selection||t.docChanged)&&!tk(t)})),e=0;e<this.running.length;e++)if(r=this.running[e],i||r.updates.length+n.transactions.length>To&&Date.now()-r.time>Bo){u=ic(r.context.abortListeners);try{for(u.s();!(o=u.n()).done;){s=o.value;try{s()}catch(t){Yl(this.view.state,t)}}}catch(t){u.e(t)}finally{u.f()}r.context.abortListeners=null,this.running.splice(e--,1)}else(h=r.updates).push.apply(h,Ja(n.transactions));if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=v.active.some((function(t){return 1==t.state&&!l.running.some((function(n){return n.active.source==t.source}))}))?setTimeout((function(){return l.startUpdate()}),jo):-1,0!=this.composing){f=ic(n.transactions);try{for(f.s();!(a=f.n()).done;)"input"==tk(c=a.value)?this.composing=2:2==this.composing&&c.selection&&(this.composing=3)}catch(t){f.e(t)}finally{f.f()}}}}},{key:"startUpdate",value:function t(){var n,i,e,r,u,o=this;this.debounceUpdate=-1,e=ic((i=(n=this.view.state).field(qo)).active);try{for(u=function t(){var n=r.value;1!=n.state||o.running.some((function(t){return t.active.source==n.source}))||o.startQuery(n)},e.s();!(r=e.n()).done;)u()}catch(t){e.e(t)}finally{e.f()}}},{key:"startQuery",value:function t(n){var i=this,e=this.view.state,r=Pp(e),u=new bo(e,r,n.explicitPos==r),o=new Lo(n,u);this.running.push(o),Promise.resolve(n.source(u)).then((function(t){o.context.aborted||(o.done=t||null,i.scheduleAccept())}),(function(t){i.view.dispatch({effects:Oo.of(null)}),Yl(i.view.state,t)}))}},{key:"scheduleAccept",value:function t(){var n=this;this.running.every((function(t){return void 0!==t.done}))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((function(){return n.accept()}),jo))}},{key:"accept",value:function t(){var n,i,e,r,u,o,s=this;for(this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1,i=[],e=this.view.state.facet(Do),r=function t(r){var u,h,f,a,c,l,v,d,y,p=s.running[r];if(void 0===p.done)return o=r,0;if(s.running.splice(r--,1),p.done){u=new Vo(p.active.source,p.active.explicitPos,p.done,p.done.from,null!==(n=p.done.to)&&void 0!==n?n:Pp(p.updates.length?p.updates[0].startState:s.view.state)),h=ic(p.updates);try{for(h.s();!(f=h.n()).done;)a=f.value,u=u.update(a,e)}catch(t){h.e(t)}finally{h.f()}if(u.hasResult())return i.push(u),o=r,0}if((c=s.view.state.field(qo).active.find((function(t){return t.source==p.active.source})))&&1==c.state)if(null==p.done){l=new Wo(p.active.source,0),v=ic(p.updates);try{for(v.s();!(d=v.n()).done;)y=d.value,l=l.update(y,e)}catch(t){v.e(t)}finally{v.f()}1!=l.state&&i.push(l)}else s.startQuery(c);o=r},o=0;o<this.running.length;o++)u=r(o);i.length&&this.view.dispatch({effects:Uo.of(i)})}}]),t}(),{eventHandlers:{blur:function t(n){var i,e=this.view.state.field(qo,!1);e&&e.tooltip&&this.view.state.facet(Do).closeOnBlur&&((i=e.open&&Kd(this.view,e.open.tooltip))&&i.dom.contains(n.relatedTarget)||this.view.dispatch({effects:Oo.of(null)}))},compositionstart:function t(){this.composing=1},compositionend:function t(){var n=this;3==this.composing&&setTimeout((function(){return n.view.dispatch({effects:Co.of(!1)})}),20),this.composing=0}}}),No=function(){function t(n,i){var e,r,u,o,s,h=this;yc(this,t),this.view=n,this.stateField=i,this.info=null,this.placeInfoReq={read:function t(){return h.measureInfo()},write:function t(n){return h.placeInfo(n)},key:this},this.space=null,this.currentClass="",r=(e=n.state.field(i)).open,u=r.options,o=r.selected,s=n.state.facet(Do),this.optionContent=qp(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Gp(u.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(n.state),this.dom.addEventListener("mousedown",(function(t){for(var i=t.target,e;i&&i!=h.dom;i=i.parentNode)if("LI"==i.nodeName&&(e=/-(\d+)$/.exec(i.id))&&+e[1]<u.length)return $p(n,u[+e[1]]),void t.preventDefault()})),this.dom.addEventListener("focusout",(function(t){var i=n.state.field(h.stateField,!1);i&&i.tooltip&&n.state.facet(Do).closeOnBlur&&t.relatedTarget!=n.contentDOM&&n.dispatch({effects:Oo.of(null)})})),this.list=this.dom.appendChild(this.createListBox(u,e.id,this.range)),this.list.addEventListener("scroll",(function(){h.info&&h.view.requestMeasure(h.placeInfoReq)}))}return kc(t,[{key:"mount",value:function t(){this.updateSel()}},{key:"update",value:function t(n){var i,e,r,u=n.state.field(this.stateField),o=n.startState.field(this.stateField);this.updateTooltipClass(n.state),u!=o&&(this.updateSel(),(null===(i=u.open)||void 0===i?void 0:i.disabled)!=(null===(e=o.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(r=u.open)||void 0===r?void 0:r.disabled)))}},{key:"updateTooltipClass",value:function t(n){var i,e,r,u,o,s,h=this.tooltipClass(n);if(h!=this.currentClass){i=ic(this.currentClass.split(" "));try{for(i.s();!(e=i.n()).done;)(r=e.value)&&this.dom.classList.remove(r)}catch(t){i.e(t)}finally{i.f()}u=ic(h.split(" "));try{for(u.s();!(o=u.n()).done;)(s=o.value)&&this.dom.classList.add(s)}catch(t){u.e(t)}finally{u.f()}this.currentClass=h}}},{key:"positioned",value:function t(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSel",value:function t(){var n,i,e,r=this,u=this.view.state.field(this.stateField),o=u.open;if((o.selected>-1&&o.selected<this.range.from||o.selected>=this.range.to)&&(this.range=Gp(o.options.length,o.selected,this.view.state.facet(Do).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(o.options,u.id,this.range)),this.list.addEventListener("scroll",(function(){r.info&&r.view.requestMeasure(r.placeInfoReq)}))),this.updateSelectedOption(o.selected)){if(this.info&&(this.info.remove(),this.info=null),!(i=(n=o.options[o.selected].completion).info))return;if(!(e="string"==typeof i?document.createTextNode(i):i(n)))return;"then"in e?e.then((function(t){t&&r.view.state.field(r.stateField,!1)==u&&r.addInfoPane(t)})).catch((function(t){return Yl(r.view.state,t,"completion info")})):this.addInfoPane(e)}}},{key:"addInfoPane",value:function t(n){var i=this.info=document.createElement("div");i.className="cm-tooltip cm-completionInfo",i.appendChild(n),this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function t(n){var i,e,r=null;for(i=this.list.firstChild,e=this.range.from;i;i=i.nextSibling,e++)"LI"==i.nodeName&&i.id?e==n?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),r=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):e--;return r&&Kp(this.list,r),r}},{key:"measureInfo",value:function t(){var n,i,e,r,u,o=this.dom.querySelector("[aria-selected]");return o&&this.info?(n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),e=o.getBoundingClientRect(),(r=this.space)||(r={left:0,top:0,right:(u=this.dom.ownerDocument.defaultView||window).innerWidth,bottom:u.innerHeight}),e.top>Math.min(r.bottom,n.bottom)-10||e.bottom<Math.max(r.top,n.top)+10?null:this.view.state.facet(Do).positionInfo(this.view,n,e,i,r)):null}},{key:"placeInfo",value:function t(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}},{key:"createListBox",value:function t(n,i,e){var r,u,o,s,h,f,a,c,l,v,d,y,p,k,m=document.createElement("ul");for(m.id=i,m.setAttribute("role","listbox"),m.setAttribute("aria-expanded","true"),m.setAttribute("aria-label",this.view.state.phrase("Completions")),r=null,u=e.from;u<e.to;u++){s=(o=n[u]).completion,h=o.match,(f=s.section)&&(a="string"==typeof f?f:f.name)!=r&&(u>e.from||0==e.from)&&(r=a,"string"!=typeof f&&f.header?m.appendChild(f.header(f)):(c=m.appendChild(document.createElement("completion-section"))).textContent=a),(l=m.appendChild(document.createElement("li"))).id=i+"-"+u,l.setAttribute("role","option"),(v=this.optionClass(s))&&(l.className=v),d=ic(this.optionContent);try{for(d.s();!(y=d.n()).done;)(k=(p=y.value)(s,this.view.state,h))&&l.appendChild(k)}catch(t){d.e(t)}finally{d.f()}}return e.from&&m.classList.add("cm-completionListIncompleteTop"),e.to<n.length&&m.classList.add("cm-completionListIncompleteBottom"),m}}]),t}(),Po=function(){function t(n,i,e,r,u,o){yc(this,t),this.options=n,this.attrs=i,this.tooltip=e,this.timestamp=r,this.selected=u,this.disabled=o}return kc(t,[{key:"setSelected",value:function n(i,e){return i==this.selected||i>=this.options.length?this:new t(this.options,Yp(e,i),this.tooltip,this.timestamp,i,this.disabled)}},{key:"map",value:function n(i){return new t(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:i.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function n(i,e,r,u,o){var s,h,f,a=Xp(i,e);if(!a.length)return u&&i.some((function(t){return 1==t.state}))?new t(u.options,u.attrs,u.tooltip,u.timestamp,u.selected,!0):null;if(s=e.facet(Do).selectOnOpen?0:-1,u&&u.selected!=s&&-1!=u.selected)for(h=u.options[u.selected].completion,f=0;f<a.length;f++)if(a[f].completion==h){s=f;break}return new t(a,Yp(r,s),{pos:i.reduce((function(t,n){return n.hasResult()?Math.min(t,n.from):t}),1e8),create:Jp(qo),above:o.aboveCursor},u?u.timestamp:Date.now(),s,!1)}}]),t}(),Fo=function(){function t(n,i,e){yc(this,t),this.active=n,this.id=i,this.open=e}return kc(t,[{key:"update",value:function n(i){var e,r,u,o,s=this,h=i.state,f=h.facet(Do),a=f.override||h.languageDataAt("autocomplete",Pp(h)).map(zp),c=a.map((function(t){var n;return(s.active.find((function(n){return n.source==t}))||new Wo(t,s.active.some((function(t){return 0!=t.state}))?1:0)).update(i,f)}));c.length==this.active.length&&c.every((function(t,n){return t==s.active[n]}))&&(c=this.active),(e=this.open)&&i.docChanged&&(e=e.map(i.changes)),i.selection||c.some((function(t){return t.hasResult()&&i.changes.touchesRange(t.from,t.to)}))||!Zp(c,this.active)?e=Po.build(c,h,this.id,e,f):e&&e.disabled&&!c.some((function(t){return 1==t.state}))&&(e=null),!e&&c.every((function(t){return 1!=t.state}))&&c.some((function(t){return t.hasResult()}))&&(c=c.map((function(t){return t.hasResult()?new Wo(t.source,0):t}))),r=ic(i.effects);try{for(r.s();!(u=r.n()).done;)(o=u.value).is($o)&&(e=e&&e.setSelected(o.value,this.id))}catch(t){r.e(t)}finally{r.f()}return c==this.active&&e==this.open?this:new t(c,this.id,e)}},{key:"tooltip",get:function t(){return this.open?this.open.tooltip:null}},{key:"attrs",get:function t(){return this.open?this.open.attrs:Ho}}],[{key:"start",value:function n(){return new t(zo,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}}]),t}(),Ho={"aria-autocomplete":"list"},zo=[],Wo=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;yc(this,t),this.source=n,this.state=i,this.explicitPos=e}return kc(t,[{key:"hasResult",value:function t(){return!1}},{key:"update",value:function n(i,e){var r,u,o,s,h,f,a=tk(i),c=this;a?c=c.handleUserEvent(i,a,e):i.docChanged?c=c.handleChange(i):i.selection&&0!=c.state&&(c=new t(c.source,0)),r=ic(i.effects);try{for(r.s();!(u=r.n()).done;)if((o=u.value).is(Co))c=new t(c.source,1,o.value?Pp(i.state):-1);else if(o.is(Oo))c=new t(c.source,0);else if(o.is(Uo)){s=ic(o.value);try{for(s.s();!(h=s.n()).done;)(f=h.value).source==c.source&&(c=f)}catch(t){s.e(t)}finally{s.f()}}}catch(t){r.e(t)}finally{r.f()}return c}},{key:"handleUserEvent",value:function n(i,e,r){return"delete"!=e&&r.activateOnTyping?new t(this.source,1):this.map(i.changes)}},{key:"handleChange",value:function n(i){return i.changes.touchesRange(Pp(i.startState))?new t(this.source,0):this.map(i.changes)}},{key:"map",value:function n(i){return i.empty||this.explicitPos<0?this:new t(this.source,this.state,i.mapPos(this.explicitPos))}}]),t}(),Vo=function(t){sc(i,t);var n=fc(i);function i(t,e,r,u,o){var s;return yc(this,i),(s=n.call(this,t,2,e)).result=r,s.from=u,s.to=o,s}return kc(i,[{key:"hasResult",value:function t(){return!0}},{key:"handleUserEvent",value:function t(n,e,r){var u,o,s,h=n.changes.mapPos(this.from),f=n.changes.mapPos(this.to,1),a=Pp(n.state);return(this.explicitPos<0?a<=h:a<this.from)||a>f||"delete"==e&&Pp(n.startState)==this.from?new Wo(this.source,"input"==e&&r.activateOnTyping?1:0):(o=this.explicitPos<0?-1:n.changes.mapPos(this.explicitPos),nk(this.result.validFor,n.state,h,f)?new i(this.source,o,this.result,h,f):this.result.update&&(s=this.result.update(this.result,h,f,new bo(n.state,a,o>=0)))?new i(this.source,o,s,s.from,null!==(u=s.to)&&void 0!==u?u:Pp(n.state)):new Wo(this.source,1,o))}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(this.from,this.to)?new Wo(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty?this:new i(this.source,this.explicitPos<0?-1:n.mapPos(this.explicitPos),this.result,n.mapPos(this.from),n.mapPos(this.to,1))}}]),i}(Wo),Uo=U.define({map:function t(n,i){return n.map((function(t){return t.map(i)}))}}),$o=U.define(),qo=x.define({create:function t(){return Fo.start()},update:function t(n,i){return n.update(i)},provide:function t(n){return[_e.from(n,(function(t){return t.tooltip})),Ui.contentAttributes.from(n,(function(t){return t.attrs}))]}}),Go=Ui.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:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Jo=kc((function t(n,i,e,r){yc(this,t),this.field=n,this.line=i,this.from=e,this.to=r})),Ko=function(){function t(n,i,e){yc(this,t),this.field=n,this.from=i,this.to=e}return kc(t,[{key:"map",value:function n(i){var e=i.mapPos(this.from,-1,v.TrackDel),r=i.mapPos(this.to,1,v.TrackDel);return null==e||null==r?null:new t(this.field,e,r)}}]),t}(),Qo=function(){function t(n,i){yc(this,t),this.lines=n,this.fieldPositions=i}return kc(t,[{key:"instantiate",value:function t(n,i){var e,r,u,o,s,h,f=[],a=[i],c=n.doc.lineAt(i),l=/^\s*/.exec(c.text)[0],v=ic(this.lines);try{for(v.s();!(e=v.n()).done;){if(r=e.value,f.length){for(u=l,o=/^\t*/.exec(r)[0].length,s=0;s<o;s++)u+=n.facet(gu);a.push(i+u.length-o),r=u+r.slice(o)}f.push(r),i+=r.length+1}}catch(t){v.e(t)}finally{v.f()}return h=this.fieldPositions.map((function(t){return new Ko(t.field,a[t.line]+t.from,a[t.line]+t.to)})),{text:f,ranges:h}}}],[{key:"parse",value:function n(i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m=[],g=[],w=[],b=ic(i.split(/\r\n?|\n/));try{for(b.s();!(r=b.n()).done;){for(u=r.value;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(u);){for(o=e[1]?+e[1]:null,s=e[2]||e[3]||"",h=-1,f=0;f<m.length;f++)(null!=o?m[f].seq==o:s&&m[f].name==s)&&(h=f);if(h<0){for(a=0;a<m.length&&(null==o||null!=m[a].seq&&m[a].seq<o);)a++;m.splice(a,0,{seq:o,name:s}),h=a,c=ic(w);try{for(c.s();!(l=c.n()).done;)(v=l.value).field>=h&&v.field++}catch(t){c.e(t)}finally{c.f()}}w.push(new Jo(h,g.length,e.index,e.index+s.length)),u=u.slice(0,e.index)+s+u.slice(e.index+e[0].length)}for(;d=/\\([{}])/.exec(u);){u=u.slice(0,d.index)+d[1]+u.slice(d.index+d[0].length),y=ic(w);try{for(y.s();!(p=y.n()).done;)(k=p.value).line==g.length&&k.from>d.index&&(k.from--,k.to--)}catch(t){y.e(t)}finally{y.f()}}g.push(u)}}catch(t){b.e(t)}finally{b.f()}return new t(g,w)}}]),t}(),Xo=Jt.widget({widget:new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt))}),Zo=Jt.mark({class:"cm-snippetField"}),Yo=function(){function t(n,i){yc(this,t),this.ranges=n,this.active=i,this.deco=Jt.set(n.map((function(t){return(t.from==t.to?Xo:Zo).range(t.from,t.to)})))}return kc(t,[{key:"map",value:function n(i){var e,r,u,o=[],s=ic(this.ranges);try{for(s.s();!(e=s.n()).done;){if(!(u=(r=e.value).map(i)))return null;o.push(u)}}catch(t){s.e(t)}finally{s.f()}return new t(o,this.active)}},{key:"selectionInsideField",value:function t(n){var i=this;return n.ranges.every((function(t){return i.ranges.some((function(n){return n.field==i.active&&n.from<=t.from&&n.to>=t.to}))}))}}]),t}(),ts=U.define({map:function t(n,i){return n&&n.map(i)}}),ns=U.define(),is=x.define({create:function t(){return null},update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;){if((r=e.value).is(ts))return r.value;if(r.is(ns)&&n)return new Yo(n.ranges,r.value)}}catch(t){u.e(t)}finally{u.f()}return n&&i.docChanged&&(n=n.map(i.changes)),n&&i.selection&&!n.selectionInsideField(i.selection)&&(n=null),n},provide:function t(n){return Ui.decorations.from(n,(function(t){return t?t.deco:Jt.none}))}}),es=function t(n){var i=n.state,e=n.dispatch,r=i.field(is,!1);return!!r&&(e(i.update({effects:ts.of(null)})),!0)},os=[{key:"Tab",run:rs=rk(1),shift:us=rk(-1)},{key:"Escape",run:es}],ss=w.define({combine:function t(n){return n.length?n[0]:os}}),hs=E.highest(Qi.compute([ss],(function(t){return t.facet(ss)}))),fs=Ui.domEventHandlers({mousedown:function t(n,i){var e,r,u=i.state.field(is,!1);return!(!u||null==(e=i.posAtCoords({x:n.clientX,y:n.clientY})))&&(r=u.ranges.find((function(t){return t.from<=e&&t.to>=e})),!(!r||r.field==u.active)&&(i.dispatch({selection:ik(u.ranges,r.field),effects:ts.of(u.ranges.some((function(t){return t.field>r.field}))?new Yo(u.ranges,r.field):null)}),!0))}}),as=Object.create(null),cs=function t(n){var i,e,r=n.state.languageDataAt("wordChars",n.pos).join(""),u=hk(r),o=n.matchBefore(fk(u,(function(t){return t+"$"})));return o||n.explicit?{from:i=o?o.from:n.pos,options:e=lk(n.state.doc,ak(r),u,5e4,i),validFor:fk(u,(function(t){return"^"+t}))}:null},ls={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},vs=U.define({map:function t(n,i){var e=i.mapPos(n,-1,v.TrackAfter);return null==e?void 0:e}}),ds=new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i)}(X)),ds.startSide=1,ds.endSide=-1,ys=x.define({create:function t(){return tt.empty},update:function t(n,i){var e,r,u,o,s;i.selection&&(e=i.state.doc.lineAt(i.selection.main.head).from,r=i.startState.doc.lineAt(i.startState.selection.main.head).from,e!=i.changes.mapPos(r,-1)&&(n=tt.empty)),n=n.map(i.changes),u=ic(i.effects);try{for(u.s();!(o=u.n()).done;)(s=o.value).is(vs)&&(n=n.update({add:[ds.range(s.value,s.value+1)]}))}catch(t){u.e(t)}finally{u.f()}return n}}),ps="()[]{}<>",ks="object"==("undefined"==typeof navigator?"undefined":dc(navigator))&&/Android\b/.test(navigator.userAgent),ms=Ui.inputHandler.of((function(t,n,i,e){var r,u;return!(ks?t.composing:t.compositionStarted)&&!t.state.readOnly&&(r=t.state.selection.main,!(e.length>2||2==e.length&&1==Lc(Ic(e,0))||n!=r.from||i!=r.to)&&(!!(u=pk(t.state,e))&&(t.dispatch(u),!0)))})),ws=[{key:"Backspace",run:gs=function t(n){var i,e,r,u,o=n.state,s=n.dispatch;return!o.readOnly&&(i=yk(o,o.selection.main.head),e=i.brackets||ls.brackets,r=null,u=o.changeByRange((function(t){var n,i,u,s;if(t.empty){n=gk(o.doc,t.head),i=ic(e);try{for(i.s();!(u=i.n()).done;)if((s=u.value)==n&&mk(o.doc,t.head)==dk(Ic(s,0)))return{changes:{from:t.head-s.length,to:t.head+s.length},range:m.cursor(t.head-s.length)}}catch(t){i.e(t)}finally{i.f()}}return{range:r=t}})),r||s(o.update(u,{scrollIntoView:!0,userEvent:"delete.backward"})),!r)}}],bs=[{key:"Ctrl-Space",run:Io},{key:"Escape",run:Ro},{key:"ArrowDown",run:Up(!0)},{key:"ArrowUp",run:Up(!1)},{key:"PageDown",run:Up(!0,"page")},{key:"PageUp",run:Up(!1,"page")},{key:"Enter",run:Eo}],Ms=E.highest(Qi.computeN([Do],(function(t){return t.facet(Do).defaultKeymap?[bs]:[]}))),xs=new WeakMap,Ss=n.Autocomplete=Object.freeze({__proto__:null,CompletionContext:bo,acceptCompletion:Eo,autocompletion:Ok,clearSnippet:es,closeBrackets:vk,closeBracketsKeymap:ws,closeCompletion:Ro,completeAnyWord:cs,completeFromList:Bp,completionKeymap:bs,completionStatus:Ak,currentCompletions:Dk,deleteBracketPair:gs,hasNextSnippetField:uk,hasPrevSnippetField:ok,ifIn:_p,ifNotIn:Np,insertBracket:pk,insertCompletionText:Hp,moveCompletionSelection:Up,nextSnippetField:rs,pickedCompletion:xo,prevSnippetField:us,selectedCompletion:Ek,selectedCompletionIndex:Ik,setSelectedCompletion:Rk,snippet:ek,snippetCompletion:sk,snippetKeymap:ss,startCompletion:Io}),Cs=function t(n){var i=n.state,e=i.doc.lineAt(i.selection.main.from),r=jk(n.state,e.from);return r.line?Os(n):!!r.block&&Ls(n)},Os=Lk(Nk,0),As=Lk(Nk,1),Ds=Lk(Nk,2),Es=Lk(_k,0),Is=Lk(_k,1),Rs=Lk(_k,2),Ls=Lk((function(t,n){return _k(t,n,Bk(n))}),0),js=50,Ts=z.define(),Bs=z.define(),_s=w.define(),Ns=w.define({combine:function t(n){return il(n,{minDepth:100,newGroupDelay:500,joinToEvent:function t(n,i){return i}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function t(n,i){return function(t,e){return n(t,e)||i(t,e)}}})}}),Ps=x.define({create:function t(){return Qs.empty},update:function t(n,i){var e,r,u,o,s,h,f,a,c=i.state.facet(Ns),l=i.annotation(Ts);return l?(e=i.docChanged?m.single(Pk(i.changes)):void 0,r=qs.fromTransaction(i,e),o=0==(u=l.side)?n.undone:n.done,o=r?Wk(o,o.length,c.minDepth,r):qk(o,i.startState.selection),new Qs(0==u?l.rest:o,0==u?o:l.rest)):("full"!=(s=i.annotation(Bs))&&"before"!=s||(n=n.isolate()),!1===i.annotation($.addToHistory)?i.changes.empty?n:n.addMapping(i.changes.desc):(h=qs.fromTransaction(i),f=i.annotation($.time),a=i.annotation($.userEvent),h?n=n.addChanges(h,f,a,c,i):i.selection&&(n=n.addSelection(i.startState.selection,f,a,c.newGroupDelay)),"full"!=s&&"after"!=s||(n=n.isolate()),n))},toJSON:function t(n){return{done:n.done.map((function(t){return t.toJSON()})),undone:n.undone.map((function(t){return t.toJSON()}))}},fromJSON:function t(n){return new Qs(n.done.map(qs.fromJSON),n.undone.map(qs.fromJSON))}}),Fs=Ps,Hs=Hk(0,!1),zs=Hk(1,!1),Ws=Hk(0,!0),Vs=Hk(1,!0),Us=zk(0),$s=zk(1),qs=function(){function t(n,i,e,r,u){yc(this,t),this.changes=n,this.effects=i,this.mapped=e,this.startSelection=r,this.selectionsAfter=u}return kc(t,[{key:"setSelAfter",value:function n(i){return new t(this.changes,this.effects,this.mapped,this.startSelection,i)}},{key:"toJSON",value:function t(){var n,i,e;return{changes:null===(n=this.changes)||void 0===n?void 0:n.toJSON(),mapped:null===(i=this.mapped)||void 0===i?void 0:i.toJSON(),startSelection:null===(e=this.startSelection)||void 0===e?void 0:e.toJSON(),selectionsAfter:this.selectionsAfter.map((function(t){return t.toJSON()}))}}}],[{key:"fromJSON",value:function n(i){return new t(i.changes&&y.fromJSON(i.changes),[],i.mapped&&d.fromJSON(i.mapped),i.startSelection&&m.fromJSON(i.startSelection),i.selectionsAfter.map(m.fromJSON))}},{key:"fromTransaction",value:function n(i,e){var r,u,o,s=Gs,h=ic(i.startState.facet(_s));try{for(h.s();!(r=h.n()).done;)(o=(u=r.value)(i)).length&&(s=s.concat(o))}catch(t){h.e(t)}finally{h.f()}return!s.length&&i.changes.empty?null:new t(i.changes.invert(i.startState.doc),s,void 0,e||i.startState.selection,Gs)}},{key:"selection",value:function n(i){return new t(void 0,Gs,void 0,void 0,i)}}]),t}(),Gs=[],Js=200,Ks=/^(input\.type|delete)($|\.)/,Qs=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;yc(this,t),this.done=n,this.undone=i,this.prevTime=e,this.prevUserEvent=r}return kc(t,[{key:"isolate",value:function n(){return this.prevTime?new t(this.done,this.undone):this}},{key:"addChanges",value:function n(i,e,r,u,o){var s=this.done,h=s[s.length-1];return new t(s=h&&h.changes&&!h.changes.empty&&i.changes&&(!r||Ks.test(r))&&(!h.selectionsAfter.length&&e-this.prevTime<u.newGroupDelay&&u.joinToEvent(o,Vk(h.changes,i.changes))||"input.type.compose"==r)?Wk(s,s.length-1,u.minDepth,new qs(i.changes.compose(h.changes),$k(i.effects,h.effects),h.mapped,h.startSelection,Gs)):Wk(s,s.length,u.minDepth,i),Gs,e,r)}},{key:"addSelection",value:function n(i,e,r,u){var o=this.done.length?this.done[this.done.length-1].selectionsAfter:Gs;return o.length>0&&e-this.prevTime<u&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Uk(o[o.length-1],i)?this:new t(qk(this.done,i),this.undone,e,r)}},{key:"addMapping",value:function n(i){return new t(Jk(this.done,i),Jk(this.undone,i),this.prevTime,this.prevUserEvent)}},{key:"pop",value:function t(n,i,e){var r,u,o=0==n?this.done:this.undone;return 0==o.length?null:(r=o[o.length-1],e&&r.selectionsAfter.length?i.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Ts.of({side:n,rest:Gk(o)}),userEvent:0==n?"select.undo":"select.redo",scrollIntoView:!0}):r.changes?(u=1==o.length?Gs:o.slice(0,o.length-1),r.mapped&&(u=Jk(u,r.mapped)),i.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Ts.of({side:n,rest:u}),filter:!1,userEvent:0==n?"undo":"redo",scrollIntoView:!0})):null)}}]),t}(),Qs.empty=new Qs(Gs,Gs),Xs=[{key:"Mod-z",run:Hs,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:zs,preventDefault:!0},{linux:"Ctrl-Shift-z",run:zs,preventDefault:!0},{key:"Mod-u",run:Ws,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Vs,preventDefault:!0}],Zs=function t(n){return tm(n,!nm(n))},Ys=function t(n){return tm(n,nm(n))},th=function t(n){return tm(n,!0)},nh=function t(n){return tm(n,!1)},ih=function t(n){return im(n,!nm(n))},eh=function t(n){return im(n,nm(n))},rh=function t(n){return im(n,!0)},uh=function t(n){return im(n,!1)},oh=function t(n){return rm(n,!0)},sh=function t(n){return rm(n,!1)},hh=function t(n){return Zk(n,(function(t){return om(n.state,t,!nm(n))}))},fh=function t(n){return Zk(n,(function(t){return om(n.state,t,nm(n))}))},ah=function t(n){return sm(n,!1)},ch=function t(n){return sm(n,!0)},lh=function t(n){return fm(n,!1)},vh=function t(n){return fm(n,!0)},dh=function t(n){return Zk(n,(function(t){return am(n,t,!0)}))},yh=function t(n){return Zk(n,(function(t){return am(n,t,!1)}))},ph=function t(n){return Zk(n,(function(t){return am(n,t,!nm(n))}))},kh=function t(n){return Zk(n,(function(t){return am(n,t,nm(n))}))},mh=function t(n){return Zk(n,(function(t){return m.cursor(n.lineBlockAt(t.head).from,1)}))},gh=function t(n){return Zk(n,(function(t){return m.cursor(n.lineBlockAt(t.head).to,-1)}))},wh=function t(n){var i,e;return cm(n.state,n.dispatch,!1)},bh=function t(n){var i,e;return cm(n.state,n.dispatch,!0)},Mh=function t(n){return vm(n,!nm(n))},xh=function t(n){return vm(n,nm(n))},Sh=function t(n){return vm(n,!0)},Ch=function t(n){return vm(n,!1)},Oh=function t(n){return dm(n,!nm(n))},Ah=function t(n){return dm(n,nm(n))},Dh=function t(n){return dm(n,!0)},Eh=function t(n){return dm(n,!1)},Ih=function t(n){return ym(n,!0)},Rh=function t(n){return ym(n,!1)},Lh=function t(n){return lm(n,(function(t){return om(n.state,t,!nm(n))}))},jh=function t(n){return lm(n,(function(t){return om(n.state,t,nm(n))}))},Th=function t(n){return pm(n,!1)},Bh=function t(n){return pm(n,!0)},_h=function t(n){return km(n,!1)},Nh=function t(n){return km(n,!0)},Ph=function t(n){return lm(n,(function(t){return am(n,t,!0)}))},Fh=function t(n){return lm(n,(function(t){return am(n,t,!1)}))},Hh=function t(n){return lm(n,(function(t){return am(n,t,!nm(n))}))},zh=function t(n){return lm(n,(function(t){return am(n,t,nm(n))}))},Wh=function t(n){return lm(n,(function(t){return m.cursor(n.lineBlockAt(t.head).from)}))},Vh=function t(n){return lm(n,(function(t){return m.cursor(n.lineBlockAt(t.head).to)}))},Uh=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:0})),!0},$h=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:i.doc.length})),!0},qh=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:i.selection.main.anchor,head:0})),!0},Gh=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0},Jh=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0},Kh=function t(n){var i=n.state,e=n.dispatch,r=wm(i).map((function(t){var n=t.from,e=t.to;return m.range(n,Math.min(e+1,i.doc.length))}));return e(i.update({selection:m.create(r),userEvent:"select"})),!0},Qh=function t(n){var i=n.state,e=n.dispatch,r=Qk(i.selection,(function(t){for(var n,e=Ly(i).resolveInner(t.head,1);!(e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent);)e=e.parent;return m.range(e.to,e.from)}));return e(Xk(i,r)),!0},Xh=function t(n){var i=n.state,e=n.dispatch,r=i.selection,u=null;return r.ranges.length>1?u=m.create([r.main]):r.main.empty||(u=m.create([m.cursor(r.main.head)])),!!u&&(e(Xk(i,u)),!0)},Zh=function t(n,i){return mm(n,(function(t){var e,r,u,o,s,h=n.state,f=h.doc.lineAt(t);if(!i&&t>f.from&&t<f.from+200&&!/[^ \t]/.test(e=f.text.slice(0,t-f.from))){if("\t"==e[e.length-1])return t-1;for(o=(u=ll(e,h.tabSize))%Py(h)||Py(h),s=0;s<o&&" "==e[e.length-1-s];s++)t--;r=t}else(r=Cc(f.text,t-f.from,i,i)+f.from)==t&&f.number!=(i?h.doc.lines:1)&&(r+=i?1:-1);return r}))},Yh=function t(n){return Zh(n,!1)},tf=function t(n){return Zh(n,!0)},nf=function t(n,i){return mm(n,(function(t){var e,r,u,o,s=t,h=n.state,f=h.doc.lineAt(s),a=h.charCategorizer(s);for(e=null;;){if(s==(i?f.to:f.from)){s==t&&f.number!=(i?h.doc.lines:1)&&(s+=i?1:-1);break}if(r=Cc(f.text,s-f.from,i)+f.from,o=a(u=f.text.slice(Math.min(s,r)-f.from,Math.max(s,r)-f.from)),null!=e&&o!=e)break;" "==u&&s==t||(e=o),s=r}return s}))},ef=function t(n){return nf(n,!1)},rf=function t(n){return nf(n,!0)},uf=function t(n){return mm(n,(function(t){var i=n.lineBlockAt(t).to;return t<i?i:Math.min(n.state.doc.length,t+1)}))},of=function t(n){return mm(n,(function(t){var i=n.lineBlockAt(t).from;return t>i?i:Math.max(0,t-1)}))},sf=function t(n){var i,e,r,u,o,s=n.state,h=n.dispatch;if(s.readOnly)return!1;for(i=[],e=0,r="",u=s.doc.iter();;){if(u.next(),u.lineBreak||u.done){if((o=r.search(/\s+$/))>-1&&i.push({from:e-(r.length-o),to:e}),u.done)break;r=""}else r=u.value;e+=u.value.length}return!!i.length&&(h(s.update({changes:i,userEvent:"delete"})),!0)},hf=function t(n){var e,r=n.state,u=n.dispatch;return!r.readOnly&&(e=r.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:i.of(["",""])},range:m.cursor(t.from)}})),u(r.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)},ff=function t(n){var i,e=n.state,r=n.dispatch;return!e.readOnly&&(!(i=e.changeByRange((function(t){var n,i,r,u;return t.empty&&0!=t.from&&t.from!=e.doc.length?{changes:{from:r=(n=t.from)==(i=e.doc.lineAt(n)).from?n-1:Cc(i.text,n-i.from,!1)+i.from,to:u=n==i.to?n+1:Cc(i.text,n-i.from,!0)+i.from,insert:e.doc.slice(n,u).append(e.doc.slice(r,n))},range:m.cursor(u)}:{range:t}}))).changes.empty&&(r(e.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0))},af=function t(n){var i,e;return bm(n.state,n.dispatch,!1)},cf=function t(n){var i,e;return bm(n.state,n.dispatch,!0)},lf=function t(n){var i,e;return Mm(n.state,n.dispatch,!1)},vf=function t(n){var i,e;return Mm(n.state,n.dispatch,!0)},df=function t(n){var i,e,r;return!n.state.readOnly&&(e=(i=n.state).changes(wm(i).map((function(t){var n=t.from,e=t.to;return n>0?n--:e<i.doc.length&&e++,{from:n,to:e}}))),r=Qk(i.selection,(function(t){return n.moveVertically(t,!0)})).map(e),n.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0)},yf=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update(i.replaceSelection(i.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0},pf=Sm(!1),mf=function t(n){var i,e,r,u=n.state,o=n.dispatch;return!u.readOnly&&(i=Object.create(null),e=new wu(u,{overrideIndentation:function t(n){var e=i[n];return null==e?-1:e}}),r=Cm(u,(function(t,n,r){var o,s,h=Hy(e,t.from);null!=h&&(/\S/.test(t.text)||(h=0),((o=/^\s*/.exec(t.text)[0])!=(s=Fy(u,h))||r.from<t.from+o.length)&&(i[t.from]=h,n.push({from:t.from,to:t.from+o.length,insert:s})))})),r.changes.empty||o(u.update(r,{userEvent:"indent"})),!0)},wf=function t(n){var i=n.state,e=n.dispatch;return!i.readOnly&&(e(i.update(Cm(i,(function(t,n){var e,r,u,o=/^\s*/.exec(t.text)[0];if(o){for(e=ll(o,i.tabSize),r=0,u=Fy(i,Math.max(0,e-Py(i)));r<o.length&&r<u.length&&o.charCodeAt(r)==u.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+o.length,insert:u.slice(r)})}})),{userEvent:"delete.dedent"})),!0)},bf=function t(n){var i=n.state,e=n.dispatch;return i.selection.ranges.some((function(t){return!t.empty}))?gf({state:i,dispatch:e}):(e(i.update(i.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0)},Sf=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hh,shift:Lh},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:fh,shift:jh},{key:"Alt-ArrowUp",run:af},{key:"Shift-Alt-ArrowUp",run:lf},{key:"Alt-ArrowDown",run:cf},{key:"Shift-Alt-ArrowDown",run:vf},{key:"Escape",run:Xh},{key:"Mod-Enter",run:kf=Sm(!0)},{key:"Alt-l",mac:"Ctrl-l",run:Kh},{key:"Mod-i",run:Qh,preventDefault:!0},{key:"Mod-[",run:wf},{key:"Mod-]",run:gf=function t(n){var i=n.state,e=n.dispatch;return!i.readOnly&&(e(i.update(Cm(i,(function(t,n){n.push({from:t.from,insert:i.facet(gu)})})),{userEvent:"input.indent"})),!0)}},{key:"Mod-Alt-\\",run:mf},{key:"Shift-Mod-k",run:df},{key:"Shift-Mod-\\",run:wh},{key:"Mod-/",run:Cs},{key:"Alt-A",run:Es}].concat(xf=[{key:"ArrowLeft",run:Zs,shift:Mh,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ih,shift:Oh,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ph,shift:Hh,preventDefault:!0},{key:"ArrowRight",run:Ys,shift:xh,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:eh,shift:Ah,preventDefault:!0},{mac:"Cmd-ArrowRight",run:kh,shift:zh,preventDefault:!0},{key:"ArrowUp",run:ah,shift:Th,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Uh,shift:qh},{mac:"Ctrl-ArrowUp",run:lh,shift:_h},{key:"ArrowDown",run:ch,shift:Bh,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$h,shift:Gh},{mac:"Ctrl-ArrowDown",run:vh,shift:Nh},{key:"PageUp",run:lh,shift:_h},{key:"PageDown",run:vh,shift:Nh},{key:"Home",run:yh,shift:Fh,preventDefault:!0},{key:"Mod-Home",run:Uh,shift:qh},{key:"End",run:dh,shift:Ph,preventDefault:!0},{key:"Mod-End",run:$h,shift:Gh},{key:"Enter",run:pf},{key:"Mod-a",run:Jh},{key:"Backspace",run:Yh,shift:Yh},{key:"Delete",run:tf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:ef},{key:"Mod-Delete",mac:"Alt-Delete",run:rf},{mac:"Mod-Backspace",run:of},{mac:"Mod-Delete",run:uf}].concat((Mf=[{key:"Ctrl-b",run:Zs,shift:Mh,preventDefault:!0},{key:"Ctrl-f",run:Ys,shift:xh},{key:"Ctrl-p",run:ah,shift:Th},{key:"Ctrl-n",run:ch,shift:Bh},{key:"Ctrl-a",run:mh,shift:Wh},{key:"Ctrl-e",run:gh,shift:Vh},{key:"Ctrl-d",run:tf},{key:"Ctrl-h",run:Yh},{key:"Ctrl-k",run:uf},{key:"Ctrl-Alt-h",run:ef},{key:"Ctrl-o",run:hf},{key:"Ctrl-t",run:ff},{key:"Ctrl-v",run:vh}]).map((function(t){return{mac:t.key,run:t.run,shift:t.shift}})))),Cf={key:"Tab",run:gf,shift:wf},Of=n.Commands=Object.freeze({__proto__:null,blockComment:Is,blockUncomment:Rs,copyLineDown:vf,copyLineUp:lf,cursorCharBackward:nh,cursorCharForward:th,cursorCharLeft:Zs,cursorCharRight:Ys,cursorDocEnd:$h,cursorDocStart:Uh,cursorGroupBackward:uh,cursorGroupForward:rh,cursorGroupLeft:ih,cursorGroupRight:eh,cursorLineBoundaryBackward:yh,cursorLineBoundaryForward:dh,cursorLineBoundaryLeft:ph,cursorLineBoundaryRight:kh,cursorLineDown:ch,cursorLineEnd:gh,cursorLineStart:mh,cursorLineUp:ah,cursorMatchingBracket:wh,cursorPageDown:vh,cursorPageUp:lh,cursorSubwordBackward:sh,cursorSubwordForward:oh,cursorSyntaxLeft:hh,cursorSyntaxRight:fh,defaultKeymap:Sf,deleteCharBackward:Yh,deleteCharForward:tf,deleteGroupBackward:ef,deleteGroupForward:rf,deleteLine:df,deleteToLineEnd:uf,deleteToLineStart:of,deleteTrailingWhitespace:sf,emacsStyleKeymap:Mf,history:Fk,historyField:Fs,historyKeymap:Xs,indentLess:wf,indentMore:gf,indentSelection:mf,indentWithTab:Cf,insertBlankLine:kf,insertNewline:yf,insertNewlineAndIndent:pf,insertTab:bf,invertedEffects:_s,isolateHistory:Bs,lineComment:As,lineUncomment:Ds,moveLineDown:cf,moveLineUp:af,redo:zs,redoDepth:$s,redoSelection:Vs,selectAll:Jh,selectCharBackward:Ch,selectCharForward:Sh,selectCharLeft:Mh,selectCharRight:xh,selectDocEnd:Gh,selectDocStart:qh,selectGroupBackward:Eh,selectGroupForward:Dh,selectGroupLeft:Oh,selectGroupRight:Ah,selectLine:Kh,selectLineBoundaryBackward:Fh,selectLineBoundaryForward:Ph,selectLineBoundaryLeft:Hh,selectLineBoundaryRight:zh,selectLineDown:Bh,selectLineEnd:Vh,selectLineStart:Wh,selectLineUp:Th,selectMatchingBracket:bh,selectPageDown:Nh,selectPageUp:_h,selectParentSyntax:Qh,selectSubwordBackward:Rh,selectSubwordForward:Ih,selectSyntaxLeft:Lh,selectSyntaxRight:jh,simplifySelection:Xh,splitLine:hf,standardKeymap:xf,toggleBlockComment:Es,toggleBlockCommentByLine:Ls,toggleComment:Cs,toggleLineComment:Os,transposeChars:ff,undo:Hs,undoDepth:Us,undoSelection:Ws}),Af=kc((function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.diagnostic=e})),Df=function(){function t(n,i,e){yc(this,t),this.diagnostics=n,this.panel=i,this.selected=e}return kc(t,null,[{key:"init",value:function n(i,e,r){var u,o=i,s=r.facet(Ff).markerFilter;return s&&(o=s(o)),new t(u=Jt.set(o.map((function(t){return t.from==t.to||t.from==t.to-1&&r.doc.lineAt(t.from).to==t.from?Jt.widget({widget:new Hf(t),diagnostic:t}).range(t.from):Jt.mark({attributes:{class:"cm-lintRange cm-lintRange-"+t.severity},diagnostic:t}).range(t.from,t.to)})),!0),e,Dm(u))}}]),t}(),Ef=U.define(),If=U.define(),Rf=U.define(),Lf=x.define({create:function t(){return new Df(Jt.none,null,null)},update:function t(n,i){var e,r,u,o,s,h;i.docChanged&&(e=n.diagnostics.map(i.changes),r=null,n.selected&&(u=i.changes.mapPos(n.selected.from,1),r=Dm(e,n.selected.diagnostic,u)||Dm(e,null,u)),n=new Df(e,n.panel,r)),o=ic(i.effects);try{for(o.s();!(s=o.n()).done;)(h=s.value).is(Ef)?n=Df.init(h.value,n.panel,i.state):h.is(If)?n=new Df(n.diagnostics,h.value?Wf.open:null,n.selected):h.is(Rf)&&(n=new Df(n.diagnostics,n.panel,h.value))}catch(t){o.e(t)}finally{o.f()}return n},provide:function t(n){return[qe.from(n,(function(t){return t.panel})),Ui.decorations.from(n,(function(t){return t.diagnostics}))]}}),jf=Jt.mark({class:"cm-lintRange cm-lintRange-active"}),Bf=function t(n){var i=n.state.field(Lf,!1);return!(!i||!i.panel)&&(n.dispatch({effects:If.of(!1)}),!0)},Nf=[{key:"Mod-Shift-m",run:Tf=function t(n){var i,e=n.state.field(Lf,!1);return e&&e.panel||n.dispatch({effects:Im(n.state,[If.of(!0)])}),(i=Yd(n,Wf.open))&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:_f=function t(n){var i,e,r=n.state.field(Lf,!1);return!!r&&(i=n.state.selection.main,!(!(e=r.diagnostics.iter(i.to+1)).value&&(!(e=r.diagnostics.iter(0)).value||e.from==i.from&&e.to==i.to))&&(n.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0}),!0))}}],Pf=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.timeout=-1,this.set=!0;var i,e=n.state.facet(Ff).delay;this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}return kc(t,[{key:"run",value:function t(){var n,i,e,r=this,u=Date.now();u<this.lintTime-10?setTimeout(this.run,this.lintTime-u):(this.set=!1,e=(i=(n=this.view.state).facet(Ff)).sources,Promise.all(e.map((function(t){return Promise.resolve(t(r.view))}))).then((function(t){var i=t.reduce((function(t,n){return t.concat(n)}));r.view.state.doc==n.doc&&r.view.dispatch(Rm(r.view.state,i))}),(function(t){Yl(r.view.state,t)})))}},{key:"update",value:function t(n){var i=n.state.facet(Ff);(n.docChanged||i!=n.startState.facet(Ff)||i.needsRefresh&&i.needsRefresh(n))&&(this.lintTime=Date.now()+i.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,i.delay)))}},{key:"force",value:function t(){this.set&&(this.lintTime=Date.now(),this.run())}},{key:"destroy",value:function t(){clearTimeout(this.timeout)}}]),t}()),Ff=w.define({combine:function t(n){return Object.assign({sources:n.map((function(t){return t.source}))},il(n.map((function(t){return t.config})),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:function t(n,i){return n?i?function(t){return n(t)||i(t)}:n:i}}))}}),Hf=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).diagnostic=t,e}return kc(i,[{key:"eq",value:function t(n){return n.diagnostic==this.diagnostic}},{key:"toDOM",value:function t(){return Om("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}]),i}(qt),zf=kc((function t(n,i){yc(this,t),this.diagnostic=i,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Pm(n,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")})),Wf=function(){function t(n){var i,e,r=this;yc(this,t),this.view=n,this.items=[],i=function t(i){var e,u,o,s;if(27==i.keyCode)Bf(r.view),r.view.focus();else if(38==i.keyCode||33==i.keyCode)r.moveSelection((r.selectedIndex-1+r.items.length)%r.items.length);else if(40==i.keyCode||34==i.keyCode)r.moveSelection((r.selectedIndex+1)%r.items.length);else if(36==i.keyCode)r.moveSelection(0);else if(35==i.keyCode)r.moveSelection(r.items.length-1);else if(13==i.keyCode)r.view.focus();else{if(!(i.keyCode>=65&&i.keyCode<=90&&r.selectedIndex>=0))return;for(u=Nm((e=r.items[r.selectedIndex].diagnostic).actions),o=0;o<u.length;o++)u[o].toUpperCase().charCodeAt(0)==i.keyCode&&(s=Dm(r.view.state.field(Lf).diagnostics,e))&&e.actions[o].apply(n,s.from,s.to)}i.preventDefault()},e=function t(n){for(var i=0;i<r.items.length;i++)r.items[i].dom.contains(n.target)&&r.moveSelection(i)},this.list=Om("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:e}),this.dom=Om("div",{class:"cm-panel-lint"},this.list,Om("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function t(){return Bf(r.view)}},"\xd7")),this.update()}return kc(t,[{key:"selectedIndex",get:function t(){var n,i=this.view.state.field(Lf).selected;if(!i)return-1;for(n=0;n<this.items.length;n++)if(this.items[n].diagnostic==i.diagnostic)return n;return-1}},{key:"update",value:function t(){var n=this,i=this.view.state.field(Lf),e=i.diagnostics,r=i.selected,u=0,o=!1,s=null;for(e.between(0,this.view.state.doc.length,(function(t,i,e){var h,f,a=e.spec,c=-1;for(f=u;f<n.items.length;f++)if(n.items[f].diagnostic==a.diagnostic){c=f;break}c<0?(h=new zf(n.view,a.diagnostic),n.items.splice(u,0,h),o=!0):(h=n.items[c],c>u&&(n.items.splice(u,c-u),o=!0)),r&&h.diagnostic==r.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),u++}));u<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();0==this.items.length&&(this.items.push(new zf(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:function t(){return{sel:s.dom.getBoundingClientRect(),panel:n.list.getBoundingClientRect()}},write:function t(i){var e=i.sel,r=i.panel;e.top<r.top?n.list.scrollTop-=r.top-e.top:e.bottom>r.bottom&&(n.list.scrollTop+=e.bottom-r.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}},{key:"sync",value:function t(){var n,i,e,r=this.list.firstChild;function u(){var t=r;r=t.nextSibling,t.remove()}n=ic(this.items);try{for(n.s();!(i=n.n()).done;)if((e=i.value).dom.parentNode==this.list){for(;r!=e.dom;)u();r=e.dom.nextSibling}else this.list.insertBefore(e.dom,r)}catch(t){n.e(t)}finally{n.f()}for(;r;)u()}},{key:"moveSelection",value:function t(n){var i,e;this.selectedIndex<0||(e=Dm((i=this.view.state.field(Lf)).diagnostics,this.items[n].diagnostic))&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:Rf.of(e)})}}],[{key:"open",value:function n(i){return new t(i)}}]),t}(),Vf=Ui.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-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:Hm("#d11")},".cm-lintRange-warning":{backgroundImage:Hm("orange")},".cm-lintRange-info":{backgroundImage:Hm("#999")},".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-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}}}),Uf=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).diagnostics=t,e.severity=t.reduce((function(t,n){var i=n.severity;return"error"==i||"warning"==i&&"info"==t?i:t}),"info"),e}return kc(i,[{key:"toDOM",value:function t(n){var i,e,r=document.createElement("div");return r.className="cm-lint-marker cm-lint-marker-"+this.severity,i=this.diagnostics,(e=n.state.facet(Xf).tooltipFilter)&&(i=e(i)),i.length&&(r.onmouseover=function(){return Wm(n,r,i)}),r}}]),i}(Ge),$f=ny({class:"cm-gutter-lint",markers:function t(n){return n.state.field(qf)}}),qf=x.define({create:function t(){return tt.empty},update:function t(n,i){var e,r,u,o,s;n=n.map(i.changes),e=i.state.facet(Xf).markerFilter,r=ic(i.effects);try{for(r.s();!(u=r.n()).done;)(o=u.value).is(Ef)&&(s=o.value,e&&(s=e(s||[])),n=Vm(i.state.doc,s.slice(0)))}catch(t){r.e(t)}finally{r.f()}return n}}),Gf=U.define(),Jf=x.define({create:function t(){return null},update:function t(n,i){return n&&i.docChanged&&(n=Em(i,n)?null:Object.assign(Object.assign({},n),{pos:i.changes.mapPos(n.pos)})),i.effects.reduce((function(t,n){return n.is(Gf)?n.value:t}),n)},provide:function t(n){return _e.from(n)}}),Kf=Ui.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Fm('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Fm('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Fm('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Qf=[Lf,Ui.decorations.compute([Lf],(function(t){var n=t.field(Lf),i=n.selected,e=n.panel;return i&&e&&i.from!=i.to?Jt.set([jf.range(i.from,i.to)]):Jt.none})),Jd(jm,{hideOn:Em}),Vf],Xf=w.define({combine:function t(n){return il(n,{hoverTime:300,markerFilter:null,tooltipFilter:null})}}),Zf=n.Lint=Object.freeze({__proto__:null,closeLintPanel:Bf,diagnosticCount:Lm,forEachDiagnostic:$m,forceLinting:_m,lintGutter:Um,lintKeymap:Nf,linter:Bm,nextDiagnostic:_f,openLintPanel:Tf,setDiagnostics:Rm,setDiagnosticsEffect:Ef}),Yf="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD")}:function(t){return t},ta=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.length,u=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;yc(this,t),this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=n.iterRange(e,r),this.bufferStart=e,this.normalize=u?function(t){return u(Yf(t))}:Yf,this.query=this.normalize(i)}return kc(t,[{key:"peek",value:function t(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ic(this.buffer,this.bufferPos)}},{key:"next",value:function t(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function t(){for(var n,i,e,r,u,o,s,h;;){if((n=this.peek())<0)return this.done=!0,this;for(i=Rc(n),e=this.bufferStart+this.bufferPos,this.bufferPos+=Lc(n),r=this.normalize(i),u=0,o=e;;u++){if(s=r.charCodeAt(u),h=this.match(s,o))return this.value=h,this;if(u==r.length-1)break;o==e&&u<i.length&&i.charCodeAt(u)==s&&o++}}}},{key:"match",value:function t(n,i){var e,r,u,t=null;for(e=0;e<this.matches.length;e+=2)r=this.matches[e],u=!1,this.query.charCodeAt(r)==n&&(r==this.query.length-1?t={from:this.matches[e+1],to:i+1}:(this.matches[e]++,u=!0)),u||(this.matches.splice(e,2),e-=2);return this.query.charCodeAt(0)==n&&(1==this.query.length?t={from:i,to:i+1}:this.matches.push(1,i)),t&&this.test&&!this.test(t.from,t.to,this.buffer,this.bufferPos)&&(t=null),t}}]),t}(),"undefined"!=typeof Symbol&&(ta.prototype[Symbol.iterator]=function(){return this}),na={from:-1,to:-1,match:/.*/.exec("")},ia="gm"+(null==/x/.unicode?"":"u"),ea=function(){function t(n,i,e){var r,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.length;if(yc(this,t),this.text=n,this.to=o,this.curLine="",this.done=!1,this.value=na,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new oa(n,i,e,u,o);this.re=new RegExp(i,ia+((null==e?void 0:e.ignoreCase)?"i":"")),this.test=null==e?void 0:e.test,this.iter=n.iter(),r=n.lineAt(u),this.curLineStart=r.from,this.matchPos=Gm(n,u),this.getLine(this.curLineStart)}return kc(t,[{key:"getLine",value:function t(n){this.iter.next(n),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}},{key:"nextLine",value:function t(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function t(){var n,i,e,r;for(n=this.matchPos-this.curLineStart;;)if(this.re.lastIndex=n,i=this.matchPos<=this.to&&this.re.exec(this.curLine)){if(r=(e=this.curLineStart+i.index)+i[0].length,this.matchPos=Gm(this.text,r+(e==r?1:0)),e==this.curLineStart+this.curLine.length&&this.nextLine(),(e<r||e>this.value.to)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this;n=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),n=0}}}]),t}(),ra=new WeakMap,ua=function(){function t(n,i){yc(this,t),this.from=n,this.text=i}return kc(t,[{key:"to",get:function t(){return this.from+this.text.length}}],[{key:"get",value:function n(i,e,r){var u,o,s,h=ra.get(i);return!h||h.from>=r||h.to<=e?(u=new t(e,i.sliceString(e,r)),ra.set(i,u),u):h.from==e&&h.to==r?h:(o=h.text,(s=h.from)>e&&(o=i.sliceString(e,s)+o,s=e),h.to<r&&(o+=i.sliceString(h.to,r)),ra.set(i,new t(s,o)),new t(e,o.slice(e-s,r-s)))}}]),t}(),oa=function(){function t(n,i,e,r,u){yc(this,t),this.text=n,this.to=u,this.done=!1,this.value=na,this.matchPos=Gm(n,r),this.re=new RegExp(i,ia+((null==e?void 0:e.ignoreCase)?"i":"")),this.test=null==e?void 0:e.test,this.flat=ua.get(n,r,this.chunkEnd(r+5e3))}return kc(t,[{key:"chunkEnd",value:function t(n){return n>=this.to?this.to:this.text.lineAt(n).to}},{key:"next",value:function t(){for(var n,i,e,r;;){if(n=this.re.lastIndex=this.matchPos-this.flat.from,(i=this.re.exec(this.flat.text))&&!i[0]&&i.index==n&&(this.re.lastIndex=n+1,i=this.re.exec(this.flat.text)),i&&(r=(e=this.flat.from+i.index)+i[0].length,(this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,i))))return this.value={from:e,to:r,match:i},this.matchPos=Gm(this.text,r+(e==r?1:0)),this;if(this.flat.to==this.to)return this.done=!0,this;this.flat=ua.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),t}(),"undefined"!=typeof Symbol&&(ea.prototype[Symbol.iterator]=oa.prototype[Symbol.iterator]=function(){return this}),sa=U.define(),ha=x.define({create:function t(){return!0},update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;)(r=e.value).is(sa)&&(n=r.value)}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return qe.from(n,(function(t){return t?Jm:null}))}}),fa=function t(n){var i,e=Yd(n,Jm);return e||(i=[sa.of(!0)],null==n.state.field(ha,!1)&&i.push(U.appendConfig.of([ha,aa])),n.dispatch({effects:i}),e=Yd(n,Jm)),e&&e.dom.querySelector("input").focus(),!0},aa=Ui.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),ca={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},la=w.define({combine:function t(n){return il(n,ca,{highlightWordAroundCursor:function t(n,i){return n||i},minSelectionLength:Math.min,maxMatches:Math.min})}}),va=Jt.mark({class:"cm-selectionMatch"}),da=Jt.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),ya=kn.fromClass(function(){function t(n){yc(this,t),this.decorations=this.getDeco(n)}return kc(t,[{key:"update",value:function t(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y=n.state.facet(la),p=n.state,k=p.selection;if(k.ranges.length>1)return Jt.none;if(r=null,(i=k.main).empty){if(!y.highlightWordAroundCursor)return Jt.none;if(!(u=p.wordAt(i.head)))return Jt.none;r=p.charCategorizer(i.head),e=p.sliceDoc(u.from,u.to)}else{if((o=i.to-i.from)<y.minSelectionLength||o>200)return Jt.none;if(y.wholeWords){if(e=p.sliceDoc(i.from,i.to),!Qm(r=p.charCategorizer(i.head),p,i.from,i.to)||!Xm(r,p,i.from,i.to))return Jt.none}else if(!(e=p.sliceDoc(i.from,i.to).trim()))return Jt.none}s=[],h=ic(n.visibleRanges);try{for(h.s();!(f=h.n()).done;)for(a=f.value,c=new ta(p.doc,e,a.from,a.to);!c.next().done;)if(v=(l=c.value).from,d=l.to,(!r||Qm(r,p,v,d))&&(i.empty&&v<=i.from&&d>=i.to?s.push(da.range(v,d)):(v>=i.to||d<=i.from)&&s.push(va.range(v,d)),s.length>y.maxMatches))return Jt.none}catch(t){h.e(t)}finally{h.f()}return Jt.set(s)}}]),t}(),{decorations:function t(n){return n.decorations}}),pa=Ui.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ka=function t(n){var i=n.state,e=n.dispatch,r=i.selection,u=m.create(r.ranges.map((function(t){return i.wordAt(t.head)||m.cursor(t.head)})),r.mainIndex);return!u.eq(r)&&(e(i.update({selection:u})),!0)},ma=function t(n){var i,e,r=n.state,u=n.dispatch,o=r.selection.ranges;return o.some((function(t){return t.from===t.to}))?ka({state:r,dispatch:u}):(i=r.sliceDoc(o[0].from,o[0].to),!r.selection.ranges.some((function(t){return r.sliceDoc(t.from,t.to)!=i}))&&(!!(e=Zm(r,i))&&(u(r.update({selection:r.selection.addRange(m.range(e.from,e.to),!1),effects:Ui.scrollIntoView(e.to)})),!0)))},ga=w.define({combine:function t(n){return il(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:function t(n){return new Ha(n)},scrollToMatch:function t(n){return Ui.scrollIntoView(n)}})}}),wa=function(){function t(n){yc(this,t),this.search=n.search,this.caseSensitive=!!n.caseSensitive,this.literal=!!n.literal,this.regexp=!!n.regexp,this.replace=n.replace||"",this.valid=!!this.search&&(!this.regexp||qm(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!n.wholeWord}return kc(t,[{key:"unquote",value:function t(n){return this.literal?n:n.replace(/\\([nrt\\])/g,(function(t,n){return"n"==n?"\n":"r"==n?"\r":"t"==n?"\t":"\\"}))}},{key:"eq",value:function t(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord}},{key:"create",value:function t(){return this.regexp?new xa(this):new Ma(this)}},{key:"getCursor",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2?arguments[2]:void 0,r=n.doc?n:Q.create({doc:n});return null==e&&(e=r.doc.length),this.regexp?ig(this,r,i,e):tg(this,r,i,e)}}]),t}(),Ma=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,t)}return kc(i,[{key:"nextMatch",value:function t(n,i,e){var r=tg(this.spec,n,e,n.doc.length).nextOverlapping();return r.done&&(r=tg(this.spec,n,0,i).nextOverlapping()),r.done?null:r.value}},{key:"prevMatchInRange",value:function t(n,i,e){var r,u,o,s;for(r=e;;){for(u=Math.max(i,r-1e4-this.spec.unquoted.length),o=tg(this.spec,n,u,r),s=null;!o.nextOverlapping().done;)s=o.value;if(s)return s;if(u==i)return null;r-=1e4}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace)}},{key:"matchAll",value:function t(n,i){for(var e=tg(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(r.length>=i)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var u=tg(this.spec,n,Math.max(0,i-this.spec.unquoted.length),Math.min(e+this.spec.unquoted.length,n.doc.length));!u.next().done;)r(u.value.from,u.value.to)}}]),i}(ba=kc((function t(n){yc(this,t),this.spec=n}))),xa=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"nextMatch",value:function t(n,i,e){var r=ig(this.spec,n,e,n.doc.length).next();return r.done&&(r=ig(this.spec,n,0,i).next()),r.done?null:r.value}},{key:"prevMatchInRange",value:function t(n,i,e){var r,u,o,s;for(r=1;;r++){for(u=Math.max(i,e-1e4*r),o=ig(this.spec,n,u,e),s=null;!o.next().done;)s=o.value;if(s&&(u==i||s.from>u+10))return s;if(u==i)return null}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(function(t,i){return"$"==i?"$":"&"==i?n.match[0]:"0"!=i&&+i<n.match.length?n.match[i]:t})))}},{key:"matchAll",value:function t(n,i){for(var e=ig(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(r.length>=i)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var u=ig(this.spec,n,Math.max(0,i-250),Math.min(e+250,n.doc.length));!u.next().done;)r(u.value.from,u.value.to)}}]),i}(ba),Sa=U.define(),Ca=U.define(),Oa=x.define({create:function t(n){return new Aa(ag(n).create(),null)},update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;)(r=e.value).is(Sa)?n=new Aa(r.value.create(),n.panel):r.is(Ca)&&(n=new Aa(n.query,r.value?fg:null))}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return qe.from(n,(function(t){return t.panel}))}}),Aa=kc((function t(n,i){yc(this,t),this.query=n,this.panel=i})),Da=Jt.mark({class:"cm-searchMatch"}),Ea=Jt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ia=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.decorations=this.highlight(n.state.field(Oa))}return kc(t,[{key:"update",value:function t(n){var i=n.state.field(Oa);(i!=n.startState.field(Oa)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(i))}},{key:"highlight",value:function t(n){var i,e,r,u,o,s,h,f,a=n.query,c=n.panel;if(!c||!a.spec.valid)return Jt.none;for(i=this.view,e=new nt,r=0,o=(u=i.visibleRanges).length;r<o;r++){for(h=(s=u[r]).from,f=s.to;r<o-1&&f>u[r+1].from-500;)f=u[++r].to;a.highlight(i.state,h,f,(function(t,n){var r=i.state.selection.ranges.some((function(i){return i.from==t&&i.to==n}));e.add(t,n,r?Ea:Da)}))}return e.finish()}}]),t}(),{decorations:function t(n){return n.decorations}}),Ra=hg((function(t,n){var i,e,r=n.query,u=t.state.selection.main.to,o=r.nextMatch(t.state,u,u);return!!o&&(i=m.single(o.from,o.to),e=t.state.facet(ga),t.dispatch({selection:i,effects:[dg(t,o),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),lg(t),!0)})),La=hg((function(t,n){var i,e,r=n.query,u=t.state,o=u.selection.main.from,s=r.prevMatch(u,o,o);return!!s&&(i=m.single(s.from,s.to),e=t.state.facet(ga),t.dispatch({selection:i,effects:[dg(t,s),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),lg(t),!0)})),ja=hg((function(t,n){var i=n.query,e=i.matchAll(t.state,1e3);return!(!e||!e.length)&&(t.dispatch({selection:m.create(e.map((function(t){return m.range(t.from,t.to)}))),userEvent:"select.search.matches"}),!0)})),Ta=function t(n){var i,e,r,u,o,s,h=n.state,f=n.dispatch,a=h.selection;if(a.ranges.length>1||a.main.empty)return!1;for(e=(i=a.main).from,r=i.to,u=[],o=0,s=new ta(h.doc,h.sliceDoc(e,r));!s.next().done;){if(u.length>1e3)return!1;s.value.from==e&&(o=u.length),u.push(m.range(s.value.from,s.value.to))}return f(h.update({selection:m.create(u,o),userEvent:"select.search.matches"})),!0},Ba=hg((function(t,n){var i,e,r,u,o,s,h=n.query,f=t.state,a=f.selection.main,c=a.from,l=a.to;return!f.readOnly&&(!!(i=h.nextMatch(f,c,c))&&(e=[],o=[],i.from==c&&i.to==l&&(u=f.toText(h.getReplacement(i)),e.push({from:i.from,to:i.to,insert:u}),i=h.nextMatch(f,i.from,i.to),o.push(Ui.announce.of(f.phrase("replaced match on line $",f.doc.lineAt(c).number)+"."))),i&&(s=0==e.length||e[0].from>=i.to?0:i.to-i.from-u.length,r=m.single(i.from-s,i.to-s),o.push(dg(t,i)),o.push(f.facet(ga).scrollToMatch(r.main,t))),t.dispatch({changes:e,selection:r,effects:o,userEvent:"input.replace"}),!0))})),_a=hg((function(t,n){var i,e,r=n.query;return!t.state.readOnly&&(!!(i=r.matchAll(t.state,1e9).map((function(t){var n,i;return{from:t.from,to:t.to,insert:r.getReplacement(t)}}))).length&&(e=t.state.phrase("replaced $ matches",i.length)+".",t.dispatch({changes:i,effects:Ui.announce.of(e),userEvent:"input.replace.all"}),!0))})),Fa=[{key:"Mod-f",run:Na=function t(n){var i,e,r=n.state.field(Oa,!1);return r&&r.panel?(i=cg(n))&&i!=n.root.activeElement&&((e=ag(n.state,r.query.spec)).valid&&n.dispatch({effects:Sa.of(e)}),i.focus(),i.select()):n.dispatch({effects:[Ca.of(!0),r?Sa.of(ag(n.state,r.query.spec)):U.appendConfig.of(Ua)]}),!0},scope:"editor search-panel"},{key:"F3",run:Ra,shift:La,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ra,shift:La,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Pa=function t(n){var i,e=n.state.field(Oa,!1);return!(!e||!e.panel)&&((i=Yd(n,fg))&&i.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Ca.of(!1)}),!0)},scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ta},{key:"Alt-g",run:fa},{key:"Mod-d",run:ma,preventDefault:!0}],Ha=function(){function t(n){var i,e=this;function r(t,n,i){return Om("button",{class:"cm-button",name:t,onclick:n,type:"button"},i)}yc(this,t),this.view=n,i=this.query=n.state.field(Oa).query.spec,this.commit=this.commit.bind(this),this.searchField=Om("input",{value:i.search,placeholder:vg(n,"Find"),"aria-label":vg(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Om("input",{value:i.replace,placeholder:vg(n,"Replace"),"aria-label":vg(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Om("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=Om("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=Om("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit}),this.dom=Om("div",{onkeydown:function t(n){return e.keydown(n)},class:"cm-search"},[this.searchField,r("next",(function(){return Ra(n)}),[vg(n,"next")]),r("prev",(function(){return La(n)}),[vg(n,"previous")]),r("select",(function(){return ja(n)}),[vg(n,"all")]),Om("label",null,[this.caseField,vg(n,"match case")]),Om("label",null,[this.reField,vg(n,"regexp")]),Om("label",null,[this.wordField,vg(n,"by word")])].concat(Ja(n.state.readOnly?[]:[Om("br"),this.replaceField,r("replace",(function(){return Ba(n)}),[vg(n,"replace")]),r("replaceAll",(function(){return _a(n)}),[vg(n,"replace all")])]),[Om("button",{name:"close",onclick:function t(){return Pa(n)},"aria-label":vg(n,"close"),type:"button"},["\xd7"])]))}return kc(t,[{key:"commit",value:function t(){var n=new wa({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:Sa.of(n)}))}},{key:"keydown",value:function t(n){pd(this.view,n,"search-panel")?n.preventDefault():13==n.keyCode&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?La:Ra)(this.view)):13==n.keyCode&&n.target==this.replaceField&&(n.preventDefault(),Ba(this.view))}},{key:"update",value:function t(n){var i,e,r,u,o,s=ic(n.transactions);try{for(s.s();!(i=s.n()).done;){r=ic((e=i.value).effects);try{for(r.s();!(u=r.n()).done;)(o=u.value).is(Sa)&&!o.value.eq(this.query)&&this.setQuery(o.value)}catch(t){r.e(t)}finally{r.f()}}}catch(t){s.e(t)}finally{s.f()}}},{key:"setQuery",value:function t(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}},{key:"mount",value:function t(){this.searchField.select()}},{key:"pos",get:function t(){return 80}},{key:"top",get:function t(){return this.view.state.facet(ga).top}}]),t}(),za=30,Wa=/[\s\.,:;?!]/,Va=Ui.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Ua=[Oa,E.lowest(Ia),Va],$a=n.Search=Object.freeze({__proto__:null,RegExpCursor:ea,SearchCursor:ta,SearchQuery:wa,closeSearchPanel:Pa,findNext:Ra,findPrevious:La,getSearchQuery:og,gotoLine:fa,highlightSelectionMatches:Km,openSearchPanel:Na,replaceAll:_a,replaceNext:Ba,search:Ym,searchKeymap:Fa,searchPanelOpen:sg,selectMatches:ja,selectNextOccurrence:ma,selectSelectionMatches:Ta,setSearchQuery:Sa}),qa=n.basicSetup=function(){return[sy(),fy(),Ld(),Fk(),lp(),Cd(),Dd(),Q.allowMultipleSelections.of(!0),Zy(),dp(Gu,{fallback:!0}),kp(),vk(),Ok(),Wd(),Vd(),_d(),Km(),Qi.of([].concat(ws,Ja(Sf),Fa,Xs,Bu,bs,Nf))]}()},888:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v;function d(t){var n,i,e,o,h,f=t.selection.main;return f&&f.from===f.to?(n=f.from,(i=(0,r.getSignatureStatus)((0,u.getTokensByState)(t),n))&&(e=(0,u.getFunctionResourceByState)(t,i.functionName))?(o=e,h=(0,r.getActiveParameterInSignatureTip)(i.activeParameter,o),[{pos:n,above:!0,arrow:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,s.createHelpFunctionTitleDom)(o,h)),o.description&&t.appendChild((0,s.createHelpFunctionDescriptionDom)(o.description)),{dom:t,overlap:!0}}}]):[]):[]}Object.defineProperty(n,"__esModule",{value:!0}),n.signatureTooltipsExtensions=n.closeParameterHintsCommand=n.triggerParameterHintsCommand=n.hasParameterHints=n.notTriggerSignatureTooltip=n.closeSignatureTooltip=n.triggerSignatureTooltip=void 0,e=i(833),r=i(129),u=i(338),o=i(367),s=i(348),h=e.State.StateField,n.triggerSignatureTooltip=e.State.StateEffect.define(),n.closeSignatureTooltip=e.State.StateEffect.define(),n.notTriggerSignatureTooltip=e.State.Annotation.define(),f=h.define({create:function(){return[]},update:function(t,i){var e,r,u,s,h=i.state.field(o.isFormulaField);if(!h)return[];if(e=t&&t.length>0,i.annotation(n.notTriggerSignatureTooltip)&&!e)return[];for(r=0,u=i.effects;r<u.length;r++){if((s=u[r]).is(n.closeSignatureTooltip))return[];if(s.is(n.triggerSignatureTooltip))return d(i.state)}return i.docChanged?d(i.state):e?i.selection?d(i.state):t:[]},provide:function(t){return e.View.showTooltip.computeN([t],(function(n){return n.field(t)}))}}),a=function(t){return t.state.field(f).length>0},n.hasParameterHints=a,c=function(t){return t.dispatch({effects:n.triggerSignatureTooltip.of(null)}),!0},n.triggerParameterHintsCommand=c,l=function(t){return!!(0,n.hasParameterHints)(t)&&(t.dispatch({effects:n.closeSignatureTooltip.of(null)}),!0)},n.closeParameterHintsCommand=l,v=e.View.EditorView.updateListener.of((function(t){t.focusChanged&&!t.view.hasFocus&&(0,n.closeParameterHintsCommand)(t.view)})),n.signatureTooltipsExtensions=[f,v]},902:function(t,n,i){var e,r,u,o,s;Object.defineProperty(n,"__esModule",{value:!0}),n.doubleClickSelectRangeExtension=void 0,e=i(833),r=i(129),u=i(338),o=i(367),s=e.State.EditorSelection,n.doubleClickSelectRangeExtension=e.View.EditorView.mouseSelectionStyle.of((function(t,n){var i,e,h=t.state.field(o.isFormulaField);return h?2!==n.detail||0!==n.button||null===(i=t.posAtCoords(n))?null:(e=t.state.selection,{get:function(n,i,o){var h,f,a=t.posAtCoords(n);return null===a?e:(h=(0,r.getTokenByPos)((0,u.getTokensByState)(t.state),a))?(f=s.range(h.index,h.endIndex+1),o?e.addRange(f):s.create([f])):e},update:function(t){i=t.changes.mapPos(i),e=e.map(t.changes)}}):null}))},910:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T,B,_,N,P,F,H,z,W,V,U,$,q,G,J,K,Q,X,Z,Y,tt;function nt(){return[r.basicSetup,Y,o.customFields,m.readOnlyExtension,p.themeExtension,c.foldExtension,l.indentExtension,s.syntaxHighlightingField,h.autoCompletionExtensions,f.hoverTooltipExtension,a.signatureTooltipsExtensions,d.doubleClickSelectRangeExtension,y.linterExtension]}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaEditorCore=void 0,e=i(376),r=i(833),u=i(465),o=i(367),s=i(307),h=i(58),f=i(284),a=i(888),c=i(971),l=i(710),v=i(33),d=i(902),y=i(413),p=i(231),k=i(744),m=i(86),g=i(338),w="gc-formula-editor-token-const-string",b="gc-formula-editor-token-const-number",M="gc-formula-editor-token-const-boolean",x="gc-formula-editor-token-const-error",S="gc-formula-editor-token-operator-prefix",C="gc-formula-editor-token-operator-infix",O="gc-formula-editor-token-operator-postfix",A="gc-formula-editor-token-function",D="gc-formula-editor-token-name",E="gc-formula-editor-token-reference-1",I="gc-formula-editor-token-reference-2",R="gc-formula-editor-token-reference-3",L="gc-formula-editor-token-reference-4",j="gc-formula-editor-token-reference-5",T="gc-formula-editor-token-reference-6",B="gc-formula-editor-token-reference-7",_="gc-formula-editor-token-argument-separator",N="gc-formula-editor-content",P="gc-formula-editor-gutters",F="gc-formula-editor-caret",H="gc-formula-editor-active-line",z="gc-formula-editor-selection",W="gc-formula-editor-tooltip-autocompletion-function",V="gc-formula-editor-tooltip-autocompletion-function-active-item",U="gc-formula-editor-tooltip-autocompletion-function-icon",$="gc-formula-editor-tooltip-autocompletion-function-name",q="gc-formula-editor-tooltip-autocompletion-function-description",G="gc-formula-editor-tooltip-error-message",J=e.I.fl,K=r.View.EditorView,Q=r.View.keymap,X=r.Commands.indentWithTab,Z=r.Autocomplete.acceptCompletion,Y=Q.of([{key:"Tab",run:Z},{key:"Tab",run:v.insertTab},X]),tt=function(){function t(t,n){this.ipe=n,this.zQt=new K({state:this.npe(""),parent:t})}return t.prototype.getView=function(){return this.zQt},t.prototype.getText=function(){return this.zQt.state.doc.toJSON().join("\n")},t.prototype.setText=function(t){this.zQt.dispatch({changes:{from:0,to:this.zQt.state.doc.length,insert:t}})},t.prototype.getFunctions=function(){return(0,g.getFunctionsByState)(this.zQt.state)},t.prototype.getCustomNames=function(){return this.zQt.state.field(o.customNamesField)},t.prototype.setCustomNames=function(t){this.zQt.dispatch({effects:o.setCustomNamesField.of(t)})},t.prototype.getOptions=function(){return this.zQt.state.field(o.optionsField)},t.prototype.setOptions=function(t){this.zQt.dispatch({effects:o.setOptionsField.of(t)})},t.prototype.getReadOnly=function(){return this.zQt.state.readOnly},t.prototype.setReadOnly=function(t){t!==this.getReadOnly()&&(0,m.reconfigureReadOnly)(this.zQt,t)},t.prototype.getTheme=function(){return this.zQt.state.field(o.themeField)},t.prototype.setTheme=function(t){this.zQt.dispatch({effects:o.setThemeField.of(t)}),this.zQt.dispatch({effects:p.themeCompartment.reconfigure((0,p.createThemeExtension)(t))})},t.prototype.getCalcSource=function(){return this.zQt.state.field(o.calcSourceField)},t.prototype.setCalcSource=function(t){this.zQt.dispatch({effects:o.setCalcSourceField.of(t)})},t.prototype.getCalcService=function(){return this.zQt.state.field(o.calcServiceField)},t.prototype.setCalcService=function(t){this.zQt.dispatch({effects:o.setCalcServiceField.of(t)})},t.prototype.getActiveCellInfo=function(){return this.zQt.state.field(o.activeCellField)},t.prototype.setActiveCellInfo=function(t){this.zQt.dispatch({effects:o.setActiveCellField.of(t)})},t.prototype.getProvider=function(){return this.zQt.state.field(o.providerField)},t.prototype.setProvider=function(t){this.zQt.dispatch({effects:o.setProviderField.of(t)})},t.prototype.format=function(){(0,k.formatDocumentCommand)(this.zQt)},t.prototype.hasFocus=function(){return this.zQt.hasFocus},t.prototype.destroy=function(){this.zQt.destroy()},t.prototype.rebuildFormula=function(){this.zQt.dispatch({effects:o.rebuildFormulaEffect.of(!0)})},t.prototype.clearHistory=function(){var t=this,n=t.getText(),i=t.getTheme(),e=t.getOptions(),r=t.getCalcService(),u=t.getCalcSource(),o=t.getCustomNames(),s=t.getActiveCellInfo(),h=t.getProvider(),f=t.getReadOnly(),a=t.npe(n);t.zQt.setState(a),t.setTheme(i),t.setOptions(e),t.setCalcService(r),t.setCalcSource(u),t.setActiveCellInfo(s),t.setCustomNames(o),t.setProvider(h),t.setReadOnly(f)},t.prototype.initTheme=function(){var t=[{token:u.SyntaxHighlightingTokenType.stringConst,color:J(w).color},{token:u.SyntaxHighlightingTokenType.numberConst,color:J(b).color},{token:u.SyntaxHighlightingTokenType.booleanConst,color:J(M).color},{token:u.SyntaxHighlightingTokenType.errorConst,color:J(x).color},{token:u.SyntaxHighlightingTokenType.operatorPrefix,color:J(S).color},{token:u.SyntaxHighlightingTokenType.operatorInfix,color:J(C).color},{token:u.SyntaxHighlightingTokenType.operatorPostfix,color:J(O).color},{token:u.SyntaxHighlightingTokenType.function,color:J(A).color},{token:u.SyntaxHighlightingTokenType.name,color:J(D).color},{token:u.SyntaxHighlightingTokenType.argumentSeparator,color:J(_).color},{token:u.SyntaxHighlightingTokenType.reference,color:[J(E).color,J(I).color,J(R).color,J(L).color,J(j).color,J(T).color,J(B).color]}],n={backgroundColor:J(N).backgroundColor,font:J(N).font,color:J(N).color,caretColor:J(F).color,selectionBackColor:J(z).backgroundColor,activeLineBackColor:J(H).backgroundColor,autocompletionStyle:{backgroundColor:J(W).backgroundColor,font:J(W).font,color:J(W).color,border:J(W).border,activeItem:{backgroundColor:J(V).backgroundColor,color:J(V).color},function_icon:{color:J(U).color,font:J(U).font},function_name:{color:J($).color,font:J($).font},function_description:{color:J(q).color,font:J(q).font}},errorStyle:{backgroundColor:J(G).backgroundColor,font:J(G).font,color:J(G).color}},i={backgroundColor:J(P).backgroundColor,font:J(P).font,color:J(P).color};this.setTheme({rules:t,editorContentStyle:n,editorGuttersStyle:i})},t.prototype.isFormattedFormula=function(){return this.zQt.state.field(o.isFormattedFormulaField)},t.prototype.npe=function(t){var n=nt().concat(this.ipe);return r.State.EditorState.create({extensions:n,doc:t})},t}(),n.FormulaEditorCore=tt},958:function(t,n,i){var e,r,u,o,s,h,f,a=this&&this.hJr||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){void 0===e&&(e=i),t[e]=n[i]}),c=this&&this.dJr||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||a(n,t,i)};Object.defineProperty(n,"__esModule",{value:!0}),n.findControl=n.vve=n.Commands=n.FormulaEditor=void 0,e=i(376),i(390),i(636),r=i(357),u=i(413),o=i(967),s=i(357),Object.defineProperty(n,"FormulaEditor",{enumerable:!0,get:function(){return s.FormulaEditor}}),h=i(636),Object.defineProperty(n,"Commands",{enumerable:!0,get:function(){return h.Commands}}),n.vve={mve:u.getDiagnostic,I5:o.format},c(i(236),n),f=function(t){return"string"==typeof t&&(t=document.getElementById(t)),(0,e.GC$)(t).data(r.CONST_FORMULA_EDITOR)},n.findControl=f},967:function(t,n,i){var e,r,u,o,s,h=this&&this.mJr||function(){return h=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},h.apply(this,arguments)};function f(t,n){var i,o=new e.Parser,s=n.parseContext,f=(0,r.parse)(t,o,s,!1,!1);if(f)return i=h(h({parser:o,oneIndentTab:u.WHITESPACE.repeat(n.tabSize)},n),(0,r.getCultureInfo)()),u.EQUAL+a(f,0,i,u.EQUAL)}function a(t,n,i,r,u,o){var s,h,f;return void 0===r&&(r=""),void 0===u&&(u=""),void 0===o&&(o=!0),t?(s=c(t,i),S(h=x(n,i,o)+s,i,r,u)&&((f=t.type)===e.ExpressionType.operator?h=l(t,n,i,r,u,o):f===e.ExpressionType.function?h=p(t,n,i,r,u,o):f===e.ExpressionType.parentheses?h=w(t,n,i,o):f===e.ExpressionType.array&&(h=m(t,n,i,o))),h):""}function c(t,n){var i,r;return t?r=(i=t.type)===e.ExpressionType.operator?v(t,n):i===e.ExpressionType.function?k(t,n):i===e.ExpressionType.parentheses?u.LEFT_PARENTHESES+c(t.value,n)+u.RIGHT_PARENTHESES:i===e.ExpressionType.array?g(t,n):b(t,n):""}function l(t,n,i,e,r,o){var h,f,l,v,y=t.operatorType,p=E(y);return A(y)?h=x(n,i,o)+p+a(t.value,n,i,e,r,!1):D(y)?h=a(t.value,n,i,e,p+r,o)+p:18===y?h=d(t,n,i,o):I(y)?(l=e+(f=a(t.value,n,i,e,u.WHITESPACE+p+s+r))+u.WHITESPACE+p,S(v=c(t.value2,i),i,l+u.WHITESPACE,r)?(v=a(t.value2,n+1,i,l+s,r),h=f+u.WHITESPACE+p+s+v):h=f+u.WHITESPACE+p+u.WHITESPACE+v):h=(f=a(t.value,n,i,e,r))+p+(v=a(t.value2,n,i,e+f+p,r,!1)),h}function v(t,n){var i,e,r,o=t.operatorType,s=E(o);return A(o)?i=s+c(t.value,n):D(o)?i=c(t.value,n)+s:(e=c(t.value,n),r=c(t.value2,n),i=18===o?y(t,n):I(o)?e+u.WHITESPACE+s+u.WHITESPACE+r:e+s+r),i}function d(t,n,i,e){return x(n,i,e)+b(t,i)}function y(t,n){return b(t,n)}function p(t,n,i,r,h,f){var c,l,v,d,y,p=x(n,i,f),k=(0,e.isFunction)(t.function)&&t.function.name||t.functionName;if(k===o)return a(t.arguments[0],n,i,r,"#"+h,f)+"#";if("@"===k)return p+"@"+a(t.arguments[0],n,i,r+p+"@",h,!1);if(c=!k&&t.function instanceof e.Expression?a(t.function,n,i,r,h,f)+u.LEFT_PARENTHESES:p+k+u.LEFT_PARENTHESES,0===(v=(l=t.arguments||[]).length))return c+u.RIGHT_PARENTHESES;for(c+=s,d=0;d<v;d++)c+=a(y=l[d],n+1,i),d!==v-1&&(c+=i.listSeparator),c+=s;return c+x(n,i)+u.RIGHT_PARENTHESES}function k(t,n){var i,r,s,h,f,a=(0,e.isFunction)(t.function)&&t.function.name||t.functionName;if(a===o)return c(t.arguments[0],n)+"#";if("@"===a)return"@"+c(t.arguments[0],n);for(i=!a&&t.function instanceof e.Expression?c(t.function,n)+u.LEFT_PARENTHESES:R(a)+u.LEFT_PARENTHESES,s=(r=t.arguments||[]).length,h=0;h<s;h++)i+=c(f=r[h],n),h!==s-1&&(i+=n.listSeparator+u.WHITESPACE);return i+u.RIGHT_PARENTHESES}function m(t,n,i,e){var r,o,h=t.value,f=h.getRowCount(),a=h.getColumnCount(),c=x(n,i,e),l=x(n+1,i),v=c+u.LEFT_CURLY_BRACKETS+s;for(r=0;r<f;r++){for(v+=l,o=0;o<a;o++)v+=M(h.getValue(r,o),i),o!==a-1&&(v+=i.arrayListSeparator+u.WHITESPACE);r!==f-1&&(v+=i.arrayGroupSeparator),v+=s}return v+x(n,i)+u.RIGHT_CURLY_BRACKETS}function g(t,n){var i,e,r=t.value,o=r.getRowCount(),s=r.getColumnCount(),h=u.LEFT_CURLY_BRACKETS;for(i=0;i<o;i++){for(e=0;e<s;e++)h+=M(r.getValue(i,e),n),e!==s-1&&(h+=n.arrayListSeparator+u.WHITESPACE);i!==o-1&&(h+=n.arrayGroupSeparator+u.WHITESPACE)}return h+u.RIGHT_CURLY_BRACKETS}function w(t,n,i,e){var r=a(t.value,n+1,i),o=x(n,i,e);return o+u.LEFT_PARENTHESES+s+r+s+x(n,i)+u.RIGHT_PARENTHESES}function b(t,n){var i=[];return n.parser.unparse(n.parseContext,t,i),i.join("")}function M(t,n){var i,r;return"string"==typeof t?i=e.ExpressionType.string:"boolean"==typeof t?i=e.ExpressionType.boolean:"number"==typeof t&&(i=e.ExpressionType.number),void 0===i?t.toString():((r=new e.Expression(i)).value=t,b(r,n))}function x(t,n,i){return void 0===i&&(i=!0),i?n.oneIndentTab.repeat(t):""}function S(t,n,i,e){if(t.trim().length>n.widthLimit)return!0;var r=C(i)+t+O(e);return n.measureTextFunc(r)>n.lineWidthLimit}function C(t){var n=t.lastIndexOf(s);return-1===n?t:t.substring(n+1)}function O(t){var n=t.indexOf(s);return-1===n?t:t.substring(0,n)}function A(t){return 0===t||1===t}function D(t){return 2===t}function E(t){return e.Z9t[t]}function I(t){return!(15===t||16===t||17===t||18===t)}function R(t){var n=(0,e.getMapping)()&&(0,e.getMapping)().builtInFunctionsMapping,i=n&&n[t];return i&&i.alias&&(t=i.alias),t}Object.defineProperty(n,"__esModule",{value:!0}),n.format=void 0,e=i(35),r=i(129),u=i(348),o="ANCHORARRAY",s="\n",n.format=f},971:function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.foldExtension=void 0,e=i(833),r=i(129),n.foldExtension=e.Language.foldService.of((function(t,n,i){var e,u,o,s=t.doc.lineAt(n),h=t.doc.lines,f=(0,r.getLineIndent)(s.text),a=n,c=i;for(e=s.number+1;e<h&&(u=t.doc.line(e),(o=(0,r.getLineIndent)(u.text))>f);e++)c=u.to;return t.doc.lineAt(a).number===t.doc.lineAt(c).number?null:{from:a=s.to,to:c}}))}},e={};function r(t){var n,u=e[t];return void 0!==u?u.exports:(n=e[t]={exports:{}},i[t].call(n.exports,n,n.exports,r),n.exports)}n=r(958),(((t=void 0===t?{}:t).Spread=t.Spread||{}).Sheets=t.Spread.Sheets||{}).FormulaPanel=n}(),t.Spread.Common.CultureManager.reloadResources&&t.Spread.Common.CultureManager.reloadResources("FormulaPanel")}));
12
+ !function(t){"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("@grapecity-software/spread-sheets")):"function"==typeof define&&define.amd?define(["@grapecity-software/spread-sheets"],t):"object"==typeof exports?exports.Spread=t(require("@grapecity-software/spread-sheets")):t(GC)}((function(t){!function(){"use strict";var n,i={33:function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.insertTab=void 0,e=i(338),r=function(t){if(t.state.readOnly)return!1;if(t.state.selection.ranges.some((function(t){return!t.empty})))return!1;var n=(0,e.getOneIndentSpaceByState)(t.state);return t.dispatch(t.state.update(t.state.replaceSelection(n),{scrollIntoView:!0,userEvent:"input"})),!0},n.insertTab=r},35:function(n){n.exports=t.Spread.CalcEngine},47:function(t,n,i){var e,r,u,o,s;function h(t,n,i,r,o,s){var h=(0,u.parseToExpressionTree)(t,n);return h.isFullColumn||h.isFullRow?(0,e.lmt)(h,i,r,!0,!0):h.hmt()?(0,e.dmt)(h,i,r):(0,e.lmt)(h,i,r,o,s),(0,u.unparseToText)(h,n)}function f(t,n,i){return(0,r.includeToken)(t,n,i)||(0,r.isInToken)(t,n,!0,!0)||(0,r.isInToken)(t,i,!0,!0)}Object.defineProperty(n,"__esModule",{value:!0}),n.toggleAbsoluteRelativeReferencesCommand=void 0,e=i(648),r=i(129),u=i(338),o=i(367),s=function(t){var n,i,e,r,s,a,c,l,v,d,y,p,k,m=t.state.field(o.isFormulaField);return!!m&&(n=t.state,i=(0,u.getTokensByState)(n),e=n.selection.main,r=e.from,s=e.to,a=n.field(o.activeCellField),c=a.row,l=a.col,v=!1,d=0,y=r,p=s,(k=i.filter((function(t){return f(t,r,s)&&(0,u.isValidReferenceToken)(t,n)}))).forEach((function(i){var e,u,o=i.text.indexOf(":"),f=-1!==o,a=!f||r<=i.index+o,k=!f||s>i.index+o,m=h(i.text,n,c,l,a,k);m&&(t.dispatch({changes:{from:i.index+d,to:i.endIndex+1+d,insert:m}}),d+=m.length-i.text.length,e=i.index,u=i.endIndex+1,!f||a&&k||(a?u=i.index+o:k&&(e=i.index+o+1)),y=Math.min(y,e),p=Math.max(p,u),t.dispatch({selection:{anchor:y,head:p+d}}),v=!0)})),v)},n.toggleAbsoluteRelativeReferencesCommand=s},58:function(t,n,i){var e,r,u,o,s,h,f,a=this&&this.mJr||function(){return a=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},a.apply(this,arguments)};function c(t,n){var i,e,o,s=(0,r.getSignatureStatus)((0,u.getTokensByState)(n.state),n.pos);s&&(i=(0,u.getFunctionResourceByState)(n.state,s.functionName))&&(e=(0,r.getActiveParameterInSignatureTip)(s.activeParameter,i),(o=i.parameters&&i.parameters[e])&&o.enum&&o.enum.forEach((function(n){t.push({label:n.value,detail:n.description,type:"enum",apply:n.value})})))}function l(t,n){var i=n.state,e=n.pos,o=(0,r.getLocalSymbol)((0,u.getTokensByState)(i),e);o.forEach((function(n){t.push({label:n,type:"variable",apply:n})}))}function v(t,n){var i;(0,u.getCustomNamesByState)(n.state).forEach((function(n){t.push({label:n.getName(),detail:n.getComment()||"",type:"constant",apply:n.getName()})}))}function d(t,n){var i;(0,u.getFunctionResourcesByState)(n.state).forEach((function(n){n.description&&t.push({label:n.name,detail:n.description,type:"function",apply:y})}))}function y(t,n,i,r){var u=t.state,s=u.selection.main,h=i-s.from,f=r-s.from,c=n.label,l=u.changeByRange((function(t){var n=t.from+h,o=t.from+f;return t!==s&&i!==r&&u.sliceDoc(n,o)!==u.sliceDoc(i,r)?{range:t}:{changes:{from:n,to:r===s.from?t.to:o,insert:c+"()"},range:e.State.EditorSelection.cursor(n+c.length+1)}}));t.dispatch(a(a({},l),{userEvent:"input.complete",effects:o.triggerSignatureTooltip.of(null)}))}function p(t){return(0,u.getStructReferencesByState)(t.state).map(m)}function k(t,n){var i,e,r=t.selection.main.head,o=n.text.substring(0,r-n.index);return o&&"["===o[o.length-1]?(i=o.substring(0,o.length-1),(e=(0,u.getStructReferencesByState)(t).find((function(t){return t.name===i})))?e.getColumns().map(m):[]):[]}function m(t){return{label:t.name,detail:t.description,type:"variable"}}function g(t){var n=t.state.selection.main.head,i=(0,u.getTokensByState)(t.state);return(0,r.getTokenByPos)(i,n,!1,!0)}function w(t){var n,i,e,r=t.state.field(s.isFormulaField);return r?(n=g(t))&&n.type===h.TokenType.StringConst?null:(i=t.matchBefore(/[\w.]*/),(e=[]).push.apply(e,k(t.state,n)),c(e,t),i&&i.from===i.to||(l(e,t),d(e,t),v(e,t),e.push.apply(e,p(t))),{from:i?i.from:t.pos,options:e}):null}Object.defineProperty(n,"__esModule",{value:!0}),n.autoCompletionExtensions=void 0,e=i(833),r=i(129),u=i(338),o=i(888),s=i(367),h=i(465),f=e.Autocomplete.autocompletion,n.autoCompletionExtensions=f({override:[w]})},86:function(t,n,i){var e,r;function u(t,n){t.dispatch({effects:r.reconfigure(e.State.EditorState.readOnly.of(n))})}Object.defineProperty(n,"__esModule",{value:!0}),n.reconfigureReadOnly=n.readOnlyExtension=void 0,e=i(833),r=new e.State.Compartment,n.readOnlyExtension=r.of(e.State.EditorState.readOnly.of(!1)),n.reconfigureReadOnly=u},129:function(t,n,i){var e,r,u,o,s;function h(t,n,i,e,r){var u,o,s,h,f;void 0===r&&(r=!0),u=i.culture,o=i.ignoreError,s=i.Wve,h=i.Jde,i.ignoreError=e,i.culture=!0,i.Wve=r,i.Jde=!0;try{f=n.parse(i,t)}catch(t){}return i.culture=u,i.ignoreError=o,i.Wve=s,i.Jde=h,f}function f(t,n,i){if(t){var e;try{e=n.unparse(i,t)}catch(t){}return e}}function a(t,n,i,r,o){var s,h,f,a=new e.Parser,c=!0;return n.Mf?s=(0,u.Vgt)(a,t,n.Mf,i,r,c):(a.setParserOption(c),o.ignoreError=!0,h=t.split(""),f=a.parseToTokens(o,h,!1),f=(0,u.fillBlankToTokens)(f,h),s=(0,u.getExpressTokenImp)(a,n,o,null,f,h,i,r)),H(s,n)}function c(){return{arrayListSeparator:e.Parser.arrayListSeparator||s.COMMA,arrayGroupSeparator:e.Parser.arrayGroupSeparator||s.SEMICOLON,listSeparator:e.Parser.listSeparator||s.COMMA,numberDecimalSeparator:e.Parser.numberDecimalSeparator||s.FULL_STOP}}function l(t,n){var i,e,r,u,o;for(t=t.filter((function(t){return t.endIndex<n})),i=[],e=[],r="",u=0;u<t.length;u++)w(o=t[u])?r=o.text:b(o)?(i.push(r),e.push(0)):M(o)&&(r="",i.pop(),e.pop()),i.length>0&&g(o)&&e[e.length-1]++;if(i.length>0)return{functionName:i.pop(),activeParameter:e.pop()}}function v(t,n){var i,e,r,u,o,s=n.parameters||[],h=s.length||0;for(r=0;r<s.length;r++)if(s[r].repeatable)void 0===i&&(i=r);else if(void 0!==i){e=r-1;break}return void 0!==i&&(void 0===e&&(e=s.length-1),t>=i&&(t=e+(o=(t-i)%(u=e-i+1))+1<h?e+o+1:i+o)),t}function d(t,n){t=v(t,n);var i=n.parameters?n.parameters.length:0;return Math.min(t,i-1)}function y(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),t.find((function(t){return p(t,n,i,e)}))}function p(t,n,i,e){return void 0===i&&(i=!0),void 0===e&&(e=!1),(i?n>=t.index:n>t.index)&&(e?n<=t.endIndex+1:n<t.endIndex+1)}function k(t,n,i){return n<=t.index&&i>=t.endIndex+1}function m(t,n){var i,e,r,u,o,h,f,a,c;for(t=t.filter((function(t){return t.endIndex<n})),i=[],e=[],r=[],u=0;u<t.length;u++)w(o=t[u])?(i.push(o.text.toUpperCase()),e.push([]),r.push(0)):M(o)?(i.pop(),e.pop(),r.pop()):g(o)&&(h=(0,s.lastItem)(i),f=(0,s.lastItem)(r),a=(0,s.lastItem)(e),c=t[u-1],("LAMBDA"===h||"LET"===h&&f%2==0)&&j(c)&&a.push(c.text),r[r.length-1]=f+1);return e.filter((function(t){return t.length>0})).reduce((function(t,n){return t.concat(n)}),[])}function g(t){return t.type===o.TokenType.FunctionArgumentSeparator}function w(t){return t.type===o.TokenType.FunctionName}function b(t){return t.type===o.TokenType.FunctionCallStart}function M(t){return t.type===o.TokenType.FunctionCallEnd}function x(t){return t.type===o.TokenType.SubExpressionStart}function S(t){return t.type===o.TokenType.SubExpressionEnd}function C(t){return t.type===o.TokenType.FormulaStart}function O(t){return t.type===o.TokenType.Unknown}function A(t){return O(t)&&F(t.text)===s.LEFT_PARENTHESES}function D(t){return O(t)&&F(t.text)===s.RIGHT_PARENTHESES}function E(t){return j(t)||B(t)}function I(t){return t.type===o.TokenType.OperatorInfix}function R(t){return t.type===o.TokenType.OperatorPrefix}function L(t){return t.type===o.TokenType.Whitespace}function j(t){return t.type===o.TokenType.Name}function T(t){return t.type===o.TokenType.OperatorPostfix&&"#"===t.text}function B(t){return t.type===o.TokenType.CellReference}function _(t){return E(t)&&t.ranges&&t.ranges.length>0}function N(t){var n,i=0;for(n=0;n<t.length&&t[n]===s.WHITESPACE;n++)i++;return i}function P(t,n,i){var e,r,u,o,s,h;for(void 0===i&&(i=4),e=N(t),r=[],u=function(){return 0===r.length},o=function(){return r[r.length-1]},s=0;s<n.length;s++)b(h=n[s])||x(h)?r.push(h):M(h)?!u()&&b(o())&&r.pop():S(h)&&!u()&&x(o())&&r.pop();return r.length>0&&(e+=i),e}function F(t){return t.replace(/\s+/g,"")}function H(t,n){var i,e,r,u=[],h=[],f=c(),a=!1;for(i=0;i<t.length;i++)(r=z(e=t[i],a,f))===o.TokenType.ArrayConstStart?(h.push(r),a=!0):r===o.TokenType.FunctionCallStart?(h.push(r),a=!1):r!==o.TokenType.FunctionCallEnd&&r!==o.TokenType.ArrayConstEnd||(h.pop(),a=(0,s.lastItem)(h)===o.TokenType.ArrayConstStart),u.push({type:r,index:e.index,endIndex:e.endIndex,text:e.text,ranges:e.ranges,canDrag:e.canDrag,colorIndex:e.colorIndex});return W(V(u),n)}function z(t,n,i){var e=t.type,u=t.subType,h=t.text.trim();if(1===e){if(1===u)return"ARRAY"===h?o.TokenType.ArrayConstStart:"@"===h||h===s.LEFT_PARENTHESES?o.TokenType.FunctionCallStart:o.TokenType.FunctionName;if(2===u)return h===s.RIGHT_PARENTHESES?o.TokenType.FunctionCallEnd:n?o.TokenType.ArrayConstEnd:o.TokenType.FunctionCallEnd;if((0,r.Df)(h))return o.TokenType.FormulaStart}else if(3===e){if(0===u)return n&&h===i.arrayListSeparator?o.TokenType.ArrayConstItemSeparator:n&&h===i.arrayGroupSeparator?o.TokenType.ArrayConstRowSeparator:o.TokenType.FunctionArgumentSeparator}else{if(4===e)return o.TokenType.OperatorPrefix;if(5===e)return o.TokenType.OperatorInfix;if(6===e)return o.TokenType.OperatorPostfix;if(0===e)return 5===u?o.TokenType.LogicalConst:4===u?o.TokenType.NumberConst:3===u?o.TokenType.StringConst:6===u?o.TokenType.ErrorConst:7===u||12===u?t.isName?o.TokenType.Name:o.TokenType.CellReference:o.TokenType.StringConst;if(2!==e)return 7===e?o.TokenType.Whitespace:o.TokenType.Unknown;if(1===u)return o.TokenType.SubExpressionStart;if(2===u)return o.TokenType.SubExpressionEnd}}function W(t,n){var i,r,u,o;for(i=t.length-2;i>0;i--)r=t[i],T(u=t[i+1])&&B(r)&&_(r)&&(o=new e.CalcReference(n,r.ranges).getSpillRef())&&o.$gt&&(r.text+=u.text,r.endIndex=u.endIndex,r.ranges=o.$gt,t.splice(i+1,1));return t}function V(t){var n,i,e,r,u,o,s,h=[];for(n=0;n<t.length;n++)U((i=t[n]).type)&&(e=i.text.match(/^(\s*)(\S+)(\s*)$/))&&4===e.length?(r=e[0],u=e[1],o=e[2],s=e[3],u||s?(u&&(i.index+=u.length,i.text=i.text.substring(u.length),h.push($(i.index,u))),h.push(i),s&&(i.endIndex-=s.length,i.text=i.text.substring(0,o.length),h.push($(i.endIndex+1,s)))):h.push(i)):h.push(i);return h}function U(t){return t===o.TokenType.FunctionCallStart||t===o.TokenType.FunctionCallEnd||t===o.TokenType.ArrayConstStart||t===o.TokenType.ArrayConstEnd}function $(t,n){return{type:o.TokenType.Whitespace,index:t,endIndex:t+n.length-1,text:n}}function q(){return e.Functions.findGlobalFunctions()}Object.defineProperty(n,"__esModule",{value:!0}),n.getGlobalFunctions=n.removeWhiteSpace=n.getIndentByPreviousText=n.getLineIndent=n.hasReferenceRanges=n.isReferenceToken=n.isAnchorOperatorToken=n.isNameToken=n.isWhitespaceToken=n.isPrefixOperatorToken=n.isInfixOperatorToken=n.isReferenceOrNameToken=n.isRightParenthesesToken=n.isLeftParenthesesToken=n.isNothingOperandToken=n.isFormulaStartToken=n.isSubExpressionEndToken=n.isSubExpressionStartToken=n.isFunctionCallEndToken=n.isFunctionCallStartToken=n.isFunctionCallToken=n.isFunctionArgumentSeparator=n.getLocalSymbol=n.includeToken=n.isInToken=n.getTokenByPos=n.getActiveParameterInSignatureTip=n.getActiveParameterInParameterResources=n.getSignatureStatus=n.getCultureInfo=n.parseToTokens=n.unparse=n.parse=void 0,e=i(35),r=i(376),u=i(789),o=i(465),s=i(348),n.parse=h,n.unparse=f,n.parseToTokens=a,n.getCultureInfo=c,n.getSignatureStatus=l,n.getActiveParameterInParameterResources=v,n.getActiveParameterInSignatureTip=d,n.getTokenByPos=y,n.isInToken=p,n.includeToken=k,n.getLocalSymbol=m,n.isFunctionArgumentSeparator=g,n.isFunctionCallToken=w,n.isFunctionCallStartToken=b,n.isFunctionCallEndToken=M,n.isSubExpressionStartToken=x,n.isSubExpressionEndToken=S,n.isFormulaStartToken=C,n.isNothingOperandToken=O,n.isLeftParenthesesToken=A,n.isRightParenthesesToken=D,n.isReferenceOrNameToken=E,n.isInfixOperatorToken=I,n.isPrefixOperatorToken=R,n.isWhitespaceToken=L,n.isNameToken=j,n.isAnchorOperatorToken=T,n.isReferenceToken=B,n.hasReferenceRanges=_,n.getLineIndent=N,n.getIndentByPreviousText=P,n.removeWhiteSpace=F,n.getGlobalFunctions=q},203:function(t,n,i){var e,r,u,o,s,h,f,a;function c(t,n,i){var e=i.parent;t&&t.zQt===n||(i.Bde=new s.FormulaEditorReferencedRangesContext(n),(0,s.setWorkbookFocusStatus)(e,i.Bde.Dvt()))}function l(t,n,i){if((0,s.isFormulaEditorReferencedRangesContext)(t)){var e=i.parent;v(t,n,e)?(0,s.closeFormulaReferencedRanges)(n.state):document.activeElement!==n.contentDOM&&setTimeout((function(){n.focus()}),10)}}function v(t,n,i){var e=document.activeElement;return e!==n.contentDOM&&(!e.hasAttribute("data-gc-formula-editor-additional-element")&&!(t.Dvt()&&i&&i.Ti&&i.Ti.contains(e)))}function d(t,n){var i,e;y(t.keyCode)&&(e=(i=(0,u.getActiveSheetByState)(n.state))&&i.Bde,(0,s.isFormulaEditorReferencedRangesContext)(e)&&i.rt.yk(t))}function y(t){return 16===t||17===t||18===t}function p(t,n){var i,r=n.oldSheet,u=n.newSheet;r&&u&&r!==u&&(i=r.Bde,(0,s.isFormulaEditorReferencedRangesContext)(i)&&(i.Dvt()||e.Hde.DJ)&&(n.needTriggerSheetChange=!1,u.Bde=i,r.Bde=h))}function k(t,n){var i,r,u=n.oldSheet,f=n.newSheet;if(f&&!f.xT&&u!==f&&(i=f.Bde,(0,s.isFormulaEditorReferencedRangesContext)(i)&&(i.Dvt()||e.Hde.DJ)))return i.cve()!==f?e.Hde.DJ=new s.FormulaEditorReferencedRangesAcrossSheetContext(i):(r=e.Hde.DJ,(0,s.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(r.d5(),e.Hde.DJ=h)),(0,o.paintFormulaReferencedRanges)(f),!0}Object.defineProperty(n,"__esModule",{value:!0}),n.uve=n.ave=n.isMetaKeyForAppendingRange=n.formulaReferencedRangesExtension=void 0,e=i(648),r=i(833),u=i(338),o=i(390),s=i(341),h=void 0,f=r.View.EditorView.updateListener.of((function(t){var n,i,r,h=(0,u.getActiveSheetByState)(t.state);h&&(n=h.parent,i=h.Bde,r=e.Hde.Ude(),!i&&(0,s.isFormulaEditorReferencedRangesAcrossSheetContext)(r)&&(i=r.lve),t.focusChanged?(t.view.hasFocus?c(i,t.view,h):l(i,t.view,h),(0,o.paintFormulaReferencedRanges)(h)):(t.selectionSet||t.docChanged)&&i&&(t.transactions.some((function(t){return!t.annotation(s.appendingRangeAnnotation)}))&&i.qD(),(0,s.setWorkbookFocusStatus)(n,i.Dvt()),(0,o.paintFormulaReferencedRanges)(h)))})),a=r.View.ViewPlugin.define((function(){return null}),{eventHandlers:{keydown:d,keyup:d}}),n.formulaReferencedRangesExtension=[f,a],n.isMetaKeyForAppendingRange=y,n.ave=p,n.uve=k},231:function(t,n,i){var e,r,u,o,s;function h(t){var n=t.autocompletionStyle,i=t.errorStyle;return o.theme({"& .cm-tooltip-autocomplete":{color:n.color,font:n.font,background:n.backgroundColor,border:n.border,"margin-left":"1em"},"& .cm-tooltip-autocomplete ul li":{padding:"5px"},"& .cm-tooltip-autocomplete ul li .cm-completionIcon-function":{color:n.function_icon.color,font:n.function_icon.font},"& .cm-tooltip-autocomplete ul li .cm-completionLabel":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li .cm-completionDetail":{color:n.function_name.color,font:n.function_name.font},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionIcon-function":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionLabel":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected] .cm-completionDetail":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip-autocomplete ul li[aria-selected]":{color:n.activeItem.color,background:n.activeItem.backgroundColor},"& .cm-tooltip .cm-tooltip-lint .cm-diagnostic ":{color:i.color,font:i.font,background:i.backgroundColor}})}function f(t){var n={},i=function(t,i,e){var r=(0,u.syntaxHighlightingTokenClassName)(t),o=isNaN(e)?"":"[".concat(u.TOKEN_INDEX_ATTRIBUTE_NAME,'="').concat(e,'"]');n["& .".concat(r).concat(o)]=i};return t.forEach((function(t){Array.isArray(t.color)?(i(t.token,{color:t.color[0]}),t.color.forEach((function(n,e){i(t.token,{color:n},e)}))):i(t.token,{color:t.color})})),o.theme(n)}function a(t,n){return o.theme({"& .cm-scroller":{"background-color":t.backgroundColor,color:t.color,font:t.font},".cm-cursor, .cm-dropCursor":{borderLeftColor:t.caretColor},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:t.selectionBackColor},"& .cm-activeLine":{"background-color":t.activeLineBackColor},"& .cm-gutters":{"background-color":n.backgroundColor,color:n.color,font:n.font,"user-select":"none"},"& .cm-lineNumbers ":{width:"30px"},'& .cm-foldGutter span[title="Fold line"] ':{"padding-bottom":"8px"},"& .cm-gutterElement":{display:"flex","align-items":"center","justify-content":"flex-end"},"& .cm-activeLineGutter":{"background-color":t.activeLineBackColor},"& .cm-tooltip":{border:"none"}})}function c(t){var n=t.rules,i=t.editorContentStyle,e=t.editorGuttersStyle,r=[s];return i&&e&&(r=r.concat([a(i,e),h(i)])),n&&(r=r.concat(f(n))),r}Object.defineProperty(n,"__esModule",{value:!0}),n.themeExtension=n.createThemeExtension=n.themeCompartment=n.createSyntaxHighlightingTheme=void 0,e=i(833),r=i(753),u=i(307),o=e.View.EditorView,s=o.theme({"&":{height:"100%"},"&.cm-editor.cm-focused":{outline:"none"},"& .cm-line":{"line-height":1.35}}),n.createSyntaxHighlightingTheme=f,n.themeCompartment=new e.State.Compartment,n.createThemeExtension=c,n.themeExtension=n.themeCompartment.of(c(r.defaultTheme))},234:function(n){n.exports=t.Spread},236:function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.SR=void 0;var e=i(564);n.SR={en:e}},284:function(t,n,i){var e,r,u,o,s;Object.defineProperty(n,"__esModule",{value:!0}),n.hoverTooltipExtension=void 0,e=i(833),r=i(129),u=i(348),o=i(338),s=i(367),n.hoverTooltipExtension=e.View.hoverTooltip((function(t,n){var i,e,h,f,a=t.state.field(s.isFormulaField);return a?(i=(0,o.getTokensByState)(t.state),(e=(0,r.getTokenByPos)(i,n))?(h=[],f=(0,o.getFunctionResourceByState)(t.state,e.text),(0,r.isFunctionCallToken)(e)&&f&&(h.push((0,u.getFunctionHoverTitle)(f)),f.description&&h.push(f.description)),0===h.length?null:{pos:e.index,end:e.endIndex+1,above:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,u.createHelpFunctionTitleDom)(f)),f.description&&t.appendChild((0,u.createHelpFunctionDescriptionDom)(f.description)),{dom:t}}}):null):null}))},307:function(t,n,i){var e,r,u,o,s,h,f;function a(t){return"gc-formula-editor-token_"+r.SyntaxHighlightingTokenType[t]}function c(t){var n;return t.field(o.isFormulaField)?f.of(v(t)):f.of([])}function l(t,i){var e={};return isNaN(i)||(e[n.TOKEN_INDEX_ATTRIBUTE_NAME]=i),{class:a(t),attributes:e}}function v(t){var n=(0,u.getTokensByState)(t);return d(n,t),n.map((function(t){var n=k(t);return e.View.Decoration.mark(l(n,t.colorIndex)).range(t.index,t.endIndex+1)}))}function d(t,n){var i,e=[];t.forEach((function(t){if((0,s.isReferenceToken)(t)||(0,s.isNameToken)(t)&&(0,s.hasReferenceRanges)(t)){var n=e.find((function(n){return y(n,t)}));t.colorIndex=n?n.colorIndex:p(e),e.push(t)}})),i=(0,u.getReferenceTokenColors)(n).length,e.forEach((function(t){t.colorIndex=t.colorIndex%i}))}function y(t,n){return(0,s.removeWhiteSpace)(t.text).toUpperCase()===(0,s.removeWhiteSpace)(n.text).toUpperCase()}function p(t){return t&&0!==t.length?Math.max.apply(Math,t.map((function(t){return t.colorIndex})))+1:0}function k(t){var n=t.type,i=r.SyntaxHighlightingTokenType.unknown;return n===r.TokenType.NumberConst?i=r.SyntaxHighlightingTokenType.numberConst:n===r.TokenType.StringConst?i=r.SyntaxHighlightingTokenType.stringConst:n===r.TokenType.LogicalConst?i=r.SyntaxHighlightingTokenType.booleanConst:n===r.TokenType.ErrorConst?i=r.SyntaxHighlightingTokenType.errorConst:n===r.TokenType.CellReference?i=r.SyntaxHighlightingTokenType.reference:n===r.TokenType.Name?i=(0,s.hasReferenceRanges)(t)?r.SyntaxHighlightingTokenType.reference:r.SyntaxHighlightingTokenType.name:n===r.TokenType.OperatorPrefix?i=r.SyntaxHighlightingTokenType.operatorPrefix:n===r.TokenType.OperatorInfix?i=r.SyntaxHighlightingTokenType.operatorInfix:n===r.TokenType.OperatorPostfix?i=r.SyntaxHighlightingTokenType.operatorPostfix:n===r.TokenType.Whitespace?i=r.SyntaxHighlightingTokenType.whitespace:n===r.TokenType.FunctionName||n===r.TokenType.FunctionCallStart||n===r.TokenType.FunctionCallEnd?i=r.SyntaxHighlightingTokenType.function:n===r.TokenType.FunctionArgumentSeparator||n===r.TokenType.ArrayConstRowSeparator||n===r.TokenType.ArrayConstItemSeparator?i=r.SyntaxHighlightingTokenType.argumentSeparator:n!==r.TokenType.SubExpressionStart&&n!==r.TokenType.SubExpressionEnd||(i=r.SyntaxHighlightingTokenType.subExpression),i}Object.defineProperty(n,"__esModule",{value:!0}),n.markReferenceTokenColorIndex=n.syntaxHighlightingTokenClassName=n.syntaxHighlightingField=n.TOKEN_INDEX_ATTRIBUTE_NAME=void 0,e=i(833),r=i(465),u=i(338),o=i(367),s=i(129),h=e.State.StateField,f=e.State.RangeSet,n.TOKEN_INDEX_ATTRIBUTE_NAME="data-token-index",n.syntaxHighlightingField=h.define({create:c,update:function(t,n){return c(n.state)},provide:function(t){return e.View.EditorView.decorations.from(t)}}),n.syntaxHighlightingTokenClassName=a,n.markReferenceTokenColorIndex=d},338:function(t,n,i){var e,r,u,o,s,h,f,a,c,l;function v(t){return t.field(o.tokenField)}function d(t){return t.doc.toJSON().join("\n")}function y(t){return t.field(o.providerField).getFunctions()}function p(t,n){return(0,s.findFunction)(y(t),n)}function k(t){return y(t).map(s.convertToFunctionResource)}function m(t,n){return(0,s.findFunctionResource)(k(t),n)}function g(t){return t.field(o.customNamesField)}function w(t,n){return n=n.toUpperCase(),g(t).find((function(t){return t.getName().toUpperCase()===n}))}function b(t){var n=t.field(o.themeField),i=n.rules.find((function(t){return t.token===u.SyntaxHighlightingTokenType.reference})),e=i?i.color:"black";return Array.isArray(e)?e:[e]}function M(t,n,i){return t.find((function(t){return(0,h.isInToken)(t,n,!0,!0)&&x(t,i)}))}function x(t,n){var i=O(t.text,n);return i&&i.type===r.ExpressionType.reference}function S(t){var n=t.field(o.calcServiceField),i=t.field(o.calcSourceField),e=t.field(o.activeCellField),r=n.getParserContext(i);return r.row=e.row,r.column=e.col,r}function C(t,n){var i,e,r,u;return t.field(o.isFormulaField)?(i=t.field(o.calcSourceField),r=(e=t.field(o.activeCellField)).row,u=e.col,(0,h.parseToTokens)(n,i,r,u,S(t))):[]}function O(t,n,i){void 0===i&&(i=!1);var e=S(n);return(0,h.parse)(t,new r.Parser,e,!i)}function A(t,n){var i=S(n);return(0,h.unparse)(t,new r.Parser,i)}function D(t){return t.field(o.optionsField)}function E(t){var n=D(t);return l(n.tabSize)?c.DEFAULT_TAB_SIZE:n.tabSize}function I(t){var n=D(t);return l(n.formatWidthLimit)?c.DEFAULT_FORMAT_WIDTH_LIMIT:n.formatWidthLimit}function R(t){return s.WHITESPACE.repeat(E(t))}function L(t){var n=t.field(o.calcSourceField).Mf;if(n)return(0,f.Kde)(n.parent)||n}function j(t){return t.selection.main}function T(t){return t.field(o.providerField).getStructReferences()}function B(t,n,i){var e,u,o,s;return n===i||!(!(0,a.kf)(n)||!(0,a.kf)(i))&&(e=new r.Parser,u=S(t),o=(0,h.unparse)((0,h.parse)(n,e,u,!1,!1),e,u),s=(0,h.unparse)((0,h.parse)(i,e,u,!1,!1),e,u),!(!o||!s)&&o===s)}Object.defineProperty(n,"__esModule",{value:!0}),n.isSameFormula=n.getStructReferencesByState=n.getSelection=n.getActiveSheetByState=n.getOneIndentSpaceByState=n.getFormatWidthLimitByState=n.getTabSizeByState=n.getOptionsByState=n.unparseToText=n.parseToExpressionTree=n.parseToTokens=n.getParseContextByState=n.isValidReferenceToken=n.getValidReferenceTokenByPos=n.getReferenceTokenColors=n.getCustomNameByState=n.getCustomNamesByState=n.getFunctionResourceByState=n.getFunctionResourcesByState=n.getFunctionByState=n.getFunctionsByState=n.getTextByState=n.getTokensByState=void 0,e=i(234),r=i(35),u=i(465),o=i(367),s=i(348),h=i(129),f=i(607),a=i(376),c=i(753),l=e.Common.lt.ht,n.getTokensByState=v,n.getTextByState=d,n.getFunctionsByState=y,n.getFunctionByState=p,n.getFunctionResourcesByState=k,n.getFunctionResourceByState=m,n.getCustomNamesByState=g,n.getCustomNameByState=w,n.getReferenceTokenColors=b,n.getValidReferenceTokenByPos=M,n.isValidReferenceToken=x,n.getParseContextByState=S,n.parseToTokens=C,n.parseToExpressionTree=O,n.unparseToText=A,n.getOptionsByState=D,n.getTabSizeByState=E,n.getFormatWidthLimitByState=I,n.getOneIndentSpaceByState=R,n.getActiveSheetByState=L,n.getSelection=j,n.getStructReferencesByState=T,n.isSameFormula=B},341:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p;function k(t){var n,i,e=(0,h.getActiveSheetByState)(t);e&&(g(n=u.Hde.Ude())&&(n.zde(e),e=(0,h.getActiveSheetByState)(t)),m(i=e.Bde)&&(i.dispose(),e.Bde=d,w(e.parent,!1)))}function m(t){return t instanceof y}function g(t){return t instanceof p}function w(t,n){var i=function(t){t&&(t.rt.X6=n)};t.sheets.forEach(i),t.mp.forEach((function(t){i(t.Mf)}))}function b(t,n){void 0===n&&(n=!0),t.parent.e3(t,n)}Object.defineProperty(n,"__esModule",{value:!0}),n.setWorkbookFocusStatus=n.isFormulaEditorReferencedRangesAcrossSheetContext=n.isFormulaEditorReferencedRangesContext=n.closeFormulaReferencedRanges=n.FormulaEditorReferencedRangesAcrossSheetContext=n.FormulaEditorReferencedRangesContext=n.appendingRangeAnnotation=void 0,e=i(234),r=i(376),u=i(648),o=i(833),s=i(129),h=i(338),f=i(348),a=i(367),c=i(888),l=i(307),v=i(636),d=void 0,n.appendingRangeAnnotation=o.State.Annotation.define(),y=function(){function t(t){this.cmt=!0,this.rl=!1,this.Xvt=r.SelectionUnit.cell,this.Ivt=!1,this.xmt=!0,this.qMi=!1,this.XD=!1,this.umt=-1,this.zQt=t}return t.prototype.smt=function(){var t,n,i,e,u,o;if(!this.isFormula())return[];for(t=this.zQt.state,n=(0,h.getTokensByState)(t),(0,l.markReferenceTokenColorIndex)(n,t),i=[],e=0;e<n.length;e++)u=n[e],((0,s.isReferenceToken)(u)||(0,s.isNameToken)(u)&&(0,s.hasReferenceRanges)(u))&&i.push({index:i.length,textOffset:u.index,text:u.text,ranges:u.ranges,allowDrag:u.canDrag,sheetArea:r.SheetArea.viewport,tag:{colorIndex:u.colorIndex}});return(o=this.Fvt)&&i.push({textOffset:-1,text:"",ranges:[o],index:i.length,allowDrag:!1,isPivotClickCell:!0,tag:{colorIndex:0}}),i},t.prototype.pmt=function(t){var n,i=(0,h.getReferenceTokenColors)(this.zQt.state),e=this.smt()[t];return i[(null===(n=null==e?void 0:e.tag)||void 0===n?void 0:n.colorIndex)||0]},t.prototype.ymt=function(t){var n=this.zQt.state.selection.main.head;return t.textOffset<=n&&t.textOffset+t.text.length>=n},t.prototype.bmt=function(t){var n,i;return!!this.XD&&(n=this.zQt.state.selection.main.head,i=this.umt,t.textOffset>=i&&t.textOffset+t.text.length<=n)},t.prototype.Qvt=function(){return r.SheetArea.viewport},t.prototype.Dvt=function(){var t,n=this.zQt.state;return!n.readOnly&&(!(!this.XD&&!(0,r.Df)(this.text()))||!!this.isFormula()&&(!!(t=(0,s.getTokenByPos)((0,h.getTokensByState)(n),(0,h.getSelection)(n).from-1))&&((0,s.isFormulaStartToken)(t)||(0,s.isFunctionCallStartToken)(t)||(0,s.isSubExpressionStartToken)(t)||(0,s.isFunctionArgumentSeparator)(t)||(0,s.isLeftParenthesesToken)(t)||(0,s.isInfixOperatorToken)(t)||(0,s.isPrefixOperatorToken)(t)||(0,s.isWhitespaceToken)(t))))},t.prototype.text=function(){return(0,h.getTextByState)(this.zQt.state)},t.prototype.caret=function(){return this.zQt.state.selection.main.head},t.prototype.close=function(){},t.prototype.mmt=function(){},t.prototype.Vde=function(t,n){var i,e,r,u,o,s;n&&(i=this.zQt,(r=(e=this.smt())[t])&&(o=(u=r.textOffset)+r.text.length,s=u+n.length,i.dispatch({changes:{from:u,to:o,insert:n},selection:{anchor:s,head:s},annotations:c.notTriggerSignatureTooltip.of(!0)})))},t.prototype.Gvt=function(t,i,e,u,o){var s,f,a,l,v,d,y,p;if(void 0===o&&(o=r.SheetArea.viewport),t){if(a=(f=(s=this).zQt).state,!s.XD){if(!s.Dvt())return;i=!1,s.XD=!0,s.umt=(0,h.getSelection)(a).from}l=s.umt,v=(0,h.getSelection)(a).to,d=(0,h.getTokensByState)(a),y=(0,h.getValidReferenceTokenByPos)(d,v,a),e?(p=l+t.length,f.dispatch({changes:{from:l,to:v,insert:t},selection:{anchor:p,head:p},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]})):i?y&&y.index>=l&&v>=y.index&&(p=y.index+t.length,f.dispatch({changes:{from:y.index,to:v,insert:t},selection:{anchor:p,head:p},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]})):(v>l&&(t=s.fgt()+t),p=v+t.length,f.dispatch({changes:{from:v,to:v,insert:t},selection:{anchor:p,head:p},annotations:[n.appendingRangeAnnotation.of(!0),c.notTriggerSignatureTooltip.of(!0)]}))}},t.prototype.qD=function(){var t=this;t.XD&&(t.XD=!1,t.umt=-1)},t.prototype.onRangeMoved=function(){},t.prototype.onRangeResized=function(){},t.prototype.onRangeAppend=function(){},t.prototype.fgt=function(){var t=e.Common.CultureManager.Fe().NumberFormat;return t&&t.listSeparator||f.COMMA},t.prototype.cve=function(){return this.zQt.state.field(a.calcSourceField).Mf},t.prototype.fve=function(){return this.zQt.state.field(a.activeCellField)},t.prototype.isFormula=function(){return this.zQt.state.field(a.isFormulaField)},t.prototype.Ak=function(t){t&&(this.Dmt=[t])},t.prototype.Hce=function(){this.Dmt=d},t.prototype.Ymt=function(){return this.Dmt},t.prototype.dispose=function(){this.zQt=d},t.prototype.dve=function(){var t=this.zQt;t&&(k(t.state),t.hasFocus&&t.contentDOM.blur(),this.dispose())},t}(),n.FormulaEditorReferencedRangesContext=y,p=function(){function t(t){this.lve=t}return Object.defineProperty(t.prototype,"Ivt",{get:function(){return this.lve.Ivt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"Mf",{get:function(){return this.lve.cve()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_text",{get:function(){return this.lve.text()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"bZ",{get:function(){return this.lve.fve().row},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"mvt",{get:function(){return this.lve.fve().col},enumerable:!1,configurable:!0}),t.prototype.zde=function(t){var n=!1,i=this.Mf,e=this.bZ,r=this.mvt,u=this._text;return i!==t&&(b(i),n=!0),(0,v.executeCommitContextToCellCommand)(i,e,r,u),this.d5(),n},t.prototype.d5=function(){this.lve=d,u.Hde.DJ=d},t}(),n.FormulaEditorReferencedRangesAcrossSheetContext=p,n.closeFormulaReferencedRanges=k,n.isFormulaEditorReferencedRangesContext=m,n.isFormulaEditorReferencedRangesAcrossSheetContext=g,n.setWorkbookFocusStatus=w},348:function(t,n,i){var e,r,u,o,s=this&&this.mJr||function(){return s=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},s.apply(this,arguments)};function h(t){var n=t.description();return n&&(n=f(n)),{name:t.name,description:null==n?void 0:n.description,parameters:null==n?void 0:n.parameters}}function f(t){var n,i,e,r=[],u=t.parameters||[];for(n=0;n<u.length;n++)(e=(i=s({},u[n])).name.length>2&&i.name.startsWith("[")&&i.name.endsWith("]"))&&(i.optional=!0,i.name=i.name.substring(1,i.name.length-1)),i.repeatable&&(i.optional=!0),r.push(i);return s(s({},t),{parameters:r})}function a(t,n){return n=n.toUpperCase(),(t||[]).find((function(t){return t.name.toUpperCase()===n}))}function c(t,n){return n=n.toUpperCase(),(t||[]).find((function(t){return t.name.toUpperCase()===n}))}function l(t){return t&&0!==t.length?t.map(v).join(", "):""}function v(t){var n=t.name;return t.optional&&(n="["+n+"]"),t.repeatable&&(n="..."+n),n}function d(t){var n=t.name;return t.repeatable&&(n+=", ..."),t.optional&&(n="["+n+"]"),n}function y(t){return"".concat(t.name,"(").concat(l(t.parameters),")")}function p(t){return"(".concat(o().FORMULA," ").concat(y(t))}function k(t){return t[t.length-1]}function m(t){return"gc-formula-editor-tooltip-help-function-"+t}function g(t,n){var i,e,r,u,o,s=document.createElement("p");for(s.className=m("title"),i=function(t,n){var i=document.createElement("span");return i.className=n,i.textContent=t,s.appendChild(i),i},e=function(t){return m("title-"+t)},i(t.name,e("function-name")),i("(",e("parentheses")),r=t.parameters||[],u=0;u<r.length;u++)o=e("parameter"),void 0!==n&&n===u&&(o+=" "+e("active-parameter")),i(d(r[u]),o),u!==r.length-1&&i(",",e("parameter-separator"));return i(")",e("parentheses")),s}function w(t){var n=document.createElement("p");return n.textContent=t,n.className=m("description"),n}Object.defineProperty(n,"__esModule",{value:!0}),n.createHelpFunctionDescriptionDom=n.createHelpFunctionTitleDom=n.lastItem=n.getFunctionHoverTitle=n.getFunctionSignatureString=n.getParameterString=n.getParameterListString=n.findFunctionResource=n.findFunction=n.normalizeFunctionDescription=n.convertToFunctionResource=n.END_OF_LINE=n.WHITESPACE=n.RIGHT_CURLY_BRACKETS=n.LEFT_CURLY_BRACKETS=n.RIGHT_PARENTHESES=n.LEFT_PARENTHESES=n.SEMICOLON=n.COMMA=n.FULL_STOP=n.EQUAL=void 0,e=i(234),r=i(236),u=new e.Common.ResourceManager(r.SR,"formulaEditor"),o=u.getResource.bind(u),n.EQUAL="=",n.FULL_STOP=".",n.COMMA=",",n.SEMICOLON=";",n.LEFT_PARENTHESES="(",n.RIGHT_PARENTHESES=")",n.LEFT_CURLY_BRACKETS="{",n.RIGHT_CURLY_BRACKETS="}",n.WHITESPACE=" ",n.END_OF_LINE="\r\n",n.convertToFunctionResource=h,n.normalizeFunctionDescription=f,n.findFunction=a,n.findFunctionResource=c,n.getParameterListString=l,n.getParameterString=v,n.getFunctionSignatureString=y,n.getFunctionHoverTitle=p,n.lastItem=k,n.createHelpFunctionTitleDom=g,n.createHelpFunctionDescriptionDom=w},357:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w;function b(t,n,i){if(x(t,n,i))return!0;if(S(t,n,i))return!0;if(!M(t,n,i))return!0;var e={r:y};return r.Worksheet.et(t,"formulaPanelCheckIsReadOnly",e),!!e.r}function M(t,n,i){var e=t.getActualStyle(n,i);return!e||!1!==e.allowEditInCell}function x(t,n,i){return t.isActualProtected()&&!1!==t.l0(n,i,"locked")}function S(t,n,i){var e,u=t.$go(n,i);return!(!u||(e={sheet:t,sheetName:t.name(),sheetArea:r.SheetArea.viewport,row:n,col:i},!(e=u.lfe(e,d)).readonly))}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaEditor=n.CONST_FORMULA_EDITOR=void 0,e=i(234),r=i(376),u=i(910),o=i(753),s=i(636),h=i(203),f=i(341),a=i(390),c=i(607),l=i(338),v=i(752),n.CONST_FORMULA_EDITOR="formula-editor",d=void 0,y=null,p=r.mt.b0,k=r.GC$.extend,m=r.GC$.each,g=[h.formulaReferencedRangesExtension],w=function(){function t(i,h){var f,a;"string"==typeof i&&(i=document.getElementById(i)),f=this,a={container:i},t.et(f,"onCreate",a),i=a.container,f.Wc=i,f.li=new u.FormulaEditorCore(i,g),f.e$r(),f.Qy=new e.Commands.CommandManager(f),f.Zde=f.Zde.bind(f),f.spe=f.spe.bind(f),f.Yde=f.Yde.bind(f),f.$ve=f.$ve.bind(f),f.ove=f.ove.bind(f),f.tve=f.tve.bind(f),f.Rve=f.Rve.bind(f),f.hme=f.hme.bind(f),f.qve=f.qve.bind(f),f.yme=f.yme.bind(f),f.kme=f.kme.bind(f),f.LEt=p(o.DEFAULT_FORMULA_EDITOR_OPTIONS,f.kme),f.Zp(h),f.wme(),i.addEventListener("keydown",f.Zde),(0,s.registerDefaultCommands)(f.Qy),(0,r.GC$)(i).data(n.CONST_FORMULA_EDITOR,f)}return t.prototype.e$r=function(){var n=this;n.li.initTheme(),t.et(n,"onThemeChange",n.li.getTheme())},Object.defineProperty(t.prototype,"options",{get:function(){return this.LEt},set:function(t){if(t&&"object"==typeof t)for(var n in t)t.hasOwnProperty(n)&&(this.LEt[n]=t[n])},enumerable:!1,configurable:!0}),t.prototype.text=function(t){if(0===arguments.length)return this.li.getText();this.li.setText(t+"")},t.prototype.workbook=function(){return this.Vv},t.prototype.attach=function(n){var i=this;i.Vv!==n&&(i.detach(),i.Vv=n,i._6(),i.Vv.D3(r.Events.EnterCellInternal,i.spe),i.Vv.D3(r.Events.CellChanged,i.Yde),i.Vv.D3(r.Events.RangeChanged,i.$ve),i.Vv.D3(r.Events.RangeFiltered,i.yme),i.Vv.D3(r.Events.RangeFilterCleared,i.yme),i.Vv.D3(r.Events.ActiveSheetChangingInternal,i.ove),i.Vv.D3(r.Events.ActiveSheetChangedInternal,i.tve),i.Vv.D3(r.Events.SheetOptionsChangedInternal,i.Rve),i.Vv.D3(r.Events.WorkbookOptionsChangedInternal,i.hme),i.Vv.D3(r.Events.CustomNameChangedInternal,i.qve),t.et(i,"onAttach"))},t.prototype.detach=function(){var t=this,n=t.Vv;n&&(t.exitFormulaRefMode(),n._3(r.Events.EnterCellInternal,t.spe),n._3(r.Events.CellChanged,t.Yde),n._3(r.Events.RangeChanged,t.$ve),n._3(r.Events.RangeFiltered,t.yme),n._3(r.Events.RangeFilterCleared,t.yme),n._3(r.Events.ActiveSheetChangingInternal,t.ove),n._3(r.Events.ActiveSheetChangedInternal,t.tve),n._3(r.Events.SheetOptionsChangedInternal,t.Rve),n._3(r.Events.WorkbookOptionsChangedInternal,t.hme),n._3(r.Events.CustomNameChangedInternal,t.qve),t.Vv=d,t._6())},t.prototype.format=function(){this.li.format()},t.prototype.commandManager=function(){return this.Qy},t.prototype.destroy=function(){var i=this;t.et(i,"onDestroy"),i.detach(),i.li.destroy(),i.Wc.removeEventListener("keydown",i.Zde),(0,r.GC$)(i.Wc).data(n.CONST_FORMULA_EDITOR,y)},t.prototype.refresh=function(){var t=this;t.e$r(),t._6()},t.prototype.exitFormulaRefMode=function(){var t=this.li.getView();t&&t.state&&(0,f.closeFormulaReferencedRanges)(t.state)},t.prototype.getActiveCellInfo=function(){var t=this.li.getActiveCellInfo(),n=t.row,i=t.col,e=this.li.getCalcSource().Mf;return{sheet:e,row:n,col:i}},t.prototype.isFormattedFormula=function(){return this.li.isFormattedFormula()},t.prototype.Qde=function(){return this.li.getView().hasFocus},t.prototype.Xde=function(){var t,n,i=this.getActiveCellInfo(),e=i.sheet,u=i.row,o=i.col;e&&(t=this.li,n=(0,a.getEditText)(e,u,o),e.options.showFormulas&&e.hasFormula(u,o)&&r.mt.HRe(u,o,e)&&(n=""),(0,l.isSameFormula)(t.getView().state,t.getText(),n)||t.setText(n),t.format())},t.prototype.Zp=function(t){var n=this.LEt,i=t||{};i=k(!0,{},o.DEFAULT_FORMULA_EDITOR_OPTIONS,i),m(i,(function(t,i){n.hasOwnProperty(t)&&(n[t]=i)})),this.li.setOptions(n)},t.prototype.wme=function(){var t=this;t.li.setProvider({getStructReferences:function(){return(0,v.getStructReferencesByWorkbook)(t.Vv)},getFunctions:function(){return(0,c.getFunctionsByWorkbook)(t.Vv)}})},t.prototype.Zde=function(t){this.hve(t)},t.prototype.spe=function(){var t=this;t.tpe()?t.ope():(t.Xde(),t.Ove())},t.prototype.Yde=function(t,n){var i=this.getActiveCellInfo(),e=i.sheet,r=i.row,u=i.col;e===n.sheet&&r===n.row&&u===n.col&&("[styleinfo]"===n.propertyName&&this.Ove(),this.Xde())},t.prototype.$ve=function(t,n){var i,e,u,o,s;n&&(e=(i=this.getActiveCellInfo()).sheet,u=i.row,o=i.col,e===n.sheet&&(s=new r.Range(n.row,n.col,n.rowCount,n.colCount)).contains(u,o)&&(n.changedCells&&!n.changedCells.some((function(t){return t.row===u&&t.col===o}))||this.Xde()))},t.prototype.ove=function(t,n){(0,h.ave)(t,n)},t.prototype.tve=function(t,n){var i;(0,h.uve)(t,n)||this._6()},t.prototype.Rve=function(t,n){var i=n.propertyName;"isProtected"===i&&this.Ove(),"showFormulas"===i&&this.Xde()},t.prototype.hme=function(t,n){var i;"allowDynamicArray"===n.propertyName&&this.li.rebuildFormula()},t.prototype.qve=function(){this.sve()},t.prototype.yme=function(t,n){var i,e=null===(i=this.Vv)||void 0===i?void 0:i.getSheetTab(n.sheetName),r=this.li.getCalcSource().Mf;e&&e.Mf===r&&this.Xde()},t.prototype.kme=function(t,n,i){var e=this;n!==i&&this.li.setOptions(e.LEt)},t.prototype._6=function(){var t=this;t.eve(),t.rve(),t.sve(),t.ope()},t.prototype.eve=function(){var t,n=(null===(t=this.Vv)||void 0===t?void 0:t.getCalcService())||o.defaultCalcService;this.li.setCalcService(n)},t.prototype.rve=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setCalcSource(t.Uw()):this.li.setCalcSource(o.defaultCalcSource),this.epe()},t.prototype.sve=function(){var t,n=[],i=this.Vv;i&&(n.push.apply(n,i.getCustomNames()),(t=(0,c.Kde)(i))&&n.push.apply(n,t.getCustomNames())),this.li.setCustomNames(n)},t.prototype.ope=function(){var t=this,n=t.rpe();t.li.setActiveCellInfo(n),t.Xde(),t.Ove(),t.li.clearHistory(),t.epe()},t.prototype.Ove=function(){var t=(0,c.Kde)(this.Vv);t?this.li.setReadOnly(b(t,t.getActiveRowIndex(),t.getActiveColumnIndex())):this.li.setReadOnly(!1)},t.prototype.tpe=function(){var t=this.li.getActiveCellInfo(),n=this.rpe();return t.row!==n.row||t.col!==n.col},t.prototype.rpe=function(){var t,n,i=(0,c.Kde)(this.Vv);return i?{row:t=i.getActiveRowIndex(),col:n=i.getActiveColumnIndex()}:o.DEFAULT_ACTIVE_CELL_INFO},t.prototype.epe=function(){this.options.onActiveCellChanged&&this.options.onActiveCellChanged()},t.prototype.hve=function(t){var n,i,e,u=this,o=u.Qy.getShortcutKey(t.keyCode,t.ctrlKey,t.shiftKey,t.altKey,t.metaKey),s=u.Qy.getCommands(o);if(s)for(n={cmds:s,r:y},r.Worksheet.et(this.Vv.getActiveSheet(),"beforeExecuteShortcut",n),s=n.cmds,i=0;i<s.length;i++)if(e=s[i].execute(u,{}))return e.ignoreCancelDefault||r.mt.vi(t),!0},t}(),n.FormulaEditor=w,(0,r.$e)(w)},367:function(t,n,i){var e,r,u,o,s,h,f;function a(t,n){return h.define({create:t,update:function(t,i){var e,r,u;for(e=0,r=i.effects;e<r.length;e++)if((u=r[e]).is(n))return u.value;return t}})}function c(t){return!!t.docChanged||t.effects.some((function(t){return t.is(n.setCalcServiceField)||t.is(n.setCalcSourceField)||t.is(n.setCustomNamesField)||t.is(n.setProviderField)||t.is(n.setActiveCellField)||t.is(n.rebuildFormulaEffect)}))}Object.defineProperty(n,"__esModule",{value:!0}),n.needRebuildToken=n.customFields=n.isFormattedFormulaField=n.isFormulaField=n.themeField=n.setThemeField=n.optionsField=n.setOptionsField=n.tokenField=n.rebuildFormulaEffect=n.providerField=n.setProviderField=n.customNamesField=n.setCustomNamesField=n.activeCellField=n.setActiveCellField=n.calcSourceField=n.setCalcSourceField=n.calcServiceField=n.setCalcServiceField=void 0,e=i(376),r=i(833),u=i(338),o=i(753),s=i(744),h=r.State.StateField,f=r.State.StateEffect,n.setCalcServiceField=f.define(),n.calcServiceField=a((function(){return o.defaultCalcService}),n.setCalcServiceField),n.setCalcSourceField=f.define(),n.calcSourceField=a((function(){return o.defaultCalcSource}),n.setCalcSourceField),n.setActiveCellField=f.define(),n.activeCellField=a((function(){return o.DEFAULT_ACTIVE_CELL_INFO}),n.setActiveCellField),n.setCustomNamesField=f.define(),n.customNamesField=a((function(){return[]}),n.setCustomNamesField),n.setProviderField=f.define(),n.providerField=a((function(){return o.DEFAULT_PROVIDER}),n.setProviderField),n.rebuildFormulaEffect=f.define(),n.tokenField=h.define({create:function(t){return(0,u.parseToTokens)(t,(0,u.getTextByState)(t))},update:function(t,n){return c(n)?(0,u.parseToTokens)(n.state,(0,u.getTextByState)(n.state)):t}}),n.setOptionsField=f.define(),n.optionsField=a((function(){return o.DEFAULT_FORMULA_EDITOR_OPTIONS}),n.setOptionsField),n.setThemeField=f.define(),n.themeField=a((function(){return o.defaultTheme}),n.setThemeField),n.isFormulaField=h.define({create:function(t){return(0,e.kf)((0,u.getTextByState)(t))},update:function(t,n){return n.docChanged?(0,e.kf)((0,u.getTextByState)(n.state)):t}}),n.isFormattedFormulaField=h.define({create:function(){return!0},update:function(t,n){return n.docChanged?!!n.annotation(s.formatDocumentAnnotation):t}}),n.customFields=[n.optionsField,n.themeField,n.isFormulaField,n.isFormattedFormulaField,n.activeCellField,n.calcServiceField,n.calcSourceField,n.customNamesField,n.providerField,n.tokenField],n.needRebuildToken=c},376:function(n){n.exports=t.Spread.Sheets},390:function(t,n,i){var e,r,u,o,s,h;function f(t){t.Dn.Fde()}function a(t){var n=t.Bde;if((0,o.isFormulaEditorReferencedRangesContext)(n)&&n.zQt.hasFocus)return!0}function c(t,n,i){var e,r,o,s,h,f="";if(t)if(r=(e=t.parent)&&e.options,(o=t.getFormulaInformation(n,i,3))&&o.hasFormula&&!u.mt.HRe(n,i,t)){if(f="="+o.formulaWithCulture,o.isDynamicArray)return"";o.isArrayFormula&&(f="{"+f+"}")}else s=t.getActualStyle(n,i),f="string"==typeof(h=t.getValue(n,i))&&(s.quotePrefix||h.length>1&&"="===h[0]&&r&&r.allowUserEditFormula&&!r.allowInvalidFormula)?"'"+h:u.mt.formatValue2Text(s,h,t,{sheet:t,row:n,col:i,sheetArea:3})||"";return f}Object.defineProperty(n,"__esModule",{value:!0}),n.getEditText=n.paintFormulaReferencedRanges=void 0,e=i(234),r=i(236),u=i(376),o=i(341),n.paintFormulaReferencedRanges=f,s=new e.Common.ResourceManager(r.SR,"formulaEditor"),h=s.getResource.bind(s),u.Worksheet.ch("formulaEditor",{preProcessKeyDown:function(t){var n,i=this.Bde;(0,o.isFormulaEditorReferencedRangesContext)(i)&&(n=t.e,i.zQt.hasFocus?t.r=!0:"Escape"===(null==n?void 0:n.key)&&((0,o.closeFormulaReferencedRanges)(i.zQt.state),this.repaint(),t.r=!0))},processCompositionStart:function(t){a(this)&&(t.r=!0)}}),n.getEditText=c,u.Workbook.ch("formulaEditor",{onCultureChanged:function(){h()}})},413:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v;function d(t,n){return v().NO_MATCHED_ARGUMENTS.replace("$1",t+"").replace("$2",n+"")}function y(t){return v().UNKNOWN_SHEET.replace("$1",t)}function p(t){return v().DUPLICATE_IDENTIFIER.replace("$1",t)}function k(t){var n,i,e,r=[],u=t.field(c.isFormulaField);return u?(n=(0,f.getTextByState)(t),D(r,i=(0,f.getTokensByState)(t),t,n),R(r)||((e=(0,f.parseToExpressionTree)(n,t))?b(r,e,t):E(r,i,t,n),(0,f.parseToExpressionTree)(n,t,!0)||R(r)||m(r,0,n.length,v().INVALID_FORMULA)),r):[]}function m(t,n,i,e,r){void 0===r&&(r="error"),t.push({from:n,to:i,message:e,severity:r})}function g(t,n,i,e){void 0===e&&(e="error"),m(t,n.index,n.endIndex+1,i,e)}function w(t,n,i,e){void 0===e&&(e="error"),m(t,n.lit,n.ywt,i,e)}function b(t,n,i){if(n){for(;n.type===o.ExpressionType.parentheses;){if(!n.value)return void w(t,n,v().INVALID_EXPRESSION);n=n.value}var e=n.type;e===o.ExpressionType.name?(0,f.getCustomNameByState)(i,n.value)||w(t,n,v().UNKNOWN_NAME,"warning"):e===o.ExpressionType.operator?(n.value&&b(t,n.value,i),n.value2&&b(t,n.value2,i)):e===o.ExpressionType.function?M(t,n,i):e===o.ExpressionType.reference&&A(t,n)}}function M(t,n,i){var e,r,u,s=n.functionName;if("LET"===s)x(t,n,i);else if("LAMBDA"===s)S(t,n,i);else for((0,o.isExpression)(n.function)?b(t,n.function,i):(e=(0,f.getFunctionByState)(i,s))?C(t,n,e):(0,f.getCustomNameByState)(i,s)||m(t,n.lit,n.lit+s.length,v().UNKNOWN_NAME,"warning"),r=n.arguments||[],u=0;u<r.length;u++)b(t,r[u],i)}function x(t,n,i){var e,r,u=n.lit,o=n.ywt,s=n.arguments||[];for(s.length<3&&m(t,u,o,d(3,s.length)),s.length>=3&&s.length%2==0&&m(t,u,o,v().MISS_LET_FUNCTION_BODY),e=[],r=0;r<s.length-1;r++)r%2==0?(O(t,s[r],e),e.push(s[r].value)):b(t,s[r],i);b(t,s[s.length-1],i)}function S(t,n,i){var e,r,u=n.lit,o=n.ywt,s=n.arguments||[];for(s.length<1&&m(t,u,o,d(1,s.length)),e=[],r=0;r<s.length-1;r++)O(t,s[r],e),e.push(s[r].value);b(t,s[s.length-1],i)}function C(t,n,i){var e=n.lit,r=n.ywt,u=i.minArgs||0,o=i.maxArgs!==a?i.maxArgs:Number.MAX_SAFE_INTEGER,s=n.arguments||[];s.length<u?m(t,e,r,d(u,s.length)):s.length>o&&m(t,e,r,d(o,s.length))}function O(t,n,i){var e=n.lit,r=n.ywt;!n||8!==n.type&&100!==n.type||n.value.indexOf(".")>-1?m(t,e,r,v().INVALID_IDENTIFIER_ARGUMENT):-1!==i.indexOf(n.value)&&m(t,e,r,p(n.value))}function A(t,n){var i=n.source,e=i&&i.getName();i instanceof o.ErrorSource&&e&&m(t,n.lit,n.lit+e.length,y(e),"warning")}function D(t,n,i,e){var r,u,o=[],h=function(t){return(0,s.isFunctionCallStartToken)(t)||(0,s.isSubExpressionStartToken)(t)||(0,s.isLeftParenthesesToken)(t)},f=function(t){return(0,s.isFunctionCallEndToken)(t)||(0,s.isSubExpressionEndToken)(t)||(0,s.isRightParenthesesToken)(t)};for(r=0;r<n.length;r++)h(u=n[r])?o.push(u):f(u)&&(o.length>0?o.pop():g(t,u,v().NO_MATH_PARENTHESES));o.length>0&&m(t,e.length,e.length,v().MISS_RIGHT_PARENTHESES)}function E(t,n,i,e){var r,u,o,f,a=[],c=[],l=[];for(r=0;r<n.length;r++)u=n[r],(0,s.isFunctionCallToken)(u)?(a.push({token:u}),l.push([])):(0,s.isSubExpressionStartToken)(u)?c.push({token:u}):(0,s.isFunctionCallEndToken)(u)?0===a.length?g(t,u,v().NO_MATH_PARENTHESES):(o=(0,h.lastItem)(a),a.pop(),l.pop(),o.hasError||(f=I(i,e,o.token,u),t.push.apply(t,f),R(f)&&(a.forEach((function(t){t.hasError=!0})),c.forEach((function(t){t.hasError=!0}))))):(0,s.isSubExpressionEndToken)(u)?0===c.length?g(t,u,v().NO_MATH_PARENTHESES):c.pop():(0,s.isFunctionArgumentSeparator)(u)?0!==a.length&&(0,h.lastItem)(l).push(u):(0,s.isRightParenthesesToken)(u)&&g(t,u,v().NO_MATH_PARENTHESES);(a.length>0||c.length>0)&&m(t,e.length,e.length,v().MISS_RIGHT_PARENTHESES)}function I(t,n,i,e){var r=[],u=i.index,o=e.endIndex+1,s=n.substring(u,o),h=(0,f.parseToExpressionTree)(s,t);return h?(M(r,h,t),r.forEach((function(t){t.from+=u,t.to+=u})),(0,f.parseToExpressionTree)(s,t,!0)||R(r)||m(r,u,o,v().INVALID_EXPRESSION),r):(m(r,u,o,v().INVALID_EXPRESSION),r)}function R(t){return t.some((function(t){return"error"===t.severity}))}Object.defineProperty(n,"__esModule",{value:!0}),n.getDiagnostic=n.linterExtension=void 0,e=i(833),r=i(234),u=i(236),o=i(35),s=i(129),h=i(348),f=i(338),a=void 0,c=i(367),l=new r.Common.ResourceManager(u.SR,"formulaEditor"),v=l.getResource.bind(l),n.linterExtension=e.Lint.linter((function(t){return k(t.state)}),{needsRefresh:function(t){return t.transactions.some(c.needRebuildToken)}}),n.getDiagnostic=k},465:function(t,n){var i,e;Object.defineProperty(n,"__esModule",{value:!0}),n.TokenType=n.SyntaxHighlightingTokenType=void 0,function(t){t[t.subExpression=0]="subExpression",t[t.function=1]="function",t[t.argumentSeparator=2]="argumentSeparator",t[t.operatorPrefix=3]="operatorPrefix",t[t.operatorInfix=4]="operatorInfix",t[t.operatorPostfix=5]="operatorPostfix",t[t.stringConst=6]="stringConst",t[t.errorConst=7]="errorConst",t[t.numberConst=8]="numberConst",t[t.booleanConst=9]="booleanConst",t[t.name=10]="name",t[t.reference=11]="reference",t[t.whitespace=12]="whitespace",t[t.unknown=13]="unknown"}(i=n.SyntaxHighlightingTokenType||(n.SyntaxHighlightingTokenType={})),function(t){t[t.ErrorConst=0]="ErrorConst",t[t.LogicalConst=1]="LogicalConst",t[t.NumberConst=2]="NumberConst",t[t.StringConst=3]="StringConst",t[t.ArrayConstStart=4]="ArrayConstStart",t[t.ArrayConstEnd=5]="ArrayConstEnd",t[t.ArrayConstRowSeparator=6]="ArrayConstRowSeparator",t[t.ArrayConstItemSeparator=7]="ArrayConstItemSeparator",t[t.OperatorPrefix=8]="OperatorPrefix",t[t.OperatorInfix=9]="OperatorInfix",t[t.OperatorPostfix=10]="OperatorPostfix",t[t.FunctionName=11]="FunctionName",t[t.FunctionCallStart=12]="FunctionCallStart",t[t.FunctionCallEnd=13]="FunctionCallEnd",t[t.FunctionArgumentSeparator=14]="FunctionArgumentSeparator",t[t.SubExpressionStart=15]="SubExpressionStart",t[t.SubExpressionEnd=16]="SubExpressionEnd",t[t.CellReference=17]="CellReference",t[t.Name=18]="Name",t[t.FormulaStart=19]="FormulaStart",t[t.Whitespace=20]="Whitespace",t[t.Unknown=21]="Unknown"}(e=n.TokenType||(n.TokenType={}))},564:function(t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.FORMULA=n.INVALID_FORMULA=n.INVALID_EXPRESSION=n.DUPLICATE_IDENTIFIER=n.INVALID_IDENTIFIER_ARGUMENT=n.NO_MATCHED_ARGUMENTS=n.UNKNOWN_SHEET=n.UNKNOWN_NAME=n.MISS_LET_FUNCTION_BODY=n.MISS_RIGHT_PARENTHESES=n.NO_MATH_PARENTHESES=void 0,n.NO_MATH_PARENTHESES="No match parentheses",n.MISS_RIGHT_PARENTHESES="')' is expected.",n.MISS_LET_FUNCTION_BODY="Missing body of LET expression.",n.UNKNOWN_NAME="Unknown name",n.UNKNOWN_SHEET='Unknown sheet "$1"',n.NO_MATCHED_ARGUMENTS="Expected $1 arguments, but got $2",n.INVALID_IDENTIFIER_ARGUMENT="This argument must be an identifier to bind.",n.DUPLICATE_IDENTIFIER="Duplicate identifier $1",n.INVALID_EXPRESSION="Invalid EXPRESSION",n.INVALID_FORMULA="Invalid Formula",n.FORMULA="Formula"},607:function(t,n,i){var e,r;function u(t){if(t)return(0,e.jf)(t)}function o(t){var n,i=(0,r.getGlobalFunctions)(),e=function(t){Object.keys(t).forEach((function(n){i.push(t[n])}))};return t&&(e(t.Amt),(n=u(t))&&e(n.Amt),t.options.allowDynamicArray||(i=i.filter((function(t){return!t.isDynamicArrayFunction})))),i}Object.defineProperty(n,"__esModule",{value:!0}),n.getFunctionsByWorkbook=n.Kde=void 0,e=i(376),r=i(129),n.Kde=u,n.getFunctionsByWorkbook=o},636:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m;function g(t,n){return void 0===n&&(n=!1),{canUndo:n,execute:t}}function w(t,n){return void 0===n&&(n=!1),g((function(n){return t(n.li.getView())}),n)}function b(t){var i=e.mt.Qf(),r=!i,u=i;t.register(y,n.Commands[y],27),t.register(a,n.Commands[a],32,r,!0,!1,u),t.register(c,n.Commands[c],27),t.register(l,n.Commands[l],115),t.register(v,n.Commands[v],70,!1,!0,!0),t.register(d,n.Commands[d],83,r,!1,!1,u)}Object.defineProperty(n,"__esModule",{value:!0}),n.registerDefaultCommands=n.Commands=n.executeCommitContextToCellCommand=void 0,e=i(376),r=i(648),u=i(607),o=i(744),s=i(888),h=i(47),f=i(341),a="showHints",c="closeHints",l="toggleAbsoluteRelativeReferences",v="formatDocument",d="commitContentToActiveCell",y="exitEdit",p=function(t,n,i,r,u){var o,s,h,f;void 0===u&&(u=e.SheetArea.viewport),o=r.length>0?r:null,s={cmd:"editCell",sheetName:t.name(),row:n,col:i,sheetArea:u,newValue:o},t.dataRanges&&(h=t.dataRanges.getByPosition(n,i))&&(f=h.convertContext({sheet:t,row:n,col:i,sheetArea:u}))&&f.sheet!==t&&(s.sheetName=f.sheet.name(),s.row=f.row,s.col=f.col),t.Qy().execute(s)},n.executeCommitContextToCellCommand=p,k=g((function(t){var i,e,o,s,h=(0,u.Kde)(t.Vv);return!!h&&(i=r.Hde.Ude(),(0,f.isFormulaEditorReferencedRangesAcrossSheetContext)(i)?(i.zde(h),!0):(e=t.text(),o=h.getActiveRowIndex(),s=h.getActiveColumnIndex(),(0,n.executeCommitContextToCellCommand)(h,o,s,e),!0))})),m=g((function(t){var n,i=t.workbook();return!(!t.Qde()||!i)&&((n=t.li.getView()).contentDOM.blur(),(0,f.closeFormulaReferencedRanges)(n.state),i.focus(!1),i.focus(),t.Xde(),!0)})),n.Commands={},n.Commands[a]=w(s.triggerParameterHintsCommand),n.Commands[c]=w(s.closeParameterHintsCommand),n.Commands[v]=w(o.formatDocumentCommand),n.Commands[l]=w(h.toggleAbsoluteRelativeReferencesCommand),n.Commands[d]=k,n.Commands[y]=m,n.registerDefaultCommands=b},648:function(n){n.exports=t.Spread.Sheets.FormulaTextBox},710:function(t,n,i){var e,r,u;Object.defineProperty(n,"__esModule",{value:!0}),n.indentExtension=void 0,e=i(833),r=i(129),u=i(338),n.indentExtension=e.Language.indentService.of((function(t,n){if(n<=0)return 0;var i=t.lineAt(n-1);return i&&i.text?(0,r.getIndentByPreviousText)(i.text,(0,u.getTokensByState)(t.state)):0}))},744:function(t,n,i){var e,r,u,o,s,h,f;function a(t,n,i,e){var r=c(t),u=c(n),o=n.length,s=function(t,n){var i,e;for(t-=r[t],i=0;i<u.length;i++){if((e=i-u[i])===t&&!n){t=i;break}if(e>t){t=i-1;break}}return t<=o&&t>=0?t:0};return i===e?i=e=s(e,!1):(i=s(i,!0),e=s(e,!1)),[i,e]}function c(t){var n,i,e=function(t){return" "===t||"\n"===t},r=[0];for(n=1;n<=t.length;n++)i=r[n-1],r.push(i+(e(t[n-1])?1:0));return r}function l(t){var n,i=t.scrollDOM.getBoundingClientRect(),e=t.contentDOM.getBoundingClientRect(),r=v(i,e),u=t.contentDOM.querySelector(".cm-line");return u&&(n=window.getComputedStyle(u),r-=parseInt(n.paddingLeft,10)+parseInt(n.paddingRight,10)),r}function v(t,n){var i=Math.max(t.left,n.left),e=Math.min(t.right,n.right),r=e-i;return r>=0?r:0}function d(t){var n=window.getComputedStyle(t.contentDOM),i=n.font,e=document.createElement("canvas"),r=e.getContext("2d");return r.font=i,function(t){return r.measureText(t).width}}Object.defineProperty(n,"__esModule",{value:!0}),n.formatDocumentCommand=n.formatDocumentAnnotation=void 0,e=i(833),r=i(338),u=i(967),o=i(367),s=i(888),h=Number.MAX_SAFE_INTEGER,n.formatDocumentAnnotation=e.State.Annotation.define(),f=function(t){var i,e,f,c,v,y,p,k,m,g,w=t.state.field(o.isFormulaField);return!!w&&(i=(0,r.getTabSizeByState)(t.state),e=(0,r.getFormatWidthLimitByState)(t.state),f=h,c=function(t){return 0},"auto"===e&&(f=l(t),e=h,c=d(t)),v=t.state.selection.main,p={absoluteReference:!1,parseContext:y=(0,r.getParseContextByState)(t.state),tabSize:i,widthLimit:e,lineWidthLimit:f,measureTextFunc:c},k=(0,r.getTextByState)(t.state),void 0!==(m=(0,u.format)(k,p))&&(k===m||(g=a(k,m,v.from,v.to),t.dispatch({changes:{from:0,to:t.state.doc.length,insert:m},selection:{anchor:g[0],head:g[1]},annotations:[s.notTriggerSignatureTooltip.of(!0),n.formatDocumentAnnotation.of(!0)]})),!0))},n.formatDocumentCommand=f},752:function(t,n,i){Object.defineProperty(n,"__esModule",{value:!0}),n.getStructReferencesByWorkbook=void 0;var e=i(35);function r(t){return t?u(t).concat(s(t)):[]}function u(t){var n=[];return t.sheets.forEach((function(t){var i;(t.tables&&t.tables.all()||[]).forEach((function(t){n.push({name:t.name(),description:(0,e.sR)().Fbx_TableName_Description+t.name(),getColumns:function(){return o(t)}})}))})),n}function o(t){for(var n,i,r=[],u=0,o="";null!==o;)o=t.getColumnName(u),u++,null!==o&&r.push({name:o,description:""});return n=(0,e.sR)().d2t,i=(0,e.getMapping)()&&(0,e.getMapping)().tableFunctionsMapping,Object.keys(n).forEach((function(t){var e=n[t],u=e.name,o=e.description;u=i&&i[u]||u,r.push({name:u,description:o})})),r}function s(t){var n=[];return t.mp.forEach((function(t){n.push({name:t.name(),description:(0,e.sR)().Fbx_TableSheetName_Description+t.name(),getColumns:function(){return h(t)}})})),n}function h(t){var n,i=[],e=t.getColumnCount();for(n=0;n<e;n++)i.push({name:t.getColumnName(n),description:""});return i}n.getStructReferencesByWorkbook=r},753:function(t,n,i){var e,r,u,o;function s(){var t=new e.CalcService;return t.addResolver(new r.SheetReferenceResolver),t.addResolver(new r.StructureReferenceResolver),t}Object.defineProperty(n,"__esModule",{value:!0}),n.defaultTheme=n.defaultSyntaxHighlighRules=n.DEFAULT_ACTIVE_CELL_INFO=n.DEFAULT_FORMULA_EDITOR_OPTIONS=n.defaultCalcSource=n.defaultCalcService=n.DEFAULT_PROVIDER=n.DEFAULT_FORMAT_WIDTH_LIMIT=n.DEFAULT_TAB_SIZE=void 0,e=i(35),r=i(789),u=i(465),o=i(129),n.DEFAULT_TAB_SIZE=4,n.DEFAULT_FORMAT_WIDTH_LIMIT="auto",n.DEFAULT_PROVIDER={getStructReferences:function(){return[]},getFunctions:o.getGlobalFunctions},n.defaultCalcService=s(),n.defaultCalcSource=new e.CalcSource(n.defaultCalcService),n.DEFAULT_FORMULA_EDITOR_OPTIONS={formatWidthLimit:n.DEFAULT_FORMAT_WIDTH_LIMIT,tabSize:n.DEFAULT_TAB_SIZE},n.DEFAULT_ACTIVE_CELL_INFO={row:0,col:0},n.defaultSyntaxHighlighRules=[{token:u.SyntaxHighlightingTokenType.stringConst,color:"#CC1C1C"},{token:u.SyntaxHighlightingTokenType.errorConst,color:"#CC1C1C"},{token:u.SyntaxHighlightingTokenType.numberConst,color:"#088000"},{token:u.SyntaxHighlightingTokenType.booleanConst,color:"#088000"},{token:u.SyntaxHighlightingTokenType.function,color:"#1C1CFF"},{token:u.SyntaxHighlightingTokenType.argumentSeparator,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.operatorPrefix,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.operatorInfix,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.operatorPostfix,color:"#FF0000"},{token:u.SyntaxHighlightingTokenType.reference,color:["#0000ff","#008000","#9900cc","#800000","#00cc33","#cc6600","#cc0099"]}],n.defaultTheme={rules:n.defaultSyntaxHighlighRules}},789:function(n){n.exports=t.Spread.Sheets.CalcEngine},833:function(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T,B,_,N,P,F,H,z,W,V,U,$,q,G,J,K,Q,X,Z,Y,tt,nt,it,et,rt,ut,ot,st,ht,ft,at,ct,lt,vt,dt,yt,pt,kt,mt,gt,wt,bt,Mt,xt,St,Ct,Ot,At,Dt,Et,It,Rt,Lt,jt,Tt,Bt,_t,Nt,Pt,Ft,Ht,zt,Wt,Vt,Ut,$t,qt,Gt,Jt,Kt,Qt,Xt,Zt,Yt,tn,nn,en,rn,un,on,sn,hn,fn,an,cn,ln,vn,dn,yn,pn,kn,mn,gn,wn,bn,Mn,xn,Sn,Cn,On,An,Dn,En,In,Rn,Ln,jn,Tn,Bn,_n,Nn,Pn,Fn,Hn,zn,Wn,Vn,Un,$n,qn,Gn,Jn,Kn,Qn,Xn,Zn,Yn,ti,ni,ii,ei,ri,ui,oi,si,hi,fi,ai,ci,li,vi,di,yi,pi,ki,mi,gi,wi,bi,Mi,xi,Si,Ci,Oi,Ai,Di,Ei,Ii,Ri,Li,ji,Ti,Bi,_i,Ni,Pi,Fi,Hi,zi,Wi,Vi,Ui,$i,qi,Gi,Ji,Ki,Qi,Xi,Zi,Yi,te,ne,ie,ee,re,ue,oe,se,he,fe,ae,ce,le,ve,de,ye,pe,ke,me,ge,we,be,Me,xe,Se,Ce,Oe,Ae,De,Ee,Ie,Re,Le,je,Te,Be,_e,Ne,Pe,Fe,He,ze,We,Ve,Ue,$e,qe,Ge,Je,Ke,Qe,Xe,Ze,Ye,tr,nr,ir,er,rr,ur,or,sr,hr,fr,ar,cr,lr,vr,dr,yr,pr,kr,mr,gr,wr,br,Mr,xr,Sr,Cr,Or,Ar,Dr,Er,Ir,Rr,Lr,jr,Tr,Br,_r,Nr,Pr,Fr,Hr,zr,Wr,Vr,Ur,$r,qr,Gr,Jr,Kr,Qr,Xr,Zr,Yr,tu,nu,iu,eu,ru,uu,ou,su,hu,fu,au,cu,lu,vu,du,yu,pu,ku,mu,gu,wu,bu,Mu,xu,Su,Cu,Ou,Au,Du,Eu,Iu,Ru,Lu,ju,Tu,Bu,_u,Nu,Pu,Fu,Hu,zu,Wu,Vu,Uu,$u,qu,Gu,Ju,Ku,Qu,Xu,Zu,Yu,to,no,io,eo,ro,uo,oo,so,ho,fo,ao,co,lo,vo,yo,po,ko,mo,go,wo,bo,Mo,xo,So,Co,Oo,Ao,Do,Eo,Io,Ro,Lo,jo,To,Bo,_o,No,Po,Fo,Ho,zo,Wo,Vo,Uo,$o,qo,Go,Jo,Ko,Qo,Xo,Zo,Yo,ts,ns,is,es,rs,us,os,ss,hs,fs,as,cs,ls,vs,ds,ys,ps,ks,ms,gs,ws,bs,Ms,xs,Ss,Cs,Os,As,Ds,Es,Is,Rs,Ls,js,Ts,Bs,_s,Ns,Ps,Fs,Hs,zs,Ws,Vs,Us,$s,qs,Gs,Js,Ks,Qs,Xs,Zs,Ys,th,nh,ih,eh,rh,uh,oh,sh,hh,fh,ah,ch,lh,vh,dh,yh,ph,kh,mh,gh,wh,bh,Mh,xh,Sh,Ch,Oh,Ah,Dh,Eh,Ih,Rh,Lh,jh,Th,Bh,_h,Nh,Ph,Fh,Hh,zh,Wh,Vh,Uh,$h,qh,Gh,Jh,Kh,Qh,Xh,Zh,Yh,tf,nf,ef,rf,uf,of,sf,hf,ff,af,cf,lf,vf,df,yf,pf,kf,mf,gf,wf,bf,Mf,xf,Sf,Cf,Of,Af,Df,Ef,If,Rf,Lf,jf,Tf,Bf,_f,Nf,Pf,Ff,Hf,zf,Wf,Vf,Uf,$f,qf,Gf,Jf,Kf,Qf,Xf,Zf,Yf,ta,na,ia,ea,ra,ua,oa,sa,ha,fa,aa,ca,la,va,da,ya,pa,ka,ma,ga,wa,ba,Ma,xa,Sa,Ca,Oa,Aa,Da,Ea,Ia,Ra,La,ja,Ta,Ba,_a,Na,Pa,Fa,Ha,za,Wa,Va,Ua,$a,qa;function Ga(t,n,i){return(n=mc(n))in t?Object.defineProperty(t,n,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[n]=i,t}function Ja(t){return Xa(t)||Qa(t)||ec(t)||Ka()}function Ka(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Qa(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function Xa(t){if(Array.isArray(t))return rc(t)}function Za(t,n){return nc(t)||tc(t,n)||ec(t,n)||Ya()}function Ya(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function tc(t,n){var i,e,r,u,o,s,h,f=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=f){o=[],s=!0,h=!1;try{if(r=(f=f.call(t)).next,0===n){if(Object(f)!==f)return;s=!1}else for(;!(s=(i=r.call(f)).done)&&(o.push(i.value),o.length!==n);s=!0);}catch(t){h=!0,e=t}finally{try{if(!s&&null!=f.return&&(u=f.return(),Object(u)!==u))return}finally{if(h)throw e}}return o}}function nc(t){if(Array.isArray(t))return t}function ic(t,n){var i,e,r,u,o,s="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!s){if(Array.isArray(t)||(s=ec(t))||n&&t&&"number"==typeof t.length)return s&&(t=s),i=0,{s:e=function t(){},n:function n(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function t(n){throw n},f:e};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return r=!0,u=!1,{s:function n(){s=s.call(t)},n:function t(){var n=s.next();return r=n.done,n},e:function t(n){u=!0,o=n},f:function t(){try{r||null==s.return||s.return()}finally{if(u)throw o}}}}function ec(t,n){if(t){if("string"==typeof t)return rc(t,n);var i=Object.prototype.toString.call(t).slice(8,-1);return"Object"===i&&t.constructor&&(i=t.constructor.name),"Map"===i||"Set"===i?Array.from(t):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?rc(t,n):void 0}}function rc(t,n){(null==n||n>t.length)&&(n=t.length);for(var i=0,e=new Array(n);i<n;i++)e[i]=t[i];return e}function uc(){return uc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function t(n,i,e){var r,u=oc(n,i);if(u)return(r=Object.getOwnPropertyDescriptor(u,i)).get?r.get.call(arguments.length<3?n:e):r.value},uc.apply(this,arguments)}function oc(t,n){for(;!Object.prototype.hasOwnProperty.call(t,n)&&null!==(t=vc(t)););return t}function sc(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),n&&hc(t,n)}function hc(t,n){return hc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function t(n,i){return n.__proto__=i,n},hc(t,n)}function fc(t){var n=lc();return function i(){var e,r,u=vc(t);return n?(r=vc(this).constructor,e=Reflect.construct(u,arguments,r)):e=u.apply(this,arguments),ac(this,e)}}function ac(t,n){if(n&&("object"===dc(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return cc(t)}function cc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function lc(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function vc(t){return vc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function t(n){return n.__proto__||Object.getPrototypeOf(n)},vc(t)}function dc(t){return dc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dc(t)}function yc(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function pc(t,n){var i,e;for(i=0;i<n.length;i++)(e=n[i]).enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,mc(e.key),e)}function kc(t,n,i){return n&&pc(t.prototype,n),i&&pc(t,i),Object.defineProperty(t,"prototype",{writable:!1}),t}function mc(t){var n=gc(t,"string");return"symbol"===dc(n)?n:String(n)}function gc(t,n){var i,e;if("object"!==dc(t)||null===t)return t;if(void 0!==(i=t[Symbol.toPrimitive])){if("object"!==dc(e=i.call(t,n||"default")))return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}function wc(t){var n,i,e=-1,r=ic(t);try{for(r.s();!(n=r.n()).done;)e+=(i=n.value).length+1}catch(t){r.e(t)}finally{r.f()}return e}function bc(t,n){var i,e,r,u,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e9;for(i=0,e=0,r=!0;e<t.length&&i<=h;e++)(o=i+(u=t[e]).length)>=s&&(o>h&&(u=u.slice(0,h-i)),i<s&&(u=u.slice(s-i)),r?(n[n.length-1]+=u,r=!1):n.push(u)),i=o+1;return n}function Mc(t,n,i){return bc(t,[""],n,i)}for(Object.defineProperty(n,"__esModule",{value:!0}),n.basicSetup=n.View=n.State=n.Search=n.Lint=n.Language=n.Commands=n.Autocomplete=void 0,i=function(){function t(){yc(this,t)}return kc(t,[{key:"lineAt",value:function t(n){if(n<0||n>this.length)throw new RangeError("Invalid position ".concat(n," in document of length ").concat(this.length));return this.lineInner(n,!1,1,0)}},{key:"line",value:function t(n){if(n<1||n>this.lines)throw new RangeError("Invalid line number ".concat(n," in ").concat(this.lines,"-line document"));return this.lineInner(n,!0,1,0)}},{key:"replace",value:function t(n,i,e){var u=[];return this.decompose(0,n,u,2),e.length&&e.decompose(0,e.length,u,3),this.decompose(i,this.length,u,1),r.from(u,this.length-(i-n)+e.length)}},{key:"append",value:function t(n){return this.replace(this.length,this.length,n)}},{key:"slice",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,e=[];return this.decompose(n,i,e,0),r.from(e,i-n)}},{key:"eq",value:function t(n){var i,e,r,o,s,h;if(n==this)return!0;if(n.length!=this.length||n.lines!=this.lines)return!1;for(i=this.scanIdentical(n,1),e=this.length-this.scanIdentical(n,-1),r=new u(this),o=new u(n),s=i,h=i;;){if(r.next(s),o.next(s),s=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(h+=r.value.length,r.done||h>=e)return!0}}},{key:"iter",value:function t(){var n;return new u(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:1)}},{key:"iterRange",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length;return new o(this,n,i)}},{key:"iterLines",value:function t(n,i){var e,r;return null==n?e=this.iter():(null==i&&(i=this.lines+1),r=this.line(n).from,e=this.iterRange(r,Math.max(r,i==this.lines+1?this.length:i<=1?0:this.line(i-1).to))),new s(e)}},{key:"toString",value:function t(){return this.sliceString(0)}},{key:"toJSON",value:function t(){var n=[];return this.flatten(n),n}}],[{key:"of",value:function n(i){if(0==i.length)throw new RangeError("A document must have at least one line");return 1!=i.length||i[0]?i.length<=32?new e(i):r.from(e.split(i,[])):t.empty}}]),t}(),e=function(t){sc(i,t);var n=fc(i);function i(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wc(t);return yc(this,i),(e=n.call(this)).text=t,e.length=r,e}return kc(i,[{key:"lines",get:function t(){return this.text.length}},{key:"children",get:function t(){return null}},{key:"lineInner",value:function t(n,i,e,r){var u,o,s;for(u=0;;u++){if(s=r+(o=this.text[u]).length,(i?e:s)>=n)return new h(r,s,e,o);r=s+1,e++}}},{key:"decompose",value:function t(n,e,r,u){var o,s,h,f=n<=0&&e>=this.length?this:new i(Mc(this.text,n,e),Math.min(e,this.length)-Math.max(0,n));1&u?(o=r.pop(),(s=bc(f.text,o.text.slice(),0,f.length)).length<=32?r.push(new i(s,o.length+f.length)):(h=s.length>>1,r.push(new i(s.slice(0,h)),new i(s.slice(h))))):r.push(f)}},{key:"replace",value:function t(n,e,u){var o,s;return u instanceof i?(o=bc(this.text,bc(u.text,Mc(this.text,0,n)),e),s=this.length+u.length-(e-n),o.length<=32?new i(o,s):r.from(i.split(o,[]),s)):uc(vc(i.prototype),"replace",this).call(this,n,e,u)}},{key:"sliceString",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",h="";for(i=0,e=0;i<=o&&e<this.text.length;e++)i>n&&e&&(h+=s),n<(u=i+(r=this.text[e]).length)&&o>i&&(h+=r.slice(Math.max(0,n-i),o-i)),i=u+1;return h}},{key:"flatten",value:function t(n){var i,e,r=ic(this.text);try{for(r.s();!(i=r.n()).done;)e=i.value,n.push(e)}catch(t){r.e(t)}finally{r.f()}}},{key:"scanIdentical",value:function t(){return 0}}],[{key:"split",value:function t(n,e){var r,u,o=[],s=-1,h=ic(n);try{for(h.s();!(r=h.n()).done;)u=r.value,o.push(u),s+=u.length+1,32==o.length&&(e.push(new i(o,s)),o=[],s=-1)}catch(t){h.e(t)}finally{h.f()}return s>-1&&e.push(new i(o,s)),e}}]),i}(i),r=function(t){sc(i,t);var n=fc(i);function i(t,e){var r,u,o,s;yc(this,i),(r=n.call(this)).children=t,r.length=e,r.lines=0,u=ic(t);try{for(u.s();!(o=u.n()).done;)s=o.value,r.lines+=s.lines}catch(t){u.e(t)}finally{u.f()}return r}return kc(i,[{key:"lineInner",value:function t(n,i,e,r){var u,o,s,h;for(u=0;;u++){if(s=r+(o=this.children[u]).length,h=e+o.lines-1,(i?h:s)>=n)return o.lineInner(n,i,e,r);r=s+1,e=h+1}}},{key:"decompose",value:function t(n,i,e,r){var u,o,s,h,f;for(u=0,o=0;o<=i&&u<this.children.length;u++)n<=(h=o+(s=this.children[u]).length)&&i>=o&&(f=r&((o<=n?1:0)|(h>=i?2:0)),o>=n&&h<=i&&!f?e.push(s):s.decompose(n-o,i-o,e,f)),o=h+1}},{key:"replace",value:function t(n,e,r){var u,o,s,h,f,a,c;if(r.lines<this.lines)for(u=0,o=0;u<this.children.length;u++){if(h=o+(s=this.children[u]).length,n>=o&&e<=h)return f=s.replace(n-o,e-o,r),a=this.lines-s.lines+f.lines,f.lines<a>>4&&f.lines>a>>6?((c=this.children.slice())[u]=f,new i(c,this.length-(e-n)+r.length)):uc(vc(i.prototype),"replace",this).call(this,o,h,f);o=h+1}return uc(vc(i.prototype),"replace",this).call(this,n,e,r)}},{key:"sliceString",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"\n",h="";for(i=0,e=0;i<this.children.length&&e<=o;i++)e>n&&i&&(h+=s),n<(u=e+(r=this.children[i]).length)&&o>e&&(h+=r.sliceString(n-e,o-e,s)),e=u+1;return h}},{key:"flatten",value:function t(n){var i,e,r=ic(this.children);try{for(r.s();!(i=r.n()).done;)(e=i.value).flatten(n)}catch(t){r.e(t)}finally{r.f()}}},{key:"scanIdentical",value:function t(n,e){var r,u,o,s,h,f,a,c,l;if(!(n instanceof i))return 0;for(r=0,s=(o=Za(u=e>0?[0,0,this.children.length,n.children.length]:[this.children.length-1,n.children.length-1,-1,-1],4))[0],h=o[1],f=o[2],a=o[3];;s+=e,h+=e){if(s==f||h==a)return r;if((c=this.children[s])!=(l=n.children[h]))return r+c.scanIdentical(l,e);r+=c.length+1}}}],[{key:"from",value:function t(n){var r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.reduce((function(t,n){return t+n.length+1}),-1),b=0,M=ic(n);try{for(M.s();!(r=M.n()).done;)b+=(u=r.value).lines}catch(t){M.e(t)}finally{M.f()}if(b<32){o=[],s=ic(n);try{for(s.s();!(h=s.n()).done;)(f=h.value).flatten(o)}catch(t){s.e(t)}finally{s.f()}return new e(o,w)}function x(t){var n,r,u,o;if(t.lines>c&&t instanceof i){r=ic(t.children);try{for(r.s();!(u=r.n()).done;)x(o=u.value)}catch(t){r.e(t)}finally{r.f()}}else t.lines>l&&(d>l||!d)?(S(),v.push(t)):t instanceof e&&d&&(n=p[p.length-1])instanceof e&&t.lines+n.lines<=32?(d+=t.lines,y+=t.length+1,p[p.length-1]=new e(n.text.concat(t.text),n.length+1+t.length)):(d+t.lines>a&&S(),d+=t.lines,y+=t.length+1,p.push(t))}function S(){0!=d&&(v.push(1==p.length?p[0]:i.from(p,y)),y=-1,d=p.length=0)}a=Math.max(32,b>>5),c=a<<1,l=a>>1,v=[],d=0,y=-1,p=[],k=ic(n);try{for(k.s();!(m=k.n()).done;)x(g=m.value)}catch(t){k.e(t)}finally{k.f()}return S(),1==v.length?v[0]:new i(v,w)}}]),i}(i),i.empty=new e([""],0),u=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;yc(this,t),this.dir=i,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[n],this.offsets=[i>0?1:(n instanceof e?n.text.length:n.children.length)<<1]}return kc(t,[{key:"nextInner",value:function t(n,i){var r,u,o,s,h,f,a;for(this.done=this.lineBreak=!1;;)if(r=this.nodes.length-1,u=this.nodes[r],s=(o=this.offsets[r])>>1,h=u instanceof e?u.text.length:u.children.length,s==(i>0?h:0)){if(0==r)return this.done=!0,this.value="",this;i>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&o)==(i>0?0:1)){if(this.offsets[r]+=i,0==n)return this.lineBreak=!0,this.value="\n",this;n--}else if(u instanceof e){if(f=u.text[s+(i<0?-1:0)],this.offsets[r]+=i,f.length>Math.max(0,n))return this.value=0==n?f:i>0?f.slice(n):f.slice(0,f.length-n),this;n-=f.length}else n>(a=u.children[s+(i<0?-1:0)]).length?(n-=a.length,this.offsets[r]+=i):(i<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(i>0?1:(a instanceof e?a.text.length:a.children.length)<<1))}},{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return n<0&&(this.nextInner(-n,-this.dir),n=this.value.length),this.nextInner(n,this.dir)}}]),t}(),o=function(){function t(n,i,e){yc(this,t),this.value="",this.done=!1,this.cursor=new u(n,i>e?-1:1),this.pos=i>e?n.length:0,this.from=Math.min(i,e),this.to=Math.max(i,e)}return kc(t,[{key:"nextInner",value:function t(n,i){var e,r,u;return(i<0?this.pos<=this.from:this.pos>=this.to)?(this.value="",this.done=!0,this):((n+=Math.max(0,i<0?this.pos-this.to:this.from-this.pos))>(e=i<0?this.pos-this.from:this.to-this.pos)&&(n=e),e-=n,u=(r=this.cursor.next(n)).value,this.pos+=(u.length+n)*i,this.value=u.length<=e?u:i<0?u.slice(u.length-e):u.slice(0,e),this.done=!this.value,this)}},{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return n<0?n=Math.max(n,this.from-this.pos):n>0&&(n=Math.min(n,this.to-this.pos)),this.nextInner(n,this.cursor.dir)}},{key:"lineBreak",get:function t(){return this.cursor.lineBreak&&""!=this.value}}]),t}(),s=function(){function t(n){yc(this,t),this.inner=n,this.afterBreak=!0,this.value="",this.done=!1}return kc(t,[{key:"next",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=this.inner.next(n),e=i.done,r=i.lineBreak,u=i.value;return e?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=u,this.afterBreak=!1),this}},{key:"lineBreak",get:function t(){return!1}}]),t}(),"undefined"!=typeof Symbol&&(i.prototype[Symbol.iterator]=function(){return this.iter()},u.prototype[Symbol.iterator]=o.prototype[Symbol.iterator]=s.prototype[Symbol.iterator]=function(){return this}),h=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.number=e,this.text=r}return kc(t,[{key:"length",get:function t(){return this.to-this.from}}]),t}(),f="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((function(t){return t?parseInt(t,36):1})),a=1;a<f.length;a++)f[a]+=f[a-1];function xc(t){for(var n=1;n<f.length;n+=2)if(f[n]>t)return f[n-1]<=t;return!1}function Sc(t){return t>=127462&&t<=127487}function Cc(t,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],e=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return(i?Oc:Ac)(t,n,e)}function Oc(t,n,i){var e,r,u,o;if(n==t.length)return n;for(n&&Dc(t.charCodeAt(n))&&Ec(t.charCodeAt(n-1))&&n--,n+=Lc(e=Ic(t,n));n<t.length;)if(r=Ic(t,n),e==c||r==c||i&&xc(r))n+=Lc(r),e=r;else{if(!Sc(r))break;for(u=0,o=n-2;o>=0&&Sc(Ic(t,o));)u++,o-=2;if(u%2==0)break;n+=2}return n}function Ac(t,n,i){for(;n>0;){var e=Oc(t,n-2,i);if(e<n)return e;n--}return 0}function Dc(t){return t>=56320&&t<57344}function Ec(t){return t>=55296&&t<56320}function Ic(t,n){var i,e=t.charCodeAt(n);return Ec(e)&&n+1!=t.length&&Dc(i=t.charCodeAt(n+1))?i-56320+(e-55296<<10)+65536:e}function Rc(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Lc(t){return t<65536?1:2}function jc(t,n,i){var e,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];0==n&&i<=0||((e=t.length-2)>=0&&i<=0&&i==t[e+1]?t[e]+=n:0==n&&0==t[e]?t[e+1]+=i:r?(t[e]+=n,t[e+1]+=i):t.push(n,i))}function Tc(t,n,e){if(0!=e.length){var r=n.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(e);else{for(;t.length<r;)t.push(i.empty);t.push(e)}}}function Bc(t,n,e){var r,u,o,s,h,f,a,c,l=t.inserted;for(r=0,u=0,o=0;o<t.sections.length;)if(s=t.sections[o++],(h=t.sections[o++])<0)r+=s,u+=s;else{for(f=r,a=u,c=i.empty;f+=s,a+=h,h&&l&&(c=c.append(l[o-2>>1])),!(e||o==t.sections.length||t.sections[o+1]<0);)s=t.sections[o++],h=t.sections[o++];n(r,f,u,a,c),r=f,u=a}}function _c(t,n,i){var e,r,u,o,s,h,f,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=[],l=a?[]:null,v=new p(t),k=new p(n);for(e=-1;;)if(-1==v.ins&&-1==k.ins)jc(c,r=Math.min(v.len,k.len),-1),v.forward(r),k.forward(r);else if(k.ins>=0&&(v.ins<0||e==v.i||0==v.off&&(k.len<v.len||k.len==v.len&&!i))){for(u=k.len,jc(c,k.ins,-1);u;)o=Math.min(v.len,u),v.ins>=0&&e<v.i&&v.len<=o&&(jc(c,0,v.ins),l&&Tc(l,c,v.text),e=v.i),v.forward(o),u-=o;k.next()}else{if(!(v.ins>=0)){if(v.done&&k.done)return l?y.createSet(c,l):d.create(c);throw new Error("Mismatched change set lengths")}for(s=0,h=v.len;h;)if(-1==k.ins)s+=f=Math.min(h,k.len),h-=f,k.forward(f);else{if(!(0==k.ins&&k.len<h))break;h-=k.len,k.next()}jc(c,s,e<v.i?v.ins:0),l&&e<v.i&&Tc(l,c,v.text),e=v.i,v.forward(v.len-h)}}function Nc(t,n){var i,e,r,u,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=[],h=o?[]:null,f=new p(t),a=new p(n);for(i=!1;;){if(f.done&&a.done)return h?y.createSet(s,h):d.create(s);if(0==f.ins)jc(s,f.len,0,i),f.next();else if(0!=a.len||a.done){if(f.done||a.done)throw new Error("Mismatched change set lengths");e=Math.min(f.len2,a.len),r=s.length,-1==f.ins?(jc(s,e,u=-1==a.ins?-1:a.off?0:a.ins,i),h&&u&&Tc(h,s,a.text)):-1==a.ins?(jc(s,f.off?0:f.len,e,i),h&&Tc(h,s,f.textBit(e))):(jc(s,f.off?0:f.len,a.off?0:a.ins,i),h&&!a.off&&Tc(h,s,a.text)),i=(f.ins>e||a.ins>=0&&a.len>e)&&(i||s.length>r),f.forward2(e),a.forward(e)}else jc(s,0,a.ins,i),h&&Tc(h,s,a.text),a.next()}}function Pc(t,n){var i,e,r=ic(t.ranges);try{for(r.s();!(i=r.n()).done;)if((e=i.value).to>n)throw new RangeError("Selection points outside of document")}catch(t){r.e(t)}finally{r.f()}}function Fc(t,n){return t==n||t.length==n.length&&t.every((function(t,i){return t===n[i]}))}function Hc(t,n,i){if(t.length!=n.length)return!1;for(var e=0;e<t.length;e++)if(!i(t[e],n[e]))return!1;return!0}function zc(t,n){var i,e,r=!1,u=ic(n);try{for(u.s();!(i=u.n()).done;)1&$c(t,e=i.value)&&(r=!0)}catch(t){u.e(t)}finally{u.f()}return r}function Wc(t,n,i){var e=i.map((function(n){return t[n.id]})),r=i.map((function(t){return t.type})),u=e.filter((function(t){return!(1&t)})),o=t[n.id]>>1;function s(t){var i,u,o,s,h,f=[];for(i=0;i<e.length;i++)if(u=qc(t,e[i]),2==r[i]){o=ic(u);try{for(o.s();!(s=o.n()).done;)h=s.value,f.push(h)}catch(t){o.e(t)}finally{o.f()}}else f.push(u);return n.combine(f)}return{create:function t(n){var i,r,u=ic(e);try{for(u.s();!(i=u.n()).done;)$c(n,r=i.value)}catch(t){u.e(t)}finally{u.f()}return n.values[o]=s(n),1},update:function t(i,e){if(!zc(i,u))return 0;var r=s(i);return n.compare(r,i.values[o])?0:(i.values[o]=r,1)},reconfigure:function t(r,u){var h,f=zc(r,e),a=u.config.facets[n.id],c=u.facet(n);return a&&!f&&Fc(i,a)?(r.values[o]=c,0):(h=s(r),n.compare(h,c)?(r.values[o]=c,0):(r.values[o]=h,1))}}}function Vc(t){return function(n){return new I(n,t)}}function Uc(t,n,i){var e=[[],[],[],[],[]],r=new Map;function u(t,o){var s,h,f,a,c,l,v=r.get(t);if(null!=v){if(v<=o)return;(s=e[v].indexOf(t))>-1&&e[v].splice(s,1),t instanceof L&&i.delete(t.compartment)}if(r.set(t,o),Array.isArray(t)){h=ic(t);try{for(h.s();!(f=h.n()).done;)u(a=f.value,o)}catch(t){h.e(t)}finally{h.f()}}else if(t instanceof L){if(i.has(t.compartment))throw new RangeError("Duplicate use of compartment in extensions");c=n.get(t.compartment)||t.inner,i.set(t.compartment,c),u(c,o)}else if(t instanceof I)u(t.inner,t.prec);else if(t instanceof x)e[o].push(t),t.provides&&u(t.provides,o);else if(t instanceof b)e[o].push(t),t.facet.extensions&&u(t.facet.extensions,O);else{if(!(l=t.extension))throw new Error("Unrecognized extension value in extension set (".concat(t,"). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks."));u(l,o)}}return u(t,O),e.reduce((function(t,n){return t.concat(n)}))}function $c(t,n){var i,e,r;if(1&n)return 2;if(i=n>>1,4==(e=t.status[i]))throw new Error("Cyclic dependency between fields and/or facets");return 2&e?e:(t.status[i]=4,r=t.computeSlot(t,t.config.dynamicSlots[i]),t.status[i]=2|r)}function qc(t,n){return 1&n?t.config.staticValues[n>>1]:t.values[n>>1]}function Gc(t,n){var i,e,r,u,o=[];for(i=0,e=0;;){if(r=void 0,u=void 0,i<t.length&&(e==n.length||n[e]>=t[i]))r=t[i++],u=t[i++];else{if(!(e<n.length))return o;r=n[e++],u=n[e++]}!o.length||o[o.length-1]<r?o.push(r,u):o[o.length-1]<u&&(o[o.length-1]=u)}}function Jc(t,n,i){var e,r,u,o;return i?(r=n.changes,u=y.empty(n.changes.length),o=t.changes.compose(n.changes)):(r=n.changes.map(t.changes),u=t.changes.mapDesc(n.changes,!0),o=t.changes.compose(r)),{changes:o,selection:n.selection?n.selection.map(u):null===(e=t.selection)||void 0===e?void 0:e.map(r),effects:U.mapEffects(t.effects,r).concat(U.mapEffects(n.effects,u)),annotations:t.annotations.length?t.annotations.concat(n.annotations):n.annotations,scrollIntoView:t.scrollIntoView||n.scrollIntoView}}function Kc(t,n,i){var e=n.selection,r=Yc(n.annotations);return n.userEvent&&(r=r.concat($.userEvent.of(n.userEvent))),{changes:n.changes instanceof y?n.changes:y.of(n.changes||[],i,t.facet(_)),selection:e&&(e instanceof m?e:m.single(e.anchor,e.head)),effects:Yc(n.effects),annotations:r,scrollIntoView:!!n.scrollIntoView}}function Qc(t,n,i){var e,r,u,o=Kc(t,n.length?n[0]:{},t.doc.length);for(n.length&&!1===n[0].filter&&(i=!1),e=1;e<n.length;e++)!1===n[e].filter&&(i=!1),r=!!n[e].sequential,o=Jc(o,Kc(t,n[e],r?o.changes.newLength:t.doc.length),r);return u=$.create(t,o.changes,o.selection,o.effects,o.annotations,o.scrollIntoView),Zc(i?Xc(u):u)}function Xc(t){var n,i,e,r,u,o,s,h,f,a=t.startState,c=!0,l=ic(a.facet(N));try{for(l.s();!(n=l.n()).done;){if(!1===(e=(i=n.value)(t))){c=!1;break}Array.isArray(e)&&(c=!0===c?e:Gc(c,e))}}catch(t){l.e(t)}finally{l.f()}for(!0!==c&&(!1===c?(u=t.changes.invertedDesc,r=y.empty(a.doc.length)):(r=(o=t.changes.filter(c)).changes,u=o.filtered.mapDesc(o.changes).invertedDesc),t=$.create(a,r,t.selection&&t.selection.map(u),U.mapEffects(t.effects,u),t.annotations,t.scrollIntoView)),h=(s=a.facet(P)).length-1;h>=0;h--)t=(f=s[h](t))instanceof $?f:Array.isArray(f)&&1==f.length&&f[0]instanceof $?f[0]:Qc(a,Yc(f),!1);return t}function Zc(t){var n,i,e=t.startState,r=e.facet(F),u=t;for(n=r.length-1;n>=0;n--)(i=r[n](t))&&Object.keys(i).length&&(u=Jc(u,Kc(e,i,t.changes.newLength),!0));return u==t?t:$.create(e,t.changes,t.selection,u.effects,u.annotations,u.scrollIntoView)}function Yc(t){return null==t?q:Array.isArray(t)?t:[t]}c=8205,l=/\r\n?|\n/,v=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(v||(v={})),d=function(){function t(n){yc(this,t),this.sections=n}return kc(t,[{key:"length",get:function t(){var n,i=0;for(n=0;n<this.sections.length;n+=2)i+=this.sections[n];return i}},{key:"newLength",get:function t(){var n,i,e=0;for(n=0;n<this.sections.length;n+=2)e+=(i=this.sections[n+1])<0?this.sections[n]:i;return e}},{key:"empty",get:function t(){return 0==this.sections.length||2==this.sections.length&&this.sections[1]<0}},{key:"iterGaps",value:function t(n){var i,e,r,u,o;for(i=0,e=0,r=0;i<this.sections.length;)u=this.sections[i++],(o=this.sections[i++])<0?(n(e,r,u),r+=u):r+=o,e+=u}},{key:"iterChangedRanges",value:function t(n){var i;Bc(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"invertedDesc",get:function n(){var i,e,r,u=[];for(i=0;i<this.sections.length;)e=this.sections[i++],(r=this.sections[i++])<0?u.push(e,r):u.push(r,e);return new t(u)}},{key:"composeDesc",value:function t(n){return this.empty?n:n.empty?this:Nc(this,n)}},{key:"mapDesc",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.empty?this:_c(this,n,i)}},{key:"mapPos",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:v.Simple,h=0,f=0;for(i=0;i<this.sections.length;){if(u=h+(e=this.sections[i++]),(r=this.sections[i++])<0){if(u>n)return f+(n-h);f+=e}else{if(s!=v.Simple&&u>=n&&(s==v.TrackDel&&h<n&&u>n||s==v.TrackBefore&&h<n||s==v.TrackAfter&&u>n))return null;if(u>n||u==n&&o<0&&!e)return n==h||o<0?f:f+r;f+=r}h=u}if(n>h)throw new RangeError("Position ".concat(n," is out of range for changeset of length ").concat(h));return f}},{key:"touchesRange",value:function t(n){var i,e,r,u,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;for(i=0,e=0;i<this.sections.length&&e<=s;){if(o=e+(r=this.sections[i++]),(u=this.sections[i++])>=0&&e<=s&&o>=n)return!(e<n&&o>s)||"cover";e=o}return!1}},{key:"toString",value:function t(){var n,i,e,r="";for(n=0;n<this.sections.length;)r+=(r?" ":"")+(i=this.sections[n++])+((e=this.sections[n++])>=0?":"+e:"");return r}},{key:"toJSON",value:function t(){return this.sections}}],[{key:"fromJSON",value:function n(i){if(!Array.isArray(i)||i.length%2||i.some((function(t){return"number"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(i)}},{key:"create",value:function n(i){return new t(i)}}]),t}(),y=function(t){sc(e,t);var n=fc(e);function e(t,i){var r;return yc(this,e),(r=n.call(this,t)).inserted=i,r}return kc(e,[{key:"apply",value:function t(n){if(this.length!=n.length)throw new RangeError("Applying change set to a document with the wrong length");return Bc(this,(function(t,i,e,r,u){return n=n.replace(e,e+(i-t),u)}),!1),n}},{key:"mapDesc",value:function t(n){var i;return _c(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1],!0)}},{key:"invert",value:function t(n){var r,u,o,s,h,f=this.sections.slice(),a=[];for(r=0,u=0;r<f.length;r+=2){if(o=f[r],(s=f[r+1])>=0){for(f[r]=s,f[r+1]=o,h=r>>1;a.length<h;)a.push(i.empty);a.push(o?n.slice(u,u+o):i.empty)}u+=o}return new e(f,a)}},{key:"compose",value:function t(n){return this.empty?n:n.empty?this:Nc(this,n,!0)}},{key:"map",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return n.empty?this:_c(this,n,i,!0)}},{key:"iterChanges",value:function t(n){var i;Bc(this,n,arguments.length>1&&void 0!==arguments[1]&&arguments[1])}},{key:"desc",get:function t(){return d.create(this.sections)}},{key:"filter",value:function t(n){var i,r,u,o,s,h,f,a=[],c=[],l=[],v=new p(this);t:for(i=0,r=0;;){for(u=i==n.length?1e9:n[i++];r<u||r==u&&0==v.len;){if(v.done)break t;jc(l,o=Math.min(v.len,u-r),-1),jc(a,o,s=-1==v.ins?-1:0==v.off?v.ins:0),s>0&&Tc(c,a,v.text),v.forward(o),r+=o}for(h=n[i++];r<h;){if(v.done)break t;jc(a,f=Math.min(v.len,h-r),-1),jc(l,f,-1==v.ins?-1:0==v.off?v.ins:0),v.forward(f),r+=f}}return{changes:new e(a,c),filtered:d.create(l)}}},{key:"toJSON",value:function t(){var n,i,e,r=[];for(n=0;n<this.sections.length;n+=2)i=this.sections[n],(e=this.sections[n+1])<0?r.push(i):0==e?r.push([i]):r.push([i].concat(this.inserted[n>>1].toJSON()));return r}}],[{key:"of",value:function t(n,r,u){var o=[],s=[],h=0,f=null;function a(){var t,n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(n||o.length)&&(h<r&&jc(o,r-h,-1),t=new e(o,s),f=f?f.compose(t.map(f)):t,o=[],s=[],h=0)}function c(t){var n,v,d,y,p,k,m,g,w;if(Array.isArray(t)){n=ic(t);try{for(n.s();!(v=n.n()).done;)c(d=v.value)}catch(t){n.e(t)}finally{n.f()}}else if(t instanceof e){if(t.length!=r)throw new RangeError("Mismatched change set length (got ".concat(t.length,", expected ").concat(r,")"));a(),f=f?f.compose(t.map(f)):t}else{if(y=t.from,k=void 0===(p=t.to)?y:p,m=t.insert,y>k||y<0||k>r)throw new RangeError("Invalid change range ".concat(y," to ").concat(k," (in doc of length ").concat(r,")"));if(w=(g=m?"string"==typeof m?i.of(m.split(u||l)):m:i.empty).length,y==k&&0==w)return;y<h&&a(),y>h&&jc(o,y-h,-1),jc(o,k-y,w),Tc(s,o,g),h=k}}return c(n),a(!f),f}},{key:"empty",value:function t(n){return new e(n?[n,-1]:[],[])}},{key:"fromJSON",value:function t(n){var r,u,o,s;if(!Array.isArray(n))throw new RangeError("Invalid JSON representation of ChangeSet");for(r=[],u=[],o=0;o<n.length;o++)if("number"==typeof(s=n[o]))r.push(s,-1);else{if(!Array.isArray(s)||"number"!=typeof s[0]||s.some((function(t,n){return n&&"string"!=typeof t})))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==s.length)r.push(s[0],0);else{for(;u.length<o;)u.push(i.empty);u[o]=i.of(s.slice(1)),r.push(s[0],u[o].length)}}return new e(r,u)}},{key:"createSet",value:function t(n,i){return new e(n,i)}}]),e}(d),p=function(){function t(n){yc(this,t),this.set=n,this.i=0,this.next()}return kc(t,[{key:"next",value:function t(){var n=this.set.sections;this.i<n.length?(this.len=n[this.i++],this.ins=n[this.i++]):(this.len=0,this.ins=-2),this.off=0}},{key:"done",get:function t(){return-2==this.ins}},{key:"len2",get:function t(){return this.ins<0?this.len:this.ins}},{key:"text",get:function t(){var n=this.set.inserted,e=this.i-2>>1;return e>=n.length?i.empty:n[e]}},{key:"textBit",value:function t(n){var e=this.set.inserted,r=this.i-2>>1;return r>=e.length&&!n?i.empty:e[r].slice(this.off,null==n?void 0:this.off+n)}},{key:"forward",value:function t(n){n==this.len?this.next():(this.len-=n,this.off+=n)}},{key:"forward2",value:function t(n){-1==this.ins?this.forward(n):n==this.ins?this.next():(this.ins-=n,this.off+=n)}}]),t}(),k=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.flags=e}return kc(t,[{key:"anchor",get:function t(){return 16&this.flags?this.to:this.from}},{key:"head",get:function t(){return 16&this.flags?this.from:this.to}},{key:"empty",get:function t(){return this.from==this.to}},{key:"assoc",get:function t(){return 4&this.flags?-1:8&this.flags?1:0}},{key:"bidiLevel",get:function t(){var n=3&this.flags;return 3==n?null:n}},{key:"goalColumn",get:function t(){var n=this.flags>>5;return 33554431==n?void 0:n}},{key:"map",value:function n(i){var e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return this.empty?e=r=i.mapPos(this.from,u):(e=i.mapPos(this.from,1),r=i.mapPos(this.to,-1)),e==this.from&&r==this.to?this:new t(e,r,this.flags)}},{key:"extend",value:function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return n<=this.anchor&&e>=this.anchor?m.range(n,e):(i=Math.abs(n-this.anchor)>Math.abs(e-this.anchor)?n:e,m.range(this.anchor,i))}},{key:"eq",value:function t(n){return this.anchor==n.anchor&&this.head==n.head}},{key:"toJSON",value:function t(){return{anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function t(n){if(!n||"number"!=typeof n.anchor||"number"!=typeof n.head)throw new RangeError("Invalid JSON representation for SelectionRange");return m.range(n.anchor,n.head)}},{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),m=function(){function t(n,i){yc(this,t),this.ranges=n,this.mainIndex=i}return kc(t,[{key:"map",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;return i.empty?this:t.create(this.ranges.map((function(t){return t.map(i,e)})),this.mainIndex)}},{key:"eq",value:function t(n){if(this.ranges.length!=n.ranges.length||this.mainIndex!=n.mainIndex)return!1;for(var i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(n.ranges[i]))return!1;return!0}},{key:"main",get:function t(){return this.ranges[this.mainIndex]}},{key:"asSingle",value:function n(){return 1==this.ranges.length?this:new t([this.main],0)}},{key:"addRange",value:function n(i){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t.create([i].concat(this.ranges),e?0:this.mainIndex+1)}},{key:"replaceRange",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.mainIndex,r=this.ranges.slice();return r[e]=i,t.create(r,this.mainIndex)}},{key:"toJSON",value:function t(){return{ranges:this.ranges.map((function(t){return t.toJSON()})),main:this.mainIndex}}}],[{key:"fromJSON",value:function n(i){if(!i||!Array.isArray(i.ranges)||"number"!=typeof i.main||i.main>=i.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(i.ranges.map((function(t){return k.fromJSON(t)})),i.main)}},{key:"single",value:function n(i){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:i;return new t([t.range(i,e)],0)}},{key:"create",value:function n(i){var e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(0==i.length)throw new RangeError("A selection needs at least one range");for(e=0,r=0;r<i.length;r++){if((u=i[r]).empty?u.from<=e:u.from<e)return t.normalized(i.slice(),o);e=u.to}return new t(i,o)}},{key:"cursor",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return k.create(n,n,(0==i?0:i<0?4:8)|(null==e?3:Math.min(2,e))|(null!=r?r:33554431)<<5)}},{key:"range",value:function t(n,i,e,r){var u=(null!=e?e:33554431)<<5|(null==r?3:Math.min(2,r));return i<n?k.create(i,n,24|u):k.create(n,i,(i>n?4:0)|u)}},{key:"normalized",value:function n(i){var e,r,u,o,s,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,f=i[h];for(i.sort((function(t,n){return t.from-n.from})),h=i.indexOf(f),e=1;e<i.length;e++)r=i[e],u=i[e-1],(r.empty?r.from<=u.to:r.from<u.to)&&(o=u.from,s=Math.max(r.to,u.to),e<=h&&h--,i.splice(--e,2,r.anchor>r.head?t.range(s,o):t.range(o,s)));return new t(i,h)}}]),t}(),g=0,w=function(){function t(n,i,e,r,u){yc(this,t),this.combine=n,this.compareInput=i,this.compare=e,this.isStatic=r,this.id=g++,this.default=n([]),this.extensions="function"==typeof u?u(this):u}return kc(t,[{key:"of",value:function t(n){return new b([],this,0,n)}},{key:"compute",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new b(n,this,1,i)}},{key:"computeN",value:function t(n,i){if(this.isStatic)throw new Error("Can't compute a static facet");return new b(n,this,2,i)}},{key:"from",value:function t(n,i){return i||(i=function t(n){return n}),this.compute([n],(function(t){return i(t.field(n))}))}}],[{key:"define",value:function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new t(i.combine||function(t){return t},i.compareInput||function(t,n){return t===n},i.compare||(i.combine?function(t,n){return t===n}:Fc),!!i.static,i.enables)}}]),t}(),b=function(){function t(n,i,e,r){yc(this,t),this.dependencies=n,this.facet=i,this.type=e,this.value=r,this.id=g++}return kc(t,[{key:"dynamicSlot",value:function t(n){var i,e,r,u=this,o=this.value,s=this.facet.compareInput,h=this.id,f=n[h]>>1,a=2==this.type,c=!1,l=!1,v=[],d=ic(this.dependencies);try{for(d.s();!(e=d.n()).done;)"doc"==(r=e.value)?c=!0:"selection"==r?l=!0:1&(null!==(i=n[r.id])&&void 0!==i?i:1)||v.push(n[r.id])}catch(t){d.e(t)}finally{d.f()}return{create:function t(n){return n.values[f]=o(n),1},update:function t(n,i){if(c&&i.docChanged||l&&(i.docChanged||i.selection)||zc(n,v)){var e=o(n);if(a?!Hc(e,n.values[f],s):!s(e,n.values[f]))return n.values[f]=e,1}return 0},reconfigure:function t(n,i){var e,r,c=i.config.address[h];if(null!=c){if(r=qc(i,c),u.dependencies.every((function(t){return t instanceof w?i.facet(t)===n.facet(t):!(t instanceof x)||i.field(t,!1)==n.field(t,!1)}))||(a?Hc(e=o(n),r,s):s(e=o(n),r)))return n.values[f]=r,0}else e=o(n);return n.values[f]=e,1}}}}]),t}(),M=w.define({static:!0}),x=function(){function t(n,i,e,r,u){yc(this,t),this.id=n,this.createF=i,this.updateF=e,this.compareF=r,this.spec=u,this.provides=void 0}return kc(t,[{key:"create",value:function t(n){var i=this,e=n.facet(M).find((function(t){return t.field==i}));return((null==e?void 0:e.create)||this.createF)(n)}},{key:"slot",value:function t(n){var i=this,e=n[this.id]>>1;return{create:function t(n){return n.values[e]=i.create(n),1},update:function t(n,r){var u=n.values[e],o=i.updateF(u,r);return i.compareF(u,o)?0:(n.values[e]=o,1)},reconfigure:function t(n,r){return null!=r.config.address[i.id]?(n.values[e]=r.field(i),0):(n.values[e]=i.create(n),1)}}}},{key:"init",value:function t(n){return[this,M.of({field:this,create:n})]}},{key:"extension",get:function t(){return this}}],[{key:"define",value:function n(i){var e=new t(g++,i.create,i.update,i.compare||function(t,n){return t===n},i);return i.provide&&(e.provides=i.provide(e)),e}}]),t}(),S=4,C=3,O=2,A=1,E={highest:Vc(D=0),high:Vc(A),default:Vc(O),low:Vc(C),lowest:Vc(S)},I=kc((function t(n,i){yc(this,t),this.inner=n,this.prec=i})),R=function(){function t(){yc(this,t)}return kc(t,[{key:"of",value:function t(n){return new L(this,n)}},{key:"reconfigure",value:function n(i){return t.reconfigure.of({compartment:this,extension:i})}},{key:"get",value:function t(n){return n.config.compartments.get(this)}}]),t}(),L=kc((function t(n,i){yc(this,t),this.compartment=n,this.inner=i})),j=function(){function t(n,i,e,r,u,o){for(yc(this,t),this.base=n,this.compartments=i,this.dynamicSlots=e,this.address=r,this.staticValues=u,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<e.length;)this.statusTemplate.push(0)}return kc(t,[{key:"staticFacet",value:function t(n){var i=this.address[n.id];return null==i?n.default:this.staticValues[i>>1]}}],[{key:"resolve",value:function n(i,e,r){var u,o,s,h,f,a,c,l,v,d,y,p,k=[],m=Object.create(null),g=new Map,w=ic(Uc(i,e,g));try{for(w.s();!(u=w.n()).done;)(o=u.value)instanceof x?k.push(o):(m[o.facet.id]||(m[o.facet.id]=[])).push(o)}catch(t){w.e(t)}finally{w.f()}for(s=Object.create(null),h=[],f=[],a=function t(){var n=l[c];s[n.id]=f.length<<1,f.push((function(t){return n.slot(t)}))},c=0,l=k;c<l.length;c++)a();for(y in v=null==r?void 0:r.config.facets,d=function t(){var n,i,e,u,o=m[y],a=o[0].facet,c=v&&v[y]||[];if(o.every((function(t){return 0==t.type})))s[a.id]=h.length<<1|1,Fc(c,o)?h.push(r.facet(a)):(n=a.combine(o.map((function(t){return t.value}))),h.push(r&&a.compare(n,r.facet(a))?r.facet(a):n));else{i=ic(o);try{for(u=function t(){var n=e.value;0==n.type?(s[n.id]=h.length<<1|1,h.push(n.value)):(s[n.id]=f.length<<1,f.push((function(t){return n.dynamicSlot(t)})))},i.s();!(e=i.n()).done;)u()}catch(t){i.e(t)}finally{i.f()}s[a.id]=f.length<<1,f.push((function(t){return Wc(t,a,o)}))}},m)d();return new t(i,g,p=f.map((function(t){return t(s)})),s,h,m)}}]),t}(),T=w.define(),B=w.define({combine:function t(n){return n.some((function(t){return t}))},static:!0}),_=w.define({combine:function t(n){return n.length?n[0]:void 0},static:!0}),N=w.define(),P=w.define(),F=w.define(),H=w.define({combine:function t(n){return!!n.length&&n[0]}}),z=function(){function t(n,i){yc(this,t),this.type=n,this.value=i}return kc(t,null,[{key:"define",value:function t(){return new W}}]),t}(),W=function(){function t(){yc(this,t)}return kc(t,[{key:"of",value:function t(n){return new z(this,n)}}]),t}(),V=function(){function t(n){yc(this,t),this.map=n}return kc(t,[{key:"of",value:function t(n){return new U(this,n)}}]),t}(),U=function(){function t(n,i){yc(this,t),this.type=n,this.value=i}return kc(t,[{key:"map",value:function n(i){var e=this.type.map(this.value,i);return void 0===e?void 0:e==this.value?this:new t(this.type,e)}},{key:"is",value:function t(n){return this.type==n}}],[{key:"define",value:function t(){var n;return new V((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).map||function(t){return t})}},{key:"mapEffects",value:function t(n,i){var e,r,u,o,s;if(!n.length)return n;e=[],r=ic(n);try{for(r.s();!(u=r.n()).done;)(s=(o=u.value).map(i))&&e.push(s)}catch(t){r.e(t)}finally{r.f()}return e}}]),t}(),U.reconfigure=U.define(),U.appendConfig=U.define(),$=function(){function t(n,i,e,r,u,o){yc(this,t),this.startState=n,this.changes=i,this.selection=e,this.effects=r,this.annotations=u,this.scrollIntoView=o,this.Qae=null,this.Kh=null,e&&Pc(e,i.newLength),u.some((function(n){return n.type==t.time}))||(this.annotations=u.concat(t.time.of(Date.now())))}return kc(t,[{key:"newDoc",get:function t(){return this.Qae||(this.Qae=this.changes.apply(this.startState.doc))}},{key:"newSelection",get:function t(){return this.selection||this.startState.selection.map(this.changes)}},{key:"state",get:function t(){return this.Kh||this.startState.applyTransaction(this),this.Kh}},{key:"annotation",value:function t(n){var i,e,r=ic(this.annotations);try{for(r.s();!(i=r.n()).done;)if((e=i.value).type==n)return e.value}catch(t){r.e(t)}finally{r.f()}}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"reconfigured",get:function t(){return this.startState.config!=this.state.config}},{key:"isUserEvent",value:function n(i){var e=this.annotation(t.userEvent);return!(!e||!(e==i||e.length>i.length&&e.slice(0,i.length)==i&&"."==e[i.length]))}}],[{key:"create",value:function n(i,e,r,u,o,s){return new t(i,e,r,u,o,s)}}]),t}(),$.time=z.define(),$.userEvent=z.define(),$.addToHistory=z.define(),$.remote=z.define(),q=[],G=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(G||(G={})),J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;try{K=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(t){}function tl(t){var n,i;if(K)return K.test(t);for(n=0;n<t.length;n++)if(i=t[n],/\w/.test(i)||i>"\x80"&&(i.toUpperCase()!=i.toLowerCase()||J.test(i)))return!0;return!1}function nl(t){return function(n){if(!/\S/.test(n))return G.Space;if(tl(n))return G.Word;for(var i=0;i<t.length;i++)if(n.indexOf(t[i])>-1)return G.Word;return G.Other}}function il(t,n){var i,e,r,u,o,s,h,f,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},c={},l=ic(t);try{for(l.s();!(i=l.n()).done;)for(e=i.value,r=0,u=Object.keys(e);r<u.length;r++)if(s=e[o=u[r]],void 0===(h=c[o]))c[o]=s;else if(h===s||void 0===s);else{if(!Object.hasOwnProperty.call(a,o))throw new Error("Config merge conflict for field "+o);c[o]=a[o](h,s)}}catch(t){l.e(t)}finally{l.f()}for(f in n)void 0===c[f]&&(c[f]=n[f]);return c}function el(t,n){return t.from-n.from||t.value.startSide-n.value.startSide}function rl(t){var n,i,e;if(t.length>1)for(n=t[0],i=1;i<t.length;i++){if(el(n,e=t[i])>0)return t.slice().sort(el);n=e}return t}function ul(t,n,i){var e,r,u,o,s,h,f,a,c,l=new Map,v=ic(t);try{for(v.s();!(e=v.n()).done;)for(r=e.value,u=0;u<r.chunk.length;u++)r.chunk[u].maxPoint<=0&&l.set(r.chunk[u],r.chunkPos[u])}catch(t){v.e(t)}finally{v.f()}o=new Set,s=ic(n);try{for(s.s();!(h=s.n()).done;)for(f=h.value,a=0;a<f.chunk.length;a++)null==(c=l.get(f.chunk[a]))||(i?i.mapPos(c):c)!=f.chunkPos[a]||(null==i?void 0:i.touchesRange(c,c+f.chunk[a].length))||o.add(f.chunk[a])}catch(t){s.e(t)}finally{s.f()}return o}function ol(t,n){var i,e,r;for(i=t[n];!((e=1+(n<<1))>=t.length)&&(r=t[e],e+1<t.length&&r.compare(t[e+1])>=0&&(r=t[e+1],e++),!(i.compare(r)<0));)t[e]=i,t[n]=r,n=e}function sl(t,n,i,e,r,u){var o,s,h,f,a,c;for(t.goto(n),i.goto(e),o=e+r,s=e,h=e-n;a=(f=t.to+h-i.to||t.endSide-i.endSide)<0?t.to+h:i.to,c=Math.min(a,o),t.point||i.point?t.point&&i.point&&(t.point==i.point||t.point.eq(i.point))&&hl(t.activeForPoint(t.to),i.activeForPoint(i.to))||u.comparePoint(s,c,t.point,i.point):c>s&&!hl(t.active,i.active)&&u.compareRange(s,c,t.active,i.active),!(a>o);)s=a,f<=0&&t.next(),f>=0&&i.next()}function hl(t,n){if(t.length!=n.length)return!1;for(var i=0;i<t.length;i++)if(t[i]!=n[i]&&!t[i].eq(n[i]))return!1;return!0}function fl(t,n){for(var i=n,e=t.length-1;i<e;i++)t[i]=t[i+1];t.pop()}function al(t,n,i){for(var e=t.length-1;e>=n;e--)t[e+1]=t[e];t[n]=i}function cl(t,n){var i,e=-1,r=1e9;for(i=0;i<n.length;i++)(n[i]-r||t[i].endSide-t[e].endSide)<0&&(e=i,r=n[i]);return e}function ll(t,n){var i,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.length,r=0;for(i=0;i<e;)9==t.charCodeAt(i)?(r+=n-r%n,i++):(r++,i=Cc(t,i));return r}function vl(t,n,i,e){for(var r=0,u=0;;){if(u>=n)return r;if(r==t.length)break;u+=9==t.charCodeAt(r)?i-u%i:1,r=Cc(t,r)}return!0===e?-1:t.length}for(Q=function(){function t(n,i,e,r,u,o){yc(this,t),this.config=n,this.doc=i,this.selection=e,this.values=r,this.status=n.statusTemplate.slice(),this.computeSlot=u,o&&(o.Kh=this);for(var s=0;s<this.config.dynamicSlots.length;s++)$c(this,s<<1);this.computeSlot=null}return kc(t,[{key:"field",value:function t(n){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],e=this.config.address[n.id];if(null!=e)return $c(this,e),qc(this,e);if(i)throw new RangeError("Field is not present in this state")}},{key:"update",value:function t(){for(var n=arguments.length,i=new Array(n),e=0;e<n;e++)i[e]=arguments[e];return Qc(this,i,!0)}},{key:"applyTransaction",value:function n(i){var e,r,u,o,s=this,h=this.config,f=h,a=f.base,c=f.compartments,l=ic(i.effects);try{for(l.s();!(e=l.n()).done;)(r=e.value).is(R.reconfigure)?(h&&(c=new Map,h.compartments.forEach((function(t,n){return c.set(n,t)})),h=null),c.set(r.value.compartment,r.value.extension)):r.is(U.reconfigure)?(h=null,a=r.value):r.is(U.appendConfig)&&(h=null,a=Yc(a).concat(r.value))}catch(t){l.e(t)}finally{l.f()}u=h?i.startState.values.slice():(o=new t(h=j.resolve(a,c,this),this.doc,this.selection,h.dynamicSlots.map((function(){return null})),(function(t,n){return n.reconfigure(t,s)}),null)).values,new t(h,i.newDoc,i.newSelection,u,(function(t,n){return n.update(t,i)}),i)}},{key:"replaceSelection",value:function t(n){return"string"==typeof n&&(n=this.toText(n)),this.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:n},range:m.cursor(t.from+n.length)}}))}},{key:"changeByRange",value:function t(n){var i,e,r,u,o,s,h=this.selection,f=n(h.ranges[0]),a=this.changes(f.changes),c=[f.range],l=Yc(f.effects);for(i=1;i<h.ranges.length;i++){for(e=n(h.ranges[i]),u=(r=this.changes(e.changes)).map(a),o=0;o<i;o++)c[o]=c[o].map(u);s=a.mapDesc(r,!0),c.push(e.range.map(s)),a=a.compose(u),l=U.mapEffects(l,u).concat(U.mapEffects(Yc(e.effects),s))}return{changes:a,selection:m.create(c,h.mainIndex),effects:l}}},{key:"changes",value:function n(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return i instanceof y?i:y.of(i,this.doc.length,this.facet(t.lineSeparator))}},{key:"toText",value:function n(e){return i.of(e.split(this.facet(t.lineSeparator)||l))}},{key:"sliceDoc",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.doc.length;return this.doc.sliceString(n,i,this.lineBreak)}},{key:"facet",value:function t(n){var i=this.config.address[n.id];return null==i?n.default:($c(this,i),qc(this,i))}},{key:"toJSON",value:function t(n){var i,e,r={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(n)for(i in n)(e=n[i])instanceof x&&null!=this.config.address[e.id]&&(r[i]=e.spec.toJSON(this.field(n[i]),this));return r}},{key:"tabSize",get:function n(){return this.facet(t.tabSize)}},{key:"lineBreak",get:function n(){return this.facet(t.lineSeparator)||"\n"}},{key:"readOnly",get:function t(){return this.facet(H)}},{key:"phrase",value:function n(i){var e,r,u,o,s,h;for(e=arguments.length,r=new Array(e>1?e-1:0),u=1;u<e;u++)r[u-1]=arguments[u];o=ic(this.facet(t.phrases));try{for(o.s();!(s=o.n()).done;)if(h=s.value,Object.prototype.hasOwnProperty.call(h,i)){i=h[i];break}}catch(t){o.e(t)}finally{o.f()}return r.length&&(i=i.replace(/\$(\$|\d*)/g,(function(t,n){if("$"==n)return"$";var i=+(n||1);return!i||i>r.length?t:r[i-1]}))),i}},{key:"languageDataAt",value:function t(n,i){var e,r,u,o,s,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,f=[],a=ic(this.facet(T));try{for(a.s();!(e=a.n()).done;){u=ic((r=e.value)(this,i,h));try{for(u.s();!(o=u.n()).done;)s=o.value,Object.prototype.hasOwnProperty.call(s,n)&&f.push(s[n])}catch(t){u.e(t)}finally{u.f()}}}catch(t){a.e(t)}finally{a.f()}return f}},{key:"charCategorizer",value:function t(n){return nl(this.languageDataAt("wordChars",n).join(""))}},{key:"wordAt",value:function t(n){for(var i,e,r=this.doc.lineAt(n),u=r.text,o=r.from,s=r.length,h=this.charCategorizer(n),f=n-o,a=n-o;f>0&&(i=Cc(u,f,!1),h(u.slice(i,f))==G.Word);)f=i;for(;a<s&&(e=Cc(u,a),h(u.slice(a,e))==G.Word);)a=e;return f==a?null:m.range(f+o,a+o)}}],[{key:"fromJSON",value:function n(i){var e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;if(!i||"string"!=typeof i.doc)throw new RangeError("Invalid JSON representation for EditorState");if(e=[],s)for(u in r=function t(){if(Object.prototype.hasOwnProperty.call(i,u)){var n=s[u],r=i[u];e.push(n.init((function(t){return n.spec.fromJSON(r,t)})))}},s)r();return t.create({doc:i.doc,selection:m.fromJSON(i.selection),extensions:o.extensions?e.concat([o.extensions]):e})}},{key:"create",value:function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=j.resolve(e.extensions||[],new Map),u=e.doc instanceof i?e.doc:i.of((e.doc||"").split(r.staticFacet(t.lineSeparator)||l)),o=e.selection?e.selection instanceof m?e.selection:m.single(e.selection.anchor,e.selection.head):m.single(0);return Pc(o,u.length),r.staticFacet(B)||(o=o.asSingle()),new t(r,u,o,r.dynamicSlots.map((function(){return null})),(function(t,n){return n.create(t)}),null)}}]),t}(),Q.allowMultipleSelections=B,Q.tabSize=w.define({combine:function t(n){return n.length?n[0]:4}}),Q.lineSeparator=_,Q.readOnly=H,Q.phrases=w.define({compare:function t(n,i){var e=Object.keys(n),r=Object.keys(i);return e.length==r.length&&e.every((function(t){return n[t]==i[t]}))}}),Q.languageData=T,Q.changeFilter=N,Q.transactionFilter=P,Q.transactionExtender=F,R.reconfigure=U.define(),X=function(){function t(){yc(this,t)}return kc(t,[{key:"eq",value:function t(n){return this==n}},{key:"range",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;return Z.create(n,i,this)}}]),t}(),X.prototype.startSide=X.prototype.endSide=0,X.prototype.point=!1,X.prototype.mapMode=v.TrackDel,Z=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.value=e}return kc(t,null,[{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),Y=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.value=e,this.maxPoint=r}return kc(t,[{key:"length",get:function t(){return this.to[this.to.length-1]}},{key:"findIndex",value:function t(n,i,e){var r,u,o,s,h=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,f=e?this.to:this.from;for(r=h,u=f.length;;){if(r==u)return r;if(s=f[o=r+u>>1]-n||(e?this.value[o].endSide:this.value[o].startSide)-i,o==r)return s>=0?r:u;s>=0?u=o:r=o+1}}},{key:"between",value:function t(n,i,e,r){for(var u=this.findIndex(i,-1e9,!0),o=this.findIndex(e,1e9,!1,u);u<o;u++)if(!1===r(this.from[u]+n,this.to[u]+n,this.value[u]))return!1}},{key:"map",value:function n(i,e){var r,u,o,s,h,f,a,c=[],l=[],v=[],d=-1,y=-1;for(r=0;r<this.value.length;r++){if(u=this.value[r],h=void 0,f=void 0,(o=this.from[r]+i)==(s=this.to[r]+i)){if(null==(a=e.mapPos(o,u.startSide,u.mapMode)))continue;if(h=f=a,u.startSide!=u.endSide&&(f=e.mapPos(o,u.endSide))<h)continue}else if((h=e.mapPos(o,u.startSide))>(f=e.mapPos(s,u.endSide))||h==f&&u.startSide>0&&u.endSide<=0)continue;(f-h||u.endSide-u.startSide)<0||(d<0&&(d=h),u.point&&(y=Math.max(y,f-h)),c.push(u),l.push(h-d),v.push(f-d))}return{mapped:c.length?new t(l,v,c,y):null,pos:d}}}]),t}(),tt=function(){function t(n,i,e,r){yc(this,t),this.chunkPos=n,this.chunk=i,this.nextLayer=e,this.maxPoint=r}return kc(t,[{key:"length",get:function t(){var n=this.chunk.length-1;return n<0?0:Math.max(this.chunkEnd(n),this.nextLayer.length)}},{key:"size",get:function t(){var n,i,e,r;if(this.isEmpty)return 0;n=this.nextLayer.size,i=ic(this.chunk);try{for(i.s();!(e=i.n()).done;)n+=(r=e.value).value.length}catch(t){i.e(t)}finally{i.f()}return n}},{key:"chunkEnd",value:function t(n){return this.chunkPos[n]+this.chunk[n].length}},{key:"update",value:function n(i){var e,r,u,o,s,h=i.add,f=void 0===h?[]:h,a=i.sort,c=void 0!==a&&a,l=i.filterFrom,v=void 0===l?0:l,d=i.filterTo,y=void 0===d?this.length:d,p=i.filter;if(0==f.length&&!p)return this;if(c&&(f=f.slice().sort(el)),this.isEmpty)return f.length?t.of(f):this;for(e=new it(this,null,-1).goto(0),r=0,u=[],o=new nt;e.value||r<f.length;)r<f.length&&(e.from-f[r].from||e.startSide-f[r].value.startSide)>=0?(s=f[r++],o.addInner(s.from,s.to,s.value)||u.push(s)):1==e.rangeIndex&&e.chunkIndex<this.chunk.length&&(r==f.length||this.chunkEnd(e.chunkIndex)<f[r].from)&&(!p||v>this.chunkEnd(e.chunkIndex)||y<this.chunkPos[e.chunkIndex])&&o.addChunk(this.chunkPos[e.chunkIndex],this.chunk[e.chunkIndex])?e.nextChunk():((!p||v>e.to||y<e.from||p(e.from,e.to,e.value))&&(o.addInner(e.from,e.to,e.value)||u.push(Z.create(e.from,e.to,e.value))),e.next());return o.finishInner(this.nextLayer.isEmpty&&!u.length?t.empty:this.nextLayer.update({add:u,filter:p,filterFrom:v,filterTo:y}))}},{key:"map",value:function n(i){var e,r,u,o,s,h,f,a,c,l,v;if(i.empty||this.isEmpty)return this;for(e=[],r=[],u=-1,o=0;o<this.chunk.length;o++)s=this.chunkPos[o],h=this.chunk[o],!1===(f=i.touchesRange(s,s+h.length))?(u=Math.max(u,h.maxPoint),e.push(h),r.push(i.mapPos(s))):!0===f&&(c=(a=h.map(s,i)).mapped,l=a.pos,c&&(u=Math.max(u,c.maxPoint),e.push(c),r.push(l)));return v=this.nextLayer.map(i),0==e.length?v:new t(r,e,v||t.empty,u)}},{key:"between",value:function t(n,i,e){var r,u,o;if(!this.isEmpty){for(r=0;r<this.chunk.length;r++)if(u=this.chunkPos[r],o=this.chunk[r],i>=u&&n<=u+o.length&&!1===o.between(u,n-u,i-u,e))return;this.nextLayer.between(n,i,e)}}},{key:"iter",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return et.from([this]).goto(n)}},{key:"isEmpty",get:function t(){return this.nextLayer==this}}],[{key:"create",value:function n(i,e,r,u){return new t(i,e,r,u)}},{key:"iter",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return et.from(n).goto(i)}},{key:"compare",value:function t(n,i,e,r){var u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=n.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=u})),s=i.filter((function(t){return t.maxPoint>0||!t.isEmpty&&t.maxPoint>=u})),h=ul(o,s,e),f=new rt(o,h,u),a=new rt(s,h,u);e.iterGaps((function(t,n,i){return sl(f,t,a,n,i,r)})),e.empty&&0==e.length&&sl(f,0,a,0,0,r)}},{key:"eq",value:function t(n,i){var e,r,u,o,s,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,f=arguments.length>3?arguments[3]:void 0;if(null==f&&(f=999999999),e=n.filter((function(t){return!t.isEmpty&&i.indexOf(t)<0})),r=i.filter((function(t){return!t.isEmpty&&n.indexOf(t)<0})),e.length!=r.length)return!1;if(!e.length)return!0;for(u=ul(e,r),o=new rt(e,u,0).goto(h),s=new rt(r,u,0).goto(h);;){if(o.to!=s.to||!hl(o.active,s.active)||o.point&&(!s.point||!o.point.eq(s.point)))return!1;if(o.to>f)return!0;o.next(),s.next()}}},{key:"spans",value:function t(n,i,e,r){for(var u,o,s,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,f=new rt(n,null,h).goto(i),a=i,c=f.openStart;;){if(u=Math.min(f.to,e),f.point?(o=f.activeForPoint(f.to),s=f.pointFrom<i?o.length+1:Math.min(o.length,c),r.point(a,u,f.point,o,s,f.pointRank),c=Math.min(f.openEnd(u),o.length)):u>a&&(r.span(a,u,f.active,c),c=f.openEnd(u)),f.to>e)return c+(f.point&&f.to>e?1:0);a=f.to,f.next()}}},{key:"of",value:function t(n){var i,e,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],u=new nt,o=ic(n instanceof Z?[n]:r?rl(n):n);try{for(o.s();!(i=o.n()).done;)e=i.value,u.add(e.from,e.to,e.value)}catch(t){o.e(t)}finally{o.f()}return u.finish()}}]),t}(),tt.empty=new tt([],[],null,-1),tt.empty.nextLayer=tt.empty,nt=function(){function t(){yc(this,t),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}return kc(t,[{key:"finishChunk",value:function t(n){this.chunks.push(new Y(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,n&&(this.from=[],this.to=[],this.value=[])}},{key:"add",value:function n(i,e,r){this.addInner(i,e,r)||(this.nextLayer||(this.nextLayer=new t)).add(i,e,r)}},{key:"addInner",value:function t(n,i,e){var r=n-this.lastTo||e.startSide-this.last.endSide;if(r<=0&&(n-this.lastFrom||e.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(r<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=n),this.from.push(n-this.chunkStart),this.to.push(i-this.chunkStart),this.last=e,this.lastFrom=n,this.lastTo=i,this.value.push(e),e.point&&(this.maxPoint=Math.max(this.maxPoint,i-n)),!0)}},{key:"addChunk",value:function t(n,i){if((n-this.lastTo||i.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,i.maxPoint),this.chunks.push(i),this.chunkPos.push(n);var e=i.value.length-1;return this.last=i.value[e],this.lastFrom=i.from[e]+n,this.lastTo=i.to[e]+n,!0}},{key:"finish",value:function t(){return this.finishInner(tt.empty)}},{key:"finishInner",value:function t(n){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return n;var i=tt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(n):n,this.setMaxPoint);return this.from=null,i}}]),t}(),it=function(){function t(n,i,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;yc(this,t),this.layer=n,this.skip=i,this.minPoint=e,this.rank=r}return kc(t,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"endSide",get:function t(){return this.value?this.value.endSide:0}},{key:"goto",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.chunkIndex=this.rangeIndex=0,this.gotoInner(n,i,!1),this}},{key:"gotoInner",value:function t(n,i,e){for(var r,u;this.chunkIndex<this.layer.chunk.length&&(r=this.layer.chunk[this.chunkIndex],this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<n||r.maxPoint<this.minPoint);)this.chunkIndex++,e=!1;this.chunkIndex<this.layer.chunk.length&&(u=this.layer.chunk[this.chunkIndex].findIndex(n-this.layer.chunkPos[this.chunkIndex],i,!0),(!e||this.rangeIndex<u)&&this.setRangeIndex(u)),this.next()}},{key:"forward",value:function t(n,i){(this.to-n||this.endSide-i)<0&&this.gotoInner(n,i,!0)}},{key:"next",value:function t(){for(var n,i,e;;){if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}if(e=(n=this.layer.chunkPos[this.chunkIndex])+(i=this.layer.chunk[this.chunkIndex]).from[this.rangeIndex],this.from=e,this.to=n+i.to[this.rangeIndex],this.value=i.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}},{key:"setRangeIndex",value:function t(n){if(n==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=n}},{key:"nextChunk",value:function t(){this.chunkIndex++,this.rangeIndex=0,this.next()}},{key:"compare",value:function t(n){return this.from-n.from||this.startSide-n.startSide||this.rank-n.rank||this.to-n.to||this.endSide-n.endSide}}]),t}(),et=function(){function t(n){yc(this,t),this.heap=n}return kc(t,[{key:"startSide",get:function t(){return this.value?this.value.startSide:0}},{key:"goto",value:function t(n){var i,e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9,o=ic(this.heap);try{for(o.s();!(i=o.n()).done;)(e=i.value).goto(n,u)}catch(t){o.e(t)}finally{o.f()}for(r=this.heap.length>>1;r>=0;r--)ol(this.heap,r);return this.next(),this}},{key:"forward",value:function t(n,i){var e,r,u,o=ic(this.heap);try{for(o.s();!(e=o.n()).done;)(r=e.value).forward(n,i)}catch(t){o.e(t)}finally{o.f()}for(u=this.heap.length>>1;u>=0;u--)ol(this.heap,u);(this.to-n||this.value.endSide-i)<0&&this.next()}},{key:"next",value:function t(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{var n=this.heap[0];this.from=n.from,this.to=n.to,this.value=n.value,this.rank=n.rank,n.value&&n.next(),ol(this.heap,0)}}}],[{key:"from",value:function n(i){var e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,s=[];for(e=0;e<i.length;e++)for(r=i[e];!r.isEmpty;r=r.nextLayer)r.maxPoint>=o&&s.push(new it(r,u,o,e));return 1==s.length?s[0]:new t(s)}}]),t}(),rt=function(){function t(n,i,e){yc(this,t),this.minPoint=e,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=et.from(n,i,e)}return kc(t,[{key:"goto",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1e9;return this.cursor.goto(n,i),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=n,this.endSide=i,this.openStart=-1,this.next(),this}},{key:"forward",value:function t(n,i){for(;this.minActive>-1&&(this.activeTo[this.minActive]-n||this.active[this.minActive].endSide-i)<0;)this.removeActive(this.minActive);this.cursor.forward(n,i)}},{key:"removeActive",value:function t(n){fl(this.active,n),fl(this.activeTo,n),fl(this.activeRank,n),this.minActive=cl(this.active,this.activeTo)}},{key:"addActive",value:function t(n){for(var i=0,e=this.cursor,r=e.value,u=e.to,o=e.rank;i<this.activeRank.length&&this.activeRank[i]<=o;)i++;al(this.active,i,r),al(this.activeTo,i,u),al(this.activeRank,i,o),n&&al(n,i,this.cursor.from),this.minActive=cl(this.active,this.activeTo)}},{key:"next",value:function t(){var n,i,e,r,u=this.to,o=this.point;for(this.point=null,n=this.openStart<0?[]:null;;)if((i=this.minActive)>-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>u){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&fl(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>u){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}if((e=this.cursor.value).point){if(!(o&&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)for(this.openStart=0,r=n.length-1;r>=0&&n[r]<u;r--)this.openStart++}},{key:"activeForPoint",value:function t(n){var i,e;if(!this.active.length)return this.active;for(i=[],e=this.active.length-1;e>=0&&!(this.activeRank[e]<this.pointRank);e--)(this.activeTo[e]>n||this.activeTo[e]==n&&this.active[e].endSide>=this.point.endSide)&&i.push(this.active[e]);return i.reverse()}},{key:"openEnd",value:function t(n){var i,e=0;for(i=this.activeTo.length-1;i>=0&&this.activeTo[i]>n;i--)e++;return e}}]),t}(),ut=n.State=Object.freeze({__proto__:null,Annotation:z,AnnotationType:W,ChangeDesc:d,ChangeSet:y,get CharCategory(){return G},Compartment:R,EditorSelection:m,EditorState:Q,Facet:w,Line:h,get MapMode(){return v},Prec:E,Range:Z,RangeSet:tt,RangeSetBuilder:nt,RangeValue:X,SelectionRange:k,StateEffect:U,StateEffectType:V,StateField:x,Text:i,Transaction:$,codePointAt:Ic,codePointSize:Lc,combineConfig:il,countColumn:ll,findClusterBreak:Cc,findColumn:vl,fromCodePoint:Rc}),ot="\u037c",st="undefined"==typeof Symbol?"__"+ot:Symbol.for(ot),ht="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),ft="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{},at=function(){function t(n,i){var e,r,u;function o(t){return/^@/.test(t)?[t]:t.split(/,\s*/)}function s(t,n,i,e){var u,h,f=[],a=/^@(\w+)\b/.exec(t[0]),c=a&&"keyframes"==a[1];if(a&&null==n)return i.push(t[0]+";");for(u in n)if(h=n[u],/&/.test(u))s(u.split(/,\s*/).map((function(n){return t.map((function(t){return n.replace(/&/,t)}))})).reduce((function(t,n){return t.concat(n)})),h,i);else if(h&&"object"==dc(h)){if(!a)throw new RangeError("The value of a property ("+u+") should be a primitive value.");s(o(u),h,f,c)}else null!=h&&f.push(u.replace(/_.*/,"").replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))+": "+h+";");(f.length||c)&&i.push((!r||a||e?t:t.map(r)).join(", ")+" {"+f.join(" ")+"}")}for(u in yc(this,t),this.rules=[],r=(e=i||{}).finish,n)s(o(u),n[u],this.rules)}return kc(t,[{key:"getRules",value:function t(){return this.rules.join("\n")}}],[{key:"newName",value:function t(){var n=ft[st]||1;return ft[st]=n+1,ot+n.toString(36)}},{key:"mount",value:function t(n,i){(n[ht]||new lt(n)).mount(Array.isArray(i)?i:[i])}}]),t}(),ct=new Map,lt=function(){function t(n){var i,e,r,u;if(yc(this,t),e=(i=n.ownerDocument||n).defaultView,!n.head&&n.adoptedStyleSheets&&e.CSSStyleSheet){if(r=ct.get(i))return n.adoptedStyleSheets=[r.sheet].concat(Ja(n.adoptedStyleSheets)),n[ht]=r;this.sheet=new e.CSSStyleSheet,n.adoptedStyleSheets=[this.sheet].concat(Ja(n.adoptedStyleSheets)),ct.set(i,this)}else this.styleTag=i.createElement("style"),(u=n.head||n).insertBefore(this.styleTag,u.firstChild);this.modules=[],n[ht]=this}return kc(t,[{key:"mount",value:function t(n){var i,e,r,u,o,s,h=this.sheet,f=0,a=0;for(i=0;i<n.length;i++)if(e=n[i],(r=this.modules.indexOf(e))<a&&r>-1&&(this.modules.splice(r,1),a--,r=-1),-1==r){if(this.modules.splice(a++,0,e),h)for(u=0;u<e.rules.length;u++)h.insertRule(e.rules[u],f++)}else{for(;a<r;)f+=this.modules[a++].rules.length;f+=e.rules.length,a++}if(!h){for(o="",s=0;s<this.modules.length;s++)o+=this.modules[s].getRules()+"\n";this.styleTag.textContent=o}}}]),t}(),vt={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:"'"},dt={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&&/Chrome\/(\d+)/.exec(navigator.userAgent),pt="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),kt="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mt=pt||yt&&+yt[1]<57,gt=0;gt<10;gt++)vt[48+gt]=vt[96+gt]=String(gt);for(gt=1;gt<=24;gt++)vt[gt+111]="F"+gt;for(gt=65;gt<=90;gt++)vt[gt]=String.fromCharCode(gt+32),dt[gt]=String.fromCharCode(gt);for(wt in vt)dt.hasOwnProperty(wt)||(dt[wt]=vt[wt]);function dl(t){var n=mt&&(t.ctrlKey||t.altKey||t.metaKey)||kt&&t.shiftKey&&t.key&&1==t.key.length||"Unidentified"==t.key,i=!n&&t.key||(t.shiftKey?dt:vt)[t.keyCode]||t.key||"Unidentified";return"Esc"==i&&(i="Escape"),"Del"==i&&(i="Delete"),"Left"==i&&(i="ArrowLeft"),"Up"==i&&(i="ArrowUp"),"Right"==i&&(i="ArrowRight"),"Down"==i&&(i="ArrowDown"),i}function yl(t){var n;return(n=11==t.nodeType?t.getSelection?t:t.ownerDocument:t).getSelection()}function pl(t,n){return!!n&&(t==n||t.contains(1!=n.nodeType?n.parentNode:n))}function kl(t){for(var n=t.activeElement;n&&n.shadowRoot;)n=n.shadowRoot.activeElement;return n}function ml(t,n){if(!n.anchorNode)return!1;try{return pl(t,n.anchorNode)}catch(t){return!1}}function gl(t){return 3==t.nodeType?El(t,0,t.nodeValue.length).getClientRects():1==t.nodeType?t.getClientRects():[]}function wl(t,n,i,e){return!!i&&(Ml(t,n,i,e,-1)||Ml(t,n,i,e,1))}function bl(t){for(var n=0;;n++)if(!(t=t.previousSibling))return n}function Ml(t,n,i,e,r){for(;;){if(t==i&&n==e)return!0;if(n==(r<0?0:xl(t))){if("DIV"==t.nodeName)return!1;var u=t.parentNode;if(!u||1!=u.nodeType)return!1;n=bl(t)+(r<0?0:1),t=u}else{if(1!=t.nodeType)return!1;if(1==(t=t.childNodes[n+(r<0?-1:0)]).nodeType&&"false"==t.contentEditable)return!1;n=r<0?xl(t):0}}}function xl(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function Sl(t,n){var i=n?t.left:t.right;return{left:i,right:i,top:t.top,bottom:t.bottom}}function Cl(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function Ol(t,n,i,e,r,u,o,s){var h,f,a,c,l,v,d,y,p,k,m,g,w,b,M=t.ownerDocument,x=M.defaultView||window;for(h=t;h;)if(1==h.nodeType){if(f=void 0,a=h==M.body)f=Cl(x);else{if(h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}f={left:(c=h.getBoundingClientRect()).left,right:c.left+h.clientWidth,top:c.top,bottom:c.top+h.clientHeight}}if(l=0,v=0,"nearest"==r?n.top<f.top?(v=-(f.top-n.top+o),i>0&&n.bottom>f.bottom+v&&(v=n.bottom-f.bottom+v+o)):n.bottom>f.bottom&&(v=n.bottom-f.bottom+o,i<0&&n.top-v<f.top&&(v=-(f.top+v-n.top+o))):(d=n.bottom-n.top,y=f.bottom-f.top,v=(p="center"==r&&d<=y?n.top+d/2-y/2:"start"==r||"center"==r&&i<0?n.top-o:n.bottom-y+o)-f.top),"nearest"==e?n.left<f.left?(l=-(f.left-n.left+u),i>0&&n.right>f.right+l&&(l=n.right-f.right+l+u)):n.right>f.right&&(l=n.right-f.right+u,i<0&&n.left<f.left+l&&(l=-(f.left+l-n.left+u))):l=(k="center"==e?n.left+(n.right-n.left)/2-(f.right-f.left)/2:"start"==e==s?n.left-u:n.right-(f.right-f.left)+u)-f.left,(l||v)&&(a?x.scrollBy(l,v):(m=0,g=0,v&&(w=h.scrollTop,h.scrollTop+=v,g=h.scrollTop-w),l&&(b=h.scrollLeft,h.scrollLeft+=l,m=h.scrollLeft-b),n={left:n.left-m,top:n.top-g,right:n.right-m,bottom:n.bottom-g},m&&Math.abs(m-l)<1&&(e="nearest"),g&&Math.abs(g-v)<1&&(r="nearest"))),a)break;h=h.assignedSlot||h.parentNode}else{if(11!=h.nodeType)break;h=h.host}}function Al(t){var n,i=t.ownerDocument;for(n=t.parentNode;n&&n!=i.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}function Dl(t){var n,i,e,r,u,o;if(t.setActive)return t.setActive();if(Mt)return t.focus(Mt);for(n=[],i=t;i&&(n.push(i,i.scrollTop,i.scrollLeft),i!=i.ownerDocument);i=i.parentNode);if(t.focus(null==Mt?{get preventScroll(){return Mt={preventScroll:!0},!0}}:void 0),!Mt)for(Mt=!1,e=0;e<n.length;)r=n[e++],u=n[e++],o=n[e++],r.scrollTop!=u&&(r.scrollTop=u),r.scrollLeft!=o&&(r.scrollLeft=o)}function El(t,n){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n,e=xt||(xt=document.createRange());return e.setEnd(t,i),e.setStart(t,n),e}function Il(t,n,i){var e,r={key:n,code:n,keyCode:i,which:i,cancelable:!0},u=new KeyboardEvent("keydown",r);return u.synthetic=!0,t.dispatchEvent(u),(e=new KeyboardEvent("keyup",r)).synthetic=!0,t.dispatchEvent(e),u.defaultPrevented||e.defaultPrevented}function Rl(t){for(;t;){if(t&&(9==t.nodeType||11==t.nodeType&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Ll(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function jl(t,n){var i,e=n.focusNode,r=n.focusOffset;if(!e||n.anchorNode!=e||n.anchorOffset!=r)return!1;for(r=Math.min(r,xl(e));;)if(r){if(1!=e.nodeType)return!1;"false"==(i=e.childNodes[r-1]).contentEditable?r--:r=xl(e=i)}else{if(e==t)return!0;r=bl(e),e=e.parentNode}}function Tl(t){var n=t.nextSibling;return t.parentNode.removeChild(t),n}function Bl(t,n,i,e,r,u,o,s,h){var f,a=t.children,c=a.length?a[n]:null,l=u.length?u[u.length-1]:null,v=l?l.breakAfter:o;if(!(n==e&&c&&!o&&!v&&u.length<2&&c.merge(i,r,u.length?l:null,0==i,s,h))){for(e<a.length&&((f=a[e])&&r<f.length?(n==e&&(f=f.split(r),r=0),!v&&l&&f.merge(0,r,l,!0,0,h)?u[u.length-1]=f:(r&&f.merge(0,r,null,!1,0,h),u.push(f))):(null==f?void 0:f.breakAfter)&&(l?l.breakAfter=1:o=1),e++),c&&(c.breakAfter=o,i>0&&(!o&&u.length&&c.merge(i,c.length,u[0],!1,s,0)?c.breakAfter=u.shift().breakAfter:(i<c.length||c.children.length&&0==c.children[c.children.length-1].length)&&c.merge(i,c.length,null,!1,s,0),n++));n<e&&u.length;)if(a[e-1].become(u[u.length-1]))e--,u.pop(),h=u.length?0:s;else{if(!a[n].become(u[0]))break;n++,u.shift(),s=u.length?0:h}!u.length&&n&&e<a.length&&!a[n-1].breakAfter&&a[e].merge(0,0,a[n-1],!1,s,h)&&n--,(n<e||u.length)&&t.replaceChildren(n,e,u)}}function _l(t,n,i,e,r,u){var o,s,h=t.childCursor(),f=h.findPos(i,1),a=f.i,c=f.off,l=h.findPos(n,-1),v=l.i,d=l.off,y=n-i,p=ic(e);try{for(p.s();!(o=p.n()).done;)y+=(s=o.value).length}catch(t){p.e(t)}finally{p.f()}t.length+=y,Bl(t,v,d,a,c,e,0,r,u)}function Nl(t,n,i){var e,r,u,o,s,h=t.nodeValue.length;return n>h&&(n=h),e=n,r=n,u=0,0==n&&i<0||n==h&&i>=0?Ft.chrome||Ft.gecko||(n?(e--,u=1):r<h&&(r++,u=-1)):i<0?e--:r<h&&r++,(o=El(t,e,r).getClientRects()).length?(s=o[(u?u<0:i>=0)?0:o.length-1],Ft.safari&&!u&&0==s.width&&(s=Array.prototype.find.call(o,(function(t){return t.width}))||s),u?Sl(s,u<0):s||null):null}function Pl(t,n,i,e,r,u,o){var s,h,f,a,c;if(i instanceof Wt){for(s=i.dom.firstChild;s;s=s.nextSibling)if(h=Ot.get(s)){if(a=pl(s,e),t<(c=h.length+(a?r:0))||t==c&&h.getSide()<=0)return a?Pl(t,n,h,e,r,u,o):u(h,t,n);t-=c}else{if("number"!=typeof(f=Fl(t,n,s,o)))return f;t=f}return u(i,i.length,-1)}return i.dom==e?o(e,t,n):u(i,t,n)}function Fl(t,n,i,e){var r,u,o;if(3==i.nodeType){if(t<=(r=i.nodeValue.length))return e(i,t,n);t-=r}else if(1==i.nodeType&&"false"!=i.contentEditable)for(u=i.firstChild;u;u=u.nextSibling){if("number"!=typeof(o=Fl(t,n,u,e)))return o;t=o}return t}function Hl(t,n,i,e,r){var u,o,s,h,f;if(i instanceof Wt)for(u=0,o=i.dom.firstChild;o;o=o.nextSibling)if(s=Ot.get(o)){if(h=pl(o,e),pl(o,t))return u+(h?Hl(t,n,s,e,r):s.localPosFromDOM(t,n));u+=s.length+(h?r:0)}else{if(null!=(f=zl(t,n,o)).result)return u+f.result;u+=f.size}else if(i.dom==e)return Math.min(n,e.nodeValue.length);return i.localPosFromDOM(t,n)}function zl(t,n,i){var e,r,u,o;if(3==i.nodeType)return t==i?{result:n}:{size:i.nodeValue.length};if(1!=i.nodeType||"false"==i.contentEditable)return i.contains(t)?{result:0}:{size:0};for(e=0,r=i.firstChild,u=0;;r=r.nextSibling,u++){if(t==i&&u==n)return{result:e};if(!r)return{size:e};if(null!=(o=zl(t,n,r)).result)return{result:n+o.result};e+=o.size}}function Wl(t,n){var i,e,r,u,o,s,h,f=t.dom,a=t.children,c=0;for(i=0;c<a.length;c++)if(!((r=i+(e=a[c]).length)==i&&e.getSide()<=0)){if(n>i&&n<r&&e.dom.parentNode==f)return e.domAtPos(n-i);if(n<=i)break;i=r}for(u=c;u>0;u--)if((o=a[u-1]).dom.parentNode==f)return o.domAtPos(o.length);for(s=c;s<a.length;s++)if((h=a[s]).dom.parentNode==f)return h.domAtPos(0);return new St(f,0)}function Vl(t,n,i){var e,r=t.children;i>0&&n instanceof Wt&&r.length&&(e=r[r.length-1])instanceof Wt&&e.mark.eq(n.mark)?Vl(e,n.children[0],i-1):(r.push(n),n.setParent(t)),t.length+=n.length}function Ul(t,n,i){var e,r=null,u=-1,o=null,s=-1;function h(t,n){var e,f,a,c;for(e=0,f=0;e<t.children.length&&f<=n;e++)(c=f+(a=t.children[e]).length)>=n&&(a.children.length?h(a,n-f):(!o||o.isHidden&&i>0)&&(c>n||f==c&&a.getSide()>0)?(o=a,s=n-f):(f<n||f==c&&a.getSide()<0&&!a.isHidden)&&(r=a,u=n-f)),f=c}return h(t,n),(e=(i<0?r:o)||r||o)?e.coordsAt(Math.max(0,e==r?u:s),i):$l(t)}function $l(t){var n,i=t.dom.lastChild;return i?(n=gl(i))[n.length-1]||null:t.dom.getBoundingClientRect()}function ql(t,n){for(var i in t)"class"==i&&n.class?n.class+=" "+t.class:"style"==i&&n.style?n.style+=";"+t.style:n[i]=t[i];return n}function Gl(t,n){var i,e,r,u,o;if(t==n)return!0;if(!t||!n)return!1;if(i=Object.keys(t),e=Object.keys(n),i.length!=e.length)return!1;for(r=0,u=i;r<u.length;r++)if(o=u[r],-1==e.indexOf(o)||t[o]!==n[o])return!1;return!0}function Jl(t,n,i){var e,r,u=null;if(n)for(e in n)i&&e in i||t.removeAttribute(u=e);if(i)for(r in i)n&&n[r]==i[r]||t.setAttribute(u=r,i[r]);return!!u}function Kl(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=t.inclusiveStart,e=t.inclusiveEnd;return null==i&&(i=t.inclusive),null==e&&(e=t.inclusive),{start:null!=i?i:n,end:null!=e?e:n}}function Ql(t,n){return t==n||!!(t&&n&&t.compare(n))}function Xl(t,n,i){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=i.length-1;r>=0&&i[r]+e>=t?i[r]=Math.max(i[r],n):i.push(t,n)}function Zl(t,n){var i,e,r=ic(n);try{for(r.s();!(i=r.n()).done;)e=i.value,t=new Wt(e,[t],t.length)}catch(t){r.e(t)}finally{r.f()}return t}function Yl(t,n,i){var e=t.facet(on);e.length?e[0](n):window.onerror?window.onerror(String(n),i,void 0,void 0,n):i?console.error(i+":",n):console.error(n)}function tv(t){var n,i,e,r=0,u=0,o=0,s=0,h=ic(t.state.facet(xn));try{for(h.s();!(n=h.n()).done;)(e=(i=n.value)(t))&&(null!=e.left&&(r=Math.max(r,e.left)),null!=e.right&&(u=Math.max(u,e.right)),null!=e.top&&(o=Math.max(o,e.top)),null!=e.bottom&&(s=Math.max(s,e.bottom)))}catch(t){h.e(t)}finally{h.f()}return{left:r,right:u,top:o,bottom:s}}function nv(t){var n,i=[];for(n=0;n<t.length;n++)i.push(1<<+t[n]);return i}bt=function(){function t(){yc(this,t),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return kc(t,[{key:"eq",value:function t(n){return this.anchorNode==n.anchorNode&&this.anchorOffset==n.anchorOffset&&this.focusNode==n.focusNode&&this.focusOffset==n.focusOffset}},{key:"setRange",value:function t(n){var i=n.anchorNode,e=n.focusNode;this.set(i,Math.min(n.anchorOffset,i?xl(i):0),e,Math.min(n.focusOffset,e?xl(e):0))}},{key:"set",value:function t(n,i,e,r){this.anchorNode=n,this.anchorOffset=i,this.focusNode=e,this.focusOffset=r}}]),t}(),Mt=null,St=function(){function t(n,i){var e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];yc(this,t),this.node=n,this.offset=i,this.precise=e}return kc(t,null,[{key:"before",value:function n(i,e){return new t(i.parentNode,bl(i),e)}},{key:"after",value:function n(i,e){return new t(i.parentNode,bl(i)+1,e)}}]),t}(),Ct=[],Ot=function(){function t(){yc(this,t),this.parent=null,this.dom=null,this.dirty=2}return kc(t,[{key:"overrideDOMText",get:function t(){return null}},{key:"posAtStart",get:function t(){return this.parent?this.parent.posBefore(this):0}},{key:"posAtEnd",get:function t(){return this.posAtStart+this.length}},{key:"posBefore",value:function t(n){var i,e,r=this.posAtStart,u=ic(this.children);try{for(u.s();!(i=u.n()).done;){if((e=i.value)==n)return r;r+=e.length+e.breakAfter}}catch(t){u.e(t)}finally{u.f()}throw new RangeError("Invalid child in posBefore")}},{key:"posAfter",value:function t(n){return this.posBefore(n)+n.length}},{key:"sync",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v;if(2&this.dirty){r=this.dom,u=null,s=ic(this.children);try{for(s.s();!(h=s.n()).done;){if((f=h.value).dirty&&(!f.dom&&(o=u?u.nextSibling:r.firstChild)&&(!(a=t.get(o))||!a.parent&&a.canReuseDOM(f))&&f.reuseDOM(o),f.sync(i,e),f.dirty=0),o=u?u.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&o!=f.dom&&(e.written=!0),f.dom.parentNode==r)for(;o&&o!=f.dom;)o=Tl(o);else r.insertBefore(f.dom,o);u=f.dom}}catch(t){s.e(t)}finally{s.f()}for((o=u?u.nextSibling:r.firstChild)&&e&&e.node==r&&(e.written=!0);o;)o=Tl(o)}else if(1&this.dirty){c=ic(this.children);try{for(c.s();!(l=c.n()).done;)(v=l.value).dirty&&(v.sync(i,e),v.dirty=0)}catch(t){c.e(t)}finally{c.f()}}}},{key:"reuseDOM",value:function t(n){}},{key:"localPosFromDOM",value:function n(i,e){var r,u,o,s,h,f;if(i==this.dom)r=this.dom.childNodes[e];else{for(u=0==xl(i)?0:0==e?-1:1;(o=i.parentNode)!=this.dom;)0==u&&o.firstChild!=o.lastChild&&(u=i==o.firstChild?-1:1),i=o;r=u<0?i:i.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!t.get(r);)r=r.nextSibling;if(!r)return this.length;for(s=0,h=0;;s++){if((f=this.children[s]).dom==r)return h;h+=f.length+f.breakAfter}}},{key:"domBoundsAround",value:function t(n,i){var e,r,u,o,s,h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,f=-1,a=-1,c=-1,l=-1;for(e=0,r=h,u=h;e<this.children.length;e++){if(s=r+(o=this.children[e]).length,r<n&&s>i)return o.domBoundsAround(n,i,r);if(s>=n&&-1==f&&(f=e,a=r),r>i&&o.dom.parentNode==this.dom){c=e,l=u;break}u=s,r=s+o.breakAfter}return{from:a,to:l<0?h+this.length:l,startDOM:(f?this.children[f-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:c<this.children.length&&c>=0?this.children[c].dom:null}}},{key:"markDirty",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.dirty|=2,this.markParentsDirty(n)}},{key:"markParentsDirty",value:function t(n){for(var i=this.parent;i;i=i.parent){if(n&&(i.dirty|=2),1&i.dirty)return;i.dirty|=1,n=!1}}},{key:"setParent",value:function t(n){this.parent!=n&&(this.parent=n,this.dirty&&this.markParentsDirty(!0))}},{key:"setDOM",value:function t(n){this.dom&&(this.dom.cmView=null),this.dom=n,n.cmView=this}},{key:"rootView",get:function t(){var n,i;for(n=this;;){if(!(i=n.parent))return n;n=i}}},{key:"replaceChildren",value:function t(n,i){var e,r,u,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ct;for(this.markDirty(),r=n;r<i;r++)(u=this.children[r]).parent==this&&u.destroy();for((e=this.children).splice.apply(e,[n,i-n].concat(Ja(s))),o=0;o<s.length;o++)s[o].setParent(this)}},{key:"ignoreMutation",value:function t(n){return!1}},{key:"ignoreEvent",value:function t(n){return!1}},{key:"childCursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length;return new At(this.children,n,this.children.length)}},{key:"childPos",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.childCursor().findPos(n,i)}},{key:"toString",value:function t(){var n=this.constructor.name.replace("View","");return n+(this.children.length?"("+this.children.join()+")":this.length?"["+("Text"==n?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}},{key:"isEditable",get:function t(){return!0}},{key:"isWidget",get:function t(){return!1}},{key:"isHidden",get:function t(){return!1}},{key:"merge",value:function t(n,i,e,r,u,o){return!1}},{key:"become",value:function t(n){return!1}},{key:"canReuseDOM",value:function t(n){return n.constructor==this.constructor}},{key:"getSide",value:function t(){return 0}},{key:"destroy",value:function t(){this.parent=null}}],[{key:"get",value:function t(n){return n.cmView}}]),t}(),Ot.prototype.breakAfter=0,At=function(){function t(n,i,e){yc(this,t),this.children=n,this.pos=i,this.i=e,this.off=0}return kc(t,[{key:"findPos",value:function t(n){for(var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;;){if(n>this.pos||n==this.pos&&(e>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=n-this.pos,this;i=this.children[--this.i],this.pos-=i.length+i.breakAfter}}}]),t}(),Dt="undefined"!=typeof navigator?navigator:{userAgent:"",vendor:"",platform:""},Et="undefined"!=typeof document?document:{documentElement:{style:{}}},It=/Edge\/(\d+)/.exec(Dt.userAgent),Rt=/MSIE \d/.test(Dt.userAgent),Lt=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Dt.userAgent),Tt=!(jt=!!(Rt||Lt||It))&&/gecko\/(\d+)/i.test(Dt.userAgent),Bt=!jt&&/Chrome\/(\d+)/.exec(Dt.userAgent),_t="webkitFontSmoothing"in Et.documentElement.style,Pt=(Nt=!jt&&/Apple Computer/.test(Dt.vendor))&&(/Mobile\/\w+/.test(Dt.userAgent)||Dt.maxTouchPoints>2),Ft={mac:Pt||/Mac/.test(Dt.platform),windows:/Win/.test(Dt.platform),linux:/Linux|X11/.test(Dt.platform),ie:jt,ie_version:Rt?Et.documentMode||6:Lt?+Lt[1]:It?+It[1]:0,gecko:Tt,gecko_version:Tt?+(/Firefox\/(\d+)/.exec(Dt.userAgent)||[0,0])[1]:0,chrome:!!Bt,chrome_version:Bt?+Bt[1]:0,ios:Pt,android:/Android\b/.test(Dt.userAgent),webkit:_t,safari:Nt,webkit_version:_t?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Et.documentElement.style.tabSize?"tab-size":"-moz-tab-size"},Ht=256,zt=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).text=t,e}return kc(i,[{key:"length",get:function t(){return this.text.length}},{key:"createDOM",value:function t(n){this.setDOM(n||document.createTextNode(this.text))}},{key:"sync",value:function t(n,i){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(i&&i.node==this.dom&&(i.written=!0),this.dom.nodeValue=this.text)}},{key:"reuseDOM",value:function t(n){3==n.nodeType&&this.createDOM(n)}},{key:"merge",value:function t(n,e,r){return(!r||r instanceof i&&!(this.length-(e-n)+r.length>Ht))&&(this.text=this.text.slice(0,n)+(r?r.text:"")+this.text.slice(e),this.markDirty(),!0)}},{key:"split",value:function t(n){var e=new i(this.text.slice(n));return this.text=this.text.slice(0,n),this.markDirty(),e}},{key:"localPosFromDOM",value:function t(n,i){return n==this.dom?i:i?this.text.length:0}},{key:"domAtPos",value:function t(n){return new St(this.dom,n)}},{key:"domBoundsAround",value:function t(n,i,e){return{from:e,to:e+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}},{key:"coordsAt",value:function t(n,i){return Nl(this.dom,n,i)}}]),i}(Ot),Wt=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,u,o,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],h=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;yc(this,i),(e=n.call(this)).mark=t,e.children=s,e.length=h,r=ic(s);try{for(r.s();!(u=r.n()).done;)(o=u.value).setParent(cc(e))}catch(t){r.e(t)}finally{r.f()}return e}return kc(i,[{key:"setAttrs",value:function t(n){if(Ll(n),this.mark.class&&(n.className=this.mark.class),this.mark.attrs)for(var i in this.mark.attrs)n.setAttribute(i,this.mark.attrs[i]);return n}},{key:"reuseDOM",value:function t(n){n.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,e){this.dom?4&this.dirty&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),uc(vc(i.prototype),"sync",this).call(this,n,e)}},{key:"merge",value:function t(n,e,r,u,o,s){return(!r||!(!(r instanceof i&&r.mark.eq(this.mark))||n&&o<=0||e<this.length&&s<=0))&&(_l(this,n,e,r?r.children:[],o-1,s-1),this.markDirty(),!0)}},{key:"split",value:function t(n){var e,r,u,o,s=[],h=0,f=-1,a=0,c=ic(this.children);try{for(c.s();!(e=c.n()).done;)(u=h+(r=e.value).length)>n&&s.push(h<n?r.split(n-h):r),f<0&&h>=n&&(f=a),h=u,a++}catch(t){c.e(t)}finally{c.f()}return o=this.length-n,this.length=n,f>-1&&(this.children.length=f,this.markDirty()),new i(this.mark,s,o)}},{key:"domAtPos",value:function t(n){return Wl(this,n)}},{key:"coordsAt",value:function t(n,i){return Ul(this,n,i)}}]),i}(Ot),Vt=function(t){sc(e,t);var n=fc(e);function e(t,i,r){var u;return yc(this,e),(u=n.call(this)).widget=t,u.length=i,u.side=r,u.prevWidget=null,u}return kc(e,[{key:"split",value:function t(n){var i=e.create(this.widget,this.length-n,this.side);return this.length-=n,i}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"getSide",value:function t(){return this.side}},{key:"merge",value:function t(n,i,r,u,o,s){return!(r&&(!(r instanceof e&&this.widget.compare(r.widget))||n>0&&o<=0||i<this.length&&s<=0))&&(this.length=n+(r?r.length:0)+(this.length-i),!0)}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side&&this.widget.constructor==n.widget.constructor&&(this.widget.compare(n.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"overrideDOMText",get:function t(){var n,e,r,u,o;if(0==this.length)return i.empty;for(n=this;n.parent;)n=n.parent;return u=(r=(e=n).view)&&r.state.doc,o=this.posAtStart,u?u.slice(o,o+this.length):i.empty}},{key:"domAtPos",value:function t(n){return(this.length?0==n:this.side>0)?St.before(this.dom):St.after(this.dom,n==this.length)}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e,r,u,o=this.widget.coordsAt(this.dom,n,i);if(o)return o;if(r=null,!(e=this.dom.getClientRects()).length)return null;for(u=n>0?e.length-1:0;r=e[u],!(n>0?0==u:u==e.length-1||r.top<r.bottom);u+=n>0?-1:1);return this.length?r:Sl(r,this.side>0)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"isHidden",get:function t(){return this.widget.isHidden}},{key:"destroy",value:function t(){uc(vc(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}],[{key:"create",value:function t(n,i,r){return new(n.customView||e)(n,i,r)}}]),e}(Ot),Ut=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"domAtPos",value:function t(n){var i=this.widget,e=i.topView,r=i.text;return e?Pl(n,0,e,r,this.length-e.length,(function(t,n){return t.domAtPos(n)}),(function(t,n){return new St(t,Math.min(n,t.nodeValue.length))})):new St(r,Math.min(n,r.nodeValue.length))}},{key:"sync",value:function t(){this.setDOM(this.widget.toDOM())}},{key:"localPosFromDOM",value:function t(n,i){var e=this.widget,r=e.topView,u=e.text;return r?Hl(n,i,r,u,this.length-r.length):Math.min(i,this.length)}},{key:"ignoreMutation",value:function t(){return!1}},{key:"overrideDOMText",get:function t(){return null}},{key:"coordsAt",value:function t(n,i){var e=this.widget,r=e.topView,u=e.text;return r?Pl(n,i,r,u,this.length-r.length,(function(t,n,i){return t.coordsAt(n,i)}),(function(t,n,i){return Nl(t,n,i)})):Nl(u,n,i)}},{key:"destroy",value:function t(){var n;uc(vc(i.prototype),"destroy",this).call(this),null===(n=this.widget.topView)||void 0===n||n.destroy()}},{key:"isEditable",get:function t(){return!0}},{key:"canReuseDOM",value:function t(){return!0}}]),i}(Vt),$t=function(t){sc(e,t);var n=fc(e);function e(t){var i;return yc(this,e),(i=n.call(this)).side=t,i}return kc(e,[{key:"length",get:function t(){return 0}},{key:"merge",value:function t(){return!1}},{key:"become",value:function t(n){return n instanceof e&&n.side==this.side}},{key:"split",value:function t(){return new e(this.side)}},{key:"sync",value:function t(){if(!this.dom){var n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),this.setDOM(n)}}},{key:"getSide",value:function t(){return this.side}},{key:"domAtPos",value:function t(n){return this.side>0?St.before(this.dom):St.after(this.dom)}},{key:"localPosFromDOM",value:function t(){return 0}},{key:"domBoundsAround",value:function t(){return null}},{key:"coordsAt",value:function t(n){return this.dom.getBoundingClientRect()}},{key:"overrideDOMText",get:function t(){return i.empty}},{key:"isHidden",get:function t(){return!0}}]),e}(Ot),zt.prototype.children=Vt.prototype.children=$t.prototype.children=Ct,qt=function(){function t(){yc(this,t)}return kc(t,[{key:"eq",value:function t(n){return!1}},{key:"updateDOM",value:function t(n,i){return!1}},{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"estimatedHeight",get:function t(){return-1}},{key:"ignoreEvent",value:function t(n){return!0}},{key:"coordsAt",value:function t(n,i,e){return null}},{key:"customView",get:function t(){return null}},{key:"isHidden",get:function t(){return!1}},{key:"destroy",value:function t(n){}}]),t}(),Gt=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Gt||(Gt={})),Jt=function(t){sc(i,t);var n=fc(i);function i(t,e,r,u){var o;return yc(this,i),(o=n.call(this)).startSide=t,o.endSide=e,o.widget=r,o.spec=u,o}return kc(i,[{key:"heightRelevant",get:function t(){return!1}},{key:"hasHeight",value:function t(){return!!this.widget&&this.widget.estimatedHeight>-1}}],[{key:"mark",value:function t(n){return new Kt(n)}},{key:"widget",value:function t(n){var i=n.side||0,e=!!n.block;return new Xt(n,i+=e?i>0?3e8:-4e8:i>0?1e8:-1e8,i,e,n.widget||null,!1)}},{key:"replace",value:function t(n){var i,e,r,u,o,s=!!n.block;return n.isBlockGap?(i=-5e8,e=4e8):(i=((u=(r=Kl(n,s)).start)?s?-3e8:-1:5e8)-1,e=1+((o=r.end)?s?2e8:1:-6e8)),new Xt(n,i,e,s,n.widget||null,!0)}},{key:"line",value:function t(n){return new Qt(n)}},{key:"set",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return tt.of(n,i)}}]),i}(X),Jt.none=tt.empty,Kt=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,u,o;return yc(this,i),u=(r=Kl(t)).start,o=r.end,(e=n.call(this,u?-1:5e8,o?1:-6e8,null,t)).tagName=t.tagName||"span",e.class=t.class||"",e.attrs=t.attributes||null,e}return kc(i,[{key:"eq",value:function t(n){return this==n||n instanceof i&&this.tagName==n.tagName&&this.class==n.class&&Gl(this.attrs,n.attrs)}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(n>=e)throw new RangeError("Mark decorations may not be empty");return uc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Kt.prototype.point=!1,Qt=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,-2e8,-2e8,null,t)}return kc(i,[{key:"eq",value:function t(n){return n instanceof i&&this.spec.class==n.spec.class&&Gl(this.spec.attributes,n.spec.attributes)}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(e!=n)throw new RangeError("Line decoration ranges must be zero-length");return uc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Qt.prototype.mapMode=v.TrackBefore,Qt.prototype.point=!0,Xt=function(t){sc(i,t);var n=fc(i);function i(t,e,r,u,o,s){var h;return yc(this,i),(h=n.call(this,e,r,o,t)).block=u,h.isReplace=s,h.mapMode=u?e<=0?v.TrackBefore:v.TrackAfter:v.TrackDel,h}return kc(i,[{key:"type",get:function t(){return this.startSide<this.endSide?Gt.WidgetRange:this.startSide<=0?Gt.WidgetBefore:Gt.WidgetAfter}},{key:"heightRelevant",get:function t(){return this.block||!!this.widget&&this.widget.estimatedHeight>=5}},{key:"eq",value:function t(n){return n instanceof i&&Ql(this.widget,n.widget)&&this.block==n.block&&this.startSide==n.startSide&&this.endSide==n.endSide}},{key:"range",value:function t(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n;if(this.isReplace&&(n>e||n==e&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&e!=n)throw new RangeError("Widget decorations can only have zero-length ranges");return uc(vc(i.prototype),"range",this).call(this,n,e)}}]),i}(Jt),Xt.prototype.point=!0,Zt=function(t){sc(i,t);var n=fc(i);function i(){var t;return yc(this,i),(t=n.apply(this,arguments)).children=[],t.length=0,t.prevAttrs=void 0,t.attrs=null,t.breakAfter=0,t}return kc(i,[{key:"merge",value:function t(n,e,r,u,o,s){if(r){if(!(r instanceof i))return!1;this.dom||r.transferDOM(this)}return u&&this.setDeco(r?r.attrs:null),_l(this,n,e,r?r.children:[],o,s),!0}},{key:"split",value:function t(n){var e,r,u,o,s=new i;if(s.breakAfter=this.breakAfter,0==this.length)return s;for(r=(e=this.childPos(n)).i,(u=e.off)&&(s.append(this.children[r].split(u),0),this.children[r].merge(u,this.children[r].length,null,!1,0,0),r++),o=r;o<this.children.length;o++)s.append(this.children[o],0);for(;r>0&&0==this.children[r-1].length;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=n,s}},{key:"transferDOM",value:function t(n){this.dom&&(this.markDirty(),n.setDOM(this.dom),n.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}},{key:"setDeco",value:function t(n){Gl(this.attrs,n)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=n)}},{key:"append",value:function t(n,i){Vl(this,n,i)}},{key:"addLineDeco",value:function t(n){var i=n.spec.attributes,e=n.spec.class;i&&(this.attrs=ql(i,this.attrs||{})),e&&(this.attrs=ql({class:e},this.attrs||{}))}},{key:"domAtPos",value:function t(n){return Wl(this,n)}},{key:"reuseDOM",value:function t(n){"DIV"==n.nodeName&&(this.setDOM(n),this.dirty|=6)}},{key:"sync",value:function t(n,e){var r,u,o;for(this.dom?4&this.dirty&&(Ll(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),uc(vc(i.prototype),"sync",this).call(this,n,e),u=this.dom.lastChild;u&&Ot.get(u)instanceof Wt;)u=u.lastChild;u&&this.length&&("BR"==u.nodeName||0!=(null===(r=Ot.get(u))||void 0===r?void 0:r.isEditable)||Ft.ios&&this.children.some((function(t){return t instanceof zt})))||((o=document.createElement("BR")).cmIgnore=!0,this.dom.appendChild(o))}},{key:"measureTextSize",value:function t(){var n,i,e,r,u,o;if(0==this.children.length||this.length>20)return null;n=0,e=ic(this.children);try{for(e.s();!(r=e.n()).done;){if(!((u=r.value)instanceof zt)||/[^ -~]/.test(u.text))return null;if(1!=(o=gl(u.dom)).length)return null;n+=o[0].width,i=o[0].height}}catch(t){e.e(t)}finally{e.f()}return n?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:n/this.length,textHeight:i}:null}},{key:"coordsAt",value:function t(n,i){var e,r,u,o=Ul(this,n,i);return!this.children.length&&o&&this.parent&&(e=this.parent.view.viewState.heightOracle,r=o.bottom-o.top,Math.abs(r-e.lineHeight)<2&&e.textHeight<r)?(u=(r-e.textHeight)/2,{top:o.top+u,bottom:o.bottom-u,left:o.left,right:o.left}):o}},{key:"become",value:function t(n){return!1}},{key:"type",get:function t(){return Gt.Text}}],[{key:"find",value:function t(n,e){var r,u,o,s;for(r=0,u=0;r<n.children.length;r++){if((s=u+(o=n.children[r]).length)>=e){if(o instanceof i)return o;if(s>e)break}u=s+o.breakAfter}return null}}]),i}(Ot),Yt=function(t){sc(e,t);var n=fc(e);function e(t,i,r){var u;return yc(this,e),(u=n.call(this)).widget=t,u.length=i,u.type=r,u.breakAfter=0,u.prevWidget=null,u}return kc(e,[{key:"merge",value:function t(n,i,r,u,o,s){return!(r&&(!(r instanceof e&&this.widget.compare(r.widget))||n>0&&o<=0||i<this.length&&s<=0))&&(this.length=n+(r?r.length:0)+(this.length-i),!0)}},{key:"domAtPos",value:function t(n){return 0==n?St.before(this.dom):St.after(this.dom,n==this.length)}},{key:"split",value:function t(n){var i,r=this.length-n;return this.length=n,(i=new e(this.widget,r,this.type)).breakAfter=this.breakAfter,i}},{key:"children",get:function t(){return Ct}},{key:"sync",value:function t(n){this.dom&&this.widget.updateDOM(this.dom,n)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(n)),this.dom.contentEditable="false")}},{key:"overrideDOMText",get:function t(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):i.empty}},{key:"domBoundsAround",value:function t(){return null}},{key:"become",value:function t(n){return n instanceof e&&n.widget.constructor==this.widget.constructor&&(n.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=n.widget,this.length=n.length,this.type=n.type,this.breakAfter=n.breakAfter,!0)}},{key:"ignoreMutation",value:function t(){return!0}},{key:"ignoreEvent",value:function t(n){return this.widget.ignoreEvent(n)}},{key:"isEditable",get:function t(){return!1}},{key:"isWidget",get:function t(){return!0}},{key:"coordsAt",value:function t(n,i){return this.widget.coordsAt(this.dom,n,i)}},{key:"destroy",value:function t(){uc(vc(e.prototype),"destroy",this).call(this),this.dom&&this.widget.destroy(this.dom)}}]),e}(Ot),tn=function(){function t(n,i,e,r){yc(this,t),this.doc=n,this.pos=i,this.end=e,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=n.iter(),this.skip=i}return kc(t,[{key:"posCovered",value:function t(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;var n=this.content[this.content.length-1];return!(n.breakAfter||n instanceof Yt&&n.type==Gt.WidgetBefore)}},{key:"getLine",value:function t(){return this.curLine||(this.content.push(this.curLine=new Zt),this.atCursorPos=!0),this.curLine}},{key:"flushBuffer",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.bufferMarks;this.pendingBuffer&&(this.curLine.append(Zl(new $t(-1),n),n.length),this.pendingBuffer=0)}},{key:"addBlockWidget",value:function t(n){this.flushBuffer(),this.curLine=null,this.content.push(n)}},{key:"finish",value:function t(n){this.pendingBuffer&&n<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}},{key:"buildText",value:function t(n,i,e){for(var r,u,o,s,h;n>0;){if(this.textOff==this.text.length){if(u=(r=this.cursor.next(this.skip)).value,o=r.lineBreak,s=r.done,this.skip=0,s)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,n--;continue}this.text=u,this.textOff=0}h=Math.min(this.text.length-this.textOff,n,512),this.flushBuffer(i.slice(i.length-e)),this.getLine().append(Zl(new zt(this.text.slice(this.textOff,this.textOff+h)),i),e),this.atCursorPos=!0,this.textOff+=h,n-=h,e=0}}},{key:"span",value:function t(n,i,e,r){this.buildText(i-n,e,r),this.pos=i,this.openStart<0&&(this.openStart=r)}},{key:"point",value:function t(n,i,e,r,u,o){var s,h,f,a,c,l;if(this.disallowBlockEffectsFor[o]&&e instanceof Xt){if(e.block)throw new RangeError("Block decorations may not be specified via plugins");if(i>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}s=i-n,e instanceof Xt?e.block?((h=e.type)!=Gt.WidgetAfter||this.posCovered()||this.getLine(),this.addBlockWidget(new Yt(e.widget||new nn("div"),s,h))):(f=Vt.create(e.widget||new nn("span"),s,s?0:e.startSide),a=this.atCursorPos&&!f.isEditable&&u<=r.length&&(n<i||e.startSide>0),c=!f.isEditable&&(n<i||u>r.length||e.startSide<=0),l=this.getLine(),2!=this.pendingBuffer||a||f.isEditable||(this.pendingBuffer=0),this.flushBuffer(r),a&&(l.append(Zl(new $t(1),r),u),u=r.length+Math.max(0,u-r.length)),l.append(Zl(f,r),u),this.atCursorPos=c,this.pendingBuffer=c?n<i||u>r.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())):this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(e),s&&(this.textOff+s<=this.text.length?this.textOff+=s:(this.skip+=s-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=i),this.openStart<0&&(this.openStart=u)}}],[{key:"build",value:function n(i,e,r,u,o){var s=new t(i,e,r,o);return s.openEnd=tt.spans(u,e,r,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}]),t}(),nn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).tag=t,e}return kc(i,[{key:"eq",value:function t(n){return n.tag==this.tag}},{key:"toDOM",value:function t(){return document.createElement(this.tag)}},{key:"updateDOM",value:function t(n){return n.nodeName.toLowerCase()==this.tag}},{key:"isHidden",get:function t(){return!0}}]),i}(qt),en=w.define(),rn=w.define(),un=w.define(),on=w.define(),sn=w.define(),hn=w.define(),fn=w.define(),an=w.define({combine:function t(n){return n.some((function(t){return t}))}}),cn=w.define({combine:function t(n){return n.some((function(t){return t}))}}),ln=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"nearest",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"nearest",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:5,u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:5;yc(this,t),this.range=n,this.y=i,this.x=e,this.yMargin=r,this.xMargin=u}return kc(t,[{key:"map",value:function n(i){return i.empty?this:new t(this.range.map(i),this.y,this.x,this.yMargin,this.xMargin)}}]),t}(),vn=U.define({map:function t(n,i){return n.map(i)}}),dn=w.define({combine:function t(n){return!n.length||n[0]}}),yn=0,pn=w.define(),kn=function(){function t(n,i,e,r){yc(this,t),this.id=n,this.create=i,this.domEventHandlers=e,this.extension=r(this)}return kc(t,null,[{key:"define",value:function n(i,e){var r=e||{},u=r.eventHandlers,o=r.provide,s=r.decorations;return new t(yn++,i,u,(function(t){var n=[pn.of(t)];return s&&n.push(bn.of((function(n){var i=n.plugin(t);return i?s(i):Jt.none}))),o&&n.push(o(t)),n}))}},{key:"fromClass",value:function n(i,e){return t.define((function(t){return new i(t)}),e)}}]),t}(),mn=function(){function t(n){yc(this,t),this.spec=n,this.mustUpdate=null,this.value=null}return kc(t,[{key:"update",value:function t(n){if(this.value){if(this.mustUpdate){var t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Yl(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(t){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(n)}catch(t){Yl(n.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}},{key:"destroy",value:function t(n){var i;if(null===(i=this.value)||void 0===i?void 0:i.destroy)try{this.value.destroy()}catch(t){Yl(n.state,t,"CodeMirror plugin crashed")}}},{key:"deactivate",value:function t(){this.spec=this.value=null}}]),t}(),gn=w.define(),wn=w.define(),bn=w.define(),Mn=w.define(),xn=w.define(),Sn=w.define(),Cn=function(){function t(n,i,e,r){yc(this,t),this.fromA=n,this.toA=i,this.fromB=e,this.toB=r}return kc(t,[{key:"join",value:function n(i){return new t(Math.min(this.fromA,i.fromA),Math.max(this.toA,i.toA),Math.min(this.fromB,i.fromB),Math.max(this.toB,i.toB))}},{key:"addToSet",value:function t(n){for(var i,e=n.length,r=this;e>0;e--)if(!((i=n[e-1]).fromA>r.toA)){if(i.toA<r.fromA)break;r=r.join(i),n.splice(e-1,1)}return n.splice(e,0,r),n}}],[{key:"extendWithRanges",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v,d,y;if(0==e.length)return i;for(r=[],u=0,o=0,s=0,h=0;;u++){for(a=s-h,c=(f=u==i.length?null:i[u])?f.fromB:1e9;o<e.length&&e[o]<c&&(l=e[o],v=e[o+1],(d=Math.max(h,l))<=(y=Math.min(c,v))&&new t(d+a,y+a,d,y).addToSet(r),!(v>c));)o+=2;if(!f)return r;new t(f.fromA,f.toA,f.fromB,f.toB).addToSet(r),s=f.toA,h=f.toB}}}]),t}(),On=function(){function t(n,i,e){var r,u,o,s;yc(this,t),this.view=n,this.state=i,this.transactions=e,this.flags=0,this.startState=n.state,this.changes=y.empty(this.startState.doc.length),r=ic(e);try{for(r.s();!(u=r.n()).done;)o=u.value,this.changes=this.changes.compose(o.changes)}catch(t){r.e(t)}finally{r.f()}s=[],this.changes.iterChangedRanges((function(t,n,i,e){return s.push(new Cn(t,n,i,e))})),this.changedRanges=s}return kc(t,[{key:"viewportChanged",get:function t(){return(4&this.flags)>0}},{key:"heightChanged",get:function t(){return(2&this.flags)>0}},{key:"geometryChanged",get:function t(){return this.docChanged||(10&this.flags)>0}},{key:"focusChanged",get:function t(){return(1&this.flags)>0}},{key:"docChanged",get:function t(){return!this.changes.empty}},{key:"selectionSet",get:function t(){return this.transactions.some((function(t){return t.selection}))}},{key:"empty",get:function t(){return 0==this.flags&&0==this.transactions.length}}],[{key:"create",value:function n(i,e,r){return new t(i,e,r)}}]),t}(),An=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(An||(An={})),Dn=An.LTR,En=An.RTL,In=nv("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),Rn=nv("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Ln=Object.create(null),jn=[];for(Tn=0,Bn=["()","[]","{}"];Tn<Bn.length;Tn++)Nn=(_n=Bn[Tn]).charCodeAt(0),Pn=_n.charCodeAt(1),Ln[Nn]=Pn,Ln[Pn]=-Nn;function iv(t){return t<=247?In[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?Rn[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:8204==t?256:1}function ev(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T,B,_,N,P,F,H,z=t.length,W=n==Dn?1:2,V=n==Dn?2:1;if(!t||1==W&&!Fn.test(t))return rv(z);for(i=0,e=W,r=W;i<z;i++)512==(u=iv(t.charCodeAt(i)))?u=e:8==u&&4==r&&(u=16),zn[i]=4==u?2:u,7&u&&(r=u),e=u;for(o=0,s=W,h=W;o<z;o++){if(128==(f=zn[o]))o<z-1&&s==zn[o+1]&&24&s?f=zn[o]=s:zn[o]=256;else if(64==f){for(a=o+1;a<z&&64==zn[a];)a++;for(c=o&&8==s||a<z&&8==zn[a]?1==h?1:8:256,l=o;l<a;l++)zn[l]=c;o=a-1}else 8==f&&1==h&&(zn[o]=1);s=f,7&f&&(h=f)}for(v=0,d=0,y=0;v<z;v++)if(k=Ln[p=t.charCodeAt(v)])if(k<0){for(g=d-3;g>=0;g-=3)if(jn[g+1]==-k){(b=2&(w=jn[g+2])?W:4&w?1&w?V:W:0)&&(zn[v]=zn[jn[g]]=b),d=g;break}}else{if(189==jn.length)break;jn[d++]=v,jn[d++]=p,jn[d++]=y}else if(2==(m=zn[v])||1==m)for(y=(M=m==W)?0:1,x=d-3;x>=0&&!(2&(S=jn[x+2]));x-=3)if(M)jn[x+2]|=2;else{if(4&S)break;jn[x+2]|=4}for(C=0;C<z;C++)if(256==zn[C]){for(O=C+1;O<z&&256==zn[O];)O++;for(E=(A=1==(C?zn[C-1]:W))==(D=1==(O<z?zn[O]:W))?A?1:2:W,I=C;I<O;I++)zn[I]=E;C=O-1}if(R=[],1==W)for(L=0;L<z;){for(j=L,T=1!=zn[L++];L<z&&T==(1!=zn[L]);)L++;if(T)for(B=L;B>j;){for(_=B,N=2!=zn[--B];B>j&&N==(2!=zn[B-1]);)B--;R.push(new Hn(B,_,N?2:1))}else R.push(new Hn(j,L,0))}else for(P=0;P<z;){for(F=P,H=2==zn[P++];P<z&&H==(2==zn[P]);)P++;R.push(new Hn(F,P,H?1:2))}return R}function rv(t){return[new Hn(0,t,0)]}function uv(t,n,i,e,r){var u,o,s,h,f,a,c=e.head-t.from,l=-1;if(0==c){if(!r||!t.length)return null;n[0].level!=i&&(c=n[0].side(!1,i),l=0)}else if(c==t.length){if(r)return null;(o=n[n.length-1]).level!=i&&(c=o.side(!0,i),l=n.length-1)}return l<0&&(l=Hn.find(n,c,null!==(u=e.bidiLevel)&&void 0!==u?u:-1,e.assoc)),c==(s=n[l]).side(r,i)&&(c=(s=n[l+=r?1:-1]).side(!r,i)),h=r==(s.dir==i),f=Cc(t.text,c,h),Wn=t.text.slice(Math.min(c,f),Math.max(c,f)),f!=s.side(r,i)?m.cursor(f+t.from,h?-1:1,s.level):(a=l==(r?n.length-1:0)?null:n[l+(r?1:-1)])||s.level==i?a&&a.level<s.level?m.cursor(a.side(!r,i)+t.from,r?1:-1,a.level):m.cursor(f+t.from,r?-1:1,s.level):m.cursor(r?t.to:t.from,r?-1:1,i)}function ov(t){return 1==t.nodeType&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function sv(t){return 1==t.node.nodeType&&t.node.firstChild&&(0==t.offset||"false"==t.node.childNodes[t.offset-1].contentEditable)&&(t.offset==t.node.childNodes.length||"false"==t.node.childNodes[t.offset].contentEditable)}function hv(t){var n,i,e,r,u,o,s,h=t.observer.selectionRange,f=h.focusNode&&av(h.focusNode,h.focusOffset,0);if(!f)return null;if(!(n=t.docView.nearest(f)))return null;if(n instanceof Zt){for(i=f;i.parentNode!=n.dom;)i=i.parentNode;for(e=i.previousSibling;e&&!Ot.get(e);)e=e.previousSibling;return{from:r=e?Ot.get(e).posAtEnd:n.posAtStart,to:r,node:i,text:f}}for(;;){if(!(o=(u=n).parent))return null;if(o instanceof Zt)break;n=o}return{from:s=n.posAtStart,to:s+n.length,node:n.dom,text:f}}function fv(t,n){var i,e,r,u,o,s,h,f,a,c=hv(t);if(!c)return Jt.none;if(i=c.from,e=c.to,r=c.node,u=c.text,o=n.mapPos(i,1),s=Math.max(o,n.mapPos(e,-1)),h=t.state,(f=3==r.nodeType?r.nodeValue:new Un([],h).readRange(r.firstChild,null).text).indexOf(Vn)>-1)return Jt.none;if(s-o<f.length)if(h.doc.sliceString(o,Math.min(h.doc.length,o+f.length))==f)s=o+f.length;else{if(h.doc.sliceString(Math.max(0,s-f.length),s)!=f)return Jt.none;o=s-f.length}else if(h.doc.sliceString(o,s)!=f)return Jt.none;return(a=Ot.get(r))instanceof Ut?a=a.widget.topView:a&&(a.parent=null),Jt.set(Jt.replace({widget:new Jn(r,u,a),inclusive:!0}).range(o,s))}function av(t,n,i){var e,r,u,o;if(i<=0)for(e=t,r=n;;){if(3==e.nodeType)return e;if(!(1==e.nodeType&&r>0))break;r=xl(e=e.childNodes[r-1])}if(i>=0)for(u=t,o=n;;){if(3==u.nodeType)return u;if(!(1==u.nodeType&&o<u.childNodes.length&&i>=0))break;u=u.childNodes[o],o=0}return null}function cv(t,n){return 1!=t.nodeType?0:(n&&"false"==t.childNodes[n-1].contentEditable?1:0)|(n<t.childNodes.length&&"false"==t.childNodes[n].contentEditable?2:0)}function lv(t,n,i){var e=new Kn;return tt.compare(t,n,i,e),e.changes}function vv(t,n){for(var i=t;i&&i!=n;i=i.assignedSlot||i.parentNode)if(1==i.nodeType&&"false"==i.contentEditable)return!0;return!1}function dv(t,n){var i,e,r,u,o,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,h=t.charCategorizer(n),f=t.doc.lineAt(n),a=n-f.from;if(0==f.length)return m.cursor(n);for(0==a?s=1:a==f.length&&(s=-1),i=a,e=a,s<0?i=Cc(f.text,a,!1):e=Cc(f.text,a),r=h(f.text.slice(i,e));i>0&&(u=Cc(f.text,i,!1),h(f.text.slice(u,i))==r);)i=u;for(;e<f.length&&(o=Cc(f.text,e),h(f.text.slice(e,o))==r);)e=o;return m.range(i+f.from,e+f.from)}function yv(t,n){return n.left>t?n.left-t:Math.max(0,t-n.right)}function pv(t,n){return n.top>t?n.top-t:Math.max(0,t-n.bottom)}function kv(t,n){return t.top<n.bottom-1&&t.bottom>n.top+1}function mv(t,n){return n<t.top?{top:n,left:t.left,right:t.right,bottom:t.bottom}:t}function gv(t,n){return n>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:n}:t}function wv(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=!1;for(c=t.firstChild;c;c=c.nextSibling)for(l=gl(c),v=0;v<l.length;v++){if(d=l[v],r&&kv(r,d)&&(d=mv(gv(d,r.bottom),r.top)),y=yv(n,d),p=pv(i,d),0==y&&0==p)return 3==c.nodeType?bv(c,n,i):wv(c,n,i);(!e||o>p||o==p&&u>y)&&(e=c,r=d,u=y,o=p,w=!(k=p?i<d.top?-1:1:y?n<d.left?-1:1:0)||(k>0?v<l.length-1:v>0)),0==y?i>d.bottom&&(!f||f.bottom<d.bottom)?(s=c,f=d):i<d.top&&(!a||a.top>d.top)&&(h=c,a=d):f&&kv(f,d)?f=gv(f,d.bottom):a&&kv(a,d)&&(a=mv(a,d.top))}return f&&f.bottom>=i?(e=s,r=f):a&&a.top<=i&&(e=h,r=a),e?(m=Math.max(r.left,Math.min(r.right,n)),3==e.nodeType?bv(e,m,i):w&&"false"!=e.contentEditable?wv(e,m,i):{node:t,offset:g=Array.prototype.indexOf.call(t.childNodes,e)+(n>=(r.left+r.right)/2?1:0)}):{node:t,offset:0}}function bv(t,n,i){var e,r,u,o,s,h,f,a,c=t.nodeValue.length,l=-1,v=1e9,d=0;for(e=0;e<c;e++)for(r=El(t,e,e+1).getClientRects(),u=0;u<r.length;u++)if((o=r[u]).top!=o.bottom&&(d||(d=n-o.left),s=(o.top>i?o.top-i:i-o.bottom)-1,o.left-1<=n&&o.right+1>=n&&s<v)){if(f=h=n>=(o.left+o.right)/2,(Ft.chrome||Ft.gecko)&&(a=El(t,e).getBoundingClientRect()).left==o.right&&(f=!h),s<=0)return{node:t,offset:e+(f?1:0)};l=e+(f?1:0),v=s}return{node:t,offset:l>-1?l:d>0?t.nodeValue.length:0}}function Mv(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,b=t.contentDOM.getBoundingClientRect(),M=b.top+t.viewState.paddingTop,x=t.viewState.docHeight,S=n.x,C=n.y,O=C-M;if(O<0)return 0;if(O>x)return t.state.doc.length;for(o=t.defaultLineHeight/2,s=!1;(u=t.elementAtHeight(O)).type!=Gt.Text;)for(;!((O=w>0?u.bottom+o:u.top-o)>=0&&O<=x);){if(s)return i?null:0;s=!0,w=-w}if(C=M+O,(h=u.from)<t.viewport.from)return 0==t.viewport.from?0:i?null:xv(t,b,u,S,C);if(h>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:i?null:xv(t,b,u,S,C);if(f=t.dom.ownerDocument,(c=(a=t.root.elementFromPoint?t.root:f).elementFromPoint(S,C))&&!t.contentDOM.contains(c)&&(c=null),c||(S=Math.max(b.left+1,Math.min(b.right-1,S)),(c=a.elementFromPoint(S,C))&&!t.contentDOM.contains(c)&&(c=null)),v=-1,c&&0!=(null===(e=t.docView.nearest(c))||void 0===e?void 0:e.isEditable)&&(f.caretPositionFromPoint?(d=f.caretPositionFromPoint(S,C))&&(l=d.offsetNode,v=d.offset):f.caretRangeFromPoint&&(y=f.caretRangeFromPoint(S,C))&&(l=y.startContainer,v=y.startOffset,(!t.contentDOM.contains(l)||Ft.safari&&Sv(l,v,S)||Ft.chrome&&Cv(l,v,S))&&(l=void 0))),!l||!t.docView.dom.contains(l)){if(!(p=Zt.find(t.docView,h)))return O>u.top+u.height/2?u.to:u.from;l=(k=wv(p.dom,S,C)).node,v=k.offset}return(m=t.docView.nearest(l))?m.isWidget&&1==(null===(r=m.dom)||void 0===r?void 0:r.nodeType)?(g=m.dom.getBoundingClientRect(),n.y<g.top||n.y<=g.bottom&&n.x<=(g.left+g.right)/2?m.posAtStart:m.posAtEnd):m.localPosFromDOM(l,v)+m.posAtStart:null}function xv(t,n,i,e,r){var u,o,s=Math.round((e-n.left)*t.defaultCharacterWidth);return t.lineWrapping&&i.height>1.5*t.defaultLineHeight&&(s+=(u=Math.floor((r-i.top)/t.defaultLineHeight))*t.viewState.heightOracle.lineLength),o=t.state.sliceDoc(i.from,i.to),i.from+vl(o,s,t.state.tabSize)}function Sv(t,n,i){var e,r;if(3!=t.nodeType||n!=(e=t.nodeValue.length))return!1;for(r=t.nextSibling;r;r=r.nextSibling)if(1!=r.nodeType||"BR"!=r.nodeName)return!1;return El(t,e-1,e).getBoundingClientRect().left>i}function Cv(t,n,i){var e,r,u;if(0!=n)return!1;for(e=t;;){if(!(r=e.parentNode)||1!=r.nodeType||r.firstChild!=e)return!1;if(r.classList.contains("cm-line"))break;e=r}return i-(u=1==t.nodeType?t.getBoundingClientRect():El(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect()).left>5}function Ov(t,n,i,e){var r,u,o,s,h,f=t.state.doc.lineAt(n.head),a=e&&t.lineWrapping?t.coordsAtPos(n.assoc<0&&n.head>f.from?n.head-1:n.head):null;return a&&(r=t.dom.getBoundingClientRect(),u=t.textDirectionAt(f.from),null!=(o=t.posAtCoords({x:i==(u==An.LTR)?r.right-1:r.left+1,y:(a.top+a.bottom)/2})))?m.cursor(o,i?-1:1):(h=(s=Zt.find(t.docView,n.head))?i?s.posAtEnd:s.posAtStart:i?f.to:f.from,m.cursor(h,i?-1:1))}function Av(t,n,i,e){var r,u,o,s,h=t.state.doc.lineAt(n.head),f=t.bidiSpans(h),a=t.textDirectionAt(h.from);for(r=n,u=null;;){if(o=uv(h,f,a,r,i),s=Wn,!o){if(h.number==(i?t.state.doc.lines:1))return r;s="\n",h=t.state.doc.line(h.number+(i?1:-1)),f=t.bidiSpans(h),o=m.cursor(i?h.from:h.to)}if(u){if(!u(s))return r}else{if(!e)return o;u=e(s)}r=o}}function Dv(t,n,i){var e=t.state.charCategorizer(n),r=e(i);return function(t){var n=e(t);return r==G.Space&&(r=n),r==n}}function Ev(t,n,i,e){var r,u,o,s,h,f,a,c,l,v,d,y=n.head,p=i?1:-1;if(y==(i?t.state.doc.length:0))return m.cursor(y,n.assoc);for(r=n.goalColumn,o=t.contentDOM.getBoundingClientRect(),s=t.coordsAtPos(y),h=t.documentTop,s?(null==r&&(r=s.left-o.left),u=p<0?s.top:s.bottom):(f=t.viewState.lineBlockAt(y),null==r&&(r=Math.min(o.right-o.left,t.defaultCharacterWidth*(y-f.from))),u=(p<0?f.top:f.bottom)+h),a=o.left+r,c=null!=e?e:t.defaultLineHeight>>1,l=0;;l+=10)if(d=Mv(t,{x:a,y:v=u+(c+l)*p},!1,p),v<o.top||v>o.bottom||(p<0?d<y:d>y))return m.cursor(d,n.assoc,void 0,r)}function Iv(t,n,i){for(var e=function e(){var r,u,o=0,s=ic(t);try{for(s.s();!(r=s.n()).done;)(u=r.value).between(n-1,n+1,(function(t,e,r){if(n>t&&n<e){var u=o||i||(n-t<e-n?-1:1);n=u<0?t:e,o=u}}))}catch(t){s.e(t)}finally{s.f()}if(!o)return{v:n}},r;;)if(r=e())return r.v}function Rv(t,n,i){var e=Iv(t.state.facet(Mn).map((function(n){return n(t)})),i.from,n.head>i.from?-1:1);return e==i.from?i:m.cursor(e,e<i.from?1:-1)}function Lv(t){return.7*Math.max(0,t)+8}function jv(t,n){var i=t.state.facet(en);return i.length?i[0](n):Ft.mac?n.metaKey:n.ctrlKey}function Tv(t,n){var i=t.state.facet(rn);return i.length?i[0](n):Ft.mac?!n.altKey:!n.ctrlKey}function Bv(t,n){var i,e,r,u,o=t.state.selection.main;if(o.empty)return!1;if(!(i=yl(t.root))||0==i.rangeCount)return!0;for(e=i.getRangeAt(0).getClientRects(),r=0;r<e.length;r++)if((u=e[r]).left<=n.clientX&&u.right>=n.clientX&&u.top<=n.clientY&&u.bottom>=n.clientY)return!0;return!1}function _v(t,n){if(!n.bubbles)return!0;if(n.defaultPrevented)return!1;for(var i=n.target,e;i!=t.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(e=Ot.get(i))&&e.ignoreEvent(n))return!1;return!0}function Nv(t){var n,i=t.dom.parentNode;i&&((n=i.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((function(){t.focus(),n.remove(),Pv(t,n.value)}),50))}function Pv(t,n){var i,e,r=t.state,u=1,o=r.toText(n),s=o.lines==r.selection.ranges.length,h=null!=ci&&r.selection.ranges.every((function(t){return t.empty}))&&ci==o.toString();h?(e=-1,i=r.changeByRange((function(t){var i,h=r.doc.lineAt(t.from);return h.from==e?{range:t}:(e=h.from,i=r.toText((s?o.line(u++).text:n)+r.lineBreak),{changes:{from:h.from,insert:i},range:m.cursor(t.from+i.length)})}))):i=s?r.changeByRange((function(t){var n=o.line(u++);return{changes:{from:t.from,to:t.to,insert:n.text},range:m.cursor(t.from+n.length)}})):r.replaceSelection(o),t.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}function Fv(t,n,i,e){var r,u,o,s;return 1==e?m.cursor(n,i):2==e?dv(t.state,n,i):(r=Zt.find(t.docView,n),u=t.state.doc.lineAt(r?r.posAtEnd:n),o=r?r.posAtStart:u.from,(s=r?r.posAtEnd:u.to)<t.state.doc.length&&s==u.to&&s++,m.range(o,s))}function Hv(t,n,i,e){var r,u,o,s=Zt.find(t.docView,n);return s?0==(r=n-s.posAtStart)?1:r==s.length||(u=s.coordsAt(r,-1))&&oi(i,e,u)?-1:(o=s.coordsAt(r,1))&&oi(i,e,o)?1:u&&ui(e,u)?-1:1:1}function zv(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1);return{pos:i,bias:Hv(t,i,n.clientX,n.clientY)}}function Wv(t){if(!si)return t.detail;var n=hi,i=ai;return hi=t,ai=Date.now(),fi=!n||i>Date.now()-400&&Math.abs(n.clientX-t.clientX)<2&&Math.abs(n.clientY-t.clientY)<2?(fi+1)%3:1}function Vv(t,n){var i=zv(t,n),e=Wv(n),r=t.state.selection;return{update:function t(n){n.docChanged&&(i.pos=n.changes.mapPos(i.pos),r=r.map(n.changes))},get:function n(u,o,s){var h,f,a,c,l=zv(t,u),v=Fv(t,l.pos,l.bias,e);return i.pos==l.pos||o||(f=Fv(t,i.pos,i.bias,e),a=Math.min(f.from,v.from),c=Math.max(f.to,v.to),v=a<v.from?m.range(a,c):m.range(c,a)),o?r.replaceRange(r.main.extend(v.from,v.to)):s&&1==e&&r.ranges.length>1&&(h=Uv(r,l.pos))?h:s?r.addRange(v):m.create([v])}}}function Uv(t,n){var i,e,r,u;for(i=0;i<t.ranges.length;i++)if(r=(e=t.ranges[i]).from,u=e.to,r<=n&&u>=n)return m.create(t.ranges.slice(0,i).concat(t.ranges.slice(i+1)),t.mainIndex==i?0:t.mainIndex-(t.mainIndex>i?1:0));return null}function $v(t,n,i,e){var r,u,o,s,h;i&&(r=t.posAtCoords({x:n.clientX,y:n.clientY},!1),n.preventDefault(),u=t.inputState.mouseSelection,o=e&&u&&u.dragging&&u.dragMove?{from:u.dragging.from,to:u.dragging.to}:null,s={from:r,insert:i},h=t.state.changes(o?[o,s]:s),t.focus(),t.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}))}function qv(t,n){var i,e=t.dom.parentNode;e&&((i=e.appendChild(document.createElement("textarea"))).style.cssText="position: fixed; left: -10000px; top: 10px",i.value=n,i.focus(),i.selectionEnd=n.length,i.selectionStart=0,setTimeout((function(){i.remove(),t.focus()}),50))}function Gv(t){var n,i,e,r,u,o,s,h=[],f=[],a=!1,c=ic(t.selection.ranges);try{for(c.s();!(n=c.n()).done;)(i=n.value).empty||(h.push(t.sliceDoc(i.from,i.to)),f.push(i))}catch(t){c.e(t)}finally{c.f()}if(!h.length){e=-1,r=ic(t.selection.ranges);try{for(r.s();!(u=r.n()).done;)o=u.value.from,(s=t.doc.lineAt(o)).number>e&&(h.push(s.text),f.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),e=s.number}catch(t){r.e(t)}finally{r.f()}a=!0}return{text:h.join(t.lineBreak),ranges:f,linewise:a}}function Jv(t,n){var i,e,r,u=[],o=ic(t.facet(fn));try{for(o.s();!(i=o.n()).done;)(r=(e=i.value)(t,n))&&u.push(r)}catch(t){o.e(t)}finally{o.f()}return u?t.update({effects:u,annotations:li.of(!0)}):null}function Kv(t){setTimeout((function(){var n,i=t.hasFocus;i!=t.inputState.notifiedFocused&&((n=Jv(t.state,i))?t.dispatch(n):t.update([]))}),10)}function Qv(t,n){var i,e;null==t[n]&&(i=t[n-1])instanceof Mi&&(e=t[n+1])instanceof Mi&&t.splice(n-1,3,new Mi(i.length+1+e.length))}function Xv(t,n,i){var e=new Oi;return tt.compare(t,n,i,e,0),e.changes}function Zv(t,n){var i,e,r,u,o=t.getBoundingClientRect(),s=t.ownerDocument,h=s.defaultView||window,f=Math.max(0,o.left),a=Math.min(h.innerWidth,o.right),c=Math.max(0,o.top),l=Math.min(h.innerHeight,o.bottom);for(i=t.parentNode;i&&i!=s.body;)if(1==i.nodeType)e=i,r=window.getComputedStyle(e),(e.scrollHeight>e.clientHeight||e.scrollWidth>e.clientWidth)&&"visible"!=r.overflow&&(u=e.getBoundingClientRect(),f=Math.max(f,u.left),a=Math.min(a,u.right),c=Math.max(c,u.top),l=i==t.parentNode?u.bottom:Math.min(l,u.bottom)),i="absolute"==r.position||"fixed"==r.position?e.offsetParent:e.parentNode;else{if(11!=i.nodeType)break;i=i.host}return{left:f-o.left,right:Math.max(f,a)-o.left,top:c-(o.top+n),bottom:Math.max(c,l)-(o.top+n)}}function Yv(t,n){var i=t.getBoundingClientRect();return{left:0,right:i.right-i.left,top:n,bottom:i.bottom-(i.top+n)}}function td(t,n,i){var e=[],r=t,u=0;return tt.spans(i,t,n,{span:function t(){},point:function t(n,i){n>r&&(e.push({from:r,to:n}),u+=n-r),r=i}},20),r<n&&(e.push({from:r,to:n}),u+=n-r),{total:u,ranges:e}}function nd(t,n){var i,e,r,u,o,s,h=t.total,f=t.ranges;if(n<=0)return f[0].from;if(n>=1)return f[f.length-1].to;for(i=Math.floor(h*n),e=0;;e++){if(u=(r=f[e]).from,i<=(s=(o=r.to)-u))return u+i;i-=s}}function id(t,n){var i,e,r,u,o=0,s=ic(t.ranges);try{for(s.s();!(i=s.n()).done;){if(r=(e=i.value).from,n<=(u=e.to)){o+=n-r;break}o+=u-r}}catch(t){s.e(t)}finally{s.f()}return o/t.total}function ed(t,n){var i,e,r=ic(t);try{for(r.s();!(i=r.n()).done;)if(n(e=i.value))return e}catch(t){r.e(t)}finally{r.f()}}function rd(t,n){if(1==n.scale)return t;var i=n.toDOM(t.top),e=n.toDOM(t.bottom);return new pi(t.from,t.length,i,e-i,t.children&&t.children.map((function(t){return rd(t,n)})),t.deco)}function ud(t,n,i){return new at(n,{finish:function n(e){return/&/.test(e)?e.replace(/&\w*/,(function(n){if("&"==n)return t;if(!i||!i[n])throw new RangeError("Unsupported selector: ".concat(n));return i[n]})):t+" "+e}})}function od(t,n){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,g,w,b,M,x,S,C=n.newSel,O=t.state.selection.main,A=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;return n.bounds?(u=(r=n.bounds).from,o=r.to,s=O.from,h=null,(8===A||Ft.android&&n.text.length<o-u)&&(s=O.to,h="end"),(f=sd(t.state.doc.sliceString(u,o,Vn),n.text,s-u,h))&&(Ft.chrome&&13==A&&f.toB==f.from+2&&n.text.slice(f.from,f.toB)==Vn+Vn&&f.toB--,e={from:u+f.from,to:u+f.toA,insert:i.of(n.text.slice(f.from,f.toB).split(Vn))})):C&&(!t.hasFocus&&t.state.facet(dn)||C.main.eq(O))&&(C=null),!(!e&&!C)&&(!e&&n.typeOver&&!O.empty&&C&&C.main.empty?e={from:O.from,to:O.to,insert:t.state.doc.slice(O.from,O.to)}:e&&e.from>=O.from&&e.to<=O.to&&(e.from!=O.from||e.to!=O.to)&&O.to-O.from-(e.to-e.from)<=4?e={from:O.from,to:O.to,insert:t.state.doc.slice(O.from,e.from).append(e.insert).append(t.state.doc.slice(e.to,O.to))}:(Ft.mac||Ft.android)&&e&&e.from==e.to&&e.from==O.head-1&&/^\. ?$/.test(e.insert.toString())&&"off"==t.contentDOM.getAttribute("autocorrect")?(C&&2==e.insert.length&&(C=m.single(C.main.anchor-1,C.main.head-1)),e={from:O.from,to:O.to,insert:i.of([" "])}):Ft.chrome&&e&&e.from==e.to&&e.from==O.head&&"\n "==e.insert.toString()&&t.lineWrapping&&(C&&(C=m.single(C.main.anchor-1,C.main.head-1)),e={from:O.from,to:O.to,insert:i.of([" "])}),e?(a=t.state,!(!Ft.ios||!t.inputState.flushIOSKey(t))||(!(!Ft.android||!(e.from==O.from&&e.to==O.to&&1==e.insert.length&&2==e.insert.lines&&Il(t.contentDOM,"Enter",13)||(e.from==O.from-1&&e.to==O.to&&0==e.insert.length||8==A&&e.insert.length<e.to-e.from)&&Il(t.contentDOM,"Backspace",8)||e.from==O.from&&e.to==O.to+1&&0==e.insert.length&&Il(t.contentDOM,"Delete",46)))||(c=e.insert.toString(),t.state.facet(hn).some((function(n){return n(t,e.from,e.to,c)}))||(t.inputState.composing>=0&&t.inputState.composing++,e.from>=O.from&&e.to<=O.to&&e.to-e.from>=(O.to-O.from)/3&&(!C||C.main.empty&&C.main.from==e.from+e.insert.length)&&t.inputState.composing<0?(v=O.from<e.from?a.sliceDoc(O.from,e.from):"",d=O.to>e.to?a.sliceDoc(e.to,O.to):"",l=a.replaceSelection(t.state.toText(v+e.insert.sliceString(0,void 0,t.state.lineBreak)+d))):(y=a.changes(e),p=C&&C.main.to<=y.newLength?C.main:void 0,a.selection.ranges.length>1&&t.inputState.composing>=0&&e.to<=O.to&&e.to>=O.to-10?(k=t.state.sliceDoc(e.from,e.to),g=hv(t)||t.state.doc.lineAt(O.head),w=O.to-e.to,b=O.to-O.from,l=a.changeByRange((function(n){var i,r,u,o;return n.from==O.from&&n.to==O.to?{changes:y,range:p||n.map(y)}:(r=(i=n.to-w)-k.length,n.to-n.from!=b||t.state.sliceDoc(r,i)!=k||g&&n.to>=g.from&&n.from<=g.to?{range:n}:(u=a.changes({from:r,to:i,insert:e.insert}),o=n.to-O.to,{changes:u,range:p?m.range(Math.max(0,p.anchor+o),Math.max(0,p.head+o)):n.map(u)}))}))):l={changes:y,selection:p&&a.selection.replaceRange(p)}),M="input.type",(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,M+=".compose",t.inputState.compositionFirstChange&&(M+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(l,{scrollIntoView:!0,userEvent:M})),!0))):!(!C||C.main.eq(O))&&(x=!1,S="select",t.inputState.lastSelectionTime>Date.now()-50&&("select"==t.inputState.lastSelectionOrigin&&(x=!0),S=t.inputState.lastSelectionOrigin),t.dispatch({selection:C,scrollIntoView:x,userEvent:S}),!0))}function sd(t,n,i,e){for(var r,u,o,s,h,f=Math.min(t.length,n.length),a=0;a<f&&t.charCodeAt(a)==n.charCodeAt(a);)a++;if(a==f&&t.length==n.length)return null;for(r=t.length,u=n.length;r>0&&u>0&&t.charCodeAt(r-1)==n.charCodeAt(u-1);)r--,u--;return"end"==e&&(i-=r+(o=Math.max(0,a-Math.min(r,u)))-a),r<a&&t.length<n.length?(u=(a-=s=i<=a&&i>=r?a-i:0)+(u-r),r=a):u<a&&(r=(a-=h=i<=a&&i>=u?a-i:0)+(r-u),u=a),{from:a,toA:r,toB:u}}function hd(t){var n,i,e,r,u,o=[];return t.root.activeElement!=t.contentDOM||(i=(n=t.observer.selectionRange).anchorNode,e=n.anchorOffset,r=n.focusNode,u=n.focusOffset,i&&(o.push(new $n(i,e)),r==i&&u==e||o.push(new $n(r,u)))),o}function fd(t,n){if(0==t.length)return null;var i=t[0].pos,e=2==t.length?t[1].pos:i;return i>-1&&e>-1?m.single(i+n,e+n):null}function ad(t,n,i){for(var e,r;n;){if((e=Ot.get(n))&&e.parent==t)return e;n=(r=n.parentNode)!=t.dom?r:i>0?n.nextSibling:n.previousSibling}return null}function cd(t){var n,i,e,r,u,o,s=null;function h(t){t.preventDefault(),t.stopImmediatePropagation(),s=t.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",h,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",h,!0),s?(n=s.startContainer,i=s.startOffset,e=s.endContainer,r=s.endOffset,wl((u=t.docView.domAtPos(t.state.selection.main.anchor)).node,u.offset,e,r)&&(n=(o=[e,r,n,i])[0],i=o[1],e=o[2],r=o[3]),{anchorNode:n,anchorOffset:i,focusNode:e,focusOffset:r}):null}function ld(t,n,i){var e,r,u,o;for(r=(e=t.state.facet(n)).length-1;r>=0;r--)(o="function"==typeof(u=e[r])?u(t):u)&&ql(o,i);return i}function vd(t,n){var i,e,r,u,o,s,h=t.split(/-(?!$)/),f=h[h.length-1];for("Space"==f&&(f=" "),o=0;o<h.length-1;++o)if(s=h[o],/^(cmd|meta|m)$/i.test(s))u=!0;else if(/^a(lt)?$/i.test(s))i=!0;else if(/^(c|ctrl|control)$/i.test(s))e=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);"mac"==n?u=!0:e=!0}return i&&(f="Alt-"+f),e&&(f="Ctrl-"+f),u&&(f="Meta-"+f),r&&(f="Shift-"+f),f}function dd(t,n,i){return n.altKey&&(t="Alt-"+t),n.ctrlKey&&(t="Ctrl-"+t),n.metaKey&&(t="Meta-"+t),!1!==i&&n.shiftKey&&(t="Shift-"+t),t}function yd(t){var n=t.facet(Qi),i=Xi.get(n);return i||Xi.set(n,i=kd(n.reduce((function(t,n){return t.concat(n)}),[]))),i}function pd(t,n,i){return md(yd(t.state),n,t,i)}function kd(t){var n,i,e,r,u,o,s,h,f,a,c,l,v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ji,d=Object.create(null),y=Object.create(null),p=function t(n,i){var e=y[n];if(null==e)y[n]=i;else if(e!=i)throw new Error("Key binding "+n+" is used both as a regular binding and as a multi-stroke prefix")},k=function t(n,i,e,r){var u,o,s,h,f,a=d[n]||(d[n]=Object.create(null)),c=i.split(/ (?!$)/).map((function(t){return vd(t,v)})),l=function t(){var i=c.slice(0,s).join(" ");p(i,!0),a[i]||(a[i]={preventDefault:!0,run:[function(t){var e=Zi={view:t,prefix:i,scope:n};return setTimeout((function(){Zi==e&&(Zi=null)}),Yi),!0}]})};for(s=1;s<c.length;s++)l();h=c.join(" "),p(h,!1),f=a[h]||(a[h]={preventDefault:!1,run:(null===(o=null===(u=a.Wde)||void 0===u?void 0:u.run)||void 0===o?void 0:o.slice())||[]}),e&&f.run.push(e),r&&(f.preventDefault=!0)},m=ic(t);try{for(m.s();!(n=m.n()).done;){if(e=(i=n.value).scope?i.scope.split(" "):["editor"],i.any){r=ic(e);try{for(r.s();!(u=r.n()).done;)for(h in o=u.value,(s=d[o]||(d[o]=Object.create(null))).Wde||(s.Wde={preventDefault:!1,run:[]}),s)s[h].run.push(i.any)}catch(t){r.e(t)}finally{r.f()}}if(f=i[v]||i.key){a=ic(e);try{for(a.s();!(c=a.n()).done;)k(l=c.value,f,i.run,i.preventDefault),i.shift&&k(l,"Shift-"+f,i.shift,i.preventDefault)}catch(t){a.e(t)}finally{a.f()}}}}catch(t){m.e(t)}finally{m.f()}return d}function md(t,n,i,e){var r,u,o,s,h,f=dl(n),a=Ic(f,0),c=Lc(a)==f.length&&" "!=f,l="",v=!1;if(Zi&&Zi.view==i&&Zi.scope==e&&(l=Zi.prefix+" ",(v=Yn.indexOf(n.keyCode)<0)&&(Zi=null)),r=new Set,u=function t(e){var u,o,s;if(e){u=ic(e.run);try{for(u.s();!(o=u.n()).done;)if(s=o.value,!r.has(s)&&(r.add(s),s(i,n)))return!0}catch(t){u.e(t)}finally{u.f()}e.preventDefault&&(v=!0)}return!1},o=t[e]){if(u(o[l+dd(f,n,!c)]))return!0;if(c&&(n.altKey||n.metaKey||n.ctrlKey)&&!(Ft.windows&&n.ctrlKey&&n.altKey)&&(s=vt[n.keyCode])&&s!=f){if(u(o[l+dd(s,n,!0)]))return!0;if(n.shiftKey&&(h=dt[n.keyCode])!=f&&h!=s&&u(o[l+dd(h,n,!1)]))return!0}else if(c&&n.shiftKey&&u(o[l+dd(f,n,!0)]))return!0;if(u(o.Wde))return!0}return v}function gd(t){var n=t.scrollDOM.getBoundingClientRect(),i=t.textDirection==An.LTR?n.left:n.right-t.scrollDOM.clientWidth;return{left:i-t.scrollDOM.scrollLeft,top:n.top-t.scrollDOM.scrollTop}}function wd(t,n,i){var e=m.cursor(n);return{from:Math.max(i.from,t.moveToLineBoundary(e,!1,!0).from),to:Math.min(i.to,t.moveToLineBoundary(e,!0,!0).from),type:Gt.Text}}function bd(t,n){var i,e,r,u=t.lineBlockAt(n);if(Array.isArray(u.type)){i=ic(u.type);try{for(i.s();!(e=i.n()).done;)if((r=e.value).to>n||r.to==n&&(r.to==u.to||r.type==Gt.Text))return r}catch(t){i.e(t)}finally{i.f()}}return u}function Md(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g;return i.to<=t.viewport.from||i.from>=t.viewport.to?[]:(e=Math.max(i.from,t.viewport.from),r=Math.min(i.to,t.viewport.to),u=t.textDirection==An.LTR,o=t.contentDOM,s=o.getBoundingClientRect(),h=gd(t),a=(f=o.querySelector(".cm-line"))&&window.getComputedStyle(f),c=s.left+(a?parseInt(a.paddingLeft)+Math.min(0,parseInt(a.textIndent)):0),l=s.right-(a?parseInt(a.paddingRight):0),v=bd(t,e),d=bd(t,r),y=v.type==Gt.Text?v:null,p=d.type==Gt.Text?d:null,t.lineWrapping&&(y&&(y=wd(t,e,y)),p&&(p=wd(t,r,p))),y&&p&&y.from==p.from?b(M(i.from,i.to,y)):(k=y?M(i.from,null,y):x(v,!1),m=p?M(null,i.to,p):x(d,!0),g=[],(y||v).to<(p||d).from-(y&&p?1:0)?g.push(w(c,k.bottom,l,m.top)):k.bottom<m.top&&t.elementAtHeight((k.bottom+m.top)/2).type==Gt.Text&&(k.bottom=m.top=(k.bottom+m.top)/2),b(k).concat(g).concat(b(m))));function w(t,i,e,r){return new te(n,t-h.left,i-h.top-.01,e-t,r-i+.01)}function b(t){var n,i=t.top,e=t.bottom,r=t.horizontal,u=[];for(n=0;n<r.length;n+=2)u.push(w(r[n],i,r[n+1],e));return u}function M(n,i,e){var r,o,s,h,f,a,v,d,y,p,k,m,g,w=1e9,b=-1e9,M=[];function x(n,i,r,o,s){var h=t.coordsAtPos(n,n==e.to?-2:2),f=t.coordsAtPos(r,r==e.from?2:-2);h&&f&&(w=Math.min(h.top,f.top,w),b=Math.max(h.bottom,f.bottom,b),s==An.LTR?M.push(u&&i?c:h.left,u&&o?l:f.right):M.push(!u&&o?c:f.left,!u&&i?l:h.right))}r=null!=n?n:e.from,o=null!=i?i:e.to,s=ic(t.visibleRanges);try{for(s.s();!(h=s.n()).done;)if((f=h.value).to>r&&f.from<o)for(a=Math.max(f.from,r),v=Math.min(f.to,o);;){d=t.state.doc.lineAt(a),y=ic(t.bidiSpans(d));try{for(y.s();!(p=y.n()).done&&(m=(k=p.value).from+d.from,g=k.to+d.from,!(m>=v));)g>a&&x(Math.max(m,a),null==n&&m<=r,Math.min(g,v),null==i&&g>=o,k.dir)}catch(t){y.e(t)}finally{y.f()}if((a=d.to+1)>=v)break}}catch(t){s.e(t)}finally{s.f()}return 0==M.length&&x(r,null==n,o,null==i,t.textDirection),{top:w,bottom:b,horizontal:M}}function x(t,n){var i=s.top+(n?t.top:t.bottom);return{top:i,bottom:i,horizontal:[]}}}function xd(t,n){return t.constructor==n.constructor&&t.eq(n)}function Sd(t){return[kn.define((function(n){return new ne(n,t)})),ie.of(t)]}function Cd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[re.of(t),ue,oe,he,cn.of(!0)]}function Od(t){return t.startState.facet(re)!=t.state.facet(re)}function Ad(t,n){n.style.animationDuration=t.facet(re).cursorBlinkRate+"ms"}function Dd(){return[ae,ce]}function Ed(t,n,i,e,r){n.lastIndex=0;for(var u=t.iterRange(i,e),o=i,s;!u.next().done;o+=u.value.length)if(!u.lineBreak)for(;s=n.exec(u.value);)r(o+s.index,s)}function Id(t,n){var i,e,r,u,o,s,h=t.visibleRanges;if(1==h.length&&h[0].from==t.viewport.from&&h[0].to==t.viewport.to)return h;i=[],e=ic(h);try{for(e.s();!(r=e.n()).done;)o=(u=r.value).from,s=u.to,o=Math.max(t.state.doc.lineAt(o).from,o-n),s=Math.min(t.state.doc.lineAt(s).to,s+n),i.length&&i[i.length-1].to>=o?i[i.length-1].to=s:i.push({from:o,to:s})}catch(t){e.e(t)}finally{e.f()}return i}function Rd(){var t,n;return null==pe&&"undefined"!=typeof document&&document.body&&(n=document.body.style,pe=null!=(null!==(t=n.tabSize)&&void 0!==t?t:n.MozTabSize)),pe||!1}function Ld(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[ke.of(t),jd()]}function jd(){return me||(me=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.decorations=Jt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ke)),this.decorations=this.decorator.createDeco(n)}return kc(t,[{key:"makeDecorator",value:function t(n){var i=this;return new le({regexp:n.specialChars,decoration:function t(e,r,u){var o,s,h,f=r.state.doc,a=Ic(e[0],0);return 9==a?(o=f.lineAt(u),s=r.state.tabSize,h=ll(o.text,s,u-o.from),Jt.replace({widget:new be((s-h%s)*i.view.defaultCharacterWidth)})):i.decorationCache[a]||(i.decorationCache[a]=Jt.replace({widget:new we(n,a)}))},boundary:n.replaceTabs?void 0:/[^]/})}},{key:"update",value:function t(n){var i=n.state.facet(ke);n.startState.facet(ke)!=i?(this.decorator=this.makeDecorator(i),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}}]),t}(),{decorations:function t(n){return n.decorations}}))}function Td(t){return t>=32?ge:10==t?"\u2424":String.fromCharCode(9216+t)}function Bd(){return[Me,wn.of((function(t){var n;return(null===(n=t.plugin(Me))||void 0===n?void 0:n.attrs)||null}))]}function _d(){return Se}function Nd(t){return kn.fromClass(function(){function n(i){yc(this,n),this.view=i,this.placeholder=Jt.set([Jt.widget({widget:new Ce(t),side:1}).range(0)])}return kc(n,[{key:"decorations",get:function t(){return this.view.state.doc.length?Jt.none:this.placeholder}}]),n}(),{decorations:function t(n){return n.decorations}})}function Pd(t,n,i){var e,r,u,o,s,h,f,a,c,l,v=Math.min(n.line,i.line),d=Math.max(n.line,i.line),y=[];if(n.off>Oe||i.off>Oe||n.col<0||i.col<0)for(e=Math.min(n.off,i.off),r=Math.max(n.off,i.off),u=v;u<=d;u++)(o=t.doc.line(u)).length<=r&&y.push(m.range(o.from+e,o.to+r));else for(s=Math.min(n.col,i.col),h=Math.max(n.col,i.col),f=v;f<=d;f++)(c=vl((a=t.doc.line(f)).text,s,t.tabSize,!0))<0?y.push(m.cursor(a.to)):(l=vl(a.text,h,t.tabSize),y.push(m.range(a.from+c,a.from+l)));return y}function Fd(t,n){var i=t.coordsAtPos(t.viewport.from);return i?Math.round(Math.abs((i.left-n)/t.defaultCharacterWidth)):-1}function Hd(t,n){var i=t.posAtCoords({x:n.clientX,y:n.clientY},!1),e=t.state.doc.lineAt(i),r=i-e.from,u=r>Oe?-1:r==e.length?Fd(t,n.clientX):ll(e.text,t.state.tabSize,i-e.from);return{line:e.number,col:u,off:r}}function zd(t,n){var i=Hd(t,n),e=t.state.selection;return i?{update:function t(n){var r,u;n.docChanged&&(r=n.changes.mapPos(n.startState.doc.line(i.line).from),u=n.state.doc.lineAt(r),i={line:u.number,col:i.col,off:Math.min(i.off,u.length)},e=e.map(n.changes))},get:function n(r,u,o){var s,h=Hd(t,r);return h&&(s=Pd(t.state,i,h)).length?o?m.create(s.concat(e.ranges)):m.create(s):e}}:null}function Wd(t){var n=(null==t?void 0:t.eventFilter)||function(t){return t.altKey&&0==t.button};return Ui.mouseSelectionStyle.of((function(t,i){return n(i)?zd(t,i):null}))}function Vd(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Za(Ae[t.key||"Alt"],2),i=n[0],e=n[1],r=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.isDown=!1}return kc(t,[{key:"set",value:function t(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}}]),t}(),{eventHandlers:{keydown:function t(n){this.set(n.keyCode==i||e(n))},keyup:function t(n){n.keyCode!=i&&e(n)||this.set(!1)},mousemove:function t(n){this.set(e(n))}}});return[r,Ui.contentAttributes.of((function(t){var n;return(null===(n=t.plugin(r))||void 0===n?void 0:n.isDown)?De:null}))]}function Ud(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Re.of(t)}function $d(t){var n=t.win;return{top:0,left:0,bottom:n.innerHeight,right:n.innerWidth}}function qd(t){for(var n=t;n;n=n.parentNode)if(1==n.nodeType&&n.classList.contains("cm-tooltip"))return!0;return!1}function Gd(t,n,i,e,r,u){var o,s,h,f,a=document.createRange(),c=t.domAtPos(n),l=t.domAtPos(i);for(a.setEnd(l.node,l.offset),a.setStart(c.node,c.offset),o=a.getClientRects(),a.detach(),s=0;s<o.length;s++)if(h=o[s],(f=Math.max(h.top-r,r-h.bottom,h.left-e,e-h.right))<=u)return!0;return!1}function Jd(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=U.define(),e=x.define({create:function t(){return null},update:function t(e,r){var u,o,s,h,f;if(e&&(n.hideOnChange&&(r.docChanged||r.selection)||n.hideOn&&n.hideOn(r,e)))return null;if(e&&r.docChanged){if(null==(u=r.changes.mapPos(e.pos,-1,v.TrackDel)))return null;(o=Object.assign(Object.create(null),e)).pos=u,null!=e.end&&(o.end=r.changes.mapPos(e.end)),e=o}s=ic(r.effects);try{for(s.s();!(h=s.n()).done;)(f=h.value).is(i)&&(e=f.value),f.is(ze)&&(e=null)}catch(t){s.e(t)}finally{s.f()}return e},provide:function t(n){return Ne.from(n)}});return[e,kn.define((function(r){return new He(r,t,e,i,n.hoverTime||300)})),Fe]}function Kd(t,n){var i,e=t.plugin(je);return e?(i=e.manager.tooltips.indexOf(n))<0?null:e.manager.tooltipViews[i]:null}function Qd(t){return t.facet(Ne).some((function(t){return t}))}function Xd(t){var n;null===(n=t.plugin(je))||void 0===n||n.maybeMeasure()}function Zd(t){return t?[Ve.of(t)]:[]}function Yd(t,n){var i=t.plugin(Ue),e=i?i.specs.indexOf(n):-1;return e>-1?i.panels[e]:null}function ty(t){var n=t.nextSibling;return t.remove(),n}function ny(t){return[iy(),Qe.of(Object.assign(Object.assign({},Ke),t))]}function iy(t){var n=[Ze];return t&&!1===t.fixed&&n.push(Xe.of(!0)),n}function ey(t){return Array.isArray(t)?t:[t]}function ry(t,n,i){for(;t.value&&t.from<=i;)t.from==i&&n.push(t.value),t.next()}function uy(t,n){if(t.length!=n.length)return!1;for(var i=0;i<t.length;i++)if(!t[i].compare(n[i]))return!1;return!0}function oy(t,n){return t.state.facet(er).formatNumber(n,t.state)}function sy(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[er.of(t),iy(),ur]}function hy(t){for(var n=9;n<t;)n=10*n+9;return n}function fy(){return sr}function ay(t){var n=hr.get(t);return n||hr.set(t,n=Jt.mark({attributes:"\t"===t?{class:"cm-highlightTab"}:{class:"cm-highlightSpace","data-display":t.replace(/ /g,"\xb7")}})),n}function cy(t){return kn.define((function(n){return{decorations:t.createDeco(n),update:function n(i){this.decorations=t.updateDeco(i,this.decorations)}}}),{decorations:function t(n){return n.decorations}})}function ly(){return fr}function vy(){return ar}function dy(t,n,i,e){switch(t){case-2:return i<n;case-1:return e>=n&&i<n;case 0:return i<n&&e>n;case 1:return i<=n&&e>n;case 2:return e>n;case 4:return!0}}function yy(t,n){for(var i,e=t.childBefore(n);e&&(i=e.lastChild)&&i.to==e.to;)i.type.isError&&i.from==i.to?(t=e,e=i.prevSibling):e=i;return t}function py(t,n,i,e){for(var r,u,o,s,h,f;t.from==t.to||(i<1?t.from>=n:t.from>n)||(i>-1?t.to<=n:t.to<n);){if(!(u=!e&&t instanceof Or&&t.index<0?null:t.parent))return t;t=u}if(o=e?0:Mr.IgnoreOverlays,e)for(h=(s=t).parent;h;h=(s=h).parent)s instanceof Or&&s.index<0&&(null===(r=h.enter(n,i,o))||void 0===r?void 0:r.from)!=s.from&&(t=h);for(;;){if(!(f=t.enter(n,i,o)))return t;t=f}}function ky(t,n,i,e){var r=t.cursor(),u=[];if(!r.firstChild())return u;if(null!=i)for(;!r.type.is(i);)if(!r.nextSibling())return u;for(;;){if(null!=e&&r.type.is(e))return u;if(r.type.is(n)&&u.push(r.node),!r.nextSibling())return null==e?u:[]}}function my(t,n){var i,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.length-1;for(i=t.parent;e>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(n[e]&&n[e]!=i.name)return!1;e--}}return!0}function gy(t){return t.children.some((function(t){return t instanceof Cr||!t.type.isAnonymous||gy(t)}))}function wy(t){var n,i,e,r,u=t.buffer,o=t.nodeSet,s=t.maxBufferLength,h=void 0===s?vr:s,f=t.reused,a=void 0===f?[]:f,c=t.minRepeatType,l=void 0===c?o.types.length:c,v=Array.isArray(u)?new Sr(u,u.length):u,d=o.types,y=0,p=0;function k(t,n,i,e,r){for(var u,s,f,c,x,S,C,O,A,D,E,I,R,L,j,T=v.id,B=v.start,_=v.end,N=v.size,P=p;N<0;){if(v.next(),-1==N)return u=a[T],i.push(u),void e.push(B-t);if(-3==N)return void(y=T);if(-4==N)return void(p=T);throw new RangeError("Unrecognized record size: ".concat(N))}if(s=d[T],x=B-t,_-B<=h&&(c=b(v.pos-n,r))){for(S=new Uint16Array(c.size-c.skip),C=v.pos-c.size,O=S.length;v.pos>C;)O=M(c.start,S,O);f=new Cr(S,_-c.start,o),x=c.start-t}else{for(A=v.pos-N,v.next(),D=[],E=[],I=T>=l?T:-1,R=0,L=_;v.pos>A;)I>=0&&v.id==I&&v.size>=0?(v.end<=L-h&&(g(D,E,B,R,v.end,L,I,P),R=D.length,L=v.end),v.next()):k(B,A,D,E,I);I>=0&&R>0&&R<D.length&&g(D,E,B,R,B,L,I,P),D.reverse(),E.reverse(),I>-1&&R>0?(j=m(s),f=My(s,D,E,0,D.length,0,_-B,j,j)):f=w(s,D,E,_-B,P-_)}i.push(f),e.push(x)}function m(t){return function(n,i,e){var r=0,u=n.length-1,o,s;if(u>=0&&(o=n[u])instanceof xr){if(!u&&o.type==t&&o.length==e)return o;(s=o.prop(pr.lookAhead))&&(r=i[u]+o.length+s)}return w(t,n,i,e,r)}}function g(t,n,i,e,r,u,s,h){for(var f=[],a=[];t.length>e;)f.push(t.pop()),a.push(n.pop()+i-r);t.push(w(o.types[s],f,a,u-r,h-u)),n.push(r-i)}function w(t,n,i,e){var r,u,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,s=arguments.length>5?arguments[5]:void 0;return y&&(r=[pr.contextHash,y],s=s?[r].concat(s):[r]),o>25&&(u=[pr.lookAhead,o],s=s?[u].concat(s):[u]),new xr(t,n,i,e,s)}function b(t,n){var i,e,r,u,o,s=v.fork(),f=0,a=0,c=0,d=s.end-h,y={size:0,start:0,skip:0};t:for(i=s.pos-t;s.pos>i;)if(e=s.size,s.id==n&&e>=0)y.size=f,y.start=a,y.skip=c,c+=4,f+=4,s.next();else{if(r=s.pos-e,e<0||r<i||s.start<d)break;for(u=s.id>=l?4:0,o=s.start,s.next();s.pos>r;){if(s.size<0){if(-3!=s.size)break t;u+=4}else s.id>=l&&(u+=4);s.next()}a=o,f+=e,c+=u}return(n<0||f==t)&&(y.size=f,y.start=a,y.skip=c),y.size>4?y:void 0}function M(t,n,i){var e,r,u=v.id,o=v.start,s=v.end,h=v.size;if(v.next(),h>=0&&u<l){if(e=i,h>4)for(r=v.pos-(h-4);v.pos>r;)i=M(t,n,i);n[--i]=e,n[--i]=s-t,n[--i]=o-t,n[--i]=u}else-3==h?y=u:-4==h&&(p=u);return i}for(i=[],e=[];v.pos>0;)k(t.start||0,t.bufferStart||0,i,e,-1);return r=null!==(n=t.length)&&void 0!==n?n:i.length?e[0]+i[0].length:0,new xr(d[t.topID],i.reverse(),e.reverse(),r)}function by(t,n){var i,e,r,u;if(!t.isAnonymous||n instanceof Cr||n.type!=t)return 1;if(null==(i=Ir.get(n))){i=1,e=ic(n.children);try{for(e.s();!(r=e.n()).done;){if((u=r.value).type!=t||!(u instanceof xr)){i=1;break}i+=by(t,u)}}catch(t){e.e(t)}finally{e.f()}Ir.set(n,i)}return i}function My(t,n,i,e,r,u,o,s,h){var f,a,c,l,v=0;for(f=e;f<r;f++)v+=by(t,n[f]);function d(n,i,e,r,o){var s,f,v,y,p,k,m;for(s=e;s<r;){for(f=s,v=i[s],y=by(t,n[s]),s++;s<r&&!(y+(p=by(t,n[s]))>=a);s++)y+=p;if(s==f+1){if(y>a){d((k=n[f]).children,k.positions,0,k.children.length,i[f]+o);continue}c.push(n[f])}else m=i[s-1]+n[s-1].length-v,c.push(My(t,n,i,f,s,v,m,null,h));l.push(v+o-u)}}return a=Math.ceil(1.5*v/8),c=[],l=[],d(n,i,e,r,0),(s||h)(c,l,o)}function xy(t,n){return t.length==n.length&&t.every((function(t,i){return t==n[i]}))}function Sy(t){var n,i,e,r=[[]];for(n=0;n<t.length;n++)for(i=0,e=r.length;i<e;i++)r.push(r[i].concat(t[n]));return r.sort((function(t,n){return n.length-t.length}))}function Cy(t){var n,i,e,r,u,o,s,h,f,a,c,l,v,d,y=Object.create(null);for(n in t){i=t[n],Array.isArray(i)||(i=[i]),e=ic(n.split(" "));try{for(e.s();!(r=e.n()).done;)if(u=r.value){for(o=[],s=2,h=u,f=0;;){if("..."==h&&f>0&&f+3==u.length){s=1;break}if(!(a=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(h)))throw new RangeError("Invalid path: "+u);if(o.push("*"==a[0]?"":'"'==a[0][0]?JSON.parse(a[0]):a[0]),(f+=a[0].length)==u.length)break;if(c=u[f++],f==u.length&&"!"==c){s=0;break}if("/"!=c)throw new RangeError("Invalid path: "+u);h=u.slice(f)}if(!(v=o[l=o.length-1]))throw new RangeError("Invalid path: "+u);d=new Fr(i,s,l>0?o.slice(0,l):null),y[v]=d.sort(y[v])}}catch(t){e.e(t)}finally{e.f()}}return Pr.add(y)}function Oy(t,n){var i,e,r,u,o,s,h,f,a,c=Object.create(null),l=ic(t);try{for(l.s();!(i=l.n()).done;)if(e=i.value,Array.isArray(e.tag)){r=ic(e.tag);try{for(r.s();!(u=r.n()).done;)o=u.value,c[o.id]=e.class}catch(t){r.e(t)}finally{r.f()}}else c[e.tag.id]=e.class}catch(t){l.e(t)}finally{l.f()}return h=(s=n||{}).scope,f=s.all,a=void 0===f?null:f,{style:function t(n){var i,e,r,u,o,s,h=a,f=ic(n);try{for(f.s();!(i=f.n()).done;){r=ic((e=i.value).set);try{for(r.s();!(u=r.n()).done;)if(o=u.value,s=c[o.id]){h=h?h+" "+s:s;break}}catch(t){r.e(t)}finally{r.f()}}}catch(t){f.e(t)}finally{f.f()}return h},scope:h}}function Ay(t,n){var i,e,r,u=null,o=ic(t);try{for(o.s();!(i=o.n()).done;)(r=(e=i.value).style(n))&&(u=u?u+" "+r:r)}catch(t){o.e(t)}finally{o.f()}return u}function Dy(t,n,i){var e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:t.length,u=new Hr(e,Array.isArray(n)?n:[n],i);u.highlightRange(t.cursor(),e,r,"",u.highlighters),u.flush(r)}function Ey(t){for(var n=t.type.prop(Pr);n&&n.context&&!t.matchContext(n.context);)n=n.next;return n||null}function Iy(t){return w.define({combine:t?function(n){return n.concat(t)}:void 0})}function Ry(t,n,i){var e,r=t.facet(yu),u=Ly(t).topNode;if(!r||r.allowsNesting)for(e=u;e;e=e.enter(n,i,Mr.ExcludeBuffers))e.type.isTop&&(u=e);return u}function Ly(t){var n=t.field(ou.state,!1);return n?n.tree:xr.empty}function jy(t,n){var i,e,r,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,o=null===(i=t.field(ou.state,!1))||void 0===i?void 0:i.context;return o?(e=o.viewport,o.updateViewport({from:0,to:n}),r=o.isDone(n)||o.work(u,n)?o.tree:null,o.updateViewport(e),r):null}function Ty(t){var n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.doc.length;return(null===(n=t.field(ou.state,!1))||void 0===n?void 0:n.context.isDone(i))||!1}function By(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.viewport.to,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,e=jy(t.state,n,i);return e!=Ly(t.state)&&t.dispatch({}),!!e}function _y(t){var n;return(null===(n=t.plugin(du))||void 0===n?void 0:n.isWorking())||!1}function Ny(t,n,i){return Rr.applyChanges(t,[{fromA:n,toA:i,fromB:n,toB:i}])}function Py(t){var n=t.facet(gu);return 9==n.charCodeAt(0)?t.tabSize*n.length:n.length}function Fy(t,n){var i,e="",r=t.tabSize,u=t.facet(gu)[0];if("\t"==u){for(;n>=r;)e+="\t",n-=r;u=" "}for(i=0;i<n;i++)e+=u;return e}function Hy(t,n){var i,e,r,u,o;t instanceof Q&&(t=new wu(t)),i=ic(t.state.facet(mu));try{for(i.s();!(e=i.n()).done;)if(void 0!==(u=(r=e.value)(t,n)))return u}catch(t){i.e(t)}finally{i.f()}return(o=Ly(t.state))?Wy(t,o,n):null}function zy(t,n,i){var e,r,u,o,s,h=Object.create(null),f=new wu(t,{overrideIndentation:function t(n){var i;return null!==(i=h[n])&&void 0!==i?i:-1}}),a=[];for(e=n;e<=i;)e=(r=t.doc.lineAt(e)).to+1,null!=(u=Hy(f,r.from))&&(/\S/.test(r.text)||(u=0),(o=/^\s*/.exec(r.text)[0])!=(s=Fy(t,u))&&(h[r.from]=u,a.push({from:r.from,to:r.from+o.length,insert:s})));return t.changes(a)}function Wy(t,n,i){return $y(n.resolveInner(i).enterUnfinishedNodesBefore(i),i,t)}function Vy(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Uy(t){var n,i,e,r,u=t.type.prop(bu);return u||((n=t.firstChild)&&(i=n.type.prop(pr.closedBy))?(e=t.lastChild,r=e&&i.indexOf(e.name)>-1,function(t){return Qy(t,!0,1,void 0,r&&!Vy(t)?e.from:void 0)}):null==t.parent?qy:null)}function $y(t,n,i){for(;t;t=t.parent){var e=Uy(t);if(e)return e(Mu.create(i,n,t))}return null}function qy(){return 0}function Gy(t,n){for(var i=n;i;i=i.parent)if(t==i)return!0;return!1}function Jy(t){var n,i,e,r,u,o=t.node,s=o.childAfter(o.from),h=o.lastChild;if(!s)return null;for(n=t.options.simulateBreak,i=t.state.doc.lineAt(s.from),e=null==n||n<=i.from?i.to:Math.min(i.to,n),r=s.to;;){if(!(u=o.childAfter(r))||u==h)return null;if(!u.type.isSkipped)return u.from<e?s:null;r=u.to}}function Ky(t){var n=t.closing,i=t.align,e=void 0===i||i,r=t.units,u=void 0===r?1:r;return function(t){return Qy(t,e,u,n)}}function Qy(t,n,i,e,r){var u=t.textAfter,o=u.match(/^\s*/)[0].length,s=e&&u.slice(o,o+e.length)==e||r==t.pos+o,h=n?Jy(t):null;return h?s?t.column(h.from):t.column(h.to):t.baseIndent+(s?0:t.unit*i)}function Xy(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.except,i=t.units,e=void 0===i?1:i;return function(t){var i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}function Zy(){return Q.transactionFilter.of((function(t){var n,i,e,r,u,o,s,h,f,a,c,l,v,d,y;if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;if(!(n=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head)).length)return t;if(i=t.newDoc,(e=t.newSelection.main.head)>(r=i.lineAt(e)).from+Su)return t;if(u=i.sliceString(r.from,e),!n.some((function(t){return t.test(u)})))return t;s=-1,h=[],f=ic((o=t.state).selection.ranges);try{for(f.s();!(a=f.n()).done;)c=a.value.head,(l=o.doc.lineAt(c)).from!=s&&(s=l.from,null!=(v=Hy(o,l.from))&&(d=/^\s*/.exec(l.text)[0])!=(y=Fy(o,v))&&h.push({from:l.from,to:l.from+d.length,insert:y}))}catch(t){f.e(t)}finally{f.f()}return h.length?[t,{changes:h,sequential:!0}]:t}))}function Yy(t){var n=t.firstChild,i=t.lastChild;return n&&n.to<i.from?{from:n.to,to:i.type.isError?t.to:i.from}:null}function tp(t,n,i){var e,r,u,o,s,h=Ly(t);if(h.length<i)return null;for(r=null,u=e=h.resolveInner(i,1);u;u=u.parent)if(!(u.to<=i||u.from>i)){if(r&&u.from<n)break;(o=u.type.prop(Ou))&&(u.to<h.length-50||h.length==t.doc.length||!np(u))&&(s=o(u,t))&&s.from<=i&&s.from>=n&&s.to>i&&(r=s)}return r}function np(t){var n=t.lastChild;return n&&n.to==t.to&&n.type.isError}function ip(t,n,i){var e,r,u,o=ic(t.facet(Cu));try{for(o.s();!(e=o.n()).done;)if(u=(r=e.value)(t,n,i))return u}catch(t){o.e(t)}finally{o.f()}return tp(t,n,i)}function ep(t,n){var i=n.mapPos(t.from,1),e=n.mapPos(t.to,-1);return i>=e?void 0:{from:i,to:e}}function rp(t){var n,i,e=[],r=ic(t.state.selection.ranges);try{for(i=function i(){var r=n.value.head;if(e.some((function(t){return t.from<=r&&t.to>=r})))return 1;e.push(t.lineBlockAt(r))},r.s();!(n=r.n()).done;)i()}catch(t){r.e(t)}finally{r.f()}return e}function up(t){return t.field(Eu,!1)||tt.empty}function op(t,n,i){var e,r=null;return null===(e=t.field(Eu,!1))||void 0===e||e.between(n,i,(function(t,n){(!r||r.from>t)&&(r={from:t,to:n})})),r}function sp(t,n,i){var e=!1;return t.between(n,n,(function(t,r){t==n&&r==i&&(e=!0)})),e}function hp(t,n){return t.field(Eu,!1)?n:n.concat(U.appendConfig.of(cp()))}function fp(t,n){var i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],e=t.state.doc.lineAt(n.from).number,r=t.state.doc.lineAt(n.to).number;return Ui.announce.of("".concat(t.state.phrase(i?"Folded lines":"Unfolded lines")," ").concat(e," ").concat(t.state.phrase("to")," ").concat(r,"."))}function ap(t,n){var i,e;for(i=n;;){if((e=ip(t.state,i.from,i.to))&&e.to>n.from)return e;if(!i.from)return null;i=t.lineBlockAt(i.from-1)}}function cp(t){var n=[Eu,zu];return t&&n.push(Nu.of(t)),n}function lp(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=Object.assign(Object.assign({},Fu),t),i=new Hu(n,!0),e=new Hu(n,!1),r=kn.fromClass(function(){function t(n){yc(this,t),this.from=n.viewport.from,this.markers=this.buildMarkers(n)}return kc(t,[{key:"update",value:function t(i){(i.docChanged||i.viewportChanged||i.startState.facet(yu)!=i.state.facet(yu)||i.startState.field(Eu,!1)!=i.state.field(Eu,!1)||Ly(i.startState)!=Ly(i.state)||n.foldingChanged(i))&&(this.markers=this.buildMarkers(i.view))}},{key:"buildMarkers",value:function t(n){var r,u,o,s=new nt,h=ic(n.viewportLineBlocks);try{for(h.s();!(r=h.n()).done;)u=r.value,(o=op(n.state,u.from,u.to)?e:ip(n.state,u.from,u.to)?i:null)&&s.add(u.from,u.from,o)}catch(t){h.e(t)}finally{h.f()}return s.finish()}}]),t}()),u=n.domEventHandlers;return[r,ny({class:"cm-foldGutter",markers:function t(n){var i;return(null===(i=n.plugin(r))||void 0===i?void 0:i.markers)||tt.empty},initialSpacer:function t(){return new Hu(n,!1)},domEventHandlers:Object.assign(Object.assign({},u),{click:function t(n,i,e){var r,o;return!(!u.click||!u.click(n,i,e))||((r=op(n.state,i.from,i.to))?(n.dispatch({effects:Du.of(r)}),!0):!!(o=ip(n.state,i.from,i.to))&&(n.dispatch({effects:Au.of(o)}),!0))}})}),cp()]}function vp(t){var n=t.facet(Vu);return n.length?n:t.facet(Uu)}function dp(t,n){var i=[qu],e;return t instanceof Wu&&(t.module&&i.push(Ui.styleModule.of(t.module)),e=t.themeType),(null==n?void 0:n.fallback)?i.push(Uu.of(t)):e?i.push(Vu.computeN([Ui.darkTheme],(function(n){return n.facet(Ui.darkTheme)==("dark"==e)?[t]:[]}))):i.push(Vu.of(t)),i}function yp(t,n,i){var e,r,u,o,s=vp(t),h=null;if(s){e=ic(s);try{for(e.s();!(r=e.n()).done;)(!(u=r.value).scope||i&&u.scope(i))&&(o=u.style(n))&&(h=h?h+" "+o:o)}catch(t){e.e(t)}finally{e.f()}}return h}function pp(t){var n=[],i=t.matched?Zu:Yu;return n.push(i.range(t.start.from,t.start.to)),t.end&&n.push(i.range(t.end.from,t.end.to)),n}function kp(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Xu.of(t),no]}function mp(t,n,i){var e,r=t.prop(n<0?pr.openedBy:pr.closedBy);return r||(1==t.name.length&&(e=i.indexOf(t.name))>-1&&e%2==(n<0?1:0)?[i[e+n]]:null)}function gp(t){var n=t.type.prop(io);return n?n(t.node):t}function wp(t,n,i){var e,r,u,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=o.maxScanDistance||Ku,h=o.brackets||Qu,f=Ly(t),a=f.resolveInner(n,i);for(e=a;e;e=e.parent)if((r=mp(e.type,i,h))&&e.from<e.to&&(u=gp(e))&&(i>0?n>=u.from&&n<u.to:n>u.from&&n<=u.to))return bp(t,n,i,e,u,r,h);return Mp(t,n,i,f,a.type,s,h)}function bp(t,n,i,e,r,u,o){var s,h,f=e.parent,a={from:r.from,to:r.to},c=0,l=null==f?void 0:f.cursor();if(l&&(i<0?l.childBefore(e.from):l.childAfter(e.to)))do{if(i<0?l.to<=e.from:l.from>=e.to){if(0==c&&u.indexOf(l.type.name)>-1&&l.from<l.to)return{start:a,end:(s=gp(l))?{from:s.from,to:s.to}:void 0,matched:!0};if(mp(l.type,i,o))c++;else if(mp(l.type,-i,o)){if(0==c)return{start:a,end:(h=gp(l))&&h.from<h.to?{from:h.from,to:h.to}:void 0,matched:!1};c--}}}while(i<0?l.prevSibling():l.nextSibling());return{start:a,matched:!1}}function Mp(t,n,i,e,r,u,o){var s,h,f,a,c,l,v,d,y,p=i<0?t.sliceDoc(n-1,n):t.sliceDoc(n,n+1),k=o.indexOf(p);if(k<0||k%2==0!=i>0)return null;for(s={from:i<0?n-1:n,to:i>0?n+1:n},h=t.doc.iterRange(n,i>0?t.doc.length:0),f=0,a=0;!h.next().done&&a<=u;){for(c=h.value,i<0&&(a+=c.length),l=n+a*i,v=i>0?0:c.length-1,d=i>0?c.length:-1;v!=d;v+=i)if(!((y=o.indexOf(c[v]))<0||e.resolveInner(l+v,1).type!=r))if(y%2==0==i>0)f++;else{if(1==f)return{start:s,end:{from:l+v,to:l+v+1},matched:y>>1==k>>1};f--}i>0&&(a+=c.length)}return h.done?{start:s,matched:!1}:null}function xp(t,n,i){var e,r,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;for(null==n&&-1==(n=t.search(/[^\s\u00a0]/))&&(n=t.length),e=o,r=u;r<n;r++)9==t.charCodeAt(r)?e+=i-e%i:e++;return e}function Sp(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||function(){},startState:t.startState||function(){return!0},copyState:t.copyState||Cp,indent:t.indent||function(){return null},languageData:t.languageData||{},tokenTable:t.tokenTable||so}}function Cp(t){var n,i,e;if("object"!=dc(t))return t;for(i in n={},t)e=t[i],n[i]=e instanceof Array?e.slice():e;return n}function Op(t,n,i,e,r){var u,o,s,h,f=i>=e&&i+n.length<=r&&n.prop(t.stateAfter);if(f)return{state:t.streamParser.copyState(f),pos:i+n.length};for(u=n.children.length-1;u>=0;u--)if(o=n.children[u],s=i+n.positions[u],h=o instanceof xr&&s<r&&Op(t,o,s,e,r))return h;return null}function Ap(t,n,i,e,r){var u,o,s,h;if(r&&i<=0&&e>=n.length)return n;for(r||n.type!=t.topNode||(r=!0),u=n.children.length-1;u>=0;u--)if(o=n.positions[u],s=n.children[u],h=void 0,o<e&&s instanceof xr){if(!(h=Ap(t,s,i-o,e-o,r)))break;return r?new xr(n.type,n.children.slice(0,u).concat(h),n.positions.slice(0,u+1),o+h.length):h}return null}function Dp(t,n,i,e){var r,u,o,s,h,f,a=ic(n);try{for(a.s();!(r=a.n()).done;)if(o=(u=r.value).from+(u.openStart?25:0),s=u.to-(u.openEnd?25:0),h=o<=i&&s>i&&Op(t,u.tree,0-u.offset,i,s),f=void 0,h&&(f=Ap(t,u.tree,i+u.offset,h.pos+u.offset,!1)))return{state:h.state,tree:f}}catch(t){a.e(t)}finally{a.f()}return{state:t.streamParser.startState(e?Py(e):4),tree:xr.empty}}function Ep(t,n,i){var e,r;for(n.start=n.pos,e=0;e<10;e++)if(r=t(n,i),n.pos>n.start)return r;throw new Error("Stream parser failed to advance stream.")}for(Fn=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Hn=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.level=e}return kc(t,[{key:"dir",get:function t(){return this.level%2?En:Dn}},{key:"side",value:function t(n,i){return this.dir==i==n?this.to:this.from}}],[{key:"find",value:function t(n,i,e,r){var u,o,s=-1;for(u=0;u<n.length;u++)if((o=n[u]).from<=i&&o.to>=i){if(o.level==e)return u;(s<0||(0!=r?r<0?o.from<i:o.to>i:n[s].level>o.level))&&(s=u)}if(s<0)throw new RangeError("Index out of range");return s}}]),t}(),zn=[],Wn="",Vn="\uffff",Un=function(){function t(n,i){yc(this,t),this.points=n,this.text="",this.lineSeparator=i.facet(Q.lineSeparator)}return kc(t,[{key:"append",value:function t(n){this.text+=n}},{key:"lineBreak",value:function t(){this.text+=Vn}},{key:"readRange",value:function t(n,i){var e,r,u,o,s,h;if(!n)return this;for(e=n.parentNode,r=n;this.findPointBefore(e,r),u=this.text.length,this.readNode(r),(o=r.nextSibling)!=i;)s=Ot.get(r),h=Ot.get(o),(s&&h?s.breakAfter:(s?s.breakAfter:ov(r))||ov(o)&&("BR"!=r.nodeName||r.cmIgnore)&&this.text.length>u)&&this.lineBreak(),r=o;return this.findPointBefore(e,i),this}},{key:"readTextNode",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l=n.nodeValue,v=ic(this.points);try{for(v.s();!(i=v.n()).done;)(e=i.value).node==n&&(e.pos=this.text.length+Math.min(e.offset,l.length))}catch(t){v.e(t)}finally{v.f()}for(r=0,u=this.lineSeparator?null:/\r\n?|\n/g;o=-1,s=1,h=void 0,this.lineSeparator?(o=l.indexOf(this.lineSeparator,r),s=this.lineSeparator.length):(h=u.exec(l))&&(o=h.index,s=h[0].length),this.append(l.slice(r,o<0?l.length:o)),!(o<0);){if(this.lineBreak(),s>1){f=ic(this.points);try{for(f.s();!(a=f.n()).done;)(c=a.value).node==n&&c.pos>this.text.length&&(c.pos-=s-1)}catch(t){f.e(t)}finally{f.f()}}r=o+s}}},{key:"readNode",value:function t(n){var i,e,r;if(!n.cmIgnore)if(null!=(e=(i=Ot.get(n))&&i.overrideDOMText))for(this.findPointInside(n,e.length),r=e.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value);else 3==n.nodeType?this.readTextNode(n):"BR"==n.nodeName?n.nextSibling&&this.lineBreak():1==n.nodeType&&this.readRange(n.firstChild,null)}},{key:"findPointBefore",value:function t(n,i){var e,r,u=ic(this.points);try{for(u.s();!(e=u.n()).done;)(r=e.value).node==n&&n.childNodes[r.offset]==i&&(r.pos=this.text.length)}catch(t){u.e(t)}finally{u.f()}}},{key:"findPointInside",value:function t(n,i){var e,r,u=ic(this.points);try{for(u.s();!(e=u.n()).done;)r=e.value,(3==n.nodeType?r.node==n:n.contains(r.node))&&(r.pos=this.text.length+Math.min(i,r.offset))}catch(t){u.e(t)}finally{u.f()}}}]),t}(),$n=kc((function t(n,i){yc(this,t),this.node=n,this.offset=i,this.pos=-1})),qn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).view=t,e.compositionDeco=Jt.none,e.decorations=[],e.dynamicDecorationMap=[],e.minWidth=0,e.minWidthFrom=0,e.minWidthTo=0,e.impreciseAnchor=null,e.impreciseHead=null,e.forceSelection=!1,e.lastUpdate=Date.now(),e.setDOM(t.contentDOM),e.children=[new Zt],e.children[0].setParent(cc(e)),e.updateDeco(),e.updateInner([new Cn(0,0,0,t.state.doc.length)],0),e}return kc(i,[{key:"length",get:function t(){return this.view.state.doc.length}},{key:"update",value:function t(n){var i,e,r,u=this,o=n.changedRanges;return this.minWidth>0&&o.length&&(o.every((function(t){var n=t.fromA,i;return t.toA<u.minWidthFrom||n>u.minWidthTo}))?(this.minWidthFrom=n.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=n.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.view.inputState.composing<0?this.compositionDeco=Jt.none:(n.transactions.length||this.dirty)&&(this.compositionDeco=fv(this.view,n.changes)),(Ft.ie||Ft.chrome)&&!this.compositionDeco.size&&n&&n.state.doc.lines!=n.startState.doc.lines&&(this.forceSelection=!0),r=lv(i=this.decorations,e=this.updateDeco(),n.changes),o=Cn.extendWithRanges(o,r),(0!=this.dirty||0!=o.length)&&(this.updateInner(o,n.startState.doc.length),n.transactions.length&&(this.lastUpdate=Date.now()),!0)}},{key:"updateInner",value:function t(n,i){var e,r,u,o,s,h=this;if(this.view.viewState.mustMeasureContent=!0,this.updateChildren(n,i),(e=this.view.observer).ignore((function(){h.dom.style.height=h.view.viewState.contentHeight+"px",h.dom.style.flexBasis=h.minWidth?h.minWidth+"px":"";var t=Ft.chrome||Ft.ios?{node:e.selectionRange.focusNode,written:!1}:void 0;h.sync(h.view,t),h.dirty=0,t&&(t.written||e.selectionRange.focusNode!=t.node)&&(h.forceSelection=!0),h.dom.style.height=""})),r=[],this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length){u=ic(this.children);try{for(u.s();!(o=u.n()).done;)(s=o.value)instanceof Yt&&s.widget instanceof Gn&&r.push(s.dom)}catch(t){u.e(t)}finally{u.f()}}e.updateGaps(r)}},{key:"updateChildren",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w=this.childCursor(i);for(e=n.length-1;r=e>=0?n[e]:null;e--)u=r.fromA,o=r.toA,s=r.fromB,h=r.toB,a=(f=tn.build(this.view.state.doc,s,h,this.decorations,this.dynamicDecorationMap)).content,c=f.breakAtStart,l=f.openStart,v=f.openEnd,y=(d=w.findPos(o,1)).i,p=d.off,Bl(this,m=(k=w.findPos(u,-1)).i,g=k.off,y,p,a,c,l,v)}},{key:"updateSelection",value:function t(){var n,i,e,r,u,o,s,h,f,a=this,c=arguments.length>0&&void 0!==arguments[0]&&arguments[0],l=arguments.length>1&&void 0!==arguments[1]&&arguments[1];!c&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange(),i=(n=this.view.root.activeElement)==this.dom,e=!i&&ml(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n)),(i||l||e)&&(r=this.forceSelection,this.forceSelection=!1,u=this.view.state.selection.main,o=this.domAtPos(u.anchor),s=u.empty?o:this.domAtPos(u.head),Ft.gecko&&u.empty&&!this.compositionDeco.size&&sv(o)&&(h=document.createTextNode(""),this.view.observer.ignore((function(){return o.node.insertBefore(h,o.node.childNodes[o.offset]||null)})),o=s=new St(h,0),r=!0),f=this.view.observer.selectionRange,!r&&f.focusNode&&wl(o.node,o.offset,f.anchorNode,f.anchorOffset)&&wl(s.node,s.offset,f.focusNode,f.focusOffset)||(this.view.observer.ignore((function(){var t,i,r,h,c;if(Ft.android&&Ft.chrome&&a.dom.contains(f.focusNode)&&vv(f.focusNode,a.dom)&&(a.dom.blur(),a.dom.focus({preventScroll:!0})),t=yl(a.view.root))if(u.empty)Ft.gecko&&(i=cv(o.node,o.offset))&&3!=i&&(r=av(o.node,o.offset,1==i?1:-1))&&(o=new St(r,1==i?0:r.nodeValue.length)),t.collapse(o.node,o.offset),null!=u.bidiLevel&&null!=f.cursorBidiLevel&&(f.cursorBidiLevel=u.bidiLevel);else if(t.extend){t.collapse(o.node,o.offset);try{t.extend(s.node,s.offset)}catch(t){}}else h=document.createRange(),u.anchor>u.head&&(o=(c=[s,o])[0],s=c[1]),h.setEnd(s.node,s.offset),h.setStart(o.node,o.offset),t.removeAllRanges(),t.addRange(h);else;e&&a.view.root.activeElement==a.dom&&(a.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(o,s)),this.impreciseAnchor=o.precise?null:new St(f.anchorNode,f.anchorOffset),this.impreciseHead=s.precise?null:new St(f.focusNode,f.focusOffset))}},{key:"enforceCursorAssoc",value:function t(){var n,i,e,r,u,o,s,h,f,a,c,l;this.compositionDeco.size||(i=(n=this.view).state.selection.main,e=yl(n.root),u=(r=n.observer.selectionRange).anchorNode,o=r.anchorOffset,e&&i.empty&&i.assoc&&e.modify&&(s=Zt.find(this,i.head))&&(h=s.posAtStart,i.head!=h&&i.head!=h+s.length&&(f=this.coordsAt(i.head,-1),a=this.coordsAt(i.head,1),!f||!a||f.bottom>a.top||(c=this.domAtPos(i.head+i.assoc),e.collapse(c.node,c.offset),e.modify("move",i.assoc<0?"forward":"backward","lineboundary"),n.observer.readSelectionRange(),l=n.observer.selectionRange,n.docView.posFromDOM(l.anchorNode,l.anchorOffset)!=i.from&&e.collapse(u,o)))))}},{key:"nearest",value:function t(n){var i,e;for(i=n;i;){if((e=Ot.get(i))&&e.rootView==this)return e;i=i.parentNode}return null}},{key:"posFromDOM",value:function t(n,i){var e=this.nearest(n);if(!e)throw new RangeError("Trying to find position for a DOM position outside of the document");return e.localPosFromDOM(n,i)+e.posAtStart}},{key:"domAtPos",value:function t(n){for(var i,e=this.childCursor().findPos(n,-1),r=e.i,u=e.off;r<this.children.length-1&&!(u<(i=this.children[r]).length||i instanceof Zt);)r++,u=0;return this.children[r].domAtPos(u)}},{key:"coordsAt",value:function t(n,i){var e,r,u,o;for(e=this.length,r=this.children.length-1;;r--){if(n>(o=e-(u=this.children[r]).breakAfter-u.length)||n==o&&u.type!=Gt.WidgetBefore&&u.type!=Gt.WidgetAfter&&(!r||2==i||this.children[r-1].breakAfter||this.children[r-1].type==Gt.WidgetBefore&&i>-2))return u.coordsAt(n-o,i);e=o}}},{key:"measureVisibleLineHeights",value:function t(n){var i,e,r,u,o,s,h,f,a,c=[],l=n.from,v=n.to,d=this.view.contentDOM.clientWidth,y=d>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,p=-1,k=this.view.textDirection==An.LTR;for(i=0,e=0;e<this.children.length&&!((u=i+(r=this.children[e]).length)>v);e++)i>=l&&(o=r.dom.getBoundingClientRect(),c.push(o.height),y&&(h=(s=r.dom.lastChild)?gl(s):[]).length&&(f=h[h.length-1],(a=k?f.right-o.left:o.right-f.left)>p&&(p=a,this.minWidth=d,this.minWidthFrom=i,this.minWidthTo=u))),i=u+r.breakAfter;return c}},{key:"textDirectionAt",value:function t(n){var i,e=this.childPos(n,1).i;return"rtl"==getComputedStyle(this.children[e].dom).direction?An.RTL:An.LTR}},{key:"measureTextSize",value:function t(){var n,i,e,r,u,o,s,h=this,f=ic(this.children);try{for(f.s();!(n=f.n()).done;)if((i=n.value)instanceof Zt&&(e=i.measureTextSize()))return e}catch(t){f.e(t)}finally{f.f()}return(r=document.createElement("div")).className="cm-line",r.style.width="99999px",r.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((function(){h.dom.appendChild(r);var t=gl(r.firstChild)[0];u=r.getBoundingClientRect().height,o=t?t.width/27:7,s=t?t.height:u,r.remove()})),{lineHeight:u,charWidth:o,textHeight:s}}},{key:"childCursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.length,i=this.children.length;return i&&(n-=this.children[--i].length),new At(this.children,n,i)}},{key:"computeBlockGapDeco",value:function t(){var n,i,e,r,u,o=[],s=this.view.viewState;for(n=0,i=0;(r=(e=i==s.viewports.length?null:s.viewports[i])?e.from-1:this.length)>n&&(u=s.lineBlockAt(r).bottom-s.lineBlockAt(n).top,o.push(Jt.replace({widget:new Gn(u),block:!0,inclusive:!0,isBlockGap:!0}).range(n,r))),e;i++)n=e.to+1;return Jt.set(o)}},{key:"updateDeco",value:function t(){var n,i=this,e=this.view.state.facet(bn).map((function(t,n){var e;return(i.dynamicDecorationMap[n]="function"==typeof t)?t(i.view):t}));for(n=e.length;n<e.length+3;n++)this.dynamicDecorationMap[n]=!1;return this.decorations=[].concat(Ja(e),[this.compositionDeco,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco])}},{key:"scrollIntoView",value:function t(n){var i,e,r,u=n.range,o=this.coordsAt(u.head,u.empty?u.assoc:u.head>u.anchor?-1:1);o&&(!u.empty&&(i=this.coordsAt(u.anchor,u.anchor>u.head?-1:1))&&(o={left:Math.min(o.left,i.left),top:Math.min(o.top,i.top),right:Math.max(o.right,i.right),bottom:Math.max(o.bottom,i.bottom)}),e=tv(this.view),r={left:o.left-e.left,top:o.top-e.top,right:o.right+e.right,bottom:o.bottom+e.bottom},Ol(this.view.scrollDOM,r,u.head<u.anchor?-1:1,n.x,n.y,n.xMargin,n.yMargin,this.view.textDirection==An.LTR))}}]),i}(Ot),Gn=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).height=t,e}return kc(i,[{key:"toDOM",value:function t(){var n=document.createElement("div");return this.updateDOM(n),n}},{key:"eq",value:function t(n){return n.height==this.height}},{key:"updateDOM",value:function t(n){return n.style.height=this.height+"px",!0}},{key:"estimatedHeight",get:function t(){return this.height}}]),i}(qt),Jn=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this)).top=t,u.text=e,u.topView=r,u}return kc(i,[{key:"eq",value:function t(n){return this.top==n.top&&this.text==n.text}},{key:"toDOM",value:function t(){return this.top}},{key:"ignoreEvent",value:function t(){return!1}},{key:"customView",get:function t(){return Ut}}]),i}(qt),Kn=function(){function t(){yc(this,t),this.changes=[]}return kc(t,[{key:"compareRange",value:function t(n,i){Xl(n,i,this.changes)}},{key:"comparePoint",value:function t(n,i){Xl(n,i,this.changes)}}]),t}(),Qn=function(){function t(n){var i,e,r,u=this;for(r in yc(this,t),this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null,i=function t(i,e){u.ignoreDuringComposition(e)||"keydown"==e.type&&u.keydown(n,e)||(u.mustFlushObserver(e)&&n.observer.forceFlush(),u.runCustomHandlers(e.type,n,e)?e.preventDefault():i(n,e))},e=function t(){var e=ii[r];n.contentDOM.addEventListener(r,(function(t){_v(n,t)&&i(e,t)}),ei[r]),u.registeredEvents.push(r)},ii)e();n.scrollDOM.addEventListener("mousedown",(function(t){if(t.target==n.scrollDOM&&t.clientY>n.contentDOM.getBoundingClientRect().bottom&&(i(ii.mousedown,t),!t.defaultPrevented&&2==t.button)){var e=n.contentDOM.style.minHeight;n.contentDOM.style.minHeight="100%",setTimeout((function(){return n.contentDOM.style.minHeight=e}),200)}})),n.scrollDOM.addEventListener("drop",(function(t){t.target==n.scrollDOM&&t.clientY>n.contentDOM.getBoundingClientRect().bottom&&i(ii.drop,t)})),Ft.chrome&&102==Ft.chrome_version&&n.scrollDOM.addEventListener("wheel",(function(){u.chromeScrollHack<0?n.contentDOM.style.pointerEvents="none":window.clearTimeout(u.chromeScrollHack),u.chromeScrollHack=setTimeout((function(){u.chromeScrollHack=-1,n.contentDOM.style.pointerEvents=""}),100)}),{passive:!0}),this.notifiedFocused=n.hasFocus,Ft.safari&&n.contentDOM.addEventListener("input",(function(){return null}))}return kc(t,[{key:"setSelectionOrigin",value:function t(n){this.lastSelectionOrigin=n,this.lastSelectionTime=Date.now()}},{key:"ensureHandlers",value:function t(n,i){var e,r,u,o,s,h,f,a=this;this.customHandlers=[],u=ic(i);try{for(u.s();!(o=u.n()).done;)if(r=null===(e=(s=o.value).update(n).spec)||void 0===e?void 0:e.domEventHandlers)for(f in this.customHandlers.push({plugin:s.value,handlers:r}),h=function t(i){a.registeredEvents.indexOf(i)<0&&"scroll"!=i&&(a.registeredEvents.push(i),n.contentDOM.addEventListener(i,(function(t){_v(n,t)&&a.runCustomHandlers(i,n,t)&&t.preventDefault()})))},r)h(f)}catch(t){u.e(t)}finally{u.f()}}},{key:"runCustomHandlers",value:function t(n,i,e){var r,u,o,s=ic(this.customHandlers);try{for(s.s();!(r=s.n()).done;)if(o=(u=r.value).handlers[n])try{if(o.call(u.plugin,e,i)||e.defaultPrevented)return!0}catch(t){Yl(i.state,t)}}catch(t){s.e(t)}finally{s.f()}return!1}},{key:"runScrollHandlers",value:function t(n,i){var e,r,u,o;this.lastScrollTop=n.scrollDOM.scrollTop,this.lastScrollLeft=n.scrollDOM.scrollLeft,e=ic(this.customHandlers);try{for(e.s();!(r=e.n()).done;)if(o=(u=r.value).handlers.scroll)try{o.call(u.plugin,i,n)}catch(t){Yl(n.state,t)}}catch(t){e.e(t)}finally{e.f()}}},{key:"keydown",value:function t(n,i){var e,r=this;return this.lastKeyCode=i.keyCode,this.lastKeyTime=Date.now(),9==i.keyCode&&Date.now()<this.lastEscPress+2e3||(27!=i.keyCode&&Yn.indexOf(i.keyCode)<0&&(n.inputState.lastEscPress=0),!Ft.android||!Ft.chrome||i.synthetic||13!=i.keyCode&&8!=i.keyCode?!(!Ft.ios||i.synthetic||i.altKey||i.metaKey||!((e=Xn.find((function(t){return t.keyCode==i.keyCode})))&&!i.ctrlKey||Zn.indexOf(i.key)>-1&&i.ctrlKey&&!i.shiftKey))&&(this.pendingIOSKey=e||i,setTimeout((function(){return r.flushIOSKey(n)}),250),!0):(n.observer.delayAndroidKey(i.key,i.keyCode),!0))}},{key:"flushIOSKey",value:function t(n){var i=this.pendingIOSKey;return!!i&&(this.pendingIOSKey=void 0,Il(n.contentDOM,i.key,i.keyCode))}},{key:"ignoreDuringComposition",value:function t(n){return!!/^key/.test(n.type)&&(this.composing>0||!!(Ft.safari&&!Ft.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}},{key:"mustFlushObserver",value:function t(n){return"keydown"==n.type&&229!=n.keyCode}},{key:"startMouseSelection",value:function t(n){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=n}},{key:"update",value:function t(n){this.mouseSelection&&this.mouseSelection.update(n),n.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}},{key:"destroy",value:function t(){this.mouseSelection&&this.mouseSelection.destroy()}}]),t}(),Xn=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Zn="dthko",Yn=[16,17,18,20,91,92,224,225],ti=6,ni=function(){function t(n,i,e,r){yc(this,t),this.view=n,this.style=e,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=i,this.scrollParent=Al(n.contentDOM),this.atoms=n.state.facet(Mn).map((function(t){return t(n)}));var u=n.contentDOM.ownerDocument;u.addEventListener("mousemove",this.move=this.move.bind(this)),u.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=i.shiftKey,this.multiple=n.state.facet(Q.allowMultipleSelections)&&jv(n,i),this.dragMove=Tv(n,i),this.dragging=!(!Bv(n,i)||1!=Wv(i))&&null}return kc(t,[{key:"start",value:function t(n){!1===this.dragging&&(n.preventDefault(),this.select(n))}},{key:"move",value:function t(n){var i,e,r,u,o;if(0==n.buttons)return this.destroy();!1===this.dragging&&(this.select(this.lastEvent=n),e=0,r=0,u=(null===(i=this.scrollParent)||void 0===i?void 0:i.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=tv(this.view),n.clientX-o.left<=u.left+ti?e=-Lv(u.left-n.clientX):n.clientX+o.right>=u.right-ti&&(e=Lv(n.clientX-u.right)),n.clientY-o.top<=u.top+ti?r=-Lv(u.top-n.clientY):n.clientY+o.bottom>=u.bottom-ti&&(r=Lv(n.clientY-u.bottom)),this.setScrollSpeed(e,r))}},{key:"up",value:function t(n){null==this.dragging&&this.select(this.lastEvent),this.dragging||n.preventDefault(),this.destroy()}},{key:"destroy",value:function t(){this.setScrollSpeed(0,0);var n=this.view.contentDOM.ownerDocument;n.removeEventListener("mousemove",this.move),n.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}},{key:"setScrollSpeed",value:function t(n,i){var e=this;this.scrollSpeed={x:n,y:i},n||i?this.scrolling<0&&(this.scrolling=setInterval((function(){return e.scroll()}),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}},{key:"scroll",value:function t(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}},{key:"skipAtoms",value:function t(n){var i,e,r,u,o,s,h=null;for(i=0;i<n.ranges.length;i++)r=null,(e=n.ranges[i]).empty?(u=Iv(this.atoms,e.from,0))!=e.from&&(r=m.cursor(u,-1)):(o=Iv(this.atoms,e.from,-1),s=Iv(this.atoms,e.to,1),o==e.from&&s==e.to||(r=m.range(e.from==e.anchor?o:s,e.from==e.head?o:s))),r&&(h||(h=n.ranges.slice()),h[i]=r);return h?m.create(h,n.mainIndex):n}},{key:"select",value:function t(n){var i=this.view,e=this.skipAtoms(this.style.get(n,this.extend,this.multiple));!this.mustSelect&&e.eq(i.state.selection)&&e.main.assoc==i.state.selection.main.assoc||this.view.dispatch({selection:e,userEvent:"select.pointer"}),this.mustSelect=!1}},{key:"update",value:function t(n){var i=this;n.docChanged&&this.dragging&&(this.dragging=this.dragging.map(n.changes)),this.style.update(n)&&setTimeout((function(){return i.select(i.lastEvent)}),20)}}]),t}(),ii=Object.create(null),ei=Object.create(null),ri=Ft.ie&&Ft.ie_version<15||Ft.ios&&Ft.webkit_version<604,ii.keydown=function(t,n){t.inputState.setSelectionOrigin("select"),27==n.keyCode&&(t.inputState.lastEscPress=Date.now())},ii.touchstart=function(t,n){t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")},ii.touchmove=function(t){t.inputState.setSelectionOrigin("select.pointer")},ei.touchstart=ei.touchmove={passive:!0},ii.mousedown=function(t,n){var i,e,r,u,o;if(t.observer.flush(),!(t.inputState.lastTouchTime>Date.now()-2e3)){i=null,e=ic(t.state.facet(un));try{for(e.s();!(r=e.n()).done&&!(i=(u=r.value)(t,n)););}catch(t){e.e(t)}finally{e.f()}i||0!=n.button||(i=Vv(t,n)),i&&(o=t.root.activeElement!=t.contentDOM,t.inputState.startMouseSelection(new ni(t,n,i,o)),o&&t.observer.ignore((function(){return Dl(t.contentDOM)})),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(n))}},ui=function t(n,i){return n>=i.top&&n<=i.bottom},oi=function t(n,i,e){return ui(i,e)&&n>=e.left&&n<=e.right},si=Ft.ie&&Ft.ie_version<=11,hi=null,fi=0,ai=0,ii.dragstart=function(t,n){var i=t.state.selection.main,e=t.inputState.mouseSelection;e&&(e.dragging=i),n.dataTransfer&&(n.dataTransfer.setData("Text",t.state.sliceDoc(i.from,i.to)),n.dataTransfer.effectAllowed="copyMove")},ii.drop=function(t,n){var i,e,r,u,o,s;if(n.dataTransfer){if(t.state.readOnly)return n.preventDefault();if((i=n.dataTransfer.files)&&i.length)for(n.preventDefault(),e=Array(i.length),r=0,u=function u(){++r==i.length&&$v(t,n,e.filter((function(t){return null!=t})).join(t.state.lineBreak),!1)},o=function t(n){var r=new FileReader;r.onerror=u,r.onload=function(){/[\x00-\x08\x0e-\x1f]{2}/.test(r.result)||(e[n]=r.result),u()},r.readAsText(i[n])},s=0;s<i.length;s++)o(s);else $v(t,n,n.dataTransfer.getData("Text"),!0)}},ii.paste=function(t,n){if(t.state.readOnly)return n.preventDefault();t.observer.flush();var i=ri?null:n.clipboardData;i?(Pv(t,i.getData("text/plain")||i.getData("text/uri-text")),n.preventDefault()):Nv(t)},ci=null,ii.copy=ii.cut=function(t,n){var i,e=Gv(t.state),r=e.text,u=e.ranges,o=e.linewise;(r||o)&&(ci=o?r:null,(i=ri?null:n.clipboardData)?(n.preventDefault(),i.clearData(),i.setData("text/plain",r)):qv(t,r),"cut"!=n.type||t.state.readOnly||t.dispatch({changes:u,scrollIntoView:!0,userEvent:"delete.cut"}))},li=z.define(),ii.focus=function(t){t.inputState.lastFocusTime=Date.now(),t.scrollDOM.scrollTop||!t.inputState.lastScrollTop&&!t.inputState.lastScrollLeft||(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),Kv(t)},ii.blur=function(t){t.observer.clearSelectionRange(),Kv(t)},ii.compositionstart=ii.compositionupdate=function(t){null==t.inputState.compositionFirstChange&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)},ii.compositionend=function(t){t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ft.chrome&&Ft.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then((function(){return t.observer.flush()})):setTimeout((function(){t.inputState.composing<0&&t.docView.compositionDeco.size&&t.update([])}),50)},ii.contextmenu=function(t){t.inputState.lastContextMenu=Date.now()},ii.beforeinput=function(t,n){var i,e,r;Ft.chrome&&Ft.android&&(e=Xn.find((function(t){return t.inputType==n.inputType})))&&(t.observer.delayAndroidKey(e.key,e.keyCode),"Backspace"!=e.key&&"Delete"!=e.key||(r=(null===(i=window.visualViewport)||void 0===i?void 0:i.height)||0,setTimeout((function(){var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>r+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())}),100)))},vi=["pre-wrap","normal","pre-line","break-spaces"],di=function(){function t(n){yc(this,t),this.lineWrapping=n,this.doc=i.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}return kc(t,[{key:"heightForGap",value:function t(n,i){var e=this.doc.lineAt(i).number-this.doc.lineAt(n).number+1;return this.lineWrapping&&(e+=Math.max(0,Math.ceil((i-n-e*this.lineLength*.5)/this.lineLength))),this.lineHeight*e}},{key:"heightForLine",value:function t(n){return this.lineWrapping?(1+Math.max(0,Math.ceil((n-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight;var i}},{key:"setDoc",value:function t(n){return this.doc=n,this}},{key:"mustRefreshForWrapping",value:function t(n){return vi.indexOf(n)>-1!=this.lineWrapping}},{key:"mustRefreshForHeights",value:function t(n){var i,e,r=!1;for(i=0;i<n.length;i++)(e=n[i])<0?i++:this.heightSamples[Math.floor(10*e)]||(r=!0,this.heightSamples[Math.floor(10*e)]=!0);return r}},{key:"refresh",value:function t(n,i,e,r,u,o){var s,h,f=vi.indexOf(n)>-1,a=Math.round(i)!=Math.round(this.lineHeight)||this.lineWrapping!=f;if(this.lineWrapping=f,this.lineHeight=i,this.charWidth=e,this.textHeight=r,this.lineLength=u,a)for(this.heightSamples={},s=0;s<o.length;s++)(h=o[s])<0?s++:this.heightSamples[Math.floor(10*h)]=!0;return a}}]),t}(),yi=function(){function t(n,i){yc(this,t),this.from=n,this.heights=i,this.index=0}return kc(t,[{key:"more",get:function t(){return this.index<this.heights.length}}]),t}(),pi=function(){function t(n,i,e,r,u,o){yc(this,t),this.from=n,this.length=i,this.top=e,this.height=r,this.children=u,this.deco=o}return kc(t,[{key:"type",get:function t(){var n,i,e;return null!==(e=null!==(n=this.children)&&void 0!==n?n:null===(i=this.deco)||void 0===i?void 0:i.type)&&void 0!==e?e:Gt.Text}},{key:"widget",get:function t(){return this.deco&&this.deco.widget}},{key:"to",get:function t(){return this.from+this.length}},{key:"bottom",get:function t(){return this.top+this.height}},{key:"join",value:function n(i){var e=(this.children||[this]).concat(i.children||[i]);return new t(this.from,this.length+i.length,this.top,this.height+i.height,e,null)}}]),t}(),ki=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(ki||(ki={})),mi=.001,gi=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;yc(this,t),this.length=n,this.height=i,this.flags=e}return kc(t,[{key:"outdated",get:function t(){return(2&this.flags)>0},set:function t(n){this.flags=(n?2:0)|-3&this.flags}},{key:"setHeight",value:function t(n,i){this.height!=i&&(Math.abs(this.height-i)>mi&&(n.heightChanged=!0),this.height=i)}},{key:"replace",value:function n(i,e,r){return t.of(r)}},{key:"decomposeLeft",value:function t(n,i){i.push(this)}},{key:"decomposeRight",value:function t(n,i){i.push(this)}},{key:"applyChanges",value:function t(n,i,e,r){var u,o,s,h,f,a,c,l,v,d=this,y=e.doc;for(u=r.length-1;u>=0;u--){for(s=(o=r[u]).fromA,h=o.toA,f=o.fromB,a=o.toB,a+=(l=(c=d.lineAt(s,ki.ByPosNoHeight,e.setDoc(i),0,0)).to>=h?c:d.lineAt(h,ki.ByPosNoHeight,e,0,0)).to-h,h=l.to;u>0&&c.from<=r[u-1].toA;)s=r[u-1].fromA,f=r[u-1].fromB,u--,s<c.from&&(c=d.lineAt(s,ki.ByPosNoHeight,e,0,0));f+=c.from-s,s=c.from,v=Ci.build(e.setDoc(y),n,f,a),d=d.replace(s,h,v)}return d.updateHeight(e,0)}}],[{key:"empty",value:function t(){return new bi(0,0)}},{key:"of",value:function n(i){var e,r,u,o,s,h,f,a,c;if(1==i.length)return i[0];for(e=0,r=i.length,u=0,o=0;;)if(e==r)if(u>2*o)(s=i[e-1]).break?i.splice(--e,1,s.left,null,s.right):i.splice(--e,1,s.left,s.right),r+=1+s.break,u-=s.size;else{if(!(o>2*u))break;(h=i[r]).break?i.splice(r,1,h.left,null,h.right):i.splice(r,1,h.left,h.right),r+=2+h.break,o-=h.size}else u<o?(f=i[e++])&&(u+=f.size):(a=i[--r])&&(o+=a.size);return c=0,null==i[e-1]?(c=1,e--):null==i[e]&&(c=1,r++),new xi(t.of(i.slice(0,e)),c,t.of(i.slice(r)))}}]),t}(),gi.prototype.size=1,wi=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t,e)).deco=r,u}return kc(i,[{key:"blockAt",value:function t(n,i,e,r){return new pi(r,this.length,e,this.height,null,this.deco)}},{key:"lineAt",value:function t(n,i,e,r,u){return this.blockAt(0,e,r,u)}},{key:"forEachLine",value:function t(n,i,e,r,u,o){n<=u+this.length&&i>=u&&o(this.blockAt(0,e,r,u))}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return r&&r.from<=i&&r.more&&this.setHeight(n,r.heights[r.index++]),this.outdated=!1,this}},{key:"toString",value:function t(){return"block(".concat(this.length,")")}}]),i}(gi),bi=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this,t,e,null)).collapsed=0,r.widgetHeight=0,r}return kc(i,[{key:"replace",value:function t(n,e,r){var u=r[0];return 1==r.length&&(u instanceof i||u instanceof Mi&&4&u.flags)&&Math.abs(this.length-u.length)<10?(u instanceof Mi?u=new i(u.length,this.height):u.height=this.height,this.outdated||(u.outdated=!1),u):gi.of(r)}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0;return r&&r.from<=i&&r.more?this.setHeight(n,r.heights[r.index++]):(e||this.outdated)&&this.setHeight(n,Math.max(this.widgetHeight,n.heightForLine(this.length-this.collapsed))),this.outdated=!1,this}},{key:"toString",value:function t(){return"line(".concat(this.length).concat(this.collapsed?-this.collapsed:"").concat(this.widgetHeight?":"+this.widgetHeight:"",")")}}]),i}(wi),Mi=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,t,0)}return kc(i,[{key:"heightMetrics",value:function t(n,i){var e,r,u=n.doc.lineAt(i).number,o=n.doc.lineAt(i+this.length).number,s=o-u+1,h=0;return n.lineWrapping?(e=(r=Math.min(this.height,n.lineHeight*s))/s,this.length>s+1&&(h=(this.height-r)/(this.length-s-1))):e=this.height/s,{firstLine:u,lastLine:o,perLine:e,perChar:h}}},{key:"blockAt",value:function t(n,i,e,r){var u,o,s,h,f,a,c,l,v=this.heightMetrics(i,r),d=v.firstLine,y=v.lastLine,p=v.perLine,k=v.perChar;return i.lineWrapping?(u=r+Math.round(Math.max(0,Math.min(1,(n-e)/this.height))*this.length),s=p+(o=i.doc.lineAt(u)).length*k,h=Math.max(e,n-s/2),new pi(o.from,o.length,h,s,null,null)):(f=Math.max(0,Math.min(y-d,Math.floor((n-e)/p))),c=(a=i.doc.line(d+f)).from,l=a.length,new pi(c,l,e+p*f,p,null,null))}},{key:"lineAt",value:function t(n,i,e,r,u){var o,s,h,f,a,c,l,v,d,y,p;return i==ki.ByHeight?this.blockAt(n,e,r,u):i==ki.ByPosNoHeight?(s=(o=e.doc.lineAt(n)).from,h=o.to,new pi(s,h-s,0,0,null,null)):(a=(f=this.heightMetrics(e,u)).firstLine,c=f.perLine,l=f.perChar,d=c+(v=e.doc.lineAt(n)).length*l,p=r+c*(y=v.number-a)+l*(v.from-u-y),new pi(v.from,v.length,Math.max(r,Math.min(p,r+this.height-d)),d,null,null))}},{key:"forEachLine",value:function t(n,i,e,r,u,o){var s,h,f,a,c,l,v,d,y;for(n=Math.max(n,u),i=Math.min(i,u+this.length),h=(s=this.heightMetrics(e,u)).firstLine,f=s.perLine,a=s.perChar,c=n,l=r;c<=i;)v=e.doc.lineAt(c),c==n&&(l+=f*(d=v.number-h)+a*(n-u-d)),y=f+a*v.length,o(new pi(v.from,v.length,l,y,null,null)),l+=y,c=v.to+1}},{key:"replace",value:function t(n,e,r){var u,o,s=this.length-e;return s>0&&((u=r[r.length-1])instanceof i?r[r.length-1]=new i(u.length+s):r.push(null,new i(s-1))),n>0&&((o=r[0])instanceof i?r[0]=new i(n+o.length):r.unshift(new i(n-1),null)),gi.of(r)}},{key:"decomposeLeft",value:function t(n,e){e.push(new i(n-1),null)}},{key:"decomposeRight",value:function t(n,e){e.push(null,new i(this.length-n-1))}},{key:"updateHeight",value:function t(n){var e,r,u,o,s,h,f,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=arguments.length>3?arguments[3]:void 0,v=a+this.length;if(l&&l.from<=a+this.length&&l.more){for(e=[],r=Math.max(a,l.from),u=-1,l.from>a&&e.push(new i(l.from-a-1).updateHeight(n,a));r<=v&&l.more;)o=n.doc.lineAt(r).length,e.length&&e.push(null),s=l.heights[l.index++],-1==u?u=s:Math.abs(s-u)>=mi&&(u=-2),(h=new bi(o,s)).outdated=!1,e.push(h),r+=o+1;return r<=v&&e.push(null,new i(v-r).updateHeight(n,r)),f=gi.of(e),(u<0||Math.abs(f.height-this.height)>=mi||Math.abs(u-this.heightMetrics(n,a).perLine)>=mi)&&(n.heightChanged=!0),f}return(c||this.outdated)&&(this.setHeight(n,n.heightForGap(a,a+this.length)),this.outdated=!1),this}},{key:"toString",value:function t(){return"gap(".concat(this.length,")")}}]),i}(gi),xi=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0))).left=t,u.right=r,u.size=t.size+r.size,u}return kc(i,[{key:"break",get:function t(){return 1&this.flags}},{key:"blockAt",value:function t(n,i,e,r){var u=e+this.left.height;return n<u?this.left.blockAt(n,i,e,r):this.right.blockAt(n,i,u,r+this.left.length+this.break)}},{key:"lineAt",value:function t(n,i,e,r,u){var o,s=r+this.left.height,h=u+this.left.length+this.break,f=i==ki.ByHeight?n<s:n<h,a=f?this.left.lineAt(n,i,e,r,u):this.right.lineAt(n,i,e,s,h);return this.break||(f?a.to<h:a.from>h)?a:(o=i==ki.ByPosNoHeight?ki.ByPosNoHeight:ki.ByPos,f?a.join(this.right.lineAt(h,o,e,s,h)):this.left.lineAt(h,o,e,r,u).join(a))}},{key:"forEachLine",value:function t(n,i,e,r,u,o){var s,h=r+this.left.height,f=u+this.left.length+this.break;this.break?(n<f&&this.left.forEachLine(n,i,e,r,u,o),i>=f&&this.right.forEachLine(n,i,e,h,f,o)):(n<(s=this.lineAt(f,ki.ByPos,e,r,u)).from&&this.left.forEachLine(n,s.from-1,e,r,u,o),s.to>=n&&s.from<=i&&o(s),i>s.to&&this.right.forEachLine(s.to+1,i,e,h,f,o))}},{key:"replace",value:function t(n,i,e){var r,u,o,s,h,f,a=this.left.length+this.break;if(i<a)return this.balanced(this.left.replace(n,i,e),this.right);if(n>this.left.length)return this.balanced(this.left,this.right.replace(n-a,i-a,e));r=[],n>0&&this.decomposeLeft(n,r),u=r.length,o=ic(e);try{for(o.s();!(s=o.n()).done;)h=s.value,r.push(h)}catch(t){o.e(t)}finally{o.f()}return n>0&&Qv(r,u-1),i<this.length&&(f=r.length,this.decomposeRight(i,r),Qv(r,f)),gi.of(r)}},{key:"decomposeLeft",value:function t(n,i){var e=this.left.length;if(n<=e)return this.left.decomposeLeft(n,i);i.push(this.left),this.break&&n>=++e&&i.push(null),n>e&&this.right.decomposeLeft(n-e,i)}},{key:"decomposeRight",value:function t(n,i){var e=this.left.length,r=e+this.break;if(n>=r)return this.right.decomposeRight(n-r,i);n<e&&this.left.decomposeRight(n,i),this.break&&n<r&&i.push(null),i.push(this.right)}},{key:"balanced",value:function t(n,i){return n.size>2*i.size||i.size>2*n.size?gi.of(this.break?[n,null,i]:[n,i]):(this.left=n,this.right=i,this.height=n.height+i.height,this.outdated=n.outdated||i.outdated,this.size=n.size+i.size,this.length=n.length+this.break+i.length,this)}},{key:"updateHeight",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3?arguments[3]:void 0,u=this.left,o=this.right,s=i+u.length+this.break,h=null;return r&&r.from<=i+u.length&&r.more?h=u=u.updateHeight(n,i,e,r):u.updateHeight(n,i,e),r&&r.from<=s+o.length&&r.more?h=o=o.updateHeight(n,s,e,r):o.updateHeight(n,s,e),h?this.balanced(u,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}},{key:"toString",value:function t(){return this.left+(this.break?" ":"-")+this.right}}]),i}(gi),Si=5,Ci=function(){function t(n,i){yc(this,t),this.pos=n,this.oracle=i,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=n}return kc(t,[{key:"isCovered",get:function t(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}},{key:"span",value:function t(n,i){if(this.lineStart>-1){var e=Math.min(i,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof bi?r.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new bi(e-this.pos,-1)),this.writtenTo=e,i>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=i}},{key:"point",value:function t(n,i,e){var r,u;n<i||e.heightRelevant?((r=e.widget?e.widget.estimatedHeight:0)<0&&(r=this.oracle.lineHeight),u=i-n,e.block?this.addBlock(new wi(u,r,e)):(u||r>=Si)&&this.addLineDeco(r,u)):i>n&&this.span(n,i),this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}},{key:"enterLine",value:function t(){if(!(this.lineStart>-1)){var n=this.oracle.doc.lineAt(this.pos),i=n.from,e=n.to;this.lineStart=i,this.lineEnd=e,this.writtenTo<i&&((this.writtenTo<i-1||null==this.nodes[this.nodes.length-1])&&this.nodes.push(this.blankContent(this.writtenTo,i-1)),this.nodes.push(null)),this.pos>i&&this.nodes.push(new bi(this.pos-i,-1)),this.writtenTo=this.pos}}},{key:"blankContent",value:function t(n,i){var e=new Mi(i-n);return this.oracle.doc.lineAt(n).to==i&&(e.flags|=4),e}},{key:"ensureLine",value:function t(){var n,i;return this.enterLine(),(n=this.nodes.length?this.nodes[this.nodes.length-1]:null)instanceof bi?n:(i=new bi(0,-1),this.nodes.push(i),i)}},{key:"addBlock",value:function t(n){var i,e;this.enterLine(),(e=null===(i=n.deco)||void 0===i?void 0:i.type)!=Gt.WidgetAfter||this.isCovered||this.ensureLine(),this.nodes.push(n),this.writtenTo=this.pos=this.pos+n.length,e!=Gt.WidgetBefore&&(this.covering=n)}},{key:"addLineDeco",value:function t(n,i){var e=this.ensureLine();e.length+=i,e.collapsed+=i,e.widgetHeight=Math.max(e.widgetHeight,n),this.writtenTo=this.pos=this.pos+i}},{key:"finish",value:function t(n){var i,e,r,u,o=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||o instanceof bi||this.isCovered?(this.writtenTo<this.pos||null==o)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos)):this.nodes.push(new bi(0,-1)),i=n,e=ic(this.nodes);try{for(e.s();!(r=e.n()).done;)(u=r.value)instanceof bi&&u.updateHeight(this.oracle,i),i+=u?u.length:1}catch(t){e.e(t)}finally{e.f()}return this.nodes}}],[{key:"build",value:function n(i,e,r,u){var o=new t(r,i);return tt.spans(e,r,u,o,0),o.finish(r)}}]),t}(),Oi=function(){function t(){yc(this,t),this.changes=[]}return kc(t,[{key:"compareRange",value:function t(){}},{key:"comparePoint",value:function t(n,i,e,r){(n<i||e&&e.heightRelevant||r&&r.heightRelevant)&&Xl(n,i,this.changes,5)}}]),t}(),Ai=function(){function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.size=e}return kc(t,[{key:"draw",value:function t(n){return Jt.replace({widget:new Di(this.size,n)}).range(this.from,this.to)}}],[{key:"same",value:function t(n,i){var e,r,u;if(n.length!=i.length)return!1;for(e=0;e<n.length;e++)if(r=n[e],u=i[e],r.from!=u.from||r.to!=u.to||r.size!=u.size)return!1;return!0}}]),t}(),Di=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).size=t,r.vertical=e,r}return kc(i,[{key:"eq",value:function t(n){return n.size==this.size&&n.vertical==this.vertical}},{key:"toDOM",value:function t(){var n=document.createElement("div");return this.vertical?n.style.height=this.size+"px":(n.style.width=this.size+"px",n.style.height="2px",n.style.display="inline-block"),n}},{key:"estimatedHeight",get:function t(){return this.vertical?this.size:-1}}]),i}(qt),Ei=function(){function t(n){yc(this,t),this.state=n,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.scaler=Ri,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=An.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;var e=n.facet(wn).some((function(t){return"function"!=typeof t&&"cm-lineWrapping"==t.class}));this.heightOracle=new di(e),this.stateDeco=n.facet(bn).filter((function(t){return"function"!=typeof t})),this.heightMap=gi.empty().applyChanges(this.stateDeco,i.empty,this.heightOracle.setDoc(n.doc),[new Cn(0,0,0,n.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Jt.set(this.lineGaps.map((function(t){return t.draw(!1)}))),this.computeVisibleRanges()}return kc(t,[{key:"updateForViewport",value:function t(){var n,i=this,e=[this.viewport],r=this.state.selection.main,u=function t(){var u,o,s,h=n?r.head:r.anchor;e.some((function(t){var n=t.from,i=t.to;return h>=n&&h<=i}))||(o=(u=i.lineBlockAt(h)).from,s=u.to,e.push(new Ii(o,s)))};for(n=0;n<=1;n++)u();this.viewports=e.sort((function(t,n){return t.from-n.from})),this.scaler=this.heightMap.height<=7e6?Ri:new Li(this.heightOracle,this.heightMap,this.viewports)}},{key:"updateViewportLines",value:function t(){var n=this;this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(function(t){n.viewportLines.push(1==n.scaler.scale?t:rd(t,n.scaler))}))}},{key:"update",value:function t(n){var i,e,r,u,o,s,h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.state=n.state,i=this.stateDeco,this.stateDeco=this.state.facet(bn).filter((function(t){return"function"!=typeof t})),e=n.changedRanges,r=Cn.extendWithRanges(e,Xv(i,this.stateDeco,n?n.changes:y.empty(this.state.doc.length))),u=this.heightMap.height,this.heightMap=this.heightMap.applyChanges(this.stateDeco,n.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=u&&(n.flags|=2),o=r.length?this.mapViewport(this.viewport,n.changes):this.viewport,(h&&(h.range.head<o.from||h.range.head>o.to)||!this.viewportIsAppropriate(o))&&(o=this.getViewport(0,h)),s=!n.changes.empty||2&n.flags||o.from!=this.viewport.from||o.to!=this.viewport.to,this.viewport=o,this.updateForViewport(),s&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,n.changes))),n.flags|=this.computeVisibleRanges(),h&&(this.scrollTarget=h),!this.mustEnforceCursorAssoc&&n.selectionSet&&n.view.lineWrapping&&n.state.selection.main.empty&&n.state.selection.main.assoc&&!n.state.facet(cn)&&(this.mustEnforceCursorAssoc=!0)}},{key:"measure",value:function t(n){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C=n.contentDOM,O=window.getComputedStyle(C),A=this.heightOracle,D=O.whiteSpace;if(this.defaultTextDirection="rtl"==O.direction?An.RTL:An.LTR,e=this.heightOracle.mustRefreshForWrapping(D),r=C.getBoundingClientRect(),u=e||this.mustMeasureContent||this.contentDOMHeight!=r.height,this.contentDOMHeight=r.height,this.mustMeasureContent=!1,o=0,s=0,h=parseInt(O.paddingTop)||0,f=parseInt(O.paddingBottom)||0,this.paddingTop==h&&this.paddingBottom==f||(this.paddingTop=h,this.paddingBottom=f,o|=10),this.editorWidth!=n.scrollDOM.clientWidth&&(A.lineWrapping&&(u=!0),this.editorWidth=n.scrollDOM.clientWidth,o|=8),c=(a=(this.printing?Yv:Zv)(C,this.paddingTop)).top-this.pixelViewport.top,l=a.bottom-this.pixelViewport.bottom,this.pixelViewport=a,(v=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left)!=this.inView&&(this.inView=v,v&&(u=!0)),!this.inView&&!this.scrollTarget)return 0;if(d=r.width,this.contentDOMWidth==d&&this.editorHeight==n.scrollDOM.clientHeight||(this.contentDOMWidth=r.width,this.editorHeight=n.scrollDOM.clientHeight,o|=8),u){y=n.docView.measureVisibleLineHeights(this.viewport),A.mustRefreshForHeights(y)&&(e=!0),(e||A.lineWrapping&&Math.abs(d-this.contentDOMWidth)>A.charWidth)&&(k=(p=n.docView.measureTextSize()).lineHeight,m=p.charWidth,g=p.textHeight,(e=k>0&&A.refresh(D,k,m,g,d/m,y))&&(n.docView.minWidth=0,o|=8)),c>0&&l>0?s=Math.max(c,l):c<0&&l<0&&(s=Math.min(c,l)),A.heightChanged=!1,w=ic(this.viewports);try{for(w.s();!(b=w.n()).done;)x=(M=b.value).from==this.viewport.from?y:n.docView.measureVisibleLineHeights(M),this.heightMap=(e?gi.empty().applyChanges(this.stateDeco,i.empty,this.heightOracle,[new Cn(0,0,0,n.state.doc.length)]):this.heightMap).updateHeight(A,0,e,new yi(M.from,x))}catch(t){w.e(t)}finally{w.f()}A.heightChanged&&(o|=2)}return(S=!this.viewportIsAppropriate(this.viewport,s)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to))&&(this.viewport=this.getViewport(s,this.scrollTarget)),this.updateForViewport(),(2&o||S)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(e?[]:this.lineGaps,n)),o|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,n.docView.enforceCursorAssoc()),o}},{key:"visibleTop",get:function t(){return this.scaler.fromDOM(this.pixelViewport.top)}},{key:"visibleBottom",get:function t(){return this.scaler.fromDOM(this.pixelViewport.bottom)}},{key:"getViewport",value:function t(n,i){var e,r,u,o,s=.5-Math.max(-.5,Math.min(.5,n/1e3/2)),h=this.heightMap,f=this.heightOracle,a=this.visibleTop,c=this.visibleBottom,l=new Ii(h.lineAt(a-1e3*s,ki.ByHeight,f,0,0).from,h.lineAt(c+1e3*(1-s),ki.ByHeight,f,0,0).to);return i&&((e=i.range.head)<l.from||e>l.to)&&(r=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),u=h.lineAt(e,ki.ByPos,f,0,0),o="center"==i.y?(u.top+u.bottom)/2-r/2:"start"==i.y||"nearest"==i.y&&e<l.from?u.top:u.bottom-r,l=new Ii(h.lineAt(o-500,ki.ByHeight,f,0,0).from,h.lineAt(o+r+500,ki.ByHeight,f,0,0).to)),l}},{key:"mapViewport",value:function t(n,i){var e=i.mapPos(n.from,-1),r=i.mapPos(n.to,1);return new Ii(this.heightMap.lineAt(e,ki.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,ki.ByPos,this.heightOracle,0,0).to)}},{key:"viewportIsAppropriate",value:function t(n){var i,e,r,u,o,s,h=n.from,f=n.to,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!this.inView||(e=(i=this.heightMap.lineAt(h,ki.ByPos,this.heightOracle,0,0)).top,u=(r=this.heightMap.lineAt(f,ki.ByPos,this.heightOracle,0,0)).bottom,o=this.visibleTop,s=this.visibleBottom,(0==h||e<=o-Math.max(10,Math.min(-a,250)))&&(f==this.state.doc.length||u>=s+Math.max(10,Math.min(a,250)))&&e>o-2e3&&u<s+2e3)}},{key:"mapLineGaps",value:function t(n,i){var e,r,u,o;if(!n.length||i.empty)return n;e=[],r=ic(n);try{for(r.s();!(u=r.n()).done;)o=u.value,i.touchesRange(o.from,o.to)||e.push(new Ai(i.mapPos(o.from),i.mapPos(o.to),o.size))}catch(t){r.e(t)}finally{r.f()}return e}},{key:"ensureLineGaps",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,g,w,b,M,x,S=this,C=this.heightOracle.lineWrapping,O=C?1e4:2e3,A=O>>1,D=O<<1;if(this.defaultTextDirection!=An.LTR&&!C)return[];e=[],r=function t(r,u,o,s){var h,f,a,c,l,v,d;if(!(u-r<A)){for(h=S.state.selection.main,f=[h.from],h.empty||f.push(h.to),a=0,c=f;a<c.length;a++)if((l=c[a])>r&&l<u)return t(r,l-10,o,s),void t(l+10,u,o,s);v=ed(n,(function(t){return t.from>=o.from&&t.to<=o.to&&Math.abs(t.from-r)<A&&Math.abs(t.to-u)<A&&!f.some((function(n){return t.from<n&&t.to>n}))})),v||(u<o.to&&i&&C&&i.visibleRanges.some((function(t){return t.from<=u&&t.to>=u}))&&(d=i.moveToLineBoundary(m.cursor(u),!1,!0).head)>r&&(u=d),v=new Ai(r,u,S.gapSize(o,r,u,s))),e.push(v)}},u=ic(this.viewportLines);try{for(u.s();!(o=u.n()).done;)(s=o.value).length<D||(h=td(s.from,s.to,this.stateDeco)).total<D||(f=this.scrollTarget?this.scrollTarget.range.head:null,a=void 0,c=void 0,C?(l=O/this.heightOracle.lineLength*this.heightOracle.lineHeight,v=void 0,d=void 0,null!=f?(v=(y=id(h,f))-(p=((this.visibleBottom-this.visibleTop)/2+l)/s.height),d=y+p):(v=(this.visibleTop-s.top-l)/s.height,d=(this.visibleBottom-s.top+l)/s.height),a=nd(h,v),c=nd(h,d)):(k=h.total*this.heightOracle.charWidth,g=O*this.heightOracle.charWidth,w=void 0,b=void 0,null!=f?(w=(M=id(h,f))-(x=((this.pixelViewport.right-this.pixelViewport.left)/2+g)/k),b=M+x):(w=(this.pixelViewport.left-g)/k,b=(this.pixelViewport.right+g)/k),a=nd(h,w),c=nd(h,b)),a>s.from&&r(s.from,a,s,h),c<s.to&&r(c,s.to,s,h))}catch(t){u.e(t)}finally{u.f()}return e}},{key:"gapSize",value:function t(n,i,e,r){var u=id(r,e)-id(r,i);return this.heightOracle.lineWrapping?n.height*u:r.total*this.heightOracle.charWidth*u}},{key:"updateLineGaps",value:function t(n){var i=this;Ai.same(n,this.lineGaps)||(this.lineGaps=n,this.lineGapDeco=Jt.set(n.map((function(t){return t.draw(i.heightOracle.lineWrapping)}))))}},{key:"computeVisibleRanges",value:function t(){var n,i,e=this.stateDeco;return this.lineGaps.length&&(e=e.concat(this.lineGapDeco)),n=[],tt.spans(e,this.viewport.from,this.viewport.to,{span:function t(i,e){n.push({from:i,to:e})},point:function t(){}},20),i=n.length!=this.visibleRanges.length||this.visibleRanges.some((function(t,i){return t.from!=n[i].from||t.to!=n[i].to})),this.visibleRanges=n,i?4:0}},{key:"lineBlockAt",value:function t(n){return n>=this.viewport.from&&n<=this.viewport.to&&this.viewportLines.find((function(t){return t.from<=n&&t.to>=n}))||rd(this.heightMap.lineAt(n,ki.ByPos,this.heightOracle,0,0),this.scaler)}},{key:"lineBlockAtHeight",value:function t(n){return rd(this.heightMap.lineAt(this.scaler.fromDOM(n),ki.ByHeight,this.heightOracle,0,0),this.scaler)}},{key:"elementAtHeight",value:function t(n){return rd(this.heightMap.blockAt(this.scaler.fromDOM(n),this.heightOracle,0,0),this.scaler)}},{key:"docHeight",get:function t(){return this.scaler.toDOM(this.heightMap.height)}},{key:"contentHeight",get:function t(){return this.docHeight+this.paddingTop+this.paddingBottom}}]),t}(),Ii=kc((function t(n,i){yc(this,t),this.from=n,this.to=i})),Ri={toDOM:function t(n){return n},fromDOM:function t(n){return n},scale:1},Li=function(){function t(n,i,e){var r,u,o,s,h,f;yc(this,t),r=0,u=0,o=0,this.viewports=e.map((function(t){var e=t.from,u=t.to,o=i.lineAt(e,ki.ByPos,n,0,0).top,s=i.lineAt(u,ki.ByPos,n,0,0).bottom;return r+=s-o,{from:e,to:u,top:o,bottom:s,domTop:0,domBottom:0}})),this.scale=(7e6-r)/(i.height-r),s=ic(this.viewports);try{for(s.s();!(h=s.n()).done;)(f=h.value).domTop=o+(f.top-u)*this.scale,o=f.domBottom=f.domTop+(f.bottom-f.top),u=f.bottom}catch(t){s.e(t)}finally{s.f()}}return kc(t,[{key:"toDOM",value:function t(n){var i,e,r,u;for(i=0,e=0,r=0;;i++){if(!(u=i<this.viewports.length?this.viewports[i]:null)||n<u.top)return r+(n-e)*this.scale;if(n<=u.bottom)return u.domTop+(n-u.top);e=u.bottom,r=u.domBottom}}},{key:"fromDOM",value:function t(n){var i,e,r,u;for(i=0,e=0,r=0;;i++){if(!(u=i<this.viewports.length?this.viewports[i]:null)||n<u.domTop)return e+(n-r)/this.scale;if(n<=u.domBottom)return u.top+(n-u.domTop);e=u.bottom,r=u.domBottom}}}]),t}(),ji=w.define({combine:function t(n){return n.join(" ")}}),Ti=w.define({combine:function t(n){return n.indexOf(!0)>-1}}),Fi=ud("."+(Bi=at.newName()),{"&":{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},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",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:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&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",left:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&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},"&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-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"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".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"}},Pi={"&light":"."+(_i=at.newName()),"&dark":"."+(Ni=at.newName())}),Hi=kc((function t(n,i,e,r){var u,o,s,h,f,a,c,l;yc(this,t),this.typeOver=r,this.bounds=null,this.text="",o=(u=n.docView).impreciseHead,s=u.impreciseAnchor,n.state.readOnly&&i>-1?this.newSel=null:i>-1&&(this.bounds=n.docView.domBoundsAround(i,e,0))?(h=o||s?[]:hd(n),(f=new Un(h,n.state)).readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=f.text,this.newSel=fd(h,this.bounds.from)):(a=n.observer.selectionRange,c=o&&o.node==a.focusNode&&o.offset==a.focusOffset||!pl(n.contentDOM,a.focusNode)?n.state.selection.main.head:n.docView.posFromDOM(a.focusNode,a.focusOffset),l=s&&s.node==a.anchorNode&&s.offset==a.anchorOffset||!pl(n.contentDOM,a.anchorNode)?n.state.selection.main.anchor:n.docView.posFromDOM(a.anchorNode,a.anchorOffset),this.newSel=m.single(l,c))})),zi={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Wi=Ft.ie&&Ft.ie_version<=11,Vi=function(){function t(n){var i=this;yc(this,t),this.view=n,this.active=!1,this.selectionRange=new bt,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.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=n.contentDOM,this.observer=new MutationObserver((function(t){var e,r,u=ic(t);try{for(u.s();!(e=u.n()).done;)r=e.value,i.queue.push(r)}catch(t){u.e(t)}finally{u.f()}(Ft.ie&&Ft.ie_version<=11||Ft.ios&&n.composing)&&t.some((function(t){return"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length}))?i.flushSoon():i.flush()})),Wi&&(this.onCharData=function(t){i.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),i.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),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((function(){var t;(null===(t=i.view.docView)||void 0===t?void 0:t.lastUpdate)<Date.now()-75&&i.onResize()})),this.resizeScroll.observe(n.scrollDOM),this.resizeContent=new ResizeObserver((function(){return i.view.requestMeasure()})),this.resizeContent.observe(n.contentDOM)),this.addWindowListeners(this.win=n.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((function(t){i.parentCheck<0&&(i.parentCheck=setTimeout(i.listenForScroll.bind(i),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=i.intersecting&&(i.intersecting=!i.intersecting,i.intersecting!=i.view.inView&&i.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((function(t){t.length>0&&t[t.length-1].intersectionRatio>0&&i.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}return kc(t,[{key:"onScrollChanged",value:function t(n){this.view.inputState.runScrollHandlers(this.view,n),this.intersecting&&this.view.measure()}},{key:"onScroll",value:function t(n){this.intersecting&&this.flush(!1),this.onScrollChanged(n)}},{key:"onResize",value:function t(){var n=this;this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((function(){n.resizeTimeout=-1,n.view.requestMeasure()}),50))}},{key:"onPrint",value:function t(){var n=this;this.view.viewState.printing=!0,this.view.measure(),setTimeout((function(){n.view.viewState.printing=!1,n.view.requestMeasure()}),500)}},{key:"updateGaps",value:function t(n){var i,e,r;if(this.gapIntersection&&(n.length!=this.gaps.length||this.gaps.some((function(t,i){return t!=n[i]})))){this.gapIntersection.disconnect(),i=ic(n);try{for(i.s();!(e=i.n()).done;)r=e.value,this.gapIntersection.observe(r)}catch(t){i.e(t)}finally{i.f()}this.gaps=n}}},{key:"onSelectionChange",value:function t(n){var i,e,r,u=this.selectionChanged;this.readSelectionRange()&&!this.delayedAndroidKey&&(i=this.view,e=this.selectionRange,(i.state.facet(dn)?i.root.activeElement==this.dom:ml(i.dom,e))&&((r=e.anchorNode&&i.docView.nearest(e.anchorNode))&&r.ignoreEvent(n)?u||(this.selectionChanged=!1):(Ft.ie&&Ft.ie_version<=11||Ft.android&&Ft.chrome)&&!i.state.selection.main.empty&&e.focusNode&&wl(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)?this.flushSoon():this.flush(!1)))}},{key:"readSelectionRange",value:function t(){var n,i=this.view,e=Ft.safari&&11==i.root.nodeType&&kl(this.dom.ownerDocument)==this.dom&&cd(this.view)||yl(i.root);return!(!e||this.selectionRange.eq(e))&&((n=ml(this.dom,e))&&!this.selectionChanged&&i.inputState.lastFocusTime>Date.now()-200&&i.inputState.lastTouchTime<Date.now()-300&&jl(this.dom,e)?(this.view.inputState.lastFocusTime=0,i.docView.updateSelection(),!1):(this.selectionRange.setRange(e),n&&(this.selectionChanged=!0),!0))}},{key:"setSelectionRange",value:function t(n,i){this.selectionRange.set(n.node,n.offset,i.node,i.offset),this.selectionChanged=!1}},{key:"clearSelectionRange",value:function t(){this.selectionRange.set(null,0,null,0)}},{key:"listenForScroll",value:function t(){var n,i,e,r,u,o,s,h,f;for(this.parentCheck=-1,n=0,i=null,e=this.dom;e;)if(1==e.nodeType)!i&&n<this.scrollTargets.length&&this.scrollTargets[n]==e?n++:i||(i=this.scrollTargets.slice(0,n)),i&&i.push(e),e=e.assignedSlot||e.parentNode;else{if(11!=e.nodeType)break;e=e.host}if(n<this.scrollTargets.length&&!i&&(i=this.scrollTargets.slice(0,n)),i){r=ic(this.scrollTargets);try{for(r.s();!(u=r.n()).done;)(o=u.value).removeEventListener("scroll",this.onScroll)}catch(t){r.e(t)}finally{r.f()}s=ic(this.scrollTargets=i);try{for(s.s();!(h=s.n()).done;)(f=h.value).addEventListener("scroll",this.onScroll)}catch(t){s.e(t)}finally{s.f()}}}},{key:"ignore",value:function t(n){if(!this.active)return n();try{return this.stop(),n()}finally{this.start(),this.clear()}}},{key:"start",value:function t(){this.active||(this.observer.observe(this.dom,zi),Wi&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}},{key:"stop",value:function t(){this.active&&(this.active=!1,this.observer.disconnect(),Wi&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}},{key:"clear",value:function t(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}},{key:"delayAndroidKey",value:function t(n,i){var e,r,u=this;this.delayedAndroidKey||(r=function t(){var n,i=u.delayedAndroidKey;i&&(u.clearDelayedAndroidKey(),u.view.inputState.lastKeyCode=i.keyCode,u.view.inputState.lastKeyTime=Date.now(),!(n=u.flush())&&i.force&&Il(u.dom,i.key,i.keyCode))},this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)),this.delayedAndroidKey&&"Enter"!=n||(this.delayedAndroidKey={key:n,keyCode:i,force:this.lastChange<Date.now()-50||!!(null===(e=this.delayedAndroidKey)||void 0===e?void 0:e.force)})}},{key:"clearDelayedAndroidKey",value:function t(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}},{key:"flushSoon",value:function t(){var n=this;this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame((function(){n.delayedFlush=-1,n.flush()})))}},{key:"forceFlush",value:function t(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}},{key:"pendingRecords",value:function t(){var n,i,e=ic(this.observer.takeRecords());try{for(e.s();!(n=e.n()).done;)i=n.value,this.queue.push(i)}catch(t){e.e(t)}finally{e.f()}return this.queue}},{key:"processRecords",value:function t(){var n,i,e,r,u,o,s,h=this.pendingRecords();h.length&&(this.queue=[]),n=-1,i=-1,e=!1,r=ic(h);try{for(r.s();!(u=r.n()).done;)o=u.value,(s=this.readMutation(o))&&(s.typeOver&&(e=!0),-1==n?(n=s.from,i=s.to):(n=Math.min(s.from,n),i=Math.max(s.to,i)))}catch(t){r.e(t)}finally{r.f()}return{from:n,to:i,typeOver:e}}},{key:"readChange",value:function t(){var n=this.processRecords(),i=n.from,e=n.to,r=n.typeOver,u=this.selectionChanged&&ml(this.dom,this.selectionRange);return i<0&&!u?null:(i>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Hi(this.view,i,e,r))}},{key:"flush",value:function t(){var n,i,e,r=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return!(this.delayedFlush>=0||this.delayedAndroidKey)&&(r&&this.readSelectionRange(),!!(n=this.readChange())&&(i=this.view.state,e=od(this.view,n),this.view.state==i&&this.view.update([]),e))}},{key:"readMutation",value:function t(n){var i,e,r=this.view.docView.nearest(n.target);return!r||r.ignoreMutation(n)?null:(r.markDirty("attributes"==n.type),"attributes"==n.type&&(r.dirty|=4),"childList"==n.type?(i=ad(r,n.previousSibling||n.target.previousSibling,-1),e=ad(r,n.nextSibling||n.target.nextSibling,1),{from:i?r.posAfter(i):r.posAtStart,to:e?r.posBefore(e):r.posAtEnd,typeOver:!1}):"characterData"==n.type?{from:r.posAtStart,to:r.posAtEnd,typeOver:n.target.nodeValue==n.oldValue}:null)}},{key:"setWindow",value:function t(n){n!=this.win&&(this.removeWindowListeners(this.win),this.win=n,this.addWindowListeners(this.win))}},{key:"addWindowListeners",value:function t(n){n.addEventListener("resize",this.onResize),n.addEventListener("beforeprint",this.onPrint),n.addEventListener("scroll",this.onScroll),n.document.addEventListener("selectionchange",this.onSelectionChange)}},{key:"removeWindowListeners",value:function t(n){n.removeEventListener("scroll",this.onScroll),n.removeEventListener("resize",this.onResize),n.removeEventListener("beforeprint",this.onPrint),n.document.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"destroy",value:function t(){var n,i,e,r,u,o,s;this.stop(),null===(n=this.intersection)||void 0===n||n.disconnect(),null===(i=this.gapIntersection)||void 0===i||i.disconnect(),null===(e=this.resizeScroll)||void 0===e||e.disconnect(),null===(r=this.resizeContent)||void 0===r||r.disconnect(),u=ic(this.scrollTargets);try{for(u.s();!(o=u.n()).done;)(s=o.value).removeEventListener("scroll",this.onScroll)}catch(t){u.e(t)}finally{u.f()}this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}]),t}(),Ui=function(){function t(){var n,i,e,r=this,u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};yc(this,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.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this.$de=u.dispatch||function(t){return r.update([t])},this.dispatch=this.dispatch.bind(this),this.Nkt=u.root||Rl(u.parent)||document,this.viewState=new Ei(u.state||Q.create(u)),this.plugins=this.state.facet(pn).map((function(t){return new mn(t)})),n=ic(this.plugins);try{for(n.s();!(i=n.n()).done;)(e=i.value).update(this)}catch(t){n.e(t)}finally{n.f()}this.observer=new Vi(this),this.inputState=new Qn(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new qn(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),u.parent&&u.parent.appendChild(this.dom)}return kc(t,[{key:"state",get:function t(){return this.viewState.state}},{key:"viewport",get:function t(){return this.viewState.viewport}},{key:"visibleRanges",get:function t(){return this.viewState.visibleRanges}},{key:"inView",get:function t(){return this.viewState.inView}},{key:"composing",get:function t(){return this.inputState.composing>0}},{key:"compositionStarted",get:function t(){return this.inputState.composing>=0}},{key:"root",get:function t(){return this.Nkt}},{key:"win",get:function t(){return this.dom.ownerDocument.defaultView||window}},{key:"dispatch",value:function t(){var n,i=1==arguments.length&&(arguments.length<=0?void 0:arguments[0])instanceof $?arguments.length<=0?void 0:arguments[0]:(n=this.state).update.apply(n,arguments);this.$de(i,this)}},{key:"update",value:function t(n){var i,e,t,r,u,o,s,h,f,a,c,l,v,d,y,p,k,g,w,b,M,x,S,C=this;if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");i=!1,e=!1,r=this.state,u=ic(n);try{for(u.s();!(o=u.n()).done;){if((s=o.value).startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=s.state}}catch(t){u.e(t)}finally{u.f()}if(this.destroyed)this.viewState.state=r;else{if(h=this.hasFocus,f=0,a=null,n.some((function(t){return t.annotation(li)}))?(this.inputState.notifiedFocused=h,f=1):h!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=h,(a=Jv(r,h))||(f=1)),c=this.observer.delayedAndroidKey,l=null,c?(this.observer.clearDelayedAndroidKey(),((l=this.observer.readChange())&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(l=null)):this.observer.clear(),r.facet(Q.phrases)!=this.state.facet(Q.phrases))return this.setState(r);t=On.create(this,r,n),t.flags|=f,v=this.viewState.scrollTarget;try{this.updateState=2,d=ic(n);try{for(d.s();!(y=d.n()).done;){p=y.value,v&&(v=v.map(p.changes)),p.scrollIntoView&&(k=p.state.selection.main,v=new ln(k.empty?k:m.cursor(k.head,k.head>k.anchor?-1:1))),g=ic(p.effects);try{for(g.s();!(w=g.n()).done;)(b=w.value).is(vn)&&(v=b.value)}catch(t){g.e(t)}finally{g.f()}}}catch(t){d.e(t)}finally{d.f()}this.viewState.update(t,v),this.bidiCache=Gi.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),i=this.docView.update(t),this.state.facet(Sn)!=this.styleModules&&this.mountStyles(),e=this.updateAttrs(),this.showAnnouncements(n),this.docView.updateSelection(i,n.some((function(t){return t.isUserEvent("select.pointer")})))}finally{this.updateState=0}if(t.startState.facet(ji)!=t.state.facet(ji)&&(this.viewState.mustMeasureContent=!0),(i||e||v||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty){M=ic(this.state.facet(sn));try{for(M.s();!(x=M.n()).done;)(S=x.value)(t)}catch(t){M.e(t)}finally{M.f()}}(a||l)&&Promise.resolve().then((function(){a&&C.state==a.startState&&C.dispatch(a),l&&!od(C,l)&&c.force&&Il(C.contentDOM,c.key,c.keyCode)}))}}},{key:"setState",value:function t(n){var i,e,r,u,o,s,h;if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)this.viewState.state=n;else{this.updateState=2,i=this.hasFocus;try{e=ic(this.plugins);try{for(e.s();!(r=e.n()).done;)(u=r.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.viewState=new Ei(n),this.plugins=n.facet(pn).map((function(t){return new mn(t)})),this.pluginMap.clear(),o=ic(this.plugins);try{for(o.s();!(s=o.n()).done;)(h=s.value).update(this)}catch(t){o.e(t)}finally{o.f()}this.docView=new qn(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}i&&this.focus(),this.requestMeasure()}}},{key:"updatePlugins",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y=n.startState.facet(pn),p=n.state.facet(pn);if(y!=p){i=[],e=ic(p);try{for(e.s();!(r=e.n()).done;)u=r.value,(o=y.indexOf(u))<0?i.push(new mn(u)):((s=this.plugins[o]).mustUpdate=n,i.push(s))}catch(t){e.e(t)}finally{e.f()}h=ic(this.plugins);try{for(h.s();!(f=h.n()).done;)(a=f.value).mustUpdate!=n&&a.destroy(this)}catch(t){h.e(t)}finally{h.f()}this.plugins=i,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else{c=ic(this.plugins);try{for(c.s();!(l=c.n()).done;)(v=l.value).mustUpdate=n}catch(t){c.e(t)}finally{c.f()}}for(d=0;d<this.plugins.length;d++)this.plugins[d].update(this)}},{key:"measure",value:function t(){var n,i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x=this,S=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(!this.destroyed){this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,S&&this.observer.forceFlush(),n=null,e=(i=this.scrollDOM).scrollHeight,o=(r=i.scrollTop)>e-(u=i.clientHeight)-4?e:r;try{for(s=0;this.updateState=1,h=this.viewport,f=this.viewState.lineBlockAtHeight(o),(a=this.viewState.measure(this))||this.measureRequests.length||null!=this.viewState.scrollTarget;s++){if(s>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}for(c=[],4&a||(l=[c,this.measureRequests],this.measureRequests=l[0],c=l[1]),v=c.map((function(t){try{return t.read(x)}catch(t){return Yl(x.state,t),qi}})),d=On.create(this,this.state,[]),y=!1,p=!1,d.flags|=a,n?n.flags|=a:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),y=this.docView.update(d)),k=0;k<c.length;k++)if(v[k]!=qi)try{(m=c[k]).write&&m.write(v[k],this)}catch(t){Yl(this.state,t)}if(this.viewState.editorHeight&&(this.viewState.scrollTarget?(this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,p=!0):((g=this.viewState.lineBlockAt(f.from).top-f.top)>1||g<-1)&&(this.scrollDOM.scrollTop+=g,p=!0)),y&&this.docView.updateSelection(!0),this.viewport.from==h.from&&this.viewport.to==h.to&&!p&&0==this.measureRequests.length)break}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty){w=ic(this.state.facet(sn));try{for(w.s();!(b=w.n()).done;)(M=b.value)(n)}catch(t){w.e(t)}finally{w.f()}}}}},{key:"themeClasses",get:function t(){return Bi+" "+(this.state.facet(Ti)?Ni:_i)+" "+this.state.facet(ji)}},{key:"updateAttrs",value:function t(){var n,i=this,e=ld(this,gn,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),r={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(dn)?"true":"false",class:"cm-content",style:"".concat(Ft.tabSize,": ").concat(this.state.tabSize),role:"textbox","aria-multiline":"true"};return this.state.readOnly&&(r["aria-readonly"]="true"),ld(this,wn,r),n=this.observer.ignore((function(){var t=Jl(i.contentDOM,i.contentAttrs,r),n=Jl(i.dom,i.editorAttrs,e);return t||n})),this.editorAttrs=e,this.contentAttrs=r,n}},{key:"showAnnouncements",value:function n(i){var e,r,u,o,s,h,f=!0,a=ic(i);try{for(a.s();!(e=a.n()).done;){u=ic((r=e.value).effects);try{for(u.s();!(o=u.n()).done;)(s=o.value).is(t.announce)&&(f&&(this.announceDOM.textContent=""),f=!1,(h=this.announceDOM.appendChild(document.createElement("div"))).textContent=s.value)}catch(t){u.e(t)}finally{u.f()}}}catch(t){a.e(t)}finally{a.f()}}},{key:"mountStyles",value:function t(){this.styleModules=this.state.facet(Sn),at.mount(this.root,this.styleModules.concat(Fi).reverse())}},{key:"readMeasured",value:function t(){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)}},{key:"requestMeasure",value:function t(n){var i,e=this;if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((function(){return e.measure()}))),n){if(this.measureRequests.indexOf(n)>-1)return;if(null!=n.key)for(i=0;i<this.measureRequests.length;i++)if(this.measureRequests[i].key===n.key)return void(this.measureRequests[i]=n);this.measureRequests.push(n)}}},{key:"plugin",value:function t(n){var i=this.pluginMap.get(n);return(void 0===i||i&&i.spec!=n)&&this.pluginMap.set(n,i=this.plugins.find((function(t){return t.spec==n}))||null),i&&i.update(this).value}},{key:"documentTop",get:function t(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}},{key:"documentPadding",get:function t(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}},{key:"elementAtHeight",value:function t(n){return this.readMeasured(),this.viewState.elementAtHeight(n)}},{key:"lineBlockAtHeight",value:function t(n){return this.readMeasured(),this.viewState.lineBlockAtHeight(n)}},{key:"viewportLineBlocks",get:function t(){return this.viewState.viewportLines}},{key:"lineBlockAt",value:function t(n){return this.viewState.lineBlockAt(n)}},{key:"contentHeight",get:function t(){return this.viewState.contentHeight}},{key:"moveByChar",value:function t(n,i,e){return Rv(this,n,Av(this,n,i,e))}},{key:"moveByGroup",value:function t(n,i){var e=this;return Rv(this,n,Av(this,n,i,(function(t){return Dv(e,n.head,t)})))}},{key:"moveToLineBoundary",value:function t(n,i){var e;return Ov(this,n,i,!(arguments.length>2&&void 0!==arguments[2])||arguments[2])}},{key:"moveVertically",value:function t(n,i,e){return Rv(this,n,Ev(this,n,i,e))}},{key:"domAtPos",value:function t(n){return this.docView.domAtPos(n)}},{key:"posAtDOM",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.posFromDOM(n,i)}},{key:"posAtCoords",value:function t(n){var i=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.readMeasured(),Mv(this,n,i)}},{key:"coordsAtPos",value:function t(n){var i,e,r,u,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.readMeasured(),(i=this.docView.coordsAt(n,o))&&i.left!=i.right?(e=this.state.doc.lineAt(n),Sl(i,(u=(r=this.bidiSpans(e))[Hn.find(r,n-e.from,-1,o)]).dir==An.LTR==o>0)):i}},{key:"defaultCharacterWidth",get:function t(){return this.viewState.heightOracle.charWidth}},{key:"defaultLineHeight",get:function t(){return this.viewState.heightOracle.lineHeight}},{key:"textDirection",get:function t(){return this.viewState.defaultTextDirection}},{key:"textDirectionAt",value:function t(n){var i;return!this.state.facet(an)||n<this.viewport.from||n>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(n))}},{key:"lineWrapping",get:function t(){return this.viewState.heightOracle.lineWrapping}},{key:"bidiSpans",value:function t(n){var i,e,r,u,o;if(n.length>$i)return rv(n.length);i=this.textDirectionAt(n.from),e=ic(this.bidiCache);try{for(e.s();!(r=e.n()).done;)if((u=r.value).from==n.from&&u.dir==i)return u.order}catch(t){e.e(t)}finally{e.f()}return o=ev(n.text,i),this.bidiCache.push(new Gi(n.from,n.to,i,o)),o}},{key:"hasFocus",get:function t(){var n;return(this.dom.ownerDocument.hasFocus()||Ft.safari&&(null===(n=this.inputState)||void 0===n?void 0:n.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}},{key:"focus",value:function t(){var n=this;this.observer.ignore((function(){Dl(n.contentDOM),n.docView.updateSelection()}))}},{key:"setRoot",value:function t(n){this.Nkt!=n&&(this.Nkt=n,this.observer.setWindow((9==n.nodeType?n:n.ownerDocument).defaultView||window),this.mountStyles())}},{key:"destroy",value:function t(){var n,i,e=ic(this.plugins);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy(this)}catch(t){e.e(t)}finally{e.f()}this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}}],[{key:"scrollIntoView",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return vn.of(new ln("number"==typeof n?m.cursor(n):n,i.y,i.x,i.yMargin,i.xMargin))}},{key:"domEventHandlers",value:function t(n){return kn.define((function(){return{}}),{eventHandlers:n})}},{key:"theme",value:function t(n,i){var e=at.newName(),r=[ji.of(e),Sn.of(ud(".".concat(e),n))];return i&&i.dark&&r.push(Ti.of(!0)),r}},{key:"baseTheme",value:function t(n){return E.lowest(Sn.of(ud("."+Bi,n,Pi)))}},{key:"findFromDOM",value:function t(n){var i,e=n.querySelector(".cm-content"),r=e&&Ot.get(e)||Ot.get(n);return(null===(i=null==r?void 0:r.rootView)||void 0===i?void 0:i.view)||null}}]),t}(),Ui.styleModule=Sn,Ui.inputHandler=hn,Ui.focusChangeEffect=fn,Ui.perLineTextDirection=an,Ui.exceptionSink=on,Ui.updateListener=sn,Ui.editable=dn,Ui.mouseSelectionStyle=un,Ui.dragMovesSelection=rn,Ui.clickAddsSelectionRange=en,Ui.decorations=bn,Ui.atomicRanges=Mn,Ui.scrollMargins=xn,Ui.darkTheme=Ti,Ui.contentAttributes=wn,Ui.editorAttributes=gn,Ui.lineWrapping=Ui.contentAttributes.of({class:"cm-lineWrapping"}),Ui.announce=U.define(),$i=4096,qi={},Gi=function(){function t(n,i,e,r){yc(this,t),this.from=n,this.to=i,this.dir=e,this.order=r}return kc(t,null,[{key:"update",value:function n(i,e){var r,u,o,s;if(e.empty)return i;for(r=[],u=i.length?i[i.length-1].dir:An.LTR,o=Math.max(0,i.length-10);o<i.length;o++)(s=i[o]).dir!=u||e.touchesRange(s.from,s.to)||r.push(new t(e.mapPos(s.from,1),e.mapPos(s.to,-1),s.dir,s.order));return r}}]),t}(),Ji=Ft.mac?"mac":Ft.windows?"win":Ft.linux?"linux":"key",Ki=E.default(Ui.domEventHandlers({keydown:function t(n,i){return md(yd(i.state),n,i,"editor")}})),Qi=w.define({enables:Ki}),Xi=new WeakMap,Zi=null,Yi=4e3,te=function(){function t(n,i,e,r,u){yc(this,t),this.className=n,this.left=i,this.top=e,this.width=r,this.height=u}return kc(t,[{key:"draw",value:function t(){var n=document.createElement("div");return n.className=this.className,this.adjust(n),n}},{key:"update",value:function t(n,i){return i.className==this.className&&(this.adjust(n),!0)}},{key:"adjust",value:function t(n){n.style.left=this.left+"px",n.style.top=this.top+"px",null!=this.width&&(n.style.width=this.width+"px"),n.style.height=this.height+"px"}},{key:"eq",value:function t(n){return this.left==n.left&&this.top==n.top&&this.width==n.width&&this.height==n.height&&this.className==n.className}}],[{key:"forRange",value:function n(i,e,r){var u,o;return r.empty?(u=i.coordsAtPos(r.head,r.assoc||1))?(o=gd(i),[new t(e,u.left-o.left,u.top-o.top,null,u.bottom-u.top)]):[]:Md(i,e,r)}}]),t}(),ne=function(){function t(n,i){yc(this,t),this.view=n,this.layer=i,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=n.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),i.above&&this.dom.classList.add("cm-layer-above"),i.class&&this.dom.classList.add(i.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(n.state),n.requestMeasure(this.measureReq),i.mount&&i.mount(this.dom,n)}return kc(t,[{key:"update",value:function t(n){n.startState.facet(ie)!=n.state.facet(ie)&&this.setOrder(n.state),(this.layer.update(n,this.dom)||n.geometryChanged)&&n.view.requestMeasure(this.measureReq)}},{key:"setOrder",value:function t(n){for(var i=0,e=n.facet(ie);i<e.length&&e[i]!=this.layer;)i++;this.dom.style.zIndex=String((this.layer.above?150:-1)-i)}},{key:"measure",value:function t(){return this.layer.markers(this.view)}},{key:"draw",value:function t(n){var i,e,r,u,o,s,h=this;if(n.length!=this.drawn.length||n.some((function(t,n){return!xd(t,h.drawn[n])}))){i=this.dom.firstChild,e=0,r=ic(n);try{for(r.s();!(u=r.n()).done;)(o=u.value).update&&i&&o.constructor&&this.drawn[e].constructor&&o.update(i,this.drawn[e])?(i=i.nextSibling,e++):this.dom.insertBefore(o.draw(),i)}catch(t){r.e(t)}finally{r.f()}for(;i;)s=i.nextSibling,i.remove(),i=s;this.drawn=n}}},{key:"destroy",value:function t(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}]),t}(),ie=w.define(),ee=!Ft.ios,re=w.define({combine:function t(n){return il(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:function t(n,i){return Math.min(n,i)},drawRangeCursor:function t(n,i){return n||i}})}}),ue=Sd({above:!0,markers:function t(n){var i,e,r,u,o,s,h,f,a=n.state,c=a.facet(re),l=[],v=ic(a.selection.ranges);try{for(v.s();!(i=v.n()).done;)if(r=(e=i.value)==a.selection.main,e.empty?!r||ee:c.drawRangeCursor){u=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=e.empty?e:m.cursor(e.head,e.head>e.anchor?-1:1),s=ic(te.forRange(n,u,o));try{for(s.s();!(h=s.n()).done;)f=h.value,l.push(f)}catch(t){s.e(t)}finally{s.f()}}}catch(t){v.e(t)}finally{v.f()}return l},update:function t(n,i){n.transactions.some((function(t){return t.selection}))&&(i.style.animationName="cm-blink"==i.style.animationName?"cm-blink2":"cm-blink");var e=Od(n);return e&&Ad(n.state,i),n.docChanged||n.selectionSet||e},mount:function t(n,i){Ad(i.state,n)},class:"cm-cursorLayer"}),oe=Sd({above:!1,markers:function t(n){return n.state.selection.ranges.map((function(t){return t.empty?[]:te.forRange(n,"cm-selectionBackground",t)})).reduce((function(t,n){return t.concat(n)}))},update:function t(n,i){return n.docChanged||n.selectionSet||n.viewportChanged||Od(n)},class:"cm-selectionLayer"}),se={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}},ee&&(se[".cm-line"].caretColor="transparent !important"),he=E.highest(Ui.theme(se)),fe=U.define({map:function t(n,i){return null==n?null:i.mapPos(n)}}),ae=x.define({create:function t(){return null},update:function t(n,i){return null!=n&&(n=i.changes.mapPos(n)),i.effects.reduce((function(t,n){return n.is(fe)?n.value:t}),n)}}),ce=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}return kc(t,[{key:"update",value:function t(n){var i,e=n.state.field(ae);null==e?null!=this.cursor&&(null===(i=this.cursor)||void 0===i||i.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(ae)!=e||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}},{key:"readPos",value:function t(){var n,i=this.view.state.field(ae),e=null!=i&&this.view.coordsAtPos(i);return e?(n=this.view.scrollDOM.getBoundingClientRect(),{left:e.left-n.left+this.view.scrollDOM.scrollLeft,top:e.top-n.top+this.view.scrollDOM.scrollTop,height:e.bottom-e.top}):null}},{key:"drawCursor",value:function t(n){this.cursor&&(n?(this.cursor.style.left=n.left+"px",this.cursor.style.top=n.top+"px",this.cursor.style.height=n.height+"px"):this.cursor.style.left="-100000px")}},{key:"destroy",value:function t(){this.cursor&&this.cursor.remove()}},{key:"setDropPos",value:function t(n){this.view.state.field(ae)!=n&&this.view.dispatch({effects:fe.of(n)})}}]),t}(),{eventHandlers:{dragover:function t(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave:function t(n){n.target!=this.view.contentDOM&&this.view.contentDOM.contains(n.relatedTarget)||this.setDropPos(null)},dragend:function t(){this.setDropPos(null)},drop:function t(){this.setDropPos(null)}}}),le=function(){function t(n){yc(this,t);var i=n.regexp,e=n.decoration,r=n.decorate,u=n.boundary,o=n.maxLength,s=void 0===o?1e3:o;if(!i.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=i,r)this.addMatch=function(t,n,i,e){return r(e,i,i+t[0].length,t,n)};else if("function"==typeof e)this.addMatch=function(t,n,i,r){var u=e(t,n,i);u&&r(i,i+t[0].length,u)};else{if(!e)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=function(t,n,i,r){return r(i,i+t[0].length,e)}}this.boundary=u,this.maxLength=s}return kc(t,[{key:"createDeco",value:function t(n){var i,e,r,u,o=this,s=new nt,h=s.add.bind(s),f=ic(Id(n,this.maxLength));try{for(f.s();!(i=f.n()).done;)r=(e=i.value).from,u=e.to,Ed(n.state.doc,this.regexp,r,u,(function(t,i){return o.addMatch(i,n,t,h)}))}catch(t){f.e(t)}finally{f.f()}return s.finish()}},{key:"updateDeco",value:function t(n,i){var e=1e9,r=-1;return n.docChanged&&n.changes.iterChanges((function(t,i,u,o){o>n.view.viewport.from&&u<n.view.viewport.to&&(e=Math.min(u,e),r=Math.max(o,r))})),n.viewportChanged||r-e>1e3?this.createDeco(n.view):r>-1?this.updateRange(n.view,i.map(n.changes),e,r):i}},{key:"updateRange",value:function t(n,i,e,r){var u,o,s=this,h=ic(n.visibleRanges);try{for(o=function t(){var o,h,f,a,c,l,v,d=u.value,y=Math.max(d.from,e),p=Math.min(d.to,r);if(p>y){if(h=(o=n.state.doc.lineAt(y)).to<p?n.state.doc.lineAt(p):o,f=Math.max(d.from,o.from),a=Math.min(d.to,h.to),s.boundary){for(;y>o.from;y--)if(s.boundary.test(o.text[y-1-o.from])){f=y;break}for(;p<h.to;p++)if(s.boundary.test(h.text[p-h.from])){a=p;break}}if(c=[],v=function t(n,i,e){return c.push(e.range(n,i))},o==h)for(s.regexp.lastIndex=f-o.from;(l=s.regexp.exec(o.text))&&l.index<a-o.from;)s.addMatch(l,n,l.index+o.from,v);else Ed(n.state.doc,s.regexp,f,a,(function(t,i){return s.addMatch(i,n,t,v)}));i=i.update({filterFrom:f,filterTo:a,filter:function t(n,i){return n<f||i>a},add:c})}},h.s();!(u=h.n()).done;)o()}catch(t){h.e(t)}finally{h.f()}return i}}]),t}(),ve=null!=/x/.unicode?"gu":"g",de=new RegExp("[\0-\b\n-\x1f\x7f-\x9f\xad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]",ve),ye={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},pe=null,ke=w.define({combine:function t(n){var i=il(n,{render:null,specialChars:de,addSpecialChars:null});return(i.replaceTabs=!Rd())&&(i.specialChars=new RegExp("\t|"+i.specialChars.source,ve)),i.addSpecialChars&&(i.specialChars=new RegExp(i.specialChars.source+"|"+i.addSpecialChars.source,ve)),i}}),me=null,ge="\u2022",we=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).options=t,r.code=e,r}return kc(i,[{key:"eq",value:function t(n){return n.code==this.code}},{key:"toDOM",value:function t(n){var i,e=Td(this.code),r=n.state.phrase("Control character")+" "+(ye[this.code]||"0x"+this.code.toString(16)),u=this.options.render&&this.options.render(this.code,r,e);return u||((i=document.createElement("span")).textContent=e,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i)}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),be=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).width=t,e}return kc(i,[{key:"eq",value:function t(n){return n.width==this.width}},{key:"toDOM",value:function t(){var n=document.createElement("span");return n.textContent="\t",n.className="cm-tab",n.style.width=this.width+"px",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),Me=kn.fromClass(function(){function t(){yc(this,t),this.height=1e3,this.attrs={style:"padding-bottom: 1000px"}}return kc(t,[{key:"update",value:function t(n){var i=n.view,e=i.viewState.editorHeight-i.defaultLineHeight-i.documentPadding.top-.5;e!=this.height&&(this.height=e,this.attrs={style:"padding-bottom: ".concat(e,"px")})}}]),t}()),xe=Jt.line({class:"cm-activeLine"}),Se=kn.fromClass(function(){function t(n){yc(this,t),this.decorations=this.getDeco(n)}return kc(t,[{key:"update",value:function t(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,u=-1,o=[],s=ic(n.state.selection.ranges);try{for(s.s();!(i=s.n()).done;)e=i.value,(r=n.lineBlockAt(e.head)).from>u&&(o.push(xe.range(r.from)),u=r.from)}catch(t){s.e(t)}finally{s.f()}return Jt.set(o)}}]),t}(),{decorations:function t(n){return n.decorations}}),Ce=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).content=t,e}return kc(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild("string"==typeof this.content?document.createTextNode(this.content):this.content),"string"==typeof this.content?n.setAttribute("aria-label","placeholder "+this.content):n.setAttribute("aria-hidden","true"),n}},{key:"coordsAt",value:function t(n){var i,e,r,u=n.firstChild?gl(n.firstChild):[];return u.length?(i=window.getComputedStyle(n.parentNode),e=Sl(u[0],"rtl"!=i.direction),r=parseInt(i.lineHeight),e.bottom-e.top>1.5*r?{left:e.left,right:e.right,top:e.top,bottom:e.top+r}:e):null}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt),Oe=2e3,Ae={Alt:[18,function(t){return!!t.altKey}],Control:[17,function(t){return!!t.ctrlKey}],Shift:[16,function(t){return!!t.shiftKey}],Meta:[91,function(t){return!!t.metaKey}]},De={style:"cursor: crosshair"},Ee="-10000px",Ie=function(){function t(n,i,e){yc(this,t),this.facet=i,this.createTooltipView=e,this.input=n.state.facet(i),this.tooltips=this.input.filter((function(t){return t})),this.tooltipViews=this.tooltips.map(e)}return kc(t,[{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p=n.state.facet(this.facet),k=p.filter((function(t){return t}));if(p===this.input){e=ic(this.tooltipViews);try{for(e.s();!(r=e.n()).done;)(u=r.value).update&&u.update(n)}catch(t){e.e(t)}finally{e.f()}return!1}for(o=[],s=0;s<k.length;s++)if(f=-1,h=k[s]){for(a=0;a<this.tooltips.length;a++)(c=this.tooltips[a])&&c.create==h.create&&(f=a);f<0?o[s]=this.createTooltipView(h):(l=o[s]=this.tooltipViews[f]).update&&l.update(n)}v=ic(this.tooltipViews);try{for(v.s();!(d=v.n()).done;)y=d.value,o.indexOf(y)<0&&(y.dom.remove(),null===(i=y.destroy)||void 0===i||i.call(y))}catch(t){v.e(t)}finally{v.f()}return this.input=p,this.tooltips=k,this.tooltipViews=o,!0}}]),t}(),Re=w.define({combine:function t(n){var i,e,r;return{position:Ft.ios?"absolute":(null===(i=n.find((function(t){return t.position})))||void 0===i?void 0:i.position)||"fixed",parent:(null===(e=n.find((function(t){return t.parent})))||void 0===e?void 0:e.parent)||null,tooltipSpace:(null===(r=n.find((function(t){return t.tooltipSpace})))||void 0===r?void 0:r.tooltipSpace)||$d}}}),Le=new WeakMap,je=kn.fromClass(function(){function t(n){var i,e=this;yc(this,t),this.view=n,this.inView=!0,this.lastTransaction=0,this.measureTimeout=-1,i=n.state.facet(Re),this.position=i.position,this.parent=i.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Ie(n,_e,(function(t){return e.createTooltip(t)})),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((function(t){Date.now()>e.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&e.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}return kc(t,[{key:"createContainer",value:function t(){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}},{key:"observeIntersection",value:function t(){var n,i,e;if(this.intersectionObserver){this.intersectionObserver.disconnect(),n=ic(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)e=i.value,this.intersectionObserver.observe(e.dom)}catch(t){n.e(t)}finally{n.f()}}}},{key:"measureSoon",value:function t(){var n=this;this.measureTimeout<0&&(this.measureTimeout=setTimeout((function(){n.measureTimeout=-1,n.maybeMeasure()}),50))}},{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a;if(n.transactions.length&&(this.lastTransaction=Date.now()),(i=this.manager.update(n))&&this.observeIntersection(),e=i||n.geometryChanged,(r=n.state.facet(Re)).position!=this.position){this.position=r.position,u=ic(this.manager.tooltipViews);try{for(u.s();!(o=u.n()).done;)(s=o.value).dom.style.position=this.position}catch(t){u.e(t)}finally{u.f()}e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer(),h=ic(this.manager.tooltipViews);try{for(h.s();!(f=h.n()).done;)a=f.value,this.container.appendChild(a.dom)}catch(t){h.e(t)}finally{h.f()}e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}},{key:"createTooltip",value:function t(n){var i,e=n.create(this.view);return e.dom.classList.add("cm-tooltip"),n.arrow&&!e.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")&&((i=document.createElement("div")).className="cm-tooltip-arrow",e.dom.appendChild(i)),e.dom.style.position=this.position,e.dom.style.top=Ee,this.container.appendChild(e.dom),e.mount&&e.mount(this.view),e}},{key:"destroy",value:function t(){var n,i,e,r,u;this.view.win.removeEventListener("resize",this.measureSoon),e=ic(this.manager.tooltipViews);try{for(e.s();!(r=e.n()).done;)(u=r.value).dom.remove(),null===(n=u.destroy)||void 0===n||n.call(u)}catch(t){e.e(t)}finally{e.f()}null===(i=this.intersectionObserver)||void 0===i||i.disconnect(),clearTimeout(this.measureTimeout)}},{key:"readMeasure",value:function t(){var n=this,i=this.view.dom.getBoundingClientRect();return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((function(t,i){var e=n.manager.tooltipViews[i];return e.getCoords?e.getCoords(t.pos):n.view.coordsAtPos(t.pos)})),size:this.manager.tooltipViews.map((function(t){var n;return t.dom.getBoundingClientRect()})),space:this.view.state.facet(Re).tooltipSpace(this.view)}}},{key:"writeMeasure",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x=n.editor,S=n.space,C=[];for(e=0;e<this.manager.tooltips.length;e++)if(r=this.manager.tooltips[e],o=(u=this.manager.tooltipViews[e]).dom,s=n.pos[e],h=n.size[e],!s||s.bottom<=Math.max(x.top,S.top)||s.top>=Math.min(x.bottom,S.bottom)||s.right<Math.max(x.left,S.left)-.1||s.left>Math.min(x.right,S.right)+.1)o.style.top=Ee;else{if(a=(f=r.arrow?u.dom.querySelector(".cm-tooltip-arrow"):null)?7:0,c=h.right-h.left,l=null!==(i=Le.get(u))&&void 0!==i?i:h.bottom-h.top,v=u.offset||Be,d=this.view.textDirection==An.LTR,y=h.width>S.right-S.left?d?S.left:S.right-h.width:d?Math.min(s.left-(f?14:0)+v.x,S.right-c):Math.max(S.left,s.left-c+(f?14:0)-v.x),p=!!r.above,!r.strictSide&&(p?s.top-(h.bottom-h.top)-v.y<S.top:s.bottom+(h.bottom-h.top)+v.y>S.bottom)&&p==S.bottom-s.bottom>s.top-S.top&&(p=!p),(k=(p?s.top-S.top:S.bottom-s.bottom)-a)<l&&!1!==u.resize){if(k<this.view.defaultLineHeight){o.style.top=Ee;continue}Le.set(u,l),o.style.height=(l=k)+"px"}else o.style.height&&(o.style.height="");if(m=p?s.top-l-a-v.y:s.bottom+a+v.y,g=y+c,!0!==u.overlap){w=ic(C);try{for(w.s();!(b=w.n()).done;)(M=b.value).left<g&&M.right>y&&M.top<m+l&&M.bottom>m&&(m=p?M.top-l-2-a:M.bottom+a+2)}catch(t){w.e(t)}finally{w.f()}}"absolute"==this.position?(o.style.top=m-n.parent.top+"px",o.style.left=y-n.parent.left+"px"):(o.style.top=m+"px",o.style.left=y+"px"),f&&(f.style.left="".concat(s.left+(d?v.x:-v.x)-(y+14-7),"px")),!0!==u.overlap&&C.push({left:y,top:m,right:g,bottom:m+l}),o.classList.toggle("cm-tooltip-above",p),o.classList.toggle("cm-tooltip-below",!p),u.positioned&&u.positioned(n.space)}}},{key:"maybeMeasure",value:function t(){var n,i,e;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))){n=ic(this.manager.tooltipViews);try{for(n.s();!(i=n.n()).done;)(e=i.value).dom.style.top=Ee}catch(t){n.e(t)}finally{n.f()}}}}]),t}(),{eventHandlers:{scroll:function t(){this.maybeMeasure()}}}),Te=Ui.baseTheme({".cm-tooltip":{zIndex:100,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:"".concat(7,"px"),width:"".concat(14,"px"),position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"".concat(7,"px solid transparent"),borderRight:"".concat(7,"px solid transparent")},".cm-tooltip-above &":{bottom:"-".concat(7,"px"),"&:before":{borderTop:"".concat(7,"px solid #bbb")},"&:after":{borderTop:"".concat(7,"px solid #f5f5f5"),bottom:"1px"}},".cm-tooltip-below &":{top:"-".concat(7,"px"),"&:before":{borderBottom:"".concat(7,"px solid #bbb")},"&:after":{borderBottom:"".concat(7,"px solid #f5f5f5"),top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Be={x:0,y:0},_e=w.define({enables:[je,Te]}),Ne=w.define(),Pe=function(){function t(n){var i=this;yc(this,t),this.view=n,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Ie(n,Ne,(function(t){return i.createHostedView(t)}))}return kc(t,[{key:"createHostedView",value:function t(n){var i=n.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(i.dom),this.mounted&&i.mount&&i.mount(this.view),i}},{key:"mount",value:function t(n){var i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)(e=i.value).mount&&e.mount(n)}catch(t){r.e(t)}finally{r.f()}this.mounted=!0}},{key:"positioned",value:function t(n){var i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)(e=i.value).positioned&&e.positioned(n)}catch(t){r.e(t)}finally{r.f()}}},{key:"update",value:function t(n){this.manager.update(n)}},{key:"destroy",value:function t(){var n,i,e,r=ic(this.manager.tooltipViews);try{for(r.s();!(i=r.n()).done;)null===(n=(e=i.value).destroy)||void 0===n||n.call(e)}catch(t){r.e(t)}finally{r.f()}}}],[{key:"create",value:function n(i){return new t(i)}}]),t}(),Fe=_e.compute([Ne],(function(t){var n=t.facet(Ne).filter((function(t){return t}));return 0===n.length?null:{pos:Math.min.apply(Math,Ja(n.map((function(t){return t.pos})))),end:Math.max.apply(Math,Ja(n.filter((function(t){return null!=t.end})).map((function(t){return t.end})))),create:Pe.create,above:n[0].above,arrow:n.some((function(t){return t.arrow}))}})),He=function(){function t(n,i,e,r,u){yc(this,t),this.view=n,this.source=i,this.field=e,this.setHover=r,this.hoverTime=u,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:n.dom,time:0},this.checkHover=this.checkHover.bind(this),n.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),n.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}return kc(t,[{key:"update",value:function t(){var n=this;this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((function(){return n.startHover()}),20))}},{key:"active",get:function t(){return this.view.state.field(this.field)}},{key:"checkHover",value:function t(){if(this.hoverTimeout=-1,!this.active){var n=Date.now()-this.lastMove.time;n<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-n):this.startHover()}}},{key:"startHover",value:function t(){var n,i,e,r,u,o,s,h=this;clearTimeout(this.restartTimeout),n=this.lastMove,null!=(i=this.view.contentDOM.contains(n.target)?this.view.posAtCoords(n):null)&&(null==(e=this.view.coordsAtPos(i))||n.y<e.top||n.y>e.bottom||n.x<e.left-this.view.defaultCharacterWidth||n.x>e.right+this.view.defaultCharacterWidth||(u=(r=this.view.bidiSpans(this.view.state.doc.lineAt(i)).find((function(t){return t.from<=i&&t.to>=i})))&&r.dir==An.RTL?-1:1,(null==(o=this.source(this.view,i,n.x<e.left?-u:u))?void 0:o.then)?(s=this.pending={pos:i},o.then((function(t){h.pending==s&&(h.pending=null,t&&h.view.dispatch({effects:h.setHover.of(t)}))}),(function(t){return Yl(h.view.state,t,"hover tooltip")}))):o&&this.view.dispatch({effects:this.setHover.of(o)})))}},{key:"mousemove",value:function t(n){var i,e,r,u,o;this.lastMove={x:n.clientX,y:n.clientY,target:n.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime)),((e=this.active)&&!qd(this.lastMove.target)||this.pending)&&(((u=(r=e||this.pending).pos)==(o=null!==(i=null==e?void 0:e.end)&&void 0!==i?i:u)?this.view.posAtCoords(this.lastMove)==u:Gd(this.view,u,o,n.clientX,n.clientY,6))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null))}},{key:"mouseleave",value:function t(n){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!qd(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}},{key:"destroy",value:function t(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}]),t}(),We=(ze=U.define()).of(null),Ve=w.define({combine:function t(n){var i,e,r,u,o=ic(n);try{for(o.s();!(r=o.n()).done;)u=r.value,i=i||u.topContainer,e=e||u.bottomContainer}catch(t){o.e(t)}finally{o.f()}return{topContainer:i,bottomContainer:e}}}),Ue=kn.fromClass(function(){function t(n){var i,e,r,u;yc(this,t),this.input=n.state.facet(qe),this.specs=this.input.filter((function(t){return t})),this.panels=this.specs.map((function(t){return t(n)})),i=n.state.facet(Ve),this.top=new $e(n,!0,i.topContainer),this.bottom=new $e(n,!1,i.bottomContainer),this.top.sync(this.panels.filter((function(t){return t.top}))),this.bottom.sync(this.panels.filter((function(t){return!t.top}))),e=ic(this.panels);try{for(e.s();!(r=e.n()).done;)(u=r.value).dom.classList.add("cm-panel"),u.mount&&u.mount()}catch(t){e.e(t)}finally{e.f()}}return kc(t,[{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g=n.state.facet(Ve);if(this.top.container!=g.topContainer&&(this.top.sync([]),this.top=new $e(n.view,!0,g.topContainer)),this.bottom.container!=g.bottomContainer&&(this.bottom.sync([]),this.bottom=new $e(n.view,!1,g.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses(),(i=n.state.facet(qe))!=this.input){r=[],u=[],o=[],s=[],h=ic(e=i.filter((function(t){return t})));try{for(h.s();!(f=h.n()).done;)a=f.value,c=this.specs.indexOf(a),l=void 0,c<0?(l=a(n.view),s.push(l)):(l=this.panels[c]).update&&l.update(n),r.push(l),(l.top?u:o).push(l)}catch(t){h.e(t)}finally{h.f()}for(this.specs=e,this.panels=r,this.top.sync(u),this.bottom.sync(o),v=0,d=s;v<d.length;v++)(y=d[v]).dom.classList.add("cm-panel"),y.mount&&y.mount()}else{p=ic(this.panels);try{for(p.s();!(k=p.n()).done;)(m=k.value).update&&m.update(n)}catch(t){p.e(t)}finally{p.f()}}}},{key:"destroy",value:function t(){this.top.sync([]),this.bottom.sync([])}}]),t}(),{provide:function t(n){return Ui.scrollMargins.of((function(t){var i=t.plugin(n);return i&&{top:i.top.scrollMargin(),bottom:i.bottom.scrollMargin()}}))}}),$e=function(){function t(n,i,e){yc(this,t),this.view=n,this.top=i,this.container=e,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}return kc(t,[{key:"sync",value:function t(n){var i,e,r=ic(this.panels);try{for(r.s();!(i=r.n()).done;)(e=i.value).destroy&&n.indexOf(e)<0&&e.destroy()}catch(t){r.e(t)}finally{r.f()}this.panels=n,this.syncDOM()}},{key:"syncDOM",value:function t(){var n,i,e,r,u;if(0!=this.panels.length){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",(n=this.container||this.view.dom).insertBefore(this.dom,this.top?n.firstChild:null)),i=this.dom.firstChild,e=ic(this.panels);try{for(e.s();!(r=e.n()).done;)if((u=r.value).dom.parentNode==this.dom){for(;i!=u.dom;)i=ty(i);i=i.nextSibling}else this.dom.insertBefore(u.dom,i)}catch(t){e.e(t)}finally{e.f()}for(;i;)i=ty(i)}else this.dom&&(this.dom.remove(),this.dom=void 0)}},{key:"scrollMargin",value:function t(){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)}},{key:"syncClasses",value:function t(){var n,i,e,r,u,o;if(this.container&&this.classes!=this.view.themeClasses){n=ic(this.classes.split(" "));try{for(n.s();!(i=n.n()).done;)(e=i.value)&&this.container.classList.remove(e)}catch(t){n.e(t)}finally{n.f()}r=ic((this.classes=this.view.themeClasses).split(" "));try{for(r.s();!(u=r.n()).done;)(o=u.value)&&this.container.classList.add(o)}catch(t){r.e(t)}finally{r.f()}}}}]),t}(),qe=w.define({enables:Ue}),Ge=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"compare",value:function t(n){return this==n||this.constructor==n.constructor&&this.eq(n)}},{key:"eq",value:function t(n){return!1}},{key:"destroy",value:function t(n){}}]),i}(X),Ge.prototype.elementClass="",Ge.prototype.toDOM=void 0,Ge.prototype.mapMode=v.TrackBefore,Ge.prototype.startSide=Ge.prototype.endSide=-1,Ge.prototype.point=!0,Je=w.define(),Ke={class:"",renderEmptyElements:!1,elementStyle:"",markers:function t(){return tt.empty},lineMarker:function t(){return null},widgetMarker:function t(){return null},lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Qe=w.define(),Xe=w.define({combine:function t(n){return n.some((function(t){return t}))}}),Ze=kn.fromClass(function(){function t(n){var i,e,r;yc(this,t),this.view=n,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight+"px",this.gutters=n.state.facet(Qe).map((function(t){return new tr(n,t)})),i=ic(this.gutters);try{for(i.s();!(e=i.n()).done;)r=e.value,this.dom.appendChild(r.dom)}catch(t){i.e(t)}finally{i.f()}this.fixed=!n.state.facet(Xe),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}return kc(t,[{key:"update",value:function t(n){var i,e,r;this.updateGutters(n)&&(i=this.prevViewport,e=n.view.viewport,r=Math.min(i.to,e.to)-Math.max(i.from,e.from),this.syncGutters(r<.8*(e.to-e.from))),n.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(Xe)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=n.view.viewport}},{key:"syncGutters",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S=this,C=this.dom.nextSibling;n&&this.dom.remove(),i=tt.iter(this.view.state.facet(Je),this.view.viewport.from),e=[],r=this.gutters.map((function(t){return new Ye(t,S.view.viewport,-S.view.documentPadding.top)})),u=ic(this.view.viewportLineBlocks);try{for(u.s();!(o=u.n()).done;)if(s=o.value,e.length&&(e=[]),Array.isArray(s.type)){h=!0,f=ic(s.type);try{for(f.s();!(a=f.n()).done;)if((c=a.value).type==Gt.Text&&h){ry(i,e,c.from),l=ic(r);try{for(l.s();!(v=l.n()).done;)(d=v.value).line(this.view,c,e)}catch(t){l.e(t)}finally{l.f()}h=!1}else if(c.widget){y=ic(r);try{for(y.s();!(p=y.n()).done;)(k=p.value).widget(this.view,c)}catch(t){y.e(t)}finally{y.f()}}}catch(t){f.e(t)}finally{f.f()}}else if(s.type==Gt.Text){ry(i,e,s.from),m=ic(r);try{for(m.s();!(g=m.n()).done;)(w=g.value).line(this.view,s,e)}catch(t){m.e(t)}finally{m.f()}}}catch(t){u.e(t)}finally{u.f()}b=ic(r);try{for(b.s();!(M=b.n()).done;)(x=M.value).finish()}catch(t){b.e(t)}finally{b.f()}n&&this.view.scrollDOM.insertBefore(this.dom,C)}},{key:"updateGutters",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p=n.startState.facet(Qe),k=n.state.facet(Qe),m=n.docChanged||n.heightChanged||n.viewportChanged||!tt.eq(n.startState.facet(Je),n.state.facet(Je),n.view.viewport.from,n.view.viewport.to);if(p==k){i=ic(this.gutters);try{for(i.s();!(e=i.n()).done;)(r=e.value).update(n)&&(m=!0)}catch(t){i.e(t)}finally{i.f()}}else{m=!0,u=[],o=ic(k);try{for(o.s();!(s=o.n()).done;)h=s.value,(f=p.indexOf(h))<0?u.push(new tr(this.view,h)):(this.gutters[f].update(n),u.push(this.gutters[f]))}catch(t){o.e(t)}finally{o.f()}a=ic(this.gutters);try{for(a.s();!(c=a.n()).done;)(l=c.value).dom.remove(),u.indexOf(l)<0&&l.destroy()}catch(t){a.e(t)}finally{a.f()}for(v=0,d=u;v<d.length;v++)y=d[v],this.dom.appendChild(y.dom);this.gutters=u}return m}},{key:"destroy",value:function t(){var n,i,e=ic(this.gutters);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy()}catch(t){e.e(t)}finally{e.f()}this.dom.remove()}}]),t}(),{provide:function t(n){return Ui.scrollMargins.of((function(t){var i=t.plugin(n);return i&&0!=i.gutters.length&&i.fixed?t.textDirection==An.LTR?{left:i.dom.offsetWidth}:{right:i.dom.offsetWidth}:null}))}}),Ye=function(){function t(n,i,e){yc(this,t),this.gutter=n,this.height=e,this.i=0,this.cursor=tt.iter(n.markers,i.from)}return kc(t,[{key:"addElement",value:function t(n,i,e){var r,u=this.gutter,o=i.top-this.height;this.i==u.elements.length?(r=new nr(n,i.height,o,e),u.elements.push(r),u.dom.appendChild(r.dom)):u.elements[this.i].update(n,i.height,o,e),this.height=i.bottom,this.i++}},{key:"line",value:function t(n,i,e){var r,u,o=[];ry(this.cursor,o,i.from),e.length&&(o=o.concat(e)),(r=this.gutter.config.lineMarker(n,i,o))&&o.unshift(r),u=this.gutter,(0!=o.length||u.config.renderEmptyElements)&&this.addElement(n,i,o)}},{key:"widget",value:function t(n,i){var e=this.gutter.config.widgetMarker(n,i.widget,i);e&&this.addElement(n,i,[e])}},{key:"finish",value:function t(){for(var n,i=this.gutter;i.elements.length>this.i;)n=i.elements.pop(),i.dom.removeChild(n.dom),n.destroy()}}]),t}(),tr=function(){function t(n,i){var e,r,u=this;for(r in yc(this,t),this.view=n,this.config=i,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:""),e=function t(e){u.dom.addEventListener(e,(function(t){var r,o,s,h=t.target;if(h!=u.dom&&u.dom.contains(h)){for(;h.parentNode!=u.dom;)h=h.parentNode;r=((o=h.getBoundingClientRect()).top+o.bottom)/2}else r=t.clientY;s=n.lineBlockAtHeight(r-n.documentTop),i.domEventHandlers[e](n,s,t)&&t.preventDefault()}))},i.domEventHandlers)e(r);this.markers=ey(i.markers(n)),i.initialSpacer&&(this.spacer=new nr(n,0,0,[i.initialSpacer(n)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}return kc(t,[{key:"update",value:function t(n){var i,e,r=this.markers;return this.markers=ey(this.config.markers(n.view)),this.spacer&&this.config.updateSpacer&&(i=this.config.updateSpacer(this.spacer.markers[0],n))!=this.spacer.markers[0]&&this.spacer.update(n.view,0,0,[i]),e=n.view.viewport,!tt.eq(this.markers,r,e.from,e.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(n)}},{key:"destroy",value:function t(){var n,i,e=ic(this.elements);try{for(e.s();!(n=e.n()).done;)(i=n.value).destroy()}catch(t){e.e(t)}finally{e.f()}}}]),t}(),nr=function(){function t(n,i,e,r){yc(this,t),this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(n,i,e,r)}return kc(t,[{key:"update",value:function t(n,i,e,r){this.height!=i&&(this.dom.style.height=(this.height=i)+"px"),this.above!=e&&(this.dom.style.marginTop=(this.above=e)?e+"px":""),uy(this.markers,r)||this.setMarkers(n,r)}},{key:"setMarkers",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l="cm-gutterElement",v=this.dom.firstChild;for(e=0,r=0;;){if(u=r,s=!1,o=e<i.length?i[e++]:null){for((h=o.elementClass)&&(l+=" "+h),f=r;f<this.markers.length;f++)if(this.markers[f].compare(o)){u=f,s=!0;break}}else u=this.markers.length;for(;r<u;)(a=this.markers[r++]).toDOM&&(a.destroy(v),c=v.nextSibling,v.remove(),v=c);if(!o)break;o.toDOM&&(s?v=v.nextSibling:this.dom.insertBefore(o.toDOM(n),v)),s&&r++}this.dom.className=l,this.markers=i}},{key:"destroy",value:function t(){this.setMarkers(null,[])}}]),t}(),ir=w.define(),er=w.define({combine:function t(n){return il(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers:function t(n,i){var e,r=Object.assign({},n),u=function t(){var n=r[e],u=i[e];r[e]=n?function(t,i,e){return n(t,i,e)||u(t,i,e)}:u};for(e in i)u();return r}})}}),rr=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).number=t,e}return kc(i,[{key:"eq",value:function t(n){return this.number==n.number}},{key:"toDOM",value:function t(){return document.createTextNode(this.number)}}]),i}(Ge),ur=Qe.compute([er],(function(t){return{class:"cm-lineNumbers",renderEmptyElements:!1,markers:function t(n){return n.state.facet(ir)},lineMarker:function t(n,i,e){return e.some((function(t){return t.toDOM}))?null:new rr(oy(n,n.state.doc.lineAt(i.from).number))},widgetMarker:function t(){return null},lineMarkerChange:function t(n){return n.startState.facet(er)!=n.state.facet(er)},initialSpacer:function t(n){return new rr(oy(n,hy(n.state.doc.lines)))},updateSpacer:function t(n,i){var e=oy(i.view,hy(i.view.state.doc.lines));return e==n.number?n:new rr(e)},domEventHandlers:t.facet(er).domEventHandlers}})),or=new(function(t){sc(i,t);var n=fc(i);function i(){var t;return yc(this,i),(t=n.apply(this,arguments)).elementClass="cm-activeLineGutter",t}return kc(i)}(Ge)),sr=Je.compute(["selection"],(function(t){var n,i,e,r=[],u=-1,o=ic(t.selection.ranges);try{for(o.s();!(n=o.n()).done;)i=n.value,(e=t.doc.lineAt(i.head).from)>u&&(u=e,r.push(or.range(e)))}catch(t){o.e(t)}finally{o.f()}return tt.of(r)})),hr=new Map,fr=cy(new le({regexp:/\t| +/g,decoration:function t(n){return ay(n[0])},boundary:/\S/})),ar=cy(new le({regexp:/\s+$/g,decoration:Jt.mark({class:"cm-trailingSpace"}),boundary:/\S/})),cr={HeightMap:gi,HeightOracle:di,MeasuredHeights:yi,QueryType:ki,ChangedRange:Cn,computeOrder:ev,moveVisually:uv},lr=n.View=Object.freeze({__proto__:null,BidiSpan:Hn,BlockInfo:pi,get BlockType(){return Gt},Decoration:Jt,get Direction(){return An},EditorView:Ui,GutterMarker:Ge,MatchDecorator:le,RectangleMarker:te,ViewPlugin:kn,ViewUpdate:On,WidgetType:qt,qde:cr,closeHoverTooltips:We,crosshairCursor:Vd,drawSelection:Cd,dropCursor:Dd,getPanel:Yd,getTooltip:Kd,gutter:ny,gutterLineClass:Je,gutters:iy,hasHoverTooltips:Qd,highlightActiveLine:_d,highlightActiveLineGutter:fy,highlightSpecialChars:Ld,highlightTrailingWhitespace:vy,highlightWhitespace:ly,hoverTooltip:Jd,keymap:Qi,layer:Sd,lineNumberMarkers:ir,lineNumbers:sy,logException:Yl,panels:Zd,placeholder:Nd,rectangularSelection:Wd,repositionTooltips:Xd,runScopeHandlers:pd,scrollPastEnd:Bd,showPanel:qe,showTooltip:_e,tooltips:Ud}),vr=1024,dr=0,yr=kc((function t(n,i){yc(this,t),this.from=n,this.to=i})),pr=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};yc(this,t),this.id=dr++,this.perNode=!!n.perNode,this.deserialize=n.deserialize||function(){throw new Error("This node type doesn't define a deserialize function")}}return kc(t,[{key:"add",value:function t(n){var i=this;if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof n&&(n=mr.match(n)),function(t){var e=n(t);return void 0===e?null:[i,e]}}}]),t}(),pr.closedBy=new pr({deserialize:function t(n){return n.split(" ")}}),pr.openedBy=new pr({deserialize:function t(n){return n.split(" ")}}),pr.group=new pr({deserialize:function t(n){return n.split(" ")}}),pr.contextHash=new pr({perNode:!0}),pr.lookAhead=new pr({perNode:!0}),pr.mounted=new pr({perNode:!0}),kr=Object.create(null),mr=function(){function t(n,i,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;yc(this,t),this.name=n,this.props=i,this.id=e,this.flags=r}return kc(t,[{key:"prop",value:function t(n){return this.props[n.id]}},{key:"isTop",get:function t(){return(1&this.flags)>0}},{key:"isSkipped",get:function t(){return(2&this.flags)>0}},{key:"isError",get:function t(){return(4&this.flags)>0}},{key:"isAnonymous",get:function t(){return(8&this.flags)>0}},{key:"is",value:function t(n){if("string"==typeof n){if(this.name==n)return!0;var i=this.prop(pr.group);return!!i&&i.indexOf(n)>-1}return this.id==n}}],[{key:"define",value:function n(i){var e,r,u,o=i.props&&i.props.length?Object.create(null):kr,s=(i.top?1:0)|(i.skipped?2:0)|(i.error?4:0)|(null==i.name?8:0),h=new t(i.name||"",o,i.id,s);if(i.props){e=ic(i.props);try{for(e.s();!(r=e.n()).done;)if(u=r.value,Array.isArray(u)||(u=u(h)),u){if(u[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");o[u[0].id]=u[1]}}catch(t){e.e(t)}finally{e.f()}}return h}},{key:"match",value:function t(n){var i,e,r,u,o=Object.create(null);for(i in n){e=ic(i.split(" "));try{for(e.s();!(r=e.n()).done;)u=r.value,o[u]=n[i]}catch(t){e.e(t)}finally{e.f()}}return function(t){var n,i,e;for(n=t.prop(pr.group),i=-1;i<(n?n.length:0);i++)if(e=o[i<0?t.name:n[i]])return e}}}]),t}(),mr.none=new mr("",Object.create(null),0,8),gr=function(){function t(n){yc(this,t),this.types=n;for(var i=0;i<n.length;i++)if(n[i].id!=i)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}return kc(t,[{key:"extend",value:function n(){var i,e,r,u,o,s,h,f,a,c,l,v=[];for(i=arguments.length,e=new Array(i),r=0;r<i;r++)e[r]=arguments[r];u=ic(this.types);try{for(u.s();!(o=u.n()).done;){s=o.value,h=null,f=ic(e);try{for(f.s();!(a=f.n()).done;)(l=(c=a.value)(s))&&(h||(h=Object.assign({},s.props)),h[l[0].id]=l[1])}catch(t){f.e(t)}finally{f.f()}v.push(h?new mr(s.name,h,s.id,s.flags):s)}}catch(t){u.e(t)}finally{u.f()}return new t(v)}}]),t}(),wr=new WeakMap,br=new WeakMap,function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"}(Mr||(Mr={})),xr=function(){function t(n,i,e,r,u){var o,s,h,f,a;if(yc(this,t),this.type=n,this.children=i,this.positions=e,this.length=r,this.props=null,u&&u.length){this.props=Object.create(null),o=ic(u);try{for(o.s();!(s=o.n()).done;)f=(h=Za(s.value,2))[0],a=h[1],this.props["number"==typeof f?f:f.id]=a}catch(t){o.e(t)}finally{o.f()}}}return kc(t,[{key:"toString",value:function t(){var n,i,e,r,u,o=this.prop(pr.mounted);if(o&&!o.overlay)return o.tree.toString();n="",i=ic(this.children);try{for(i.s();!(e=i.n()).done;)(u=(r=e.value).toString())&&(n&&(n+=","),n+=u)}catch(t){i.e(t)}finally{i.f()}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}},{key:"cursor",value:function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return new Er(this.topNode,n)}},{key:"cursorAt",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=wr.get(this)||this.topNode,u=new Er(r);return u.moveTo(n,i),wr.set(this,u.oMi),u}},{key:"topNode",get:function t(){return new Or(this,0,0,null)}},{key:"resolve",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=py(wr.get(this)||this.topNode,n,i,!1);return wr.set(this,e),e}},{key:"resolveInner",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=py(br.get(this)||this.topNode,n,i,!0);return br.set(this,e),e}},{key:"iterate",value:function t(n){var i,e,r=n.enter,u=n.leave,o=n.from,s=void 0===o?0:o,h=n.to,f=void 0===h?this.length:h,a=n.mode||0,c=(a&Mr.IncludeAnonymous)>0;for(i=this.cursor(a|Mr.IncludeAnonymous);;){if(e=!1,i.from<=f&&i.to>=s&&(!c&&i.type.isAnonymous||!1!==r(i))){if(i.firstChild())continue;e=!0}for(;e&&u&&(c||!i.type.isAnonymous)&&u(i),!i.nextSibling();){if(!i.parent())return;e=!0}}}},{key:"prop",value:function t(n){return n.perNode?this.props?this.props[n.id]:void 0:this.type.prop(n)}},{key:"propValues",get:function t(){var n,i=[];if(this.props)for(n in this.props)i.push([+n,this.props[n]]);return i}},{key:"balance",value:function n(){var i=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this.children.length<=8?this:My(mr.none,this.children,this.positions,0,this.children.length,0,this.length,(function(n,e,r){return new t(i.type,n,e,r,i.propValues)}),e.makeTree||function(n,i,e){return new t(mr.none,n,i,e)})}}],[{key:"build",value:function t(n){return wy(n)}}]),t}(),xr.empty=new xr(mr.none,[],[],0),Sr=function(){function t(n,i){yc(this,t),this.buffer=n,this.index=i}return kc(t,[{key:"id",get:function t(){return this.buffer[this.index-4]}},{key:"start",get:function t(){return this.buffer[this.index-3]}},{key:"end",get:function t(){return this.buffer[this.index-2]}},{key:"size",get:function t(){return this.buffer[this.index-1]}},{key:"pos",get:function t(){return this.index}},{key:"next",value:function t(){this.index-=4}},{key:"fork",value:function n(){return new t(this.buffer,this.index)}}]),t}(),Cr=function(){function t(n,i,e){yc(this,t),this.buffer=n,this.length=i,this.set=e}return kc(t,[{key:"type",get:function t(){return mr.none}},{key:"toString",value:function t(){var n,i=[];for(n=0;n<this.buffer.length;)i.push(this.childString(n)),n=this.buffer[n+3];return i.join(",")}},{key:"childString",value:function t(n){var i,e=this.buffer[n],r=this.buffer[n+3],u=this.set.types[e],o=u.name;if(/\W/.test(o)&&!u.isError&&(o=JSON.stringify(o)),r==(n+=4))return o;for(i=[];n<r;)i.push(this.childString(n)),n=this.buffer[n+3];return o+"("+i.join(",")+")"}},{key:"findChild",value:function t(n,i,e,r,u){var o,s=this.buffer,h=-1;for(o=n;o!=i&&!(dy(u,r,s[o+1],s[o+2])&&(h=o,e>0));o=s[o+3]);return h}},{key:"slice",value:function n(i,e,r){var u,o,s,h=this.buffer,f=new Uint16Array(e-i),a=0;for(u=i,o=0;u<e;)f[o++]=h[u++],f[o++]=h[u++]-r,s=f[o++]=h[u++]-r,f[o++]=h[u++]-i,a=Math.max(a,s);return new t(f,a,this.set)}}]),t}(),Or=function(){function t(n,i,e,r){yc(this,t),this.oMi=n,this.from=i,this.index=e,this.sft=r}return kc(t,[{key:"type",get:function t(){return this.oMi.type}},{key:"name",get:function t(){return this.oMi.type.name}},{key:"to",get:function t(){return this.from+this.oMi.length}},{key:"nextChild",value:function n(i,e,r,u){var o,s,h,f,a,c,l,v,d,y,p=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;for(o=this;;){for(h=(s=o.oMi).children,f=s.positions,a=e>0?h.length:-1;i!=a;i+=e)if(c=h[i],dy(u,r,l=f[i]+o.from,l+c.length))if(c instanceof Cr){if(p&Mr.ExcludeBuffers)continue;if((v=c.findChild(0,c.buffer.length,e,r-l,u))>-1)return new Dr(new Ar(o,c,i,l),null,v)}else if(p&Mr.IncludeAnonymous||!c.type.isAnonymous||gy(c))return d=void 0,p&Mr.IgnoreMounts||!c.props||!(d=c.prop(pr.mounted))||d.overlay?(y=new t(c,l,i,o),p&Mr.IncludeAnonymous||!y.type.isAnonymous?y:y.nextChild(e<0?c.children.length-1:0,e,r,u)):new t(d.tree,l,i,o);if(p&Mr.IncludeAnonymous||!o.type.isAnonymous)return null;if(i=o.index>=0?o.index+e:e<0?-1:o.sft.oMi.children.length,!(o=o.sft))return null}}},{key:"firstChild",get:function t(){return this.nextChild(0,1,0,4)}},{key:"lastChild",get:function t(){return this.nextChild(this.oMi.children.length-1,-1,0,4)}},{key:"childAfter",value:function t(n){return this.nextChild(0,1,n,2)}},{key:"childBefore",value:function t(n){return this.nextChild(this.oMi.children.length-1,-1,n,-2)}},{key:"enter",value:function n(i,e){var r,u,o,s,h,f,a,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!(c&Mr.IgnoreOverlays)&&(r=this.oMi.prop(pr.mounted))&&r.overlay){u=i-this.from,o=ic(r.overlay);try{for(o.s();!(s=o.n()).done;)if(f=(h=s.value).from,a=h.to,(e>0?f<=u:f<u)&&(e<0?a>=u:a>u))return new t(r.tree,r.overlay[0].from+this.from,-1,this)}catch(t){o.e(t)}finally{o.f()}}return this.nextChild(0,1,i,e,c)}},{key:"nextSignificantParent",value:function t(){for(var n=this;n.type.isAnonymous&&n.sft;)n=n.sft;return n}},{key:"parent",get:function t(){return this.sft?this.sft.nextSignificantParent():null}},{key:"nextSibling",get:function t(){return this.sft&&this.index>=0?this.sft.nextChild(this.index+1,1,0,4):null}},{key:"prevSibling",get:function t(){return this.sft&&this.index>=0?this.sft.nextChild(this.index-1,-1,0,4):null}},{key:"cursor",value:function t(){var n;return new Er(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return this.oMi}},{key:"toTree",value:function t(){return this.oMi}},{key:"resolve",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return yy(this,n)}},{key:"getChild",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=ky(this,n,i,e);return r.length?r[0]:null}},{key:"getChildren",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return ky(this,n,i,e)}},{key:"toString",value:function t(){return this.oMi.toString()}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return my(this,n)}}]),t}(),Ar=kc((function t(n,i,e,r){yc(this,t),this.parent=n,this.buffer=i,this.index=e,this.start=r})),Dr=function(){function t(n,i,e){yc(this,t),this.context=n,this.sft=i,this.index=e,this.type=n.buffer.set.types[n.buffer.buffer[e]]}return kc(t,[{key:"name",get:function t(){return this.type.name}},{key:"from",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+1]}},{key:"to",get:function t(){return this.context.start+this.context.buffer.buffer[this.index+2]}},{key:"child",value:function n(i,e,r){var u=this.context.buffer,o=u.findChild(this.index+4,u.buffer[this.index+3],i,e-this.context.start,r);return o<0?null:new t(this.context,this,o)}},{key:"firstChild",get:function t(){return this.child(1,0,4)}},{key:"lastChild",get:function t(){return this.child(-1,0,4)}},{key:"childAfter",value:function t(n){return this.child(1,n,2)}},{key:"childBefore",value:function t(n){return this.child(-1,n,-2)}},{key:"enter",value:function n(i,e){var r,u,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return o&Mr.ExcludeBuffers||(u=(r=this.context.buffer).findChild(this.index+4,r.buffer[this.index+3],e>0?1:-1,i-this.context.start,e))<0?null:new t(this.context,this,u)}},{key:"parent",get:function t(){return this.sft||this.context.parent.nextSignificantParent()}},{key:"externalSibling",value:function t(n){return this.sft?null:this.context.parent.nextChild(this.context.index+n,n,0,4)}},{key:"nextSibling",get:function n(){var i=this.context.buffer,e=i.buffer[this.index+3];return e<(this.sft?i.buffer[this.sft.index+3]:i.buffer.length)?new t(this.context,this.sft,e):this.externalSibling(1)}},{key:"prevSibling",get:function n(){var i=this.context.buffer,e=this.sft?this.sft.index+4:0;return this.index==e?this.externalSibling(-1):new t(this.context,this.sft,i.findChild(e,this.index,-1,0,4))}},{key:"cursor",value:function t(){var n;return new Er(this,arguments.length>0&&void 0!==arguments[0]?arguments[0]:0)}},{key:"tree",get:function t(){return null}},{key:"toTree",value:function t(){var n,i=[],e=[],r=this.context.buffer,u=this.index+4,o=r.buffer[this.index+3];return o>u&&(n=r.buffer[this.index+1],i.push(r.slice(u,o,n)),e.push(0)),new xr(this.type,i,e,this.to-this.from)}},{key:"resolve",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!1)}},{key:"resolveInner",value:function t(n){var i;return py(this,n,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,!0)}},{key:"enterUnfinishedNodesBefore",value:function t(n){return yy(this,n)}},{key:"toString",value:function t(){return this.context.buffer.childString(this.index)}},{key:"getChild",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=ky(this,n,i,e);return r.length?r[0]:null}},{key:"getChildren",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;return ky(this,n,i,e)}},{key:"node",get:function t(){return this}},{key:"matchContext",value:function t(n){return my(this,n)}}]),t}(),Er=function(){function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(yc(this,t),this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,n instanceof Or)this.yieldNode(n);else{for(this.oMi=n.context.parent,this.buffer=n.context,i=n.sft;i;i=i.sft)this.stack.unshift(i.index);this.bufferNode=n,this.yieldBuf(n.index)}}return kc(t,[{key:"name",get:function t(){return this.type.name}},{key:"yieldNode",value:function t(n){return!!n&&(this.oMi=n,this.type=n.type,this.from=n.from,this.to=n.to,!0)}},{key:"yieldBuf",value:function t(n,i){this.index=n;var e=this.buffer,r=e.start,u=e.buffer;return this.type=i||u.set.types[u.buffer[n]],this.from=r+u.buffer[n+1],this.to=r+u.buffer[n+2],!0}},{key:"yield",value:function t(n){return!!n&&(n instanceof Or?(this.buffer=null,this.yieldNode(n)):(this.buffer=n.context,this.yieldBuf(n.index,n.type)))}},{key:"toString",value:function t(){return this.buffer?this.buffer.buffer.childString(this.index):this.oMi.toString()}},{key:"enterChild",value:function t(n,i,e){var r,u;return this.buffer?!((u=(r=this.buffer.buffer).findChild(this.index+4,r.buffer[this.index+3],n,i-this.buffer.start,e))<0)&&(this.stack.push(this.index),this.yieldBuf(u)):this.yield(this.oMi.nextChild(n<0?this.oMi.oMi.children.length-1:0,n,i,e,this.mode))}},{key:"firstChild",value:function t(){return this.enterChild(1,0,4)}},{key:"lastChild",value:function t(){return this.enterChild(-1,0,4)}},{key:"childAfter",value:function t(n){return this.enterChild(1,n,2)}},{key:"childBefore",value:function t(n){return this.enterChild(-1,n,-2)}},{key:"enter",value:function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.mode;return this.buffer?!(e&Mr.ExcludeBuffers)&&this.enterChild(1,n,i):this.yield(this.oMi.enter(n,i,e))}},{key:"parent",value:function t(){if(!this.buffer)return this.yieldNode(this.mode&Mr.IncludeAnonymous?this.oMi.sft:this.oMi.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());var t=this.mode&Mr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}},{key:"sibling",value:function t(n){var i,e,r,u;if(!this.buffer)return!!this.oMi.sft&&this.yield(this.oMi.index<0?null:this.oMi.sft.nextChild(this.oMi.index+n,n,0,4,this.mode));if(i=this.buffer.buffer,e=this.stack.length-1,n<0){if(r=e<0?0:this.stack[e]+4,this.index!=r)return this.yieldBuf(i.findChild(r,this.index,-1,0,4))}else if((u=i.buffer[this.index+3])<(e<0?i.buffer.length:i.buffer[this.stack[e]+3]))return this.yieldBuf(u);return e<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+n,n,0,4,this.mode))}},{key:"nextSibling",value:function t(){return this.sibling(1)}},{key:"prevSibling",value:function t(){return this.sibling(-1)}},{key:"atLastNode",value:function t(n){var i,e,r,u,o,s,h,f,a=this.buffer;if(a){if(n>0){if(this.index<a.buffer.buffer.length)return!1}else for(r=0;r<this.index;r++)if(a.buffer.buffer[r+3]<this.index)return!1;i=a.index,e=a.parent}else i=(u=this.oMi).index,e=u.sft;for(;e;i=(o=e).index,e=o.sft,o)if(i>-1)for(s=i+n,h=n<0?-1:e.oMi.children.length;s!=h;s+=n)if(f=e.oMi.children[s],this.mode&Mr.IncludeAnonymous||f instanceof Cr||!f.type.isAnonymous||gy(f))return!1;return!0}},{key:"move",value:function t(n,i){if(i&&this.enterChild(n,0,4))return!0;for(;;){if(this.sibling(n))return!0;if(this.atLastNode(n)||!this.parent())return!1}}},{key:"next",value:function t(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(1,n)}},{key:"prev",value:function t(){var n=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.move(-1,n)}},{key:"moveTo",value:function t(n){for(var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;(this.from==this.to||(i<1?this.from>=n:this.from>n)||(i>-1?this.to<=n:this.to<n))&&this.parent(););for(;this.enterChild(1,n,i););return this}},{key:"node",get:function t(){var n,i,e,r,u,o,s;if(!this.buffer)return this.oMi;if(i=null,e=0,(n=this.bufferNode)&&n.context==this.buffer)t:for(r=this.index,u=this.stack.length;u>=0;){for(o=n;o;o=o.sft)if(o.index==r){if(r==this.index)return o;i=o,e=u+1;break t}r=this.stack[--u]}for(s=e;s<this.stack.length;s++)i=new Dr(this.buffer,i,this.stack[s]);return this.bufferNode=new Dr(this.buffer,i,this.index)}},{key:"tree",get:function t(){return this.buffer?null:this.oMi.oMi}},{key:"iterate",value:function t(n,i){var e,r;for(e=0;;){if(r=!1,this.type.isAnonymous||!1!==n(this)){if(this.firstChild()){e++;continue}this.type.isAnonymous||(r=!0)}for(;r&&i&&i(this),r=this.type.isAnonymous,!this.nextSibling();){if(!e)return;this.parent(),e--,r=!0}}}},{key:"matchContext",value:function t(n){var i,e,r,u,o;if(!this.buffer)return my(this.node,n);for(e=(i=this.buffer.buffer).set.types,r=n.length-1,u=this.stack.length-1;r>=0;u--){if(u<0)return my(this.node,n,r);if(!(o=e[i.buffer[this.stack[u]]]).isAnonymous){if(n[r]&&n[r]!=o.name)return!1;r--}}return!0}}]),t}(),Ir=new WeakMap,Rr=function(){function t(n,i,e,r){var u=arguments.length>4&&void 0!==arguments[4]&&arguments[4],o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];yc(this,t),this.from=n,this.to=i,this.tree=e,this.offset=r,this.open=(u?1:0)|(o?2:0)}return kc(t,[{key:"openStart",get:function t(){return(1&this.open)>0}},{key:"openEnd",get:function t(){return(2&this.open)>0}}],[{key:"addTree",value:function n(i){var e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=[new t(0,i.length,i,0,!1,o)],h=ic(u);try{for(h.s();!(e=h.n()).done;)(r=e.value).to>i.length&&s.push(r)}catch(t){h.e(t)}finally{h.f()}return s}},{key:"applyChanges",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v,d,y=arguments.length>2&&void 0!==arguments[2]?arguments[2]:128;if(!e.length)return i;for(r=[],u=1,o=i.length?i[0]:null,s=0,h=0,f=0;;s++){if((c=(a=s<e.length?e[s]:null)?a.fromA:1e9)-h>=y)for(;o&&o.from<c&&((h>=(l=o).from||c<=l.to||f)&&(l=(v=Math.max(l.from,h)-f)>=(d=Math.min(l.to,c)-f)?null:new t(v,d,l.tree,l.offset+f,s>0,!!a)),l&&r.push(l),!(o.to>c));)o=u<i.length?i[u++]:null;if(!a)break;h=a.toA,f=a.toA-a.toB}return r}}]),t}(),Lr=function(){function t(){yc(this,t)}return kc(t,[{key:"startParse",value:function t(n,i,e){return"string"==typeof n&&(n=new jr(n)),e=e?e.length?e.map((function(t){return new yr(t.from,t.to)})):[new yr(0,0)]:[new yr(0,n.length)],this.createParse(n,i||[],e)}},{key:"parse",value:function t(n,i,e){for(var r,t=this.startParse(n,i,e);;)if(r=t.advance())return r}}]),t}(),jr=function(){function t(n){yc(this,t),this.string=n}return kc(t,[{key:"length",get:function t(){return this.string.length}},{key:"chunk",value:function t(n){return this.string.slice(n)}},{key:"lineChunks",get:function t(){return!1}},{key:"read",value:function t(n,i){return this.string.slice(n,i)}}]),t}(),new pr({perNode:!0}),Tr=0,Br=function(){function t(n,i,e){yc(this,t),this.set=n,this.base=i,this.modified=e,this.id=Tr++}return kc(t,null,[{key:"define",value:function n(i){var e,r,u,o;if(null==i?void 0:i.base)throw new Error("Can not derive from a modified tag");if((e=new t([],null,[])).set.push(e),i){r=ic(i.set);try{for(r.s();!(u=r.n()).done;)o=u.value,e.set.push(o)}catch(t){r.e(t)}finally{r.f()}}return e}},{key:"defineModifier",value:function t(){var n=new Nr;return function(t){return t.modified.indexOf(n)>-1?t:Nr.get(t.base||t,t.modified.concat(n).sort((function(t,n){return t.id-n.id})))}}}]),t}(),_r=0,Nr=function(){function t(){yc(this,t),this.instances=[],this.id=_r++}return kc(t,null,[{key:"get",value:function n(i,e){var r,u,o,s,h,f,a,c,l,v,d,y,p;if(!e.length)return i;if(r=e[0].instances.find((function(t){return t.base==i&&xy(e,t.modified)})),r)return r;o=new Br(u=[],i,e),s=ic(e);try{for(s.s();!(h=s.n()).done;)(f=h.value).instances.push(o)}catch(t){s.e(t)}finally{s.f()}a=Sy(e),c=ic(i.set);try{for(c.s();!(l=c.n()).done;)if(!(v=l.value).modified.length){d=ic(a);try{for(d.s();!(y=d.n()).done;)p=y.value,u.push(t.get(v,p))}catch(t){d.e(t)}finally{d.f()}}}catch(t){c.e(t)}finally{c.f()}return o}}]),t}(),Pr=new pr,Fr=function(){function t(n,i,e,r){yc(this,t),this.tags=n,this.mode=i,this.context=e,this.next=r}return kc(t,[{key:"opaque",get:function t(){return 0==this.mode}},{key:"inherit",get:function t(){return 1==this.mode}},{key:"sort",value:function t(n){return!n||n.depth<this.depth?(this.next=n,this):(n.next=this.sort(n.next),n)}},{key:"depth",get:function t(){return this.context?this.context.length:0}}]),t}(),Fr.empty=new Fr([],2,null),Hr=function(){function t(n,i,e){yc(this,t),this.at=n,this.highlighters=i,this.span=e,this.class=""}return kc(t,[{key:"startSpan",value:function t(n,i){i!=this.class&&(this.flush(n),n>this.at&&(this.at=n),this.class=i)}},{key:"flush",value:function t(n){n>this.at&&this.class&&this.span(this.at,n,this.class)}},{key:"highlightRange",value:function t(n,i,e,r,u){var o,s,h,f,a,c,l,v,d,y,p,k,m,g=n.type,w=n.from,b=n.to;if(!(w>=e||b<=i||(g.isTop&&(u=this.highlighters.filter((function(t){return!t.scope||t.scope(g)}))),o=r,(h=Ay(u,(s=Ey(n)||Fr.empty).tags))&&(o&&(o+=" "),o+=h,1==s.mode&&(r+=(r?" ":"")+h)),this.startSpan(Math.max(i,w),o),s.opaque)))if((f=n.tree&&n.tree.prop(pr.mounted))&&f.overlay){for(a=n.node.enter(f.overlay[0].from+w,1),c=this.highlighters.filter((function(t){return!t.scope||t.scope(f.tree.type)})),l=n.firstChild(),v=0,d=w;;v++){if(p=(y=v<f.overlay.length?f.overlay[v]:null)?y.from+w:b,(k=Math.max(i,d))<(m=Math.min(e,p))&&l)for(;n.from<m&&(this.highlightRange(n,k,m,r,u),this.startSpan(Math.min(m,n.to),o),!(n.to>=p)&&n.nextSibling()););if(!y||p>e)break;(d=y.to+w)>i&&(this.highlightRange(a.cursor(),Math.max(i,y.from+w),Math.min(e,d),"",c),this.startSpan(Math.min(e,d),o))}l&&n.parent()}else if(n.firstChild()){f&&(r="");do{if(!(n.to<=i)){if(n.from>=e)break;this.highlightRange(n,i,e,r,u),this.startSpan(Math.min(e,n.to),o)}}while(n.nextSibling());n.parent()}}}]),t}(),Wr=(zr=Br.define)(),Vr=zr(),Ur=zr(Vr),$r=zr(Vr),qr=zr(),Gr=zr(qr),Jr=zr(qr),Kr=zr(),Qr=zr(Kr),Xr=zr(),Zr=zr(),Yr=zr(),tu=zr(Yr),nu=zr(),Oy([{tag:(iu={comment:Wr,lineComment:zr(Wr),blockComment:zr(Wr),docComment:zr(Wr),name:Vr,variableName:zr(Vr),typeName:Ur,tagName:zr(Ur),propertyName:$r,attributeName:zr($r),className:zr(Vr),labelName:zr(Vr),namespace:zr(Vr),macroName:zr(Vr),literal:qr,string:Gr,docString:zr(Gr),character:zr(Gr),attributeValue:zr(Gr),number:Jr,integer:zr(Jr),float:zr(Jr),bool:zr(qr),regexp:zr(qr),escape:zr(qr),color:zr(qr),url:zr(qr),keyword:Xr,self:zr(Xr),null:zr(Xr),atom:zr(Xr),unit:zr(Xr),modifier:zr(Xr),operatorKeyword:zr(Xr),controlKeyword:zr(Xr),definitionKeyword:zr(Xr),moduleKeyword:zr(Xr),operator:Zr,derefOperator:zr(Zr),arithmeticOperator:zr(Zr),logicOperator:zr(Zr),bitwiseOperator:zr(Zr),compareOperator:zr(Zr),updateOperator:zr(Zr),definitionOperator:zr(Zr),typeOperator:zr(Zr),controlOperator:zr(Zr),punctuation:Yr,separator:zr(Yr),bracket:tu,angleBracket:zr(tu),squareBracket:zr(tu),paren:zr(tu),brace:zr(tu),content:Kr,heading:Qr,heading1:zr(Qr),heading2:zr(Qr),heading3:zr(Qr),heading4:zr(Qr),heading5:zr(Qr),heading6:zr(Qr),contentSeparator:zr(Kr),list:zr(Kr),quote:zr(Kr),emphasis:zr(Kr),strong:zr(Kr),link:zr(Kr),monospace:zr(Kr),strikethrough:zr(Kr),inserted:zr(),deleted:zr(),changed:zr(),invalid:zr(),meta:nu,documentMeta:zr(nu),annotation:zr(nu),processingInstruction:zr(nu),definition:Br.defineModifier(),constant:Br.defineModifier(),function:Br.defineModifier(),standard:Br.defineModifier(),local:Br.defineModifier(),special:Br.defineModifier()}).link,class:"tok-link"},{tag:iu.heading,class:"tok-heading"},{tag:iu.emphasis,class:"tok-emphasis"},{tag:iu.strong,class:"tok-strong"},{tag:iu.keyword,class:"tok-keyword"},{tag:iu.atom,class:"tok-atom"},{tag:iu.bool,class:"tok-bool"},{tag:iu.url,class:"tok-url"},{tag:iu.labelName,class:"tok-labelName"},{tag:iu.inserted,class:"tok-inserted"},{tag:iu.deleted,class:"tok-deleted"},{tag:iu.literal,class:"tok-literal"},{tag:iu.string,class:"tok-string"},{tag:iu.number,class:"tok-number"},{tag:[iu.regexp,iu.escape,iu.special(iu.string)],class:"tok-string2"},{tag:iu.variableName,class:"tok-variableName"},{tag:iu.local(iu.variableName),class:"tok-variableName tok-local"},{tag:iu.definition(iu.variableName),class:"tok-variableName tok-definition"},{tag:iu.special(iu.variableName),class:"tok-variableName2"},{tag:iu.definition(iu.propertyName),class:"tok-propertyName tok-definition"},{tag:iu.typeName,class:"tok-typeName"},{tag:iu.namespace,class:"tok-namespace"},{tag:iu.className,class:"tok-className"},{tag:iu.macroName,class:"tok-macroName"},{tag:iu.propertyName,class:"tok-propertyName"},{tag:iu.operator,class:"tok-operator"},{tag:iu.comment,class:"tok-comment"},{tag:iu.meta,class:"tok-meta"},{tag:iu.invalid,class:"tok-invalid"},{tag:iu.punctuation,class:"tok-punctuation"}]),ru=new pr,uu=new pr,ou=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";yc(this,t),this.data=n,this.name=r,Q.prototype.hasOwnProperty("tree")||Object.defineProperty(Q.prototype,"tree",{get:function t(){return Ly(this)}}),this.parser=i,this.extension=[yu.of(this),Q.languageData.of((function(t,n,i){var e,r,u,o,s,h,f,a=Ry(t,n,i),c=a.type.prop(ru);if(!c)return[];if(e=t.facet(c),r=a.type.prop(uu)){u=a.resolve(n-a.from,i),o=ic(r);try{for(o.s();!(s=o.n()).done;)if((h=s.value).test(u,t))return f=t.facet(h.facet),"replace"==h.type?f:f.concat(e)}catch(t){o.e(t)}finally{o.f()}}return e}))].concat(e)}return kc(t,[{key:"isActiveAt",value:function t(n,i){var e;return Ry(n,i,arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1).type.prop(ru)==this.data}},{key:"findRegions",value:function t(n){var i,e,r=this,u=n.facet(yu);return(null==u?void 0:u.data)==this.data?[{from:0,to:n.doc.length}]:u&&u.allowsNesting?(i=[],(e=function t(n,e){var u,o,s,h,f,a,c;if(n.prop(ru)!=r.data){if(u=n.prop(pr.mounted)){if(u.tree.prop(ru)==r.data){if(u.overlay){o=ic(u.overlay);try{for(o.s();!(s=o.n()).done;)h=s.value,i.push({from:h.from+e,to:h.to+e})}catch(t){o.e(t)}finally{o.f()}}else i.push({from:e,to:e+n.length});return}if(u.overlay&&(f=i.length,t(u.tree,u.overlay[0].from+e),i.length>f))return}for(a=0;a<n.children.length;a++)(c=n.children[a])instanceof xr&&t(c,n.positions[a]+e)}else i.push({from:e,to:e+n.length})})(Ly(n),0),i):[]}},{key:"allowsNesting",get:function t(){return!0}}]),t}(),ou.setState=U.define(),su=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t,e,[],r)).parser=e,u}return kc(i,[{key:"configure",value:function t(n,e){return new i(this.data,this.parser.configure(n),e||this.name)}},{key:"allowsNesting",get:function t(){return this.parser.hasWrappers()}}],[{key:"define",value:function t(n){var e=Iy(n.languageData);return new i(e,n.parser.configure({props:[ru.add((function(t){return t.isTop?e:void 0}))]}),n.name)}}]),i}(ou),hu=function(){function t(n){yc(this,t),this.doc=n,this.cursorPos=0,this.string="",this.cursor=n.iter()}return kc(t,[{key:"length",get:function t(){return this.doc.length}},{key:"syncTo",value:function t(n){return this.string=this.cursor.next(n-this.cursorPos).value,this.cursorPos=n+this.string.length,this.cursorPos-this.string.length}},{key:"chunk",value:function t(n){return this.syncTo(n),this.string}},{key:"lineChunks",get:function t(){return!0}},{key:"read",value:function t(n,i){var e=this.cursorPos-this.string.length;return n<e||i>=this.cursorPos?this.doc.sliceString(n,i):this.string.slice(n-e,i-e)}}]),t}(),fu=null,au=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3?arguments[3]:void 0,u=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0,s=arguments.length>6?arguments[6]:void 0,h=arguments.length>7?arguments[7]:void 0;yc(this,t),this.parser=n,this.state=i,this.fragments=e,this.tree=r,this.treeLen=u,this.viewport=o,this.skipped=s,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}return kc(t,[{key:"startParse",value:function t(){return this.parser.startParse(new hu(this.state.doc),this.fragments)}},{key:"work",value:function t(n,i){var e=this;return null!=i&&i>=this.state.doc.length&&(i=void 0),this.tree!=xr.empty&&this.isDone(null!=i?i:this.state.doc.length)?(this.takeTree(),!0):this.withContext((function(){var t,r,u;for("number"==typeof n&&(r=Date.now()+n,n=function t(){return Date.now()>r}),e.parse||(e.parse=e.startParse()),null!=i&&(null==e.parse.stoppedAt||e.parse.stoppedAt>i)&&i<e.state.doc.length&&e.parse.stopAt(i);;){if(u=e.parse.advance()){if(e.fragments=e.withoutTempSkipped(Rr.addTree(u,e.fragments,null!=e.parse.stoppedAt)),e.treeLen=null!==(t=e.parse.stoppedAt)&&void 0!==t?t:e.state.doc.length,e.tree=u,e.parse=null,!(e.treeLen<(null!=i?i:e.state.doc.length)))return!0;e.parse=e.startParse()}if(n())return!1}}))}},{key:"takeTree",value:function t(){var n,i,e=this;this.parse&&(n=this.parse.parsedPos)>=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>n)&&this.parse.stopAt(n),this.withContext((function(){for(;!(i=e.parse.advance()););})),this.treeLen=n,this.tree=i,this.fragments=this.withoutTempSkipped(Rr.addTree(this.tree,this.fragments,!0)),this.parse=null)}},{key:"withContext",value:function t(n){var i=fu;fu=this;try{return n()}finally{fu=i}}},{key:"withoutTempSkipped",value:function t(n){for(var i;i=this.tempSkipped.pop();)n=Ny(n,i.from,i.to);return n}},{key:"changes",value:function n(i,e){var r,u,o,s,h,f,a=this.fragments,c=this.tree,l=this.treeLen,v=this.viewport,d=this.skipped;if(this.takeTree(),!i.empty&&(r=[],i.iterChangedRanges((function(t,n,i,e){return r.push({fromA:t,toA:n,fromB:i,toB:e})})),a=Rr.applyChanges(a,r),c=xr.empty,l=0,v={from:i.mapPos(v.from,-1),to:i.mapPos(v.to,1)},this.skipped.length)){d=[],u=ic(this.skipped);try{for(u.s();!(o=u.n()).done;)s=o.value,(h=i.mapPos(s.from,1))<(f=i.mapPos(s.to,-1))&&d.push({from:h,to:f})}catch(t){u.e(t)}finally{u.f()}}return new t(this.parser,e,a,c,l,v,d,this.scheduleOn)}},{key:"updateViewport",value:function t(n){var i,e,r,u,o;if(this.viewport.from==n.from&&this.viewport.to==n.to)return!1;for(this.viewport=n,i=this.skipped.length,e=0;e<this.skipped.length;e++)u=(r=this.skipped[e]).from,o=r.to,u<n.to&&o>n.from&&(this.fragments=Ny(this.fragments,u,o),this.skipped.splice(e--,1));return!(this.skipped.length>=i)&&(this.reset(),!0)}},{key:"reset",value:function t(){this.parse&&(this.takeTree(),this.parse=null)}},{key:"skipUntilInView",value:function t(n,i){this.skipped.push({from:n,to:i})}},{key:"isDone",value:function t(n){n=Math.min(n,this.state.doc.length);var i=this.fragments;return this.treeLen>=n&&i.length&&0==i[0].from&&i[0].to>=n}}],[{key:"create",value:function n(i,e,r){return new t(i,e,[],xr.empty,0,r,[],null)}},{key:"getSkippingParser",value:function t(n){return new(function(t){sc(e,t);var i=fc(e);function e(){return yc(this,e),i.apply(this,arguments)}return kc(e,[{key:"createParse",value:function t(i,e,r){var u=r[0].from,o=r[r.length-1].to,s={parsedPos:u,advance:function t(){var i,e,s,h=fu;if(h){i=ic(r);try{for(i.s();!(e=i.n()).done;)s=e.value,h.tempSkipped.push(s)}catch(t){i.e(t)}finally{i.f()}n&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,n]):n)}return this.parsedPos=o,new xr(mr.none,[],[],o-u)},stoppedAt:null,stopAt:function t(){}};return s}}]),e}(Lr))}},{key:"get",value:function t(){return fu}}]),t}(),cu=function(){function t(n){yc(this,t),this.context=n,this.tree=n.tree}return kc(t,[{key:"apply",value:function n(i){var e,r;return i.docChanged||this.tree!=this.context.tree?(e=this.context.changes(i.changes,i.state),r=this.context.treeLen==i.startState.doc.length?void 0:Math.max(i.changes.mapPos(this.context.treeLen),e.viewport.to),e.work(20,r)||e.takeTree(),new t(e)):this}}],[{key:"init",value:function n(i){var e=Math.min(3e3,i.doc.length),r=au.create(i.facet(yu).parser,i,{from:0,to:e});return r.work(20,e)||r.takeTree(),new t(r)}}]),t}(),ou.state=x.define({create:cu.init,update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;)if((r=e.value).is(ou.setState))return r.value}catch(t){u.e(t)}finally{u.f()}return i.startState.facet(yu)!=i.state.facet(yu)?cu.init(i.state):n.apply(i)}}),lu=function t(n){var i=setTimeout((function(){return n()}),500);return function(){return clearTimeout(i)}},"undefined"!=typeof requestIdleCallback&&(lu=function t(n){var i=-1,e=setTimeout((function(){i=requestIdleCallback(n,{timeout:400})}),100);return function(){return i<0?clearTimeout(e):cancelIdleCallback(i)}}),vu="undefined"!=typeof navigator&&(null===(eu=navigator.scheduling)||void 0===eu?void 0:eu.isInputPending)?function(){return navigator.scheduling.isInputPending()}:null,du=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}return kc(t,[{key:"update",value:function t(n){var i=this.view.state.field(ou.state).context;(i.updateViewport(n.view.viewport)||this.view.viewport.to>i.treeLen)&&this.scheduleWork(),n.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(i)}},{key:"scheduleWork",value:function t(){if(!this.working){var n=this.view.state,i=n.field(ou.state);i.tree==i.context.tree&&i.context.isDone(n.doc.length)||(this.working=lu(this.work))}}},{key:"work",value:function t(n){var i,e,r,u,o,s,h,f;this.working=null,i=Date.now(),this.chunkEnd<i&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=i+3e4,this.chunkBudget=3e3),this.chunkBudget<=0||(r=(e=this.view).state,u=e.viewport.to,(o=r.field(ou.state)).tree==o.context.tree&&o.context.isDone(u+1e5)||(s=Date.now()+Math.min(this.chunkBudget,100,n&&!vu?Math.max(25,n.timeRemaining()-5):1e9),h=o.context.treeLen<u&&r.doc.length>u+1e3,f=o.context.work((function(){return vu&&vu()||Date.now()>s}),u+(h?0:1e5)),this.chunkBudget-=Date.now()-i,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:ou.setState.of(new cu(o.context))})),this.chunkBudget>0&&(!f||h)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)))}},{key:"checkAsyncSchedule",value:function t(n){var i=this;n.scheduleOn&&(this.workScheduled++,n.scheduleOn.then((function(){return i.scheduleWork()})).catch((function(t){return Yl(i.view.state,t)})).then((function(){return i.workScheduled--})),n.scheduleOn=null)}},{key:"destroy",value:function t(){this.working&&this.working()}},{key:"isWorking",value:function t(){return!!(this.working||this.workScheduled>0)}}]),t}(),{eventHandlers:{focus:function t(){this.scheduleWork()}}}),yu=w.define({combine:function t(n){return n.length?n[0]:null},enables:function t(n){return[ou.state,du,Ui.contentAttributes.compute([n],(function(t){var i=t.facet(n);return i&&i.name?{"data-language":i.name}:{}}))]}}),pu=kc((function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];yc(this,t),this.language=n,this.support=i,this.extension=[n,i]})),ku=function(){function t(n,i,e,r,u){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:void 0;yc(this,t),this.name=n,this.alias=i,this.extensions=e,this.filename=r,this.loadFunc=u,this.support=o,this.loading=null}return kc(t,[{key:"load",value:function t(){var n=this;return this.loading||(this.loading=this.loadFunc().then((function(t){return n.support=t}),(function(t){throw n.loading=null,t})))}}],[{key:"of",value:function n(i){var e=i.load,r=i.support;if(!e){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");e=function t(){return Promise.resolve(r)}}return new t(i.name,(i.alias||[]).concat(i.name).map((function(t){return t.toLowerCase()})),i.extensions||[],i.filename,e,r)}},{key:"matchFilename",value:function t(n,i){var e,r,u,o,s,h,f=ic(n);try{for(f.s();!(e=f.n()).done;)if((r=e.value).filename&&r.filename.test(i))return r}catch(t){f.e(t)}finally{f.f()}if(u=/\.([^.]+)$/.exec(i)){o=ic(n);try{for(o.s();!(s=o.n()).done;)if((h=s.value).extensions.indexOf(u[1])>-1)return h}catch(t){o.e(t)}finally{o.f()}}return null}},{key:"matchLanguageName",value:function t(n,i){var e,r,u,o,s,h,f,a,c,l,v=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];i=i.toLowerCase(),e=ic(n);try{for(e.s();!(r=e.n()).done;)if((u=r.value).alias.some((function(t){return t==i})))return u}catch(t){e.e(t)}finally{e.f()}if(v){o=ic(n);try{for(o.s();!(s=o.n()).done;){f=ic((h=s.value).alias);try{for(f.s();!(a=f.n()).done;)if(c=a.value,(l=i.indexOf(c))>-1&&(c.length>2||!/\w/.test(i[l-1])&&!/\w/.test(i[l+c.length])))return h}catch(t){f.e(t)}finally{f.f()}}}catch(t){o.e(t)}finally{o.f()}}return null}}]),t}(),mu=w.define(),gu=w.define({combine:function t(n){if(!n.length)return" ";var i=n[0];if(!i||/\S/.test(i)||Array.from(i).some((function(t){return t!=i[0]})))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return i}}),wu=function(){function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};yc(this,t),this.state=n,this.options=i,this.unit=Py(n)}return kc(t,[{key:"lineAt",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=this.state.doc.lineAt(n),r=this.options,u=r.simulateBreak,o=r.simulateDoubleBreak;return null!=u&&u>=e.from&&u<=e.to?o&&u==n?{text:"",from:n}:(i<0?u<n:u<=n)?{text:e.text.slice(u-e.from),from:u}:{text:e.text.slice(0,u-e.from),from:e.from}:e}},{key:"textAfterPos",value:function t(n){var i,e,r,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.options.simulateDoubleBreak&&n==this.options.simulateBreak?"":(e=(i=this.lineAt(n,u)).text,r=i.from,e.slice(n-r,Math.min(e.length,n+100-r)))}},{key:"column",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,e=this.lineAt(n,i),r=e.text,u=e.from,o=this.countColumn(r,n-u),s=this.options.overrideIndentation?this.options.overrideIndentation(u):-1;return s>-1&&(o+=s-this.countColumn(r,r.search(/\S|$/))),o}},{key:"countColumn",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.length;return ll(n,this.state.tabSize,i)}},{key:"lineIndent",value:function t(n){var i,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=this.lineAt(n,e),u=r.text,o=r.from,s=this.options.overrideIndentation;return s&&(i=s(o))>-1?i:this.countColumn(u,u.search(/\S|$/))}},{key:"simulatedBreak",get:function t(){return this.options.simulateBreak||null}}]),t}(),bu=new pr,Mu=function(t){sc(i,t);var n=fc(i);function i(t,e,r){var u;return yc(this,i),(u=n.call(this,t.state,t.options)).base=t,u.pos=e,u.node=r,u}return kc(i,[{key:"textAfter",get:function t(){return this.textAfterPos(this.pos)}},{key:"baseIndent",get:function t(){for(var n,i=this.state.doc.lineAt(this.node.from);;){for(n=this.node.resolve(i.from);n.parent&&n.parent.from==n.from;)n=n.parent;if(Gy(n,this.node))break;i=this.state.doc.lineAt(n.from)}return this.lineIndent(i.from)}},{key:"continue",value:function t(){var n=this.node.parent;return n?$y(n,this.pos,this.base):0}}],[{key:"create",value:function t(n,e,r){return new i(n,e,r)}}]),i}(wu),xu=function t(n){return n.baseIndent},Su=200,Cu=w.define(),Ou=new pr,Au=U.define({map:ep}),Du=U.define({map:ep}),Eu=x.define({create:function t(){return Jt.none},update:function t(n,i){var e,r,u,o,s;n=n.map(i.changes),e=ic(i.effects);try{for(u=function t(){var i=r.value;i.is(Au)&&!sp(n,i.value.from,i.value.to)?n=n.update({add:[Pu.range(i.value.from,i.value.to)]}):i.is(Du)&&(n=n.update({filter:function t(n,e){return i.value.from!=n||i.value.to!=e},filterFrom:i.value.from,filterTo:i.value.to}))},e.s();!(r=e.n()).done;)u()}catch(t){e.e(t)}finally{e.f()}return i.selection&&(o=!1,s=i.selection.main.head,n.between(s,s,(function(t,n){t<s&&n>s&&(o=!0)})),o&&(n=n.update({filterFrom:s,filterTo:s,filter:function t(n,i){return i<=s||n>=s}}))),n},provide:function t(n){return Ui.decorations.from(n)},toJSON:function t(n,i){var e=[];return n.between(0,i.doc.length,(function(t,n){e.push(t,n)})),e},fromJSON:function t(n){var i,e,r,u;if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");for(i=[],e=0;e<n.length;){if(r=n[e++],u=n[e++],"number"!=typeof r||"number"!=typeof u)throw new RangeError("Invalid JSON for fold state");i.push(Pu.range(r,u))}return Jt.set(i,!0)}}),Tu=function t(n){var i,e,r,u,o=[],s=ic(rp(n));try{for(s.s();!(i=s.n()).done;)e=i.value,(r=op(n.state,e.from,e.to))?o.push(Du.of(r),fp(n,r,!1)):(u=ap(n,e))&&o.push(Au.of(u),fp(n,u))}catch(t){s.e(t)}finally{s.f()}return o.length>0&&n.dispatch({effects:hp(n.state,o)}),!!o.length},Bu=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Iu=function t(n){var i,e,r,u=ic(rp(n));try{for(u.s();!(i=u.n()).done;)if(e=i.value,r=ip(n.state,e.from,e.to))return n.dispatch({effects:hp(n.state,[Au.of(r),fp(n,r)])}),!0}catch(t){u.e(t)}finally{u.f()}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Ru=function t(n){var i,e,r,u,o;if(!n.state.field(Eu,!1))return!1;i=[],e=ic(rp(n));try{for(e.s();!(r=e.n()).done;)u=r.value,(o=op(n.state,u.from,u.to))&&i.push(Du.of(o),fp(n,o,!1))}catch(t){e.e(t)}finally{e.f()}return i.length&&n.dispatch({effects:i}),i.length>0}},{key:"Ctrl-Alt-[",run:Lu=function t(n){var i,e,r,u=n.state,o=[];for(i=0;i<u.doc.length;)(r=ip(u,(e=n.lineBlockAt(i)).from,e.to))&&o.push(Au.of(r)),i=(r?n.lineBlockAt(r.to):e).to+1;return o.length&&n.dispatch({effects:hp(n.state,o)}),!!o.length}},{key:"Ctrl-Alt-]",run:ju=function t(n){var i,e=n.state.field(Eu,!1);return!(!e||!e.size)&&(i=[],e.between(0,n.state.doc.length,(function(t,n){i.push(Du.of({from:t,to:n}))})),n.dispatch({effects:i}),!0)}}],_u={placeholderDOM:null,placeholderText:"\u2026"},Nu=w.define({combine:function t(n){return il(n,_u)}}),Pu=Jt.replace({widget:new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"toDOM",value:function t(n){var i,e=n.state,r=e.facet(Nu),u=function t(i){var e=n.lineBlockAt(n.posAtDOM(i.target)),r=op(n.state,e.from,e.to);r&&n.dispatch({effects:Du.of(r)}),i.preventDefault()};return r.placeholderDOM?r.placeholderDOM(n,u):((i=document.createElement("span")).textContent=r.placeholderText,i.setAttribute("aria-label",e.phrase("folded code")),i.title=e.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=u,i)}}]),i}(qt))}),Fu={openText:"\u2304",closedText:"\u203a",markerDOM:null,domEventHandlers:{},foldingChanged:function t(){return!1}},Hu=function(t){sc(i,t);var n=fc(i);function i(t,e){var r;return yc(this,i),(r=n.call(this)).config=t,r.open=e,r}return kc(i,[{key:"eq",value:function t(n){return this.config==n.config&&this.open==n.open}},{key:"toDOM",value:function t(n){if(this.config.markerDOM)return this.config.markerDOM(this.open);var i=document.createElement("span");return i.textContent=this.open?this.config.openText:this.config.closedText,i.title=n.state.phrase(this.open?"Fold line":"Unfold line"),i}}]),i}(Ge),zu=Ui.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"}}),Wu=function(){function t(n,i){var e,r,u;function o(t){var n=at.newName();return(e||(e=Object.create(null)))["."+n]=t,n}yc(this,t),this.specs=n,r="string"==typeof i.all?i.all:i.all?o(i.all):void 0,u=i.scope,this.scope=u instanceof ou?function(t){return t.prop(ru)==u.data}:u?function(t){return t==u}:void 0,this.style=Oy(n.map((function(t){return{tag:t.tag,class:t.class||o(Object.assign({},t,{tag:null}))}})),{all:r}).style,this.module=e?new at(e):null,this.themeType=i.themeType}return kc(t,null,[{key:"define",value:function n(i,e){return new t(i,e||{})}}]),t}(),Vu=w.define(),Uu=w.define({combine:function t(n){return n.length?[n[0]]:null}}),$u=function(){function t(n){yc(this,t),this.markCache=Object.create(null),this.tree=Ly(n.state),this.decorations=this.buildDeco(n,vp(n.state))}return kc(t,[{key:"update",value:function t(n){var i=Ly(n.state),e=vp(n.state),r=e!=vp(n.startState);i.length<n.view.viewport.to&&!r&&i.type==this.tree.type?this.decorations=this.decorations.map(n.changes):(i!=this.tree||n.viewportChanged||r)&&(this.tree=i,this.decorations=this.buildDeco(n.view,e))}},{key:"buildDeco",value:function t(n,i){var e,r,u,o,s,h,f=this;if(!i||!this.tree.length)return Jt.none;e=new nt,r=ic(n.visibleRanges);try{for(r.s();!(u=r.n()).done;)s=(o=u.value).from,h=o.to,Dy(this.tree,i,(function(t,n,i){e.add(t,n,f.markCache[i]||(f.markCache[i]=Jt.mark({class:i})))}),s,h)}catch(t){r.e(t)}finally{r.f()}return e.finish()}}]),t}(),qu=E.high(kn.fromClass($u,{decorations:function t(n){return n.decorations}})),Gu=Wu.define([{tag:iu.meta,color:"#404740"},{tag:iu.link,textDecoration:"underline"},{tag:iu.heading,textDecoration:"underline",fontWeight:"bold"},{tag:iu.emphasis,fontStyle:"italic"},{tag:iu.strong,fontWeight:"bold"},{tag:iu.strikethrough,textDecoration:"line-through"},{tag:iu.keyword,color:"#708"},{tag:[iu.atom,iu.bool,iu.url,iu.contentSeparator,iu.labelName],color:"#219"},{tag:[iu.literal,iu.inserted],color:"#164"},{tag:[iu.string,iu.deleted],color:"#a11"},{tag:[iu.regexp,iu.escape,iu.special(iu.string)],color:"#e40"},{tag:iu.definition(iu.variableName),color:"#00f"},{tag:iu.local(iu.variableName),color:"#30a"},{tag:[iu.typeName,iu.namespace],color:"#085"},{tag:iu.className,color:"#167"},{tag:[iu.special(iu.variableName),iu.macroName],color:"#256"},{tag:iu.definition(iu.propertyName),color:"#00c"},{tag:iu.comment,color:"#940"},{tag:iu.invalid,color:"#f00"}]),Ju=Ui.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),Ku=1e4,Qu="()[]{}",Xu=w.define({combine:function t(n){return il(n,{afterCursor:!0,brackets:Qu,maxScanDistance:Ku,renderMatch:pp})}}),Zu=Jt.mark({class:"cm-matchingBracket"}),Yu=Jt.mark({class:"cm-nonmatchingBracket"}),to=x.define({create:function t(){return Jt.none},update:function t(n,i){var e,r,u,o,s,h;if(!i.docChanged&&!i.selection)return n;e=[],r=i.state.facet(Xu),u=ic(i.state.selection.ranges);try{for(u.s();!(o=u.n()).done;)(s=o.value).empty&&(h=wp(i.state,s.head,-1,r)||s.head>0&&wp(i.state,s.head-1,1,r)||r.afterCursor&&(wp(i.state,s.head,1,r)||s.head<i.state.doc.length&&wp(i.state,s.head+1,-1,r)))&&(e=e.concat(r.renderMatch(h,i.state)))}catch(t){u.e(t)}finally{u.f()}return Jt.set(e,!0)},provide:function t(n){return Ui.decorations.from(n)}}),no=[to,Ju],io=new pr,eo=function(){function t(n,i,e,r){yc(this,t),this.string=n,this.tabSize=i,this.indentUnit=e,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}return kc(t,[{key:"eol",value:function t(){return this.pos>=this.string.length}},{key:"sol",value:function t(){return 0==this.pos}},{key:"peek",value:function t(){return this.string.charAt(this.pos)||void 0}},{key:"next",value:function t(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}},{key:"eat",value:function t(n){var i,e=this.string.charAt(this.pos);if(i="string"==typeof n?e==n:e&&(n instanceof RegExp?n.test(e):n(e)))return++this.pos,e}},{key:"eatWhile",value:function t(n){for(var i=this.pos;this.eat(n););return this.pos>i}},{key:"eatSpace",value:function t(){for(var n=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>n}},{key:"skipToEnd",value:function t(){this.pos=this.string.length}},{key:"skipTo",value:function t(n){var i=this.string.indexOf(n,this.pos);if(i>-1)return this.pos=i,!0}},{key:"backUp",value:function t(n){this.pos-=n}},{key:"column",value:function t(){return this.lastColumnPos<this.start&&(this.lastColumnValue=xp(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}},{key:"indentation",value:function t(){var n;return null!==(n=this.overrideIndent)&&void 0!==n?n:xp(this.string,null,this.tabSize)}},{key:"match",value:function t(n,i,e){var r,u,t;return"string"==typeof n?(r=function t(n){return e?n.toLowerCase():n})(u=this.string.substr(this.pos,n.length))==r(n)?(!1!==i&&(this.pos+=n.length),!0):null:(t=this.string.slice(this.pos).match(n),t&&t.index>0?null:(t&&!1!==i&&(this.pos+=t[0].length),t))}},{key:"current",value:function t(){return this.string.slice(this.start,this.pos)}}]),t}(),ro=new WeakMap,uo=function(t){sc(i,t);var n=fc(i);function i(t){var e,r,u,o,s;return yc(this,i),r=Iy(t.languageData),u=Sp(t),s=new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"createParse",value:function t(n,i,e){return new oo(o,n,i,e)}}]),i}(Lr)),(e=n.call(this,r,s,[mu.of((function(t,n){return e.getIndent(t,n)}))],t.name)).topNode=Lp(r),o=cc(e),e.streamParser=u,e.stateAfter=new pr({perNode:!0}),e.tokenTable=t.tokenTable?new mo(u.tokenTable):go,e}return kc(i,[{key:"getIndent",value:function t(n,i){for(var e,r,u,o,s,h,f,a,c,l,v=Ly(n.state),d=v.resolve(i);d&&d.type!=this.topNode;)d=d.parent;if(!d)return null;if(e=void 0,(r=n.options.overrideIndentation)&&null!=(e=ro.get(n.state))&&e<i-1e4&&(e=void 0),(u=Op(this,v,0,d.from,null!=e?e:i))?(s=u.state,o=u.pos+1):(s=this.streamParser.startState(n.unit),o=0),i-o>1e4)return null;for(;o<i;){if(h=n.state.doc.lineAt(o),f=Math.min(i,h.to),h.length)for(a=r?r(h.from):-1,c=new eo(h.text,n.state.tabSize,n.unit,a<0?void 0:a);c.pos<f-h.from;)Ep(this.streamParser.token,c,s);else this.streamParser.blankLine(s,n.unit);if(f==i)break;o=h.to+1}return l=n.lineAt(i),r&&null==e&&ro.set(n.state,l.from),this.streamParser.indent(s,/^\s*(.*)/.exec(l.text)[1],n)}},{key:"allowsNesting",get:function t(){return!1}}],[{key:"define",value:function t(n){return new i(n)}}]),i}(ou),oo=function(){function t(n,i,e,r){var u,o,s,h,f,a;for(yc(this,t),this.lang=n,this.input=i,this.fragments=e,this.ranges=r,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=r[r.length-1].to,u=au.get(),h=(s=Dp(n,e,o=r[0].from,null==u?void 0:u.state)).state,f=s.tree,this.state=h,this.parsedPos=this.chunkStart=o+f.length,a=0;a<f.children.length;a++)this.chunks.push(f.children[a]),this.chunkPos.push(f.positions[a]);u&&this.parsedPos<u.viewport.from-1e5&&(this.state=this.lang.streamParser.startState(Py(u.state)),u.skipUntilInView(this.parsedPos,u.viewport.from),this.parsedPos=u.viewport.from),this.moveRangeIndex()}return kc(t,[{key:"advance",value:function t(){var n=au.get(),i=null==this.stoppedAt?this.to:Math.min(this.to,this.stoppedAt),e=Math.min(i,this.chunkStart+2048);for(n&&(e=Math.min(e,n.viewport.to));this.parsedPos<e;)this.parseLine(n);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=i?this.finish():n&&this.parsedPos>=n.viewport.to?(n.skipUntilInView(this.parsedPos,i),this.finish()):null}},{key:"stopAt",value:function t(n){this.stoppedAt=n}},{key:"lineAfter",value:function t(n){var i,e=this.input.chunk(n);return this.input.lineChunks?"\n"==e&&(e=""):(i=e.indexOf("\n"))>-1&&(e=e.slice(0,i)),n+e.length<=this.to?e:e.slice(0,this.to-n)}},{key:"nextLine",value:function t(){var n,i,e,r,u=this.parsedPos,o=this.lineAfter(u),s=u+o.length;for(n=this.rangeIndex;!((i=this.ranges[n].to)>=s)&&(o=o.slice(0,i-(s-o.length)),++n!=this.ranges.length);)e=this.ranges[n].from,o+=r=this.lineAfter(e),s=e+r.length;return{line:o,end:s}}},{key:"skipGapsTo",value:function t(n,i,e){for(var r,u,o;r=this.ranges[this.rangeIndex].to,u=n+i,!(e>0?r>u:r>=u);)i+=(o=this.ranges[++this.rangeIndex].from)-r;return i}},{key:"moveRangeIndex",value:function t(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}},{key:"emitToken",value:function t(n,i,e,r,u){if(this.ranges.length>1){i+=u=this.skipGapsTo(i,u,1);var o=this.chunk.length;e+=u=this.skipGapsTo(e,u,-1),r+=this.chunk.length-o}return this.chunk.push(n,i,e,r),u}},{key:"parseLine",value:function t(n){var i,e=this.nextLine(),r=e.line,u=e.end,o=0,s=this.lang.streamParser,h=new eo(r,n?n.state.tabSize:4,n?Py(n.state):2);if(h.eol())s.blankLine(this.state,h.indentUnit);else for(;!(h.eol()||((i=Ep(s.token,h,this.state))&&(o=this.emitToken(this.lang.tokenTable.resolve(i),this.parsedPos+h.start,this.parsedPos+h.pos,4,o)),h.start>1e4)););this.parsedPos=u,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}},{key:"finishChunk",value:function t(){var n=xr.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:fo,topID:0,maxBufferLength:2048,reused:this.chunkReused});n=new xr(n.type,n.children,n.positions,n.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(n),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}},{key:"finish",value:function t(){return new xr(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}}]),t}(),so=Object.create(null),ho=[mr.none],fo=new gr(ho),ao=[],co=Object.create(null),lo=0,vo=[["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"]];lo<vo.length;lo++)po=(yo=Za(vo[lo],2))[0],ko=yo[1],co[po]=Rp(so,ko);function Ip(t,n){ao.indexOf(t)>-1||(ao.push(t),console.warn(n))}function Rp(t,n){var i,e,r,u,o,s=null,h=ic(n.split("."));try{for(h.s();!(i=h.n()).done;)(r=t[e=i.value]||iu[e])?"function"==typeof r?s?s=r(s):Ip(e,"Modifier ".concat(e," used at start of tag")):s?Ip(e,"Tag ".concat(e," used as modifier")):s=r:Ip(e,"Unknown highlighting tag ".concat(e))}catch(t){h.e(t)}finally{h.f()}return s?(u=n.replace(/ /g,"_"),o=mr.define({id:ho.length,name:u,props:[Cy(Ga({},u,s))]}),ho.push(o),o.id):0}function Lp(t){var n=mr.define({id:ho.length,name:"Document",props:[ru.add((function(){return t}))]});return ho.push(n),n}function jp(t){var n=Object.keys(t).join(""),i=/\w/.test(n);return i&&(n=n.replace(/\w/g,"")),"[".concat(i?"\\w":"").concat(n.replace(/[^\w\s]/g,"\\$&"),"]")}function Tp(t){var n,i,e,r,u=Object.create(null),o=Object.create(null),s=ic(t);try{for(s.s();!(n=s.n()).done;)for(u[(i=n.value.label)[0]]=!0,e=1;e<i.length;e++)o[i[e]]=!0}catch(t){s.e(t)}finally{s.f()}return r=jp(u)+jp(o)+"*$",[new RegExp("^"+r),new RegExp(r)]}function Bp(t){var n=t.map((function(t){return"string"==typeof t?{label:t}:t})),i=n.every((function(t){return/^\w+$/.test(t.label)}))?[/\w*$/,/\w+$/]:Tp(n),e=Za(i,2),r=e[0],u=e[1];return function(t){var i=t.matchBefore(u);return i||t.explicit?{from:i?i.from:t.pos,options:n,validFor:r}:null}}function _p(t,n){return function(i){for(var e=Ly(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return n(i);if(e.type.isTop)break}return null}}function Np(t,n){return function(i){for(var e=Ly(i.state).resolveInner(i.pos,-1);e;e=e.parent){if(t.indexOf(e.name)>-1)return null;if(e.type.isTop)break}return n(i)}}function Pp(t){return t.selection.main.from}function Fp(t,n){var i,e=t.source,r=n&&"^"!=e[0],u="$"!=e[e.length-1];return r||u?new RegExp("".concat(r?"^":"","(?:").concat(e,")").concat(u?"$":""),null!==(i=t.flags)&&void 0!==i?i:t.ignoreCase?"i":""):t}function Hp(t,n,i,e){var r=t.selection.main,u=i-r.from,o=e-r.from;return Object.assign(Object.assign({},t.changeByRange((function(s){return s!=r&&i!=e&&t.sliceDoc(s.from+u,s.from+o)!=t.sliceDoc(i,e)?{range:s}:{changes:{from:s.from+u,to:e==r.from?s.to:s.from+o,insert:n},range:m.cursor(s.from+u+n.length)}}))),{userEvent:"input.complete"})}function zp(t){if(!Array.isArray(t))return t;var n=So.get(t);return n||So.set(t,n=Bp(t)),n}function Wp(t,n){return t?n?t+" "+n:t:n}function Vp(t,n,i,e,r){var u,o,s,h=t.textDirection==An.RTL,f=h,a=!1,c="top",l=n.left-r.left,v=r.right-n.right,d=e.right-e.left,y=e.bottom-e.top;return f&&l<Math.min(d,v)?f=!1:!f&&v<Math.min(d,l)&&(f=!0),d<=(f?l:v)?(u=Math.max(r.top,Math.min(i.top,r.bottom-y))-n.top,o=Math.min(400,f?l:v)):(a=!0,o=Math.min(400,(h?n.right:r.right-n.left)-30),(s=r.bottom-n.bottom)>=y||s>n.top?u=i.bottom-n.top:(c="bottom",u=n.bottom-i.top)),{style:"".concat(c,": ").concat(u,"px; max-width: ").concat(o,"px"),class:"cm-completionInfo-"+(a?h?"left-narrow":"right-narrow":f?"left":"right")}}function Up(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"option";return function(i){var e,r,u,o,s=i.state.field(qo,!1);return!(!s||!s.open||s.open.disabled||Date.now()-s.open.timestamp<i.state.facet(Do).interactionDelay)&&(e=1,"page"==n&&(r=Kd(i,s.open.tooltip))&&(e=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1)),u=s.open.options.length,(o=s.open.selected>-1?s.open.selected+e*(t?1:-1):t?0:u-1)<0?o="page"==n?0:u-1:o>=u&&(o="page"==n?u-1:0),i.dispatch({effects:$o.of(o)}),!0)}}function $p(t,n){var i=n.completion.apply||n.completion.label,e=t.state.field(qo).active.find((function(t){return t.source==n.source}));return e instanceof Vo&&("string"==typeof i?t.dispatch(Object.assign(Object.assign({},Hp(t.state,i,e.from,e.to)),{annotations:xo.of(n.completion)})):i(t,n.completion,e.from,e.to),!0)}function qp(t){var n=t.addToOptions.slice();return t.icons&&n.push({render:function t(n){var i,e=document.createElement("div");return e.classList.add("cm-completionIcon"),n.type&&(i=e.classList).add.apply(i,Ja(n.type.split(/\s+/g).map((function(t){return"cm-completionIcon-"+t})))),e.setAttribute("aria-hidden","true"),e},position:20}),n.push({render:function t(n,i,e){var r,u,o,s,h,f,a=document.createElement("span");for(a.className="cm-completionLabel",r=n.label,u=0,o=1;o<e.length;)s=e[o++],h=e[o++],s>u&&a.appendChild(document.createTextNode(r.slice(u,s))),(f=a.appendChild(document.createElement("span"))).appendChild(document.createTextNode(r.slice(s,h))),f.className="cm-completionMatchedText",u=h;return u<r.length&&a.appendChild(document.createTextNode(r.slice(u))),a},position:50},{render:function t(n){if(!n.detail)return null;var i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=n.detail,i},position:80}),n.sort((function(t,n){return t.position-n.position})).map((function(t){return t.render}))}function Gp(t,n,i){var e,r;return t<=i?{from:0,to:t}:(n<0&&(n=0),n<=t>>1?{from:(e=Math.floor(n/i))*i,to:(e+1)*i}:{from:t-((r=Math.floor((t-n)/i))+1)*i,to:t-r*i})}function Jp(t){return function(n){return new No(n,t)}}function Kp(t,n){var i=t.getBoundingClientRect(),e=n.getBoundingClientRect();e.top<i.top?t.scrollTop-=i.top-e.top:e.bottom>i.bottom&&(t.scrollTop+=e.bottom-i.bottom)}function Qp(t){return 100*(t.boost||0)+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Xp(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j=[],T=null,B=function t(n){var i,e;j.push(n),(i=n.completion.section)&&(T||(T=[]),e="string"==typeof i?i:i.name,T.some((function(t){return t.name==e}))||T.push("string"==typeof i?{name:e}:i))},_=ic(t);try{for(_.s();!(i=_.n()).done;)if((e=i.value).hasResult())if(!1===e.result.filter){r=e.result.getMatch,u=ic(e.result.options);try{for(u.s();!(o=u.n()).done;){if(s=o.value,h=[1e9-j.length],r){f=ic(r(s));try{for(f.s();!(a=f.n()).done;)c=a.value,h.push(c)}catch(t){f.e(t)}finally{f.f()}}B(new Mo(s,e.source,h,h[0]))}}catch(t){u.e(t)}finally{u.f()}}else{l=new Ao(n.sliceDoc(e.from,e.to)),v=void 0,d=ic(e.result.options);try{for(d.s();!(y=d.n()).done;)p=y.value,(v=l.match(p.label))&&B(new Mo(p,e.source,v,v[0]+(p.boost||0)))}catch(t){d.e(t)}finally{d.f()}}}catch(t){_.e(t)}finally{_.f()}if(T){k=Object.create(null),m=0,g=function t(n,i){var e,r;return(null!==(e=n.rank)&&void 0!==e?e:1e9)-(null!==(r=i.rank)&&void 0!==r?r:1e9)||(n.name<i.name?-1:1)},w=ic(T.sort(g));try{for(w.s();!(b=w.n()).done;)M=b.value,m-=1e5,k[M.name]=m}catch(t){w.e(t)}finally{w.f()}x=ic(j);try{for(x.s();!(S=x.n()).done;)(O=(C=S.value).completion.section)&&(C.score+=k["string"==typeof O?O:O.name])}catch(t){x.e(t)}finally{x.f()}}A=[],D=null,E=n.facet(Do).compareCompletions,I=ic(j.sort((function(t,n){return n.score-t.score||E(t.completion,n.completion)})));try{for(I.s();!(R=I.n()).done;)L=R.value,!D||D.label!=L.completion.label||D.detail!=L.completion.detail||null!=D.type&&null!=L.completion.type&&D.type!=L.completion.type||D.apply!=L.completion.apply?A.push(L):Qp(L.completion)>Qp(D)&&(A[A.length-1]=L),D=L.completion}catch(t){I.e(t)}finally{I.f()}return A}function Zp(t,n){var i,e,r,u;if(t==n)return!0;for(i=0,e=0;;){for(;i<t.length&&!t[i].hasResult;)i++;for(;e<n.length&&!n[e].hasResult;)e++;if(r=i==t.length,u=e==n.length,r||u)return r==u;if(t[i++].result!=n[e++].result)return!1}}function Yp(t,n){var i={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":t};return n>-1&&(i["aria-activedescendant"]=t+"-"+n),i}function tk(t){return t.isUserEvent("input.type")?"input":t.isUserEvent("delete.backward")?"delete":null}function nk(t,n,i,e){if(!t)return!1;var r=n.sliceDoc(i,e);return"function"==typeof t?t(r,i,e,n):Fp(t,!0).test(r)}function ik(t,n){return m.create(t.filter((function(t){return t.field==n})).map((function(t){return m.range(t.from,t.to)})))}function ek(t){var n=Qo.parse(t);return function(t,e,r,u){var o,s,h=n.instantiate(t.state,r),f=h.text,a=h.ranges,c={changes:{from:r,to:u,insert:i.of(f)},scrollIntoView:!0,annotations:e?xo.of(e):void 0};a.length&&(c.selection=ik(a,0)),a.length>1&&(o=new Yo(a,0),s=c.effects=[ts.of(o)],void 0===t.state.field(is,!1)&&s.push(U.appendConfig.of([is,hs,fs,Go]))),t.dispatch(t.state.update(c))}}function rk(t){return function(n){var i,e,r=n.state,u=n.dispatch,o=r.field(is,!1);return!(!o||t<0&&0==o.active)&&(i=o.active+t,e=t>0&&!o.ranges.some((function(n){return n.field==i+t})),u(r.update({selection:ik(o.ranges,i),effects:ts.of(e?null:new Yo(o.ranges,i))})),!0)}}function uk(t){var n=t.field(is,!1);return!(!n||!n.ranges.some((function(t){return t.field==n.active+1})))}function ok(t){var n=t.field(is,!1);return!!(n&&n.active>0)}function sk(t,n){return Object.assign(Object.assign({},n),{apply:ek(t)})}function hk(t){var n=t.replace(/[\\[.+*?(){|^$]/g,"\\$&");try{return new RegExp("[\\p{Alphabetic}\\p{Number}_".concat(n,"]+"),"ug")}catch(t){return new RegExp("[w".concat(n,"]"),"g")}}function fk(t,n){return new RegExp(n(t.source),t.unicode?"u":"")}function ak(t){return as[t]||(as[t]=new WeakMap)}function ck(t,n,i,e,r){var u,o,s,h;for(u=t.iterLines(),o=0;!u.next().done;){for(s=u.value,h=void 0,n.lastIndex=0;h=n.exec(s);)if(!e[h[0]]&&o+h.index!=r&&(i.push({type:"text",label:h[0]}),e[h[0]]=!0,i.length>=2e3))return;o+=s.length+1}}function lk(t,n,i,e,r){var u,o,s,h,f,a,c,l,v,d=t.length>=1e3,y=d&&n.get(t);if(y)return y;if(u=[],o=Object.create(null),t.children){s=0,h=ic(t.children);try{for(h.s();!(f=h.n()).done;){if((a=f.value).length>=1e3){c=ic(lk(a,n,i,e-s,r-s));try{for(c.s();!(l=c.n()).done;)o[(v=l.value).label]||(o[v.label]=!0,u.push(v))}catch(t){c.e(t)}finally{c.f()}}else ck(a,i,u,o,r-s);s+=a.length+1}}catch(t){h.e(t)}finally{h.f()}}else ck(t,i,u,o,r);return d&&u.length<2e3&&n.set(t,u),u}function vk(){return[ms,ys]}function dk(t){for(var n=0;n<ps.length;n+=2)if(ps.charCodeAt(n)==t)return ps.charAt(n+1);return Rc(t<128?t:t+1)}function yk(t,n){return t.languageDataAt("closeBrackets",n)[0]||ls}function pk(t,n){var i,e,r,u=yk(t,t.selection.main.head),o=u.brackets||ls.brackets,s=ic(o);try{for(s.s();!(i=s.n()).done;){if(r=dk(Ic(e=i.value,0)),n==e)return r==e?Mk(t,e,o.indexOf(e+e+e)>-1,u):wk(t,e,r,u.before||ls.before);if(n==r&&kk(t,t.selection.main.from))return bk(t,e,r)}}catch(t){s.e(t)}finally{s.f()}return null}function kk(t,n){var i=!1;return t.field(ys).between(0,t.doc.length,(function(t){t==n&&(i=!0)})),i}function mk(t,n){var i=t.sliceString(n,n+2);return i.slice(0,Lc(Ic(i,0)))}function gk(t,n){var i=t.sliceString(n-2,n);return Lc(Ic(i,0))==i.length?i:i.slice(1)}function wk(t,n,i,e){var r=null,u=t.changeByRange((function(u){if(!u.empty)return{changes:[{insert:n,from:u.from},{insert:i,from:u.to}],effects:vs.of(u.to+n.length),range:m.range(u.anchor+n.length,u.head+n.length)};var o=mk(t.doc,u.head);return!o||/\s/.test(o)||e.indexOf(o)>-1?{changes:{insert:n+i,from:u.head},effects:vs.of(u.head+n.length),range:m.cursor(u.head+n.length)}:{range:r=u}}));return r?null:t.update(u,{scrollIntoView:!0,userEvent:"input.type"})}function bk(t,n,i){var e=null,r=t.changeByRange((function(n){return n.empty&&mk(t.doc,n.head)==i?{changes:{from:n.head,to:n.head+i.length,insert:i},range:m.cursor(n.head+i.length)}:e={range:n}}));return e?null:t.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function Mk(t,n,i,e){var r=e.stringPrefixes||ls.stringPrefixes,u=null,o=t.changeByRange((function(e){var o,s,h,f,a;if(!e.empty)return{changes:[{insert:n,from:e.from},{insert:n,from:e.to}],effects:vs.of(e.to+n.length),range:m.range(e.anchor+n.length,e.head+n.length)};if(o=e.head,(s=mk(t.doc,o))==n){if(xk(t,o))return{changes:{insert:n+n,from:o},effects:vs.of(o+n.length),range:m.cursor(o+n.length)};if(kk(t,o))return{changes:{from:o,to:o+(a=(f=i&&t.sliceDoc(o,o+3*n.length)==n+n+n)?n+n+n:n).length,insert:a},range:m.cursor(o+a.length)}}else{if(i&&t.sliceDoc(o-2*n.length,o)==n+n&&(h=Ck(t,o-2*n.length,r))>-1&&xk(t,h))return{changes:{insert:n+n+n+n,from:o},effects:vs.of(o+n.length),range:m.cursor(o+n.length)};if(t.charCategorizer(o)(s)!=G.Word&&Ck(t,o,r)>-1&&!Sk(t,o,n,r))return{changes:{insert:n+n,from:o},effects:vs.of(o+n.length),range:m.cursor(o+n.length)}}return{range:u=e}}));return u?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function xk(t,n){var i=Ly(t).resolveInner(n+1);return i.parent&&i.from==n}function Sk(t,n,i,e){var r,u,o,s,h,f=Ly(t).resolveInner(n,-1),a=e.reduce((function(t,n){return Math.max(t,n.length)}),0);for(r=0;r<5;r++){if(!(o=(u=t.sliceDoc(f.from,Math.min(f.to,f.from+i.length+a))).indexOf(i))||o>-1&&e.indexOf(u.slice(0,o))>-1){for(s=f.firstChild;s&&s.from==f.from&&s.to-s.from>i.length+o;){if(t.sliceDoc(s.to-i.length,s.to)==i)return!1;s=s.firstChild}return!0}if(!(h=f.to==n&&f.parent))break;f=h}return!1}function Ck(t,n,i){var e,r,u,o,s=t.charCategorizer(n);if(s(t.sliceDoc(n-1,n))!=G.Word)return n;e=ic(i);try{for(e.s();!(r=e.n()).done;)if(o=n-(u=r.value).length,t.sliceDoc(o,n)==u&&s(t.sliceDoc(o-1,o))!=G.Word)return o}catch(t){e.e(t)}finally{e.f()}return-1}function Ok(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[qo,Do.of(t),_o,Ms,Go]}function Ak(t){var n=t.field(qo,!1);return n&&n.active.some((function(t){return 1==t.state}))?"pending":n&&n.active.some((function(t){return 0!=t.state}))?"active":null}function Dk(t){var n,i,e=null===(n=t.field(qo,!1))||void 0===n?void 0:n.open;return!e||e.disabled?[]:((i=xs.get(e.options))||xs.set(e.options,i=e.options.map((function(t){return t.completion}))),i)}function Ek(t){var n,i=null===(n=t.field(qo,!1))||void 0===n?void 0:n.open;return i&&!i.disabled&&i.selected>=0?i.options[i.selected].completion:null}function Ik(t){var n,i=null===(n=t.field(qo,!1))||void 0===n?void 0:n.open;return i&&!i.disabled&&i.selected>=0?i.selected:null}function Rk(t){return $o.of(t)}function Lk(t,n){return function(i){var e,r=i.state,u=i.dispatch;return!r.readOnly&&(!!(e=t(n,r))&&(u(r.update(e)),!0))}}function jk(t,n){var i=t.languageDataAt("commentTokens",n);return i.length?i[0]:{}}function Tk(t,n,i,e){var r,u,o,s,h,f=n.open,a=n.close,c=t.sliceDoc(i-js,i),l=t.sliceDoc(e,e+js),v=/\s*$/.exec(c)[0].length,d=/^\s*/.exec(l)[0].length,y=c.length-v;return c.slice(y-f.length,y)==f&&l.slice(d,d+a.length)==a?{open:{pos:i-v,margin:v&&1},close:{pos:e+d,margin:d&&1}}:(e-i<=2*js?r=u=t.sliceDoc(i,e):(r=t.sliceDoc(i,i+js),u=t.sliceDoc(e-js,e)),o=/^\s*/.exec(r)[0].length,s=/\s*$/.exec(u)[0].length,h=u.length-s-a.length,r.slice(o,o+f.length)==f&&u.slice(h,h+a.length)==a?{open:{pos:i+o+f.length,margin:/\s/.test(r.charAt(o+f.length))?1:0},close:{pos:e-s-a.length,margin:/\s/.test(u.charAt(h-1))?1:0}}:null)}function Bk(t){var n,i,e,r,u,o=[],s=ic(t.selection.ranges);try{for(s.s();!(n=s.n()).done;)i=n.value,e=t.doc.lineAt(i.from),r=i.to<=e.to?e:t.doc.lineAt(i.to),(u=o.length-1)>=0&&o[u].to>e.from?o[u].to=r.to:o.push({from:e.from+/^\s*/.exec(e.text)[0].length,to:r.to})}catch(t){s.e(t)}finally{s.f()}return o}function _k(t,n){var i,e,r,u,o,s,h,f,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.selection.ranges,c=a.map((function(t){return jk(n,t.from).block}));if(!c.every((function(t){return t})))return null;if(i=a.map((function(t,i){return Tk(n,c[i],t.from,t.to)})),2!=t&&!i.every((function(t){return t})))return{changes:n.changes(a.map((function(t,n){return i[n]?[]:[{from:t.from,insert:c[n].open+" "},{from:t.to,insert:" "+c[n].close}]})))};if(1!=t&&i.some((function(t){return t}))){for(e=[],r=0;r<i.length;r++)(u=i[r])&&(o=c[r],h=(s=u).open,f=s.close,e.push({from:h.pos-o.open.length,to:h.pos+h.margin},{from:f.pos-f.margin,to:f.pos+o.close.length}));return{changes:e}}return null}function Nk(t,n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n.selection.ranges,B=[],_=-1,N=ic(T);try{for(N.s();!(i=N.n()).done;)if(r=(e=i.value).from,u=e.to,o=B.length,s=1e9,h=jk(n,r).line){for(f=r;f<=u;)(a=n.doc.lineAt(f)).from>_&&(r==u||u>a.from)&&(_=a.from,l=(c=/^\s*/.exec(a.text)[0].length)==a.length,v=a.text.slice(c,c+h.length)==h?c:-1,c<a.text.length&&c<s&&(s=c),B.push({line:a,comment:v,token:h,indent:c,empty:l,single:!1})),f=a.to+1;if(s<1e9)for(d=o;d<B.length;d++)B[d].indent<B[d].line.text.length&&(B[d].indent=s);B.length==o+1&&(B[o].single=!0)}}catch(t){N.e(t)}finally{N.f()}if(2!=t&&B.some((function(t){return t.comment<0&&(!t.empty||t.single)}))){y=[],p=ic(B);try{for(p.s();!(k=p.n()).done;)g=(m=k.value).line,w=m.token,b=m.indent,M=m.empty,!(x=m.single)&&M||y.push({from:g.from+b,insert:w+" "})}catch(t){p.e(t)}finally{p.f()}return{changes:S=n.changes(y),selection:n.selection.map(S,1)}}if(1!=t&&B.some((function(t){return t.comment>=0}))){C=[],O=ic(B);try{for(O.s();!(A=O.n()).done;)E=(D=A.value).line,I=D.comment,R=D.token,I>=0&&(j=(L=E.from+I)+R.length," "==E.text[j-E.from]&&j++,C.push({from:L,to:j}))}catch(t){O.e(t)}finally{O.f()}return{changes:C}}return null}function Pk(t){var n=0;return t.iterChangedRanges((function(t,i){return n=i})),n}function Fk(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Ps,Ns.of(t),Ui.domEventHandlers({beforeinput:function t(n,i){var e="historyUndo"==n.inputType?Hs:"historyRedo"==n.inputType?zs:null;return!!e&&(n.preventDefault(),e(i))}})]}function Hk(t,n){return function(i){var e,r,u=i.state,o=i.dispatch;return!(!n&&u.readOnly)&&(!!(e=u.field(Ps,!1))&&(!!(r=e.pop(t,u,n))&&(o(r),!0)))}}function zk(t){return function(n){var i,e=n.field(Ps,!1);return e?(i=0==t?e.done:e.undone).length-(i.length&&!i[0].changes?1:0):0}}function Wk(t,n,i,e){var r=n+1>i+20?n-i-1:0,u=t.slice(r,n);return u.push(e),u}function Vk(t,n){var i=[],e=!1;return t.iterChangedRanges((function(t,n){return i.push(t,n)})),n.iterChangedRanges((function(t,n,r,u){var o,s,h;for(o=0;o<i.length;)s=i[o++],h=i[o++],u>=s&&r<=h&&(e=!0)})),e}function Uk(t,n){return t.ranges.length==n.ranges.length&&0===t.ranges.filter((function(t,i){return t.empty!=n.ranges[i].empty})).length}function $k(t,n){return t.length?n.length?t.concat(n):t:n}function qk(t,n){var i,e;return t.length?(e=(i=t[t.length-1]).selectionsAfter.slice(Math.max(0,i.selectionsAfter.length-Js))).length&&e[e.length-1].eq(n)?t:(e.push(n),Wk(t,t.length-1,1e9,i.setSelAfter(e))):[qs.selection([n])]}function Gk(t){var n=t[t.length-1],i=t.slice();return i[t.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),i}function Jk(t,n){var i,e,r,u;if(!t.length)return t;for(i=t.length,e=Gs;i;){if((r=Kk(t[i-1],n,e)).changes&&!r.changes.empty||r.effects.length)return(u=t.slice(0,i))[i-1]=r,u;n=r.mapped,i--,e=r.selectionsAfter}return e.length?[qs.selection(e)]:Gs}function Kk(t,n,i){var e,r,u,o=$k(t.selectionsAfter.length?t.selectionsAfter.map((function(t){return t.map(n)})):Gs,i);return t.changes?(e=t.changes.map(n),r=n.mapDesc(t.changes,!0),u=t.mapped?t.mapped.composeDesc(r):r,new qs(e,U.mapEffects(t.effects,n),u,t.startSelection.map(r),o)):qs.selection(o)}function Qk(t,n){return m.create(t.ranges.map(n),t.mainIndex)}function Xk(t,n){return t.update({selection:n,scrollIntoView:!0,userEvent:"select"})}function Zk(t,n){var i=t.state,e=t.dispatch,r=Qk(i.selection,n);return!r.eq(i.selection)&&(e(Xk(i,r)),!0)}function Yk(t,n){return m.cursor(n?t.to:t.from)}function tm(t,n){return Zk(t,(function(i){return i.empty?t.moveByChar(i,n):Yk(i,n)}))}function nm(t){return t.textDirectionAt(t.state.selection.main.head)==An.LTR}function im(t,n){return Zk(t,(function(i){return i.empty?t.moveByGroup(i,n):Yk(i,n)}))}function em(t,n,i){var e=t.state.charCategorizer(n.from);return t.moveByChar(n,i,(function(r){var u=G.Space,o=n.from,s=!1,h=!1,f=!1,a=function n(r){if(s)return!1;o+=i?r.length:-r.length;var a=e(r),c;if(a==G.Word&&r.charCodeAt(0)<128&&/[\W_]/.test(r)&&(a=-1),u==G.Space&&(u=a),u!=a)return!1;if(u==G.Word)if(r.toLowerCase()==r){if(!i&&h)return!1;f=!0}else if(f){if(i)return!1;s=!0}else{if(h&&i&&e(c=t.state.sliceDoc(o,o+1))==G.Word&&c.toLowerCase()==c)return!1;h=!0}return!0};return a(r),a}))}function rm(t,n){return Zk(t,(function(i){return i.empty?em(t,i,n):Yk(i,n)}))}function um(t,n,i){if(n.type.prop(i))return!0;var e=n.to-n.from;return e&&(e>2||/[^\s,.;:]/.test(t.sliceDoc(n.from,n.to)))||n.firstChild}function om(t,n,i){var e,r,u,o,s,h=Ly(t).resolveInner(n.head),f=i?pr.closedBy:pr.openedBy;for(e=n.head;r=i?h.childAfter(e):h.childBefore(e);)um(t,r,f)?h=r:e=i?r.to:r.from;return s=(u=h.type.prop(f))&&(o=i?wp(t,h.from,1):wp(t,h.to,-1))&&o.matched?i?o.end.to:o.end.from:i?h.to:h.from,m.cursor(s,i?-1:1)}function sm(t,n){return Zk(t,(function(i){if(!i.empty)return Yk(i,n);var e=t.moveVertically(i,n);return e.head!=i.head?e:t.moveToLineBoundary(i,n)}))}function hm(t){var n,i,e,r,u,o=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,s=0,h=0;if(o){i=ic(t.state.facet(Ui.scrollMargins));try{for(i.s();!(e=i.n()).done;)(null==(u=(r=e.value)(t))?void 0:u.top)&&(s=Math.max(null==u?void 0:u.top,s)),(null==u?void 0:u.bottom)&&(h=Math.max(null==u?void 0:u.bottom,h))}catch(t){i.e(t)}finally{i.f()}n=t.scrollDOM.clientHeight-s-h}else n=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:s,marginBottom:h,selfScroll:o,height:Math.max(t.defaultLineHeight,n-5)}}function fm(t,n){var i,e,r,u,o,s=hm(t),h=t.state,f=Qk(h.selection,(function(i){return i.empty?t.moveVertically(i,n,s.height):Yk(i,n)}));return!f.eq(h.selection)&&(s.selfScroll&&(e=t.coordsAtPos(h.selection.main.head),u=(r=t.scrollDOM.getBoundingClientRect()).top+s.marginTop,o=r.bottom-s.marginBottom,e&&e.top>u&&e.bottom<o&&(i=Ui.scrollIntoView(f.main.head,{y:"start",yMargin:e.top-u}))),t.dispatch(Xk(h,f),{effects:i}),!0)}function am(t,n,i){var e,r=t.lineBlockAt(n.head),u=t.moveToLineBoundary(n,i);return u.head==n.head&&u.head!=(i?r.to:r.from)&&(u=t.moveToLineBoundary(n,i,!1)),!i&&u.head==r.from&&r.length&&(e=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length)&&n.head!=r.from+e&&(u=m.cursor(r.from+e)),u}function cm(t,n,i){var e=!1,r=Qk(t.selection,(function(n){var r,u=wp(t,n.head,-1)||wp(t,n.head,1)||n.head>0&&wp(t,n.head-1,1)||n.head<t.doc.length&&wp(t,n.head+1,-1);return u&&u.end?(e=!0,r=u.start.from==n.head?u.end.to:u.end.from,i?m.range(n.anchor,r):m.cursor(r)):n}));return!!e&&(n(Xk(t,r)),!0)}function lm(t,n){var i=Qk(t.state.selection,(function(t){var i=n(t);return m.range(t.anchor,i.head,i.goalColumn,i.bidiLevel||void 0)}));return!i.eq(t.state.selection)&&(t.dispatch(Xk(t.state,i)),!0)}function vm(t,n){return lm(t,(function(i){return t.moveByChar(i,n)}))}function dm(t,n){return lm(t,(function(i){return t.moveByGroup(i,n)}))}function ym(t,n){return lm(t,(function(i){return em(t,i,n)}))}function pm(t,n){return lm(t,(function(i){return t.moveVertically(i,n)}))}function km(t,n){return lm(t,(function(i){return t.moveVertically(i,n,hm(t).height)}))}function mm(t,n){var i,e,r;return!t.state.readOnly&&(i="delete.selection",!(r=(e=t.state).changeByRange((function(e){var r,u=e.from,o=e.to;return u==o?((r=n(u))<u?(i="delete.backward",r=gm(t,r,!1)):r>u&&(i="delete.forward",r=gm(t,r,!0)),u=Math.min(u,r),o=Math.max(o,r)):(u=gm(t,u,!1),o=gm(t,o,!0)),u==o?{range:e}:{changes:{from:u,to:o},range:m.cursor(u)}}))).changes.empty&&(t.dispatch(e.update(r,{scrollIntoView:!0,userEvent:i,effects:"delete.selection"==i?Ui.announce.of(e.phrase("Selection deleted")):void 0})),!0))}function gm(t,n,i){var e,r,u;if(t instanceof Ui){e=ic(t.state.facet(Ui.atomicRanges).map((function(n){return n(t)})));try{for(e.s();!(r=e.n()).done;)(u=r.value).between(n,n,(function(t,e){t<n&&e>n&&(n=i?e:t)}))}catch(t){e.e(t)}finally{e.f()}}return n}function wm(t){var n,i,e,r,u,o=[],s=-1,h=ic(t.selection.ranges);try{for(h.s();!(n=h.n()).done;)i=n.value,e=t.doc.lineAt(i.from),r=t.doc.lineAt(i.to),i.empty||i.to!=r.from||(r=t.doc.lineAt(i.to-1)),s>=e.number?((u=o[o.length-1]).to=r.to,u.ranges.push(i)):o.push({from:e.from,to:r.to,ranges:[i]}),s=r.number+1}catch(t){h.e(t)}finally{h.f()}return o}function bm(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y;if(t.readOnly)return!1;e=[],r=[],u=ic(wm(t));try{for(u.s();!(o=u.n()).done;)if(s=o.value,i?s.to!=t.doc.length:0!=s.from)if(f=(h=t.doc.lineAt(i?s.to+1:s.from-1)).length+1,i){e.push({from:s.to,to:h.to},{from:s.from,insert:h.text+t.lineBreak}),a=ic(s.ranges);try{for(a.s();!(c=a.n()).done;)l=c.value,r.push(m.range(Math.min(t.doc.length,l.anchor+f),Math.min(t.doc.length,l.head+f)))}catch(t){a.e(t)}finally{a.f()}}else{e.push({from:h.from,to:s.from},{from:s.to,insert:t.lineBreak+h.text}),v=ic(s.ranges);try{for(v.s();!(d=v.n()).done;)y=d.value,r.push(m.range(y.anchor-f,y.head-f))}catch(t){v.e(t)}finally{v.f()}}}catch(t){u.e(t)}finally{u.f()}return!!e.length&&(n(t.update({changes:e,scrollIntoView:!0,selection:m.create(r,t.selection.mainIndex),userEvent:"move.line"})),!0)}function Mm(t,n,i){var e,r,u,o;if(t.readOnly)return!1;e=[],r=ic(wm(t));try{for(r.s();!(u=r.n()).done;)o=u.value,i?e.push({from:o.from,insert:t.doc.slice(o.from,o.to)+t.lineBreak}):e.push({from:o.to,insert:t.lineBreak+t.doc.slice(o.from,o.to)})}catch(t){r.e(t)}finally{r.f()}return n(t.update({changes:e,scrollIntoView:!0,userEvent:"input.copyline"})),!0}function xm(t,n){var i,e,r,u;return/\(\)|\[\]|\{\}/.test(t.sliceDoc(n-1,n+1))?{from:n,to:n}:(e=(i=Ly(t).resolveInner(n)).childBefore(n),r=i.childAfter(n),e&&r&&e.to<=n&&r.from>=n&&(u=e.type.prop(pr.closedBy))&&u.indexOf(r.name)>-1&&t.doc.lineAt(e.to).from==t.doc.lineAt(r.from).from?{from:e.to,to:r.from}:null)}function Sm(t){return function(n){var e,r=n.state,u=n.dispatch;return!r.readOnly&&(e=r.changeByRange((function(n){var e,u,o,s=n.from,h=n.to,f=r.doc.lineAt(s),a=!t&&s==h&&xm(r,s);for(t&&(s=h=(h<=f.to?f:r.doc.lineAt(h)).to),null==(u=Hy(e=new wu(r,{simulateBreak:s,simulateDoubleBreak:!!a}),s))&&(u=/^\s*/.exec(r.doc.lineAt(s).text)[0].length);h<f.to&&/\s/.test(f.text[h-f.from]);)h++;return a?(s=a.from,h=a.to):s>f.from&&s<f.from+100&&!/\S/.test(f.text.slice(0,s))&&(s=f.from),o=["",Fy(r,u)],a&&o.push(Fy(r,e.lineIndent(f.from,-1))),{changes:{from:s,to:h,insert:i.of(o)},range:m.cursor(s+1+o[1].length)}})),u(r.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)}}function Cm(t,n){var i=-1;return t.changeByRange((function(e){var r,u,o,s=[];for(r=e.from;r<=e.to;)(u=t.doc.lineAt(r)).number>i&&(e.empty||e.to>u.from)&&(n(u,s,e),i=u.number),r=u.to+1;return o=t.changes(s),{changes:s,range:m.range(o.mapPos(e.anchor,1),o.mapPos(e.head,1))}}))}function Om(){var t,n,i,e,r=arguments[0];if("string"==typeof r&&(r=document.createElement(r)),t=1,(n=arguments[1])&&"object"==dc(n)&&null==n.nodeType&&!Array.isArray(n)){for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&("string"==typeof(e=n[i])?r.setAttribute(i,e):null!=e&&(r[i]=e));t++}for(;t<arguments.length;t++)Am(r,arguments[t]);return r}function Am(t,n){if("string"==typeof n)t.appendChild(document.createTextNode(n));else if(null==n);else if(null!=n.nodeType)t.appendChild(n);else{if(!Array.isArray(n))throw new RangeError("Unsupported child node: "+n);for(var i=0;i<n.length;i++)Am(t,n[i])}}function Dm(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,e=null;return t.between(i,1e9,(function(t,i,r){var u=r.spec;if(!n||u.diagnostic==n)return e=new Af(t,i,u.diagnostic),!1})),e}function Em(t,n){return!(!t.effects.some((function(t){return t.is(Ef)}))&&!t.changes.touchesRange(n.pos))}function Im(t,n){return t.field(Lf,!1)?n:n.concat(U.appendConfig.of(Qf))}function Rm(t,n){return{effects:Im(t,[Ef.of(n)])}}function Lm(t){var n=t.field(Lf,!1);return n?n.diagnostics.size:0}function jm(t,n,i){var e,r=t.state.field(Lf),u=r.diagnostics,o=[],s=2e8,h=0;return u.between(n-(i<0?1:0),n+(i>0?1:0),(function(t,e,r){var u=r.spec;n>=t&&n<=e&&(t==e||(n>t||i>0)&&(n<e||i<0))&&(o.push(u.diagnostic),s=Math.min(t,s),h=Math.max(e,h))})),(e=t.state.facet(Ff).tooltipFilter)&&(o=e(o)),o.length?{pos:s,end:h,above:t.state.doc.lineAt(s).to<h,create:function n(){return{dom:Tm(t,o)}}}:null}function Tm(t,n){return Om("ul",{class:"cm-tooltip-lint"},n.map((function(n){return Pm(t,n,!1)})))}function Bm(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return[Ff.of({source:t,config:n}),Pf,Qf]}function _m(t){var n=t.plugin(Pf);n&&n.force()}function Nm(t){var n,i,e,r,u,o=[];if(t){n=ic(t);try{t:for(n.s();!(i=n.n()).done;){for(e=i.value.name,r=function t(){var n=e[u];if(/[a-zA-Z]/.test(n)&&!o.some((function(t){return t.toLowerCase()==n.toLowerCase()})))return o.push(n),1},u=0;u<e.length;u++)if(r())continue t;o.push("")}}catch(t){n.e(t)}finally{n.f()}}return o}function Pm(t,n,i){var e,r=i?Nm(n.actions):[];return Om("li",{class:"cm-diagnostic cm-diagnostic-"+n.severity},Om("span",{class:"cm-diagnosticText"},n.renderMessage?n.renderMessage():n.message),null===(e=n.actions)||void 0===e?void 0:e.map((function(i,e){var u=!1,o=function e(r){if(r.preventDefault(),!u){u=!0;var o=Dm(t.state.field(Lf).diagnostics,n);o&&i.apply(t,o.from,o.to)}},s=i.name,h=r[e]?s.indexOf(r[e]):-1,f=h<0?s:[s.slice(0,h),Om("u",s.slice(h,h+1)),s.slice(h+1)];return Om("button",{type:"button",class:"cm-diagnosticAction",onclick:o,onmousedown:o,"aria-label":" Action: ".concat(s).concat(h<0?"":' (access key "'.concat(r[e],')"'),".")},f)})),n.source&&Om("div",{class:"cm-diagnosticSource"},n.source))}function Fm(t){var n;return'url(\'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" '.concat(arguments.length>1&&void 0!==arguments[1]?arguments[1]:'viewBox="0 0 40 40"',">").concat(encodeURIComponent(t),"</svg>')")}function Hm(t){return Fm('<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="'.concat(t,'" fill="none" stroke-width=".7"/>'),'width="6" height="3"')}function zm(t,n){var i=function i(e){var r,u=n.getBoundingClientRect();if(!(e.clientX>u.left-10&&e.clientX<u.right+10&&e.clientY>u.top-10&&e.clientY<u.bottom+10)){for(r=e.target;r;r=r.parentNode)if(1==r.nodeType&&r.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",i),t.state.field(Jf)&&t.dispatch({effects:Gf.of(null)})}};window.addEventListener("mousemove",i)}function Wm(t,n,i){var e,r,u;function o(){var e=t.elementAtHeight(n.getBoundingClientRect().top+5-t.documentTop),r=t.coordsAtPos(e.from);r&&t.dispatch({effects:Gf.of({pos:e.from,above:!1,create:function e(){return{dom:Tm(t,i),getCoords:function t(){return n.getBoundingClientRect()}}}})}),n.onmouseout=n.onmousemove=null,zm(t,n)}e=t.state.facet(Xf),r=e.hoverTime,u=setTimeout(o,r),n.onmouseout=function(){clearTimeout(u),n.onmouseout=n.onmousemove=null},n.onmousemove=function(){clearTimeout(u),u=setTimeout(o,r)}}function Vm(t,n){var i,e,r,u,o,s=Object.create(null),h=ic(n);try{for(h.s();!(i=h.n()).done;)e=i.value,(s[(r=t.lineAt(e.from)).from]||(s[r.from]=[])).push(e)}catch(t){h.e(t)}finally{h.f()}for(o in u=[],s)u.push(new Uf(s[o]).range(+o));return tt.of(u,!0)}function Um(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return[Xf.of(t),qf,$f,Kf,Jf]}function $m(t,n){var i,e=t.field(Lf,!1);if(e&&e.diagnostics.size)for(i=tt.iter([e.diagnostics]);i.value;i.next())n(i.value.spec.diagnostic,i.from,i.to)}function qm(t){try{return new RegExp(t,ia),!0}catch(t){return!1}}function Gm(t,n){if(n>=t.length)return n;for(var i=t.lineAt(n),e;n<i.to&&(e=i.text.charCodeAt(n-i.from))>=56320&&e<57344;)n++;return n}function Jm(t){var n=Om("input",{class:"cm-textfield",name:"line"}),i=Om("form",{class:"cm-gotoLine",onkeydown:function n(i){27==i.keyCode?(i.preventDefault(),t.dispatch({effects:sa.of(!1)}),t.focus()):13==i.keyCode&&(i.preventDefault(),e())},onsubmit:function t(n){n.preventDefault(),e()}},Om("label",t.state.phrase("Go to line"),": ",n)," ",Om("button",{class:"cm-button",type:"submit"},t.state.phrase("go")));function e(){var i,e,r,u,o,s,h,f,a,c,l,v=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);v&&(e=(i=t.state).doc.lineAt(i.selection.main.head),u=(r=Za(v,5))[1],o=r[2],s=r[3],h=r[4],f=s?+s.slice(1):0,a=o?+o:e.number,o&&h?(c=a/100,u&&(c=c*("-"==u?-1:1)+e.number/i.doc.lines),a=Math.round(i.doc.lines*c)):o&&u&&(a=a*("-"==u?-1:1)+e.number),l=i.doc.line(Math.max(1,Math.min(i.doc.lines,a))),t.dispatch({effects:sa.of(!1),selection:m.cursor(l.from+Math.max(0,Math.min(f,l.length))),scrollIntoView:!0}),t.focus())}return{dom:i}}function Km(t){var n=[pa,ya];return t&&n.push(la.of(t)),n}function Qm(t,n,i,e){return!(0!=i&&t(n.sliceDoc(i-1,i))==G.Word||e!=n.doc.length&&t(n.sliceDoc(e,e+1))==G.Word)}function Xm(t,n,i,e){return t(n.sliceDoc(i,i+1))==G.Word&&t(n.sliceDoc(e-1,e))==G.Word}function Zm(t,n){var i,e,r,u=t.selection,o=u.main,s=u.ranges,h=t.wordAt(o.head),f=h&&h.from==o.from&&h.to==o.to,a=function i(u,o){if(o.next(),!o.done){if(u&&s.some((function(t){return t.from==o.value.from})))return e=u,r=o,0;if(f){var h=t.wordAt(o.value.from);if(!h||h.from!=o.value.from||h.to!=o.value.to)return e=u,r=o,0}return{v:o.value}}if(u)return{v:null};o=new ta(t.doc,n,0,Math.max(0,s[s.length-1].from-1)),e=u=!0,r=o};for(e=!1,r=new ta(t.doc,n,s[s.length-1].to);;)if(0!==(i=a(e,r))&&i)return i.v}function Ym(t){return t?[ga.of(t),Ua]:Ua}function tg(t,n,i,e){return new ta(n.doc,t.unquoted,i,e,t.caseSensitive?void 0:function(t){return t.toLowerCase()},t.wholeWord?ng(n.doc,n.charCategorizer(n.selection.main.head)):void 0)}function ng(t,n){return function(i,e,r,u){return(u>i||u+r.length<e)&&(u=Math.max(0,i-2),r=t.sliceString(u,Math.min(t.length,e+2))),!(n(eg(r,i-u))==G.Word&&n(rg(r,i-u))==G.Word||n(rg(r,e-u))==G.Word&&n(eg(r,e-u))==G.Word)}}function ig(t,n,i,e){return new ea(n.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?ug(n.charCategorizer(n.selection.main.head)):void 0},i,e)}function eg(t,n){return t.slice(Cc(t,n,!1),n)}function rg(t,n){return t.slice(n,Cc(t,n))}function ug(t){return function(n,i,e){return!e[0].length||(t(eg(e.input,e.index))!=G.Word||t(rg(e.input,e.index))!=G.Word)&&(t(rg(e.input,e.index+e[0].length))!=G.Word||t(eg(e.input,e.index+e[0].length))!=G.Word)}}function og(t){var n=t.field(Oa,!1);return n?n.query.spec:ag(t)}function sg(t){var n;return null!=(null===(n=t.field(Oa,!1))||void 0===n?void 0:n.panel)}function hg(t){return function(n){var i=n.state.field(Oa,!1);return i&&i.query.spec.valid?t(n,i):Na(n)}}function fg(t){return t.state.facet(ga).createPanel(t)}function ag(t,n){var i,e,r,u,o,s=t.selection.main,h=s.empty||s.to>s.from+100?"":t.sliceDoc(s.from,s.to);return n&&!h?n:(o=t.facet(ga),new wa({search:(null!==(i=null==n?void 0:n.literal)&&void 0!==i?i:o.literal)?h:h.replace(/\n/g,"\\n"),caseSensitive:null!==(e=null==n?void 0:n.caseSensitive)&&void 0!==e?e:o.caseSensitive,literal:null!==(r=null==n?void 0:n.literal)&&void 0!==r?r:o.literal,wholeWord:null!==(u=null==n?void 0:n.wholeWord)&&void 0!==u?u:o.wholeWord}))}function cg(t){var n=Yd(t,fg);return n&&n.dom.querySelector("[main-field]")}function lg(t){var n=cg(t);n&&n==t.root.activeElement&&n.select()}function vg(t,n){return t.state.phrase(n)}function dg(t,n){var i,e,r=n.from,u=n.to,o=t.state.doc.lineAt(r),s=t.state.doc.lineAt(u).to,h=Math.max(o.from,r-za),f=Math.min(s,u+za),a=t.state.sliceDoc(h,f);if(h!=o.from)for(i=0;i<za;i++)if(!Wa.test(a[i+1])&&Wa.test(a[i])){a=a.slice(i);break}if(f!=s)for(e=a.length-1;e>a.length-za;e--)if(!Wa.test(a[e-1])&&Wa.test(a[e])){a=a.slice(0,e);break}return Ui.announce.of("".concat(t.state.phrase("current match"),". ").concat(a," ").concat(t.state.phrase("on line")," ").concat(o.number,"."))}go=new(mo=function(){function t(n){yc(this,t),this.extra=n,this.table=Object.assign(Object.create(null),co)}return kc(t,[{key:"resolve",value:function t(n){return n?this.table[n]||(this.table[n]=Rp(this.extra,n)):0}}]),t}())(so),wo=n.Language=Object.freeze({__proto__:null,DocInput:hu,HighlightStyle:Wu,IndentContext:wu,LRLanguage:su,Language:ou,LanguageDescription:ku,LanguageSupport:pu,ParseContext:au,StreamLanguage:uo,StringStream:eo,TreeIndentContext:Mu,bracketMatching:kp,bracketMatchingHandle:io,codeFolding:cp,continuedIndent:Xy,defaultHighlightStyle:Gu,defineLanguageFacet:Iy,delimitedIndent:Ky,ensureSyntaxTree:jy,flatIndent:xu,foldAll:Lu,foldCode:Iu,foldEffect:Au,foldGutter:lp,foldInside:Yy,foldKeymap:Bu,foldNodeProp:Ou,foldService:Cu,foldState:Eu,foldable:ip,foldedRanges:up,forceParsing:By,getIndentUnit:Py,getIndentation:Hy,highlightingFor:yp,indentNodeProp:bu,indentOnInput:Zy,indentRange:zy,indentService:mu,indentString:Fy,indentUnit:gu,language:yu,languageDataProp:ru,matchBrackets:wp,sublanguageProp:uu,syntaxHighlighting:dp,syntaxParserRunning:_y,syntaxTree:Ly,syntaxTreeAvailable:Ty,toggleFold:Tu,unfoldAll:ju,unfoldCode:Ru,unfoldEffect:Du}),bo=function(){function t(n,i,e){yc(this,t),this.state=n,this.pos=i,this.explicit=e,this.abortListeners=[]}return kc(t,[{key:"tokenBefore",value:function t(n){for(var i=Ly(this.state).resolveInner(this.pos,-1);i&&n.indexOf(i.name)<0;)i=i.parent;return i?{from:i.from,to:this.pos,text:this.state.sliceDoc(i.from,this.pos),type:i.type}:null}},{key:"matchBefore",value:function t(n){var i=this.state.doc.lineAt(this.pos),e=Math.max(i.from,this.pos-250),r=i.text.slice(e-i.from,this.pos-i.from),u=r.search(Fp(n,!1));return u<0?null:{from:e+u,to:this.pos,text:r.slice(u)}}},{key:"aborted",get:function t(){return null==this.abortListeners}},{key:"addEventListener",value:function t(n,i){"abort"==n&&this.abortListeners&&this.abortListeners.push(i)}}]),t}(),Mo=kc((function t(n,i,e,r){yc(this,t),this.completion=n,this.source=i,this.match=e,this.score=r})),xo=z.define(),So=new WeakMap,Co=U.define(),Oo=U.define(),Ao=function(){function t(n){var i,e,r,u,o;for(yc(this,t),this.pattern=n,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],i=0;i<n.length;)r=Lc(e=Ic(n,i)),this.chars.push(e),o=(u=n.slice(i,i+r)).toUpperCase(),this.folded.push(Ic(o==u?u.toLowerCase():o,0)),i+=r;this.astral=n.length!=this.chars.length}return kc(t,[{key:"match",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E;if(0==this.pattern.length)return[-100];if(n.length<this.pattern.length)return null;if(i=this.chars,e=this.folded,r=this.any,u=this.precise,o=this.byWord,1==i.length){if(f=(h=Lc(s=Ic(n,0)))==n.length?0:-100,s==i[0]);else{if(s!=e[0])return null;f+=-200}return[f,0,h]}if(0==(a=n.indexOf(this.pattern)))return[n.length==this.pattern.length?0:-100,0,this.pattern.length];if(c=i.length,l=0,a<0){for(v=0,d=Math.min(n.length,200);v<d&&l<c;)(y=Ic(n,v))!=i[l]&&y!=e[l]||(r[l++]=v),v+=Lc(y);if(l<c)return null}for(p=0,k=0,m=!1,g=0,w=-1,b=-1,M=/[a-z]/.test(n),x=!0,S=0,C=Math.min(n.length,200),O=0;S<C&&k<c;)A=Ic(n,S),a<0&&(p<c&&A==i[p]&&(u[p++]=S),g<c&&(A==i[g]||A==e[g]?(0==g&&(w=S),b=S+1,g++):g=0)),D=void 0,E=A<255?A>=48&&A<=57||A>=97&&A<=122?2:A>=65&&A<=90?1:0:(D=Rc(A))!=D.toLowerCase()?1:D!=D.toUpperCase()?2:0,(!S||1==E&&M||0==O&&0!=E)&&(i[k]==A||e[k]==A&&(m=!0)?o[k++]=S:o.length&&(x=!1)),O=E,S+=Lc(A);return k==c&&0==o[0]&&x?this.result((m?-200:0)-100,o,n):g==c&&0==w?[-200-n.length+(b==n.length?0:-100),0,b]:a>-1?[-700-n.length,a,a+this.pattern.length]:g==c?[-900-n.length,w,b]:k==c?this.result((m?-200:0)-100-700+(x?0:-1100),o,n):2==i.length?null:this.result((r[0]?-700:0)-200-1100,r,n)}},{key:"result",value:function t(n,i,e){var r,u,o,t=[n-e.length],s=1,h=ic(i);try{for(h.s();!(r=h.n()).done;)o=(u=r.value)+(this.astral?Lc(Ic(e,u)):1),s>1&&t[s-1]==u?t[s-1]=o:(t[s++]=u,t[s++]=o)}catch(t){h.e(t)}finally{h.f()}return t}}]),t}(),Do=w.define({combine:function t(n){return il(n,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:function t(){return""},optionClass:function t(){return""},aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Vp,compareCompletions:function t(n,i){return n.label.localeCompare(i.label)},interactionDelay:75},{defaultKeymap:function t(n,i){return n&&i},closeOnBlur:function t(n,i){return n&&i},icons:function t(n,i){return n&&i},tooltipClass:function t(n,i){return function(t){return Wp(n(t),i(t))}},optionClass:function t(n,i){return function(t){return Wp(n(t),i(t))}},addToOptions:function t(n,i){return n.concat(i)}})}}),Eo=function t(n){var i=n.state.field(qo,!1);return!(n.state.readOnly||!i||!i.open||i.open.selected<0||Date.now()-i.open.timestamp<n.state.facet(Do).interactionDelay)&&(!!i.open.disabled||$p(n,i.open.options[i.open.selected]))},Io=function t(n){var i;return!!n.state.field(qo,!1)&&(n.dispatch({effects:Co.of(!0)}),!0)},Ro=function t(n){var i=n.state.field(qo,!1);return!(!i||!i.active.some((function(t){return 0!=t.state})))&&(n.dispatch({effects:Oo.of(null)}),!0)},Lo=kc((function t(n,i){yc(this,t),this.active=n,this.context=i,this.time=Date.now(),this.updates=[],this.done=void 0})),jo=50,To=50,Bo=1e3,_o=kn.fromClass(function(){function t(n){var i,e,r;yc(this,t),this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0,i=ic(n.state.field(qo).active);try{for(i.s();!(e=i.n()).done;)1==(r=e.value).state&&this.startQuery(r)}catch(t){i.e(t)}finally{i.f()}}return kc(t,[{key:"update",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l=this,v=n.state.field(qo);if(n.selectionSet||n.docChanged||n.startState.field(qo)!=v){for(i=n.transactions.some((function(t){return(t.selection||t.docChanged)&&!tk(t)})),e=0;e<this.running.length;e++)if(r=this.running[e],i||r.updates.length+n.transactions.length>To&&Date.now()-r.time>Bo){u=ic(r.context.abortListeners);try{for(u.s();!(o=u.n()).done;){s=o.value;try{s()}catch(t){Yl(this.view.state,t)}}}catch(t){u.e(t)}finally{u.f()}r.context.abortListeners=null,this.running.splice(e--,1)}else(h=r.updates).push.apply(h,Ja(n.transactions));if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=v.active.some((function(t){return 1==t.state&&!l.running.some((function(n){return n.active.source==t.source}))}))?setTimeout((function(){return l.startUpdate()}),jo):-1,0!=this.composing){f=ic(n.transactions);try{for(f.s();!(a=f.n()).done;)"input"==tk(c=a.value)?this.composing=2:2==this.composing&&c.selection&&(this.composing=3)}catch(t){f.e(t)}finally{f.f()}}}}},{key:"startUpdate",value:function t(){var n,i,e,r,u,o=this;this.debounceUpdate=-1,e=ic((i=(n=this.view.state).field(qo)).active);try{for(u=function t(){var n=r.value;1!=n.state||o.running.some((function(t){return t.active.source==n.source}))||o.startQuery(n)},e.s();!(r=e.n()).done;)u()}catch(t){e.e(t)}finally{e.f()}}},{key:"startQuery",value:function t(n){var i=this,e=this.view.state,r=Pp(e),u=new bo(e,r,n.explicitPos==r),o=new Lo(n,u);this.running.push(o),Promise.resolve(n.source(u)).then((function(t){o.context.aborted||(o.done=t||null,i.scheduleAccept())}),(function(t){i.view.dispatch({effects:Oo.of(null)}),Yl(i.view.state,t)}))}},{key:"scheduleAccept",value:function t(){var n=this;this.running.every((function(t){return void 0!==t.done}))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((function(){return n.accept()}),jo))}},{key:"accept",value:function t(){var n,i,e,r,u,o,s=this;for(this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1,i=[],e=this.view.state.facet(Do),r=function t(r){var u,h,f,a,c,l,v,d,y,p=s.running[r];if(void 0===p.done)return o=r,0;if(s.running.splice(r--,1),p.done){u=new Vo(p.active.source,p.active.explicitPos,p.done,p.done.from,null!==(n=p.done.to)&&void 0!==n?n:Pp(p.updates.length?p.updates[0].startState:s.view.state)),h=ic(p.updates);try{for(h.s();!(f=h.n()).done;)a=f.value,u=u.update(a,e)}catch(t){h.e(t)}finally{h.f()}if(u.hasResult())return i.push(u),o=r,0}if((c=s.view.state.field(qo).active.find((function(t){return t.source==p.active.source})))&&1==c.state)if(null==p.done){l=new Wo(p.active.source,0),v=ic(p.updates);try{for(v.s();!(d=v.n()).done;)y=d.value,l=l.update(y,e)}catch(t){v.e(t)}finally{v.f()}1!=l.state&&i.push(l)}else s.startQuery(c);o=r},o=0;o<this.running.length;o++)u=r(o);i.length&&this.view.dispatch({effects:Uo.of(i)})}}]),t}(),{eventHandlers:{blur:function t(n){var i,e=this.view.state.field(qo,!1);e&&e.tooltip&&this.view.state.facet(Do).closeOnBlur&&((i=e.open&&Kd(this.view,e.open.tooltip))&&i.dom.contains(n.relatedTarget)||this.view.dispatch({effects:Oo.of(null)}))},compositionstart:function t(){this.composing=1},compositionend:function t(){var n=this;3==this.composing&&setTimeout((function(){return n.view.dispatch({effects:Co.of(!1)})}),20),this.composing=0}}}),No=function(){function t(n,i){var e,r,u,o,s,h=this;yc(this,t),this.view=n,this.stateField=i,this.info=null,this.placeInfoReq={read:function t(){return h.measureInfo()},write:function t(n){return h.placeInfo(n)},key:this},this.space=null,this.currentClass="",r=(e=n.state.field(i)).open,u=r.options,o=r.selected,s=n.state.facet(Do),this.optionContent=qp(s),this.optionClass=s.optionClass,this.tooltipClass=s.tooltipClass,this.range=Gp(u.length,o,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(n.state),this.dom.addEventListener("mousedown",(function(t){for(var i=t.target,e;i&&i!=h.dom;i=i.parentNode)if("LI"==i.nodeName&&(e=/-(\d+)$/.exec(i.id))&&+e[1]<u.length)return $p(n,u[+e[1]]),void t.preventDefault()})),this.dom.addEventListener("focusout",(function(t){var i=n.state.field(h.stateField,!1);i&&i.tooltip&&n.state.facet(Do).closeOnBlur&&t.relatedTarget!=n.contentDOM&&n.dispatch({effects:Oo.of(null)})})),this.list=this.dom.appendChild(this.createListBox(u,e.id,this.range)),this.list.addEventListener("scroll",(function(){h.info&&h.view.requestMeasure(h.placeInfoReq)}))}return kc(t,[{key:"mount",value:function t(){this.updateSel()}},{key:"update",value:function t(n){var i,e,r,u=n.state.field(this.stateField),o=n.startState.field(this.stateField);this.updateTooltipClass(n.state),u!=o&&(this.updateSel(),(null===(i=u.open)||void 0===i?void 0:i.disabled)!=(null===(e=o.open)||void 0===e?void 0:e.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(r=u.open)||void 0===r?void 0:r.disabled)))}},{key:"updateTooltipClass",value:function t(n){var i,e,r,u,o,s,h=this.tooltipClass(n);if(h!=this.currentClass){i=ic(this.currentClass.split(" "));try{for(i.s();!(e=i.n()).done;)(r=e.value)&&this.dom.classList.remove(r)}catch(t){i.e(t)}finally{i.f()}u=ic(h.split(" "));try{for(u.s();!(o=u.n()).done;)(s=o.value)&&this.dom.classList.add(s)}catch(t){u.e(t)}finally{u.f()}this.currentClass=h}}},{key:"positioned",value:function t(n){this.space=n,this.info&&this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSel",value:function t(){var n,i,e,r=this,u=this.view.state.field(this.stateField),o=u.open;if((o.selected>-1&&o.selected<this.range.from||o.selected>=this.range.to)&&(this.range=Gp(o.options.length,o.selected,this.view.state.facet(Do).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(o.options,u.id,this.range)),this.list.addEventListener("scroll",(function(){r.info&&r.view.requestMeasure(r.placeInfoReq)}))),this.updateSelectedOption(o.selected)){if(this.info&&(this.info.remove(),this.info=null),!(i=(n=o.options[o.selected].completion).info))return;if(!(e="string"==typeof i?document.createTextNode(i):i(n)))return;"then"in e?e.then((function(t){t&&r.view.state.field(r.stateField,!1)==u&&r.addInfoPane(t)})).catch((function(t){return Yl(r.view.state,t,"completion info")})):this.addInfoPane(e)}}},{key:"addInfoPane",value:function t(n){var i=this.info=document.createElement("div");i.className="cm-tooltip cm-completionInfo",i.appendChild(n),this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}},{key:"updateSelectedOption",value:function t(n){var i,e,r=null;for(i=this.list.firstChild,e=this.range.from;i;i=i.nextSibling,e++)"LI"==i.nodeName&&i.id?e==n?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),r=i):i.hasAttribute("aria-selected")&&i.removeAttribute("aria-selected"):e--;return r&&Kp(this.list,r),r}},{key:"measureInfo",value:function t(){var n,i,e,r,u,o=this.dom.querySelector("[aria-selected]");return o&&this.info?(n=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),e=o.getBoundingClientRect(),(r=this.space)||(r={left:0,top:0,right:(u=this.dom.ownerDocument.defaultView||window).innerWidth,bottom:u.innerHeight}),e.top>Math.min(r.bottom,n.bottom)-10||e.bottom<Math.max(r.top,n.top)+10?null:this.view.state.facet(Do).positionInfo(this.view,n,e,i,r)):null}},{key:"placeInfo",value:function t(n){this.info&&(n?(n.style&&(this.info.style.cssText=n.style),this.info.className="cm-tooltip cm-completionInfo "+(n.class||"")):this.info.style.cssText="top: -1e6px")}},{key:"createListBox",value:function t(n,i,e){var r,u,o,s,h,f,a,c,l,v,d,y,p,k,m=document.createElement("ul");for(m.id=i,m.setAttribute("role","listbox"),m.setAttribute("aria-expanded","true"),m.setAttribute("aria-label",this.view.state.phrase("Completions")),r=null,u=e.from;u<e.to;u++){s=(o=n[u]).completion,h=o.match,(f=s.section)&&(a="string"==typeof f?f:f.name)!=r&&(u>e.from||0==e.from)&&(r=a,"string"!=typeof f&&f.header?m.appendChild(f.header(f)):(c=m.appendChild(document.createElement("completion-section"))).textContent=a),(l=m.appendChild(document.createElement("li"))).id=i+"-"+u,l.setAttribute("role","option"),(v=this.optionClass(s))&&(l.className=v),d=ic(this.optionContent);try{for(d.s();!(y=d.n()).done;)(k=(p=y.value)(s,this.view.state,h))&&l.appendChild(k)}catch(t){d.e(t)}finally{d.f()}}return e.from&&m.classList.add("cm-completionListIncompleteTop"),e.to<n.length&&m.classList.add("cm-completionListIncompleteBottom"),m}}]),t}(),Po=function(){function t(n,i,e,r,u,o){yc(this,t),this.options=n,this.attrs=i,this.tooltip=e,this.timestamp=r,this.selected=u,this.disabled=o}return kc(t,[{key:"setSelected",value:function n(i,e){return i==this.selected||i>=this.options.length?this:new t(this.options,Yp(e,i),this.tooltip,this.timestamp,i,this.disabled)}},{key:"map",value:function n(i){return new t(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:i.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}],[{key:"build",value:function n(i,e,r,u,o){var s,h,f,a=Xp(i,e);if(!a.length)return u&&i.some((function(t){return 1==t.state}))?new t(u.options,u.attrs,u.tooltip,u.timestamp,u.selected,!0):null;if(s=e.facet(Do).selectOnOpen?0:-1,u&&u.selected!=s&&-1!=u.selected)for(h=u.options[u.selected].completion,f=0;f<a.length;f++)if(a[f].completion==h){s=f;break}return new t(a,Yp(r,s),{pos:i.reduce((function(t,n){return n.hasResult()?Math.min(t,n.from):t}),1e8),create:Jp(qo),above:o.aboveCursor},u?u.timestamp:Date.now(),s,!1)}}]),t}(),Fo=function(){function t(n,i,e){yc(this,t),this.active=n,this.id=i,this.open=e}return kc(t,[{key:"update",value:function n(i){var e,r,u,o,s=this,h=i.state,f=h.facet(Do),a=f.override||h.languageDataAt("autocomplete",Pp(h)).map(zp),c=a.map((function(t){var n;return(s.active.find((function(n){return n.source==t}))||new Wo(t,s.active.some((function(t){return 0!=t.state}))?1:0)).update(i,f)}));c.length==this.active.length&&c.every((function(t,n){return t==s.active[n]}))&&(c=this.active),(e=this.open)&&i.docChanged&&(e=e.map(i.changes)),i.selection||c.some((function(t){return t.hasResult()&&i.changes.touchesRange(t.from,t.to)}))||!Zp(c,this.active)?e=Po.build(c,h,this.id,e,f):e&&e.disabled&&!c.some((function(t){return 1==t.state}))&&(e=null),!e&&c.every((function(t){return 1!=t.state}))&&c.some((function(t){return t.hasResult()}))&&(c=c.map((function(t){return t.hasResult()?new Wo(t.source,0):t}))),r=ic(i.effects);try{for(r.s();!(u=r.n()).done;)(o=u.value).is($o)&&(e=e&&e.setSelected(o.value,this.id))}catch(t){r.e(t)}finally{r.f()}return c==this.active&&e==this.open?this:new t(c,this.id,e)}},{key:"tooltip",get:function t(){return this.open?this.open.tooltip:null}},{key:"attrs",get:function t(){return this.open?this.open.attrs:Ho}}],[{key:"start",value:function n(){return new t(zo,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}}]),t}(),Ho={"aria-autocomplete":"list"},zo=[],Wo=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1;yc(this,t),this.source=n,this.state=i,this.explicitPos=e}return kc(t,[{key:"hasResult",value:function t(){return!1}},{key:"update",value:function n(i,e){var r,u,o,s,h,f,a=tk(i),c=this;a?c=c.handleUserEvent(i,a,e):i.docChanged?c=c.handleChange(i):i.selection&&0!=c.state&&(c=new t(c.source,0)),r=ic(i.effects);try{for(r.s();!(u=r.n()).done;)if((o=u.value).is(Co))c=new t(c.source,1,o.value?Pp(i.state):-1);else if(o.is(Oo))c=new t(c.source,0);else if(o.is(Uo)){s=ic(o.value);try{for(s.s();!(h=s.n()).done;)(f=h.value).source==c.source&&(c=f)}catch(t){s.e(t)}finally{s.f()}}}catch(t){r.e(t)}finally{r.f()}return c}},{key:"handleUserEvent",value:function n(i,e,r){return"delete"!=e&&r.activateOnTyping?new t(this.source,1):this.map(i.changes)}},{key:"handleChange",value:function n(i){return i.changes.touchesRange(Pp(i.startState))?new t(this.source,0):this.map(i.changes)}},{key:"map",value:function n(i){return i.empty||this.explicitPos<0?this:new t(this.source,this.state,i.mapPos(this.explicitPos))}}]),t}(),Vo=function(t){sc(i,t);var n=fc(i);function i(t,e,r,u,o){var s;return yc(this,i),(s=n.call(this,t,2,e)).result=r,s.from=u,s.to=o,s}return kc(i,[{key:"hasResult",value:function t(){return!0}},{key:"handleUserEvent",value:function t(n,e,r){var u,o,s,h=n.changes.mapPos(this.from),f=n.changes.mapPos(this.to,1),a=Pp(n.state);return(this.explicitPos<0?a<=h:a<this.from)||a>f||"delete"==e&&Pp(n.startState)==this.from?new Wo(this.source,"input"==e&&r.activateOnTyping?1:0):(o=this.explicitPos<0?-1:n.changes.mapPos(this.explicitPos),nk(this.result.validFor,n.state,h,f)?new i(this.source,o,this.result,h,f):this.result.update&&(s=this.result.update(this.result,h,f,new bo(n.state,a,o>=0)))?new i(this.source,o,s,s.from,null!==(u=s.to)&&void 0!==u?u:Pp(n.state)):new Wo(this.source,1,o))}},{key:"handleChange",value:function t(n){return n.changes.touchesRange(this.from,this.to)?new Wo(this.source,0):this.map(n.changes)}},{key:"map",value:function t(n){return n.empty?this:new i(this.source,this.explicitPos<0?-1:n.mapPos(this.explicitPos),this.result,n.mapPos(this.from),n.mapPos(this.to,1))}}]),i}(Wo),Uo=U.define({map:function t(n,i){return n.map((function(t){return t.map(i)}))}}),$o=U.define(),qo=x.define({create:function t(){return Fo.start()},update:function t(n,i){return n.update(i)},provide:function t(n){return[_e.from(n,(function(t){return t.tooltip})),Ui.contentAttributes.from(n,(function(t){return t.attrs}))]}}),Go=Ui.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:'"\xb7\xb7\xb7"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"".concat(400,"px"),boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"".concat(30,"px")},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"".concat(30,"px")},"&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:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25cb'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25cc'"}},".cm-completionIcon-variable":{"&:after":{content:"'\ud835\udc65'"}},".cm-completionIcon-constant":{"&:after":{content:"'\ud835\udc36'"}},".cm-completionIcon-type":{"&:after":{content:"'\ud835\udc61'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222a'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25a1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\ud83d\udd11\ufe0e'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25a2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Jo=kc((function t(n,i,e,r){yc(this,t),this.field=n,this.line=i,this.from=e,this.to=r})),Ko=function(){function t(n,i,e){yc(this,t),this.field=n,this.from=i,this.to=e}return kc(t,[{key:"map",value:function n(i){var e=i.mapPos(this.from,-1,v.TrackDel),r=i.mapPos(this.to,1,v.TrackDel);return null==e||null==r?null:new t(this.field,e,r)}}]),t}(),Qo=function(){function t(n,i){yc(this,t),this.lines=n,this.fieldPositions=i}return kc(t,[{key:"instantiate",value:function t(n,i){var e,r,u,o,s,h,f=[],a=[i],c=n.doc.lineAt(i),l=/^\s*/.exec(c.text)[0],v=ic(this.lines);try{for(v.s();!(e=v.n()).done;){if(r=e.value,f.length){for(u=l,o=/^\t*/.exec(r)[0].length,s=0;s<o;s++)u+=n.facet(gu);a.push(i+u.length-o),r=u+r.slice(o)}f.push(r),i+=r.length+1}}catch(t){v.e(t)}finally{v.f()}return h=this.fieldPositions.map((function(t){return new Ko(t.field,a[t.line]+t.from,a[t.line]+t.to)})),{text:f,ranges:h}}}],[{key:"parse",value:function n(i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m=[],g=[],w=[],b=ic(i.split(/\r\n?|\n/));try{for(b.s();!(r=b.n()).done;){for(u=r.value;e=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(u);){for(o=e[1]?+e[1]:null,s=e[2]||e[3]||"",h=-1,f=0;f<m.length;f++)(null!=o?m[f].seq==o:s&&m[f].name==s)&&(h=f);if(h<0){for(a=0;a<m.length&&(null==o||null!=m[a].seq&&m[a].seq<o);)a++;m.splice(a,0,{seq:o,name:s}),h=a,c=ic(w);try{for(c.s();!(l=c.n()).done;)(v=l.value).field>=h&&v.field++}catch(t){c.e(t)}finally{c.f()}}w.push(new Jo(h,g.length,e.index,e.index+s.length)),u=u.slice(0,e.index)+s+u.slice(e.index+e[0].length)}for(;d=/\\([{}])/.exec(u);){u=u.slice(0,d.index)+d[1]+u.slice(d.index+d[0].length),y=ic(w);try{for(y.s();!(p=y.n()).done;)(k=p.value).line==g.length&&k.from>d.index&&(k.from--,k.to--)}catch(t){y.e(t)}finally{y.f()}}g.push(u)}}catch(t){b.e(t)}finally{b.f()}return new t(g,w)}}]),t}(),Xo=Jt.widget({widget:new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"toDOM",value:function t(){var n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}},{key:"ignoreEvent",value:function t(){return!1}}]),i}(qt))}),Zo=Jt.mark({class:"cm-snippetField"}),Yo=function(){function t(n,i){yc(this,t),this.ranges=n,this.active=i,this.deco=Jt.set(n.map((function(t){return(t.from==t.to?Xo:Zo).range(t.from,t.to)})))}return kc(t,[{key:"map",value:function n(i){var e,r,u,o=[],s=ic(this.ranges);try{for(s.s();!(e=s.n()).done;){if(!(u=(r=e.value).map(i)))return null;o.push(u)}}catch(t){s.e(t)}finally{s.f()}return new t(o,this.active)}},{key:"selectionInsideField",value:function t(n){var i=this;return n.ranges.every((function(t){return i.ranges.some((function(n){return n.field==i.active&&n.from<=t.from&&n.to>=t.to}))}))}}]),t}(),ts=U.define({map:function t(n,i){return n&&n.map(i)}}),ns=U.define(),is=x.define({create:function t(){return null},update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;){if((r=e.value).is(ts))return r.value;if(r.is(ns)&&n)return new Yo(n.ranges,r.value)}}catch(t){u.e(t)}finally{u.f()}return n&&i.docChanged&&(n=n.map(i.changes)),n&&i.selection&&!n.selectionInsideField(i.selection)&&(n=null),n},provide:function t(n){return Ui.decorations.from(n,(function(t){return t?t.deco:Jt.none}))}}),es=function t(n){var i=n.state,e=n.dispatch,r=i.field(is,!1);return!!r&&(e(i.update({effects:ts.of(null)})),!0)},os=[{key:"Tab",run:rs=rk(1),shift:us=rk(-1)},{key:"Escape",run:es}],ss=w.define({combine:function t(n){return n.length?n[0]:os}}),hs=E.highest(Qi.compute([ss],(function(t){return t.facet(ss)}))),fs=Ui.domEventHandlers({mousedown:function t(n,i){var e,r,u=i.state.field(is,!1);return!(!u||null==(e=i.posAtCoords({x:n.clientX,y:n.clientY})))&&(r=u.ranges.find((function(t){return t.from<=e&&t.to>=e})),!(!r||r.field==u.active)&&(i.dispatch({selection:ik(u.ranges,r.field),effects:ts.of(u.ranges.some((function(t){return t.field>r.field}))?new Yo(u.ranges,r.field):null)}),!0))}}),as=Object.create(null),cs=function t(n){var i,e,r=n.state.languageDataAt("wordChars",n.pos).join(""),u=hk(r),o=n.matchBefore(fk(u,(function(t){return t+"$"})));return o||n.explicit?{from:i=o?o.from:n.pos,options:e=lk(n.state.doc,ak(r),u,5e4,i),validFor:fk(u,(function(t){return"^"+t}))}:null},ls={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},vs=U.define({map:function t(n,i){var e=i.mapPos(n,-1,v.TrackAfter);return null==e?void 0:e}}),ds=new(function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i)}(X)),ds.startSide=1,ds.endSide=-1,ys=x.define({create:function t(){return tt.empty},update:function t(n,i){var e,r,u,o,s;i.selection&&(e=i.state.doc.lineAt(i.selection.main.head).from,r=i.startState.doc.lineAt(i.startState.selection.main.head).from,e!=i.changes.mapPos(r,-1)&&(n=tt.empty)),n=n.map(i.changes),u=ic(i.effects);try{for(u.s();!(o=u.n()).done;)(s=o.value).is(vs)&&(n=n.update({add:[ds.range(s.value,s.value+1)]}))}catch(t){u.e(t)}finally{u.f()}return n}}),ps="()[]{}<>",ks="object"==("undefined"==typeof navigator?"undefined":dc(navigator))&&/Android\b/.test(navigator.userAgent),ms=Ui.inputHandler.of((function(t,n,i,e){var r,u;return!(ks?t.composing:t.compositionStarted)&&!t.state.readOnly&&(r=t.state.selection.main,!(e.length>2||2==e.length&&1==Lc(Ic(e,0))||n!=r.from||i!=r.to)&&(!!(u=pk(t.state,e))&&(t.dispatch(u),!0)))})),ws=[{key:"Backspace",run:gs=function t(n){var i,e,r,u,o=n.state,s=n.dispatch;return!o.readOnly&&(i=yk(o,o.selection.main.head),e=i.brackets||ls.brackets,r=null,u=o.changeByRange((function(t){var n,i,u,s;if(t.empty){n=gk(o.doc,t.head),i=ic(e);try{for(i.s();!(u=i.n()).done;)if((s=u.value)==n&&mk(o.doc,t.head)==dk(Ic(s,0)))return{changes:{from:t.head-s.length,to:t.head+s.length},range:m.cursor(t.head-s.length)}}catch(t){i.e(t)}finally{i.f()}}return{range:r=t}})),r||s(o.update(u,{scrollIntoView:!0,userEvent:"delete.backward"})),!r)}}],bs=[{key:"Ctrl-Space",run:Io},{key:"Escape",run:Ro},{key:"ArrowDown",run:Up(!0)},{key:"ArrowUp",run:Up(!1)},{key:"PageDown",run:Up(!0,"page")},{key:"PageUp",run:Up(!1,"page")},{key:"Enter",run:Eo}],Ms=E.highest(Qi.computeN([Do],(function(t){return t.facet(Do).defaultKeymap?[bs]:[]}))),xs=new WeakMap,Ss=n.Autocomplete=Object.freeze({__proto__:null,CompletionContext:bo,acceptCompletion:Eo,autocompletion:Ok,clearSnippet:es,closeBrackets:vk,closeBracketsKeymap:ws,closeCompletion:Ro,completeAnyWord:cs,completeFromList:Bp,completionKeymap:bs,completionStatus:Ak,currentCompletions:Dk,deleteBracketPair:gs,hasNextSnippetField:uk,hasPrevSnippetField:ok,ifIn:_p,ifNotIn:Np,insertBracket:pk,insertCompletionText:Hp,moveCompletionSelection:Up,nextSnippetField:rs,pickedCompletion:xo,prevSnippetField:us,selectedCompletion:Ek,selectedCompletionIndex:Ik,setSelectedCompletion:Rk,snippet:ek,snippetCompletion:sk,snippetKeymap:ss,startCompletion:Io}),Cs=function t(n){var i=n.state,e=i.doc.lineAt(i.selection.main.from),r=jk(n.state,e.from);return r.line?Os(n):!!r.block&&Ls(n)},Os=Lk(Nk,0),As=Lk(Nk,1),Ds=Lk(Nk,2),Es=Lk(_k,0),Is=Lk(_k,1),Rs=Lk(_k,2),Ls=Lk((function(t,n){return _k(t,n,Bk(n))}),0),js=50,Ts=z.define(),Bs=z.define(),_s=w.define(),Ns=w.define({combine:function t(n){return il(n,{minDepth:100,newGroupDelay:500,joinToEvent:function t(n,i){return i}},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:function t(n,i){return function(t,e){return n(t,e)||i(t,e)}}})}}),Ps=x.define({create:function t(){return Qs.empty},update:function t(n,i){var e,r,u,o,s,h,f,a,c=i.state.facet(Ns),l=i.annotation(Ts);return l?(e=i.docChanged?m.single(Pk(i.changes)):void 0,r=qs.fromTransaction(i,e),o=0==(u=l.side)?n.undone:n.done,o=r?Wk(o,o.length,c.minDepth,r):qk(o,i.startState.selection),new Qs(0==u?l.rest:o,0==u?o:l.rest)):("full"!=(s=i.annotation(Bs))&&"before"!=s||(n=n.isolate()),!1===i.annotation($.addToHistory)?i.changes.empty?n:n.addMapping(i.changes.desc):(h=qs.fromTransaction(i),f=i.annotation($.time),a=i.annotation($.userEvent),h?n=n.addChanges(h,f,a,c,i):i.selection&&(n=n.addSelection(i.startState.selection,f,a,c.newGroupDelay)),"full"!=s&&"after"!=s||(n=n.isolate()),n))},toJSON:function t(n){return{done:n.done.map((function(t){return t.toJSON()})),undone:n.undone.map((function(t){return t.toJSON()}))}},fromJSON:function t(n){return new Qs(n.done.map(qs.fromJSON),n.undone.map(qs.fromJSON))}}),Fs=Ps,Hs=Hk(0,!1),zs=Hk(1,!1),Ws=Hk(0,!0),Vs=Hk(1,!0),Us=zk(0),$s=zk(1),qs=function(){function t(n,i,e,r,u){yc(this,t),this.changes=n,this.effects=i,this.mapped=e,this.startSelection=r,this.selectionsAfter=u}return kc(t,[{key:"setSelAfter",value:function n(i){return new t(this.changes,this.effects,this.mapped,this.startSelection,i)}},{key:"toJSON",value:function t(){var n,i,e;return{changes:null===(n=this.changes)||void 0===n?void 0:n.toJSON(),mapped:null===(i=this.mapped)||void 0===i?void 0:i.toJSON(),startSelection:null===(e=this.startSelection)||void 0===e?void 0:e.toJSON(),selectionsAfter:this.selectionsAfter.map((function(t){return t.toJSON()}))}}}],[{key:"fromJSON",value:function n(i){return new t(i.changes&&y.fromJSON(i.changes),[],i.mapped&&d.fromJSON(i.mapped),i.startSelection&&m.fromJSON(i.startSelection),i.selectionsAfter.map(m.fromJSON))}},{key:"fromTransaction",value:function n(i,e){var r,u,o,s=Gs,h=ic(i.startState.facet(_s));try{for(h.s();!(r=h.n()).done;)(o=(u=r.value)(i)).length&&(s=s.concat(o))}catch(t){h.e(t)}finally{h.f()}return!s.length&&i.changes.empty?null:new t(i.changes.invert(i.startState.doc),s,void 0,e||i.startState.selection,Gs)}},{key:"selection",value:function n(i){return new t(void 0,Gs,void 0,void 0,i)}}]),t}(),Gs=[],Js=200,Ks=/^(input\.type|delete)($|\.)/,Qs=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0;yc(this,t),this.done=n,this.undone=i,this.prevTime=e,this.prevUserEvent=r}return kc(t,[{key:"isolate",value:function n(){return this.prevTime?new t(this.done,this.undone):this}},{key:"addChanges",value:function n(i,e,r,u,o){var s=this.done,h=s[s.length-1];return new t(s=h&&h.changes&&!h.changes.empty&&i.changes&&(!r||Ks.test(r))&&(!h.selectionsAfter.length&&e-this.prevTime<u.newGroupDelay&&u.joinToEvent(o,Vk(h.changes,i.changes))||"input.type.compose"==r)?Wk(s,s.length-1,u.minDepth,new qs(i.changes.compose(h.changes),$k(i.effects,h.effects),h.mapped,h.startSelection,Gs)):Wk(s,s.length,u.minDepth,i),Gs,e,r)}},{key:"addSelection",value:function n(i,e,r,u){var o=this.done.length?this.done[this.done.length-1].selectionsAfter:Gs;return o.length>0&&e-this.prevTime<u&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&Uk(o[o.length-1],i)?this:new t(qk(this.done,i),this.undone,e,r)}},{key:"addMapping",value:function n(i){return new t(Jk(this.done,i),Jk(this.undone,i),this.prevTime,this.prevUserEvent)}},{key:"pop",value:function t(n,i,e){var r,u,o=0==n?this.done:this.undone;return 0==o.length?null:(r=o[o.length-1],e&&r.selectionsAfter.length?i.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Ts.of({side:n,rest:Gk(o)}),userEvent:0==n?"select.undo":"select.redo",scrollIntoView:!0}):r.changes?(u=1==o.length?Gs:o.slice(0,o.length-1),r.mapped&&(u=Jk(u,r.mapped)),i.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Ts.of({side:n,rest:u}),filter:!1,userEvent:0==n?"undo":"redo",scrollIntoView:!0})):null)}}]),t}(),Qs.empty=new Qs(Gs,Gs),Xs=[{key:"Mod-z",run:Hs,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:zs,preventDefault:!0},{linux:"Ctrl-Shift-z",run:zs,preventDefault:!0},{key:"Mod-u",run:Ws,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Vs,preventDefault:!0}],Zs=function t(n){return tm(n,!nm(n))},Ys=function t(n){return tm(n,nm(n))},th=function t(n){return tm(n,!0)},nh=function t(n){return tm(n,!1)},ih=function t(n){return im(n,!nm(n))},eh=function t(n){return im(n,nm(n))},rh=function t(n){return im(n,!0)},uh=function t(n){return im(n,!1)},oh=function t(n){return rm(n,!0)},sh=function t(n){return rm(n,!1)},hh=function t(n){return Zk(n,(function(t){return om(n.state,t,!nm(n))}))},fh=function t(n){return Zk(n,(function(t){return om(n.state,t,nm(n))}))},ah=function t(n){return sm(n,!1)},ch=function t(n){return sm(n,!0)},lh=function t(n){return fm(n,!1)},vh=function t(n){return fm(n,!0)},dh=function t(n){return Zk(n,(function(t){return am(n,t,!0)}))},yh=function t(n){return Zk(n,(function(t){return am(n,t,!1)}))},ph=function t(n){return Zk(n,(function(t){return am(n,t,!nm(n))}))},kh=function t(n){return Zk(n,(function(t){return am(n,t,nm(n))}))},mh=function t(n){return Zk(n,(function(t){return m.cursor(n.lineBlockAt(t.head).from,1)}))},gh=function t(n){return Zk(n,(function(t){return m.cursor(n.lineBlockAt(t.head).to,-1)}))},wh=function t(n){var i,e;return cm(n.state,n.dispatch,!1)},bh=function t(n){var i,e;return cm(n.state,n.dispatch,!0)},Mh=function t(n){return vm(n,!nm(n))},xh=function t(n){return vm(n,nm(n))},Sh=function t(n){return vm(n,!0)},Ch=function t(n){return vm(n,!1)},Oh=function t(n){return dm(n,!nm(n))},Ah=function t(n){return dm(n,nm(n))},Dh=function t(n){return dm(n,!0)},Eh=function t(n){return dm(n,!1)},Ih=function t(n){return ym(n,!0)},Rh=function t(n){return ym(n,!1)},Lh=function t(n){return lm(n,(function(t){return om(n.state,t,!nm(n))}))},jh=function t(n){return lm(n,(function(t){return om(n.state,t,nm(n))}))},Th=function t(n){return pm(n,!1)},Bh=function t(n){return pm(n,!0)},_h=function t(n){return km(n,!1)},Nh=function t(n){return km(n,!0)},Ph=function t(n){return lm(n,(function(t){return am(n,t,!0)}))},Fh=function t(n){return lm(n,(function(t){return am(n,t,!1)}))},Hh=function t(n){return lm(n,(function(t){return am(n,t,!nm(n))}))},zh=function t(n){return lm(n,(function(t){return am(n,t,nm(n))}))},Wh=function t(n){return lm(n,(function(t){return m.cursor(n.lineBlockAt(t.head).from)}))},Vh=function t(n){return lm(n,(function(t){return m.cursor(n.lineBlockAt(t.head).to)}))},Uh=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:0})),!0},$h=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:i.doc.length})),!0},qh=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:i.selection.main.anchor,head:0})),!0},Gh=function t(n){var i=n.state,e;return(0,n.dispatch)(Xk(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0},Jh=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0},Kh=function t(n){var i=n.state,e=n.dispatch,r=wm(i).map((function(t){var n=t.from,e=t.to;return m.range(n,Math.min(e+1,i.doc.length))}));return e(i.update({selection:m.create(r),userEvent:"select"})),!0},Qh=function t(n){var i=n.state,e=n.dispatch,r=Qk(i.selection,(function(t){for(var n,e=Ly(i).resolveInner(t.head,1);!(e.from<t.from&&e.to>=t.to||e.to>t.to&&e.from<=t.from)&&(null===(n=e.parent)||void 0===n?void 0:n.parent);)e=e.parent;return m.range(e.to,e.from)}));return e(Xk(i,r)),!0},Xh=function t(n){var i=n.state,e=n.dispatch,r=i.selection,u=null;return r.ranges.length>1?u=m.create([r.main]):r.main.empty||(u=m.create([m.cursor(r.main.head)])),!!u&&(e(Xk(i,u)),!0)},Zh=function t(n,i){return mm(n,(function(t){var e,r,u,o,s,h=n.state,f=h.doc.lineAt(t);if(!i&&t>f.from&&t<f.from+200&&!/[^ \t]/.test(e=f.text.slice(0,t-f.from))){if("\t"==e[e.length-1])return t-1;for(o=(u=ll(e,h.tabSize))%Py(h)||Py(h),s=0;s<o&&" "==e[e.length-1-s];s++)t--;r=t}else(r=Cc(f.text,t-f.from,i,i)+f.from)==t&&f.number!=(i?h.doc.lines:1)&&(r+=i?1:-1);return r}))},Yh=function t(n){return Zh(n,!1)},tf=function t(n){return Zh(n,!0)},nf=function t(n,i){return mm(n,(function(t){var e,r,u,o,s=t,h=n.state,f=h.doc.lineAt(s),a=h.charCategorizer(s);for(e=null;;){if(s==(i?f.to:f.from)){s==t&&f.number!=(i?h.doc.lines:1)&&(s+=i?1:-1);break}if(r=Cc(f.text,s-f.from,i)+f.from,o=a(u=f.text.slice(Math.min(s,r)-f.from,Math.max(s,r)-f.from)),null!=e&&o!=e)break;" "==u&&s==t||(e=o),s=r}return s}))},ef=function t(n){return nf(n,!1)},rf=function t(n){return nf(n,!0)},uf=function t(n){return mm(n,(function(t){var i=n.lineBlockAt(t).to;return t<i?i:Math.min(n.state.doc.length,t+1)}))},of=function t(n){return mm(n,(function(t){var i=n.lineBlockAt(t).from;return t>i?i:Math.max(0,t-1)}))},sf=function t(n){var i,e,r,u,o,s=n.state,h=n.dispatch;if(s.readOnly)return!1;for(i=[],e=0,r="",u=s.doc.iter();;){if(u.next(),u.lineBreak||u.done){if((o=r.search(/\s+$/))>-1&&i.push({from:e-(r.length-o),to:e}),u.done)break;r=""}else r=u.value;e+=u.value.length}return!!i.length&&(h(s.update({changes:i,userEvent:"delete"})),!0)},hf=function t(n){var e,r=n.state,u=n.dispatch;return!r.readOnly&&(e=r.changeByRange((function(t){return{changes:{from:t.from,to:t.to,insert:i.of(["",""])},range:m.cursor(t.from)}})),u(r.update(e,{scrollIntoView:!0,userEvent:"input"})),!0)},ff=function t(n){var i,e=n.state,r=n.dispatch;return!e.readOnly&&(!(i=e.changeByRange((function(t){var n,i,r,u;return t.empty&&0!=t.from&&t.from!=e.doc.length?{changes:{from:r=(n=t.from)==(i=e.doc.lineAt(n)).from?n-1:Cc(i.text,n-i.from,!1)+i.from,to:u=n==i.to?n+1:Cc(i.text,n-i.from,!0)+i.from,insert:e.doc.slice(n,u).append(e.doc.slice(r,n))},range:m.cursor(u)}:{range:t}}))).changes.empty&&(r(e.update(i,{scrollIntoView:!0,userEvent:"move.character"})),!0))},af=function t(n){var i,e;return bm(n.state,n.dispatch,!1)},cf=function t(n){var i,e;return bm(n.state,n.dispatch,!0)},lf=function t(n){var i,e;return Mm(n.state,n.dispatch,!1)},vf=function t(n){var i,e;return Mm(n.state,n.dispatch,!0)},df=function t(n){var i,e,r;return!n.state.readOnly&&(e=(i=n.state).changes(wm(i).map((function(t){var n=t.from,e=t.to;return n>0?n--:e<i.doc.length&&e++,{from:n,to:e}}))),r=Qk(i.selection,(function(t){return n.moveVertically(t,!0)})).map(e),n.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0)},yf=function t(n){var i=n.state,e;return(0,n.dispatch)(i.update(i.replaceSelection(i.lineBreak),{scrollIntoView:!0,userEvent:"input"})),!0},pf=Sm(!1),mf=function t(n){var i,e,r,u=n.state,o=n.dispatch;return!u.readOnly&&(i=Object.create(null),e=new wu(u,{overrideIndentation:function t(n){var e=i[n];return null==e?-1:e}}),r=Cm(u,(function(t,n,r){var o,s,h=Hy(e,t.from);null!=h&&(/\S/.test(t.text)||(h=0),((o=/^\s*/.exec(t.text)[0])!=(s=Fy(u,h))||r.from<t.from+o.length)&&(i[t.from]=h,n.push({from:t.from,to:t.from+o.length,insert:s})))})),r.changes.empty||o(u.update(r,{userEvent:"indent"})),!0)},wf=function t(n){var i=n.state,e=n.dispatch;return!i.readOnly&&(e(i.update(Cm(i,(function(t,n){var e,r,u,o=/^\s*/.exec(t.text)[0];if(o){for(e=ll(o,i.tabSize),r=0,u=Fy(i,Math.max(0,e-Py(i)));r<o.length&&r<u.length&&o.charCodeAt(r)==u.charCodeAt(r);)r++;n.push({from:t.from+r,to:t.from+o.length,insert:u.slice(r)})}})),{userEvent:"delete.dedent"})),!0)},bf=function t(n){var i=n.state,e=n.dispatch;return i.selection.ranges.some((function(t){return!t.empty}))?gf({state:i,dispatch:e}):(e(i.update(i.replaceSelection("\t"),{scrollIntoView:!0,userEvent:"input"})),!0)},Sf=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hh,shift:Lh},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:fh,shift:jh},{key:"Alt-ArrowUp",run:af},{key:"Shift-Alt-ArrowUp",run:lf},{key:"Alt-ArrowDown",run:cf},{key:"Shift-Alt-ArrowDown",run:vf},{key:"Escape",run:Xh},{key:"Mod-Enter",run:kf=Sm(!0)},{key:"Alt-l",mac:"Ctrl-l",run:Kh},{key:"Mod-i",run:Qh,preventDefault:!0},{key:"Mod-[",run:wf},{key:"Mod-]",run:gf=function t(n){var i=n.state,e=n.dispatch;return!i.readOnly&&(e(i.update(Cm(i,(function(t,n){n.push({from:t.from,insert:i.facet(gu)})})),{userEvent:"input.indent"})),!0)}},{key:"Mod-Alt-\\",run:mf},{key:"Shift-Mod-k",run:df},{key:"Shift-Mod-\\",run:wh},{key:"Mod-/",run:Cs},{key:"Alt-A",run:Es}].concat(xf=[{key:"ArrowLeft",run:Zs,shift:Mh,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:ih,shift:Oh,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:ph,shift:Hh,preventDefault:!0},{key:"ArrowRight",run:Ys,shift:xh,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:eh,shift:Ah,preventDefault:!0},{mac:"Cmd-ArrowRight",run:kh,shift:zh,preventDefault:!0},{key:"ArrowUp",run:ah,shift:Th,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Uh,shift:qh},{mac:"Ctrl-ArrowUp",run:lh,shift:_h},{key:"ArrowDown",run:ch,shift:Bh,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$h,shift:Gh},{mac:"Ctrl-ArrowDown",run:vh,shift:Nh},{key:"PageUp",run:lh,shift:_h},{key:"PageDown",run:vh,shift:Nh},{key:"Home",run:yh,shift:Fh,preventDefault:!0},{key:"Mod-Home",run:Uh,shift:qh},{key:"End",run:dh,shift:Ph,preventDefault:!0},{key:"Mod-End",run:$h,shift:Gh},{key:"Enter",run:pf},{key:"Mod-a",run:Jh},{key:"Backspace",run:Yh,shift:Yh},{key:"Delete",run:tf},{key:"Mod-Backspace",mac:"Alt-Backspace",run:ef},{key:"Mod-Delete",mac:"Alt-Delete",run:rf},{mac:"Mod-Backspace",run:of},{mac:"Mod-Delete",run:uf}].concat((Mf=[{key:"Ctrl-b",run:Zs,shift:Mh,preventDefault:!0},{key:"Ctrl-f",run:Ys,shift:xh},{key:"Ctrl-p",run:ah,shift:Th},{key:"Ctrl-n",run:ch,shift:Bh},{key:"Ctrl-a",run:mh,shift:Wh},{key:"Ctrl-e",run:gh,shift:Vh},{key:"Ctrl-d",run:tf},{key:"Ctrl-h",run:Yh},{key:"Ctrl-k",run:uf},{key:"Ctrl-Alt-h",run:ef},{key:"Ctrl-o",run:hf},{key:"Ctrl-t",run:ff},{key:"Ctrl-v",run:vh}]).map((function(t){return{mac:t.key,run:t.run,shift:t.shift}})))),Cf={key:"Tab",run:gf,shift:wf},Of=n.Commands=Object.freeze({__proto__:null,blockComment:Is,blockUncomment:Rs,copyLineDown:vf,copyLineUp:lf,cursorCharBackward:nh,cursorCharForward:th,cursorCharLeft:Zs,cursorCharRight:Ys,cursorDocEnd:$h,cursorDocStart:Uh,cursorGroupBackward:uh,cursorGroupForward:rh,cursorGroupLeft:ih,cursorGroupRight:eh,cursorLineBoundaryBackward:yh,cursorLineBoundaryForward:dh,cursorLineBoundaryLeft:ph,cursorLineBoundaryRight:kh,cursorLineDown:ch,cursorLineEnd:gh,cursorLineStart:mh,cursorLineUp:ah,cursorMatchingBracket:wh,cursorPageDown:vh,cursorPageUp:lh,cursorSubwordBackward:sh,cursorSubwordForward:oh,cursorSyntaxLeft:hh,cursorSyntaxRight:fh,defaultKeymap:Sf,deleteCharBackward:Yh,deleteCharForward:tf,deleteGroupBackward:ef,deleteGroupForward:rf,deleteLine:df,deleteToLineEnd:uf,deleteToLineStart:of,deleteTrailingWhitespace:sf,emacsStyleKeymap:Mf,history:Fk,historyField:Fs,historyKeymap:Xs,indentLess:wf,indentMore:gf,indentSelection:mf,indentWithTab:Cf,insertBlankLine:kf,insertNewline:yf,insertNewlineAndIndent:pf,insertTab:bf,invertedEffects:_s,isolateHistory:Bs,lineComment:As,lineUncomment:Ds,moveLineDown:cf,moveLineUp:af,redo:zs,redoDepth:$s,redoSelection:Vs,selectAll:Jh,selectCharBackward:Ch,selectCharForward:Sh,selectCharLeft:Mh,selectCharRight:xh,selectDocEnd:Gh,selectDocStart:qh,selectGroupBackward:Eh,selectGroupForward:Dh,selectGroupLeft:Oh,selectGroupRight:Ah,selectLine:Kh,selectLineBoundaryBackward:Fh,selectLineBoundaryForward:Ph,selectLineBoundaryLeft:Hh,selectLineBoundaryRight:zh,selectLineDown:Bh,selectLineEnd:Vh,selectLineStart:Wh,selectLineUp:Th,selectMatchingBracket:bh,selectPageDown:Nh,selectPageUp:_h,selectParentSyntax:Qh,selectSubwordBackward:Rh,selectSubwordForward:Ih,selectSyntaxLeft:Lh,selectSyntaxRight:jh,simplifySelection:Xh,splitLine:hf,standardKeymap:xf,toggleBlockComment:Es,toggleBlockCommentByLine:Ls,toggleComment:Cs,toggleLineComment:Os,transposeChars:ff,undo:Hs,undoDepth:Us,undoSelection:Ws}),Af=kc((function t(n,i,e){yc(this,t),this.from=n,this.to=i,this.diagnostic=e})),Df=function(){function t(n,i,e){yc(this,t),this.diagnostics=n,this.panel=i,this.selected=e}return kc(t,null,[{key:"init",value:function n(i,e,r){var u,o=i,s=r.facet(Ff).markerFilter;return s&&(o=s(o)),new t(u=Jt.set(o.map((function(t){return t.from==t.to||t.from==t.to-1&&r.doc.lineAt(t.from).to==t.from?Jt.widget({widget:new Hf(t),diagnostic:t}).range(t.from):Jt.mark({attributes:{class:"cm-lintRange cm-lintRange-"+t.severity},diagnostic:t}).range(t.from,t.to)})),!0),e,Dm(u))}}]),t}(),Ef=U.define(),If=U.define(),Rf=U.define(),Lf=x.define({create:function t(){return new Df(Jt.none,null,null)},update:function t(n,i){var e,r,u,o,s,h;i.docChanged&&(e=n.diagnostics.map(i.changes),r=null,n.selected&&(u=i.changes.mapPos(n.selected.from,1),r=Dm(e,n.selected.diagnostic,u)||Dm(e,null,u)),n=new Df(e,n.panel,r)),o=ic(i.effects);try{for(o.s();!(s=o.n()).done;)(h=s.value).is(Ef)?n=Df.init(h.value,n.panel,i.state):h.is(If)?n=new Df(n.diagnostics,h.value?Wf.open:null,n.selected):h.is(Rf)&&(n=new Df(n.diagnostics,n.panel,h.value))}catch(t){o.e(t)}finally{o.f()}return n},provide:function t(n){return[qe.from(n,(function(t){return t.panel})),Ui.decorations.from(n,(function(t){return t.diagnostics}))]}}),jf=Jt.mark({class:"cm-lintRange cm-lintRange-active"}),Bf=function t(n){var i=n.state.field(Lf,!1);return!(!i||!i.panel)&&(n.dispatch({effects:If.of(!1)}),!0)},Nf=[{key:"Mod-Shift-m",run:Tf=function t(n){var i,e=n.state.field(Lf,!1);return e&&e.panel||n.dispatch({effects:Im(n.state,[If.of(!0)])}),(i=Yd(n,Wf.open))&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:_f=function t(n){var i,e,r=n.state.field(Lf,!1);return!!r&&(i=n.state.selection.main,!(!(e=r.diagnostics.iter(i.to+1)).value&&(!(e=r.diagnostics.iter(0)).value||e.from==i.from&&e.to==i.to))&&(n.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0}),!0))}}],Pf=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.timeout=-1,this.set=!0;var i,e=n.state.facet(Ff).delay;this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}return kc(t,[{key:"run",value:function t(){var n,i,e,r=this,u=Date.now();u<this.lintTime-10?setTimeout(this.run,this.lintTime-u):(this.set=!1,e=(i=(n=this.view.state).facet(Ff)).sources,Promise.all(e.map((function(t){return Promise.resolve(t(r.view))}))).then((function(t){var i=t.reduce((function(t,n){return t.concat(n)}));r.view.state.doc==n.doc&&r.view.dispatch(Rm(r.view.state,i))}),(function(t){Yl(r.view.state,t)})))}},{key:"update",value:function t(n){var i=n.state.facet(Ff);(n.docChanged||i!=n.startState.facet(Ff)||i.needsRefresh&&i.needsRefresh(n))&&(this.lintTime=Date.now()+i.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,i.delay)))}},{key:"force",value:function t(){this.set&&(this.lintTime=Date.now(),this.run())}},{key:"destroy",value:function t(){clearTimeout(this.timeout)}}]),t}()),Ff=w.define({combine:function t(n){return Object.assign({sources:n.map((function(t){return t.source}))},il(n.map((function(t){return t.config})),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:function t(n,i){return n?i?function(t){return n(t)||i(t)}:n:i}}))}}),Hf=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).diagnostic=t,e}return kc(i,[{key:"eq",value:function t(n){return n.diagnostic==this.diagnostic}},{key:"toDOM",value:function t(){return Om("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}]),i}(qt),zf=kc((function t(n,i){yc(this,t),this.diagnostic=i,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=Pm(n,i,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")})),Wf=function(){function t(n){var i,e,r=this;yc(this,t),this.view=n,this.items=[],i=function t(i){var e,u,o,s;if(27==i.keyCode)Bf(r.view),r.view.focus();else if(38==i.keyCode||33==i.keyCode)r.moveSelection((r.selectedIndex-1+r.items.length)%r.items.length);else if(40==i.keyCode||34==i.keyCode)r.moveSelection((r.selectedIndex+1)%r.items.length);else if(36==i.keyCode)r.moveSelection(0);else if(35==i.keyCode)r.moveSelection(r.items.length-1);else if(13==i.keyCode)r.view.focus();else{if(!(i.keyCode>=65&&i.keyCode<=90&&r.selectedIndex>=0))return;for(u=Nm((e=r.items[r.selectedIndex].diagnostic).actions),o=0;o<u.length;o++)u[o].toUpperCase().charCodeAt(0)==i.keyCode&&(s=Dm(r.view.state.field(Lf).diagnostics,e))&&e.actions[o].apply(n,s.from,s.to)}i.preventDefault()},e=function t(n){for(var i=0;i<r.items.length;i++)r.items[i].dom.contains(n.target)&&r.moveSelection(i)},this.list=Om("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:i,onclick:e}),this.dom=Om("div",{class:"cm-panel-lint"},this.list,Om("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:function t(){return Bf(r.view)}},"\xd7")),this.update()}return kc(t,[{key:"selectedIndex",get:function t(){var n,i=this.view.state.field(Lf).selected;if(!i)return-1;for(n=0;n<this.items.length;n++)if(this.items[n].diagnostic==i.diagnostic)return n;return-1}},{key:"update",value:function t(){var n=this,i=this.view.state.field(Lf),e=i.diagnostics,r=i.selected,u=0,o=!1,s=null;for(e.between(0,this.view.state.doc.length,(function(t,i,e){var h,f,a=e.spec,c=-1;for(f=u;f<n.items.length;f++)if(n.items[f].diagnostic==a.diagnostic){c=f;break}c<0?(h=new zf(n.view,a.diagnostic),n.items.splice(u,0,h),o=!0):(h=n.items[c],c>u&&(n.items.splice(u,c-u),o=!0)),r&&h.diagnostic==r.diagnostic?h.dom.hasAttribute("aria-selected")||(h.dom.setAttribute("aria-selected","true"),s=h):h.dom.hasAttribute("aria-selected")&&h.dom.removeAttribute("aria-selected"),u++}));u<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)o=!0,this.items.pop();0==this.items.length&&(this.items.push(new zf(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),o=!0),s?(this.list.setAttribute("aria-activedescendant",s.id),this.view.requestMeasure({key:this,read:function t(){return{sel:s.dom.getBoundingClientRect(),panel:n.list.getBoundingClientRect()}},write:function t(i){var e=i.sel,r=i.panel;e.top<r.top?n.list.scrollTop-=r.top-e.top:e.bottom>r.bottom&&(n.list.scrollTop+=e.bottom-r.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),o&&this.sync()}},{key:"sync",value:function t(){var n,i,e,r=this.list.firstChild;function u(){var t=r;r=t.nextSibling,t.remove()}n=ic(this.items);try{for(n.s();!(i=n.n()).done;)if((e=i.value).dom.parentNode==this.list){for(;r!=e.dom;)u();r=e.dom.nextSibling}else this.list.insertBefore(e.dom,r)}catch(t){n.e(t)}finally{n.f()}for(;r;)u()}},{key:"moveSelection",value:function t(n){var i,e;this.selectedIndex<0||(e=Dm((i=this.view.state.field(Lf)).diagnostics,this.items[n].diagnostic))&&this.view.dispatch({selection:{anchor:e.from,head:e.to},scrollIntoView:!0,effects:Rf.of(e)})}}],[{key:"open",value:function n(i){return new t(i)}}]),t}(),Vf=Ui.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-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:Hm("#d11")},".cm-lintRange-warning":{backgroundImage:Hm("orange")},".cm-lintRange-info":{backgroundImage:Hm("#999")},".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-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}}}),Uf=function(t){sc(i,t);var n=fc(i);function i(t){var e;return yc(this,i),(e=n.call(this)).diagnostics=t,e.severity=t.reduce((function(t,n){var i=n.severity;return"error"==i||"warning"==i&&"info"==t?i:t}),"info"),e}return kc(i,[{key:"toDOM",value:function t(n){var i,e,r=document.createElement("div");return r.className="cm-lint-marker cm-lint-marker-"+this.severity,i=this.diagnostics,(e=n.state.facet(Xf).tooltipFilter)&&(i=e(i)),i.length&&(r.onmouseover=function(){return Wm(n,r,i)}),r}}]),i}(Ge),$f=ny({class:"cm-gutter-lint",markers:function t(n){return n.state.field(qf)}}),qf=x.define({create:function t(){return tt.empty},update:function t(n,i){var e,r,u,o,s;n=n.map(i.changes),e=i.state.facet(Xf).markerFilter,r=ic(i.effects);try{for(r.s();!(u=r.n()).done;)(o=u.value).is(Ef)&&(s=o.value,e&&(s=e(s||[])),n=Vm(i.state.doc,s.slice(0)))}catch(t){r.e(t)}finally{r.f()}return n}}),Gf=U.define(),Jf=x.define({create:function t(){return null},update:function t(n,i){return n&&i.docChanged&&(n=Em(i,n)?null:Object.assign(Object.assign({},n),{pos:i.changes.mapPos(n.pos)})),i.effects.reduce((function(t,n){return n.is(Gf)?n.value:t}),n)},provide:function t(n){return _e.from(n)}}),Kf=Ui.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:Fm('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:Fm('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:Fm('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),Qf=[Lf,Ui.decorations.compute([Lf],(function(t){var n=t.field(Lf),i=n.selected,e=n.panel;return i&&e&&i.from!=i.to?Jt.set([jf.range(i.from,i.to)]):Jt.none})),Jd(jm,{hideOn:Em}),Vf],Xf=w.define({combine:function t(n){return il(n,{hoverTime:300,markerFilter:null,tooltipFilter:null})}}),Zf=n.Lint=Object.freeze({__proto__:null,closeLintPanel:Bf,diagnosticCount:Lm,forEachDiagnostic:$m,forceLinting:_m,lintGutter:Um,lintKeymap:Nf,linter:Bm,nextDiagnostic:_f,openLintPanel:Tf,setDiagnostics:Rm,setDiagnosticsEffect:Ef}),Yf="function"==typeof String.prototype.normalize?function(t){return t.normalize("NFKD")}:function(t){return t},ta=function(){function t(n,i){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.length,u=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;yc(this,t),this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=n.iterRange(e,r),this.bufferStart=e,this.normalize=u?function(t){return u(Yf(t))}:Yf,this.query=this.normalize(i)}return kc(t,[{key:"peek",value:function t(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ic(this.buffer,this.bufferPos)}},{key:"next",value:function t(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}},{key:"nextOverlapping",value:function t(){for(var n,i,e,r,u,o,s,h;;){if((n=this.peek())<0)return this.done=!0,this;for(i=Rc(n),e=this.bufferStart+this.bufferPos,this.bufferPos+=Lc(n),r=this.normalize(i),u=0,o=e;;u++){if(s=r.charCodeAt(u),h=this.match(s,o))return this.value=h,this;if(u==r.length-1)break;o==e&&u<i.length&&i.charCodeAt(u)==s&&o++}}}},{key:"match",value:function t(n,i){var e,r,u,t=null;for(e=0;e<this.matches.length;e+=2)r=this.matches[e],u=!1,this.query.charCodeAt(r)==n&&(r==this.query.length-1?t={from:this.matches[e+1],to:i+1}:(this.matches[e]++,u=!0)),u||(this.matches.splice(e,2),e-=2);return this.query.charCodeAt(0)==n&&(1==this.query.length?t={from:i,to:i+1}:this.matches.push(1,i)),t&&this.test&&!this.test(t.from,t.to,this.buffer,this.bufferPos)&&(t=null),t}}]),t}(),"undefined"!=typeof Symbol&&(ta.prototype[Symbol.iterator]=function(){return this}),na={from:-1,to:-1,match:/.*/.exec("")},ia="gm"+(null==/x/.unicode?"":"u"),ea=function(){function t(n,i,e){var r,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.length;if(yc(this,t),this.text=n,this.to=o,this.curLine="",this.done=!1,this.value=na,/\\[sWDnr]|\n|\r|\[\^/.test(i))return new oa(n,i,e,u,o);this.re=new RegExp(i,ia+((null==e?void 0:e.ignoreCase)?"i":"")),this.test=null==e?void 0:e.test,this.iter=n.iter(),r=n.lineAt(u),this.curLineStart=r.from,this.matchPos=Gm(n,u),this.getLine(this.curLineStart)}return kc(t,[{key:"getLine",value:function t(n){this.iter.next(n),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}},{key:"nextLine",value:function t(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}},{key:"next",value:function t(){var n,i,e,r;for(n=this.matchPos-this.curLineStart;;)if(this.re.lastIndex=n,i=this.matchPos<=this.to&&this.re.exec(this.curLine)){if(r=(e=this.curLineStart+i.index)+i[0].length,this.matchPos=Gm(this.text,r+(e==r?1:0)),e==this.curLineStart+this.curLine.length&&this.nextLine(),(e<r||e>this.value.to)&&(!this.test||this.test(e,r,i)))return this.value={from:e,to:r,match:i},this;n=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),n=0}}}]),t}(),ra=new WeakMap,ua=function(){function t(n,i){yc(this,t),this.from=n,this.text=i}return kc(t,[{key:"to",get:function t(){return this.from+this.text.length}}],[{key:"get",value:function n(i,e,r){var u,o,s,h=ra.get(i);return!h||h.from>=r||h.to<=e?(u=new t(e,i.sliceString(e,r)),ra.set(i,u),u):h.from==e&&h.to==r?h:(o=h.text,(s=h.from)>e&&(o=i.sliceString(e,s)+o,s=e),h.to<r&&(o+=i.sliceString(h.to,r)),ra.set(i,new t(s,o)),new t(e,o.slice(e-s,r-s)))}}]),t}(),oa=function(){function t(n,i,e,r,u){yc(this,t),this.text=n,this.to=u,this.done=!1,this.value=na,this.matchPos=Gm(n,r),this.re=new RegExp(i,ia+((null==e?void 0:e.ignoreCase)?"i":"")),this.test=null==e?void 0:e.test,this.flat=ua.get(n,r,this.chunkEnd(r+5e3))}return kc(t,[{key:"chunkEnd",value:function t(n){return n>=this.to?this.to:this.text.lineAt(n).to}},{key:"next",value:function t(){for(var n,i,e,r;;){if(n=this.re.lastIndex=this.matchPos-this.flat.from,(i=this.re.exec(this.flat.text))&&!i[0]&&i.index==n&&(this.re.lastIndex=n+1,i=this.re.exec(this.flat.text)),i&&(r=(e=this.flat.from+i.index)+i[0].length,(this.flat.to>=this.to||i.index+i[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,r,i))))return this.value={from:e,to:r,match:i},this.matchPos=Gm(this.text,r+(e==r?1:0)),this;if(this.flat.to==this.to)return this.done=!0,this;this.flat=ua.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}]),t}(),"undefined"!=typeof Symbol&&(ea.prototype[Symbol.iterator]=oa.prototype[Symbol.iterator]=function(){return this}),sa=U.define(),ha=x.define({create:function t(){return!0},update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;)(r=e.value).is(sa)&&(n=r.value)}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return qe.from(n,(function(t){return t?Jm:null}))}}),fa=function t(n){var i,e=Yd(n,Jm);return e||(i=[sa.of(!0)],null==n.state.field(ha,!1)&&i.push(U.appendConfig.of([ha,aa])),n.dispatch({effects:i}),e=Yd(n,Jm)),e&&e.dom.querySelector("input").focus(),!0},aa=Ui.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),ca={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},la=w.define({combine:function t(n){return il(n,ca,{highlightWordAroundCursor:function t(n,i){return n||i},minSelectionLength:Math.min,maxMatches:Math.min})}}),va=Jt.mark({class:"cm-selectionMatch"}),da=Jt.mark({class:"cm-selectionMatch cm-selectionMatch-main"}),ya=kn.fromClass(function(){function t(n){yc(this,t),this.decorations=this.getDeco(n)}return kc(t,[{key:"update",value:function t(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}},{key:"getDeco",value:function t(n){var i,e,r,u,o,s,h,f,a,c,l,v,d,y=n.state.facet(la),p=n.state,k=p.selection;if(k.ranges.length>1)return Jt.none;if(r=null,(i=k.main).empty){if(!y.highlightWordAroundCursor)return Jt.none;if(!(u=p.wordAt(i.head)))return Jt.none;r=p.charCategorizer(i.head),e=p.sliceDoc(u.from,u.to)}else{if((o=i.to-i.from)<y.minSelectionLength||o>200)return Jt.none;if(y.wholeWords){if(e=p.sliceDoc(i.from,i.to),!Qm(r=p.charCategorizer(i.head),p,i.from,i.to)||!Xm(r,p,i.from,i.to))return Jt.none}else if(!(e=p.sliceDoc(i.from,i.to).trim()))return Jt.none}s=[],h=ic(n.visibleRanges);try{for(h.s();!(f=h.n()).done;)for(a=f.value,c=new ta(p.doc,e,a.from,a.to);!c.next().done;)if(v=(l=c.value).from,d=l.to,(!r||Qm(r,p,v,d))&&(i.empty&&v<=i.from&&d>=i.to?s.push(da.range(v,d)):(v>=i.to||d<=i.from)&&s.push(va.range(v,d)),s.length>y.maxMatches))return Jt.none}catch(t){h.e(t)}finally{h.f()}return Jt.set(s)}}]),t}(),{decorations:function t(n){return n.decorations}}),pa=Ui.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ka=function t(n){var i=n.state,e=n.dispatch,r=i.selection,u=m.create(r.ranges.map((function(t){return i.wordAt(t.head)||m.cursor(t.head)})),r.mainIndex);return!u.eq(r)&&(e(i.update({selection:u})),!0)},ma=function t(n){var i,e,r=n.state,u=n.dispatch,o=r.selection.ranges;return o.some((function(t){return t.from===t.to}))?ka({state:r,dispatch:u}):(i=r.sliceDoc(o[0].from,o[0].to),!r.selection.ranges.some((function(t){return r.sliceDoc(t.from,t.to)!=i}))&&(!!(e=Zm(r,i))&&(u(r.update({selection:r.selection.addRange(m.range(e.from,e.to),!1),effects:Ui.scrollIntoView(e.to)})),!0)))},ga=w.define({combine:function t(n){return il(n,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:function t(n){return new Ha(n)},scrollToMatch:function t(n){return Ui.scrollIntoView(n)}})}}),wa=function(){function t(n){yc(this,t),this.search=n.search,this.caseSensitive=!!n.caseSensitive,this.literal=!!n.literal,this.regexp=!!n.regexp,this.replace=n.replace||"",this.valid=!!this.search&&(!this.regexp||qm(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!n.wholeWord}return kc(t,[{key:"unquote",value:function t(n){return this.literal?n:n.replace(/\\([nrt\\])/g,(function(t,n){return"n"==n?"\n":"r"==n?"\r":"t"==n?"\t":"\\"}))}},{key:"eq",value:function t(n){return this.search==n.search&&this.replace==n.replace&&this.caseSensitive==n.caseSensitive&&this.regexp==n.regexp&&this.wholeWord==n.wholeWord}},{key:"create",value:function t(){return this.regexp?new xa(this):new Ma(this)}},{key:"getCursor",value:function t(n){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2?arguments[2]:void 0,r=n.doc?n:Q.create({doc:n});return null==e&&(e=r.doc.length),this.regexp?ig(this,r,i,e):tg(this,r,i,e)}}]),t}(),Ma=function(t){sc(i,t);var n=fc(i);function i(t){return yc(this,i),n.call(this,t)}return kc(i,[{key:"nextMatch",value:function t(n,i,e){var r=tg(this.spec,n,e,n.doc.length).nextOverlapping();return r.done&&(r=tg(this.spec,n,0,i).nextOverlapping()),r.done?null:r.value}},{key:"prevMatchInRange",value:function t(n,i,e){var r,u,o,s;for(r=e;;){for(u=Math.max(i,r-1e4-this.spec.unquoted.length),o=tg(this.spec,n,u,r),s=null;!o.nextOverlapping().done;)s=o.value;if(s)return s;if(u==i)return null;r-=1e4}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace)}},{key:"matchAll",value:function t(n,i){for(var e=tg(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(r.length>=i)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var u=tg(this.spec,n,Math.max(0,i-this.spec.unquoted.length),Math.min(e+this.spec.unquoted.length,n.doc.length));!u.next().done;)r(u.value.from,u.value.to)}}]),i}(ba=kc((function t(n){yc(this,t),this.spec=n}))),xa=function(t){sc(i,t);var n=fc(i);function i(){return yc(this,i),n.apply(this,arguments)}return kc(i,[{key:"nextMatch",value:function t(n,i,e){var r=ig(this.spec,n,e,n.doc.length).next();return r.done&&(r=ig(this.spec,n,0,i).next()),r.done?null:r.value}},{key:"prevMatchInRange",value:function t(n,i,e){var r,u,o,s;for(r=1;;r++){for(u=Math.max(i,e-1e4*r),o=ig(this.spec,n,u,e),s=null;!o.next().done;)s=o.value;if(s&&(u==i||s.from>u+10))return s;if(u==i)return null}}},{key:"prevMatch",value:function t(n,i,e){return this.prevMatchInRange(n,0,i)||this.prevMatchInRange(n,e,n.doc.length)}},{key:"getReplacement",value:function t(n){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,(function(t,i){return"$"==i?"$":"&"==i?n.match[0]:"0"!=i&&+i<n.match.length?n.match[i]:t})))}},{key:"matchAll",value:function t(n,i){for(var e=ig(this.spec,n,0,n.doc.length),r=[];!e.next().done;){if(r.length>=i)return null;r.push(e.value)}return r}},{key:"highlight",value:function t(n,i,e,r){for(var u=ig(this.spec,n,Math.max(0,i-250),Math.min(e+250,n.doc.length));!u.next().done;)r(u.value.from,u.value.to)}}]),i}(ba),Sa=U.define(),Ca=U.define(),Oa=x.define({create:function t(n){return new Aa(ag(n).create(),null)},update:function t(n,i){var e,r,u=ic(i.effects);try{for(u.s();!(e=u.n()).done;)(r=e.value).is(Sa)?n=new Aa(r.value.create(),n.panel):r.is(Ca)&&(n=new Aa(n.query,r.value?fg:null))}catch(t){u.e(t)}finally{u.f()}return n},provide:function t(n){return qe.from(n,(function(t){return t.panel}))}}),Aa=kc((function t(n,i){yc(this,t),this.query=n,this.panel=i})),Da=Jt.mark({class:"cm-searchMatch"}),Ea=Jt.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ia=kn.fromClass(function(){function t(n){yc(this,t),this.view=n,this.decorations=this.highlight(n.state.field(Oa))}return kc(t,[{key:"update",value:function t(n){var i=n.state.field(Oa);(i!=n.startState.field(Oa)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(i))}},{key:"highlight",value:function t(n){var i,e,r,u,o,s,h,f,a=n.query,c=n.panel;if(!c||!a.spec.valid)return Jt.none;for(i=this.view,e=new nt,r=0,o=(u=i.visibleRanges).length;r<o;r++){for(h=(s=u[r]).from,f=s.to;r<o-1&&f>u[r+1].from-500;)f=u[++r].to;a.highlight(i.state,h,f,(function(t,n){var r=i.state.selection.ranges.some((function(i){return i.from==t&&i.to==n}));e.add(t,n,r?Ea:Da)}))}return e.finish()}}]),t}(),{decorations:function t(n){return n.decorations}}),Ra=hg((function(t,n){var i,e,r=n.query,u=t.state.selection.main.to,o=r.nextMatch(t.state,u,u);return!!o&&(i=m.single(o.from,o.to),e=t.state.facet(ga),t.dispatch({selection:i,effects:[dg(t,o),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),lg(t),!0)})),La=hg((function(t,n){var i,e,r=n.query,u=t.state,o=u.selection.main.from,s=r.prevMatch(u,o,o);return!!s&&(i=m.single(s.from,s.to),e=t.state.facet(ga),t.dispatch({selection:i,effects:[dg(t,s),e.scrollToMatch(i.main,t)],userEvent:"select.search"}),lg(t),!0)})),ja=hg((function(t,n){var i=n.query,e=i.matchAll(t.state,1e3);return!(!e||!e.length)&&(t.dispatch({selection:m.create(e.map((function(t){return m.range(t.from,t.to)}))),userEvent:"select.search.matches"}),!0)})),Ta=function t(n){var i,e,r,u,o,s,h=n.state,f=n.dispatch,a=h.selection;if(a.ranges.length>1||a.main.empty)return!1;for(e=(i=a.main).from,r=i.to,u=[],o=0,s=new ta(h.doc,h.sliceDoc(e,r));!s.next().done;){if(u.length>1e3)return!1;s.value.from==e&&(o=u.length),u.push(m.range(s.value.from,s.value.to))}return f(h.update({selection:m.create(u,o),userEvent:"select.search.matches"})),!0},Ba=hg((function(t,n){var i,e,r,u,o,s,h=n.query,f=t.state,a=f.selection.main,c=a.from,l=a.to;return!f.readOnly&&(!!(i=h.nextMatch(f,c,c))&&(e=[],o=[],i.from==c&&i.to==l&&(u=f.toText(h.getReplacement(i)),e.push({from:i.from,to:i.to,insert:u}),i=h.nextMatch(f,i.from,i.to),o.push(Ui.announce.of(f.phrase("replaced match on line $",f.doc.lineAt(c).number)+"."))),i&&(s=0==e.length||e[0].from>=i.to?0:i.to-i.from-u.length,r=m.single(i.from-s,i.to-s),o.push(dg(t,i)),o.push(f.facet(ga).scrollToMatch(r.main,t))),t.dispatch({changes:e,selection:r,effects:o,userEvent:"input.replace"}),!0))})),_a=hg((function(t,n){var i,e,r=n.query;return!t.state.readOnly&&(!!(i=r.matchAll(t.state,1e9).map((function(t){var n,i;return{from:t.from,to:t.to,insert:r.getReplacement(t)}}))).length&&(e=t.state.phrase("replaced $ matches",i.length)+".",t.dispatch({changes:i,effects:Ui.announce.of(e),userEvent:"input.replace.all"}),!0))})),Fa=[{key:"Mod-f",run:Na=function t(n){var i,e,r=n.state.field(Oa,!1);return r&&r.panel?(i=cg(n))&&i!=n.root.activeElement&&((e=ag(n.state,r.query.spec)).valid&&n.dispatch({effects:Sa.of(e)}),i.focus(),i.select()):n.dispatch({effects:[Ca.of(!0),r?Sa.of(ag(n.state,r.query.spec)):U.appendConfig.of(Ua)]}),!0},scope:"editor search-panel"},{key:"F3",run:Ra,shift:La,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Ra,shift:La,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Pa=function t(n){var i,e=n.state.field(Oa,!1);return!(!e||!e.panel)&&((i=Yd(n,fg))&&i.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Ca.of(!1)}),!0)},scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ta},{key:"Alt-g",run:fa},{key:"Mod-d",run:ma,preventDefault:!0}],Ha=function(){function t(n){var i,e=this;function r(t,n,i){return Om("button",{class:"cm-button",name:t,onclick:n,type:"button"},i)}yc(this,t),this.view=n,i=this.query=n.state.field(Oa).query.spec,this.commit=this.commit.bind(this),this.searchField=Om("input",{value:i.search,placeholder:vg(n,"Find"),"aria-label":vg(n,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Om("input",{value:i.replace,placeholder:vg(n,"Replace"),"aria-label":vg(n,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Om("input",{type:"checkbox",name:"case",form:"",checked:i.caseSensitive,onchange:this.commit}),this.reField=Om("input",{type:"checkbox",name:"re",form:"",checked:i.regexp,onchange:this.commit}),this.wordField=Om("input",{type:"checkbox",name:"word",form:"",checked:i.wholeWord,onchange:this.commit}),this.dom=Om("div",{onkeydown:function t(n){return e.keydown(n)},class:"cm-search"},[this.searchField,r("next",(function(){return Ra(n)}),[vg(n,"next")]),r("prev",(function(){return La(n)}),[vg(n,"previous")]),r("select",(function(){return ja(n)}),[vg(n,"all")]),Om("label",null,[this.caseField,vg(n,"match case")]),Om("label",null,[this.reField,vg(n,"regexp")]),Om("label",null,[this.wordField,vg(n,"by word")])].concat(Ja(n.state.readOnly?[]:[Om("br"),this.replaceField,r("replace",(function(){return Ba(n)}),[vg(n,"replace")]),r("replaceAll",(function(){return _a(n)}),[vg(n,"replace all")])]),[Om("button",{name:"close",onclick:function t(){return Pa(n)},"aria-label":vg(n,"close"),type:"button"},["\xd7"])]))}return kc(t,[{key:"commit",value:function t(){var n=new wa({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});n.eq(this.query)||(this.query=n,this.view.dispatch({effects:Sa.of(n)}))}},{key:"keydown",value:function t(n){pd(this.view,n,"search-panel")?n.preventDefault():13==n.keyCode&&n.target==this.searchField?(n.preventDefault(),(n.shiftKey?La:Ra)(this.view)):13==n.keyCode&&n.target==this.replaceField&&(n.preventDefault(),Ba(this.view))}},{key:"update",value:function t(n){var i,e,r,u,o,s=ic(n.transactions);try{for(s.s();!(i=s.n()).done;){r=ic((e=i.value).effects);try{for(r.s();!(u=r.n()).done;)(o=u.value).is(Sa)&&!o.value.eq(this.query)&&this.setQuery(o.value)}catch(t){r.e(t)}finally{r.f()}}}catch(t){s.e(t)}finally{s.f()}}},{key:"setQuery",value:function t(n){this.query=n,this.searchField.value=n.search,this.replaceField.value=n.replace,this.caseField.checked=n.caseSensitive,this.reField.checked=n.regexp,this.wordField.checked=n.wholeWord}},{key:"mount",value:function t(){this.searchField.select()}},{key:"pos",get:function t(){return 80}},{key:"top",get:function t(){return this.view.state.facet(ga).top}}]),t}(),za=30,Wa=/[\s\.,:;?!]/,Va=Ui.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Ua=[Oa,E.lowest(Ia),Va],$a=n.Search=Object.freeze({__proto__:null,RegExpCursor:ea,SearchCursor:ta,SearchQuery:wa,closeSearchPanel:Pa,findNext:Ra,findPrevious:La,getSearchQuery:og,gotoLine:fa,highlightSelectionMatches:Km,openSearchPanel:Na,replaceAll:_a,replaceNext:Ba,search:Ym,searchKeymap:Fa,searchPanelOpen:sg,selectMatches:ja,selectNextOccurrence:ma,selectSelectionMatches:Ta,setSearchQuery:Sa}),qa=n.basicSetup=function(){return[sy(),fy(),Ld(),Fk(),lp(),Cd(),Dd(),Q.allowMultipleSelections.of(!0),Zy(),dp(Gu,{fallback:!0}),kp(),vk(),Ok(),Wd(),Vd(),_d(),Km(),Qi.of([].concat(ws,Ja(Sf),Fa,Xs,Bu,bs,Nf))]}()},888:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v;function d(t){var n,i,e,o,h,f=t.selection.main;return f&&f.from===f.to?(n=f.from,(i=(0,r.getSignatureStatus)((0,u.getTokensByState)(t),n))&&(e=(0,u.getFunctionResourceByState)(t,i.functionName))?(o=e,h=(0,r.getActiveParameterInSignatureTip)(i.activeParameter,o),[{pos:n,above:!0,arrow:!0,create:function(){var t=document.createElement("div");return t.className="gc-formula-editor-tooltip-help-function",t.appendChild((0,s.createHelpFunctionTitleDom)(o,h)),o.description&&t.appendChild((0,s.createHelpFunctionDescriptionDom)(o.description)),{dom:t,overlap:!0}}}]):[]):[]}Object.defineProperty(n,"__esModule",{value:!0}),n.signatureTooltipsExtensions=n.closeParameterHintsCommand=n.triggerParameterHintsCommand=n.hasParameterHints=n.notTriggerSignatureTooltip=n.closeSignatureTooltip=n.triggerSignatureTooltip=void 0,e=i(833),r=i(129),u=i(338),o=i(367),s=i(348),h=e.State.StateField,n.triggerSignatureTooltip=e.State.StateEffect.define(),n.closeSignatureTooltip=e.State.StateEffect.define(),n.notTriggerSignatureTooltip=e.State.Annotation.define(),f=h.define({create:function(){return[]},update:function(t,i){var e,r,u,s,h=i.state.field(o.isFormulaField);if(!h)return[];if(e=t&&t.length>0,i.annotation(n.notTriggerSignatureTooltip)&&!e)return[];for(r=0,u=i.effects;r<u.length;r++){if((s=u[r]).is(n.closeSignatureTooltip))return[];if(s.is(n.triggerSignatureTooltip))return d(i.state)}return i.docChanged?d(i.state):e?i.selection?d(i.state):t:[]},provide:function(t){return e.View.showTooltip.computeN([t],(function(n){return n.field(t)}))}}),a=function(t){return t.state.field(f).length>0},n.hasParameterHints=a,c=function(t){return t.dispatch({effects:n.triggerSignatureTooltip.of(null)}),!0},n.triggerParameterHintsCommand=c,l=function(t){return!!(0,n.hasParameterHints)(t)&&(t.dispatch({effects:n.closeSignatureTooltip.of(null)}),!0)},n.closeParameterHintsCommand=l,v=e.View.EditorView.updateListener.of((function(t){t.focusChanged&&!t.view.hasFocus&&(0,n.closeParameterHintsCommand)(t.view)})),n.signatureTooltipsExtensions=[f,v]},902:function(t,n,i){var e,r,u,o,s;Object.defineProperty(n,"__esModule",{value:!0}),n.doubleClickSelectRangeExtension=void 0,e=i(833),r=i(129),u=i(338),o=i(367),s=e.State.EditorSelection,n.doubleClickSelectRangeExtension=e.View.EditorView.mouseSelectionStyle.of((function(t,n){var i,e,h=t.state.field(o.isFormulaField);return h?2!==n.detail||0!==n.button||null===(i=t.posAtCoords(n))?null:(e=t.state.selection,{get:function(n,i,o){var h,f,a=t.posAtCoords(n);return null===a?e:(h=(0,r.getTokenByPos)((0,u.getTokensByState)(t.state),a))?(f=s.range(h.index,h.endIndex+1),o?e.addRange(f):s.create([f])):e},update:function(t){i=t.changes.mapPos(i),e=e.map(t.changes)}}):null}))},910:function(t,n,i){var e,r,u,o,s,h,f,a,c,l,v,d,y,p,k,m,g,w,b,M,x,S,C,O,A,D,E,I,R,L,j,T,B,_,N,P,F,H,z,W,V,U,$,q,G,J,K,Q,X,Z,Y,tt;function nt(){return[r.basicSetup,Y,o.customFields,m.readOnlyExtension,p.themeExtension,c.foldExtension,l.indentExtension,s.syntaxHighlightingField,h.autoCompletionExtensions,f.hoverTooltipExtension,a.signatureTooltipsExtensions,d.doubleClickSelectRangeExtension,y.linterExtension]}Object.defineProperty(n,"__esModule",{value:!0}),n.FormulaEditorCore=void 0,e=i(376),r=i(833),u=i(465),o=i(367),s=i(307),h=i(58),f=i(284),a=i(888),c=i(971),l=i(710),v=i(33),d=i(902),y=i(413),p=i(231),k=i(744),m=i(86),g=i(338),w="gc-formula-editor-token-const-string",b="gc-formula-editor-token-const-number",M="gc-formula-editor-token-const-boolean",x="gc-formula-editor-token-const-error",S="gc-formula-editor-token-operator-prefix",C="gc-formula-editor-token-operator-infix",O="gc-formula-editor-token-operator-postfix",A="gc-formula-editor-token-function",D="gc-formula-editor-token-name",E="gc-formula-editor-token-reference-1",I="gc-formula-editor-token-reference-2",R="gc-formula-editor-token-reference-3",L="gc-formula-editor-token-reference-4",j="gc-formula-editor-token-reference-5",T="gc-formula-editor-token-reference-6",B="gc-formula-editor-token-reference-7",_="gc-formula-editor-token-argument-separator",N="gc-formula-editor-content",P="gc-formula-editor-gutters",F="gc-formula-editor-caret",H="gc-formula-editor-active-line",z="gc-formula-editor-selection",W="gc-formula-editor-tooltip-autocompletion-function",V="gc-formula-editor-tooltip-autocompletion-function-active-item",U="gc-formula-editor-tooltip-autocompletion-function-icon",$="gc-formula-editor-tooltip-autocompletion-function-name",q="gc-formula-editor-tooltip-autocompletion-function-description",G="gc-formula-editor-tooltip-error-message",J=e.I.fl,K=r.View.EditorView,Q=r.View.keymap,X=r.Commands.indentWithTab,Z=r.Autocomplete.acceptCompletion,Y=Q.of([{key:"Tab",run:Z},{key:"Tab",run:v.insertTab},X]),tt=function(){function t(t,n){this.ipe=n,this.zQt=new K({state:this.npe(""),parent:t})}return t.prototype.getView=function(){return this.zQt},t.prototype.getText=function(){return this.zQt.state.doc.toJSON().join("\n")},t.prototype.setText=function(t){this.zQt.dispatch({changes:{from:0,to:this.zQt.state.doc.length,insert:t}})},t.prototype.getFunctions=function(){return(0,g.getFunctionsByState)(this.zQt.state)},t.prototype.getCustomNames=function(){return this.zQt.state.field(o.customNamesField)},t.prototype.setCustomNames=function(t){this.zQt.dispatch({effects:o.setCustomNamesField.of(t)})},t.prototype.getOptions=function(){return this.zQt.state.field(o.optionsField)},t.prototype.setOptions=function(t){this.zQt.dispatch({effects:o.setOptionsField.of(t)})},t.prototype.getReadOnly=function(){return this.zQt.state.readOnly},t.prototype.setReadOnly=function(t){t!==this.getReadOnly()&&(0,m.reconfigureReadOnly)(this.zQt,t)},t.prototype.getTheme=function(){return this.zQt.state.field(o.themeField)},t.prototype.setTheme=function(t){this.zQt.dispatch({effects:o.setThemeField.of(t)}),this.zQt.dispatch({effects:p.themeCompartment.reconfigure((0,p.createThemeExtension)(t))})},t.prototype.getCalcSource=function(){return this.zQt.state.field(o.calcSourceField)},t.prototype.setCalcSource=function(t){this.zQt.dispatch({effects:o.setCalcSourceField.of(t)})},t.prototype.getCalcService=function(){return this.zQt.state.field(o.calcServiceField)},t.prototype.setCalcService=function(t){this.zQt.dispatch({effects:o.setCalcServiceField.of(t)})},t.prototype.getActiveCellInfo=function(){return this.zQt.state.field(o.activeCellField)},t.prototype.setActiveCellInfo=function(t){this.zQt.dispatch({effects:o.setActiveCellField.of(t)})},t.prototype.getProvider=function(){return this.zQt.state.field(o.providerField)},t.prototype.setProvider=function(t){this.zQt.dispatch({effects:o.setProviderField.of(t)})},t.prototype.format=function(){(0,k.formatDocumentCommand)(this.zQt)},t.prototype.hasFocus=function(){return this.zQt.hasFocus},t.prototype.destroy=function(){this.zQt.destroy()},t.prototype.rebuildFormula=function(){this.zQt.dispatch({effects:o.rebuildFormulaEffect.of(!0)})},t.prototype.clearHistory=function(){var t=this,n=t.getText(),i=t.getTheme(),e=t.getOptions(),r=t.getCalcService(),u=t.getCalcSource(),o=t.getCustomNames(),s=t.getActiveCellInfo(),h=t.getProvider(),f=t.getReadOnly(),a=t.npe(n);t.zQt.setState(a),t.setTheme(i),t.setOptions(e),t.setCalcService(r),t.setCalcSource(u),t.setActiveCellInfo(s),t.setCustomNames(o),t.setProvider(h),t.setReadOnly(f)},t.prototype.initTheme=function(){var t=[{token:u.SyntaxHighlightingTokenType.stringConst,color:J(w).color},{token:u.SyntaxHighlightingTokenType.numberConst,color:J(b).color},{token:u.SyntaxHighlightingTokenType.booleanConst,color:J(M).color},{token:u.SyntaxHighlightingTokenType.errorConst,color:J(x).color},{token:u.SyntaxHighlightingTokenType.operatorPrefix,color:J(S).color},{token:u.SyntaxHighlightingTokenType.operatorInfix,color:J(C).color},{token:u.SyntaxHighlightingTokenType.operatorPostfix,color:J(O).color},{token:u.SyntaxHighlightingTokenType.function,color:J(A).color},{token:u.SyntaxHighlightingTokenType.name,color:J(D).color},{token:u.SyntaxHighlightingTokenType.argumentSeparator,color:J(_).color},{token:u.SyntaxHighlightingTokenType.reference,color:[J(E).color,J(I).color,J(R).color,J(L).color,J(j).color,J(T).color,J(B).color]}],n={backgroundColor:J(N).backgroundColor,font:J(N).font,color:J(N).color,caretColor:J(F).color,selectionBackColor:J(z).backgroundColor,activeLineBackColor:J(H).backgroundColor,autocompletionStyle:{backgroundColor:J(W).backgroundColor,font:J(W).font,color:J(W).color,border:J(W).border,activeItem:{backgroundColor:J(V).backgroundColor,color:J(V).color},function_icon:{color:J(U).color,font:J(U).font},function_name:{color:J($).color,font:J($).font},function_description:{color:J(q).color,font:J(q).font}},errorStyle:{backgroundColor:J(G).backgroundColor,font:J(G).font,color:J(G).color}},i={backgroundColor:J(P).backgroundColor,font:J(P).font,color:J(P).color};this.setTheme({rules:t,editorContentStyle:n,editorGuttersStyle:i})},t.prototype.isFormattedFormula=function(){return this.zQt.state.field(o.isFormattedFormulaField)},t.prototype.npe=function(t){var n=nt().concat(this.ipe);return r.State.EditorState.create({extensions:n,doc:t})},t}(),n.FormulaEditorCore=tt},958:function(t,n,i){var e,r,u,o,s,h,f,a=this&&this.hJr||(Object.create?function(t,n,i,e){void 0===e&&(e=i);var r=Object.getOwnPropertyDescriptor(n,i);r&&!("get"in r?!n.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(t,e,r)}:function(t,n,i,e){void 0===e&&(e=i),t[e]=n[i]}),c=this&&this.dJr||function(t,n){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(n,i)||a(n,t,i)};Object.defineProperty(n,"__esModule",{value:!0}),n.findControl=n.vve=n.Commands=n.FormulaEditor=void 0,e=i(376),i(390),i(636),r=i(357),u=i(413),o=i(967),s=i(357),Object.defineProperty(n,"FormulaEditor",{enumerable:!0,get:function(){return s.FormulaEditor}}),h=i(636),Object.defineProperty(n,"Commands",{enumerable:!0,get:function(){return h.Commands}}),n.vve={mve:u.getDiagnostic,I5:o.format},c(i(236),n),f=function(t){return"string"==typeof t&&(t=document.getElementById(t)),(0,e.GC$)(t).data(r.CONST_FORMULA_EDITOR)},n.findControl=f},967:function(t,n,i){var e,r,u,o,s,h=this&&this.mJr||function(){return h=Object.assign||function(t){var n,i,e,r;for(i=1,e=arguments.length;i<e;i++)for(r in n=arguments[i])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},h.apply(this,arguments)};function f(t,n){var i,o=new e.Parser,s=n.parseContext,f=(0,r.parse)(t,o,s,!1,!1);if(f)return i=h(h({parser:o,oneIndentTab:u.WHITESPACE.repeat(n.tabSize)},n),(0,r.getCultureInfo)()),u.EQUAL+a(f,0,i,u.EQUAL)}function a(t,n,i,r,u,o){var s,h,f;return void 0===r&&(r=""),void 0===u&&(u=""),void 0===o&&(o=!0),t?(s=c(t,i),S(h=x(n,i,o)+s,i,r,u)&&((f=t.type)===e.ExpressionType.operator?h=l(t,n,i,r,u,o):f===e.ExpressionType.function?h=p(t,n,i,r,u,o):f===e.ExpressionType.parentheses?h=w(t,n,i,o):f===e.ExpressionType.array&&(h=m(t,n,i,o))),h):""}function c(t,n){var i,r;return t?r=(i=t.type)===e.ExpressionType.operator?v(t,n):i===e.ExpressionType.function?k(t,n):i===e.ExpressionType.parentheses?u.LEFT_PARENTHESES+c(t.value,n)+u.RIGHT_PARENTHESES:i===e.ExpressionType.array?g(t,n):b(t,n):""}function l(t,n,i,e,r,o){var h,f,l,v,y=t.operatorType,p=E(y);return A(y)?h=x(n,i,o)+p+a(t.value,n,i,e,r,!1):D(y)?h=a(t.value,n,i,e,p+r,o)+p:18===y?h=d(t,n,i,o):I(y)?(l=e+(f=a(t.value,n,i,e,u.WHITESPACE+p+s+r))+u.WHITESPACE+p,S(v=c(t.value2,i),i,l+u.WHITESPACE,r)?(v=a(t.value2,n+1,i,l+s,r),h=f+u.WHITESPACE+p+s+v):h=f+u.WHITESPACE+p+u.WHITESPACE+v):h=(f=a(t.value,n,i,e,r))+p+(v=a(t.value2,n,i,e+f+p,r,!1)),h}function v(t,n){var i,e,r,o=t.operatorType,s=E(o);return A(o)?i=s+c(t.value,n):D(o)?i=c(t.value,n)+s:(e=c(t.value,n),r=c(t.value2,n),i=18===o?y(t,n):I(o)?e+u.WHITESPACE+s+u.WHITESPACE+r:e+s+r),i}function d(t,n,i,e){return x(n,i,e)+b(t,i)}function y(t,n){return b(t,n)}function p(t,n,i,r,h,f){var c,l,v,d,y,p=x(n,i,f),k=(0,e.isFunction)(t.function)&&t.function.name||t.functionName;if(k===o)return a(t.arguments[0],n,i,r,"#"+h,f)+"#";if("@"===k)return p+"@"+a(t.arguments[0],n,i,r+p+"@",h,!1);if(c=!k&&t.function instanceof e.Expression?a(t.function,n,i,r,h,f)+u.LEFT_PARENTHESES:p+k+u.LEFT_PARENTHESES,0===(v=(l=t.arguments||[]).length))return c+u.RIGHT_PARENTHESES;for(c+=s,d=0;d<v;d++)c+=a(y=l[d],n+1,i),d!==v-1&&(c+=i.listSeparator),c+=s;return c+x(n,i)+u.RIGHT_PARENTHESES}function k(t,n){var i,r,s,h,f,a=(0,e.isFunction)(t.function)&&t.function.name||t.functionName;if(a===o)return c(t.arguments[0],n)+"#";if("@"===a)return"@"+c(t.arguments[0],n);for(i=!a&&t.function instanceof e.Expression?c(t.function,n)+u.LEFT_PARENTHESES:R(a)+u.LEFT_PARENTHESES,s=(r=t.arguments||[]).length,h=0;h<s;h++)i+=c(f=r[h],n),h!==s-1&&(i+=n.listSeparator+u.WHITESPACE);return i+u.RIGHT_PARENTHESES}function m(t,n,i,e){var r,o,h=t.value,f=h.getRowCount(),a=h.getColumnCount(),c=x(n,i,e),l=x(n+1,i),v=c+u.LEFT_CURLY_BRACKETS+s;for(r=0;r<f;r++){for(v+=l,o=0;o<a;o++)v+=M(h.getValue(r,o),i),o!==a-1&&(v+=i.arrayListSeparator+u.WHITESPACE);r!==f-1&&(v+=i.arrayGroupSeparator),v+=s}return v+x(n,i)+u.RIGHT_CURLY_BRACKETS}function g(t,n){var i,e,r=t.value,o=r.getRowCount(),s=r.getColumnCount(),h=u.LEFT_CURLY_BRACKETS;for(i=0;i<o;i++){for(e=0;e<s;e++)h+=M(r.getValue(i,e),n),e!==s-1&&(h+=n.arrayListSeparator+u.WHITESPACE);i!==o-1&&(h+=n.arrayGroupSeparator+u.WHITESPACE)}return h+u.RIGHT_CURLY_BRACKETS}function w(t,n,i,e){var r=a(t.value,n+1,i),o=x(n,i,e);return o+u.LEFT_PARENTHESES+s+r+s+x(n,i)+u.RIGHT_PARENTHESES}function b(t,n){var i=[];return n.parser.unparse(n.parseContext,t,i),i.join("")}function M(t,n){var i,r;return"string"==typeof t?i=e.ExpressionType.string:"boolean"==typeof t?i=e.ExpressionType.boolean:"number"==typeof t&&(i=e.ExpressionType.number),void 0===i?t.toString():((r=new e.Expression(i)).value=t,b(r,n))}function x(t,n,i){return void 0===i&&(i=!0),i?n.oneIndentTab.repeat(t):""}function S(t,n,i,e){if(t.trim().length>n.widthLimit)return!0;var r=C(i)+t+O(e);return n.measureTextFunc(r)>n.lineWidthLimit}function C(t){var n=t.lastIndexOf(s);return-1===n?t:t.substring(n+1)}function O(t){var n=t.indexOf(s);return-1===n?t:t.substring(0,n)}function A(t){return 0===t||1===t}function D(t){return 2===t}function E(t){return e.Z9t[t]}function I(t){return!(15===t||16===t||17===t||18===t)}function R(t){var n=(0,e.getMapping)()&&(0,e.getMapping)().builtInFunctionsMapping,i=n&&n[t];return i&&i.alias&&(t=i.alias),t}Object.defineProperty(n,"__esModule",{value:!0}),n.format=void 0,e=i(35),r=i(129),u=i(348),o="ANCHORARRAY",s="\n",n.format=f},971:function(t,n,i){var e,r;Object.defineProperty(n,"__esModule",{value:!0}),n.foldExtension=void 0,e=i(833),r=i(129),n.foldExtension=e.Language.foldService.of((function(t,n,i){var e,u,o,s=t.doc.lineAt(n),h=t.doc.lines,f=(0,r.getLineIndent)(s.text),a=n,c=i;for(e=s.number+1;e<h&&(u=t.doc.line(e),(o=(0,r.getLineIndent)(u.text))>f);e++)c=u.to;return t.doc.lineAt(a).number===t.doc.lineAt(c).number?null:{from:a=s.to,to:c}}))}},e={};function r(t){var n,u=e[t];return void 0!==u?u.exports:(n=e[t]={exports:{}},i[t].call(n.exports,n,n.exports,r),n.exports)}n=r(958),(((t=void 0===t?{}:t).Spread=t.Spread||{}).Sheets=t.Spread.Sheets||{}).FormulaPanel=n}(),t.Spread.Common.CultureManager.reloadResources&&t.Spread.Common.CultureManager.reloadResources("FormulaPanel")}));