diff --git a/docs/requirements.txt b/docs/requirements.txt index 0ab737a..555c4a2 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,3 +1,5 @@ +ipython +ipykernel sphinx nbsphinx sphinx-material diff --git a/docs/src/check.ipynb b/docs/src/check.ipynb index 9c86666..8b1bcdb 100644 --- a/docs/src/check.ipynb +++ b/docs/src/check.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "dac2ffd0-6144-4f07-b050-4895018d20fe", + "id": "0", "metadata": {}, "source": [ "# Writing checks" @@ -10,7 +10,7 @@ }, { "cell_type": "markdown", - "id": "af868249-e96e-44f1-8ed4-1f8bb9b632b6", + "id": "1", "metadata": {}, "source": [ "Checks intention is to give students a way to validate their code solution. The student's code can be validated by providing a list of inputs and references comparing the output of the student's code with the references, or by directy testing certain functional behavior of the code. In cases when reference outputs need to be obfuscated the outputs that are compared can be passed through a _fingerprint_ function. This notebook goes through each of these features and presents an example." @@ -18,8 +18,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "id": "d0fb3494-ef99-4872-bbfd-fb6bb277aae4", + "execution_count": 2, + "id": "2", "metadata": { "tags": [] }, @@ -32,7 +32,7 @@ }, { "cell_type": "markdown", - "id": "9ba29257-5b8e-4b57-a397-bfc169b799e9", + "id": "3", "metadata": {}, "source": [ "Similar as for the `ExerciseRegistry` we need to define a `CheckRegistry` that registers the checks for each exercise." @@ -40,8 +40,8 @@ }, { "cell_type": "code", - "execution_count": 2, - "id": "9b1a451b-5aac-4b14-9c19-c103d55fcda5", + "execution_count": 3, + "id": "4", "metadata": { "tags": [] }, @@ -52,7 +52,7 @@ }, { "cell_type": "markdown", - "id": "2e42e747-0b38-4849-a380-630eb77a1570", + "id": "5", "metadata": {}, "source": [ "## Checks using inputs and output references" @@ -60,17 +60,16 @@ }, { "cell_type": "code", - "execution_count": 3, - "id": "e440765f-66f9-4505-83f3-18396729ab2c", + "execution_count": 4, + "id": "6", "metadata": { - "scrolled": true, "tags": [] }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e729b5426a374e23a69a9452e2155448", + "model_id": "5885830d34fa4f9492d864ed95515eab", "version_major": 2, "version_minor": 0 }, @@ -78,7 +77,7 @@ "CodeExercise(children=(CssStyle(value='\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "\n", - "function_body": "import numpy as np\nreturn np.cos(arr) # oops! wrong solution\n", - "function_name": "sin", - "function_parameters": "arr", - "layout": "IPY_MODEL_2bde408380a94636a1a3272ad8e733ce", - "name": "", - "widget_instance_count_trait": "0" - } - }, - "41e0bfcb0b594f9ab8d810fe0210c8e9": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "433bb630da464ff9bca86daae245bb95": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "BoxModel", - "state": { - "layout": "IPY_MODEL_589a8579563d4fa190578e92d42c70ed" - } - }, - "4377476c1c4341059b5f64a4fdb4a5a4": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "43ef27be9b79499e9b6f4c09b4b71254": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_221c767641da43cf8397cc1acbf39358", - "IPY_MODEL_10d2616145d0495fab9305c66d97c8e9" - ], - "layout": "IPY_MODEL_733df51db84a415a83e8765547fb7c3c" - } - }, - "44695f8c538142d2af32de53ddc069d4": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-check-cue-box" - ], - "children": [ - "IPY_MODEL_3f6e71fbcbc443a2aac9753b1ba51f44" - ], - "layout": "IPY_MODEL_466ffdf6a8e74db8b76e92ac5a732eb3" - } - }, - "4580593cf2ea41dc99f75f7de2e8ddd8": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-update-reset-cue-button--cue", - "scwidget-update-reset-cue-button" - ], - "description": "Run Code", - "layout": "IPY_MODEL_696d1bd96b1243679f7b14b194f29b13", - "style": "IPY_MODEL_4a4a240012f24af6842d1caba331fd59", - "tooltip": null - } - }, - "466db0a2a5114b5a95394b87003e03bc": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "_dom_classes": [ - "scwidget-cue-output" - ], - "layout": "IPY_MODEL_50d21651d2d64a07a50354cb065bcba6", - "outputs": [ - { - "ename": "CodeValidationError", - "evalue": "Oops!", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/code/_widget_code_input.py:183\u001b[0m, in \u001b[0;36mCodeInput.get_function_object..catch_exceptions..wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 182\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 183\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 184\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n", - "File \u001b[0;32mscwidgets.code._widget_code_input:4\u001b[0m, in \u001b[0;36merror\u001b[0;34m(arr)\u001b[0m\n", - "\u001b[0;31mValueError\u001b[0m: Oops!", - "\nThe above exception was the direct cause of the following exception:\n", - "\u001b[0;31mCodeValidationError\u001b[0m Traceback (most recent call last)", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/exercise/_widget_code_exercise.py:605\u001b[0m, in \u001b[0;36mCodeExercise.handle_checks_result\u001b[0;34m(self, results)\u001b[0m\n\u001b[1;32m 603\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m result \u001b[38;5;129;01min\u001b[39;00m results:\n\u001b[1;32m 604\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, \u001b[38;5;167;01mException\u001b[39;00m):\n\u001b[0;32m--> 605\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m result\n\u001b[1;32m 606\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(result, CheckResult):\n\u001b[1;32m 607\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m result\u001b[38;5;241m.\u001b[39msuccessful:\n", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/check/_widget_check_registry.py:246\u001b[0m, in \u001b[0;36mCheckRegistry.check_widget\u001b[0;34m(self, widget)\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 245\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m check \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_checks[widget]:\n\u001b[0;32m--> 246\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mcheck\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 247\u001b[0m checks_result\u001b[38;5;241m.\u001b[39mappend(result)\n\u001b[1;32m 248\u001b[0m widget\u001b[38;5;241m.\u001b[39mhandle_checks_result(checks_result)\n", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/check/_check.py:228\u001b[0m, in \u001b[0;36mCheck.check_function\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 225\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m check_result\n\u001b[1;32m 227\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m i, input_parameters \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28menumerate\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_inputs_parameters):\n\u001b[0;32m--> 228\u001b[0m output \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_function_to_check\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43minput_parameters\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 229\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (\u001b[38;5;28misinstance\u001b[39m(output, \u001b[38;5;28mtuple\u001b[39m)):\n\u001b[1;32m 230\u001b[0m output \u001b[38;5;241m=\u001b[39m (output,)\n", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/exercise/_widget_code_exercise.py:598\u001b[0m, in \u001b[0;36mCodeExercise.compute_output_to_check\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 597\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcompute_output_to_check\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Check\u001b[38;5;241m.\u001b[39mFunOutParamsT:\n\u001b[0;32m--> 598\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun_code\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/exercise/_widget_code_exercise.py:716\u001b[0m, in \u001b[0;36mCodeExercise.run_code\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 714\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_code\u001b[38;5;241m.\u001b[39mrun(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m 715\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m CodeValidationError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m--> 716\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n\u001b[1;32m 717\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 718\u001b[0m \u001b[38;5;66;03m# we give the student the additional information that this is most likely\u001b[39;00m\n\u001b[1;32m 719\u001b[0m \u001b[38;5;66;03m# not because of his code\u001b[39;00m\n\u001b[1;32m 720\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m python_version() \u001b[38;5;241m>\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m3.11\u001b[39m\u001b[38;5;124m\"\u001b[39m:\n", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/exercise/_widget_code_exercise.py:714\u001b[0m, in \u001b[0;36mCodeExercise.run_code\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 710\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_code \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 711\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[1;32m 712\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mrun_code was invoked, but no code was given on initializaion\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 713\u001b[0m )\n\u001b[0;32m--> 714\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_code\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrun\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 715\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m CodeValidationError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 716\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m e\n", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/code/_widget_code_input.py:96\u001b[0m, in \u001b[0;36mCodeInput.run\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 95\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrun\u001b[39m(\u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Check\u001b[38;5;241m.\u001b[39mFunOutParamsT:\n\u001b[0;32m---> 96\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_function_object\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/code/scicode-widgets/src/scwidgets/code/_widget_code_input.py:186\u001b[0m, in \u001b[0;36mCodeInput.get_function_object..catch_exceptions..wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 184\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n\u001b[1;32m 185\u001b[0m err_msg \u001b[38;5;241m=\u001b[39m format_generic_error_msg(exc, code_widget\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m)\n\u001b[0;32m--> 186\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m CodeValidationError(err_msg, orig_exc\u001b[38;5;241m=\u001b[39mexc) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n", - "\u001b[0;31mCodeValidationError\u001b[0m: Oops!" - ] - } - ] - } - }, - "466ffdf6a8e74db8b76e92ac5a732eb3": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "46e23c72045b46e1a9e8831719d8591f": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-update-reset-cue-button--cue", - "scwidget-update-reset-cue-button" - ], - "description": "Run Code", - "layout": "IPY_MODEL_c73eebb402f14d05bfa5f173a08bd91e", - "style": "IPY_MODEL_55f1aaedb8834ca8a51e8e9e2c5bff20", - "tooltip": null - } - }, - "481b47d792324002bc663bba879bb144": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_2ff34c41202e4d4fbaa00c4aff90bbed", - "IPY_MODEL_d8a5315c617643319e1f0ad2e9568454" - ], - "layout": "IPY_MODEL_71ad7b23d9c64a55871fcb1010dadfdc" - } - }, - "493cc835cb304c58ab517e5e13cedbb2": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "496ad00ff7f84a6ba032fe894a762853": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "4a4a240012f24af6842d1caba331fd59": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "4df9d96b536b407b86d9cca0e0592c3f": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-check-reset-cue-button" - ], - "description": "Check Code", - "layout": "IPY_MODEL_fd84cedfaa694eaf8ac3b1d33a6974a7", - "style": "IPY_MODEL_41e0bfcb0b594f9ab8d810fe0210c8e9", - "tooltip": null - } - }, - "4e04b3a6d754476492f0241f50540e35": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "height": "auto", - "width": "98%" - } - }, - "4e6e13dbf4e34a7e935d809814ce52eb": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "BoxModel", - "state": { - "layout": "IPY_MODEL_d1a60bd51f8d489f91843d472de4301f" - } - }, - "50d21651d2d64a07a50354cb065bcba6": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "51c3f8e31b5f493f93487d29001d0833": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-check-cue-box" - ], - "children": [ - "IPY_MODEL_5fcfe503ae514e3aa4b0f1dca07a9a40" - ], - "layout": "IPY_MODEL_d2f739cc8d7845baa1b885e6ba99e971" - } - }, - "51f3e350b5684d9cb19536e536f3e880": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "52dcae1ea61a4d0d80b57f01f299c2c3": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "55f1aaedb8834ca8a51e8e9e2c5bff20": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "577ee11e411f4d37ae823d5212a4e2cb": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "589a8579563d4fa190578e92d42c70ed": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "5af82ea6570841aaaf370f78bed416c4": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_fa01047fd83c4eef941430a987639762", - "IPY_MODEL_94a080c3594942958cfbe1be2c1cf21e", - "IPY_MODEL_7f0642279f664162a1e020bfbd4fa9df", - "IPY_MODEL_466db0a2a5114b5a95394b87003e03bc" - ], - "layout": "IPY_MODEL_6279ce1cf3c442579fc5efade187ceb9" - } - }, - "5c94c6779781453badd89780ac751951": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "_dom_classes": [ - "scwidget-cue-output" - ], - "layout": "IPY_MODEL_cb7fcdad52f4419bbd65471779179eb4", - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": "\u001b[1m\u001b[31mCheck failed\u001b[0m\n\u001b[1m\u001b[31m------------\u001b[0m\n\u001b[92massert_type passed\u001b[0m\u001b[92m for input\n\u001b[0m \u001b[94marr\u001b[0m: array([0. , 0.78539816, 1.57079633, 2.35619449, 3.14159265])\n\u001b[92massert_shape passed\u001b[0m\u001b[92m for input\n\u001b[0m \u001b[94marr\u001b[0m: array([0. , 0.78539816, 1.57079633, 2.35619449, 3.14159265])\n\u001b[91massert_numpy_allclose failed\u001b[0m\u001b[91m for\n\u001b[0m\u001b[91m|\u001b[0m \u001b[94marr\u001b[0m: array([0. , 0.78539816, 1.57079633, 2.35619449, 3.14159265])\n\u001b[91m|\u001b[0m \u001b[94m> output 0: \u001b[0m[ 1.00000000e+00 7.07106784e-01 -3.20510345e-09 -7.07106781e-01\n\u001b[91m|\u001b[0m -1.00000000e+00]\n\u001b[91m|\u001b[0m \u001b[91mOutput is not close to reference absolute difference is 4.414213567844548, relative difference is 5.000000006794897.\u001b[0m\n" - } - ] - } - }, - "5fcfe503ae514e3aa4b0f1dca07a9a40": { - "model_module": "anywidget", - "model_module_version": "~0.9.*", - "model_name": "AnyModel", - "state": { - "_anywidget_id": "scwidgets.code._widget_code_input.CodeInput", - "_css": ".forced-indent{width:4em}.CodeMirror{border:1px solid #fff;height:auto}.CodeMirror.widget-code-input-signature{border-bottom:0px}.CodeMirror.widget-code-input-docstring,.CodeMirror.widget-code-input-body{border-top:0px}\n", - "_esm": "var cO=Object.defineProperty;var uO=(i,t)=>{for(var e in t)cO(i,e,{get:t[e],enumerable:!0})};var V=class i{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,r){[t,e]=Li(this,t,e);let n=[];return this.decompose(0,t,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(e,this.length,n,1),qi.from(n,this.length-(e-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Li(this,t,e);let r=[];return this.decompose(t,e,r,0),qi.from(r,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),n=new oi(this),s=new oi(t);for(let o=e,l=e;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=r)return!0}}iter(t=1){return new oi(this,t)}iterRange(t,e=this.length){return new ts(this,t,e)}iterLines(t,e){let r;if(t==null)r=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;r=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new es(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError(\"A document must have at least one line\");return t.length==1&&!t[0]?i.empty:t.length<=32?new Xt(t):qi.from(Xt.split(t,[]))}},Xt=class i extends V{constructor(t,e=dO(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((e?r:l)>=t)return new bl(n,l,r,o);n=l+1,r++}}decompose(t,e,r,n){let s=t<=0&&e>=this.length?this:new i(Ec(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=r.pop(),l=Jn(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new i(l,o.length+s.length));else{let a=l.length>>1;r.push(new i(l.slice(0,a)),new i(l.slice(a)))}}else r.push(s)}replace(t,e,r){if(!(r instanceof i))return super.replace(t,e,r);[t,e]=Li(this,t,e);let n=Jn(this.text,Jn(r.text,Ec(this.text,0,t)),e),s=this.length+r.length-(e-t);return n.length<=32?new i(n,s):qi.from(i.split(n,[]),s)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;s<=e&&ot&&o&&(n+=r),ts&&(n+=l.slice(Math.max(0,t-s),e-s)),s=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let r=[],n=-1;for(let s of t)r.push(s),n+=s.length+1,r.length==32&&(e.push(new i(r,n)),r=[],n=-1);return n>-1&&e.push(new i(r,n)),e}},qi=class i extends V{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=r+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,r,n);n=l+1,r=a+1}}decompose(t,e,r,n){for(let s=0,o=0;o<=e&&s=o){let h=n&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?r.push(l):l.decompose(t-o,e-o,r,h)}o=a+1}}replace(t,e,r){if([t,e]=Li(this,t,e),r.lines=s&&e<=l){let a=o.replace(t-s,e-s,r),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new i(f,this.length-(e-t)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(t,e,r)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;st&&s&&(n+=r),to&&(n+=l.sliceString(t-o,e-o,r)),o=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let r=0,[n,s,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,s+=e){if(n==o||s==l)return r;let a=this.children[n],h=t.children[s];if(a!=h)return r+a.scanIdentical(h,e);r+=a.length+1}}static from(t,e=t.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let d of t)r+=d.lines;if(r<32){let d=[];for(let m of t)m.flatten(d);return new Xt(d,e)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let m;if(d.lines>s&&d instanceof i)for(let O of d.children)c(O);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Xt&&a&&(m=f[f.length-1])instanceof Xt&&d.lines+m.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new Xt(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:i.from(f,h)),h=-1,a=f.length=0)}for(let d of t)c(d);return u(),l.length==1?l[0]:new i(l,e)}};V.empty=new Xt([\"\"],0);function dO(i){let t=-1;for(let e of i)t+=e.length+1;return t}function Jn(i,t,e=0,r=1e9){for(let n=0,s=0,o=!0;s=e&&(a>r&&(l=l.slice(0,r-n)),n0?1:(t instanceof Xt?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,l=n instanceof Xt?n.text.length:n.children.length;if(o==(e>0?l:0)){if(r==0)return this.done=!0,this.value=\"\",this;e>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(e>0?0:1)){if(this.offsets[r]+=e,t==0)return this.lineBreak=!0,this.value=`\n`,this;t--}else if(n instanceof Xt){let a=n.text[o+(e<0?-1:0)];if(this.offsets[r]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=n.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[r]+=e):(e<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof Xt?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},ts=class{constructor(t,e,r){this.value=\"\",this.done=!1,this.cursor=new oi(t,e>r?-1:1),this.pos=e>r?t.length:0,this.from=Math.min(e,r),this.to=Math.max(e,r)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value=\"\",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let r=e<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=r?n:e<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=\"\"}},es=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value=\"\",this.done=!1}next(t=0){let{done:e,lineBreak:r,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value=\"\",this.afterBreak=!1):e?(this.done=!0,this.value=\"\"):r?this.afterBreak?this.value=\"\":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<\"u\"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},oi.prototype[Symbol.iterator]=ts.prototype[Symbol.iterator]=es.prototype[Symbol.iterator]=function(){return this});var bl=class{constructor(t,e,r,n){this.from=t,this.to=e,this.number=r,this.text=n}get length(){return this.to-this.from}};function Li(i,t,e){return t=Math.max(0,Math.min(i.length,t)),[t,Math.max(t,Math.min(i.length,e))]}var Di=\"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(i=>i?parseInt(i,36):1);for(let i=1;ii)return Di[t-1]<=i;return!1}function $c(i){return i>=127462&&i<=127487}var qc=8205;function at(i,t,e=!0,r=!0){return(e?Wc:mO)(i,t,r)}function Wc(i,t,e){if(t==i.length)return t;t&&Ic(i.charCodeAt(t))&&Nc(i.charCodeAt(t-1))&&t--;let r=dt(i,t);for(t+=wt(r);t=0&&$c(dt(i,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function mO(i,t,e){for(;t>0;){let r=Wc(i,t-2,e);if(r=56320&&i<57344}function Nc(i){return i>=55296&&i<56320}function dt(i,t){let e=i.charCodeAt(t);if(!Nc(e)||t+1==i.length)return e;let r=i.charCodeAt(t+1);return Ic(r)?(e-55296<<10)+(r-56320)+65536:e}function vr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function wt(i){return i<65536?1:2}var Sl=/\\r\\n?|\\n/,ut=function(i){return i[i.Simple=0]=\"Simple\",i[i.TrackDel=1]=\"TrackDel\",i[i.TrackBefore=2]=\"TrackBefore\",i[i.TrackAfter=3]=\"TrackAfter\",i}(ut||(ut={})),Me=class i{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=l}else{if(r!=ut.Simple&&h>=t&&(r==ut.TrackDel&&nt||r==ut.TrackBefore&&nt))return null;if(h>t||h==t&&e<0&&!l)return t==n||e<0?s:s+a;s+=a}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let r=0,n=0;r=0&&n<=e&&l>=t)return ne?\"cover\":!0;n=l}return!1}toString(){let t=\"\";for(let e=0;e=0?\":\"+n:\"\")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=\"number\"))throw new RangeError(\"Invalid JSON representation of ChangeDesc\");return new i(t)}static create(t){return new i(t)}},vt=class i extends Me{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError(\"Applying change set to a document with the wrong length\");return wl(this,(e,r,n,s,o)=>t=t.replace(n,n+(r-e),o),!1),t}mapDesc(t,e=!1){return vl(this,t,e,!0)}invert(t){let e=this.sections.slice(),r=[];for(let n=0,s=0;n=0){e[n]=l,e[n+1]=o;let a=n>>1;for(;r.length0&&Ve(r,e,s.text),s.forward(f),l+=f}let h=t[o++];for(;l>1].toJSON()))}return t}static of(t,e,r){let n=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;ou||c<0||u>e)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${e})`);let m=d?typeof d==\"string\"?V.of(d.split(r||Sl)):d:V.empty,O=m.length;if(c==u&&O==0)return;co&&yt(n,c-o,-1),yt(n,u-c,O),Ve(s,n,m),o=u}}return h(t),a(!l),l}static empty(t){return new i(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError(\"Invalid JSON representation of ChangeSet\");let e=[],r=[];for(let n=0;nl&&typeof o!=\"string\"))throw new RangeError(\"Invalid JSON representation of ChangeSet\");if(s.length==1)e.push(s[0],0);else{for(;r.length=0&&e<=0&&e==i[n+1]?i[n]+=t:t==0&&i[n]==0?i[n+1]+=e:r?(i[n]+=t,i[n+1]+=e):i.push(t,e)}function Ve(i,t,e){if(e.length==0)return;let r=t.length-2>>1;if(r>1])),!(e||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];t(n,h,s,f,c),n=h,s=f}}}function vl(i,t,e,r=!1){let n=[],s=r?[]:null,o=new li(i),l=new li(t);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);yt(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>h),s.forward2(a),o.forward(a)}}}}var li=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?V.empty:t[e]}textBit(t){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length&&!t?V.empty:e[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},$i=class i{constructor(t,e,r){this.from=t,this.to=e,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let r,n;return this.empty?r=n=t.mapPos(this.from,e):(r=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return b.range(t,e);let r=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return b.range(this.anchor,r)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!=\"number\"||typeof t.head!=\"number\")throw new RangeError(\"Invalid JSON representation for SelectionRange\");return b.range(t.anchor,t.head)}static create(t,e,r){return new i(t,e,r)}},b=class i{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:i.create(this.ranges.map(r=>r.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;rt.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=\"number\"||t.main>=t.ranges.length)throw new RangeError(\"Invalid JSON representation for EditorSelection\");return new i(t.ranges.map(e=>$i.fromJSON(e)),t.main)}static single(t,e=t){return new i([i.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError(\"A selection needs at least one range\");for(let r=0,n=0;nt?8:0)|s)}static normalized(t,e=0){let r=t[e];t.sort((n,s)=>n.from-s.from),e=t.indexOf(r);for(let n=1;ns.head?i.range(a,l):i.range(l,a))}}return new i(t,e)}};function zc(i,t){for(let e of i.ranges)if(e.to>t)throw new RangeError(\"Selection points outside of document\")}var $l=0,A=class i{constructor(t,e,r,n,s){this.combine=t,this.compareInput=e,this.compare=r,this.isStatic=n,this.id=$l++,this.default=t([]),this.extensions=typeof s==\"function\"?s(this):s}get reader(){return this}static define(t={}){return new i(t.combine||(e=>e),t.compareInput||((e,r)=>e===r),t.compare||(t.combine?(e,r)=>e===r:ql),!!t.static,t.enables)}of(t){return new Bi([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,2,e)}from(t,e){return e||(e=r=>r),this.compute([t],r=>e(r.field(t)))}};function ql(i,t){return i==t||i.length==t.length&&i.every((e,r)=>e===t[r])}var Bi=class{constructor(t,e,r,n){this.dependencies=t,this.facet=e,this.type=r,this.value=n,this.id=$l++}dynamicSlot(t){var e;let r=this.value,n=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c==\"doc\"?a=!0:c==\"selection\"?h=!0:((e=t[c.id])!==null&&e!==void 0?e:1)&1||f.push(t[c.id]);return{create(c){return c.values[o]=r(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||kl(c,f)){let d=r(c);if(l?!Dc(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,m=u.config.address[s];if(m!=null){let O=ns(u,m);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===c.facet(g):g instanceof it?u.field(g,!1)==c.field(g,!1):!0)||(l?Dc(d=r(c),O,n):n(d=r(c),O)))return c.values[o]=O,0}else d=r(c);return c.values[o]=d,1}}}};function Dc(i,t,e){if(i.length!=t.length)return!1;for(let r=0;ri[a.id]),n=e.map(a=>a.type),s=r.filter(a=>!(a&1)),o=i[t.id]>>1;function l(a){let h=[];for(let f=0;fr===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Bc).find(r=>r.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:r=>(r.values[e]=this.create(r),1),update:(r,n)=>{let s=r.values[e],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[e]=o,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[e]=n.field(this),0):(r.values[e]=this.create(r),1)}}init(t){return[this,Bc.of({field:this,create:t})]}get extension(){return this}},ni={lowest:4,low:3,default:2,high:1,highest:0};function xr(i){return t=>new is(t,i)}var ie={highest:xr(ni.highest),high:xr(ni.high),default:xr(ni.default),low:xr(ni.low),lowest:xr(ni.lowest)},is=class{constructor(t,e){this.inner=t,this.prec=e}},pe=class i{of(t){return new br(this,t)}reconfigure(t){return i.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},br=class{constructor(t,e){this.compartment=t,this.inner=e}},rs=class i{constructor(t,e,r,n,s,o){for(this.base=t,this.compartments=e,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,r){let n=[],s=Object.create(null),o=new Map;for(let u of OO(t,e,o))u instanceof it?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=r?.config.facets;for(let u in s){let d=s[u],m=d[0].facet,O=f&&f[u]||[];if(d.every(g=>g.type==0))if(l[m.id]=a.length<<1|1,ql(O,d))a.push(r.facet(m));else{let g=m.combine(d.map(x=>x.value));a.push(r&&m.compare(g,r.facet(m))?r.facet(m):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(x=>g.dynamicSlot(x)));l[m.id]=h.length<<1,h.push(g=>gO(g,m,d))}}let c=h.map(u=>u(l));return new i(t,o,c,l,a,s)}};function OO(i,t,e){let r=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=r[a].indexOf(o);h>-1&&r[a].splice(h,1),o instanceof br&&e.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof br){if(e.has(o.compartment))throw new RangeError(\"Duplicate use of compartment in extensions\");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),s(h,l)}else if(o instanceof is)s(o.inner,o.prec);else if(o instanceof it)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Bi)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,ni.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ni.default),r.reduce((o,l)=>o.concat(l))}function yr(i,t){if(t&1)return 2;let e=t>>1,r=i.status[e];if(r==4)throw new Error(\"Cyclic dependency between fields and/or facets\");if(r&2)return r;i.status[e]=4;let n=i.computeSlot(i,i.config.dynamicSlots[e]);return i.status[e]=2|n}function ns(i,t){return t&1?i.config.staticValues[t>>1]:i.values[t>>1]}var Zc=A.define(),Tl=A.define({combine:i=>i.some(t=>t),static:!0}),Fc=A.define({combine:i=>i.length?i[0]:void 0,static:!0}),_c=A.define(),Gc=A.define(),Hc=A.define(),Uc=A.define({combine:i=>i.length?i[0]:!1}),Et=class{constructor(t,e){this.type=t,this.value=e}static define(){return new Pl}},Pl=class{of(t){return new Et(this,t)}},Cl=class{constructor(t){this.map=t}of(t){return new M(this,t)}},M=class i{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new i(this.type,e)}is(t){return this.type==t}static define(t={}){return new Cl(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let r=[];for(let n of t){let s=n.map(e);s&&r.push(s)}return r}};M.reconfigure=M.define();M.appendConfig=M.define();var lt=class i{constructor(t,e,r,n,s,o){this.startState=t,this.changes=e,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&zc(r,e.newLength),s.some(l=>l.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(t,e,r,n,s,o){return new i(t,e,r,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(i.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]==\".\"))}};lt.time=Et.define();lt.userEvent=Et.define();lt.addToHistory=Et.define();lt.remote=Et.define();function xO(i,t){let e=[];for(let r=0,n=0;;){let s,o;if(r=i[r]))s=i[r++],o=i[r++];else if(n=0;n--){let s=r[n](i);s instanceof lt?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof lt?i=s[0]:i=Kc(t,Xi(s),!1)}return i}function bO(i){let t=i.startState,e=t.facet(Hc),r=i;for(let n=e.length-1;n>=0;n--){let s=e[n](i);s&&Object.keys(s).length&&(r=jc(r,Al(t,s,i.changes.newLength),!0))}return r==i?i:lt.create(t,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var SO=[];function Xi(i){return i==null?SO:Array.isArray(i)?i:[i]}var F=function(i){return i[i.Word=0]=\"Word\",i[i.Space=1]=\"Space\",i[i.Other=2]=\"Other\",i}(F||(F={})),wO=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,Ql;try{Ql=new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\",\"u\")}catch{}function vO(i){if(Ql)return Ql.test(i);for(let t=0;t\"\\x80\"&&(e.toUpperCase()!=e.toLowerCase()||wO.test(e)))return!0}return!1}function kO(i){return t=>{if(!/\\S/.test(t))return F.Space;if(vO(t))return F.Word;for(let e=0;e-1)return F.Word;return F.Other}}var Y=class i{constructor(t,e,r,n,s,o){this.config=t,this.doc=e,this.selection=r,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;ln.set(h,a)),e=null),n.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(e=null,r=l.value):l.is(M.appendConfig)&&(e=null,r=Xi(r).concat(l.value));let s;e?s=t.startState.values.slice():(e=rs.resolve(r,n,this),s=new i(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(Tl)?t.newSelection:t.newSelection.asSingle();new i(e,t.newDoc,o,s,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t==\"string\"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:b.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,r=t(e.ranges[0]),n=this.changes(r.changes),s=[r.range],o=Xi(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return i.create({doc:t.doc,selection:b.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=rs.resolve(t.extensions||[],new Map),r=t.doc instanceof V?t.doc:V.of((t.doc||\"\").split(e.staticFacet(i.lineSeparator)||Sl)),n=t.selection?t.selection instanceof b?t.selection:b.single(t.selection.anchor,t.selection.head):b.single(0);return zc(n,r.length),e.staticFacet(Tl)||(n=n.asSingle()),new i(e,r,n,e.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`\n`}get readOnly(){return this.facet(Uc)}phrase(t,...e){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return e.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(r,n)=>{if(n==\"$\")return\"$\";let s=+(n||1);return!s||s>e.length?r:e[s-1]})),t}languageDataAt(t,e,r=-1){let n=[];for(let s of this.facet(Zc))for(let o of s(this,e,r))Object.prototype.hasOwnProperty.call(o,t)&&n.push(o[t]);return n}charCategorizer(t){return kO(this.languageDataAt(\"wordChars\",t).join(\"\"))}wordAt(t){let{text:e,from:r,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-r,l=t-r;for(;o>0;){let a=at(e,o,!1);if(s(e.slice(a,o))!=F.Word)break;o=a}for(;li.length?i[0]:4});Y.lineSeparator=Fc;Y.readOnly=Uc;Y.phrases=A.define({compare(i,t){let e=Object.keys(i),r=Object.keys(t);return e.length==r.length&&e.every(n=>i[n]==t[n])}});Y.languageData=Zc;Y.changeFilter=_c;Y.transactionFilter=Gc;Y.transactionExtender=Hc;pe.reconfigure=M.define();function kt(i,t,e={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,s))r[s]=e[s](l,o);else throw new Error(\"Config merge conflict for field \"+s)}for(let n in t)r[n]===void 0&&(r[n]=t[n]);return r}var ee=class{eq(t){return this==t}range(t,e=t){return Sr.create(t,e,this)}};ee.prototype.startSide=ee.prototype.endSide=0;ee.prototype.point=!1;ee.prototype.mapMode=ut.TrackDel;var Sr=class i{constructor(t,e,r){this.from=t,this.to=e,this.value=r}static create(t,e,r){return new i(t,e,r)}};function Rl(i,t){return i.from-t.from||i.value.startSide-t.value.startSide}var Ml=class i{constructor(t,e,r,n){this.from=t,this.to=e,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,r,n=0){let s=r?this.to:this.from;for(let o=n,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-t||(r?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,r,n){for(let s=this.findIndex(e,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),r.push(h),n.push(u-o),s.push(d-o))}return{mapped:r.length?new i(n,s,r,l):null,pos:o}}},_=class i{constructor(t,e,r,n){this.chunkPos=t,this.chunk=e,this.nextLayer=r,this.maxPoint=n}static create(t,e,r,n){return new i(t,e,r,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(r&&(e=e.slice().sort(Rl)),this.isEmpty)return e.length?i.of(e):this;let l=new ss(this,null,-1).goto(0),a=0,h=[],f=new Ee;for(;l.value||a=0){let c=e[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+o.length&&o.between(s,t-s,e-s,r)===!1)return}this.nextLayer.between(t,e,r)}}iter(t=0){return wr.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return wr.from(t).goto(e)}static compare(t,e,r,n,s=-1){let o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=Xc(o,l,r),h=new si(o,a,s),f=new si(l,a,s);r.iterGaps((c,u,d)=>Lc(h,c,f,u,d,n)),r.empty&&r.length==0&&Lc(h,0,f,0,0,n)}static eq(t,e,r=0,n){n==null&&(n=999999999);let s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0),o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Xc(s,o),a=new si(s,l,0).goto(r),h=new si(o,l,0).goto(r);for(;;){if(a.to!=h.to||!El(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(t,e,r,n,s=-1){let o=new si(t,null,s).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,r);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(t,e=!1){let r=new Ee;for(let n of t instanceof Sr?[t]:e?TO(t):t)r.add(n.from,n.to,n.value);return r.finish()}static join(t){if(!t.length)return i.empty;let e=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let n=t[r];n!=i.empty;n=n.nextLayer)e=new i(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}};_.empty=new _([],[],null,-1);function TO(i){if(i.length>1)for(let t=i[0],e=1;e0)return i.slice().sort(Rl);t=r}return i}_.empty.nextLayer=_.empty;var Ee=class i{finishChunk(t){this.chunks.push(new Ml(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,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,r){this.addInner(t,e,r)||(this.nextLayer||(this.nextLayer=new i)).add(t,e,r)}addInner(t,e,r){let n=t-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=e,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let r=e.value.length-1;return this.last=e.value[r],this.lastFrom=e.from[r]+t,this.lastTo=e.to[r]+t,!0}finish(){return this.finishInner(_.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=_.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};function Xc(i,t,e){let r=new Map;for(let s of i)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&n.push(new ss(o,e,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let r of this.heap)r.goto(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);return this.next(),this}forward(t,e){for(let r of this.heap)r.forward(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),yl(this.heap,0)}}};function yl(i,t){for(let e=i[t];;){let r=(t<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1=0&&(n=i[r+1],r++),e.compare(n)<0)break;i[r]=e,i[t]=n,t=r}}var si=class{constructor(t,e,r){this.minPoint=r,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=wr.from(t,e,r)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){jn(this.active,t),jn(this.activeTo,t),jn(this.activeRank,t),this.minActive=Vc(this.active,this.activeTo)}addActive(t){let e=0,{value:r,to:n,rank:s}=this.cursor;for(;e0;)e++;Kn(this.active,e,r),Kn(this.activeTo,e,n),Kn(this.activeRank,e,s),t&&Kn(t,e,this.cursor.from),this.minActive=Vc(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&jn(r,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&r[n]=0&&!(this.activeRank[r]t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&e.push(this.active[r]);return e.reverse()}openEnd(t){let e=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)e++;return e}};function Lc(i,t,e,r,n,s){i.goto(t),e.goto(r);let o=r+n,l=r,a=r-t;for(;;){let h=i.to+a-e.to||i.endSide-e.endSide,f=h<0?i.to+a:e.to,c=Math.min(f,o);if(i.point||e.point?i.point&&e.point&&(i.point==e.point||i.point.eq(e.point))&&El(i.activeForPoint(i.to),e.activeForPoint(e.to))||s.comparePoint(l,c,i.point,e.point):c>l&&!El(i.active,e.active)&&s.compareRange(l,c,i.active,e.active),f>o)break;l=f,h<=0&&i.next(),h>=0&&e.next()}}function El(i,t){if(i.length!=t.length)return!1;for(let e=0;e=t;r--)i[r+1]=i[r];i[t]=e}function Vc(i,t){let e=-1,r=1e9;for(let n=0;n=t)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?e-s%e:1,n=at(i,n)}return r===!0?-1:i.length}var Dl=\"\\u037C\",Jc=typeof Symbol>\"u\"?\"__\"+Dl:Symbol.for(Dl),Bl=typeof Symbol>\"u\"?\"__styleSet\"+Math.floor(Math.random()*1e8):Symbol(\"styleSet\"),tu=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:{},Gt=class{constructor(t,e){this.rules=[];let{finish:r}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function s(o,l,a,h){let f=[],c=/^@(\\w+)\\b/.exec(o[0]),u=c&&c[1]==\"keyframes\";if(c&&l==null)return a.push(o[0]+\";\");for(let d in l){let m=l[d];if(/&/.test(d))s(d.split(/,\\s*/).map(O=>o.map(g=>O.replace(/&/,g))).reduce((O,g)=>O.concat(g)),m,a);else if(m&&typeof m==\"object\"){if(!c)throw new RangeError(\"The value of a property (\"+d+\") should be a primitive value.\");s(n(d),m,f,u)}else m!=null&&f.push(d.replace(/_.*/,\"\").replace(/[A-Z]/g,O=>\"-\"+O.toLowerCase())+\": \"+m+\";\")}(f.length||u)&&a.push((r&&!c&&!h?o.map(r):o).join(\", \")+\" {\"+f.join(\" \")+\"}\")}for(let o in t)s(n(o),t[o],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let t=tu[Jc]||1;return tu[Jc]=t+1,Dl+t.toString(36)}static mount(t,e,r){let n=t[Bl],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Xl(t,s),n.mount(Array.isArray(e)?e:[e])}},eu=new Map,Xl=class{constructor(t,e){let r=t.ownerDocument||t,n=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let s=eu.get(r);if(s)return t.adoptedStyleSheets=[s.sheet,...t.adoptedStyleSheets],t[Bl]=s;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],eu.set(r,this)}else{this.styleTag=r.createElement(\"style\"),e&&this.styleTag.setAttribute(\"nonce\",e);let s=t.head||t;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],t[Bl]=this}mount(t){let e=this.sheet,r=0,n=0;for(let s=0;s-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),e)for(let a=0;a\",191:\"?\",192:\"~\",219:\"{\",220:\"|\",221:\"}\",222:'\"'},PO=typeof navigator<\"u\"&&/Mac/.test(navigator.platform),CO=typeof navigator<\"u\"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(ht=0;ht<10;ht++)$e[48+ht]=$e[96+ht]=String(ht);var ht;for(ht=1;ht<=24;ht++)$e[ht+111]=\"F\"+ht;var ht;for(ht=65;ht<=90;ht++)$e[ht]=String.fromCharCode(ht+32),Vi[ht]=String.fromCharCode(ht);var ht;for(ls in $e)Vi.hasOwnProperty(ls)||(Vi[ls]=$e[ls]);var ls;function iu(i){var t=PO&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||CO&&i.shiftKey&&i.key&&i.key.length==1||i.key==\"Unidentified\",e=!t&&i.key||(i.shiftKey?Vi:$e)[i.keyCode]||i.key||\"Unidentified\";return e==\"Esc\"&&(e=\"Escape\"),e==\"Del\"&&(e=\"Delete\"),e==\"Left\"&&(e=\"ArrowLeft\"),e==\"Up\"&&(e=\"ArrowUp\"),e==\"Right\"&&(e=\"ArrowRight\"),e==\"Down\"&&(e=\"ArrowDown\"),e}function Ss(i){let t;return i.nodeType==11?t=i.getSelection?i:i.ownerDocument:t=i,t.getSelection()}function Zl(i,t){return t?i==t||i.contains(t.nodeType!=1?t.parentNode:t):!1}function AO(i){let t=i.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Os(i,t){if(!t.anchorNode)return!1;try{return Zl(i,t.anchorNode)}catch{return!1}}function Xr(i){return i.nodeType==3?ai(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Rr(i,t,e,r){return e?ru(i,t,e,r,-1)||ru(i,t,e,r,1):!1}function Lr(i){for(var t=0;;t++)if(i=i.previousSibling,!i)return t}function ru(i,t,e,r,n){for(;;){if(i==e&&t==r)return!0;if(t==(n<0?0:qe(i))){if(i.nodeName==\"DIV\")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;t=Lr(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[t+(n<0?-1:0)],i.nodeType==1&&i.contentEditable==\"false\")return!1;t=n<0?qe(i):0}else return!1}}function qe(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Aa(i,t){let e=t?i.left:i.right;return{left:e,right:e,top:i.top,bottom:i.bottom}}function QO(i){return{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Iu(i,t){let e=t.width/i.offsetWidth,r=t.height/i.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-i.offsetWidth)<1)&&(e=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-i.offsetHeight)<1)&&(r=1),{scaleX:e,scaleY:r}}function RO(i,t,e,r,n,s,o,l){let a=i.ownerDocument,h=a.defaultView||window;for(let f=i,c=!1;f&&!c;)if(f.nodeType==1){let u,d=f==a.body,m=1,O=1;if(d)u=QO(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:m,scaleY:O}=Iu(f,S)),u={left:S.left,right:S.left+f.clientWidth*m,top:S.top,bottom:S.top+f.clientHeight*O}}let g=0,x=0;if(n==\"nearest\")t.top0&&t.bottom>u.bottom+x&&(x=t.bottom-u.bottom+x+o)):t.bottom>u.bottom&&(x=t.bottom-u.bottom+o,e<0&&t.top-x0&&t.right>u.right+g&&(g=t.right-u.right+g+s)):t.right>u.right&&(g=t.right-u.right+s,e<0&&t.lefte.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}var Fl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:r}=t;this.set(e,Math.min(t.anchorOffset,e?qe(e):0),r,Math.min(t.focusOffset,r?qe(r):0))}set(t,e,r,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=r,this.focusOffset=n}},Wi=null;function Nu(i){if(i.setActive)return i.setActive();if(Wi)return i.focus(Wi);let t=[];for(let e=i;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(i.focus(Wi==null?{get preventScroll(){return Wi={preventScroll:!0},!0}}:void 0),!Wi){Wi=!1;for(let e=0;eMath.max(1,i.scrollHeight-i.clientHeight-4)}var Tt=class i{constructor(t,e,r=!0){this.node=t,this.offset=e,this.precise=r}static before(t,e){return new i(t.parentNode,Lr(t),e)}static after(t,e){return new i(t.parentNode,Lr(t)+1,e)}},Qa=[],rt=class i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let r of this.children){if(r==t)return e;e+=r.length+r.breakAfter}throw new RangeError(\"Invalid child in posBefore\")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(this.flags&2){let r=this.dom,n=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=n?n.nextSibling:r.firstChild)){let l=i.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(t,e),o.flags&=-8}if(s=n?n.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&s!=o.dom&&(e.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=su(s);else r.insertBefore(o.dom,s);n=o.dom}for(s=n?n.nextSibling:r.firstChild,s&&e&&e.node==r&&(e.written=!0);s;)s=su(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(t,e),r.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let r;if(t==this.dom)r=this.dom.childNodes[e];else{let n=qe(t)==0?0:e==0?-1:1;for(;;){let s=t.parentNode;if(s==this.dom)break;n==0&&s.firstChild!=s.lastChild&&(t==s.firstChild?n=-1:n=1),t=s}n<0?r=t:r=t.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!i.get(r);)r=r.nextSibling;if(!r)return this.length;for(let n=0,s=0;;n++){let o=this.children[n];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(t,e,r=0){let n=-1,s=-1,o=-1,l=-1;for(let a=0,h=r,f=r;ae)return c.domBoundsAround(t,e,h);if(u>=t&&n==-1&&(n=a,s=h),h>e&&c.dom.parentNode==this.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,r=Qa){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function Zu(i,t,e,r,n,s,o,l,a){let{children:h}=i,f=h.length?h[t]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:o;if(!(t==r&&f&&!o&&!u&&s.length<2&&f.merge(e,n,s.length?c:null,e==0,l,a))){if(r0&&(!o&&s.length&&f.merge(e,f.length,s[0],!1,l,0)?f.breakAfter=s.shift().breakAfter:(e2),Q={mac:au||/Mac/.test(Lt.platform),windows:/Win/.test(Lt.platform),linux:/Linux|X11/.test(Lt.platform),ie:Bs,ie_version:_u?_l.documentMode||6:Hl?+Hl[1]:Gl?+Gl[1]:0,gecko:ou,gecko_version:ou?+(/Firefox\\/(\\d+)/.exec(Lt.userAgent)||[0,0])[1]:0,chrome:!!Ll,chrome_version:Ll?+Ll[1]:0,ios:au,android:/Android\\b/.test(Lt.userAgent),webkit:lu,safari:Gu,webkit_version:lu?+(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:_l.documentElement.style.tabSize!=null?\"tab-size\":\"-moz-tab-size\"},qO=256,Ye=class i extends rt{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,r){return this.flags&8||r&&(!(r instanceof i)||this.length-(e-t)+r.length>qO||r.flags&8)?!1:(this.text=this.text.slice(0,t)+(r?r.text:\"\")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new i(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Tt(this.dom,t)}domBoundsAround(t,e,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return DO(this.dom,t,e)}},ze=class i extends rt{constructor(t,e=[],r=0){super(),this.mark=t,this.children=e,this.length=r;for(let n of e)n.setParent(this)}setAttrs(t){if(Yu(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,r,n,s,o){return r&&(!(r instanceof i&&r.mark.eq(this.mark))||t&&s<=0||et&&e.push(r=t&&(n=s),r=a,s++}let o=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new i(this.mark,e,o)}domAtPos(t){return Hu(this,t)}coordsAt(t,e){return ju(this,t,e)}};function DO(i,t,e){let r=i.nodeValue.length;t>r&&(t=r);let n=t,s=t,o=0;t==0&&e<0||t==r&&e>=0?Q.chrome||Q.gecko||(t?(n--,o=1):s=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Aa(a,o<0):a||null}var Vr=class i extends rt{static create(t,e,r){return new i(t,e,r)}constructor(t,e,r){super(),this.widget=t,this.length=e,this.side=r,this.prevWidget=null}split(t){let e=i.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable=\"false\"))}getSide(){return this.side}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0)?Tt.before(this.dom):Tt.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let r=this.widget.coordsAt(this.dom,t,e);if(r)return r;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:t>0;for(let l=o?n.length-1:0;s=n[l],!(t>0?l==0:l==n.length-1||s.top0?Tt.before(this.dom):Tt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}};Ye.prototype.children=Vr.prototype.children=Wr.prototype.children=Qa;function Hu(i,t){let e=i.dom,{children:r}=i,n=0;for(let s=0;ns&&t0;s--){let o=r[s-1];if(o.dom.parentNode==e)return o.domAtPos(o.length)}for(let s=n;s0&&t instanceof ze&&n.length&&(r=n[n.length-1])instanceof ze&&r.mark.eq(t.mark)?Uu(r,t.children[0],e-1):(n.push(t),t.setParent(i)),i.length+=t.length}function ju(i,t,e){let r=null,n=-1,s=null,o=-1;function l(h,f){for(let c=0,u=0;c=f&&(d.children.length?l(d,f-u):(!s||s.isHidden&&e>0)&&(m>f||u==m&&d.getSide()>0)?(s=d,o=f-u):(u-1?1:0)!=n.length-(e&&n.indexOf(e)>-1?1:0))return!1;for(let s of r)if(s!=e&&(n.indexOf(s)==-1||i[s]!==t[s]))return!1;return!0}function jl(i,t,e){let r=!1;if(t)for(let n in t)e&&n in e||(r=!0,n==\"style\"?i.style.cssText=\"\":i.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(r=!0,n==\"style\"?i.style.cssText=e[n]:i.setAttribute(n,e[n]));return r}function XO(i){let t=Object.create(null);for(let e=0;e0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Ra(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Uu(this,t,e)}addLineDeco(t){let e=t.spec.attributes,r=t.spec.class;e&&(this.attrs=Ul(e,this.attrs||{})),r&&(this.attrs=Ul({class:r},this.attrs||{}))}domAtPos(t){return Hu(this,t)}reuseDOM(t){t.nodeName==\"DIV\"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var r;this.dom?this.flags&4&&(Yu(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),this.prevAttrs!==void 0&&(jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add(\"cm-line\"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&rt.get(n)instanceof ze;)n=n.lastChild;if(!n||!this.length||n.nodeName!=\"BR\"&&((r=rt.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(s=>s instanceof Ye))){let s=document.createElement(\"BR\");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let r of this.children){if(!(r instanceof Ye)||/[^ -~]/.test(r.text))return null;let n=Xr(r.dom);if(n.length!=1)return null;t+=n[0].width,e=n[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let r=ju(this,t,e);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight=e){if(s instanceof i)return s;if(o>e)break}n=o+s.breakAfter}return null}},Zi=class i extends rt{constructor(t,e,r){super(),this.widget=t,this.length=e,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0}},Ut=class{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},Pt=function(i){return i[i.Text=0]=\"Text\",i[i.WidgetBefore=1]=\"WidgetBefore\",i[i.WidgetAfter=2]=\"WidgetAfter\",i[i.WidgetRange=3]=\"WidgetRange\",i}(Pt||(Pt={})),R=class extends ee{constructor(t,e,r,n){super(),this.startSide=t,this.endSide=e,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Ir(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return e+=r&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ze(t,e,e,r,t.widget||null,!1)}static replace(t){let e=!!t.block,r,n;if(t.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=Ku(t,e);r=(s?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new Ze(t,r,n,e,t.widget||null,!0)}static line(t){return new Nr(t)}static set(t,e=!1){return _.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};R.none=_.empty;var Ir=class i extends R{constructor(t){let{start:e,end:r}=Ku(t);super(e?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||\"span\",this.class=t.class||\"\",this.attrs=t.attributes||null}eq(t){var e,r;return this==t||t instanceof i&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((r=t.attrs)===null||r===void 0?void 0:r.class))&&Ra(this.attrs,t.attrs,\"class\")}range(t,e=t){if(t>=e)throw new RangeError(\"Mark decorations may not be empty\");return super.range(t,e)}};Ir.prototype.point=!1;var Nr=class i extends R{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof i&&this.spec.class==t.spec.class&&Ra(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError(\"Line decoration ranges must be zero-length\");return super.range(t,e)}};Nr.prototype.mapMode=ut.TrackBefore;Nr.prototype.point=!0;var Ze=class i extends R{constructor(t,e,r,n,s,o){super(e,r,s,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?ut.TrackBefore:ut.TrackAfter:ut.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof i&&LO(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError(\"Invalid range for replacement decoration\");if(!this.isReplace&&e!=t)throw new RangeError(\"Widget decorations can only have zero-length ranges\");return super.range(t,e)}};Ze.prototype.point=!0;function Ku(i,t=!1){let{inclusiveStart:e,inclusiveEnd:r}=i;return e==null&&(e=i.inclusive),r==null&&(r=i.inclusive),{start:e??t,end:r??t}}function LO(i,t){return i==t||!!(i&&t&&i.compare(t))}function Kl(i,t,e,r=0){let n=e.length-1;n>=0&&e[n]+r>=i?e[n]=Math.max(e[n],t):e.push(i,t)}var Mr=class i{constructor(t,e,r,n){this.doc=t,this.pos=e,this.end=r,this.disallowBlockEffectsFor=n,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=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof Zi&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new mt),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(as(new Wr(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof Zi)&&this.getLine()}buildText(t,e,r){for(;t>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)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,t--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-r)),this.getLine().append(as(new Ye(this.text.slice(this.textOff,this.textOff+n)),e),r),this.atCursorPos=!0,this.textOff+=n,t-=n,r=0}}span(t,e,r,n){this.buildText(e-t,r,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,r,n,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Ze){if(r.block)throw new RangeError(\"Block decorations may not be specified via plugins\");if(e>this.doc.lineAt(this.pos).to)throw new RangeError(\"Decorations that replace line breaks may not be specified via plugins\")}let l=e-t;if(r instanceof Ze)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Zi(r.widget||new vs(\"div\"),l,r));else{let a=Vr.create(r.widget||new vs(\"span\"),l,l?0:r.startSide),h=this.atCursorPos&&!a.isEditable&&s<=n.length&&(t0),f=!a.isEditable&&(tn.length||r.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(as(new Wr(1),n),s),s=n.length+Math.max(0,s-n.length)),c.append(as(a,n),s),this.atCursorPos=f,this.pendingBuffer=f?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text=\"\",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,r,n,s){let o=new i(t,e,r,s);return o.openEnd=_.spans(n,e,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function as(i,t){for(let e of t)i=new ze(e,[i],i.length);return i}var vs=class extends Ut{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},G=function(i){return i[i.LTR=0]=\"LTR\",i[i.RTL=1]=\"RTL\",i}(G||(G={})),hi=G.LTR,Ma=G.RTL;function Ju(i){let t=[];for(let e=0;e=e){if(l.level==r)return o;(s<0||(n!=0?n<0?l.frome:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError(\"Index out of range\");return s}};function ed(i,t){if(i.length!=t.length)return!1;for(let e=0;e=0;O-=3)if(me[O+1]==-d){let g=me[O+2],x=g&2?n:g&4?g&1?s:n:0;x&&(j[c]=j[me[O]]=x),l=O;break}}else{if(me.length==189)break;me[l++]=c,me[l++]=u,me[l++]=a}else if((m=j[c])==2||m==1){let O=m==n;a=O?0:1;for(let g=l-3;g>=0;g-=3){let x=me[g+2];if(x&2)break;if(O)me[g+2]|=2;else{if(x&4)break;me[g+2]|=4}}}}}function zO(i,t,e,r){for(let n=0,s=r;n<=e.length;n++){let o=n?e[n-1].to:i,l=na;)m==g&&(m=e[--O].from,g=O?e[O-1].to:i),j[--m]=d;a=f}else s=h,a++}}}function ta(i,t,e,r,n,s,o){let l=r%2?2:1;if(r%2==n%2)for(let a=t,h=0;aa&&o.push(new Oe(a,O.from,d));let g=O.direction==hi!=!(d%2);ea(i,g?r+1:r,n,O.inner,O.from,O.to,o),a=O.to}m=O.to}else{if(m==e||(f?j[m]!=l:j[m]==l))break;m++}u?ta(i,a,m,r+1,n,u,o):at;){let f=!0,c=!1;if(!h||a>s[h-1].to){let O=j[a-1];O!=l&&(f=!1,c=O==16)}let u=!f&&l==1?[]:null,d=f?r:r+1,m=a;t:for(;;)if(h&&m==s[h-1].to){if(c)break t;let O=s[--h];if(!f)for(let g=O.from,x=h;;){if(g==t)break t;if(x&&s[x-1].to==g)g=s[--x].from;else{if(j[g-1]==l)break t;break}}if(u)u.push(O);else{O.toj.length;)j[j.length]=256;let r=[],n=t==hi?0:1;return ea(i,n,n,e,0,i.length,r),r}function id(i){return[new Oe(0,i,0)]}var rd=\"\";function FO(i,t,e,r,n){var s;let o=r.head-i.from,l=Oe.find(t,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=t[l],h=a.side(n,e);if(o==h){let u=l+=n?1:-1;if(u<0||u>=t.length)return null;a=t[l=u],o=a.side(!n,e),h=a.side(n,e)}let f=at(i.text,o,a.forward(n,e));(fa.to)&&(f=h),rd=i.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(n?t.length-1:0)?null:t[l+(n?1:-1)];return c&&f==h&&c.level+(n?0:1)i.some(t=>t)}),cd=A.define({combine:i=>i.some(t=>t)}),Er=class i{constructor(t,e=\"nearest\",r=\"nearest\",n=5,s=5,o=!1){this.range=t,this.y=e,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(t){return t.empty?this:new i(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new i(b.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},hs=M.define({map:(i,t)=>i.map(t)});function Ct(i,t,e){let r=i.facet(ld);r.length?r[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+\":\",t):console.error(t)}var Xs=A.define({combine:i=>i.length?i[0]:!0}),GO=0,Tr=A.define(),ft=class i{constructor(t,e,r,n,s){this.id=t,this.create=e,this.domEventHandlers=r,this.domEventObservers=n,this.extension=s(this)}static define(t,e){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=e||{};return new i(GO++,t,r,n,l=>{let a=[Tr.of(l)];return o&&a.push(Yr.of(h=>{let f=h.plugin(l);return f?o(f):R.none})),s&&a.push(s(l)),a})}static fromClass(t,e){return i.define(r=>new t(r),e)}},$r=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(r){if(Ct(e.state,r,\"CodeMirror plugin crashed\"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){Ct(t.state,e,\"CodeMirror plugin crashed\"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(r){Ct(t.state,r,\"CodeMirror plugin crashed\")}}deactivate(){this.spec=this.value=null}},ud=A.define(),Ea=A.define(),Yr=A.define(),dd=A.define(),$a=A.define(),pd=A.define();function fu(i,t){let e=i.state.facet(pd);if(!e.length)return e;let r=e.map(s=>s instanceof Function?s(i):s),n=[];return _.spans(r,t.from,t.to,{point(){},span(s,o,l,a){let h=s-t.from,f=o-t.from,c=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,m;if(d==null&&(d=_O(t.text,h,f)),a>0&&c.length&&(m=c[c.length-1]).to==h&&m.direction==d)m.to=f,c=m.inner;else{let O={from:h,to:f,direction:d,inner:[]};c.push(O),c=O.inner}}}}),n}var md=A.define();function gd(i){let t=0,e=0,r=0,n=0;for(let s of i.state.facet(md)){let o=s(i);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:r,bottom:n}}var Pr=A.define(),xe=class i{constructor(t,e,r,n){this.fromA=t,this.toA=e,this.fromB=r,this.toB=n}join(t){return new i(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,r=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>r.toA)){if(n.toAf)break;s+=2}if(!a)return r;new i(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}},ks=class i{constructor(t,e,r){this.view=t,this.state=e,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=vt.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,l,a)=>n.push(new xe(s,o,l,a))),this.changedRanges=n}static create(t,e,r){return new i(t,e,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Ts=class extends rt{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new mt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xe(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!e0(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let s=n>-1?UO(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new xe(h,f,t.changes.mapPos(h,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Q.ie||Q.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=JO(o,l,t.changes);return r=xe.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,t.startState.doc.length,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+\"px\",this.dom.style.flexBasis=this.minWidth?this.minWidth+\"px\":\"\";let o=Q.chrome||Q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=\"\"}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:f,toB:c}=l,u,d,m,O;if(r&&r.range.fromBf){let v=Mr.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),y=Mr.build(this.view.state.doc,r.range.toB,c,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,m=v.openStart,O=y.openEnd;let k=this.compositionView(r);y.breakAtStart?k.breakAfter=1:y.content.length&&k.merge(k.length,k.length,y.content[0],!1,y.openStart,0)&&(k.breakAfter=y.content[0].breakAfter,y.content.shift()),v.content.length&&k.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),u=v.content.concat(k).concat(y.content)}else({content:u,breakAtStart:d,openStart:m,openEnd:O}=Mr.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:g,off:x}=s.findPos(h,1),{i:S,off:C}=s.findPos(a,-1);Zu(this,S,C,g,x,u,d,m,O)}r&&this.fixCompositionDOM(r)}compositionView(t){let e=new Ye(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new ze(n,[e],e.length);let r=new mt;return r.append(e,0),r}fixCompositionDOM(t){let e=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=rt.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(t.range.fromB,1),n=this.children[r.i];e(t.line,n);for(let s=t.marks.length-1;s>=-1;s--)r=n.childPos(r.off,1),n=n.children[r.i],e(s>=0?t.marks[s].node:t.text,n)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,s=!n&&Os(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||e||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&HO(a)){let c=document.createTextNode(\"\");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=h=new Tt(c,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!Rr(a.node,a.offset,f.anchorNode,f.anchorOffset)||!Rr(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(f.focusNode)&&t0(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Ss(this.view.root);if(c)if(l.empty){if(Q.gecko){let u=jO(a.node,a.offset);if(u&&u!=3){let d=xd(a.node,a.offset,u==1?1:-1);d&&(a=new Tt(d.node,d.offset))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new Tt(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Tt(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Rr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,r=Ss(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!r||!e.empty||!e.assoc||!r.modify)return;let o=mt.find(this,e.head);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(e.head+e.assoc);r.collapse(f.node,f.offset),r.modify(\"move\",e.assoc<0?\"forward\":\"backward\",\"lineboundary\"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&r.collapse(n,s)}moveToLine(t){let e=this.dom,r;if(t.node!=e)return t;for(let n=t.offset;!r&&n=0;n--){let s=rt.get(e.childNodes[n]);s instanceof mt&&(r=s.domAtPos(s.length))}return r?new Tt(r.node,r.offset,!0):t}nearest(t){for(let e=t;e;){let r=rt.get(e);if(r&&r.rootView==this)return r;e=e.parentNode}return null}posFromDOM(t,e){let r=this.nearest(t);if(!r)throw new RangeError(\"Trying to find position for a DOM position outside of the document\");return r.localPosFromDOM(t,e)+r.posAtStart}domAtPos(t){let{i:e,off:r}=this.childCursor().findPos(t,-1);for(;e=0;o--){let l=this.children[o],a=s-l.breakAfter,h=a-l.length;if(at||l.covers(1))&&(!r||l instanceof mt&&!(r instanceof mt&&e>=0))&&(r=l,n=h),s=h}return r?r.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:r}=this.childPos(t,1),n=this.children[e];if(!(n instanceof mt))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(r,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}r=a}if(!(n instanceof Ye))return null;let s=at(n.text,r);if(s==r)return null;let o=ai(n.dom,r,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==G.LTR;for(let h=0,f=0;fn)break;if(h>=r){let d=c.dom.getBoundingClientRect();if(e.push(d.height),o){let m=c.dom.lastChild,O=m?Xr(m):[];if(O.length){let g=O[O.length-1],x=a?g.right-d.left:d.right-g.left;x>l&&(l=x,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction==\"rtl\"?G.RTL:G.LTR}measureTextSize(){for(let s of this.children)if(s instanceof mt){let o=s.measureTextSize();if(o)return o}let t=document.createElement(\"div\"),e,r,n;return t.className=\"cm-line\",t.style.width=\"99999px\",t.style.position=\"absolute\",t.textContent=\"abc def ghi jkl mno pqr stu\",this.view.observer.ignore(()=>{this.dom.appendChild(t);let s=Xr(t.firstChild)[0];e=t.getBoundingClientRect().height,r=s?s.width/27:7,n=s?s.height:e,t.remove()}),{lineHeight:e,charWidth:r,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ws(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let r=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],o=s?s.from-1:this.length;if(o>r){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(r).top)/this.view.scaleY;t.push(R.replace({widget:new Ps(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return R.set(t)}updateDeco(){let t=this.view.state.facet(Yr).map((n,s)=>(this.dynamicDecorationMap[s]=typeof n==\"function\")?n(this.view):n),e=!1,r=this.view.state.facet(dd).map((n,s)=>{let o=typeof n==\"function\";return o&&(e=!0),o?n(this.view):n});r.length&&(this.dynamicDecorationMap[t.length]=e,t.push(_.join(r)));for(let n=t.length;ne.anchor?-1:1),n;if(!r)return;!e.empty&&(n=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=gd(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;RO(this.view.scrollDOM,o,e.head0)r=r.childNodes[n-1],n=qe(r);else break}if(e>=0)for(let r=i,n=t;;){if(r.nodeType==3)return{node:r,offset:n};if(r.nodeType==1&&n=0)r=r.childNodes[n],n=0;else break}return null}function jO(i,t){return i.nodeType!=1?0:(t&&i.childNodes[t-1].contentEditable==\"false\"?1:0)|(t{rt.from&&(e=!0)}),e}function i0(i,t,e=1){let r=i.charCategorizer(t),n=i.doc.lineAt(t),s=t-n.from;if(n.length==0)return b.cursor(t);s==0?e=1:s==n.length&&(e=-1);let o=s,l=s;e<0?o=at(n.text,s,!1):l=at(n.text,s);let a=r(n.text.slice(o,l));for(;o>0;){let h=at(n.text,o,!1);if(r(n.text.slice(h,o))!=a)break;o=h}for(;li?t.left-i:Math.max(0,i-t.right)}function n0(i,t){return t.top>i?t.top-i:Math.max(0,i-t.bottom)}function Vl(i,t){return i.topt.top+1}function cu(i,t){return ti.bottom?{top:i.top,left:i.left,right:i.right,bottom:t}:i}function ra(i,t,e){let r,n,s,o,l=!1,a,h,f,c;for(let m=i.firstChild;m;m=m.nextSibling){let O=Xr(m);for(let g=0;gC||o==C&&s>S){r=m,n=x,s=S,o=C;let v=C?e0?g0)}S==0?e>x.bottom&&(!f||f.bottomx.top)&&(h=m,c=x):f&&Vl(f,x)?f=uu(f,x.bottom):c&&Vl(c,x)&&(c=cu(c,x.top))}}if(f&&f.bottom>=e?(r=a,n=f):c&&c.top<=e&&(r=h,n=c),!r)return{node:i,offset:0};let u=Math.max(n.left,Math.min(n.right,t));if(r.nodeType==3)return du(r,u,e);if(l&&r.contentEditable!=\"false\")return ra(r,u,e);let d=Array.prototype.indexOf.call(i.childNodes,r)+(t>=(n.left+n.right)/2?1:0);return{node:i,offset:d}}function du(i,t,e){let r=i.nodeValue.length,n=-1,s=1e9,o=0;for(let l=0;le?f.top-e:e-f.bottom)-1;if(f.left-1<=t&&f.right+1>=t&&c=(f.left+f.right)/2,d=u;if((Q.chrome||Q.gecko)&&ai(i,l).getBoundingClientRect().left==f.right&&(d=!u),c<=0)return{node:i,offset:l+(d?1:0)};n=l+(d?1:0),s=c}}}return{node:i,offset:n>-1?n:o>0?i.nodeValue.length:0}}function yd(i,t,e,r=-1){var n,s;let o=i.contentDOM.getBoundingClientRect(),l=o.top+i.viewState.paddingTop,a,{docHeight:h}=i.viewState,{x:f,y:c}=t,u=c-l;if(u<0)return 0;if(u>h)return i.state.doc.length;for(let v=i.viewState.heightOracle.textHeight/2,y=!1;a=i.elementAtHeight(u),a.type!=Pt.Text;)for(;u=r>0?a.bottom+v:a.top-v,!(u>=0&&u<=h);){if(y)return e?null:0;y=!0,r=-r}c=l+u;let d=a.from;if(di.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:e?null:pu(i,o,a,f,c);let m=i.dom.ownerDocument,O=i.root.elementFromPoint?i.root:m,g=O.elementFromPoint(f,c);g&&!i.contentDOM.contains(g)&&(g=null),g||(f=Math.max(o.left+1,Math.min(o.right-1,f)),g=O.elementFromPoint(f,c),g&&!i.contentDOM.contains(g)&&(g=null));let x,S=-1;if(g&&((n=i.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let v=m.caretPositionFromPoint(f,c);v&&({offsetNode:x,offset:S}=v)}else if(m.caretRangeFromPoint){let v=m.caretRangeFromPoint(f,c);v&&({startContainer:x,startOffset:S}=v,(!i.contentDOM.contains(x)||Q.safari&&s0(x,S,f)||Q.chrome&&o0(x,S,f))&&(x=void 0))}}if(!x||!i.docView.dom.contains(x)){let v=mt.find(i.docView,d);if(!v)return u>a.top+a.height/2?a.to:a.from;({node:x,offset:S}=ra(v.dom,f,c))}let C=i.docView.nearest(x);if(!C)return null;if(C.isWidget&&((s=C.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=C.dom.getBoundingClientRect();return t.yi.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((n-e.top-(i.defaultLineHeight-l)*.5)/l);s+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(e.from,e.to);return e.from+os(o,s,i.state.tabSize)}function s0(i,t,e){let r;if(i.nodeType!=3||t!=(r=i.nodeValue.length))return!1;for(let n=i.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!=\"BR\")return!1;return ai(i,r-1,r).getBoundingClientRect().left>e}function o0(i,t,e){if(t!=0)return!1;for(let n=i;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains(\"cm-line\"))break;n=s}let r=i.nodeType==1?i.getBoundingClientRect():ai(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return e-r.left>5}function na(i,t){let e=i.lineBlockAt(t);if(Array.isArray(e.type)){for(let r of e.type)if(r.to>t||r.to==t&&(r.to==e.to||r.type==Pt.Text))return r}return e}function l0(i,t,e,r){let n=na(i,t.head),s=!r||n.type!=Pt.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(t.assoc<0&&t.head>n.from?t.head-1:t.head);if(s){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(n.from),a=i.posAtCoords({x:e==(l==G.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return b.cursor(a,e?-1:1)}return b.cursor(e?n.to:n.from,e?-1:1)}function mu(i,t,e,r){let n=i.state.doc.lineAt(t.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let l=t,a=null;;){let h=FO(n,s,o,l,e),f=rd;if(!h){if(n.number==(e?i.state.doc.lines:1))return l;f=`\n`,n=i.state.doc.line(n.number+(e?1:-1)),s=i.bidiSpans(n),h=i.visualLineSide(n,!e)}if(a){if(!a(f))return l}else{if(!r)return h;a=r(f)}l=h}}function a0(i,t,e){let r=i.state.charCategorizer(t),n=r(e);return s=>{let o=r(s);return n==F.Space&&(n=o),n==o}}function h0(i,t,e,r){let n=t.head,s=e?1:-1;if(n==(e?i.state.doc.length:0))return b.cursor(n,t.assoc);let o=t.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(n,t.assoc||-1),f=i.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(n-d.from))),l=(s<0?d.top:d.bottom)+f}let c=a.left+o,u=r??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(u+d)*s,O=yd(i,{x:c,y:m},!1,s);if(ma.bottom||(s<0?On)){let g=i.docView.coordsForChar(O),x=!g||m{if(t>s&&tn(i)),e.from,t.head>e.from?-1:1);return r==e.from?e:b.cursor(r,rnull),Q.gecko&&k0(t.contentDOM.ownerDocument)}handleEvent(t){!g0(this.view,t)||this.ignoreDuringComposition(t)||t.type==\"keydown\"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let r=this.handlers[t];if(r){for(let n of r.observers)n(this.view,e);for(let n of r.handlers){if(e.defaultPrevented)break;if(n(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=f0(t),r=this.handlers,n=this.view.contentDOM;for(let s in e)if(s!=\"scroll\"){let o=!e[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(n.removeEventListener(s,this.handleEvent),l=null),l||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!=\"scroll\"&&!e[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()r.keyCode==t.keyCode))&&!t.ctrlKey||c0.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,zi(this.view.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function gu(i,t){return(e,r)=>{try{return t.call(i,r,e)}catch(n){Ct(e.state,n)}}}function f0(i){let t=Object.create(null);function e(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&e(s).handlers.push(gu(r.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&e(s).observers.push(gu(r.value,o))}}for(let r in re)e(r).handlers.push(re[r]);for(let r in ne)e(r).observers.push(ne[r]);return t}var bd=[{key:\"Backspace\",keyCode:8,inputType:\"deleteContentBackward\"},{key:\"Enter\",keyCode:13,inputType:\"insertParagraph\"},{key:\"Enter\",keyCode:13,inputType:\"insertLineBreak\"},{key:\"Delete\",keyCode:46,inputType:\"deleteContentForward\"}],c0=\"dthko\",Sd=[16,17,18,20,91,92,224,225],fs=6;function cs(i){return Math.max(0,i)*.7+8}function u0(i,t){return Math.max(Math.abs(i.clientX-t.clientX),Math.abs(i.clientY-t.clientY))}var oa=class{constructor(t,e,r,n){this.view=t,this.startEvent=e,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=MO(t.contentDOM),this.atoms=t.state.facet($a).map(o=>o(t));let s=t.contentDOM.ownerDocument;s.addEventListener(\"mousemove\",this.move=this.move.bind(this)),s.addEventListener(\"mouseup\",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Y.allowMultipleSelections)&&d0(t,e),this.dragging=m0(t,e)&&Td(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&u0(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let r=0,n=0,s=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=gd(this.view);t.clientX-o.left<=s.left+fs?r=-cs(s.left-t.clientX):t.clientX+o.right>=s.right-fs&&(r=cs(t.clientX-s.right)),t.clientY-o.top<=s.top+fs?n=-cs(s.top-t.clientY):t.clientY+o.bottom>=s.bottom-fs&&(n=cs(t.clientY-s.bottom)),this.setScrollSpeed(r,n)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener(\"mousemove\",this.move),t.removeEventListener(\"mouseup\",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let r=0;rthis.select(this.lastEvent),20)}};function d0(i,t){let e=i.state.facet(nd);return e.length?e[0](t):Q.mac?t.metaKey:t.ctrlKey}function p0(i,t){let e=i.state.facet(sd);return e.length?e[0](t):Q.mac?!t.altKey:!t.ctrlKey}function m0(i,t){let{main:e}=i.state.selection;if(e.empty)return!1;let r=Ss(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function g0(i,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,r;e!=i.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(r=rt.get(e))&&r.ignoreEvent(t))return!1;return!0}var re=Object.create(null),ne=Object.create(null),wd=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function O0(i){let t=i.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement(\"textarea\"));e.style.cssText=\"position: fixed; left: -10000px; top: 10px\",e.focus(),setTimeout(()=>{i.focus(),e.remove(),vd(i,e.value)},50)}function vd(i,t){let{state:e}=i,r,n=1,s=e.toText(t),o=s.lines==e.selection.ranges.length;if(la!=null&&e.selection.ranges.every(a=>a.empty)&&la==s.toString()){let a=-1;r=e.changeByRange(h=>{let f=e.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=e.toText((o?s.line(n++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:b.cursor(h.from+c.length)}})}else o?r=e.changeByRange(a=>{let h=s.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):r=e.replaceSelection(s);i.dispatch(r,{userEvent:\"input.paste\",scrollIntoView:!0})}ne.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};re.keydown=(i,t)=>(i.inputState.setSelectionOrigin(\"select\"),t.keyCode==27&&(i.inputState.lastEscPress=Date.now()),!1);ne.touchstart=(i,t)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin(\"select.pointer\")};ne.touchmove=i=>{i.inputState.setSelectionOrigin(\"select.pointer\")};re.mousedown=(i,t)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let r of i.state.facet(od))if(e=r(i,t),e)break;if(!e&&t.button==0&&(e=b0(i,t)),e){let r=!i.hasFocus;i.inputState.startMouseSelection(new oa(i,t,e,r)),r&&i.observer.ignore(()=>Nu(i.contentDOM));let n=i.inputState.mouseSelection;if(n)return n.start(t),n.dragging===!1}return!1};function Ou(i,t,e,r){if(r==1)return b.cursor(t,e);if(r==2)return i0(i.state,t,e);{let n=mt.find(i.docView,t),s=i.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:s.from,l=n?n.posAtEnd:s.to;return li>=t.top&&i<=t.bottom,xu=(i,t,e)=>kd(t,e)&&i>=e.left&&i<=e.right;function x0(i,t,e,r){let n=mt.find(i.docView,t);if(!n)return 1;let s=t-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&xu(e,r,o))return-1;let l=n.coordsAt(s,1);return l&&xu(e,r,l)?1:o&&kd(r,o)?-1:1}function yu(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:x0(i,e,t.clientX,t.clientY)}}var y0=Q.ie&&Q.ie_version<=11,bu=null,Su=0,wu=0;function Td(i){if(!y0)return i.detail;let t=bu,e=wu;return bu=i,wu=Date.now(),Su=!t||e>Date.now()-400&&Math.abs(t.clientX-i.clientX)<2&&Math.abs(t.clientY-i.clientY)<2?(Su+1)%3:1}function b0(i,t){let e=yu(i,t),r=Td(t),n=i.state.selection;return{update(s){s.docChanged&&(e.pos=s.changes.mapPos(e.pos),n=n.map(s.changes))},get(s,o,l){let a=yu(i,s),h,f=Ou(i,a.pos,a.bias,r);if(e.pos!=a.pos&&!o){let c=Ou(i,e.pos,e.bias,r),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u1&&(h=S0(n,a.pos))?h:l?n.addRange(f):b.create([f])}}}function S0(i,t){for(let e=0;e=t)return b.create(i.ranges.slice(0,e).concat(i.ranges.slice(e+1)),i.mainIndex==e?0:i.mainIndex-(i.mainIndex>e?1:0))}return null}re.dragstart=(i,t)=>{let{selection:{main:e}}=i.state;if(t.target.draggable){let n=i.docView.nearest(t.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=e.to||o<=e.from)&&(e=b.range(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData(\"Text\",i.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed=\"copyMove\"),!1};re.dragend=i=>(i.inputState.draggedContent=null,!1);function vu(i,t,e,r){if(!e)return;let n=i.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&p0(i,t)?{from:s.from,to:s.to}:null,l={from:n,insert:e},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?\"move.drop\":\"input.drop\"}),i.inputState.draggedContent=null}re.drop=(i,t)=>{if(!t.dataTransfer)return!1;if(i.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let r=Array(e.length),n=0,s=()=>{++n==e.length&&vu(i,t,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(e[o])}return!0}else{let r=t.dataTransfer.getData(\"Text\");if(r)return vu(i,t,r,!0),!0}return!1};re.paste=(i,t)=>{if(i.state.readOnly)return!0;i.observer.flush();let e=wd?null:t.clipboardData;return e?(vd(i,e.getData(\"text/plain\")||e.getData(\"text/uri-text\")),!0):(O0(i),!1)};function w0(i,t){let e=i.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement(\"textarea\"));r.style.cssText=\"position: fixed; left: -10000px; top: 10px\",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function v0(i){let t=[],e=[],r=!1;for(let n of i.selection.ranges)n.empty||(t.push(i.sliceDoc(n.from,n.to)),e.push(n));if(!t.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(t.push(o.text),e.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:t.join(i.lineBreak),ranges:e,linewise:r}}var la=null;re.copy=re.cut=(i,t)=>{let{text:e,ranges:r,linewise:n}=v0(i.state);if(!e&&!n)return!1;la=n?e:null,t.type==\"cut\"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:\"delete.cut\"});let s=wd?null:t.clipboardData;return s?(s.clearData(),s.setData(\"text/plain\",e),!0):(w0(i,e),!1)};var Pd=Et.define();function Cd(i,t){let e=[];for(let r of i.facet(hd)){let n=r(i,t);n&&e.push(n)}return e?i.update({effects:e,annotations:Pd.of(!0)}):null}function Ad(i){setTimeout(()=>{let t=i.hasFocus;if(t!=i.inputState.notifiedFocused){let e=Cd(i.state,t);e?i.dispatch(e):i.update([])}},10)}ne.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Ad(i)};ne.blur=i=>{i.observer.clearSelectionRange(),Ad(i)};ne.compositionstart=ne.compositionupdate=i=>{i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0)};ne.compositionend=i=>{i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Q.chrome&&Q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50)};ne.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};re.beforeinput=(i,t)=>{var e;let r;if(Q.chrome&&Q.android&&(r=bd.find(n=>n.inputType==t.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key==\"Backspace\"||r.key==\"Delete\")){let n=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return!1};var ku=new Set;function k0(i){ku.has(i)||(ku.add(i),i.addEventListener(\"copy\",()=>{}),i.addEventListener(\"cut\",()=>{}))}var Tu=[\"pre-wrap\",\"normal\",\"pre-line\",\"break-spaces\"],aa=class{constructor(t){this.lineWrapping=t,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let r=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((e-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Tu.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let r=0;r-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=r,this.textHeight=n,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>ys&&(t.heightChanged=!0),this.height=e)}replace(t,e,r){return i.of(r)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,r,n){let s=this,o=r.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=s.lineAt(a,et.ByPosNoHeight,r.setDoc(e),0,0),d=u.to>=h?u:s.lineAt(h,et.ByPosNoHeight,r,0,0);for(c+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,as*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),r+=1+l.break,n-=l.size}else if(s>n*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(n=s&&o(this.blockAt(0,r,n,s))}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ht=class i extends Cs{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,r,n){return new ge(n,this.length,r,this.height,this.breaks)}replace(t,e,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof Ne&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Ne?n=new i(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Vt.of(r)}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:\"\"}${this.widgetHeight?\":\"+this.widgetHeight:\"\"})`}},Ne=class i extends Vt{constructor(t){super(t,0)}heightMetrics(t,e){let r=t.doc.lineAt(e).number,n=t.doc.lineAt(e+this.length).number,s=n-r+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:n,perLine:o,perChar:l}}blockAt(t,e,r,n){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length),f=e.doc.lineAt(h),c=l+f.length*a,u=Math.max(r,t-c/2);return new ge(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((t-r)/l))),{from:f,length:c}=e.doc.line(s+h);return new ge(f,c,r+l*h,l,0)}}lineAt(t,e,r,n,s){if(e==et.ByHeight)return this.blockAt(t,r,n,s);if(e==et.ByPosNoHeight){let{from:d,to:m}=r.doc.lineAt(t);return new ge(d,m-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),h=r.doc.lineAt(t),f=l+h.length*a,c=h.number-o,u=n+l*c+a*(h.from-s-c);return new ge(h.from,h.length,Math.max(n,Math.min(u,n+this.height-f)),f,0)}forEachLine(t,e,r,n,s,o){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(r,s);for(let f=t,c=n;f<=e;){let u=r.doc.lineAt(f);if(f==t){let m=u.number-l;c+=a*m+h*(t-s-m)}let d=a+h*u.length;o(new ge(u.from,u.length,c,d,0)),c+=d,f=u.to+1}}replace(t,e,r){let n=this.length-e;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(t>0){let s=r[0];s instanceof i?r[0]=new i(t+s.length):r.unshift(new i(t-1),null)}return Vt.of(r)}decomposeLeft(t,e){e.push(new i(t-1),null)}decomposeRight(t,e){e.push(null,new i(this.length-t-1))}updateHeight(t,e=0,r=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let o=[],l=Math.max(e,n.from),a=-1;for(n.from>e&&o.push(new i(n.from-e-1).updateHeight(t,e));l<=s&&n.more;){let f=t.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++];a==-1?a=c:Math.abs(c-a)>=ys&&(a=-2);let u=new Ht(f,c);u.outdated=!1,o.push(u),l+=f+1}l<=s&&o.push(null,new i(s-l).updateHeight(t,l));let h=Vt.of(o);return(a<0||Math.abs(h.height-this.height)>=ys||Math.abs(a-this.heightMetrics(t,e).perLine)>=ys)&&(t.heightChanged=!0),h}else(r||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},fa=class extends Vt{constructor(t,e,r){super(t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,e,r,n){let s=r+this.left.height;return tl))return h;let f=e==et.ByPosNoHeight?et.ByPosNoHeight:et.ByPos;return a?h.join(this.right.lineAt(l,f,r,o,l)):this.left.lineAt(l,f,r,n,s).join(h)}forEachLine(t,e,r,n,s,o){let l=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,r,l,a,o);else{let h=this.lineAt(a,et.ByPos,r,n,s);t=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,r,l,a,o)}}replace(t,e,r){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,r));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of r)s.push(l);if(t>0&&Pu(s,o-1),e=r&&e.push(null)),t>r&&this.right.decomposeLeft(t-r,e)}decomposeRight(t,e){let r=this.left.length,n=r+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Vt.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,r=!1,n){let{left:s,right:o}=this,l=e+s.length+this.break,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,r,n):s.updateHeight(t,e,r),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(t,l,r,n):o.updateHeight(t,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?\" \":\"-\")+this.right}};function Pu(i,t){let e,r;i[t]==null&&(e=i[t-1])instanceof Ne&&(r=i[t+1])instanceof Ne&&i.splice(t-1,3,new Ne(e.length+1+r.length))}var T0=5,ca=class i{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let r=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ht?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ht(r-this.pos,-1)),this.writtenTo=r,e>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,r){if(t=T0)&&this.addLineDeco(n,s,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ht(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let r=new Ne(e-t);return this.oracle.doc.lineAt(t).to==e&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ht)return t;let e=new Ht(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+r}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Ht)&&!this.isCovered?this.nodes.push(new Ht(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!=\"visible\"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==i.parentNode?u.bottom:Math.min(a,u.bottom)}h=c.position==\"absolute\"||c.position==\"fixed\"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-e.left,right:Math.max(s,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function A0(i,t){let e=i.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}var qr=class{constructor(t,e,r){this.from=t,this.to=e,this.size=r}static same(t,e){if(t.length!=e.length)return!1;for(let r=0;rtypeof r!=\"function\"&&r.class==\"cm-lineWrapping\");this.heightOracle=new aa(e),this.stateDeco=t.facet(Yr).filter(r=>typeof r!=\"function\"),this.heightMap=Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(t.doc),[new xe(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let r=0;r<=1;r++){let n=r?e.head:e.anchor;if(!t.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);t.push(new Ii(s,o))}}this.viewports=t.sort((r,n)=>r.from-n.from),this.scaler=this.heightMap.height<=7e6?Cu:new pa(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Cr(t,this.scaler))})}update(t,e=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Yr).filter(f=>typeof f!=\"function\");let n=t.changedRanges,s=xe.extendWithRanges(n,P0(r,this.stateDeco,t?t.changes:vt.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=!t.changes.empty||t.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(cd)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,r=window.getComputedStyle(e),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction==\"rtl\"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:v,scaleY:y}=Iu(e,l);(this.scaleX!=v||this.scaleY!=y)&&(this.scaleX=v,this.scaleY=y,h|=8,o=a=!0)}let c=(parseInt(r.paddingTop)||0)*this.scaleY,u=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=zu(t.scrollDOM);let m=(this.printing?A0:C0)(e,this.paddingTop),O=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let v=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(S-this.contentDOMWidth)>n.charWidth){let{lineHeight:y,charWidth:k,textHeight:w}=t.docView.measureTextSize();o=y>0&&n.refresh(s,y,k,w,S/k,v),o&&(t.docView.minWidth=0,h|=8)}O>0&&g>0?f=Math.max(O,g):O<0&&g<0&&(f=Math.min(O,g)),n.heightChanged=!1;for(let y of this.viewports){let k=y.from==this.viewport.from?v:t.docView.measureVisibleLineHeights(y);this.heightMap=(o?Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new xe(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new ha(y.from,k))}n.heightChanged&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ii(n.lineAt(o-r*1e3,et.ByHeight,s,0,0).from,n.lineAt(l+(1-r)*1e3,et.ByHeight,s,0,0).to);if(e){let{head:h}=e.range;if(ha.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,et.ByPos,s,0,0),u;e.y==\"center\"?u=(c.top+c.bottom)/2-f/2:e.y==\"start\"||e.y==\"nearest\"&&h=l+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s>1,o=n<<1;if(this.defaultTextDirection!=G.LTR&&!r)return[];let l=[],a=(h,f,c,u)=>{if(f-hh&&gg.from>=c.from&&g.to<=c.to&&Math.abs(g.from-h)g.fromx));if(!O){if(fg.from<=f&&g.to>=f)){let g=e.moveToLineBoundary(b.cursor(f),!1,!0).head;g>h&&(f=g)}O=new qr(h,f,this.gapSize(c,h,f,u))}l.push(O)};for(let h of this.viewportLines){if(h.lengthh.from&&a(h.from,u,h,f),de.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_.spans(t,this.viewport.from,this.viewport.to,{span(n,s){e.push({from:n,to:s})},point(){}},20);let r=e.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=e[s].from||n.to!=e[s].to);return this.visibleRanges=e,r?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Cr(this.heightMap.lineAt(t,et.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Cr(this.heightMap.lineAt(this.scaler.fromDOM(t),et.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Cr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ii=class{constructor(t,e){this.from=t,this.to=e}};function Q0(i,t,e){let r=[],n=i,s=0;return _.spans(e,i,t,{span(){},point(o,l){o>n&&(r.push({from:n,to:o}),s+=o-n),n=l}},20),n=1)return t[t.length-1].to;let r=Math.floor(i*e);for(let n=0;;n++){let{from:s,to:o}=t[n],l=o-s;if(r<=l)return s+r;r-=l}}function ds(i,t){let e=0;for(let{from:r,to:n}of i.ranges){if(t<=n){e+=t-r;break}e+=n-r}return e/i.total}function R0(i,t){for(let e of i)if(t(e))return e}var Cu={toDOM(i){return i},fromDOM(i){return i},scale:1},pa=class{constructor(t,e,r){let n=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let h=e.lineAt(l,et.ByPos,t,0,0).top,f=e.lineAt(a,et.ByPos,t,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let e=0,r=0,n=0;;e++){let s=eCr(n,t)):i._content)}var ps=A.define({combine:i=>i.join(\" \")}),ma=A.define({combine:i=>i.indexOf(!0)>-1}),ga=Gt.newName(),Qd=Gt.newName(),Rd=Gt.newName(),Md={\"&light\":\".\"+Qd,\"&dark\":\".\"+Rd};function Oa(i,t,e){return new Gt(t,{finish(r){return/&/.test(r)?r.replace(/&\\w*/,n=>{if(n==\"&\")return i;if(!e||!e[n])throw new RangeError(`Unsupported selector: ${n}`);return e[n]}):i+\" \"+r}})}var M0=Oa(\".\"+ga,{\"&\":{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\",minHeight:\"100%\",padding:\"4px 0\",outline:\"none\",\"&[contenteditable=true]\":{WebkitUserModify:\"read-write-plaintext-only\"}},\".cm-lineWrapping\":{whiteSpace_fallback:\"pre-wrap\",whiteSpace:\"break-spaces\",wordBreak:\"break-word\",overflowWrap:\"anywhere\",flexShrink:1},\"&light .cm-content\":{caretColor:\"black\"},\"&dark .cm-content\":{caretColor:\"white\"},\".cm-line\":{display:\"block\",padding:\"0 2px 0 6px\"},\".cm-layer\":{position:\"absolute\",left:0,top:0,contain:\"size style\",\"& > *\":{position:\"absolute\"}},\"&light .cm-selectionBackground\":{background:\"#d9d9d9\"},\"&dark .cm-selectionBackground\":{background:\"#222\"},\"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#d7d4f0\"},\"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#233\"},\".cm-cursorLayer\":{pointerEvents:\"none\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer\":{animation:\"steps(1) cm-blink 1.2s infinite\"},\"@keyframes cm-blink\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\"@keyframes cm-blink2\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\".cm-cursor, .cm-dropCursor\":{borderLeft:\"1.2px solid black\",marginLeft:\"-0.6px\",pointerEvents:\"none\"},\".cm-cursor\":{display:\"none\"},\"&dark .cm-cursor\":{borderLeftColor:\"#444\"},\".cm-dropCursor\":{position:\"absolute\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor\":{display:\"block\"},\".cm-iso\":{unicodeBidi:\"isolate\"},\".cm-announced\":{position:\"fixed\",top:\"-10000px\"},\"@media print\":{\".cm-announced\":{display:\"none\"}},\"&light .cm-activeLine\":{backgroundColor:\"#cceeff44\"},\"&dark .cm-activeLine\":{backgroundColor:\"#99eeff33\"},\"&light .cm-specialChar\":{color:\"red\"},\"&dark .cm-specialChar\":{color:\"#f78\"},\".cm-gutters\":{flexShrink:0,display:\"flex\",height:\"100%\",boxSizing:\"border-box\",insetInlineStart: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,')`,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\"}},Md),Ar=\"\\uFFFF\",xa=class{constructor(t,e){this.points=t,this.text=\"\",this.lineSeparator=e.facet(Y.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Ar}readRange(t,e){if(!t)return this;let r=t.parentNode;for(let n=t;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==e)break;let l=rt.get(n),a=rt.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Au(n))||Au(o)&&(n.nodeName!=\"BR\"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(r,e),this}readTextNode(t){let e=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,e.length));for(let r=0,n=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=n.exec(e))&&(s=l.index,o=l[0].length),this.append(e.slice(r,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(t){if(t.cmIgnore)return;let e=rt.get(t),r=e&&e.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName==\"BR\"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}findPointInside(t,e){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(E0(t,r.node,r.offset)?e:0))}};function E0(i,t,e){for(;;){if(!t||e-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,r,0))){let l=s||o?[]:D0(t),a=new xa(l,t.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=B0(l,this.bounds.from)}else{let l=t.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Zl(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Zl(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=t.viewport;if((Q.ios||Q.chrome)&&t.state.selection.main.empty&&a!=h&&(f.from>0||f.toDate.now()-100?i.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,a=n.from,h=null;(s===8||Q.android&&t.text.length=n.from&&e.to<=n.to&&(e.from!=n.from||e.to!=n.to)&&n.to-n.from-(e.to-e.from)<=4?e={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,e.from).append(e.insert).append(i.state.doc.slice(e.to,n.to))}:(Q.mac||Q.android)&&e&&e.from==e.to&&e.from==n.head-1&&/^\\. ?$/.test(e.insert.toString())&&i.contentDOM.getAttribute(\"autocorrect\")==\"off\"?(r&&e.insert.length==2&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}):Q.chrome&&e&&e.from==e.to&&e.from==n.head&&e.insert.toString()==`\n `&&i.lineWrapping&&(r&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}),e){if(Q.ios&&i.inputState.flushIOSKey()||Q.android&&(e.from==n.from&&e.to==n.to&&e.insert.length==1&&e.insert.lines==2&&zi(i.contentDOM,\"Enter\",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||s==8&&e.insert.lengthn.head)&&zi(i.contentDOM,\"Backspace\",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&zi(i.contentDOM,\"Delete\",46)))return!0;let o=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let l,a=()=>l||(l=$0(i,e,r));return i.state.facet(ad).some(h=>h(i,e.from,e.to,o,a))||i.dispatch(a()),!0}else if(r&&!r.main.eq(n)){let o=!1,l=\"select\";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin==\"select\"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function $0(i,t,e){let r,n=i.state,s=n.selection.main;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&i.inputState.composing<0){let l=s.fromt.to?n.sliceDoc(t.to,s.to):\"\";r=n.replaceSelection(i.state.toText(l+t.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=n.changes(t),a=e&&e.main.to<=l.newLength?e.main:void 0;if(n.selection.ranges.length>1&&i.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let h=i.state.sliceDoc(t.from,t.to),f,c=e&&Od(i,e.main.head);if(c){let m=t.insert.length-(t.to-t.from);f={from:c.from,to:c.to-m}}else f=i.state.doc.lineAt(s.head);let u=s.to-t.to,d=s.to-s.from;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let O=m.to-u,g=O-h.length;if(m.to-m.from!=d||i.state.sliceDoc(g,O)!=h||m.to>=f.from&&m.from<=f.to)return{range:m};let x=n.changes({from:g,to:O,insert:t.insert}),S=m.to-s.to;return{changes:x,range:a?b.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S)):m.map(x)}})}else r={changes:l,selection:a&&n.selection.replaceRange(a)}}let o=\"input.type\";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=\".compose\",i.inputState.compositionFirstChange&&(o+=\".start\",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:o,scrollIntoView:!0})}function q0(i,t,e,r){let n=Math.min(i.length,t.length),s=0;for(;s0&&l>0&&i.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(r==\"end\"){let a=Math.max(0,s-Math.min(o,l));e-=o+a-s}if(o=o?s-e:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-e:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function D0(i){let t=[];if(i.root.activeElement!=i.contentDOM)return t;let{anchorNode:e,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return e&&(t.push(new Qs(e,r)),(n!=e||s!=r)&&t.push(new Qs(n,s))),t}function B0(i,t){if(i.length==0)return null;let e=i[0].pos,r=i.length==2?i[1].pos:e;return e>-1&&r>-1?b.single(e+t,r+t):null}var X0={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Il=Q.ie&&Q.ie_version<=11,ba=class{constructor(t){this.view=t,this.active=!1,this.selectionRange=new Fl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let r of e)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&t.composing)&&e.some(r=>r.type==\"childList\"&&r.removedNodes.length||r.type==\"characterData\"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Il&&(this.onCharData=e=>{this.queue.push({target:e.target,type:\"characterData\",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver==\"function\"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(\"Event\")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(\"Event\"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers(\"scroll\",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,r)=>e!=t[r]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Xs)?r.root.activeElement!=this.dom:!Os(r.dom,n))return;let s=n.anchorNode&&r.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&n.focusNode&&Rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Q.safari&&t.root.nodeType==11&&AO(this.dom.ownerDocument)==this.dom&&L0(this.view)||Ss(t.root);if(!e||this.selectionRange.eq(e))return!1;let r=Os(this.dom,e);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&zi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||t==\"Enter\")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,r=-1,n=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),e==-1?{from:e,to:r}=o:(e=Math.min(o.from,e),r=Math.max(o.to,r)))}return{from:e,to:r,typeOver:n}}readChange(){let{from:t,to:e,typeOver:r}=this.processRecords(),n=this.selectionChanged&&Os(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ya(this.view,t,e,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let r=this.view.state,n=Ed(this.view,e);return this.view.state==r&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type==\"attributes\"),t.type==\"attributes\"&&(e.flags|=4),t.type==\"childList\"){let r=Qu(e,t.previousSibling||t.target.previousSibling,-1),n=Qu(e,t.nextSibling||t.target.nextSibling,1);return{from:r?e.posAfter(r):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}else return t.type==\"characterData\"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener(\"resize\",this.onResize),t.addEventListener(\"beforeprint\",this.onPrint),t.addEventListener(\"scroll\",this.onScroll),t.document.addEventListener(\"selectionchange\",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener(\"scroll\",this.onScroll),t.removeEventListener(\"resize\",this.onResize),t.removeEventListener(\"beforeprint\",this.onPrint),t.document.removeEventListener(\"selectionchange\",this.onSelectionChange)}destroy(){var t,e,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener(\"scroll\",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function Qu(i,t,e){for(;t;){let r=rt.get(t);if(r&&r.parent==i)return r;let n=t.parentNode;t=n!=i.dom?n:e>0?t.nextSibling:t.previousSibling}return null}function L0(i){let t=null;function e(a){a.preventDefault(),a.stopImmediatePropagation(),t=a.getTargetRanges()[0]}if(i.contentDOM.addEventListener(\"beforeinput\",e,!0),i.dom.ownerDocument.execCommand(\"indent\"),i.contentDOM.removeEventListener(\"beforeinput\",e,!0),!t)return null;let r=t.startContainer,n=t.startOffset,s=t.endContainer,o=t.endOffset,l=i.docView.domAtPos(i.state.selection.main.anchor);return Rr(l.node,l.offset,s,o)&&([r,n,s,o]=[s,o,r,n]),{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:o}}var T=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement(\"div\"),this.scrollDOM=document.createElement(\"div\"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=\"cm-scroller\",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(\"div\"),this.announceDOM.className=\"cm-announced\",this.announceDOM.setAttribute(\"aria-live\",\"polite\"),this.dom=document.createElement(\"div\"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(r=>r.forEach(n=>e(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||EO(t.parent)||document,this.viewState=new As(t.state||Y.create(t)),t.scrollTo&&t.scrollTo.is(hs)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Tr).map(r=>new $r(r));for(let r of this.plugins)r.update(this);this.observer=new ba(this),this.inputState=new sa(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ts(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=t.length==1&&t[0]instanceof lt?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.update are not allowed while an update is in progress\");let e=!1,r=!1,n,s=this.state;for(let u of t){if(u.startState!=s)throw new RangeError(\"Trying to update state with a transaction that doesn't start from the previous state.\");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;t.some(u=>u.annotation(Pd))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Cd(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(Y.phrases)!=this.state.facet(Y.phrases))return this.setState(s);n=ks.create(this,s,t),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;c=new Er(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(hs)&&(c=d.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Rs.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(Pr)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(u=>u.isUserEvent(\"select.pointer\")))}finally{this.updateState=0}if(n.startState.facet(ps)!=n.state.facet(ps)&&(this.viewState.mustMeasureContent=!0),(e||r||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(ia))try{u(n)}catch(d){Ct(this.state,d,\"update listener\")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!Ed(this,f)&&h.force&&zi(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.setState are not allowed while an update is in progress\");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new As(t),this.plugins=t.facet(Tr).map(r=>new $r(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Ts(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Tr),r=t.state.facet(Tr);if(e!=r){let n=[];for(let s of r){let o=e.indexOf(s);if(o<0)n.push(new $r(s));else{let l=this.plugins[o];l.mustUpdate=t,n.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(zu(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?\"Measure loop restarted more than 5 times\":\"Viewport failed to stabilize\");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(d=>{try{return d.read(this)}catch(m){return Ct(this.state,m),Ru}}),c=ks.create(this,this.state,[]),u=!1;c.flags|=a,e?e.flags|=a:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c));for(let d=0;d1||m<-1){n=n+m,r.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(ia))l(e)}get themeClasses(){return ga+\" \"+(this.state.facet(ma)?Rd:Qd)+\" \"+this.state.facet(ps)}updateAttrs(){let t=Mu(this,ud,{class:\"cm-editor\"+(this.hasFocus?\" cm-focused \":\" \")+this.themeClasses}),e={spellcheck:\"false\",autocorrect:\"off\",autocapitalize:\"off\",translate:\"no\",contenteditable:this.state.facet(Xs)?\"true\":\"false\",class:\"cm-content\",style:`${Q.tabSize}: ${this.state.tabSize}`,role:\"textbox\",\"aria-multiline\":\"true\"};this.state.readOnly&&(e[\"aria-readonly\"]=\"true\"),Mu(this,Ea,e);let r=this.observer.ignore(()=>{let n=jl(this.contentDOM,this.contentAttrs,e),s=jl(this.dom,this.editorAttrs,t);return n||s});return this.editorAttrs=t,this.contentAttrs=e,r}showAnnouncements(t){let e=!0;for(let r of t)for(let n of r.effects)if(n.is(i.announce)){e&&(this.announceDOM.textContent=\"\"),e=!1;let s=this.announceDOM.appendChild(document.createElement(\"div\"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Pr);let t=this.state.facet(i.cspNonce);Gt.mount(this.root,this.styleModules.concat(M0).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error(\"Reading the editor layout isn't allowed during an update\");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;er.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,r){return Wl(this,t,mu(this,t,e,r))}moveByGroup(t,e){return Wl(this,t,mu(this,t,e,r=>a0(this,t.head,r)))}visualLineSide(t,e){let r=this.bidiSpans(t),n=this.textDirectionAt(t.from),s=r[e?r.length-1:0];return b.cursor(s.side(e,n)+t.from,s.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,r=!0){return l0(this,t,e,r)}moveVertically(t,e,r){return Wl(this,t,h0(this,t,e,r))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),yd(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let r=this.docView.coordsAt(t,e);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n),o=s[Oe.find(s,t-n.from,-1,e)];return Aa(r,o.dir==G.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(fd)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>V0)return id(t.length);let e=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==e&&(s.fresh||ed(s.isolates,r=fu(this,t))))return s.order;r||(r=fu(this,t));let n=ZO(t.text,e,r);return this.bidiCache.push(new Rs(t.from,t.to,e,r,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nu(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return hs.of(new Er(typeof t==\"number\"?b.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return hs.of(new Er(b.cursor(r.from),\"start\",\"start\",r.top-t,e,!0))}static domEventHandlers(t){return ft.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ft.define(()=>({}),{eventObservers:t})}static theme(t,e){let r=Gt.newName(),n=[ps.of(r),Pr.of(Oa(`.${r}`,t))];return e&&e.dark&&n.push(ma.of(!0)),n}static baseTheme(t){return ie.lowest(Pr.of(Oa(\".\"+ga,t,Md)))}static findFromDOM(t){var e;let r=t.querySelector(\".cm-content\"),n=r&&rt.get(r)||rt.get(t);return((e=n?.rootView)===null||e===void 0?void 0:e.view)||null}};T.styleModule=Pr;T.inputHandler=ad;T.focusChangeEffect=hd;T.perLineTextDirection=fd;T.exceptionSink=ld;T.updateListener=ia;T.editable=Xs;T.mouseSelectionStyle=od;T.dragMovesSelection=sd;T.clickAddsSelectionRange=nd;T.decorations=Yr;T.outerDecorations=dd;T.atomicRanges=$a;T.bidiIsolatedRanges=pd;T.scrollMargins=md;T.darkTheme=ma;T.cspNonce=A.define({combine:i=>i.length?i[0]:\"\"});T.contentAttributes=Ea;T.editorAttributes=ud;T.lineWrapping=T.contentAttributes.of({class:\"cm-lineWrapping\"});T.announce=M.define();var V0=4096,Ru={},Rs=class i{constructor(t,e,r,n,s,o){this.from=t,this.to=e,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(t,e){if(e.empty&&!t.some(s=>s.fresh))return t;let r=[],n=t.length?t[t.length-1].dir:G.LTR;for(let s=Math.max(0,t.length-10);s=0;n--){let s=r[n],o=typeof s==\"function\"?s(i):s;o&&Ul(o,e)}return e}var W0=Q.mac?\"mac\":Q.windows?\"win\":Q.linux?\"linux\":\"key\";function I0(i,t){let e=i.split(/-(?!$)/),r=e[e.length-1];r==\"Space\"&&(r=\" \");let n,s,o,l;for(let a=0;ar.concat(n),[]))),e}function qd(i,t,e){return Dd($d(i.state),t,i,e)}var Ie=null,Y0=4e3;function z0(i,t=W0){let e=Object.create(null),r=Object.create(null),n=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error(\"Key binding \"+o+\" is used both as a regular binding and as a multi-stroke prefix\")},s=(o,l,a,h,f)=>{var c,u;let d=e[o]||(e[o]=Object.create(null)),m=l.split(/ (?!$)/).map(x=>I0(x,t));for(let x=1;x{let v=Ie={view:C,prefix:S,scope:o};return setTimeout(()=>{Ie==v&&(Ie=null)},Y0),!0}]})}let O=m.join(\" \");n(O,!1);let g=d[O]||(d[O]={preventDefault:!1,stopPropagation:!1,run:((u=(c=d._any)===null||c===void 0?void 0:c.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),f&&(g.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(\" \"):[\"editor\"];if(o.any)for(let h of l){let f=e[h]||(e[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let c in f)f[c].run.push(o.any)}let a=o[t]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,\"Shift-\"+a,o.shift,o.preventDefault,o.stopPropagation)}return e}function Dd(i,t,e,r){let n=iu(t),s=dt(n,0),o=wt(s)==n.length&&n!=\" \",l=\"\",a=!1,h=!1,f=!1;Ie&&Ie.view==e&&Ie.scope==r&&(l=Ie.prefix+\" \",Sd.indexOf(t.keyCode)<0&&(h=!0,Ie=null));let c=new Set,u=g=>{if(g){for(let x of g.run)if(!c.has(x)&&(c.add(x),x(e,t)))return g.stopPropagation&&(f=!0),!0;g.preventDefault&&(g.stopPropagation&&(f=!0),h=!0)}return!1},d=i[r],m,O;return d&&(u(d[l+ms(n,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Q.windows&&t.ctrlKey&&t.altKey)&&(m=$e[t.keyCode])&&m!=n?(u(d[l+ms(m,t,!0)])||t.shiftKey&&(O=Vi[t.keyCode])!=n&&O!=m&&u(d[l+ms(O,t,!1)]))&&(a=!0):o&&t.shiftKey&&u(d[l+ms(n,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&f&&t.stopPropagation(),a}var zr=class i{constructor(t,e,r,n,s){this.className=t,this.left=e,this.top=r,this.width=n,this.height=s}draw(){let t=document.createElement(\"div\");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+\"px\",t.style.top=this.top+\"px\",this.width!=null&&(t.style.width=this.width+\"px\"),t.style.height=this.height+\"px\"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,r){if(r.empty){let n=t.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let s=Bd(t);return[new i(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}else return Z0(t,e,r)}};function Bd(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==G.LTR?t.left:t.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:t.top-i.scrollDOM.scrollTop*i.scaleY}}function $u(i,t,e){let r=b.cursor(t);return{from:Math.max(e.from,i.moveToLineBoundary(r,!1,!0).from),to:Math.min(e.to,i.moveToLineBoundary(r,!0,!0).from),type:Pt.Text}}function Z0(i,t,e){if(e.to<=i.viewport.from||e.from>=i.viewport.to)return[];let r=Math.max(e.from,i.viewport.from),n=Math.min(e.to,i.viewport.to),s=i.textDirection==G.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=Bd(i),h=o.querySelector(\".cm-line\"),f=h&&window.getComputedStyle(h),c=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),u=l.right-(f?parseInt(f.paddingRight):0),d=na(i,r),m=na(i,n),O=d.type==Pt.Text?d:null,g=m.type==Pt.Text?m:null;if(O&&(i.lineWrapping||d.widgetLineBreaks)&&(O=$u(i,r,O)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=$u(i,n,g)),O&&g&&O.from==g.from)return S(C(e.from,e.to,O));{let y=O?C(e.from,null,O):v(d,!1),k=g?C(null,e.to,g):v(m,!0),w=[];return(O||d).to<(g||m).from-(O&&g?1:0)||d.widgetLineBreaks>1&&y.bottom+i.defaultLineHeight/2D&&N.from=Rt)break;ct>nt&&B(Math.max(Ft,nt),y==null&&Ft<=D,Math.min(ct,Rt),k==null&&ct>=U,Bt.dir)}if(nt=Mt.to+1,nt>=Rt)break}return W.length==0&&B(D,y==null,U,k==null,i.textDirection),{top:q,bottom:L,horizontal:W}}function v(y,k){let w=l.top+(k?y.top:y.bottom);return{top:w,bottom:w,horizontal:[]}}}function F0(i,t){return i.constructor==t.constructor&&i.eq(t)}var Sa=class{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement(\"div\")),this.dom.classList.add(\"cm-layer\"),e.above&&this.dom.classList.add(\"cm-layer-above\"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute(\"aria-hidden\",\"true\"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(bs)!=t.state.facet(bs)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,r=t.facet(bs);for(;e!F0(e,this.drawn[r]))){let e=this.dom.firstChild,r=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[r].constructor&&n.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(n.draw(),e);for(;e;){let n=e.nextSibling;e.remove(),e=n}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},bs=A.define();function Xd(i){return[ft.define(t=>new Sa(t,i)),bs.of(i)]}var Ld=!Q.ios,Zr=A.define({combine(i){return kt(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function Ls(i={}){return[Zr.of(i),_0,G0,H0,cd.of(!0)]}function Vd(i){return i.startState.facet(Zr)!=i.state.facet(Zr)}var _0=Xd({above:!0,markers(i){let{state:t}=i,e=t.facet(Zr),r=[];for(let n of t.selection.ranges){let s=n==t.selection.main;if(n.empty?!s||Ld:e.drawRangeCursor){let o=s?\"cm-cursor cm-cursor-primary\":\"cm-cursor cm-cursor-secondary\",l=n.empty?n:b.cursor(n.head,n.head>n.anchor?-1:1);for(let a of zr.forRange(i,o,l))r.push(a)}}return r},update(i,t){i.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName==\"cm-blink\"?\"cm-blink2\":\"cm-blink\");let e=Vd(i);return e&&qu(i.state,t),i.docChanged||i.selectionSet||e},mount(i,t){qu(t.state,i)},class:\"cm-cursorLayer\"});function qu(i,t){t.style.animationDuration=i.facet(Zr).cursorBlinkRate+\"ms\"}var G0=Xd({above:!1,markers(i){return i.state.selection.ranges.map(t=>t.empty?[]:zr.forRange(i,\"cm-selectionBackground\",t)).reduce((t,e)=>t.concat(e))},update(i,t){return i.docChanged||i.selectionSet||i.viewportChanged||Vd(i)},class:\"cm-selectionLayer\"}),wa={\".cm-line\":{\"& ::selection\":{backgroundColor:\"transparent !important\"},\"&::selection\":{backgroundColor:\"transparent !important\"}}};Ld&&(wa[\".cm-line\"].caretColor=\"transparent !important\",wa[\".cm-content\"]={caretColor:\"transparent !important\"});var H0=ie.highest(T.theme(wa)),Wd=M.define({map(i,t){return i==null?null:t.mapPos(i)}}),Qr=it.define({create(){return null},update(i,t){return i!=null&&(i=t.changes.mapPos(i)),t.effects.reduce((e,r)=>r.is(Wd)?r.value:e,i)}}),U0=ft.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var t;let e=i.state.field(Qr);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(\"div\")),this.cursor.className=\"cm-dropCursor\"),(i.startState.field(Qr)!=e||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,t=i.state.field(Qr),e=t!=null&&i.coordsAtPos(t);if(!e)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:e.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:e.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:e.bottom-e.top}}drawCursor(i){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;i?(this.cursor.style.left=i.left/t+\"px\",this.cursor.style.top=i.top/e+\"px\",this.cursor.style.height=i.height/e+\"px\"):this.cursor.style.left=\"-100000px\"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Qr)!=i&&this.view.dispatch({effects:Wd.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Vs(){return[Qr,U0]}var Aw=/x/.unicode!=null?\"gu\":\"g\";var va=2e3;function j0(i,t,e){let r=Math.min(t.line,e.line),n=Math.max(t.line,e.line),s=[];if(t.off>va||e.off>va||t.col<0||e.col<0){let o=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let a=r;a<=n;a++){let h=i.doc.line(a);h.length<=l&&s.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let a=r;a<=n;a++){let h=i.doc.line(a),f=os(h.text,o,i.tabSize,!0);if(f<0)s.push(b.cursor(h.to));else{let c=os(h.text,l,i.tabSize);s.push(b.range(h.from+f,h.from+c))}}}return s}function K0(i,t){let e=i.coordsAtPos(i.viewport.from);return e?Math.round(Math.abs((e.left-t)/i.defaultCharacterWidth)):-1}function Du(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1),r=i.state.doc.lineAt(e),n=e-r.from,s=n>va?-1:n==r.length?K0(i,t.clientX):We(r.text,i.state.tabSize,e-r.from);return{line:r.number,col:s,off:n}}function J0(i,t){let e=Du(i,t),r=i.state.selection;return e?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(e.line).from),o=n.state.doc.lineAt(s);e={line:o.number,col:e.col,off:Math.min(e.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let l=Du(i,n);if(!l)return r;let a=j0(i.state,e,l);return a.length?o?b.create(a.concat(r.ranges)):b.create(a):r}}:null}function qa(i){let t=i?.eventFilter||(e=>e.altKey&&e.button==0);return T.mouseSelectionStyle.of((e,r)=>t(r)?J0(e,r):null)}var tx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},ex={style:\"cursor: crosshair\"};function Ws(i={}){let[t,e]=tx[i.key||\"Alt\"],r=ft.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==t||e(n))},keyup(n){(n.keyCode==t||!e(n))&&this.set(!1)},mousemove(n){this.set(e(n))}}});return[r,T.contentAttributes.of(n=>{var s;return!((s=n.plugin(r))===null||s===void 0)&&s.isDown?ex:null})]}var kr=\"-10000px\",Ms=class{constructor(t,e,r,n){this.facet=e,this.createTooltipView=r,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(t,e){var r;let n=t.state.facet(this.facet),s=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let o=[],l=e?[]:null;for(let a=0;ae[h]=a),e.length=l.length),this.input=n,this.tooltips=s,this.tooltipViews=o,!0}};function ix(i){let{win:t}=i;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}var Nl=A.define({combine:i=>{var t,e,r;return{position:Q.ios?\"absolute\":((t=i.find(n=>n.position))===null||t===void 0?void 0:t.position)||\"fixed\",parent:((e=i.find(n=>n.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((r=i.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||ix}}}),Bu=new WeakMap,Da=ft.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=i.state.facet(Nl);this.position=t.position,this.parent=t.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==\"function\"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ms(i,Fr,(e,r)=>this.createTooltip(e,r),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==\"function\"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener(\"resize\",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(\"div\"),this.container.style.position=\"relative\",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(i,this.above);t&&this.observeIntersection();let e=t||i.geometryChanged,r=i.state.facet(Nl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(i,t){let e=i.create(this.view),r=t?t.dom:null;if(e.dom.classList.add(\"cm-tooltip\"),i.arrow&&!e.dom.querySelector(\".cm-tooltip > .cm-tooltip-arrow\")){let n=document.createElement(\"div\");n.className=\"cm-tooltip-arrow\",e.dom.insertBefore(n,r)}return e.dom.style.position=this.position,e.dom.style.top=kr,e.dom.style.left=\"0px\",this.container.insertBefore(e.dom,r),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var i,t,e;this.view.win.removeEventListener(\"resize\",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),t=1,e=1,r=!1;if(this.position==\"fixed\"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Q.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==kr&&n.style.left==\"0px\"){let s=n.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position==\"absolute\")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((n,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Nl).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:r}}writeMeasure(i){var t;if(i.makeAbsolute){this.madeAbsolute=!0,this.position=\"absolute\";for(let l of this.manager.tooltipViews)l.dom.style.position=\"absolute\"}let{editor:e,space:r,scaleX:n,scaleY:s}=i,o=[];for(let l=0;l=Math.min(e.bottom,r.bottom)||c.rightMath.min(e.right,r.right)+.1){f.style.top=kr;continue}let d=a.arrow?h.dom.querySelector(\".cm-tooltip-arrow\"):null,m=d?7:0,O=u.right-u.left,g=(t=Bu.get(h))!==null&&t!==void 0?t:u.bottom-u.top,x=h.offset||nx,S=this.view.textDirection==G.LTR,C=u.width>r.right-r.left?S?r.left:r.right-u.width:S?Math.min(c.left-(d?14:0)+x.x,r.right-O):Math.max(r.left,c.left-O+(d?14:0)-x.x),v=this.above[l];!a.strictSide&&(v?c.top-(u.bottom-u.top)-x.yr.bottom)&&v==r.bottom-c.bottom>c.top-r.top&&(v=this.above[l]=!v);let y=(v?c.top-r.top:r.bottom-c.bottom)-m;if(yC&&q.topk&&(k=v?q.top-g-2-m:q.bottom+m+2);if(this.position==\"absolute\"?(f.style.top=(k-i.parent.top)/s+\"px\",f.style.left=(C-i.parent.left)/n+\"px\"):(f.style.top=k/s+\"px\",f.style.left=C/n+\"px\"),d){let q=c.left+(S?x.x:-x.x)-(C+14-7);d.style.left=q/n+\"px\"}h.overlap!==!0&&o.push({left:C,top:k,right:w,bottom:k+g}),f.classList.toggle(\"cm-tooltip-above\",v),f.classList.toggle(\"cm-tooltip-below\",!v),h.positioned&&h.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=kr}},{eventObservers:{scroll(){this.maybeMeasure()}}}),rx=T.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:\"7px\",width:`${7*2}px`,position:\"absolute\",zIndex:-1,overflow:\"hidden\",\"&:before, &:after\":{content:\"''\",position:\"absolute\",width:0,height:0,borderLeft:\"7px solid transparent\",borderRight:\"7px solid transparent\"},\".cm-tooltip-above &\":{bottom:\"-7px\",\"&:before\":{borderTop:\"7px solid #bbb\"},\"&:after\":{borderTop:\"7px solid #f5f5f5\",bottom:\"1px\"}},\".cm-tooltip-below &\":{top:\"-7px\",\"&:before\":{borderBottom:\"7px solid #bbb\"},\"&:after\":{borderBottom:\"7px solid #f5f5f5\",top:\"1px\"}}},\"&dark .cm-tooltip .cm-tooltip-arrow\":{\"&:before\":{borderTopColor:\"#333338\",borderBottomColor:\"#333338\"},\"&:after\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"}}}),nx={x:0,y:0},Fr=A.define({enables:[Da,rx]}),Es=A.define({combine:i=>i.reduce((t,e)=>t.concat(e),[])}),$s=class i{static create(t){return new i(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement(\"div\"),this.dom.classList.add(\"cm-tooltip-hover\"),this.manager=new Ms(t,Es,(e,r)=>this.createHostedView(e,r),e=>e.dom.remove())}createHostedView(t,e){let r=t.create(this.view);return r.dom.classList.add(\"cm-tooltip-section\"),this.dom.insertBefore(r.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let r of this.manager.tooltipViews){let n=r[t];if(n!==void 0){if(e===void 0)e=n;else if(e!==n)return}}return e}get offset(){return this.passProp(\"offset\")}get getCoords(){return this.passProp(\"getCoords\")}get overlap(){return this.passProp(\"overlap\")}get resize(){return this.passProp(\"resize\")}},sx=Fr.compute([Es],i=>{let t=i.facet(Es);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var r;return(r=e.end)!==null&&r!==void 0?r:e.pos})),create:$s.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),ka=class{constructor(t,e,r,n,s){this.view=t,this.source=e,this.field=r,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener(\"mouseleave\",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener(\"mousemove\",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;tl.bottom||e.xl.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(n)).find(f=>f.from<=n&&f.to>=n),h=a&&a.dir==G.RTL?-1:1;s=e.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Ct(t.state,a,\"hover tooltip\"))}else o&&!(Array.isArray(o)&&!o.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(Da),e=t?t.manager.tooltips.findIndex(r=>r.create==$s.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!ox(s.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,l=(r=(e=n[0])===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!lx(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=r=>{t.removeEventListener(\"mouseleave\",e),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener(\"mouseleave\",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener(\"mouseleave\",this.mouseleave),this.view.dom.removeEventListener(\"mousemove\",this.mousemove)}},gs=4;function ox(i,t){let e=i.getBoundingClientRect();return t.clientX>=e.left-gs&&t.clientX<=e.right+gs&&t.clientY>=e.top-gs&&t.clientY<=e.bottom+gs}function lx(i,t,e,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),l=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.rightn||Math.min(o.bottom,l)=t&&a<=e}function Id(i,t={}){let e=M.define(),r=it.define({create(){return[]},update(n,s){if(n.length&&(t.hideOnChange&&(s.docChanged||s.selection)?n=[]:t.hideOn&&(n=n.filter(o=>!t.hideOn(s,o))),s.docChanged)){let o=[];for(let l of n){let a=s.changes.mapPos(l.pos,-1,ut.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=s.changes.mapPos(h.end)),o.push(h)}}n=o}for(let o of s.effects)o.is(e)&&(n=o.value),o.is(ax)&&(n=[]);return n},provide:n=>Es.from(n)});return[r,ft.define(n=>new ka(n,i,r,e,t.hoverTime||300)),sx]}function Ba(i,t){let e=i.plugin(Da);if(!e)return null;let r=e.manager.tooltips.indexOf(t);return r<0?null:e.manager.tooltipViews[r]}var ax=M.define();var Xu=A.define({combine(i){let t,e;for(let r of i)t=t||r.topContainer,e=e||r.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ci(i,t){let e=i.plugin(Nd),r=e?e.specs.indexOf(t):-1;return r>-1?e.panels[r]:null}var Nd=ft.fromClass(class{constructor(i){this.input=i.state.facet(fi),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(i));let t=i.state.facet(Xu);this.top=new Ni(i,!0,t.topContainer),this.bottom=new Ni(i,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(\"cm-panel\"),e.mount&&e.mount()}update(i){let t=i.state.facet(Xu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ni(i.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ni(i.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=i.state.facet(fi);if(e!=this.input){let r=e.filter(a=>a),n=[],s=[],o=[],l=[];for(let a of r){let h=this.specs.indexOf(a),f;h<0?(f=a(i.view),l.push(f)):(f=this.panels[h],f.update&&f.update(i)),n.push(f),(f.top?s:o).push(f)}this.specs=r,this.panels=n,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add(\"cm-panel\"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})}),Ni=class{constructor(t,e,r){this.view=t,this.top=e,this.container=r,this.dom=void 0,this.classes=\"\",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement(\"div\"),this.dom.className=this.top?\"cm-panels cm-panels-top\":\"cm-panels cm-panels-bottom\",this.dom.style[this.top?\"top\":\"bottom\"]=\"0\";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Lu(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Lu(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(\" \"))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(\" \"))t&&this.container.classList.add(t)}}};function Lu(i){let t=i.nextSibling;return i.remove(),t}var fi=A.define({enables:Nd}),se=class extends ee{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}};se.prototype.elementClass=\"\";se.prototype.toDOM=void 0;se.prototype.mapMode=ut.TrackBefore;se.prototype.startSide=se.prototype.endSide=-1;se.prototype.point=!0;var Yl=A.define(),hx={class:\"\",renderEmptyElements:!1,elementStyle:\"\",markers:()=>_.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Dr=A.define();function _r(i){return[Yd(),Dr.of(Object.assign(Object.assign({},hx),i))]}var Ta=A.define({combine:i=>i.some(t=>t)});function Yd(i){let t=[fx];return i&&i.fixed===!1&&t.push(Ta.of(!0)),t}var fx=ft.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutters\",this.dom.setAttribute(\"aria-hidden\",\"true\"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+\"px\",this.gutters=i.state.facet(Dr).map(t=>new qs(i,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!i.state.facet(Ta),this.fixed&&(this.dom.style.position=\"sticky\"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let t=this.prevViewport,e=i.view.viewport,r=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(r<(e.to-e.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+\"px\"),this.view.state.facet(Ta)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?\"sticky\":\"\"),this.prevViewport=i.view.viewport}syncGutters(i){let t=this.dom.nextSibling;i&&this.dom.remove();let e=_.iter(this.view.state.facet(Yl),this.view.viewport.from),r=[],n=this.gutters.map(s=>new Ca(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Pt.Text&&o){Pa(e,r,l.from);for(let a of n)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of n)a.widget(this.view,l)}else if(s.type==Pt.Text){Pa(e,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(i){let t=i.startState.facet(Dr),e=i.state.facet(Dr),r=i.docChanged||i.heightChanged||i.viewportChanged||!_.eq(i.startState.facet(Yl),i.state.facet(Yl),i.view.viewport.from,i.view.viewport.to);if(t==e)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of e){let o=t.indexOf(s);o<0?n.push(new qs(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==G.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Vu(i){return Array.isArray(i)?i:[i]}function Pa(i,t,e){for(;i.value&&i.from<=e;)i.from==e&&t.push(i.value),i.next()}var Ca=class{constructor(t,e,r){this.gutter=t,this.height=r,this.i=0,this.cursor=_.iter(t.markers,e.from)}addElement(t,e,r){let{gutter:n}=this,s=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==n.elements.length){let l=new Ds(t,o,s,r);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,o,s,r);this.height=e.bottom,this.i++}line(t,e,r){let n=[];Pa(this.cursor,n,e.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(t,e,n)}widget(t,e){let r=this.gutter.config.widgetMarker(t,e.widget,e);r&&this.addElement(t,e,[r])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}},qs=class{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutter\"+(this.config.class?\" \"+this.config.class:\"\");for(let r in e.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=n.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[r](t,l,n)&&n.preventDefault()});this.markers=Vu(e.markers(t)),e.initialSpacer&&(this.spacer=new Ds(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=\"visibility: hidden; pointer-events: none\")}update(t){let e=this.markers;if(this.markers=Vu(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}let r=t.view.viewport;return!_.eq(this.markers,e,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}},Ds=class{constructor(t,e,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutterElement\",this.update(t,e,r,n)}update(t,e,r,n){this.height!=e&&(this.height=e,this.dom.style.height=e+\"px\"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+\"px\":\"\"),cx(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let r=\"cm-gutterElement\",n=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,h)||o(l,a,h):o}return r}})}}),Br=class extends se{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}};function zl(i,t){return i.state.facet(Yi).formatNumber(t,i.state)}var dx=Dr.compute([Yi],i=>({class:\"cm-lineNumbers\",renderEmptyElements:!1,markers(t){return t.state.facet(ux)},lineMarker(t,e,r){return r.some(n=>n.toDOM)?null:new Br(zl(t,t.state.doc.lineAt(e.from).number))},widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Yi)!=t.state.facet(Yi),initialSpacer(t){return new Br(zl(t,Wu(t.state.doc.lines)))},updateSpacer(t,e){let r=zl(e.view,Wu(e.view.state.doc.lines));return r==t.number?t:new Br(r)},domEventHandlers:i.facet(Yi).domEventHandlers}));function ui(i={}){return[Yi.of(i),Yd(),dx]}function Wu(i){let t=9;for(;t{throw new Error(\"This node type doesn't define a deserialize function\")})}add(t){if(this.perNode)throw new RangeError(\"Can't add per-node props to node types\");return typeof t!=\"function\"&&(t=bt.match(t)),e=>{let r=t(e);return r===void 0?null:[this,r]}}};E.closedBy=new E({deserialize:i=>i.split(\" \")});E.openedBy=new E({deserialize:i=>i.split(\" \")});E.group=new E({deserialize:i=>i.split(\" \")});E.isolate=new E({deserialize:i=>{if(i&&i!=\"rtl\"&&i!=\"ltr\"&&i!=\"auto\")throw new RangeError(\"Invalid value for isolate: \"+i);return i||\"auto\"}});E.contextHash=new E({perNode:!0});E.lookAhead=new E({perNode:!0});E.mounted=new E({perNode:!0});var Fi=class{constructor(t,e,r){this.tree=t,this.overlay=e,this.parser=r}static get(t){return t&&t.props&&t.props[E.mounted.id]}},mx=Object.create(null),bt=class i{constructor(t,e,r,n=0){this.name=t,this.props=e,this.id=r,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):mx,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new i(t.name||\"\",e,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError(\"Can't store a per-node prop on a node type\");e[s[0].id]=s[1]}}return n}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t==\"string\"){if(this.name==t)return!0;let e=this.prop(E.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let r in t)for(let n of r.split(\" \"))e[n]=t[r];return r=>{for(let n=r.prop(E.group),s=-1;s<(n?n.length:0);s++){let o=e[s<0?r.name:n[s]];if(o)return o}}}};bt.none=new bt(\"\",Object.create(null),0,8);var Hr=class i{constructor(t){this.types=t;for(let e=0;e0;for(let a=this.cursor(o|st.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ya(bt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,r,n)=>new i(this.type,e,r,n,this.propValues),t.makeTree||((e,r,n)=>new i(bt.none,e,r,n)))}static build(t){return Ox(t)}};ot.empty=new ot(bt.none,[],[],0);var Xa=class i{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},_e=class i{constructor(t,e,r){this.buffer=t,this.length=e,this.set=r}get type(){return bt.none}toString(){let t=[];for(let e=0;e0));a=o[a+3]);return l}slice(t,e,r){let n=this.buffer,s=new Uint16Array(e-t),o=0;for(let l=t,a=0;l=t&&et;case 1:return e<=t&&r>t;case 2:return r>t;case 4:return!0}}function Ur(i,t,e,r){for(var n;i.from==i.to||(e<1?i.from>=t:i.from>t)||(e>-1?i.to<=t:i.to0?l.length:-1;t!=h;t+=e){let f=l[t],c=a[t]+o.from;if(_d(n,r,c,c+f.length)){if(f instanceof _e){if(s&st.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,e,r-c,n);if(u>-1)return new di(new Va(o,f,t,c),null,u)}else if(s&st.IncludeAnonymous||!f.type.isAnonymous||Na(f)){let u;if(!(s&st.IgnoreMounts)&&(u=Fi.get(f))&&!u.overlay)return new i(u.tree,c,t,o);let d=new i(f,c,t,o);return s&st.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(e<0?f.children.length-1:0,e,r,n)}}}if(s&st.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,r=0){let n;if(!(r&st.IgnoreOverlays)&&(n=Fi.get(this._tree))&&n.overlay){let s=t-this.from;for(let{from:o,to:l}of n.overlay)if((e>0?o<=s:o=s:l>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Zd(i,t,e,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(t)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function La(i,t,e=t.length-1){for(let r=i.parent;e>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[e]&&t[e]!=r.name)return!1;e--}}return!0}var Va=class{constructor(t,e,r,n){this.parent=t,this.buffer=e,this.index=r,this.start=n}},di=class i extends Ys{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,r){super(),this.context=t,this._parent=e,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,e,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,r);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,r=0){if(r&st.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new i(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new i(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];t.push(r.slice(n,s,o)),e.push(0)}return new ot(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Gd(i){if(!i.length)return null;let t=0,e=i[0];for(let s=1;se.from||o.to=t){let l=new jt(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(Ur(l,t,e,!1))}}return n?Gd(n):r}var jr=class{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof jt)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:r,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=r+n.buffer[t+1],this.to=r+n.buffer[t+2],!0}yield(t){return t?t instanceof jt?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,r=this.mode){return this.buffer?r&st.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,r=this.stack.length-1;if(t<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(r<0?e.buffer.length:e.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,r,{buffer:n}=this;if(n){if(t>0){if(this.index-1)for(let s=e+t,o=t<0?-1:r._tree.children.length;s!=o;s+=t){let l=r._tree.children[s];if(this.mode&st.IncludeAnonymous||l instanceof _e||!l.type.isAnonymous||Na(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,r=s+1;break t}n=this.stack[--s]}for(let n=r;n=0;s--){if(s<0)return La(this.node,t,n);let o=r[e.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};function Na(i){return i.children.some(t=>t instanceof _e||!t.type.isAnonymous||Na(t))}function Ox(i){var t;let{buffer:e,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,l=Array.isArray(e)?new Xa(e,e.length):e,a=r.types,h=0,f=0;function c(y,k,w,q,L,W){let{id:B,start:D,end:U,size:N}=l,nt=f;for(;N<0;)if(l.next(),N==-1){let ct=s[B];w.push(ct),q.push(D-y);return}else if(N==-3){h=B;return}else if(N==-4){f=B;return}else throw new RangeError(`Unrecognized record size: ${N}`);let Rt=a[B],Mt,Bt,Ft=D-y;if(U-D<=n&&(Bt=g(l.pos-k,L))){let ct=new Uint16Array(Bt.size-Bt.skip),_t=l.pos-Bt.size,de=ct.length;for(;l.pos>_t;)de=x(Bt.start,ct,de);Mt=new _e(ct,U-Bt.start,r),Ft=Bt.start-y}else{let ct=l.pos-N;l.next();let _t=[],de=[],ri=B>=o?B:-1,Ei=0,Un=U;for(;l.pos>ct;)ri>=0&&l.id==ri&&l.size>=0?(l.end<=Un-n&&(m(_t,de,D,Ei,l.end,Un,ri,nt),Ei=_t.length,Un=l.end),l.next()):W>2500?u(D,ct,_t,de):c(D,ct,_t,de,ri,W+1);if(ri>=0&&Ei>0&&Ei<_t.length&&m(_t,de,D,Ei,D,Un,ri,nt),_t.reverse(),de.reverse(),ri>-1&&Ei>0){let Mc=d(Rt);Mt=Ya(Rt,_t,de,0,_t.length,0,U-D,Mc,Mc)}else Mt=O(Rt,_t,de,U-D,nt-U)}w.push(Mt),q.push(Ft)}function u(y,k,w,q){let L=[],W=0,B=-1;for(;l.pos>k;){let{id:D,start:U,end:N,size:nt}=l;if(nt>4)l.next();else{if(B>-1&&U=0;N-=3)D[nt++]=L[N],D[nt++]=L[N+1]-U,D[nt++]=L[N+2]-U,D[nt++]=nt;w.push(new _e(D,L[2]-U,r)),q.push(U-y)}}function d(y){return(k,w,q)=>{let L=0,W=k.length-1,B,D;if(W>=0&&(B=k[W])instanceof ot){if(!W&&B.type==y&&B.length==q)return B;(D=B.prop(E.lookAhead))&&(L=w[W]+B.length+D)}return O(y,k,w,q,L)}}function m(y,k,w,q,L,W,B,D){let U=[],N=[];for(;y.length>q;)U.push(y.pop()),N.push(k.pop()+w-L);y.push(O(r.types[B],U,N,W-L,D-W)),k.push(L-w)}function O(y,k,w,q,L=0,W){if(h){let B=[E.contextHash,h];W=W?[B].concat(W):[B]}if(L>25){let B=[E.lookAhead,L];W=W?[B].concat(W):[B]}return new ot(y,k,w,q,W)}function g(y,k){let w=l.fork(),q=0,L=0,W=0,B=w.end-n,D={size:0,start:0,skip:0};t:for(let U=w.pos-y;w.pos>U;){let N=w.size;if(w.id==k&&N>=0){D.size=q,D.start=L,D.skip=W,W+=4,q+=4,w.next();continue}let nt=w.pos-N;if(N<0||nt=o?4:0,Mt=w.start;for(w.next();w.pos>nt;){if(w.size<0)if(w.size==-3)Rt+=4;else break t;else w.id>=o&&(Rt+=4);w.next()}L=Mt,q+=N,W+=Rt}return(k<0||q==y)&&(D.size=q,D.start=L,D.skip=W),D.size>4?D:void 0}function x(y,k,w){let{id:q,start:L,end:W,size:B}=l;if(l.next(),B>=0&&q4){let U=l.pos-(B-4);for(;l.pos>U;)w=x(y,k,w)}k[--w]=D,k[--w]=W-y,k[--w]=L-y,k[--w]=q}else B==-3?h=q:B==-4&&(f=q);return w}let S=[],C=[];for(;l.pos>0;)c(i.start||0,i.bufferStart||0,S,C,-1,0);let v=(t=i.length)!==null&&t!==void 0?t:S.length?C[0]+S[0].length:0;return new ot(a[i.topID],S.reverse(),C.reverse(),v)}var Fd=new WeakMap;function Ns(i,t){if(!i.isAnonymous||t instanceof _e||t.type!=i)return 1;let e=Fd.get(t);if(e==null){e=1;for(let r of t.children){if(r.type!=i||!(r instanceof ot)){e=1;break}e+=Ns(i,r)}Fd.set(t,e)}return e}function Ya(i,t,e,r,n,s,o,l,a){let h=0;for(let m=r;m=f)break;k+=w}if(C==v+1){if(k>f){let w=m[v];d(w.children,w.positions,0,w.children.length,O[v]+S);continue}c.push(m[v])}else{let w=O[C-1]+m[C-1].length-y;c.push(Ya(i,m,O,v,C,y,w,null,a))}u.push(y+S-s)}}return d(t,e,r,n,0),(l||a)(c,u,o)}var zs=class{constructor(){this.map=new WeakMap}setBuffer(t,e,r){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,r)}getBuffer(t,e){let r=this.map.get(t);return r&&r.get(e)}set(t,e){t instanceof di?this.setBuffer(t.context.buffer,t.index,e):t instanceof jt&&this.map.set(t.tree,e)}get(t){return t instanceof di?this.getBuffer(t.context.buffer,t.index):t instanceof jt?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},pi=class i{constructor(t,e,r,n,s=!1,o=!1){this.from=t,this.to=e,this.tree=r,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],r=!1){let n=[new i(0,t.length,t,0,!1,r)];for(let s of e)s.to>t.length&&n.push(s);return n}static applyChanges(t,e,r=128){if(!e.length)return t;let n=[],s=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let f=l=r)for(;o&&o.from=u.from||c<=u.to||h){let d=Math.max(u.from,a)-h,m=Math.min(u.to,c)-h;u=d>=m?null:new i(d,m,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=snew Gr(n.from,n.to)):[new Gr(0,0)]:[new Gr(0,t.length)],this.createParse(t,e||[],r)}parse(t,e,r){let n=this.startParse(t,e,r);for(;;){let s=n.advance();if(s)return s}}},Ia=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};var Dw=new E({perNode:!0});var xx=0,we=class i{constructor(t,e,r){this.set=t,this.base=e,this.modified=r,this.id=xx++}static define(t){if(t?.base)throw new Error(\"Can not derive from a modified tag\");let e=new i([],null,[]);if(e.set.push(e),t)for(let r of t.set)e.set.push(r);return e}static defineModifier(){let t=new Gs;return e=>e.modified.indexOf(t)>-1?e:Gs.get(e.base||e,e.modified.concat(t).sort((r,n)=>r.id-n.id))}},yx=0,Gs=class i{constructor(){this.instances=[],this.id=yx++}static get(t,e){if(!e.length)return t;let r=e[0].instances.find(l=>l.base==t&&bx(e,l.modified));if(r)return r;let n=[],s=new we(n,t,e);for(let l of e)l.instances.push(s);let o=Sx(e);for(let l of t.set)if(!l.modified.length)for(let a of o)n.push(i.get(l,a));return s}};function bx(i,t){return i.length==t.length&&i.every((e,r)=>e==t[r])}function Sx(i){let t=[[]];for(let e=0;er.length-e.length)}function Hs(i){let t=Object.create(null);for(let e in i){let r=i[e];Array.isArray(r)||(r=[r]);for(let n of e.split(\" \"))if(n){let s=[],o=2,l=n;for(let c=0;;){if(l==\"...\"&&c>0&&c+3==n.length){o=1;break}let u=/^\"(?:[^\"\\\\]|\\\\.)*?\"|[^\\/!]+/.exec(l);if(!u)throw new RangeError(\"Invalid path: \"+n);if(s.push(u[0]==\"*\"?\"\":u[0][0]=='\"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let d=n[c++];if(c==n.length&&d==\"!\"){o=0;break}if(d!=\"/\")throw new RangeError(\"Invalid path: \"+n);l=n.slice(c)}let a=s.length-1,h=s[a];if(!h)throw new RangeError(\"Invalid path: \"+n);let f=new Gi(r,o,a>0?s.slice(0,a):null);t[h]=f.sort(t[h])}}return jd.add(t)}var jd=new E,Gi=class{constructor(t,e,r,n){this.tags=t,this.mode=e,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=n;for(let l of s)for(let a of l.set){let h=e[a.id];if(h){o=o?o+\" \"+h:h;break}}return o},scope:r}}function wx(i,t){let e=null;for(let r of i){let n=r.style(t);n&&(e=e?e+\" \"+n:n)}return e}function Kd(i,t,e,r=0,n=i.length){let s=new Za(r,Array.isArray(t)?t:[t],e);s.highlightRange(i.cursor(),r,n,\"\",s.highlighters),s.flush(n)}var Za=class{constructor(t,e,r){this.at=t,this.highlighters=e,this.span=r,this.class=\"\"}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,r,n,s){let{type:o,from:l,to:a}=t;if(l>=r||a<=e)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,f=vx(t)||Gi.empty,c=wx(s,f.tags);if(c&&(h&&(h+=\" \"),h+=c,f.mode==1&&(n+=(n?\" \":\"\")+c)),this.startSpan(Math.max(e,l),h),f.opaque)return;let u=t.tree&&t.tree.prop(E.mounted);if(u&&u.overlay){let d=t.node.enter(u.overlay[0].from+l,1),m=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),O=t.firstChild();for(let g=0,x=l;;g++){let S=g=C||!t.nextSibling())););if(!S||C>r)break;x=S.to+l,x>e&&(this.highlightRange(d.cursor(),Math.max(e,S.from+l),Math.min(r,x),\"\",m),this.startSpan(Math.min(r,x),h))}O&&t.parent()}else if(t.firstChild()){u&&(n=\"\");do if(!(t.to<=e)){if(t.from>=r)break;this.highlightRange(t,e,r,n,s),this.startSpan(Math.min(r,t.to),h)}while(t.nextSibling());t.parent()}}};function vx(i){let t=i.type.prop(jd);for(;t&&t.context&&!i.matchContext(t.context);)t=t.next;return t||null}var P=we.define,Zs=P(),Ge=P(),Hd=P(Ge),Ud=P(Ge),He=P(),Fs=P(He),za=P(He),Se=P(),mi=P(Se),ye=P(),be=P(),Fa=P(),Kr=P(Fa),_s=P(),p={comment:Zs,lineComment:P(Zs),blockComment:P(Zs),docComment:P(Zs),name:Ge,variableName:P(Ge),typeName:Hd,tagName:P(Hd),propertyName:Ud,attributeName:P(Ud),className:P(Ge),labelName:P(Ge),namespace:P(Ge),macroName:P(Ge),literal:He,string:Fs,docString:P(Fs),character:P(Fs),attributeValue:P(Fs),number:za,integer:P(za),float:P(za),bool:P(He),regexp:P(He),escape:P(He),color:P(He),url:P(He),keyword:ye,self:P(ye),null:P(ye),atom:P(ye),unit:P(ye),modifier:P(ye),operatorKeyword:P(ye),controlKeyword:P(ye),definitionKeyword:P(ye),moduleKeyword:P(ye),operator:be,derefOperator:P(be),arithmeticOperator:P(be),logicOperator:P(be),bitwiseOperator:P(be),compareOperator:P(be),updateOperator:P(be),definitionOperator:P(be),typeOperator:P(be),controlOperator:P(be),punctuation:Fa,separator:P(Fa),bracket:Kr,angleBracket:P(Kr),squareBracket:P(Kr),paren:P(Kr),brace:P(Kr),content:Se,heading:mi,heading1:P(mi),heading2:P(mi),heading3:P(mi),heading4:P(mi),heading5:P(mi),heading6:P(mi),contentSeparator:P(Se),list:P(Se),quote:P(Se),emphasis:P(Se),strong:P(Se),link:P(Se),monospace:P(Se),strikethrough:P(Se),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:_s,documentMeta:P(_s),annotation:P(_s),processingInstruction:P(_s),definition:we.defineModifier(),constant:we.defineModifier(),function:we.defineModifier(),standard:we.defineModifier(),local:we.defineModifier(),special:we.defineModifier()},Lw=_a([{tag:p.link,class:\"tok-link\"},{tag:p.heading,class:\"tok-heading\"},{tag:p.emphasis,class:\"tok-emphasis\"},{tag:p.strong,class:\"tok-strong\"},{tag:p.keyword,class:\"tok-keyword\"},{tag:p.atom,class:\"tok-atom\"},{tag:p.bool,class:\"tok-bool\"},{tag:p.url,class:\"tok-url\"},{tag:p.labelName,class:\"tok-labelName\"},{tag:p.inserted,class:\"tok-inserted\"},{tag:p.deleted,class:\"tok-deleted\"},{tag:p.literal,class:\"tok-literal\"},{tag:p.string,class:\"tok-string\"},{tag:p.number,class:\"tok-number\"},{tag:[p.regexp,p.escape,p.special(p.string)],class:\"tok-string2\"},{tag:p.variableName,class:\"tok-variableName\"},{tag:p.local(p.variableName),class:\"tok-variableName tok-local\"},{tag:p.definition(p.variableName),class:\"tok-variableName tok-definition\"},{tag:p.special(p.variableName),class:\"tok-variableName2\"},{tag:p.definition(p.propertyName),class:\"tok-propertyName tok-definition\"},{tag:p.typeName,class:\"tok-typeName\"},{tag:p.namespace,class:\"tok-namespace\"},{tag:p.className,class:\"tok-className\"},{tag:p.macroName,class:\"tok-macroName\"},{tag:p.propertyName,class:\"tok-propertyName\"},{tag:p.operator,class:\"tok-operator\"},{tag:p.comment,class:\"tok-comment\"},{tag:p.meta,class:\"tok-meta\"},{tag:p.invalid,class:\"tok-invalid\"},{tag:p.punctuation,class:\"tok-punctuation\"}]);var Ga,Hi=new E;function kx(i){return A.define({combine:i?t=>t.concat(i):void 0})}var Tx=new E,Wt=class{constructor(t,e,r=[],n=\"\"){this.data=t,this.name=n,Y.prototype.hasOwnProperty(\"tree\")||Object.defineProperty(Y.prototype,\"tree\",{get(){return pt(this)}}),this.parser=e,this.extension=[Ui.of(this),Y.languageData.of((s,o,l)=>{let a=Jd(s,o,l),h=a.type.prop(Hi);if(!h)return[];let f=s.facet(h),c=a.type.prop(Tx);if(c){let u=a.resolve(o-a.from,l);for(let d of c)if(d.test(u,s)){let m=s.facet(d.facet);return d.type==\"replace\"?m:m.concat(f)}}return f})].concat(r)}isActiveAt(t,e,r=-1){return Jd(t,e,r).type.prop(Hi)==this.data}findRegions(t){let e=t.facet(Ui);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(Hi)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(E.mounted);if(l){if(l.tree.prop(Hi)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(n(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?e:void 0)]}),t.name)}configure(t,e){return new i(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function pt(i){let t=i.field(Wt.state,!1);return t?t.tree:ot.empty}var Ka=class{constructor(t){this.doc=t,this.cursorPos=0,this.string=\"\",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let r=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-r,e-r)}},Jr=null,Ja=class i{constructor(t,e,r=[],n,s,o,l,a){this.parser=t,this.state=e,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,r){return new i(t,e,[],ot.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Ka(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=ot.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t==\"number\"){let n=Date.now()+t;t=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(pi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Jr;Jr=this;try{return t()}finally{Jr=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=tp(t,e.from,e.to);return t}changes(t,e){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),r=pi.applyChanges(r,a),n=ot.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=t.mapPos(h.from,1),c=t.mapPos(h.to,-1);ft.from&&(this.fragments=tp(this.fragments,n,s),this.skipped.splice(r--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends _i{createParse(e,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let a=Jr;if(a){for(let h of n)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new ot(bt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Jr}};function tp(i,t,e){return pi.applyChanges(i,[{fromA:t,toA:e,fromB:t,toB:e}])}var tn=class i{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,r)||e.takeTree(),new i(e)}static init(t){let e=Math.min(3e3,t.doc.length),r=Ja.create(t.facet(Ui).parser,t,{from:0,to:e});return r.work(20,e)||r.takeTree(),new i(r)}};Wt.state=it.define({create:tn.init,update(i,t){for(let e of t.effects)if(e.is(Wt.setState))return e.value;return t.startState.facet(Ui)!=t.state.facet(Ui)?tn.init(t.state):i.apply(t)}});var sp=i=>{let t=setTimeout(()=>i(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<\"u\"&&(sp=i=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(i,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});var Ha=typeof navigator<\"u\"&&(!((Ga=navigator.scheduling)===null||Ga===void 0)&&Ga.isInputPending)?()=>navigator.scheduling.isInputPending():null,Px=ft.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Wt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=sp(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work(()=>Ha&&Ha()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Wt.setState.of(new tn(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Ct(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ui=A.define({combine(i){return i.length?i[0]:null},enables:i=>[Wt.state,Px,T.contentAttributes.compute([i],t=>{let e=t.facet(i);return e&&e.name?{\"data-language\":e.name}:{}})]}),js=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}};var Cx=A.define(),ke=A.define({combine:i=>{if(!i.length)return\" \";let t=i[0];if(!t||/\\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error(\"Invalid indent unit: \"+JSON.stringify(i[0]));return t}});function en(i){let t=i.facet(ke);return t.charCodeAt(0)==9?i.tabSize*t.length:t.length}function rn(i,t){let e=\"\",r=i.tabSize,n=i.facet(ke)[0];if(n==\"\t\"){for(;t>=r;)e+=\"\t\",t-=r;n=\" \"}for(let s=0;s=t?Ax(i,e,t):null}var gi=class{constructor(t,e={}){this.state=t,this.options=e,this.unit=en(t)}lineAt(t,e=1){let r=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=r.from&&n<=r.to?s&&n==t?{text:\"\",from:t}:(e<0?n-1&&(s+=o-this.countColumn(r,r.search(/\\S|$/))),s}countColumn(t,e=t.length){return We(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:r,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(r,r.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},lh=new E;function Ax(i,t,e){let r=t.resolveStack(e),n=r.node.enterUnfinishedNodesBefore(e);if(n!=r.node){let s=[];for(let o=n;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return op(r,i,e)}function op(i,t,e){for(let r=i;r;r=r.next){let n=Rx(r.node);if(n)return n(th.create(t,e,r))}return 0}function Qx(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function Rx(i){let t=i.type.prop(lh);if(t)return t;let e=i.firstChild,r;if(e&&(r=e.type.prop(E.closedBy))){let n=i.lastChild,s=n&&r.indexOf(n.name)>-1;return o=>lp(o,!0,1,void 0,s&&!Qx(o)?n.from:void 0)}return i.parent==null?Mx:null}function Mx(){return 0}var th=class i extends gi{constructor(t,e,r){super(t.state,t.options),this.base=t,this.pos=e,this.context=r}get node(){return this.context.node}static create(t,e,r){return new i(t,e,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(e.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Ex(r,t))break;e=this.state.doc.lineAt(r.from)}return this.lineIndent(e.from)}continue(){return op(this.context.next,this.base,this.pos)}};function Ex(i,t){for(let e=t;e;e=e.parent)if(i==e)return!0;return!1}function $x(i){let t=i.node,e=t.childAfter(t.from),r=t.lastChild;if(!e)return null;let n=i.options.simulateBreak,s=i.state.doc.lineAt(e.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let l=e.to;;){let a=t.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.fromlp(r,t,e,i)}function lp(i,t,e,r,n){let s=i.textAfter,o=s.match(/^\\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||n==i.pos+o,a=t?$x(i):null;return a?l?i.column(a.from):i.column(a.to):i.baseIndent+(l?0:i.unit*e)}var qx=A.define(),ah=new E;function ap(i){let t=i.firstChild,e=i.lastChild;return t&&t.toe)continue;if(s&&l.from=t&&h.to>e&&(s=h)}}return s}function Bx(i){let t=i.lastChild;return t&&t.to==i.to&&t.type.isError}function hp(i,t,e){for(let r of i.facet(qx)){let n=r(i,t,e);if(n)return n}return Dx(i,t,e)}function fp(i,t){let e=t.mapPos(i.from,1),r=t.mapPos(i.to,-1);return e>=r?void 0:{from:e,to:r}}var hh=M.define({map:fp}),Js=M.define({map:fp});function cp(i){let t=[];for(let{head:e}of i.state.selection.ranges)t.some(r=>r.from<=e&&r.to>=e)||t.push(i.lineBlockAt(e));return t}var nn=it.define({create(){return R.none},update(i,t){i=i.map(t.changes);for(let e of t.effects)if(e.is(hh)&&!Xx(i,e.value.from,e.value.to)){let{preparePlaceholder:r}=t.state.facet(fh),n=r?R.replace({widget:new eh(r(t.state,e.value))}):ep;i=i.update({add:[n.range(e.value.from,e.value.to)]})}else e.is(Js)&&(i=i.update({filter:(r,n)=>e.value.from!=r||e.value.to!=n,filterFrom:e.value.from,filterTo:e.value.to}));if(t.selection){let e=!1,{head:r}=t.selection.main;i.between(r,r,(n,s)=>{nr&&(e=!0)}),e&&(i=i.update({filterFrom:r,filterTo:r,filter:(n,s)=>s<=r||n>=r}))}return i},provide:i=>T.decorations.from(i),toJSON(i,t){let e=[];return i.between(0,t.doc.length,(r,n)=>{e.push(r,n)}),e},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError(\"Invalid JSON for fold state\");let t=[];for(let e=0;e{(!n||n.from>s)&&(n={from:s,to:o})}),n}function Xx(i,t,e){let r=!1;return i.between(t,t,(n,s)=>{n==t&&s==e&&(r=!0)}),r}function dp(i,t){return i.field(nn,!1)?t:t.concat(M.appendConfig.of(Yx()))}var Lx=i=>{for(let t of cp(i)){let e=hp(i.state,t.from,t.to);if(e)return i.dispatch({effects:dp(i.state,[hh.of(e),pp(i,e)])}),!0}return!1},Vx=i=>{if(!i.state.field(nn,!1))return!1;let t=[];for(let e of cp(i)){let r=up(i.state,e.from,e.to);r&&t.push(Js.of(r),pp(i,r,!1))}return t.length&&i.dispatch({effects:t}),t.length>0};function pp(i,t,e=!0){let r=i.state.doc.lineAt(t.from).number,n=i.state.doc.lineAt(t.to).number;return T.announce.of(`${i.state.phrase(e?\"Folded lines\":\"Unfolded lines\")} ${r} ${i.state.phrase(\"to\")} ${n}.`)}var Wx=i=>{let{state:t}=i,e=[];for(let r=0;r{let t=i.state.field(nn,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,i.state.doc.length,(r,n)=>{e.push(Js.of({from:r,to:n}))}),i.dispatch({effects:e}),!0};var to=[{key:\"Ctrl-Shift-[\",mac:\"Cmd-Alt-[\",run:Lx},{key:\"Ctrl-Shift-]\",mac:\"Cmd-Alt-]\",run:Vx},{key:\"Ctrl-Alt-[\",run:Wx},{key:\"Ctrl-Alt-]\",run:Ix}],Nx={placeholderDOM:null,preparePlaceholder:null,placeholderText:\"\\u2026\"},fh=A.define({combine(i){return kt(i,Nx)}});function Yx(i){let t=[nn,zx];return i&&t.push(fh.of(i)),t}function mp(i,t){let{state:e}=i,r=e.facet(fh),n=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=up(i.state,l.from,l.to);a&&i.dispatch({effects:Js.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,t);let s=document.createElement(\"span\");return s.textContent=r.placeholderText,s.setAttribute(\"aria-label\",e.phrase(\"folded code\")),s.title=e.phrase(\"unfold\"),s.className=\"cm-foldPlaceholder\",s.onclick=n,s}var ep=R.replace({widget:new class extends Ut{toDOM(i){return mp(i,null)}}}),eh=class extends Ut{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return mp(t,this.value)}};var zx=T.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\"}}),ve=class i{constructor(t,e){this.specs=t;let r;function n(l){let a=Gt.newName();return(r||(r=Object.create(null)))[\".\"+a]=l,a}let s=typeof e.all==\"string\"?e.all:e.all?n(e.all):void 0,o=e.scope;this.scope=o instanceof Wt?l=>l.prop(Hi)==o.data:o?l=>l==o:void 0,this.style=_a(t.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Gt(r):null,this.themeType=e.themeType}static define(t,e){return new i(t,e||{})}},ih=A.define(),gp=A.define({combine(i){return i.length?[i[0]]:null}});function Ua(i){let t=i.facet(ih);return t.length?t:i.facet(gp)}function Te(i,t){let e=[Zx],r;return i instanceof ve&&(i.module&&e.push(T.styleModule.of(i.module)),r=i.themeType),t?.fallback?e.push(gp.of(i)):r?e.push(ih.computeN([T.darkTheme],n=>n.facet(T.darkTheme)==(r==\"dark\")?[i]:[])):e.push(ih.of(i)),e}var rh=class{constructor(t){this.markCache=Object.create(null),this.tree=pt(t.state),this.decorations=this.buildDeco(t,Ua(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=pt(t.state),r=Ua(t.state),n=r!=Ua(t.startState),{viewport:s}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return R.none;let r=new Ee;for(let{from:n,to:s}of t.visibleRanges)Kd(this.tree,e,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},n,s);return r.finish()}},Zx=ie.high(ft.fromClass(rh,{decorations:i=>i.decorations})),eo=ve.define([{tag:p.meta,color:\"#404740\"},{tag:p.link,textDecoration:\"underline\"},{tag:p.heading,textDecoration:\"underline\",fontWeight:\"bold\"},{tag:p.emphasis,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\"},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.keyword,color:\"#708\"},{tag:[p.atom,p.bool,p.url,p.contentSeparator,p.labelName],color:\"#219\"},{tag:[p.literal,p.inserted],color:\"#164\"},{tag:[p.string,p.deleted],color:\"#a11\"},{tag:[p.regexp,p.escape,p.special(p.string)],color:\"#e40\"},{tag:p.definition(p.variableName),color:\"#00f\"},{tag:p.local(p.variableName),color:\"#30a\"},{tag:[p.typeName,p.namespace],color:\"#085\"},{tag:p.className,color:\"#167\"},{tag:[p.special(p.variableName),p.macroName],color:\"#256\"},{tag:p.definition(p.propertyName),color:\"#00c\"},{tag:p.comment,color:\"#940\"},{tag:p.invalid,color:\"#f00\"}]),Fx=T.baseTheme({\"&.cm-focused .cm-matchingBracket\":{backgroundColor:\"#328c8252\"},\"&.cm-focused .cm-nonmatchingBracket\":{backgroundColor:\"#bb555544\"}}),Op=1e4,xp=\"()[]{}\",yp=A.define({combine(i){return kt(i,{afterCursor:!0,brackets:xp,maxScanDistance:Op,renderMatch:Hx})}}),_x=R.mark({class:\"cm-matchingBracket\"}),Gx=R.mark({class:\"cm-nonmatchingBracket\"});function Hx(i){let t=[],e=i.matched?_x:Gx;return t.push(e.range(i.start.from,i.start.to)),i.end&&t.push(e.range(i.end.from,i.end.to)),t}var Ux=it.define({create(){return R.none},update(i,t){if(!t.docChanged&&!t.selection)return i;let e=[],r=t.state.facet(yp);for(let n of t.state.selection.ranges){if(!n.empty)continue;let s=oe(t.state,n.head,-1,r)||n.head>0&&oe(t.state,n.head-1,1,r)||r.afterCursor&&(oe(t.state,n.head,1,r)||n.headT.decorations.from(i)}),jx=[Ux,Fx];function io(i={}){return[yp.of(i),jx]}var Kx=new E;function nh(i,t,e){let r=i.prop(t<0?E.openedBy:E.closedBy);if(r)return r;if(i.name.length==1){let n=e.indexOf(i.name);if(n>-1&&n%2==(t<0?1:0))return[e[n+t]]}return null}function sh(i){let t=i.type.prop(Kx);return t?t(i.node):i}function oe(i,t,e,r={}){let n=r.maxScanDistance||Op,s=r.brackets||xp,o=pt(i),l=o.resolveInner(t,e);for(let a=l;a;a=a.parent){let h=nh(a.type,e,s);if(h&&a.from0?t>=f.from&&tf.from&&t<=f.to))return Jx(i,t,e,a,f,h,s)}}return t1(i,t,e,o,l.type,n,s)}function Jx(i,t,e,r,n,s,o){let l=r.parent,a={from:n.from,to:n.to},h=0,f=l?.cursor();if(f&&(e<0?f.childBefore(r.from):f.childAfter(r.to)))do if(e<0?f.to<=r.from:f.from>=r.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:e<0?t-1:t,to:e>0?t+1:t},f=i.doc.iterRange(t,e>0?i.doc.length:0),c=0;for(let u=0;!f.next().done&&u<=s;){let d=f.value;e<0&&(u+=d.length);let m=t+u*e;for(let O=e>0?0:d.length-1,g=e>0?d.length:-1;O!=g;O+=e){let x=o.indexOf(d[O]);if(!(x<0||r.resolveInner(m+O,1).type!=n))if(x%2==0==e>0)c++;else{if(c==1)return{start:h,end:{from:m+O,to:m+O+1},matched:x>>1==a>>1};c--}}e>0&&(u+=d.length)}return f.done?{start:h,matched:!1}:null}var e1=Object.create(null),ip=[bt.none];var rp=[],np=Object.create(null),i1=Object.create(null);for(let[i,t]of[[\"variable\",\"variableName\"],[\"variable-2\",\"variableName.special\"],[\"string-2\",\"string.special\"],[\"def\",\"variableName.definition\"],[\"tag\",\"tagName\"],[\"attribute\",\"attributeName\"],[\"type\",\"typeName\"],[\"builtin\",\"variableName.standard\"],[\"qualifier\",\"modifier\"],[\"error\",\"invalid\"],[\"header\",\"heading\"],[\"property\",\"propertyName\"]])i1[i]=r1(e1,t);function ja(i,t){rp.indexOf(i)>-1||(rp.push(i),console.warn(t))}function r1(i,t){let e=[];for(let l of t.split(\" \")){let a=[];for(let h of l.split(\".\")){let f=i[h]||p[h];f?typeof f==\"function\"?a.length?a=a.map(f):ja(h,`Modifier ${h} used at start of tag`):a.length?ja(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:ja(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let r=t.replace(/ /g,\"_\"),n=r+\" \"+e.map(l=>l.id),s=np[n];if(s)return s.id;let o=np[n]=bt.define({id:ip.length,name:r,props:[Hs({[r]:e})]});return ip.push(o),o.id}var Fw={rtl:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"rtl\"},bidiIsolate:G.RTL}),ltr:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"ltr\"},bidiIsolate:G.LTR}),auto:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"auto\"},bidiIsolate:null})};var no=class{constructor(t,e,r){this.state=t,this.pos=e,this.explicit=r,this.abortListeners=[]}tokenBefore(t){let e=pt(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),r=Math.max(e.from,this.pos-250),n=e.text.slice(r-e.from,this.pos-e.from),s=n.search(Qp(t,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,e){t==\"abort\"&&this.abortListeners&&this.abortListeners.push(e)}};function bp(i){let t=Object.keys(i).join(\"\"),e=/\\w/.test(t);return e&&(t=t.replace(/\\w/g,\"\")),`[${e?\"\\\\w\":\"\"}${t.replace(/[^\\w\\s]/g,\"\\\\$&\")}]`}function n1(i){let t=Object.create(null),e=Object.create(null);for(let{label:n}of i){t[n[0]]=!0;for(let s=1;stypeof n==\"string\"?{label:n}:n),[e,r]=t.every(n=>/^\\w+$/.test(n.label))?[/\\w*$/,/\\w+$/]:n1(t);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:t,validFor:e}:null}}function Ap(i,t){return e=>{for(let r=pt(e.state).resolveInner(e.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(e)}}var so=class{constructor(t,e,r,n){this.completion=t,this.source=e,this.match=r,this.score=n}};function Ue(i){return i.selection.main.from}function Qp(i,t){var e;let{source:r}=i,n=t&&r[0]!=\"^\",s=r[r.length-1]!=\"$\";return!n&&!s?i:new RegExp(`${n?\"^\":\"\"}(?:${r})${s?\"$\":\"\"}`,(e=i.flags)!==null&&e!==void 0?e:i.ignoreCase?\"i\":\"\")}var Rp=Et.define();function s1(i,t,e,r){let{main:n}=i.selection,s=e-n.from,o=r-n.from;return Object.assign(Object.assign({},i.changeByRange(l=>l!=n&&e!=r&&i.sliceDoc(l.from+s,l.from+o)!=i.sliceDoc(e,r)?{range:l}:{changes:{from:l.from+s,to:r==n.from?l.to:l.from+o,insert:t},range:b.cursor(l.from+s+t.length)})),{scrollIntoView:!0,userEvent:\"input.complete\"})}var Sp=new WeakMap;function o1(i){if(!Array.isArray(i))return i;let t=Sp.get(i);return t||Sp.set(i,t=wh(i)),t}var oo=M.define(),sn=M.define(),dh=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&y<=57||y>=97&&y<=122?2:y>=65&&y<=90?1:0:(k=vr(y))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!S||w==1&&g||v==0&&w!=0)&&(e[c]==y||r[c]==y&&(u=!0)?o[c++]=S:o.length&&(x=!1)),v=w,S+=wt(y)}return c==a&&o[0]==0&&x?this.result(-100+(u?-200:0),o,t):d==a&&m==0?this.ret(-200-t.length+(O==t.length?0:-100),[0,O]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):d==a?this.ret(-900-t.length,[m,O]):c==a?this.result(-100+(u?-200:0)+-700+(x?0:-1100),o,t):e.length==2?!1:this.result((n[0]?-700:0)+-200+-1100,n,t)}result(t,e,r){let n=[],s=0;for(let o of e){let l=o+(this.astral?wt(dt(r,o)):1);s&&n[s-1]==o?n[s-1]=l:(n[s++]=o,n[s++]=l)}return this.ret(t-r.length,n)}},gt=A.define({combine(i){return kt(i,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>\"\",optionClass:()=>\"\",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:l1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>r=>wp(t(r),e(r)),optionClass:(t,e)=>r=>wp(t(r),e(r)),addToOptions:(t,e)=>t.concat(e)})}});function wp(i,t){return i?t?i+\" \"+t:i:t}function l1(i,t,e,r,n,s){let o=i.textDirection==G.RTL,l=o,a=!1,h=\"top\",f,c,u=t.left-n.left,d=n.right-t.right,m=r.right-r.left,O=r.bottom-r.top;if(l&&u=O||S>t.top?f=e.bottom-t.top:(h=\"bottom\",f=t.bottom-e.top)}let g=(t.bottom-t.top)/s.offsetHeight,x=(t.right-t.left)/s.offsetWidth;return{style:`${h}: ${f/g}px; max-width: ${c/x}px`,class:\"cm-completionInfo-\"+(a?o?\"left-narrow\":\"right-narrow\":l?\"left\":\"right\")}}function a1(i){let t=i.addToOptions.slice();return i.icons&&t.push({render(e){let r=document.createElement(\"div\");return r.classList.add(\"cm-completionIcon\"),e.type&&r.classList.add(...e.type.split(/\\s+/g).map(n=>\"cm-completionIcon-\"+n)),r.setAttribute(\"aria-hidden\",\"true\"),r},position:20}),t.push({render(e,r,n,s){let o=document.createElement(\"span\");o.className=\"cm-completionLabel\";let l=e.displayLabel||e.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,f)));let u=o.appendChild(document.createElement(\"span\"));u.appendChild(document.createTextNode(l.slice(f,c))),u.className=\"cm-completionMatchedText\",a=c}return ae.position-r.position).map(e=>e.render)}function ch(i,t,e){if(i<=e)return{from:0,to:i};if(t<0&&(t=0),t<=i>>1){let n=Math.floor(t/e);return{from:n*e,to:(n+1)*e}}let r=Math.floor((i-t)/e);return{from:i-(r+1)*e,to:i-r*e}}var ph=class{constructor(t,e,r){this.view=t,this.stateField=e,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass=\"\";let n=t.state.field(e),{options:s,selected:o}=n.open,l=t.state.facet(gt);this.optionContent=a1(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ch(s.length,o,l.maxRenderedOptions),this.dom=document.createElement(\"div\"),this.dom.className=\"cm-tooltip-autocomplete\",this.updateTooltipClass(t.state),this.dom.addEventListener(\"mousedown\",a=>{let{options:h}=t.state.field(e).open;for(let f=a.target,c;f&&f!=this.dom;f=f.parentNode)if(f.nodeName==\"LI\"&&(c=/-(\\d+)$/.exec(f.id))&&+c[1]{let h=t.state.field(this.stateField,!1);h&&h.tooltip&&t.state.facet(gt).closeOnBlur&&a.relatedTarget!=t.contentDOM&&t.dispatch({effects:sn.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener(\"scroll\",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let r=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=n){let{options:s,selected:o,disabled:l}=r.open;(!n.open||n.open.options!=s)&&(this.range=ch(s.length,o,t.state.facet(gt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((e=n.open)===null||e===void 0?void 0:e.disabled)&&this.dom.classList.toggle(\"cm-tooltip-autocomplete-disabled\",!!l)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let r of this.currentClass.split(\" \"))r&&this.dom.classList.remove(r);for(let r of e.split(\" \"))r&&this.dom.classList.add(r);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ch(e.options.length,e.selected,this.view.state.facet(gt).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:r}=e.options[e.selected],{info:n}=r;if(!n)return;let s=typeof n==\"string\"?document.createTextNode(n):n(r);if(!s)return;\"then\"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,r)}).catch(o=>Ct(this.view.state,o,\"completion info\")):this.addInfoPane(s,r)}}addInfoPane(t,e){this.destroyInfo();let r=this.info=document.createElement(\"div\");if(r.className=\"cm-tooltip cm-completionInfo\",t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:n,destroy:s}=t;r.appendChild(n),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!=\"LI\"||!r.id?n--:n==t?r.hasAttribute(\"aria-selected\")||(r.setAttribute(\"aria-selected\",\"true\"),e=r):r.hasAttribute(\"aria-selected\")&&r.removeAttribute(\"aria-selected\");return e&&f1(this.list,e),e}measureInfo(){let t=this.dom.querySelector(\"[aria-selected]\");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomr.from||r.from==0))if(s=u,typeof h!=\"string\"&&h.header)n.appendChild(h.header(h));else{let d=n.appendChild(document.createElement(\"completion-section\"));d.textContent=u}}let f=n.appendChild(document.createElement(\"li\"));f.id=e+\"-\"+o,f.setAttribute(\"role\",\"option\");let c=this.optionClass(l);c&&(f.className=c);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&f.appendChild(d)}}return r.from&&n.classList.add(\"cm-completionListIncompleteTop\"),r.tonew ph(e,i,t)}function f1(i,t){let e=i.getBoundingClientRect(),r=t.getBoundingClientRect(),n=e.height/i.offsetHeight;r.tope.bottom&&(i.scrollTop+=(r.bottom-e.bottom)/n)}function vp(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function c1(i,t){let e=[],r=null,n=a=>{e.push(a);let{section:h}=a.completion;if(h){r||(r=[]);let f=typeof h==\"string\"?h:h.name;r.some(c=>c.name==f)||r.push(typeof h==\"string\"?{name:f}:h)}};for(let a of i)if(a.hasResult()){let h=a.result.getMatch;if(a.result.filter===!1)for(let f of a.result.options)n(new so(f,a.source,h?h(f):[],1e9-e.length));else{let f=new dh(t.sliceDoc(a.from,a.to));for(let c of a.result.options)if(f.match(c.label)){let u=c.displayLabel?h?h(c,f.matched):[]:f.matched;n(new so(c,a.source,u,f.score+(c.boost||0)))}}}if(r){let a=Object.create(null),h=0,f=(c,u)=>{var d,m;return((d=c.rank)!==null&&d!==void 0?d:1e9)-((m=u.rank)!==null&&m!==void 0?m:1e9)||(c.namef.score-h.score||l(h.completion,f.completion))){let h=a.completion;!o||o.label!=h.label||o.detail!=h.detail||o.type!=null&&h.type!=null&&o.type!=h.type||o.apply!=h.apply||o.boost!=h.boost?s.push(a):vp(a.completion)>vp(o)&&(s[s.length-1]=a),o=a.completion}return s}var mh=class i{constructor(t,e,r,n,s,o){this.options=t,this.attrs=e,this.tooltip=r,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new i(this.options,kp(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,r,n,s){let o=c1(t,e);if(!o.length)return n&&t.some(a=>a.state==1)?new i(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let l=e.facet(gt).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let a=n.options[n.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:g1,above:s.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(t){return new i(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},gh=class i{constructor(t,e,r){this.active=t,this.id=e,this.open=r}static start(){return new i(p1,\"cm-ac-\"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,r=e.facet(gt),s=(r.override||e.languageDataAt(\"autocomplete\",Ue(e)).map(o1)).map(l=>(this.active.find(h=>h.source==l)||new De(l,this.active.some(h=>h.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&t.docChanged&&(o=o.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!u1(s,this.active)?o=mh.build(s,e,this.id,o,r):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new De(l.source,0):l));for(let l of t.effects)l.is(Ep)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new i(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:d1}};function u1(i,t){if(i==t)return!0;for(let e=0,r=0;;){for(;e-1&&(e[\"aria-activedescendant\"]=i+\"-\"+t),e}var p1=[];function Oh(i){return i.isUserEvent(\"input.type\")?\"input\":i.isUserEvent(\"delete.backward\")?\"delete\":null}var De=class i{constructor(t,e,r=-1){this.source=t,this.state=e,this.explicitPos=r}hasResult(){return!1}update(t,e){let r=Oh(t),n=this;r?n=n.handleUserEvent(t,r,e):t.docChanged?n=n.handleChange(t):t.selection&&n.state!=0&&(n=new i(n.source,0));for(let s of t.effects)if(s.is(oo))n=new i(n.source,1,s.value?Ue(t.state):-1);else if(s.is(sn))n=new i(n.source,0);else if(s.is(Mp))for(let o of s.value)o.source==n.source&&(n=o);return n}handleUserEvent(t,e,r){return e==\"delete\"||!r.activateOnTyping?this.map(t.changes):new i(this.source,1)}handleChange(t){return t.changes.touchesRange(Ue(t.startState))?new i(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new i(this.source,this.state,t.mapPos(this.explicitPos))}},lo=class i extends De{constructor(t,e,r,n,s){super(t,2,e),this.result=r,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,r){var n;let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=Ue(t.state);if((this.explicitPos<0?l<=s:lo||e==\"delete\"&&Ue(t.startState)==this.from)return new De(this.source,e==\"input\"&&r.activateOnTyping?1:0);let a=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos),h;return m1(this.result.validFor,t.state,s,o)?new i(this.source,a,this.result,s,o):this.result.update&&(h=this.result.update(this.result,s,o,new no(t.state,l,a>=0)))?new i(this.source,a,h,h.from,(n=h.to)!==null&&n!==void 0?n:Ue(t.state)):new De(this.source,1,a)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new De(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new i(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}};function m1(i,t,e,r){if(!i)return!1;let n=t.sliceDoc(e,r);return typeof i==\"function\"?i(n,e,r,t):Qp(i,!0).test(n)}var Mp=M.define({map(i,t){return i.map(e=>e.map(t))}}),Ep=M.define(),It=it.define({create(){return gh.start()},update(i,t){return i.update(t)},provide:i=>[Fr.from(i,t=>t.tooltip),T.contentAttributes.from(i,t=>t.attrs)]});function $p(i,t){let e=t.completion.apply||t.completion.label,r=i.state.field(It).active.find(n=>n.source==t.source);return r instanceof lo?(typeof e==\"string\"?i.dispatch(Object.assign(Object.assign({},s1(i.state,e,r.from,r.to)),{annotations:Rp.of(t.completion)})):e(i,t.completion,r.from,r.to),!0):!1}var g1=h1(It,$p);function ro(i,t=\"option\"){return e=>{let r=e.state.field(It,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+n*(i?1:-1):i?0:o-1;return l<0?l=t==\"page\"?0:o-1:l>=o&&(l=t==\"page\"?o-1:0),e.dispatch({effects:Ep.of(l)}),!0}}var O1=i=>{let t=i.state.field(It,!1);return i.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampi.state.field(It,!1)?(i.dispatch({effects:oo.of(!0)}),!0):!1,y1=i=>{let t=i.state.field(It,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(i.dispatch({effects:sn.of(null)}),!0)},xh=class{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}},b1=50,S1=1e3,w1=ft.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of i.state.field(It).active)t.state==1&&this.startQuery(t)}update(i){let t=i.state.field(It);if(!i.selectionSet&&!i.docChanged&&i.startState.field(It)==t)return;let e=i.transactions.some(n=>(n.selection||n.docChanged)&&!Oh(n));for(let n=0;nb1&&Date.now()-s.time>S1){for(let o of s.context.abortListeners)try{o()}catch(l){Ct(this.view.state,l)}s.context.abortListeners=null,this.running.splice(n--,1)}else s.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(n=>n.effects.some(s=>s.is(oo)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.state.facet(gt).activateOnTypingDelay;if(this.debounceUpdate=t.active.some(n=>n.state==1&&!this.running.some(s=>s.active.source==n.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let n of i.transactions)Oh(n)==\"input\"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,t=i.field(It);for(let e of t.active)e.state==1&&!this.running.some(r=>r.active.source==e.source)&&this.startQuery(e)}startQuery(i){let{state:t}=this.view,e=Ue(t),r=new no(t,e,i.explicitPos==e),n=new xh(i,r);this.running.push(n),Promise.resolve(i.source(r)).then(s=>{n.context.aborted||(n.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:sn.of(null)}),Ct(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gt).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(gt);for(let r=0;ro.source==n.active.source);if(s&&s.state==1)if(n.done==null){let o=new De(n.active.source,0);for(let l of n.updates)o=o.update(l,e);o.state!=1&&t.push(o)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:Mp.of(t)})}},{eventHandlers:{blur(i){let t=this.view.state.field(It,!1);if(t&&t.tooltip&&this.view.state.facet(gt).closeOnBlur){let e=t.open&&Ba(this.view,t.open.tooltip);(!e||!e.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:sn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:oo.of(!1)}),20),this.composing=0}}}),qp=T.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:\"400px\",boxSizing:\"border-box\"},\".cm-completionInfo.cm-completionInfo-left\":{right:\"100%\"},\".cm-completionInfo.cm-completionInfo-right\":{left:\"100%\"},\".cm-completionInfo.cm-completionInfo-left-narrow\":{right:\"30px\"},\".cm-completionInfo.cm-completionInfo-right-narrow\":{left:\"30px\"},\"&light .cm-snippetField\":{backgroundColor:\"#00000022\"},\"&dark .cm-snippetField\":{backgroundColor:\"#ffffff22\"},\".cm-snippetFieldPosition\":{verticalAlign:\"text-top\",width:0,height:\"1.15em\",display:\"inline-block\",margin:\"0 -0.7px -.7em\",borderLeft:\"1.4px dotted #888\"},\".cm-completionMatchedText\":{textDecoration:\"underline\"},\".cm-completionDetail\":{marginLeft:\"0.5em\",fontStyle:\"italic\"},\".cm-completionIcon\":{fontSize:\"90%\",width:\".8em\",display:\"inline-block\",textAlign:\"center\",paddingRight:\".6em\",opacity:\"0.6\",boxSizing:\"content-box\"},\".cm-completionIcon-function, .cm-completionIcon-method\":{\"&:after\":{content:\"'\\u0192'\"}},\".cm-completionIcon-class\":{\"&:after\":{content:\"'\\u25CB'\"}},\".cm-completionIcon-interface\":{\"&:after\":{content:\"'\\u25CC'\"}},\".cm-completionIcon-variable\":{\"&:after\":{content:\"'\\u{1D465}'\"}},\".cm-completionIcon-constant\":{\"&:after\":{content:\"'\\u{1D436}'\"}},\".cm-completionIcon-type\":{\"&:after\":{content:\"'\\u{1D461}'\"}},\".cm-completionIcon-enum\":{\"&:after\":{content:\"'\\u222A'\"}},\".cm-completionIcon-property\":{\"&:after\":{content:\"'\\u25A1'\"}},\".cm-completionIcon-keyword\":{\"&:after\":{content:\"'\\u{1F511}\\uFE0E'\"}},\".cm-completionIcon-namespace\":{\"&:after\":{content:\"'\\u25A2'\"}},\".cm-completionIcon-text\":{\"&:after\":{content:\"'abc'\",fontSize:\"50%\",verticalAlign:\"middle\"}}}),yh=class{constructor(t,e,r,n){this.field=t,this.line=e,this.from=r,this.to=n}},bh=class i{constructor(t,e,r){this.field=t,this.from=e,this.to=r}map(t){let e=t.mapPos(this.from,-1,ut.TrackDel),r=t.mapPos(this.to,1,ut.TrackDel);return e==null||r==null?null:new i(this.field,e,r)}},Sh=class i{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let r=[],n=[e],s=t.doc.lineAt(e),o=/^\\s*/.exec(s.text)[0];for(let a of this.lines){if(r.length){let h=o,f=/^\\t*/.exec(a)[0].length;for(let c=0;cnew bh(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:r,ranges:l}}static parse(t){let e=[],r=[],n=[],s;for(let o of t.split(/\\r\\n?|\\n/)){for(;s=/[#$]\\{(?:(\\d+)(?::([^}]*))?|([^}]*))\\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||\"\",h=-1;for(let f=0;f=h&&c.field++}n.push(new yh(h,r.length,s.index,s.index+a.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}for(let l;l=/\\\\([{}])/.exec(o);){o=o.slice(0,l.index)+l[1]+o.slice(l.index+l[0].length);for(let a of n)a.line==r.length&&a.from>l.index&&(a.from--,a.to--)}r.push(o)}return new i(r,n)}},v1=R.widget({widget:new class extends Ut{toDOM(){let i=document.createElement(\"span\");return i.className=\"cm-snippetFieldPosition\",i}ignoreEvent(){return!1}}}),k1=R.mark({class:\"cm-snippetField\"}),ji=class i{constructor(t,e){this.ranges=t,this.active=e,this.deco=R.set(t.map(r=>(r.from==r.to?v1:k1).range(r.from,r.to)))}map(t){let e=[];for(let r of this.ranges){let n=r.map(t);if(!n)return null;e.push(n)}return new i(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(r=>r.field==this.active&&r.from<=e.from&&r.to>=e.to))}},an=M.define({map(i,t){return i&&i.map(t)}}),T1=M.define(),on=it.define({create(){return null},update(i,t){for(let e of t.effects){if(e.is(an))return e.value;if(e.is(T1)&&i)return new ji(i.ranges,e.value)}return i&&t.docChanged&&(i=i.map(t.changes)),i&&t.selection&&!i.selectionInsideField(t.selection)&&(i=null),i},provide:i=>T.decorations.from(i,t=>t?t.deco:R.none)});function vh(i,t){return b.create(i.filter(e=>e.field==t).map(e=>b.range(e.from,e.to)))}function P1(i){let t=Sh.parse(i);return(e,r,n,s)=>{let{text:o,ranges:l}=t.instantiate(e.state,n),a={changes:{from:n,to:s,insert:V.of(o)},scrollIntoView:!0,annotations:r?[Rp.of(r),lt.userEvent.of(\"input.complete\")]:void 0};if(l.length&&(a.selection=vh(l,0)),l.some(h=>h.field>0)){let h=new ji(l,0),f=a.effects=[an.of(h)];e.state.field(on,!1)===void 0&&f.push(M.appendConfig.of([on,M1,E1,qp]))}e.dispatch(e.state.update(a))}}function Dp(i){return({state:t,dispatch:e})=>{let r=t.field(on,!1);if(!r||i<0&&r.active==0)return!1;let n=r.active+i,s=i>0&&!r.ranges.some(o=>o.field==n+i);return e(t.update({selection:vh(r.ranges,n),effects:an.of(s?null:new ji(r.ranges,n)),scrollIntoView:!0})),!0}}var C1=({state:i,dispatch:t})=>i.field(on,!1)?(t(i.update({effects:an.of(null)})),!0):!1,A1=Dp(1),Q1=Dp(-1);var R1=[{key:\"Tab\",run:A1,shift:Q1},{key:\"Escape\",run:C1}],Tp=A.define({combine(i){return i.length?i[0]:R1}}),M1=ie.highest(Fe.compute([Tp],i=>i.facet(Tp)));function Pe(i,t){return Object.assign(Object.assign({},t),{apply:P1(i)})}var E1=T.domEventHandlers({mousedown(i,t){let e=t.state.field(on,!1),r;if(!e||(r=t.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let n=e.ranges.find(s=>s.from<=r&&s.to>=r);return!n||n.field==e.active?!1:(t.dispatch({selection:vh(e.ranges,n.field),effects:an.of(e.ranges.some(s=>s.field>n.field)?new ji(e.ranges,n.field):null),scrollIntoView:!0}),!0)}});var ln={brackets:[\"(\",\"[\",\"{\",\"'\",'\"'],before:\")]}:;>\",stringPrefixes:[]},Oi=M.define({map(i,t){let e=t.mapPos(i,-1,ut.TrackAfter);return e??void 0}}),kh=new class extends ee{};kh.startSide=1;kh.endSide=-1;var Bp=it.define({create(){return _.empty},update(i,t){if(i=i.map(t.changes),t.selection){let e=t.state.doc.lineAt(t.selection.main.head);i=i.update({filter:r=>r>=e.from&&r<=e.to})}for(let e of t.effects)e.is(Oi)&&(i=i.update({add:[kh.range(e.value,e.value+1)]}));return i}});function ao(){return[q1,Bp]}var uh=\"()[]{}<>\";function Xp(i){for(let t=0;t{if(($1?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let n=i.state.selection.main;if(r.length>2||r.length==2&&wt(dt(r,0))==1||t!=n.from||e!=n.to)return!1;let s=B1(i.state,r);return s?(i.dispatch(s),!0):!1}),D1=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let r=Lp(i,i.selection.main.head).brackets||ln.brackets,n=null,s=i.changeByRange(o=>{if(o.empty){let l=X1(i.doc,o.head);for(let a of r)if(a==l&&fo(i.doc,o.head)==Xp(dt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:n=o}});return n||t(i.update(s,{scrollIntoView:!0,userEvent:\"delete.backward\"})),!n},ho=[{key:\"Backspace\",run:D1}];function B1(i,t){let e=Lp(i,i.selection.main.head),r=e.brackets||ln.brackets;for(let n of r){let s=Xp(dt(n,0));if(t==n)return s==n?W1(i,n,r.indexOf(n+n+n)>-1,e):L1(i,n,s,e.before||ln.before);if(t==s&&Vp(i,i.selection.main.from))return V1(i,n,s)}return null}function Vp(i,t){let e=!1;return i.field(Bp).between(0,i.doc.length,r=>{r==t&&(e=!0)}),e}function fo(i,t){let e=i.sliceString(t,t+2);return e.slice(0,wt(dt(e,0)))}function X1(i,t){let e=i.sliceString(t-2,t);return wt(dt(e,0))==e.length?e:e.slice(1)}function L1(i,t,e,r){let n=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:e,from:o.to}],effects:Oi.of(o.to+t.length),range:b.range(o.anchor+t.length,o.head+t.length)};let l=fo(i.doc,o.head);return!l||/\\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+e,from:o.head},effects:Oi.of(o.head+t.length),range:b.cursor(o.head+t.length)}:{range:n=o}});return n?null:i.update(s,{scrollIntoView:!0,userEvent:\"input.type\"})}function V1(i,t,e){let r=null,n=i.changeByRange(s=>s.empty&&fo(i.doc,s.head)==e?{changes:{from:s.head,to:s.head+e.length,insert:e},range:b.cursor(s.head+e.length)}:r={range:s});return r?null:i.update(n,{scrollIntoView:!0,userEvent:\"input.type\"})}function W1(i,t,e,r){let n=r.stringPrefixes||ln.stringPrefixes,s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Oi.of(l.to+t.length),range:b.range(l.anchor+t.length,l.head+t.length)};let a=l.head,h=fo(i.doc,a),f;if(h==t){if(Pp(i,a))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(Vp(i,a)){let u=e&&i.sliceDoc(a,a+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(e&&i.sliceDoc(a-2*t.length,a)==t+t&&(f=Cp(i,a-2*t.length,n))>-1&&Pp(i,f))return{changes:{insert:t+t+t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(i.charCategorizer(a)(h)!=F.Word&&Cp(i,a,n)>-1&&!I1(i,a,t,n))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)}}return{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:\"input.type\"})}function Pp(i,t){let e=pt(i).resolveInner(t+1);return e.parent&&e.from==t}function I1(i,t,e,r){let n=pt(i).resolveInner(t,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(n.from,Math.min(n.to,n.from+e.length+s)),a=l.indexOf(e);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let f=n.firstChild;for(;f&&f.from==n.from&&f.to-f.from>e.length+a;){if(i.sliceDoc(f.to-e.length,f.to)==e)return!1;f=f.firstChild}return!0}let h=n.to==t&&n.parent;if(!h)break;n=h}return!1}function Cp(i,t,e){let r=i.charCategorizer(t);if(r(i.sliceDoc(t-1,t))!=F.Word)return t;for(let n of e){let s=t-n.length;if(i.sliceDoc(s,t)==n&&r(i.sliceDoc(s-1,s))!=F.Word)return s}return-1}function co(i={}){return[It,gt.of(i),w1,N1,qp]}var hn=[{key:\"Ctrl-Space\",run:x1},{key:\"Escape\",run:y1},{key:\"ArrowDown\",run:ro(!0)},{key:\"ArrowUp\",run:ro(!1)},{key:\"PageDown\",run:ro(!0,\"page\")},{key:\"PageUp\",run:ro(!1,\"page\")},{key:\"Enter\",run:O1}],N1=ie.highest(Fe.computeN([gt],i=>i.facet(gt).defaultKeymap?[hn]:[]));var Y1=i=>{let{state:t}=i,e=t.doc.lineAt(t.selection.main.from),r=Mh(i.state,e.from);return r.line?z1(i):r.block?F1(i):!1};function Rh(i,t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=i(t,e);return n?(r(e.update(n)),!0):!1}}var z1=Rh(H1,0);var Z1=Rh(_p,0);var F1=Rh((i,t)=>_p(i,t,G1(t)),0);function Mh(i,t){let e=i.languageDataAt(\"commentTokens\",t);return e.length?e[0]:{}}var fn=50;function _1(i,{open:t,close:e},r,n){let s=i.sliceDoc(r-fn,r),o=i.sliceDoc(n,n+fn),l=/\\s*$/.exec(s)[0].length,a=/^\\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-t.length,h)==t&&o.slice(a,a+e.length)==e)return{open:{pos:r-l,margin:l&&1},close:{pos:n+a,margin:a&&1}};let f,c;n-r<=2*fn?f=c=i.sliceDoc(r,n):(f=i.sliceDoc(r,r+fn),c=i.sliceDoc(n-fn,n));let u=/^\\s*/.exec(f)[0].length,d=/\\s*$/.exec(c)[0].length,m=c.length-d-e.length;return f.slice(u,u+t.length)==t&&c.slice(m,m+e.length)==e?{open:{pos:r+u+t.length,margin:/\\s/.test(f.charAt(u+t.length))?1:0},close:{pos:n-d-e.length,margin:/\\s/.test(c.charAt(m-1))?1:0}}:null}function G1(i){let t=[];for(let e of i.selection.ranges){let r=i.doc.lineAt(e.from),n=e.to<=r.to?r:i.doc.lineAt(e.to),s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=n.to:t.push({from:r.from+/^\\s*/.exec(r.text)[0].length,to:n.to})}return t}function _p(i,t,e=t.selection.ranges){let r=e.map(s=>Mh(t,s.from).block);if(!r.every(s=>s))return null;let n=e.map((s,o)=>_1(t,r[o],s.from,s.to));if(i!=2&&!n.every(s=>s))return{changes:t.changes(e.map((s,o)=>n[o]?[]:[{from:s.from,insert:r[o].open+\" \"},{from:s.to,insert:\" \"+r[o].close}]))};if(i!=1&&n.some(s=>s)){let s=[];for(let o=0,l;on&&(s==o||o>c.from)){n=c.from;let u=/^\\s*/.exec(c.text)[0].length,d=u==c.length,m=c.text.slice(u,u+h.length)==h?u:-1;us.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:f,single:c}of r)(c||!f)&&s.push({from:l.from+h,insert:a+\" \"});let o=t.changes(s);return{changes:o,selection:t.selection.map(o,1)}}else if(i!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let h=o.from+l,f=h+a.length;o.text[f-o.from]==\" \"&&f++,s.push({from:h,to:f})}return{changes:s}}return null}var Ph=Et.define(),U1=Et.define(),j1=A.define(),Gp=A.define({combine(i){return kt(i,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(r,n)=>t(r,n)||e(r,n)})}}),Hp=it.define({create(){return xi.empty},update(i,t){let e=t.state.facet(Gp),r=t.annotation(Ph);if(r){let a=le.fromTransaction(t,r.selection),h=r.side,f=h==0?i.undone:i.done;return a?f=po(f,f.length,e.minDepth,a):f=Kp(f,t.startState.selection),new xi(h==0?r.rest:f,h==0?f:r.rest)}let n=t.annotation(U1);if((n==\"full\"||n==\"before\")&&(i=i.isolate()),t.annotation(lt.addToHistory)===!1)return t.changes.empty?i:i.addMapping(t.changes.desc);let s=le.fromTransaction(t),o=t.annotation(lt.time),l=t.annotation(lt.userEvent);return s?i=i.addChanges(s,o,l,e,t):t.selection&&(i=i.addSelection(t.startState.selection,o,l,e.newGroupDelay)),(n==\"full\"||n==\"after\")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(t=>t.toJSON()),undone:i.undone.map(t=>t.toJSON())}},fromJSON(i){return new xi(i.done.map(le.fromJSON),i.undone.map(le.fromJSON))}});function mo(i={}){return[Hp,Gp.of(i),T.domEventHandlers({beforeinput(t,e){let r=t.inputType==\"historyUndo\"?Up:t.inputType==\"historyRedo\"?Ch:null;return r?(t.preventDefault(),r(e)):!1}})]}function go(i,t){return function({state:e,dispatch:r}){if(!t&&e.readOnly)return!1;let n=e.field(Hp,!1);if(!n)return!1;let s=n.pop(i,e,t);return s?(r(s),!0):!1}}var Up=go(0,!1),Ch=go(1,!1),K1=go(0,!0),J1=go(1,!0);var le=class i{constructor(t,e,r,n,s){this.changes=t,this.effects=e,this.mapped=r,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new i(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(t){return new i(t.changes&&vt.fromJSON(t.changes),[],t.mapped&&Me.fromJSON(t.mapped),t.startSelection&&b.fromJSON(t.startSelection),t.selectionsAfter.map(b.fromJSON))}static fromTransaction(t,e){let r=Kt;for(let n of t.startState.facet(j1)){let s=n(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new i(t.changes.invert(t.startState.doc),r,void 0,e||t.startState.selection,Kt)}static selection(t){return new i(void 0,Kt,void 0,void 0,t)}};function po(i,t,e,r){let n=t+1>e+20?t-e-1:0,s=i.slice(n,t);return s.push(r),s}function ty(i,t){let e=[],r=!1;return i.iterChangedRanges((n,s)=>e.push(n,s)),t.iterChangedRanges((n,s,o,l)=>{for(let a=0;a=h&&o<=f&&(r=!0)}}),r}function ey(i,t){return i.ranges.length==t.ranges.length&&i.ranges.filter((e,r)=>e.empty!=t.ranges[r].empty).length===0}function jp(i,t){return i.length?t.length?i.concat(t):i:t}var Kt=[],iy=200;function Kp(i,t){if(i.length){let e=i[i.length-1],r=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-iy));return r.length&&r[r.length-1].eq(t)?i:(r.push(t),po(i,i.length-1,1e9,e.setSelAfter(r)))}else return[le.selection([t])]}function ry(i){let t=i[i.length-1],e=i.slice();return e[i.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function Th(i,t){if(!i.length)return i;let e=i.length,r=Kt;for(;e;){let n=ny(i[e-1],t,r);if(n.changes&&!n.changes.empty||n.effects.length){let s=i.slice(0,e);return s[e-1]=n,s}else t=n.mapped,e--,r=n.selectionsAfter}return r.length?[le.selection(r)]:Kt}function ny(i,t,e){let r=jp(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(t)):Kt,e);if(!i.changes)return le.selection(r);let n=i.changes.map(t),s=t.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new le(n,M.mapEffects(i.effects,t),o,i.startSelection.map(s),r)}var sy=/^(input\\.type|delete)($|\\.)/,xi=class i{constructor(t,e,r=0,n=void 0){this.done=t,this.undone=e,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(t,e,r,n,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||sy.test(r))&&(!l.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee.empty?i.moveByChar(e,t):xo(e,t))}function St(i){return i.textDirectionAt(i.state.selection.main.head)==G.LTR}var tm=i=>Jp(i,!St(i)),em=i=>Jp(i,St(i));function im(i,t){return ae(i,e=>e.empty?i.moveByGroup(e,t):xo(e,t))}var oy=i=>im(i,!St(i)),ly=i=>im(i,St(i));var lv=typeof Intl<\"u\"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:\"word\"}):null;function ay(i,t,e){if(t.type.prop(e))return!0;let r=t.to-t.from;return r&&(r>2||/[^\\s,.;:]/.test(i.sliceDoc(t.from,t.to)))||t.firstChild}function yo(i,t,e){let r=pt(i).resolveInner(t.head),n=e?E.closedBy:E.openedBy;for(let a=t.head;;){let h=e?r.childAfter(a):r.childBefore(a);if(!h)break;ay(i,h,n)?r=h:a=e?h.to:h.from}let s=r.type.prop(n),o,l;return s&&(o=e?oe(i,r.from,1):oe(i,r.to,-1))&&o.matched?l=e?o.end.to:o.end.from:l=e?r.to:r.from,b.cursor(l,e?-1:1)}var hy=i=>ae(i,t=>yo(i.state,t,!St(i))),fy=i=>ae(i,t=>yo(i.state,t,St(i)));function rm(i,t){return ae(i,e=>{if(!e.empty)return xo(e,t);let r=i.moveVertically(e,t);return r.head!=e.head?r:i.moveToLineBoundary(e,t)})}var nm=i=>rm(i,!1),sm=i=>rm(i,!0);function om(i){let t=i.scrollDOM.clientHeighto.empty?i.moveVertically(o,t,e.height):xo(o,t));if(n.eq(r.selection))return!1;let s;if(e.selfScroll){let o=i.coordsAtPos(r.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+e.marginTop,h=l.bottom-e.marginBottom;o&&o.top>a&&o.bottomlm(i,!1),Ah=i=>lm(i,!0);function je(i,t,e){let r=i.lineBlockAt(t.head),n=i.moveToLineBoundary(t,e);if(n.head==t.head&&n.head!=(e?r.to:r.from)&&(n=i.moveToLineBoundary(t,e,!1)),!e&&n.head==r.from&&r.length){let s=/^\\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(n=b.cursor(r.from+s))}return n}var cy=i=>ae(i,t=>je(i,t,!0)),uy=i=>ae(i,t=>je(i,t,!1)),dy=i=>ae(i,t=>je(i,t,!St(i))),py=i=>ae(i,t=>je(i,t,St(i))),my=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).from,1)),gy=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).to,-1));function Oy(i,t,e){let r=!1,n=Ki(i.selection,s=>{let o=oe(i,s.head,-1)||oe(i,s.head,1)||s.head>0&&oe(i,s.head-1,1)||s.headOy(i,t,!1);function Jt(i,t){let e=Ki(i.state.selection,r=>{let n=t(r);return b.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return e.eq(i.state.selection)?!1:(i.dispatch(Ce(i.state,e)),!0)}function am(i,t){return Jt(i,e=>i.moveByChar(e,t))}var hm=i=>am(i,!St(i)),fm=i=>am(i,St(i));function cm(i,t){return Jt(i,e=>i.moveByGroup(e,t))}var yy=i=>cm(i,!St(i)),by=i=>cm(i,St(i));var Sy=i=>Jt(i,t=>yo(i.state,t,!St(i))),wy=i=>Jt(i,t=>yo(i.state,t,St(i)));function um(i,t){return Jt(i,e=>i.moveVertically(e,t))}var dm=i=>um(i,!1),pm=i=>um(i,!0);function mm(i,t){return Jt(i,e=>i.moveVertically(e,t,om(i).height))}var Ip=i=>mm(i,!1),Np=i=>mm(i,!0),vy=i=>Jt(i,t=>je(i,t,!0)),ky=i=>Jt(i,t=>je(i,t,!1)),Ty=i=>Jt(i,t=>je(i,t,!St(i))),Py=i=>Jt(i,t=>je(i,t,St(i))),Cy=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).from)),Ay=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).to)),Yp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:0})),!0),zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.doc.length})),!0),Zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:0})),!0),Fp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Qy=({state:i,dispatch:t})=>(t(i.update({selection:{anchor:0,head:i.doc.length},userEvent:\"select\"})),!0),Ry=({state:i,dispatch:t})=>{let e=bo(i).map(({from:r,to:n})=>b.range(r,Math.min(n+1,i.doc.length)));return t(i.update({selection:b.create(e),userEvent:\"select\"})),!0},My=({state:i,dispatch:t})=>{let e=Ki(i.selection,r=>{var n;let s=pt(i).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&(!((n=l.parent)===null||n===void 0)&&n.parent))return b.range(l.to,l.from)}return r});return t(Ce(i,e)),!0},Ey=({state:i,dispatch:t})=>{let e=i.selection,r=null;return e.ranges.length>1?r=b.create([e.main]):e.main.empty||(r=b.create([b.cursor(e.main.head)])),r?(t(Ce(i,r)),!0):!1};function cn(i,t){if(i.state.readOnly)return!1;let e=\"delete.selection\",{state:r}=i,n=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=t(s);ao&&(e=\"delete.forward\",a=uo(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=uo(i,o,!1),l=uo(i,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:b.cursor(o,on(i)))r.between(t,t,(n,s)=>{nt&&(t=e?s:n)});return t}var gm=(i,t)=>cn(i,e=>{let r=e.from,{state:n}=i,s=n.doc.lineAt(r),o,l;if(!t&&r>s.from&&rgm(i,!1),Om=i=>gm(i,!0),xm=(i,t)=>cn(i,e=>{let r=e.head,{state:n}=i,s=n.doc.lineAt(r),o=n.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==e.head&&s.number!=(t?n.doc.lines:1)&&(r+=t?1:-1);break}let a=at(s.text,r-s.from,t)+s.from,h=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),f=o(h);if(l!=null&&f!=l)break;(h!=\" \"||r!=e.head)&&(l=f),r=a}return r}),ym=i=>xm(i,!1),$y=i=>xm(i,!0),qy=i=>cn(i,t=>{let e=i.lineBlockAt(t.head).to;return t.headcn(i,t=>{let e=i.moveToLineBoundary(t,!1).head;return t.head>e?e:Math.max(0,t.head-1)}),By=i=>cn(i,t=>{let e=i.moveToLineBoundary(t,!0).head;return t.head{if(i.readOnly)return!1;let e=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:V.of([\"\",\"\"])},range:b.cursor(r.from)}));return t(i.update(e,{scrollIntoView:!0,userEvent:\"input\"})),!0},Ly=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let n=r.from,s=i.doc.lineAt(n),o=n==s.from?n-1:at(s.text,n-s.from,!1)+s.from,l=n==s.to?n+1:at(s.text,n-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:i.doc.slice(n,l).append(i.doc.slice(o,n))},range:b.cursor(l)}});return e.changes.empty?!1:(t(i.update(e,{scrollIntoView:!0,userEvent:\"move.character\"})),!0)};function bo(i){let t=[],e=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.from),s=i.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=i.doc.lineAt(r.to-1)),e>=n.number){let o=t[t.length-1];o.to=s.to,o.ranges.push(r)}else t.push({from:n.from,to:s.to,ranges:[r]});e=s.number+1}return t}function bm(i,t,e){if(i.readOnly)return!1;let r=[],n=[];for(let s of bo(i)){if(e?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(e?s.to+1:s.from-1),l=o.length+1;if(e){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let a of s.ranges)n.push(b.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let a of s.ranges)n.push(b.range(a.anchor-l,a.head-l))}}return r.length?(t(i.update({changes:r,scrollIntoView:!0,selection:b.create(n,i.selection.mainIndex),userEvent:\"move.line\"})),!0):!1}var Vy=({state:i,dispatch:t})=>bm(i,t,!1),Wy=({state:i,dispatch:t})=>bm(i,t,!0);function Sm(i,t,e){if(i.readOnly)return!1;let r=[];for(let n of bo(i))e?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});return t(i.update({changes:r,scrollIntoView:!0,userEvent:\"input.copyline\"})),!0}var Iy=({state:i,dispatch:t})=>Sm(i,t,!1),Ny=({state:i,dispatch:t})=>Sm(i,t,!0),Yy=i=>{if(i.state.readOnly)return!1;let{state:t}=i,e=t.changes(bo(t).map(({from:n,to:s})=>(n>0?n--:si.moveVertically(n,!0)).map(e);return i.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:\"delete.line\"}),!0};function zy(i,t){if(/\\(\\)|\\[\\]|\\{\\}/.test(i.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=pt(i).resolveInner(t),r=e.childBefore(t),n=e.childAfter(t),s;return r&&n&&r.to<=t&&n.from>=t&&(s=r.type.prop(E.closedBy))&&s.indexOf(n.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(n.from).from&&!/\\S/.test(i.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var Zy=wm(!1),Fy=wm(!0);function wm(i){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:s,to:o}=n,l=t.doc.lineAt(s),a=!i&&s==o&&zy(t,s);i&&(s=o=(o<=l.to?l:t.doc.lineAt(o)).to);let h=new gi(t,{simulateBreak:s,simulateDoubleBreak:!!a}),f=oh(h,s);for(f==null&&(f=We(/^\\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));ol.from&&s{let n=[];for(let o=r.from;o<=r.to;){let l=i.doc.lineAt(o);l.number>e&&(r.empty||r.to>l.from)&&(t(l,n,r),e=l.number),o=l.to+1}let s=i.changes(n);return{changes:n,range:b.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var _y=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=Object.create(null),r=new gi(i,{overrideIndentation:s=>{let o=e[s];return o??-1}}),n=Eh(i,(s,o,l)=>{let a=oh(r,s.from);if(a==null)return;/\\S/.test(s.text)||(a=0);let h=/^\\s*/.exec(s.text)[0],f=rn(i,a);(h!=f||l.fromi.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{r.push({from:e.from,insert:i.facet(ke)})}),{userEvent:\"input.indent\"})),!0),Hy=({state:i,dispatch:t})=>i.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{let n=/^\\s*/.exec(e.text)[0];if(!n)return;let s=We(n,i.tabSize),o=0,l=rn(i,Math.max(0,s-en(i)));for(;o({mac:i.key,run:i.run,shift:i.shift}))),So=[{key:\"Alt-ArrowLeft\",mac:\"Ctrl-ArrowLeft\",run:hy,shift:Sy},{key:\"Alt-ArrowRight\",mac:\"Ctrl-ArrowRight\",run:fy,shift:wy},{key:\"Alt-ArrowUp\",run:Vy},{key:\"Shift-Alt-ArrowUp\",run:Iy},{key:\"Alt-ArrowDown\",run:Wy},{key:\"Shift-Alt-ArrowDown\",run:Ny},{key:\"Escape\",run:Ey},{key:\"Mod-Enter\",run:Fy},{key:\"Alt-l\",mac:\"Ctrl-l\",run:Ry},{key:\"Mod-i\",run:My,preventDefault:!0},{key:\"Mod-[\",run:Hy},{key:\"Mod-]\",run:Gy},{key:\"Mod-Alt-\\\\\",run:_y},{key:\"Shift-Mod-k\",run:Yy},{key:\"Shift-Mod-\\\\\",run:xy},{key:\"Mod-/\",run:Y1},{key:\"Alt-A\",run:Z1}].concat(jy);var Dh=class i{constructor(t,e,r,n,s,o,l,a,h,f=0,c){this.p=t,this.stack=e,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=f,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?\"!\"+this.score:\"\"}`}static start(t,e,r=0){let n=t.parser.context;return new i(t,[],e,r,r,0,[],0,n?new wo(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let r=t>>19,n=t&65535,{parser:s}=this.p,o=s.dynamicPrecedence(n);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(!((e=this.p.parser.nodeSet.types[n])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,r,n=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(e==r)return;if(o.buffer[l-2]>=e){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(t,e,r,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(t,e,r,n){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=n,this.shiftContext(e,r),e<=this.p.parser.maxNode&&this.buffer.push(e,r,n,4);else{let s=t,{parser:o}=this.p;(n>this.pos||e<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,r),this.shiftContext(e,r),e<=o.maxNode&&this.buffer.push(e,r,n,4)}}apply(t,e,r,n){t&65536?this.reduce(t):this.shift(t,e,r,n)}useNode(t,e){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let r=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,r?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Bh(this);;){let r=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(r==0)return!1;if(!(r&65536))return!0;e.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let s=0,o;sa&1&&l==o)||n.push(e[s],o)}e=n}let r=[];for(let n=0;n>19,n=e&65535,s=this.stack.length-r*3;if(s<0||t.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],r=(n,s)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&t.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},wo=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},Bh=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,r=t>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},Xh=class i{constructor(t,e,r){this.stack=t,this.pos=e,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new i(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function un(i,t=Uint16Array){if(typeof i!=\"string\")return i;let e=null;for(let r=0,n=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}e?e[n++]=s:e=new t(s)}return e}var Ji=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},vm=new Ji,Lh=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk=\"\",this.chunkOff=0,this.chunk2=\"\",this.chunk2Pos=0,this.next=-1,this.token=vm,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let r=this.range,n=this.rangeIndex,s=this.pos+t;for(;sr.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=o}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,r,n;if(e>=0&&e=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(t,e=0){let r=e?this.resolveOffset(e,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=\"\",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=vm,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let r=\"\";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(r+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return r}},Ke=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:r}=e.p;Am(this.data,t,e,this.id,r.data,r.tokenPrecTable)}};Ke.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var Vh=class{constructor(t,e,r){this.precTable=e,this.elseToken=r,this.data=typeof t==\"string\"?un(t):t}token(t,e){let r=t.pos,n=0;for(;;){let s=t.next<0,o=t.resolveOffset(1,1);if(Am(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(r,t.token),t.acceptToken(this.elseToken,n))}};Vh.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var yi=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};function Am(i,t,e,r,n,s){let o=0,l=1<0){let m=i[d];if(a.allows(m)&&(t.token.value==-1||t.token.value==m||Jy(m,t.token.value,n,s))){t.acceptToken(m);break}}let f=t.next,c=0,u=i[o+2];if(t.next<0&&u>c&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue t}for(;c>1,m=h+d+(d<<1),O=i[m],g=i[m+1]||65536;if(f=g)c=d+1;else{o=i[m+2],t.advance();continue t}}break}}function km(i,t,e){for(let r=t,n;(n=i[r])!=65535;r++)if(n==e)return r-t;return-1}function Jy(i,t,e,r){let n=km(e,r,t);return n<0||km(e,r,i)t)&&!r.type.isError)return e<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(i.length,Math.max(r.from+1,t+25));if(e<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return e<0?0:i.length}}var Wh=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Tm(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Tm(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(s instanceof ot){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+s.length}}},Ih=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new Ji)}getActions(t){let e=0,r=null,{parser:n}=t.p,{tokenizers:s}=n,o=n.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,a=0;for(let h=0;hc.end+25&&(a=Math.max(c.lookAhead,a)),c.value!=0)){let u=e;if(c.extended>-1&&(e=this.addActions(t,c.extended,c.end,e)),e=this.addActions(t,c.value,c.end,e),!f.extend&&(r=c,e>u))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),!r&&t.pos==this.stream.end&&(r=new Ji,r.value=t.p.parser.eofTerm,r.start=r.end=t.pos,e=this.addActions(t,r.value,r.end,e)),this.mainToken=r,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ji,{pos:r,p:n}=t;return e.start=r,e.end=Math.min(r+1,n.stream.end),e.value=r==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,r){let n=this.stream.clipPos(r.pos);if(e.token(this.stream.reset(n,t),r),t.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,r,n){for(let s=0;st.bufferLength*4?new Wh(r,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,r=this.stacks=[],n,s;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oe)r.push(l);else{if(this.advanceStack(l,r,t))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=n&&tb(n);if(o)return Nt&&console.log(\"Finish with \"+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Nt&&n&&console.log(\"Stuck with token \"+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):\"none\")),new SyntaxError(\"No parse at \"+e);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Nt&&console.log(\"Force-finish \"+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>e)&&this.recovering--}else if(r.length>1){t:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue t}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o \":\"\";if(this.stoppedAt!=null&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,f=h?t.curContext.hash:0;for(let c=this.fragments.nodeAt(n);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(t.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(E.contextHash)||0)==f))return t.useNode(c,u),Nt&&console.log(o+this.stackID(t)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof ot)||c.children.length==0||c.positions[0]>0)break;let d=c.children[0];if(d instanceof ot&&c.positions[0]==0)c=d;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Nt&&console.log(o+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let h=0;hn?e.push(m):r.push(m)}return!1}advanceFully(t,e){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return Pm(t,e),!0}}runRecovery(t,e,r){let n=null,s=!1;for(let o=0;o \":\"\";if(l.deadEnd&&(s||(s=!0,l.restart(),Nt&&console.log(f+this.stackID(l)+\" (restarted)\"),this.advanceFully(l,r))))continue;let c=l.split(),u=f;for(let d=0;c.forceReduce()&&d<10&&(Nt&&console.log(u+this.stackID(c)+\" (via force-reduce)\"),!this.advanceFully(c,r));d++)Nt&&(u=this.stackID(c)+\" -> \");for(let d of l.recoverByInsert(a))Nt&&console.log(f+this.stackID(d)+\" (via recover-insert)\"),this.advanceFully(d,r);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Nt&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Pm(l,r)):(!n||n.scorei,vo=class{constructor(t){this.start=t.start,this.shift=t.shift||qh,this.reduce=t.reduce||qh,this.reuse=t.reuse||qh,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},ko=class i extends _i{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(\" \");this.minRepeatTerm=e.length;for(let l=0;lt.topRules[l][1]),n=[];for(let l=0;l=0)s(f,a,l[h++]);else{let c=l[h+-f];for(let u=-f;u>0;u--)s(l[h++],a,c);h++}}}this.nodeSet=new Hr(e.map((l,a)=>bt.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:r.indexOf(a)>-1,error:a==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(a)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=un(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l==\"number\"?new Ke(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,r){let n=new Nh(this,t,e,r);for(let s of this.wrappers)n=s(n,t,e,r);return n}getGoto(t,e,r=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&r)return a;for(let h=s+(o>>1);s0}validAction(t,e){return!!this.allActions(t,r=>r==e?!0:null)}allActions(t,e){let r=this.stateSlot(t,4),n=r?e(r):void 0;for(let s=this.stateSlot(t,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Be(this.data,s+2);else break;n=e(Be(this.data,s+1))}return n}nextStates(t){let e=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Be(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];e.some((s,o)=>o&1&&s==n)||e.push(this.data[r],n)}}return e}configure(t){let e=Object.assign(Object.create(i.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=r}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(r=>{let n=t.tokenizers.find(s=>s.from==r);return n?n.to:r})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=t.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return e.specializers[n]=Cm(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),r=e.map(()=>!1);if(t)for(let s of t.split(\" \")){let o=e.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;sr)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorei.external(e,r)<<1|t}return i.get}var eb=1,Mm=206,Em=207,ib=208,Qm=209,rb=210,nb=211,sb=212,ob=2,lb=213,ab=214,hb=3,fb=215,cb=216,ub=4,db=217,pb=218,mb=5,gb=219,Ob=26,xb=27,yb=51,bb=52,Sb=57,wb=58,vb=59,kb=61,Tb=62,Pb=63,Cb=64,Ab=65,Qb=67,Rb=256,Mb=74,Eb=275,$b=120,qb=138,Db=159,Bb=160,Xb=163,dn=10,pn=13,Fh=32,To=9,_h=35,Lb=40,Vb=46,Rm=123,$m=39,qm=34,Wb=92,Ib=new Set([xb,yb,bb,Eb,Qb,qb,wb,vb,Rb,Cb,Ab,Mb,Tb,Pb,Db,Bb,Xb,$b]);function zh(i){return i==dn||i==pn}var Nb=new yi((i,t)=>{let e;if(i.next<0)i.acceptToken(nb);else if(t.context.depth<0)zh(i.next)&&i.acceptToken(rb,1);else if(((e=i.peek(-1))<0||zh(e))&&t.canShift(Qm)){let r=0;for(;i.next==Fh||i.next==To;)i.advance(),r++;(i.next==dn||i.next==pn||i.next==_h)&&i.acceptToken(Qm,-r)}else zh(i.next)&&i.acceptToken(ib,1)},{contextual:!0}),Yb=new yi((i,t)=>{let e=t.context.depth;if(e<0)return;let r=i.peek(-1);if(r==dn||r==pn){let n=0,s=0;for(;;){if(i.next==Fh)n++;else if(i.next==To)n+=8-n%8;else break;i.advance(),s++}n!=e&&i.next!=dn&&i.next!=pn&&i.next!=_h&&(n{for(let t=0;t<5;t++){if(i.next!=\"print\".charCodeAt(t))return;i.advance()}if(!/\\w/.test(String.fromCharCode(i.next)))for(let t=0;;t++){let e=i.peek(t);if(!(e==Fh||e==To)){e!=Lb&&e!=Vb&&e!=dn&&e!=pn&&e!=_h&&i.acceptToken(eb);return}}});function Po(i,t,e,r,n){return new yi(s=>{let o=s.pos;for(;!(s.next<0);)if(s.next==Rm)if(s.peek(1)==Rm)s.advance(2);else{if(s.pos==o){s.acceptToken(r,1);return}break}else if(s.next==Wb)s.advance(),s.next>=0&&s.advance();else if(s.next==i&&(t==1||s.peek(1)==i&&s.peek(2)==i)){if(s.pos==o){s.acceptToken(n,t);return}break}else s.advance();s.pos>o&&s.acceptToken(e)})}var Gb=Po($m,1,sb,ob,lb),Hb=Po(qm,1,ab,hb,fb),Ub=Po($m,3,cb,ub,db),jb=Po(qm,3,pb,mb,gb),Kb=Hs({'async \"*\" \"**\" FormatConversion FormatSpec':p.modifier,\"for while if elif else try except finally return raise break continue with pass assert await yield match case\":p.controlKeyword,\"in not and or is del\":p.operatorKeyword,\"from def class global nonlocal lambda\":p.definitionKeyword,import:p.moduleKeyword,\"with as print\":p.keyword,Boolean:p.bool,None:p.null,VariableName:p.variableName,\"CallExpression/VariableName\":p.function(p.variableName),\"FunctionDefinition/VariableName\":p.function(p.definition(p.variableName)),\"ClassDefinition/VariableName\":p.definition(p.className),PropertyName:p.propertyName,\"CallExpression/MemberExpression/PropertyName\":p.function(p.propertyName),Comment:p.lineComment,Number:p.number,String:p.string,FormatString:p.special(p.string),UpdateOp:p.updateOperator,\"ArithOp!\":p.arithmeticOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,AssignOp:p.definitionOperator,Ellipsis:p.punctuation,At:p.meta,\"( )\":p.paren,\"[ ]\":p.squareBracket,\"{ }\":p.brace,\".\":p.derefOperator,\", ;\":p.separator}),Jb={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:178,True:180,False:180,del:194,pass:198,break:202,continue:206,return:210,raise:218,import:222,as:224,global:228,nonlocal:230,assert:234,type:239,elif:252,while:256,try:262,except:264,finally:266,with:270,def:274,class:284,match:295,case:301},Dm=ko.deserialize({version:14,states:\"#)WO`Q#yOOP$bOSOOO%kQ&nO'#HhOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HgOOQS'#Hh'#HhOOQS'#DW'#DWOOQS'#Hg'#HgO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HXOOQS'#HX'#HXO'ZQ#xO'#HWO/ZQ&nO'#HWOOQS'#Ej'#EjO/rQ#xO'#EkOOQS'#HV'#HVO/|Q#xO'#HUOOQV'#HU'#HUO0XQ#xO'#FbOOQS'#Gj'#GjO0^Q#xO'#FaOOQV'#I_'#I_OOQV'#HT'#HTOOQV'#Fy'#FyQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HlO1cQ&nO'#E_O'ZQ#xO'#E`OOQS'#Eb'#EbOOQS'#Ed'#EdOOQS'#Ef'#EfO1wQ#xO'#EhO2_Q#xO'#ElO0XQ#xO'#EnO2rQ&nO'#EnO0XQ#xO'#EqO/rQ#xO'#EtO0XQ#xO'#EvO/rQ#xO'#E|O/rQ#xO'#FPO2}Q#xO'#FRO3UQ#xO'#FWO3aQ#xO'#FSO/rQ#xO'#FWO0XQ#xO'#FYO0XQ#xO'#F_O3fQ#xO'#FdP3mO#xO'#HSPOOO)CBv)CBvOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Ck'#CkOOQS'#Cl'#ClOOQS'#Cn'#CnO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO3xQ#xO'#DqOOQS,5:[,5:[O4]Q#xO'#HvOOQS,5:_,5:_O4jQMlO,5:_O4oQ&nO,59[O0lQ#xO,59dO0lQ#xO,59dO0lQ#xO,59dO7_Q#xO,59dO7dQ#xO,59dO7kQ#xO,59lO7rQ#xO'#HgO8xQ#xO'#HfOOQS'#Hf'#HfOOQS'#D^'#D^O9aQ#xO,59cO'ZQ#xO,59cO9oQ#xO,59cOOQS,59{,59{O9tQ#xO,5:TO'ZQ#xO,5:TOOQS,5:S,5:SO:SQ#xO,5:SO:XQ#xO,5:ZO'ZQ#xO,5:ZO'ZQ#xO,5:XOOQS,5:W,5:WO:jQ#xO,5:WO:oQ#xO,5:YOOOO'#GR'#GRO:tO,UO,5:cOOQS,5:c,5:cOOOO'#GS'#GSO:|O7[O,5:cO;UQ#xO'#DyOOOW'#GT'#GTO;fOWO,5:dOOQS,5:d,5:dO;UQ#xO'#EPOOO`'#GW'#GWO;qO`O,5:dO;UQ#xO'#EROOOp'#GX'#GXO;|OpO,5:dO;UQ#xO'#ETOOO!b'#GY'#GYOWOOQS,5>W,5>WO/rQ#xO'#EZOOQS'#E['#E[OGZQ#xO'#G]OGkQ#xO,59OOGkQ#xO,59OO)pQ#xO,5:wOGyQ&nO'#HoOOQS,5:z,5:zOOQS,5;S,5;SOH^Q#xO,5;WOHoQ#xO,5;YOOQS'#G`'#G`OH}Q&nO,5;YOI]Q#xO,5;YOIbQ#xO'#I]OOQS,5;],5;]OIpQ#xO'#IXOOQS,5;`,5;`OJRQ#xO,5;bO3aQ#xO,5;hO3aQ#xO,5;kOJZQ&nO'#I`O'ZQ#xO'#I`OJeQ#xO,5;mO2}Q#xO,5;mO/rQ#xO,5;rO0XQ#xO,5;tOJjQ#yO'#E}OKvQ#{O,5;nO! [Q#xO'#IaO3aQ#xO,5;rO! gQ#xO,5;tO! oQ#xO,5;yO! zQ&nO,5bOOQS'#Du'#DuOOQS1G/y1G/yOOQS1G/O1G/OO!-uQ&nO1G/OO!-|Q&nO1G/OO0lQ#xO1G/OO!.iQ#xO1G/WOOQS'#D]'#D]O/rQ#xO,59vOOQS1G.}1G.}O!.pQ#xO1G/gO!/QQ#xO1G/gO!/YQ#xO1G/hO'ZQ#xO'#HnO!/_Q#xO'#HnO!/dQ&nO1G.}O!/tQ#xO,59kO!0zQ#xO,5>^O!1[Q#xO,5>^O!1dQ#xO1G/oO!1iQ&nO1G/oOOQS1G/n1G/nO!1yQ#xO,5>XO!2pQ#xO,5>XO/rQ#xO1G/sO!3_Q#xO1G/uO!3dQ&nO1G/uO!3tQ&nO1G/sOOQS1G/r1G/rOOQS1G/t1G/tOOOO-E:P-E:POOQS1G/}1G/}OOOO-E:Q-E:QO!4UQ#xO'#IRO/rQ#xO'#IRO!4gQ#xO,5:eOOOW-E:R-E:ROOQS1G0O1G0OO!4uQ#xO,5:kOOO`-E:U-E:UO!5TQ#xO,5:mOOOp-E:V-E:VO!5cQ#xO,5:oOOO!b-E:W-E:WOOQS-E:X-E:XO!5qQ!LUO1G3^O!6bQ&nO1G3^O'ZQ#xO,5tOOQS1G1h1G1hO!7bQ#xO1G1hOOQS'#DX'#DXO/rQ#xO,5>TOOQS,5>T,5>TO!7gQ#xO'#FzO!7rQ#xO,59qO!7zQ#xO1G/ZO!8UQ&nO,5>XOOQS1G3r1G3rOOQS,5:u,5:uO!8uQ#xO'#HWOOQS,5ZO!9vQ#xO,5>ZO/rQ#xO1G0rO/rQ#xO1G0rO0XQ#xO1G0tOOQS-E:^-E:^O!:XQ#xO1G0tO!:dQ#xO1G0tO!:iQ#xO,5>wO!:wQ#xO,5>wO!;VQ#xO,5>sO!;mQ#xO,5>sO!zO!CZQ#xO,5>zO!CcQ&nO,5>zO/rQ#xO1G1XO!CmQ#xO1G1XO3aQ#xO1G1^O! gQ#xO1G1`OOQV,5;i,5;iO!CrQ#zO,5;iO!CwQ#{O1G1YO!G]Q#xO'#GgO3aQ#xO1G1YO3aQ#xO1G1YO!GmQ#xO,5>{O!GzQ#xO,5>{O0XQ#xO,5>{OOQV1G1^1G1^O!HSQ#xO'#F[O!HeQMlO1G1`O!HmQ#xO1G1`OOQV1G1e1G1eO3aQ#xO1G1eO!HrQ#xO1G1eO!HzQ#xO'#FfOOQV1G1j1G1jO! zQ&nO1G1jPOOO1G3Y1G3YP!IPOSO1G3YOOQS,5>a,5>aOOQS'#Dr'#DrO/rQ#xO,5>aO!IUQ#xO,5>`O!IiQ#xO,5>`OOQS1G/w1G/wO!IqQ#xO,5>cO!JRQ#xO,5>cO!JZQ#xO,5>cO!JnQ#xO,5>cO!KOQ#xO,5>cOOQS1G3|1G3|OOQS7+$j7+$jO!7zQ#xO7+$rO!LqQ#xO1G/OO!LxQ#xO1G/OOOQS1G/b1G/bOOQS,5YO'ZQ#xO,5>YOOQS7+$i7+$iO!MfQ#xO7+%RO!MnQ#xO7+%SO!MsQ#xO1G3xOOQS7+%Z7+%ZO!NTQ#xO1G3xO!N]Q#xO7+%ZOOQS,5mO##cQ#xO,5>mO##cQ#xO,5>mOOQS'#Dz'#DzO##tO$ISO'#D|O#$PO#tO'#ISOOOW1G0P1G0PO#$UQ#xO1G0PO#$^Q#xO1G0POOQS'#EQ'#EQOOO`1G0V1G0VO#$iQ#xO1G0VO#$qQ#xO1G0VOOQS'#ES'#ESOOOp1G0X1G0XO#$|Q#xO1G0XO#%UQ#xO1G0XOOQS'#EU'#EUOOO!b1G0Z1G0ZO#%aQ#xO1G0ZO#%iQ#xO1G0ZO#%tQ!LUO7+(xO#&eQ&nO1G2bP#'OQ#xO'#G[OOQS,5n,5>nOOOW7+%k7+%kO#;yQ#xO7+%kOOO`7+%q7+%qO#vO#=xQ#xO,5>vO0XQ#xO,5>vO#>ZQ#xO,5>uOOQS<`Q#xO,5>xO#>nQ#xO,5>xOOQS1G1O1G1OOOQS<vQ&nO1G2lP#?QQ#xO'#GfO#?XQ#xO7+*QO#?cQ#{O<}O#F{Q#xO,5>}OOQS,5>},5>}O#GWQ#xO,5>|O#GiQ#xO,5>|OOQS1G1b1G1bOOQS,5;x,5;xOOQV<XAN>XO#JxQ#xO<eAN>eO/rQ#xO1G2UO#KYQ&nO1G2UP#KdQ#xO'#GOOOQS1G2[1G2[P#KqQ#xO'#GUO#LOQ#xO7+)sO#LiQ#xO,5:iOOOO-E:T-E:TOOOW<[OOQSANBfANBfOOOO7+%o7+%oO$.WQ#xO7+%oOOQS7+(R7+(RO$.`Q#xO<kPP>n?`?cPP'f'fPP?{PP'f'fPP'f'f'f'f'f@P@y'fP@|PASE^H}IRPIUIlIpIsIwIzJOJRJV'fPPPJYJc'^P'^'^P'^P'^P'^P'^P'^'^'^P'^PP'^PP'^P'^PJiJuJ}PKUK[PKUPKUKUPPPKUPMjPMsM}NTMjPKUN^PKUPNeNkPNo! T! r!!]NoNo!!c!!pNoNoNoNo!#U!#[!#_!#d!#g!#q!#w!$T!$g!$m!$w!$}!%k!%q!%w!%}!&X!&_!&e!&k!&q!&w!'Z!'e!'k!'q!'w!(R!(X!(_!(e!(k!(u!({!)V!)]!)f!)l!){!*T!*_!*fPPPPPPPPPPPPPPPPP!*l!*o!*u!+O!+Y!+ePPPPPPPPPPPP!0[!1p!5s!9WPP!9`!9r!9{!:t!:k!:}!;T!;W!;Z!;^!;f!V!>]!>f!>i!>l!>r!>x!?O!?RP!?Z!?d!@`!@c]jOs#v$w*`,p(TeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o}!hQ#r$P$b$q$}%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!P!iQ#r$P$b$q$}%S%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!R!jQ#r$P$b$q$}%S%T%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!T!kQ#r$P$b$q$}%S%T%U%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!V!lQ#r$P$b$q$}%S%T%U%V%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!X!mQ#r$P$b$q$}%S%T%U%V%W%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!]!mQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d(TTOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o&iVOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1o%sXOYZ[isw}!O!S!U!V!Z!n!p#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$VvQ0X/fR1l1n'zeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oW#ym!P!Q$hW$Rv&q/f1nQ$j!RQ$n!TQ${![Q$|!]W%Z!n(O+O-WS&p$S$TQ'e$vQ)b&jQ)p'QU)q'S)r)sU)t'U)u,ZW){'Y,^-z.vQ*l'nW*m'p-P._/OQ,])zS-O*n*oY-t,U-u.s.t/lQ-w,WQ.U,tQ.Y,wQ.|.Wl/R.c/X/Y/[/w/y0O0g0l0q0v1R1W1ZQ/k.rQ0P/ZQ0^/qQ0i/{U0|0r1P1XX1S0w1T1[1]R&o$R!_!|YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WR%k!{Q#QYQ&W#cQ&Z#gQ&]#jQ&_#mQ&x$^Q&{$aR-l+tT/e.j0p![!oQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dQ&m#zQ't$|R*x'uR'}%ZQ%d!rR0[/o(SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oS#pd#q!P/V.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1](SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oT#pd#qT#d`#eR)Q&Wy(}&W&Z&]&_)P)Q)T)U)X)Y)])^+y+{+},P-l.p.q/jT+u(|+vR.q-lT#ha#iR)U&ZT#kb#lR)Y&]T#nc#oR)^&_Q$`xQ,]){R,}*mX$^x$_$`&zQ'[$nQ'r${Q'u$|R*_'eQ)|'YV-y,^-z.vZlOs$w*`,pXpOs*`,pQ$x!YQ']$oQ'^$pQ'o$zQ's$|Q*]'dQ*d'iQ*g'jQ*h'kQ*u'qS*w't'uQ,d*RQ,f*SQ,g*TQ,k*ZS,m*^*vQ,q*bQ,r*cS,s*e*fQ-T*xQ-|,cQ-},eQ.P,lS.Q,n,oQ.V,uQ.X,vQ.w.OQ.y.RQ.z.TQ.{.UQ/m.xQ/n.|Q0T/_R0o0UWpOs*`,pR#|oQ'q${S*^'e'rR,o*_Q,|*mR.],}Q*v'qQ,n*^R.R,oZnOos*`,pQ'w$}R*z'xT.a-U.bu/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1Zt/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZQ0P/ZX1S0w1T1[1]!P/U.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1]Q/t/TR0c/ug/w/W/x0_0f0k0y0{0}1Y1^1_u/].c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZX/r/R/]0^0|R0`/qV1O0r1P1XR0U/_QsOS$Os,pR,p*`Q&r$UR)g&rS%z#W$WS(p%z(sT(s%}&tQ%n#OQ%u#SW(b%n%u(g(kQ(g%rR(k%wQ&}$bR)m&}Q(v&OQ+g(qT+m(v+gQ(P%]R+P(PS(S%`%aY+T(S+U-^.h/cU+U(T(U(VU-^+V+W+XS.h-_-`R/c.iQ#_^R&R#_Q#b_R&T#bQ#e`R&X#eQ(y&US+r(y+sR+s(zQ+v(|R-m+vQ#iaR&[#iQ#lbR&^#lQ#ocR&`#oQ#qdR&a#qQ#tgQ&c#rW&f#t&c)j,RQ)j&wR,R1dQ$_xS&y$_&zR&z$`Q'X$lR)y'XQ&k#yR)c&kQ$h!QR'R$hQ,V)qS-v,V.uR.u-wQ'V$jR)v'VQ,_)|R-{,_Q#wkR&h#wQ*Q']R,b*QQ'`$qS*X'`*YR*Y'aQ'h$xR*a'hQ'm$yS*k'm,zR,z*lQ-Q*qR.`-QWoOs*`,pR#{oQ.b-UR/P.bd/x/W0_0f0k0y0{0}1Y1^1_R0e/xU/p/R0^0|R0]/pQ0x0kS1U0x1VR1V0yS0s0_0`R1Q0sQ/z/WR0h/zR!`PXrOs*`,pWqOs*`,pR'f$wYkOs$w*`,pR&g#v[xOs#v$w*`,pR&x$^&hQOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1oQ!sTQ#rfQ$PtU$by%p(eS$q!W$tQ$}!^Q%S!hQ%T!iQ%U!jQ%V!kQ%W!lQ%X!mQ%r#PQ%w#TQ%}#XQ&O#YQ&t$XQ'a$rQ'x%OQ)`&dU)k&|)l,SW*U'_*W,i,jQ+Z(_Q+d(nQ,h*VQ-g+lQ0n0SR1d1iQ#OYQ#SZQ$o!UQ$p!VQ%`!pQ(V%a^(^%m%t(a(i+]+`+b^+Q(R+S-[-].g/b0WQ+W(TQ+X(UQ,e*RQ-Z+RQ-_+VQ.e-XQ.f-YQ.i-`Q/`.dR0V/a[gOs#v$w*`,p!^!{YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WQ#W[Q#uiS$Ww}Q$e!OW$l!S$a'b*[S$y!Z$uW%Y!n(O+O-WY&U#c#g#j#m+t`&e#s&b)_)a)i,Q-r1hQ&u$YQ&v$[Q&w$^Q'{%[Q(]%kW(m%y(o+e+iQ(q%{Q(z&VQ)e&oS)h&s1fQ)n'OQ)o'PU)w'W)x,[Q*O'ZQ*e'iY*i'l*j,x,y.ZQ*|'}S+Y(Y1gW+k(u+f-d-hW+o(x+q-j-kQ,a*PQ,u*fQ-S*tQ-i+pQ-s,TQ.[,|Q.m-fR.}.]hUOs#s#v$w&b&s(Y)_)a*`,p%Y!zYZ[iw}!O!S!U!V!Z!n!p#c#g#j#m$Y$[$^$a$u%[%a%k%m%t%y%{&V&o'O'P'W'Z'b'i'l'}(O(R(T(U(a(i(o(u(x)i)x*P*R*[*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$QuW%e!t!x1a1kQ%f!uQ%g!vQ%i!yQ%s1`S(X%h1eQ(Z1bQ([1cQ-a+^Q.l-bS/d.j0pR1m1oU$Uv/f1nR)f&q[hOs#v$w*`,pa!}Y#c#g#j#m$^$a+tQ#][Q$ZwR$d}Q%o#OQ%v#SQ%|#WQ'{%YQ(h%rQ(l%wQ(t%}Q(w&OQ+h(qQ-V*|Q.k-aQ/h.lR0Y/gQ$cyQ(d%pR+_(eQ/g.jR0z0pR#VZR#[[R%_!nQ%]!nV*}(O+O-W!]!qQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-l+tQ)O&WQ)S&ZQ)W&]Q)[&_S+x)P)QS+z)T)US+|)X)YS,O)])^Q-n+yQ-o+{Q-p+}Q-q,PQ.o-lS/i.p.qR0Z/jQ$m!SQ&{$aQ*Z'bR,l*[Q#zmQ$f!PQ$i!QR'T$hQ)p'SR,Y)sQ)p'SQ,X)rR,Y)sR$k!RR)}'YXqOs*`,pQ$s!WR'c$tQ$z!ZR'd$uR*s'pQ*q'pV.^-P._/OQ/_.cQ/|/XR/}/YU/W.c/X/YQ0R/[Q0_/qQ0d/wU0f/y0g0vQ0k0OQ0y0lQ0{0qU0}0r1P1XQ1Y1RQ1^1WR1_1ZR0Q/ZR0a/q\",nodeNames:\"\\u26A0 print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard\",maxTerm:288,context:Fb,nodeProps:[[\"isolate\",-8,6,73,74,75,79,81,83,85,\"\"],[\"group\",-15,8,93,95,96,98,100,102,104,106,107,108,110,113,116,118,\"Statement Statement\",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,87,88,89,90,\"Expression\",-10,122,124,127,129,130,134,136,141,143,146,\"Statement\",-9,151,152,155,156,158,159,160,161,162,\"Pattern\"],[\"openedBy\",25,\"(\",56,\"[\",60,\"{\"],[\"closedBy\",26,\")\",57,\"]\",61,\"}\"]],propSources:[Kb],skippedNodes:[0,6],repeatNodeCount:38,tokenData:\"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&w!b&oS&rW%u!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&w!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&w!b&oS&rWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cDXa&w!b&oS&msOYE^YZ%TZ]E^]^%T^rE^rs!)|swE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cEia&w!b&oS&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cFw]&w!b&oS&msOr%Trs'Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cGya&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxIOx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cIXa&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxJ^x#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#_Jg_&w!b&rW&msOYJ^YZ1XZ]J^]^1X^rJ^rsKfs#OJ^#O#PL`#P#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`!!o<%lOJ^#_KmZ&w!b&msOr1Xrs2ys#O1X#O#P3q#P#o1X#o#p4`#p#q1X#q#r4`#r;'S1X;'S;=`7i<%lO1X#_LeW&w!bO#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`! r;=`<%lL}<%lOJ^{MUZ&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l<%lOL}{M|V&msOr4`rs5ds#O4`#O#P5y#P;'S4`;'S;=`6t<%lO4`{NfRO;'SL};'S;=`No;=`OL}{Nv[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lL}<%lOL}{! oP;=`<%lL}#_! y[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lJ^<%lOL}#_!!rP;=`<%lJ^#c!!zW&w!bO#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!(q;=`<%l!#d<%lOE^!P!#m]&oS&rW&msOY!#dYZ8^Z]!#d]^8^^r!#drs!$fsw!#dwx!%Yx#O!#d#O#P!'Y#P;'S!#d;'S;=`!(k<%lO!#d!P!$mX&oS&msOr8^rs9rsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`^s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!>e_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!?ds#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!?k_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!3`s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!@q[U!T&w!bOY!=UYZ1XZ]!=U]^1X^#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!Ec;=`<%l4`<%lO!=U!]!AnZU!T&rWOY!AgYZ4`Z]!Ag]^4`^r!Agrs!Bas#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!BfZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!CXs#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!C^ZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!4Ys#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!DUWU!TOY!AgYZ4`Z]!Ag]^4`^;'S!Ag;'S;=`!Dn;=`<%l4`<%lO!Ag!]!DsW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&w!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&oS&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&oS&rWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&w!b&oS&rW&l`&XsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Jb[i]||-1}],tokenPrec:7500});var Bm=new zs,Vm=new Set([\"Script\",\"Body\",\"FunctionDefinition\",\"ClassDefinition\",\"LambdaExpression\",\"ForStatement\",\"MatchClause\"]);function Co(i){return(t,e,r)=>{if(r)return!1;let n=t.node.getChild(\"VariableName\");return n&&e(n,i),!0}}var tS={FunctionDefinition:Co(\"function\"),ClassDefinition:Co(\"class\"),ForStatement(i,t,e){if(e){for(let r=i.node.firstChild;r;r=r.nextSibling)if(r.name==\"VariableName\")t(r,\"variable\");else if(r.name==\"in\")break}},ImportStatement(i,t){var e,r;let{node:n}=i,s=((e=n.firstChild)===null||e===void 0?void 0:e.name)==\"from\";for(let o=n.getChild(\"import\");o;o=o.nextSibling)o.name==\"VariableName\"&&((r=o.nextSibling)===null||r===void 0?void 0:r.name)!=\"as\"&&t(o,s?\"variable\":\"namespace\")},AssignStatement(i,t){for(let e=i.node.firstChild;e;e=e.nextSibling)if(e.name==\"VariableName\")t(e,\"variable\");else if(e.name==\":\"||e.name==\"AssignOp\")break},ParamList(i,t){for(let e=null,r=i.node.firstChild;r;r=r.nextSibling)r.name==\"VariableName\"&&(!e||!/\\*|AssignOp/.test(e.name))&&t(r,\"variable\"),e=r},CapturePattern:Co(\"variable\"),AsPattern:Co(\"variable\"),__proto__:null};function Wm(i,t){let e=Bm.get(t);if(e)return e;let r=[],n=!0;function s(o,l){let a=i.sliceString(o.from,o.to);r.push({label:a,type:l})}return t.cursor(st.IncludeAnonymous).iterate(o=>{if(o.name){let l=tS[o.name];if(l&&l(o,s,n)||!n&&Vm.has(o.name))return!1;n=!1}else if(o.to-o.from>8192){for(let l of Wm(i,o.node))r.push(l);return!1}}),Bm.set(t,r),r}var Xm=/^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/,Im=[\"String\",\"FormatString\",\"Comment\",\"PropertyName\"];function eS(i){let t=pt(i.state).resolveInner(i.pos,-1);if(Im.indexOf(t.name)>-1)return null;let e=t.name==\"VariableName\"||t.to-t.from<20&&Xm.test(i.state.sliceDoc(t.from,t.to));if(!e&&!i.explicit)return null;let r=[];for(let n=t;n;n=n.parent)Vm.has(n.name)&&(r=r.concat(Wm(i.state.doc,n)));return{options:r,from:e?t.from:i.pos,validFor:Xm}}var iS=[\"__annotations__\",\"__builtins__\",\"__debug__\",\"__doc__\",\"__import__\",\"__name__\",\"__loader__\",\"__package__\",\"__spec__\",\"False\",\"None\",\"True\"].map(i=>({label:i,type:\"constant\"})).concat([\"ArithmeticError\",\"AssertionError\",\"AttributeError\",\"BaseException\",\"BlockingIOError\",\"BrokenPipeError\",\"BufferError\",\"BytesWarning\",\"ChildProcessError\",\"ConnectionAbortedError\",\"ConnectionError\",\"ConnectionRefusedError\",\"ConnectionResetError\",\"DeprecationWarning\",\"EOFError\",\"Ellipsis\",\"EncodingWarning\",\"EnvironmentError\",\"Exception\",\"FileExistsError\",\"FileNotFoundError\",\"FloatingPointError\",\"FutureWarning\",\"GeneratorExit\",\"IOError\",\"ImportError\",\"ImportWarning\",\"IndentationError\",\"IndexError\",\"InterruptedError\",\"IsADirectoryError\",\"KeyError\",\"KeyboardInterrupt\",\"LookupError\",\"MemoryError\",\"ModuleNotFoundError\",\"NameError\",\"NotADirectoryError\",\"NotImplemented\",\"NotImplementedError\",\"OSError\",\"OverflowError\",\"PendingDeprecationWarning\",\"PermissionError\",\"ProcessLookupError\",\"RecursionError\",\"ReferenceError\",\"ResourceWarning\",\"RuntimeError\",\"RuntimeWarning\",\"StopAsyncIteration\",\"StopIteration\",\"SyntaxError\",\"SyntaxWarning\",\"SystemError\",\"SystemExit\",\"TabError\",\"TimeoutError\",\"TypeError\",\"UnboundLocalError\",\"UnicodeDecodeError\",\"UnicodeEncodeError\",\"UnicodeError\",\"UnicodeTranslateError\",\"UnicodeWarning\",\"UserWarning\",\"ValueError\",\"Warning\",\"ZeroDivisionError\"].map(i=>({label:i,type:\"type\"}))).concat([\"bool\",\"bytearray\",\"bytes\",\"classmethod\",\"complex\",\"float\",\"frozenset\",\"int\",\"list\",\"map\",\"memoryview\",\"object\",\"range\",\"set\",\"staticmethod\",\"str\",\"super\",\"tuple\",\"type\"].map(i=>({label:i,type:\"class\"}))).concat([\"abs\",\"aiter\",\"all\",\"anext\",\"any\",\"ascii\",\"bin\",\"breakpoint\",\"callable\",\"chr\",\"compile\",\"delattr\",\"dict\",\"dir\",\"divmod\",\"enumerate\",\"eval\",\"exec\",\"exit\",\"filter\",\"format\",\"getattr\",\"globals\",\"hasattr\",\"hash\",\"help\",\"hex\",\"id\",\"input\",\"isinstance\",\"issubclass\",\"iter\",\"len\",\"license\",\"locals\",\"max\",\"min\",\"next\",\"oct\",\"open\",\"ord\",\"pow\",\"print\",\"property\",\"quit\",\"repr\",\"reversed\",\"round\",\"setattr\",\"slice\",\"sorted\",\"sum\",\"vars\",\"zip\"].map(i=>({label:i,type:\"function\"}))),rS=[Pe(\"def ${name}(${params}):\\n\t${}\",{label:\"def\",detail:\"function\",type:\"keyword\"}),Pe(\"for ${name} in ${collection}:\\n\t${}\",{label:\"for\",detail:\"loop\",type:\"keyword\"}),Pe(\"while ${}:\\n\t${}\",{label:\"while\",detail:\"loop\",type:\"keyword\"}),Pe(\"try:\\n\t${}\\nexcept ${error}:\\n\t${}\",{label:\"try\",detail:\"/ except block\",type:\"keyword\"}),Pe(`if \\${}:\n\t\n`,{label:\"if\",detail:\"block\",type:\"keyword\"}),Pe(\"if ${}:\\n\t${}\\nelse:\\n\t${}\",{label:\"if\",detail:\"/ else block\",type:\"keyword\"}),Pe(\"class ${name}:\\n\tdef __init__(self, ${params}):\\n\t\t\t${}\",{label:\"class\",detail:\"definition\",type:\"keyword\"}),Pe(\"import ${module}\",{label:\"import\",detail:\"statement\",type:\"keyword\"}),Pe(\"from ${module} import ${names}\",{label:\"from\",detail:\"import\",type:\"keyword\"})],nS=Ap(Im,wh(iS.concat(rS)));function Lm(i,t){let e=i.baseIndentFor(t),r=i.lineAt(i.pos,-1),n=r.from+r.text.length;return/^\\s*($|#)/.test(r.text)&&i.node.toe?null:e+i.unit}var Gh=Us.define({name:\"python\",parser:Dm.configure({props:[lh.add({Body:i=>{var t;return(t=Lm(i,i.node))!==null&&t!==void 0?t:i.continue()},IfStatement:i=>/^\\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\\s*(except |finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),\"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression\":Ks({closing:\")\"}),\"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression\":Ks({closing:\"}\"}),\"ArrayExpression ArrayComprehensionExpression\":Ks({closing:\"]\"}),\"String FormatString\":()=>null,Script:i=>{if(i.pos+/\\s*/.exec(i.textAfter)[0].length>=i.node.to){let t=null;for(let e=i.node,r=e.to;e=e.lastChild,!(!e||e.to!=r);)e.type.name==\"Body\"&&(t=e);if(t){let e=Lm(i,t);if(e!=null)return e}}return i.continue()}}),ah.add({\"ArrayExpression DictionaryExpression SetExpression TupleExpression\":ap,Body:(i,t)=>({from:i.from+1,to:i.to-(i.to==t.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:[\"(\",\"[\",\"{\",\"'\",'\"',\"'''\",'\"\"\"'],stringPrefixes:[\"f\",\"fr\",\"rf\",\"r\",\"u\",\"b\",\"br\",\"rb\",\"F\",\"FR\",\"RF\",\"R\",\"U\",\"B\",\"BR\",\"RB\"]},commentTokens:{line:\"#\"},indentOnInput:/^\\s*([\\}\\]\\)]|else:|elif |except |finally:)$/}});function Hh(){return new js(Gh,[Gh.data.of({autocomplete:eS}),Gh.data.of({autocomplete:nS})])}function z(){var i=arguments[0];typeof i==\"string\"&&(i=document.createElement(i));var t=1,e=arguments[1];if(e&&typeof e==\"object\"&&e.nodeType==null&&!Array.isArray(e)){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n==\"string\"?i.setAttribute(r,n):n!=null&&(i[r]=n)}t++}for(;tl.from==l.to||l.from==l.to-1&&r.doc.lineAt(l.from).to==l.from?R.widget({widget:new jh(l),diagnostic:l}).range(l.from):R.mark({attributes:{class:\"cm-lintRange cm-lintRange-\"+l.severity+(l.markClass?\" \"+l.markClass:\"\")},diagnostic:l,inclusive:!0}).range(l.from,l.to)),!0);return new i(o,e,tr(o))}};function tr(i,t=null,e=0){let r=null;return i.between(e,1e9,(n,s,{spec:o})=>{if(!(t&&o.diagnostic!=t))return r=new Uh(n,s,o.diagnostic),!1}),r}function sS(i,t){let e=i.startState.doc.lineAt(t.pos);return!!(i.effects.some(r=>r.is(zm))||i.changes.touchesRange(e.from,e.to))}function oS(i,t){return i.field(Yt,!1)?t:t.concat(M.appendConfig.of(pS))}var zm=M.define(),Kh=M.define(),Zm=M.define(),Yt=it.define({create(){return new bi(R.none,null,null)},update(i,t){if(t.docChanged){let e=i.diagnostics.map(t.changes),r=null;if(i.selected){let n=t.changes.mapPos(i.selected.from,1);r=tr(e,i.selected.diagnostic,n)||tr(e,null,n)}i=new bi(e,i.panel,r)}for(let e of t.effects)e.is(zm)?i=bi.init(e.value,i.panel,t.state):e.is(Kh)?i=new bi(i.diagnostics,e.value?Ro.open:null,i.selected):e.is(Zm)&&(i=new bi(i.diagnostics,i.panel,e.value));return i},provide:i=>[fi.from(i,t=>t.panel),T.decorations.from(i,t=>t.diagnostics)]});var lS=R.mark({class:\"cm-lintRange cm-lintRange-active\",inclusive:!0});function aS(i,t,e){let{diagnostics:r}=i.state.field(Yt),n=[],s=2e8,o=0;r.between(t-(e<0?1:0),t+(e>0?1:0),(a,h,{spec:f})=>{t>=a&&t<=h&&(a==h||(t>a||e>0)&&(tGm(i,e,!1)))}var fS=i=>{let t=i.state.field(Yt,!1);(!t||!t.panel)&&i.dispatch({effects:oS(i.state,[Kh.of(!0)])});let e=ci(i,Ro.open);return e&&e.dom.querySelector(\".cm-panel-lint ul\").focus(),!0},Ym=i=>{let t=i.state.field(Yt,!1);return!t||!t.panel?!1:(i.dispatch({effects:Kh.of(!1)}),!0)},cS=i=>{let t=i.state.field(Yt,!1);if(!t)return!1;let e=i.state.selection.main,r=t.diagnostics.iter(e.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==e.from&&r.to==e.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var Mo=[{key:\"Mod-Shift-m\",run:fS,preventDefault:!0},{key:\"F8\",run:cS}];var Fm=A.define({combine(i){return Object.assign({sources:i.map(t=>t.source).filter(t=>t!=null)},kt(i.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(t,e)=>t?e?r=>t(r)||e(r):t:e}))}});function _m(i){let t=[];if(i)t:for(let{name:e}of i){for(let r=0;rs.toLowerCase()==n.toLowerCase())){t.push(n);continue t}}t.push(\"\")}return t}function Gm(i,t,e){var r;let n=e?_m(t.actions):[];return z(\"li\",{class:\"cm-diagnostic cm-diagnostic-\"+t.severity},z(\"span\",{class:\"cm-diagnosticText\"},t.renderMessage?t.renderMessage():t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=u=>{if(u.preventDefault(),l)return;l=!0;let d=tr(i.state.field(Yt).diagnostics,t);d&&s.apply(i,d.from,d.to)},{name:h}=s,f=n[o]?h.indexOf(n[o]):-1,c=f<0?h:[h.slice(0,f),z(\"u\",h.slice(f,f+1)),h.slice(f+1)];return z(\"button\",{type:\"button\",class:\"cm-diagnosticAction\",onclick:a,onmousedown:a,\"aria-label\":` Action: ${h}${f<0?\"\":` (access key \"${n[o]})\"`}.`},c)}),t.source&&z(\"div\",{class:\"cm-diagnosticSource\"},t.source))}var jh=class extends Ut{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return z(\"span\",{class:\"cm-lintPoint cm-lintPoint-\"+this.diagnostic.severity})}},Qo=class{constructor(t,e){this.diagnostic=e,this.id=\"item_\"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Gm(t,e,!0),this.dom.id=this.id,this.dom.setAttribute(\"role\",\"option\")}},Ro=class i{constructor(t){this.view=t,this.items=[];let e=n=>{if(n.keyCode==27)Ym(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=_m(s.actions);for(let l=0;l{for(let s=0;sYm(this.view)},\"\\xD7\")),this.update()}get selectedIndex(){let t=this.view.state.field(Yt).selected;if(!t)return-1;for(let e=0;e{let h=-1,f;for(let c=r;cr&&(this.items.splice(r,h-r),n=!0)),e&&f.diagnostic==e.diagnostic?f.dom.hasAttribute(\"aria-selected\")||(f.dom.setAttribute(\"aria-selected\",\"true\"),s=f):f.dom.hasAttribute(\"aria-selected\")&&f.dom.removeAttribute(\"aria-selected\"),r++});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute(\"aria-activedescendant\"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)e();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Yt),r=tr(e.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Zm.of(r)})}static open(t){return new i(t)}};function uS(i,t='viewBox=\"0 0 40 40\"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function Ao(i){return uS(``,'width=\"6\" height=\"3\"')}var dS=T.baseTheme({\".cm-diagnostic\":{padding:\"3px 6px 3px 8px\",marginLeft:\"-1px\",display:\"block\",whiteSpace:\"pre-wrap\"},\".cm-diagnostic-error\":{borderLeft:\"5px solid #d11\"},\".cm-diagnostic-warning\":{borderLeft:\"5px solid orange\"},\".cm-diagnostic-info\":{borderLeft:\"5px solid #999\"},\".cm-diagnostic-hint\":{borderLeft:\"5px solid #66d\"},\".cm-diagnosticAction\":{font:\"inherit\",border:\"none\",padding:\"2px 4px\",backgroundColor:\"#444\",color:\"white\",borderRadius:\"3px\",marginLeft:\"8px\",cursor:\"pointer\"},\".cm-diagnosticSource\":{fontSize:\"70%\",opacity:.7},\".cm-lintRange\":{backgroundPosition:\"left bottom\",backgroundRepeat:\"repeat-x\",paddingBottom:\"0.7px\"},\".cm-lintRange-error\":{backgroundImage:Ao(\"#d11\")},\".cm-lintRange-warning\":{backgroundImage:Ao(\"orange\")},\".cm-lintRange-info\":{backgroundImage:Ao(\"#999\")},\".cm-lintRange-hint\":{backgroundImage:Ao(\"#66d\")},\".cm-lintRange-active\":{backgroundColor:\"#ffdd9980\"},\".cm-tooltip-lint\":{padding:0,margin:0},\".cm-lintPoint\":{position:\"relative\",\"&:after\":{content:'\"\"',position:\"absolute\",bottom:0,left:\"-2px\",borderLeft:\"3px solid transparent\",borderRight:\"3px solid transparent\",borderBottom:\"4px solid #d11\"}},\".cm-lintPoint-warning\":{\"&:after\":{borderBottomColor:\"orange\"}},\".cm-lintPoint-info\":{\"&:after\":{borderBottomColor:\"#999\"}},\".cm-lintPoint-hint\":{\"&:after\":{borderBottomColor:\"#66d\"}},\".cm-panel.cm-panel-lint\":{position:\"relative\",\"& ul\":{maxHeight:\"100px\",overflowY:\"auto\",\"& [aria-selected]\":{backgroundColor:\"#ddd\",\"& u\":{textDecoration:\"underline\"}},\"&:focus [aria-selected]\":{background_fallback:\"#bdf\",backgroundColor:\"Highlight\",color_fallback:\"white\",color:\"HighlightText\"},\"& u\":{textDecoration:\"none\"},padding:0,margin:0},\"& [name=close]\":{position:\"absolute\",top:\"0\",right:\"2px\",background:\"inherit\",border:\"none\",font:\"inherit\",padding:0,margin:0}}});var pS=[Yt,T.decorations.compute([Yt],i=>{let{selected:t,panel:e}=i.field(Yt);return!t||!e||t.from==t.to?R.none:R.set([lS.range(t.from,t.to)])}),Id(aS,{hideOn:sS}),dS];var Hm=typeof String.prototype.normalize==\"function\"?i=>i.normalize(\"NFKD\"):i=>i,ti=class{constructor(t,e,r=0,n=t.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=\"\",this.bufferPos=0,this.iter=t.iterRange(r,n),this.bufferStart=r,this.normalize=s?l=>s(Hm(l)):Hm,this.query=this.normalize(e)}peek(){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 dt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=vr(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=wt(t);let n=this.normalize(e);for(let s=0,o=r;;s++){let l=n.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==n.length-1){if(a)return this.value=a,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=\"\":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let r=this.curLineStart+e.index,n=r+e[0].length;if(this.matchPos=Xo(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||n.to<=e){let l=new i(e,t.sliceString(e,r));return Jh.set(t,l),l}if(n.from==e&&n.to==r)return n;let{text:s,from:o}=n;return o>e&&(s=t.sliceString(e,o)+s,o=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let r=this.flat.from+e.index,n=r+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this.matchPos=Xo(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Do.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<\"u\"&&(qo.prototype[Symbol.iterator]=Bo.prototype[Symbol.iterator]=function(){return this});function mS(i){try{return new RegExp(i,of),!0}catch{return!1}}function Xo(i,t){if(t>=i.length)return t;let e=i.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}function tf(i){let t=String(i.state.doc.lineAt(i.state.selection.main.head).number),e=z(\"input\",{class:\"cm-textfield\",name:\"line\",value:t}),r=z(\"form\",{class:\"cm-gotoLine\",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:Lo.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),n())},onsubmit:s=>{s.preventDefault(),n()}},z(\"label\",i.state.phrase(\"Go to line\"),\": \",e),\" \",z(\"button\",{class:\"cm-button\",type:\"submit\"},i.state.phrase(\"go\")));function n(){let s=/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:o}=i,l=o.doc.lineAt(o.selection.main.head),[,a,h,f,c]=s,u=f?+f.slice(1):0,d=h?+h:l.number;if(h&&c){let g=d/100;a&&(g=g*(a==\"-\"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a==\"-\"?-1:1)+l.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),O=b.cursor(m.from+Math.max(0,Math.min(u,m.length)));i.dispatch({effects:[Lo.of(!1),T.scrollIntoView(O.from,{y:\"center\"})],selection:O}),i.focus()}return{dom:r}}var Lo=M.define(),Um=it.define({create(){return!0},update(i,t){for(let e of t.effects)e.is(Lo)&&(i=e.value);return i},provide:i=>fi.from(i,t=>t?tf:null)}),gS=i=>{let t=ci(i,tf);if(!t){let e=[Lo.of(!0)];i.state.field(Um,!1)==null&&e.push(M.appendConfig.of([Um,OS])),i.dispatch({effects:e}),t=ci(i,tf)}return t&&t.dom.querySelector(\"input\").select(),!0},OS=T.baseTheme({\".cm-panel.cm-gotoLine\":{padding:\"2px 6px 4px\",\"& label\":{fontSize:\"80%\"}}}),xS={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tg=A.define({combine(i){return kt(i,xS,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}});function eg(i){let t=[vS,wS];return i&&t.push(tg.of(i)),t}var yS=R.mark({class:\"cm-selectionMatch\"}),bS=R.mark({class:\"cm-selectionMatch cm-selectionMatch-main\"});function jm(i,t,e,r){return(e==0||i(t.sliceDoc(e-1,e))!=F.Word)&&(r==t.doc.length||i(t.sliceDoc(r,r+1))!=F.Word)}function SS(i,t,e,r){return i(t.sliceDoc(e,e+1))==F.Word&&i(t.sliceDoc(r-1,r))==F.Word}var wS=ft.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=i.state.facet(tg),{state:e}=i,r=e.selection;if(r.ranges.length>1)return R.none;let n=r.main,s,o=null;if(n.empty){if(!t.highlightWordAroundCursor)return R.none;let a=e.wordAt(n.head);if(!a)return R.none;o=e.charCategorizer(n.head),s=e.sliceDoc(a.from,a.to)}else{let a=n.to-n.from;if(a200)return R.none;if(t.wholeWords){if(s=e.sliceDoc(n.from,n.to),o=e.charCategorizer(n.head),!(jm(o,e,n.from,n.to)&&SS(o,e,n.from,n.to)))return R.none}else if(s=e.sliceDoc(n.from,n.to),!s)return R.none}let l=[];for(let a of i.visibleRanges){let h=new ti(e.doc,s,a.from,a.to);for(;!h.next().done;){let{from:f,to:c}=h.value;if((!o||jm(o,e,f,c))&&(n.empty&&f<=n.from&&c>=n.to?l.push(bS.range(f,c)):(f>=n.to||c<=n.from)&&l.push(yS.range(f,c)),l.length>t.maxMatches))return R.none}}return R.set(l)}},{decorations:i=>i.decorations}),vS=T.baseTheme({\".cm-selectionMatch\":{backgroundColor:\"#99ff7780\"},\".cm-searchMatch .cm-selectionMatch\":{backgroundColor:\"transparent\"}}),kS=({state:i,dispatch:t})=>{let{selection:e}=i,r=b.create(e.ranges.map(n=>i.wordAt(n.head)||b.cursor(n.head)),e.mainIndex);return r.eq(e)?!1:(t(i.update({selection:r})),!0)};function TS(i,t){let{main:e,ranges:r}=i.selection,n=i.wordAt(e.head),s=n&&n.from==e.from&&n.to==e.to;for(let o=!1,l=new ti(i.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ti(i.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var PS=({state:i,dispatch:t})=>{let{ranges:e}=i.selection;if(e.some(s=>s.from===s.to))return kS({state:i,dispatch:t});let r=i.sliceDoc(e[0].from,e[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=r))return!1;let n=TS(i,r);return n?(t(i.update({selection:i.selection.addRange(b.range(n.from,n.to),!1),effects:T.scrollIntoView(n.to)})),!0):!1},rr=A.define({combine(i){return kt(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new sf(t),scrollToMatch:t=>T.scrollIntoView(t)})}});var Vo=class{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||\"\",this.valid=!!this.search&&(!this.regexp||mS(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\\\([nrt\\\\])/g,(e,r)=>r==\"n\"?`\n`:r==\"r\"?\"\\r\":r==\"t\"?\"\t\":\"\\\\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new rf(this):new ef(this)}getCursor(t,e=0,r){let n=t.doc?t:Y.create({doc:t});return r==null&&(r=n.doc.length),this.regexp?ir(this,n,e,r):er(this,n,e,r)}},Wo=class{constructor(t){this.spec=t}};function er(i,t,e,r){return new ti(t.doc,i.unquoted,e,r,i.caseSensitive?void 0:n=>n.toLowerCase(),i.wholeWord?CS(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function CS(i,t){return(e,r,n,s)=>((s>e||s+n.length=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=er(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function ir(i,t,e,r){return new qo(t.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?AS(t.charCategorizer(t.selection.main.head)):void 0},e,r)}function Io(i,t){return i.slice(at(i,t,!1),t)}function No(i,t){return i.slice(t,at(i,t))}function AS(i){return(t,e,r)=>!r[0].length||(i(Io(r.input,r.index))!=F.Word||i(No(r.input,r.index))!=F.Word)&&(i(No(r.input,r.index+r[0].length))!=F.Word||i(Io(r.input,r.index+r[0].length))!=F.Word)}var rf=class extends Wo{nextMatch(t,e,r){let n=ir(this.spec,t,r,t.doc.length).next();return n.done&&(n=ir(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,r){for(let n=1;;n++){let s=Math.max(e,r-n*1e4),o=ir(this.spec,t,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==e||l.from>s+10))return l;if(s==e)return null}}prevMatch(t,e,r){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\\$([$&\\d+])/g,(e,r)=>r==\"$\"?\"$\":r==\"&\"?t.match[0]:r!=\"0\"&&+r=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=ir(this.spec,t,Math.max(0,e-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},gn=M.define(),lf=M.define(),Je=it.define({create(i){return new mn(nf(i).create(),null)},update(i,t){for(let e of t.effects)e.is(gn)?i=new mn(e.value.create(),i.panel):e.is(lf)&&(i=new mn(i.query,e.value?af:null));return i},provide:i=>fi.from(i,t=>t.panel)});var mn=class{constructor(t,e){this.query=t,this.panel=e}},QS=R.mark({class:\"cm-searchMatch\"}),RS=R.mark({class:\"cm-searchMatch cm-searchMatch-selected\"}),MS=ft.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Je))}update(i){let t=i.state.field(Je);(t!=i.startState.field(Je)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:i,panel:t}){if(!t||!i.spec.valid)return R.none;let{view:e}=this,r=new Ee;for(let n=0,s=e.visibleRanges,o=s.length;ns[n+1].from-2*250;)a=s[++n].to;i.highlight(e.state,l,a,(h,f)=>{let c=e.state.selection.ranges.some(u=>u.from==h&&u.to==f);r.add(h,f,c?RS:QS)})}return r.finish()}},{decorations:i=>i.decorations});function On(i){return t=>{let e=t.state.field(Je,!1);return e&&e.query.spec.valid?i(t,e):ng(t)}}var Yo=On((i,{query:t})=>{let{to:e}=i.state.selection.main,r=t.nextMatch(i.state,e,e);if(!r)return!1;let n=b.single(r.from,r.to),s=i.state.facet(rr);return i.dispatch({selection:n,effects:[hf(i,r),s.scrollToMatch(n.main,i)],userEvent:\"select.search\"}),rg(i),!0}),zo=On((i,{query:t})=>{let{state:e}=i,{from:r}=e.selection.main,n=t.prevMatch(e,r,r);if(!n)return!1;let s=b.single(n.from,n.to),o=i.state.facet(rr);return i.dispatch({selection:s,effects:[hf(i,n),o.scrollToMatch(s.main,i)],userEvent:\"select.search\"}),rg(i),!0}),ES=On((i,{query:t})=>{let e=t.matchAll(i.state,1e3);return!e||!e.length?!1:(i.dispatch({selection:b.create(e.map(r=>b.range(r.from,r.to))),userEvent:\"select.search.matches\"}),!0)}),$S=({state:i,dispatch:t})=>{let e=i.selection;if(e.ranges.length>1||e.main.empty)return!1;let{from:r,to:n}=e.main,s=[],o=0;for(let l=new ti(i.doc,i.sliceDoc(r,n));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(b.range(l.value.from,l.value.to))}return t(i.update({selection:b.create(s,o),userEvent:\"select.search.matches\"})),!0},Km=On((i,{query:t})=>{let{state:e}=i,{from:r,to:n}=e.selection.main;if(e.readOnly)return!1;let s=t.nextMatch(e,r,r);if(!s)return!1;let o=[],l,a,h=[];if(s.from==r&&s.to==n&&(a=e.toText(t.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(e,s.from,s.to),h.push(T.announce.of(e.phrase(\"replaced match on line $\",e.doc.lineAt(r).number)+\".\"))),s){let f=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=b.single(s.from-f,s.to-f),h.push(hf(i,s)),h.push(e.facet(rr).scrollToMatch(l.main,i))}return i.dispatch({changes:o,selection:l,effects:h,userEvent:\"input.replace\"}),!0}),qS=On((i,{query:t})=>{if(i.state.readOnly)return!1;let e=t.matchAll(i.state,1e9).map(n=>{let{from:s,to:o}=n;return{from:s,to:o,insert:t.getReplacement(n)}});if(!e.length)return!1;let r=i.state.phrase(\"replaced $ matches\",e.length)+\".\";return i.dispatch({changes:e,effects:T.announce.of(r),userEvent:\"input.replace.all\"}),!0});function af(i){return i.state.facet(rr).createPanel(i)}function nf(i,t){var e,r,n,s,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?\"\":i.sliceDoc(l.from,l.to);if(t&&!a)return t;let h=i.facet(rr);return new Vo({search:((e=t?.literal)!==null&&e!==void 0?e:h.literal)?a:a.replace(/\\n/g,\"\\\\n\"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(n=t?.literal)!==null&&n!==void 0?n:h.literal,regexp:(s=t?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=t?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function ig(i){let t=ci(i,af);return t&&t.dom.querySelector(\"[main-field]\")}function rg(i){let t=ig(i);t&&t==i.root.activeElement&&t.select()}var ng=i=>{let t=i.state.field(Je,!1);if(t&&t.panel){let e=ig(i);if(e&&e!=i.root.activeElement){let r=nf(i.state,t.query.spec);r.valid&&i.dispatch({effects:gn.of(r)}),e.focus(),e.select()}}else i.dispatch({effects:[lf.of(!0),t?gn.of(nf(i.state,t.query.spec)):M.appendConfig.of(BS)]});return!0},sg=i=>{let t=i.state.field(Je,!1);if(!t||!t.panel)return!1;let e=ci(i,af);return e&&e.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:lf.of(!1)}),!0},Zo=[{key:\"Mod-f\",run:ng,scope:\"editor search-panel\"},{key:\"F3\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Mod-g\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Escape\",run:sg,scope:\"editor search-panel\"},{key:\"Mod-Shift-l\",run:$S},{key:\"Mod-Alt-g\",run:gS},{key:\"Mod-d\",run:PS,preventDefault:!0}],sf=class{constructor(t){this.view=t;let e=this.query=t.state.field(Je).query.spec;this.commit=this.commit.bind(this),this.searchField=z(\"input\",{value:e.search,placeholder:zt(t,\"Find\"),\"aria-label\":zt(t,\"Find\"),class:\"cm-textfield\",name:\"search\",form:\"\",\"main-field\":\"true\",onchange:this.commit,onkeyup:this.commit}),this.replaceField=z(\"input\",{value:e.replace,placeholder:zt(t,\"Replace\"),\"aria-label\":zt(t,\"Replace\"),class:\"cm-textfield\",name:\"replace\",form:\"\",onchange:this.commit,onkeyup:this.commit}),this.caseField=z(\"input\",{type:\"checkbox\",name:\"case\",form:\"\",checked:e.caseSensitive,onchange:this.commit}),this.reField=z(\"input\",{type:\"checkbox\",name:\"re\",form:\"\",checked:e.regexp,onchange:this.commit}),this.wordField=z(\"input\",{type:\"checkbox\",name:\"word\",form:\"\",checked:e.wholeWord,onchange:this.commit});function r(n,s,o){return z(\"button\",{class:\"cm-button\",name:n,onclick:s,type:\"button\"},o)}this.dom=z(\"div\",{onkeydown:n=>this.keydown(n),class:\"cm-search\"},[this.searchField,r(\"next\",()=>Yo(t),[zt(t,\"next\")]),r(\"prev\",()=>zo(t),[zt(t,\"previous\")]),r(\"select\",()=>ES(t),[zt(t,\"all\")]),z(\"label\",null,[this.caseField,zt(t,\"match case\")]),z(\"label\",null,[this.reField,zt(t,\"regexp\")]),z(\"label\",null,[this.wordField,zt(t,\"by word\")]),...t.state.readOnly?[]:[z(\"br\"),this.replaceField,r(\"replace\",()=>Km(t),[zt(t,\"replace\")]),r(\"replaceAll\",()=>qS(t),[zt(t,\"replace all\")])],z(\"button\",{name:\"close\",onclick:()=>sg(t),\"aria-label\":zt(t,\"close\"),type:\"button\"},[\"\\xD7\"])])}commit(){let t=new Vo({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:gn.of(t)}))}keydown(t){qd(this.view,t,\"search-panel\")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?zo:Yo)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Km(this.view))}update(t){for(let e of t.transactions)for(let r of e.effects)r.is(gn)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(rr).top}};function zt(i,t){return i.state.phrase(t)}var Eo=30,$o=/[\\s\\.,:;?!]/;function hf(i,{from:t,to:e}){let r=i.state.doc.lineAt(t),n=i.state.doc.lineAt(e).to,s=Math.max(r.from,t-Eo),o=Math.min(n,e+Eo),l=i.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;al.length-Eo;a--)if(!$o.test(l[a-1])&&$o.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${i.state.phrase(\"current match\")}. ${l} ${i.state.phrase(\"on line\")} ${r.number}.`)}var DS=T.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\"}}),BS=[Je,ie.low(MS),DS];var fc={};uO(fc,{VERSION:()=>Fo,after:()=>_f,all:()=>cl,allKeys:()=>he,any:()=>ul,assign:()=>ki,before:()=>qn,bind:()=>sl,bindAll:()=>Eg,chain:()=>Wf,chunk:()=>hc,clone:()=>Rf,collect:()=>Dt,compact:()=>nc,compose:()=>Ff,constant:()=>wn,contains:()=>Qt,countBy:()=>Lg,create:()=>Qf,debounce:()=>zf,default:()=>zg,defaults:()=>il,defer:()=>ll,delay:()=>ol,detect:()=>ur,difference:()=>pl,drop:()=>Ri,each:()=>xt,escape:()=>Ag,every:()=>cl,extend:()=>el,extendOwn:()=>ki,filter:()=>te,find:()=>ur,findIndex:()=>cr,findKey:()=>Dn,findLastIndex:()=>al,findWhere:()=>Gf,first:()=>zn,flatten:()=>sc,foldl:()=>fl,foldr:()=>Hf,forEach:()=>xt,functions:()=>ar,get:()=>Qn,groupBy:()=>Bg,has:()=>Ef,head:()=>zn,identity:()=>Pi,include:()=>Qt,includes:()=>Qt,indexBy:()=>Xg,indexOf:()=>hl,initial:()=>Yn,inject:()=>fl,intersection:()=>oc,invert:()=>Cn,invoke:()=>Dg,isArguments:()=>or,isArray:()=>$t,isArrayBuffer:()=>jo,isBoolean:()=>bn,isDataView:()=>Si,isDate:()=>dg,isElement:()=>xf,isEmpty:()=>wf,isEqual:()=>kf,isError:()=>mg,isFinite:()=>Sf,isFunction:()=>K,isMap:()=>kg,isMatch:()=>Pn,isNaN:()=>Sn,isNull:()=>Of,isNumber:()=>Ho,isObject:()=>At,isRegExp:()=>pg,isSet:()=>Pg,isString:()=>nr,isSymbol:()=>Uo,isTypedArray:()=>Jo,isUndefined:()=>yn,isWeakMap:()=>Tg,isWeakSet:()=>Cg,iteratee:()=>hr,keys:()=>X,last:()=>rc,lastIndexOf:()=>qg,map:()=>Dt,mapObject:()=>$f,matcher:()=>Qe,matches:()=>Qe,max:()=>Wn,memoize:()=>Nf,methods:()=>ar,min:()=>Kf,mixin:()=>Zn,negate:()=>Ai,noop:()=>Mn,now:()=>ei,object:()=>lc,omit:()=>Wg,once:()=>$g,pairs:()=>Af,partial:()=>ii,partition:()=>Vg,pick:()=>dl,pluck:()=>Qi,property:()=>Ci,propertyOf:()=>qf,random:()=>fr,range:()=>ac,reduce:()=>fl,reduceRight:()=>Hf,reject:()=>Uf,rest:()=>Ri,restArguments:()=>H,result:()=>Lf,sample:()=>Nn,select:()=>te,shuffle:()=>Jf,size:()=>ec,some:()=>ul,sortBy:()=>tc,sortedIndex:()=>Xn,tail:()=>Ri,take:()=>zn,tap:()=>Mf,template:()=>Xf,templateSettings:()=>Mg,throttle:()=>Yf,times:()=>Df,toArray:()=>In,toPath:()=>rl,transpose:()=>pr,unescape:()=>Rg,union:()=>Ng,uniq:()=>dr,unique:()=>dr,uniqueId:()=>Vf,unzip:()=>pr,values:()=>Zt,where:()=>jf,without:()=>Ig,wrap:()=>Zf,zip:()=>Yg});var Fo=\"1.13.6\",ff=typeof self==\"object\"&&self.self===self&&self||typeof global==\"object\"&&global.global===global&&global||Function(\"return this\")()||{},xn=Array.prototype,_o=Object.prototype,cf=typeof Symbol<\"u\"?Symbol.prototype:null,og=xn.push,Ae=xn.slice,Xe=_o.toString,lg=_o.hasOwnProperty,uf=typeof ArrayBuffer<\"u\",ag=typeof DataView<\"u\",hg=Array.isArray,df=Object.keys,pf=Object.create,mf=uf&&ArrayBuffer.isView,fg=isNaN,cg=isFinite,Go=!{toString:null}.propertyIsEnumerable(\"toString\"),gf=[\"valueOf\",\"isPrototypeOf\",\"toString\",\"propertyIsEnumerable\",\"hasOwnProperty\",\"toLocaleString\"],ug=Math.pow(2,53)-1;function H(i,t){return t=t==null?i.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),n=0;n=0&&e<=ug}}function kn(i){return function(t){return t?.[i]}}var wi=kn(\"byteLength\");var Og=vn(wi);var WS=/\\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\\]/;function IS(i){return mf?mf(i)&&!Si(i):Og(i)&&WS.test(Xe.call(i))}var Jo=uf?IS:wn(!1);var J=kn(\"length\");function NS(i){for(var t={},e=i.length,r=0;r\":\">\",'\"':\""\",\"'\":\"'\",\"`\":\"`\"};var Ag=En(nl);var Qg=Cn(nl);var Rg=En(Qg);var Mg=$.templateSettings={evaluate:/<%([\\s\\S]+?)%>/g,interpolate:/<%=([\\s\\S]+?)%>/g,escape:/<%-([\\s\\S]+?)%>/g};var Bf=/(.)^/,zS={\"'\":\"'\",\"\\\\\":\"\\\\\",\"\\r\":\"r\",\"\\n\":\"n\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},ZS=/\\\\|'|\\r|\\n|\\u2028|\\u2029/g;function FS(i){return\"\\\\\"+zS[i]}var _S=/^\\s*(\\w|\\$)+\\s*$/;function Xf(i,t,e){!t&&e&&(t=e),t=il({},t,$.templateSettings);var r=RegExp([(t.escape||Bf).source,(t.interpolate||Bf).source,(t.evaluate||Bf).source].join(\"|\")+\"|$\",\"g\"),n=0,s=\"__p+='\";i.replace(r,function(h,f,c,u,d){return s+=i.slice(n,d).replace(ZS,FS),n=d+h.length,f?s+=`'+\n((__t=(`+f+`))==null?'':_.escape(__t))+\n'`:c?s+=`'+\n((__t=(`+c+`))==null?'':__t)+\n'`:u&&(s+=`';\n`+u+`\n__p+='`),h}),s+=`';\n`;var o=t.variable;if(o){if(!_S.test(o))throw new Error(\"variable is not a bare identifier: \"+o)}else s=`with(obj||{}){\n`+s+`}\n`,o=\"obj\";s=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n`+s+`return __p;\n`;var l;try{l=new Function(o,\"_\",s)}catch(h){throw h.source=s,h}var a=function(h){return l.call(this,h,$)};return a.source=\"function(\"+o+`){\n`+s+\"}\",a}function Lf(i,t,e){t=fe(t);var r=t.length;if(!r)return K(e)?e.call(i):e;for(var n=0;n1)qt(l,t-1,e,r),n=r.length;else for(var a=0,h=l.length;at?(r&&(clearTimeout(r),r=null),l=f,o=i.apply(n,s),r||(n=s=null)):!r&&e.trailing!==!1&&(r=setTimeout(a,c)),o};return h.cancel=function(){clearTimeout(r),l=0,r=n=s=null},h}function zf(i,t,e){var r,n,s,o,l,a=function(){var f=ei()-n;t>f?r=setTimeout(a,t-f):(r=null,e||(o=i.apply(l,s)),r||(s=l=null))},h=H(function(f){return l=this,s=f,n=ei(),r||(r=setTimeout(a,t),e&&(o=i.apply(l,s))),o});return h.cancel=function(){clearTimeout(r),r=s=l=null},h}function Zf(i,t){return ii(t,i)}function Ai(i){return function(){return!i.apply(this,arguments)}}function Ff(){var i=arguments,t=i.length-1;return function(){for(var e=t,r=i[t].apply(this,arguments);e--;)r=i[e].call(this,r);return r}}function _f(i,t){return function(){if(--i<1)return t.apply(this,arguments)}}function qn(i,t){var e;return function(){return--i>0&&(e=t.apply(this,arguments)),i<=1&&(t=null),e}}var $g=ii(qn,2);function Dn(i,t,e){t=Z(t,e);for(var r=X(i),n,s=0,o=r.length;s0?0:n-1;s>=0&&s0?o=s>=0?s:Math.max(s+l,o):l=s>=0?Math.min(s+1,l):s+l+1;else if(e&&s&&l)return s=e(r,n),r[s]===n?s:-1;if(n!==n)return s=t(Ae.call(r,o,l),Sn),s>=0?s+o:-1;for(s=i>0?o:l-1;s>=0&&s0?0:l-1;for(s||(n=e[o?o[a]:a],a+=i);a>=0&&a=3;return t(e,ce(r,s,4),n,o)}}var fl=Vn(1);var Hf=Vn(-1);function te(i,t,e){var r=[];return t=Z(t,e),xt(i,function(n,s,o){t(n,s,o)&&r.push(n)}),r}function Uf(i,t,e){return te(i,Ai(Z(t)),e)}function cl(i,t,e){t=Z(t,e);for(var r=!tt(i)&&X(i),n=(r||i).length,s=0;s=0}var Dg=H(function(i,t,e){var r,n;return K(t)?n=t:(t=fe(t),r=t.slice(0,-1),t=t[t.length-1]),Dt(i,function(s){var o=n;if(!o){if(r&&r.length&&(s=Ti(s,r)),s==null)return;o=s[t]}return o==null?o:o.apply(s,e)})});function Qi(i,t){return Dt(i,Ci(t))}function jf(i,t){return te(i,Qe(t))}function Wn(i,t,e){var r=-1/0,n=-1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;lr&&(r=s)}else t=Z(t,e),xt(i,function(h,f,c){o=t(h,f,c),(o>n||o===-1/0&&r===-1/0)&&(r=h,n=o)});return r}function Kf(i,t,e){var r=1/0,n=1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;ll||o===void 0)return 1;if(o1&&(r=ce(r,t[1])),t=he(i)):(r=ic,t=qt(t,!1,!1),i=Object(i));for(var n=0,s=t.length;n1&&(r=t[1])):(t=Dt(qt(t,!1,!1),String),e=function(n,s){return!Qt(t,s)}),dl(i,e,r)});function Yn(i,t,e){return Ae.call(i,0,Math.max(0,i.length-(t==null||e?1:t)))}function zn(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[0]:Yn(i,i.length-t)}function Ri(i,t,e){return Ae.call(i,t==null||e?1:t)}function rc(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[i.length-1]:Ri(i,Math.max(0,i.length-t))}function nc(i){return te(i,Boolean)}function sc(i,t){return qt(i,t,!1)}var pl=H(function(i,t){return t=qt(t,!0,!0),te(i,function(e){return!Qt(t,e)})});var Ig=H(function(i,t){return pl(i,t)});function dr(i,t,e,r){bn(t)||(r=e,e=t,t=!1),e!=null&&(e=Z(e,r));for(var n=[],s=[],o=0,l=J(i);o ul > li[aria-selected]\":{backgroundColor:dc,color:gr}}},{dark:!0}),sw=ve.define([{tag:p.keyword,color:Re},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Fg},{tag:[p.variableName],color:Mi},{tag:[p.function(p.variableName)],color:Mi},{tag:[p.labelName],color:JS},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:Re},{tag:[p.definition(p.name),p.separator],color:ml},{tag:[p.brace],color:Mi},{tag:[p.annotation],color:Gg},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:uc},{tag:[p.typeName,p.className],color:cc},{tag:[p.operator,p.operatorKeyword],color:ml},{tag:[p.tagName],color:uc},{tag:[p.squareBracket],color:tw},{tag:[p.angleBracket],color:_g},{tag:[p.attributeName],color:cc},{tag:[p.regexp],color:Re},{tag:[p.quote],color:uc},{tag:[p.string],color:ml},{tag:p.link,color:ml,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Mi},{tag:[p.meta],color:Fg},{tag:[p.monospace],color:Fn,fontStyle:\"italic\"},{tag:[p.comment],color:gr,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:Re},{tag:p.emphasis,fontStyle:\"italic\",color:Re},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:Re},{tag:p.special(p.heading1),fontWeight:\"bold\",color:Re},{tag:p.heading1,fontWeight:\"bold\",color:Re},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Re},{tag:[p.heading5,p.heading6],color:Re},{tag:[p.atom,p.bool,p.special(p.variableName)],color:_g},{tag:[p.processingInstruction,p.inserted],color:Mi},{tag:[p.contentSeparator],color:cc},{tag:p.invalid,color:jg,borderBottom:`1px dotted ${Gg}`}]),Kg=[nw,Te(sw)];var Jg=\"#657b83\",wc=\"#586e75\",gc=\"#073642\",Gn=\"#002b36\",iO=\"#93a1a1\",ow=\"#fdf6e3\",gl=\"#dc322f\",lw=\"#cb4b16\",_n=\"#b58900\",Oc=\"#859900\",xc=\"#2aa198\",yc=\"#268bd2\",aw=\"#6c71c4\",Ol=\"#d33682\",tO=\"#d30102\",vc=\"#dfd9c8\",bc=vc,hw=ow,Sc=wc,fw=vc,eO=wc,cw=T.theme({\"&\":{color:Jg,backgroundColor:hw},\".cm-content\":{caretColor:eO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:eO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:fw},\".cm-panels\":{backgroundColor:vc,color:Gn},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:\"1px solid #457dff\"},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:\"#6199ff2f\"},\".cm-activeLine\":{backgroundColor:bc},\".cm-selectionMatch\":{backgroundColor:\"#aafe661a\"},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${iO}`},\".cm-gutters\":{backgroundColor:\"#00000010\",color:Jg,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:bc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Sc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Sc,borderBottomColor:Sc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:bc,color:Gn}}},{dark:!1}),uw=ve.define([{tag:p.keyword,color:Oc},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:xc},{tag:[p.variableName],color:yc},{tag:[p.function(p.variableName)],color:yc},{tag:[p.labelName],color:Ol},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:_n},{tag:[p.definition(p.name),p.separator],color:xc},{tag:[p.brace],color:Ol},{tag:[p.annotation],color:tO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:Ol},{tag:[p.typeName,p.className],color:lw},{tag:[p.operator,p.operatorKeyword],color:aw},{tag:[p.tagName],color:yc},{tag:[p.squareBracket],color:gl},{tag:[p.angleBracket],color:gc},{tag:[p.attributeName],color:iO},{tag:[p.regexp],color:tO},{tag:[p.quote],color:Oc},{tag:[p.string],color:_n},{tag:p.link,color:xc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:_n},{tag:[p.meta],color:gl},{tag:[p.comment],color:gc,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:wc},{tag:p.emphasis,fontStyle:\"italic\",color:Oc},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:_n},{tag:p.heading1,fontWeight:\"bold\",color:Gn},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Gn},{tag:[p.heading5,p.heading6],color:Gn},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Ol},{tag:[p.processingInstruction,p.inserted,p.contentSeparator],color:gl},{tag:[p.contentSeparator],color:_n},{tag:p.invalid,color:gc,borderBottom:`1px dotted ${gl}`}]),rO=[cw,Te(uw)];var nO=\"#2e3440\",Qc=\"#3b4252\",sO=\"#434c5e\",xl=\"#4c566a\",oO=\"#e5e9f0\",Ac=\"#eceff4\",kc=\"#8fbcbb\",lO=\"#88c0d0\",dw=\"#81a1c1\",ue=\"#5e81ac\",pw=\"#bf616a\",Or=\"#d08770\",Tc=\"#ebcb8b\",aO=\"#a3be8c\",mw=\"#b48ead\",hO=\"#d30102\",Rc=Ac,Pc=Rc,gw=\"#ffffff\",Cc=Qc,Ow=Rc,fO=Qc,xw=T.theme({\"&\":{color:nO,backgroundColor:gw},\".cm-content\":{caretColor:fO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:fO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:Ow},\".cm-panels\":{backgroundColor:Rc,color:xl},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:`1px solid ${xl}`},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:oO},\".cm-activeLine\":{backgroundColor:Pc},\".cm-selectionMatch\":{backgroundColor:oO},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${xl}`},\"&.cm-focused .cm-matchingBracket\":{backgroundColor:Ac},\".cm-gutters\":{backgroundColor:Ac,color:nO,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:Pc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Cc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Cc,borderBottomColor:Cc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:Pc,color:xl}}},{dark:!1}),yw=ve.define([{tag:p.keyword,color:ue},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Or},{tag:[p.variableName],color:Or},{tag:[p.function(p.variableName)],color:ue},{tag:[p.labelName],color:dw},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:ue},{tag:[p.definition(p.name),p.separator],color:aO},{tag:[p.brace],color:kc},{tag:[p.annotation],color:hO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:lO},{tag:[p.typeName,p.className],color:Tc},{tag:[p.operator,p.operatorKeyword],color:aO},{tag:[p.tagName],color:mw},{tag:[p.squareBracket],color:pw},{tag:[p.angleBracket],color:Or},{tag:[p.attributeName],color:Tc},{tag:[p.regexp],color:ue},{tag:[p.quote],color:Qc},{tag:[p.string],color:Or},{tag:p.link,color:kc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Or},{tag:[p.meta],color:lO},{tag:[p.comment],color:sO,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:ue},{tag:p.emphasis,fontStyle:\"italic\",color:ue},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:ue},{tag:p.special(p.heading1),fontWeight:\"bold\",color:ue},{tag:p.heading1,fontWeight:\"bold\",color:ue},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:ue},{tag:[p.heading5,p.heading6],color:ue},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Or},{tag:[p.processingInstruction,p.inserted],color:kc},{tag:[p.contentSeparator],color:Tc},{tag:p.invalid,color:sO,borderBottom:`1px dotted ${hO}`}]),Hn=[xw,Te(yw)];var hq={initialize({model:i}){},render({model:i,el:t}){var e=i.get(\"widget_instance_count_trait\");i.attributes={function_body_id:e};let r=\"\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "\n", - "function_body": "import numpy as np\nreturn np.cos(arr) # oops! wrong solution\n", - "function_name": "sinus", - "function_parameters": "arr", - "layout": "IPY_MODEL_6cf725cebd7d489998711ee7e13bbfe1", - "name": "", - "widget_instance_count_trait": "1" - } - }, - "5fe8a519a49c416fa693ff86ee252925": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "60ff0683a70e4a22b10bc015997e0850": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "6279ce1cf3c442579fc5efade187ceb9": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "644322733ba1418384d4da90f5fd4d52": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "height": "auto", - "width": "98%" - } - }, - "64aeb918f5d447df9c2b61011d84ab06": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-update-cue-box", - "scwidget-update-cue-box--cue" - ], - "children": [ - "IPY_MODEL_51c3f8e31b5f493f93487d29001d0833" - ], - "layout": "IPY_MODEL_60ff0683a70e4a22b10bc015997e0850" - } - }, - "64af7bdbdd0e4867867dfc93cc71441d": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-check-reset-cue-button" - ], - "description": "Check Code", - "layout": "IPY_MODEL_22ef2c6051944949b3c31c9d61b726dd", - "style": "IPY_MODEL_577ee11e411f4d37ae823d5212a4e2cb", - "tooltip": null - } - }, - "696d1bd96b1243679f7b14b194f29b13": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "6a8962735e1c40ebadd312e6128060fc": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLStyleModel", - "state": { - "description_width": "", - "font_size": null, - "text_color": null - } - }, - "6cf725cebd7d489998711ee7e13bbfe1": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "6d8a674a2f364810ae85eb2f0a548bfb": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "BoxModel", - "state": { - "layout": "IPY_MODEL_6ddb1a0189fd470ea86d13cad08525d6" - } - }, - "6ddb1a0189fd470ea86d13cad08525d6": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "6e79551ea44547c1b467dafe42d51ebb": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLStyleModel", - "state": { - "description_width": "", - "font_size": null, - "text_color": null - } - }, - "71ad7b23d9c64a55871fcb1010dadfdc": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "width": "100%" - } - }, - "733df51db84a415a83e8765547fb7c3c": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "74e3b2e264bd41049127ef6e85cac873": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "7540524adf724ddcbc40bf0e2c43fcde": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "justify_content": "space-between" - } - }, - "79397cd8904d44f0b32d0c8adc73fd0b": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "BoxModel", - "state": { - "layout": "IPY_MODEL_a1f5a97a9fcf47caaaabfbb53f7fcc06" - } - }, - "7f0642279f664162a1e020bfbd4fa9df": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_31655ef59b1f412680b6ada9bb910b31", - "IPY_MODEL_79397cd8904d44f0b32d0c8adc73fd0b" - ], - "layout": "IPY_MODEL_ed5e3fbefd2249de86cd5e64542387d2" - } - }, - "7fb394634b424c6ba69c53d9a495905b": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "8269507afc4f4942bc0eecfc6d3abb84": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "87125a64854042578f07df8a47bf40d4": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-check-cue-box" - ], - "children": [ - "IPY_MODEL_c753c8eed57842c395c8f95da365823e" - ], - "layout": "IPY_MODEL_d3b0e468f0454f77bf8fe1ea953cdded" - } - }, - "891037a969c54382a0123c65b3adabe6": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "89c8420829d14cf38ba8814f5ce01ac5": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "8a1bdf4aff0543a79cc616fe64ae84cd": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "height": "auto", - "width": "98%" - } - }, - "8f56636a69404858a0d3bafd7e3efe8c": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "94a080c3594942958cfbe1be2c1cf21e": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-update-cue-box", - "scwidget-update-cue-box--cue" - ], - "children": [ - "IPY_MODEL_cb3d77260a544aa68299e09578d1394a" - ], - "layout": "IPY_MODEL_51f3e350b5684d9cb19536e536f3e880" - } - }, - "94c62592c839431994f1272a65a6f037": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "height": "auto", - "width": "98%" - } - }, - "94e88484841a47eb908503ff0264ce2b": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "99b4520ba0904061a468add1eeb34f53": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLModel", - "state": { - "_dom_classes": [ - "exercise-title" - ], - "layout": "IPY_MODEL_b0b5236bc72342e5a4b4f664aacce2d8", - "style": "IPY_MODEL_ce893ef3da2549969b84af55600cf08d", - "value": "sinus_with_references_1" - } - }, - "9dc0f6b5e51647e29e36f7f57a5bcc39": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_d8131b64c014484b8382217bdf43dafa", - "IPY_MODEL_64aeb918f5d447df9c2b61011d84ab06", - "IPY_MODEL_d7dab1ae26b1473fba6b27605bd8da09", - "IPY_MODEL_5c94c6779781453badd89780ac751951" - ], - "layout": "IPY_MODEL_0337f381b29c4e3c805ff9ffb5a9b2a8" - } - }, - "9ffff3e1909748abae87c70a29b53198": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLStyleModel", - "state": { - "description_width": "", - "font_size": null, - "text_color": null - } - }, - "a1431e60339b404a89d8626a9cb32342": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "a1811e47ed544760abda82d70cdca540": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_0daa68dfd6d7467189ef3ea15cd4ad1f", - "IPY_MODEL_29739bc796084416b6d6adaba107d62f", - "IPY_MODEL_b5922ef55f3c430eb5884e706de271a0", - "IPY_MODEL_33bd7f68cb0e455b8bab39fc14baf658" - ], - "layout": "IPY_MODEL_f391d15811e44e1d9070f4a058117d85" - } - }, - "a1f5a97a9fcf47caaaabfbb53f7fcc06": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "a5ec86bdafc546cbbff2dc4661ffe636": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "_dom_classes": [ - "scwidget-cue-output" - ], - "layout": "IPY_MODEL_17301104e40f42af9a5f19cd0122f542", - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": "\u001b[1m\u001b[31mCheck failed\u001b[0m\n\u001b[1m\u001b[31m------------\u001b[0m\n\u001b[91mmy_assert_allclose failed\u001b[0m\u001b[91m for\n\u001b[0m\u001b[91m|\u001b[0m \u001b[94marr\u001b[0m: array([0. , 3.14159265, 6.28318531])\n\u001b[91m|\u001b[0m \u001b[91mYour output is not close to the references.\u001b[0m\n" - } - ] - } - }, - "b0b5236bc72342e5a4b4f664aacce2d8": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "b5922ef55f3c430eb5884e706de271a0": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_20e1e4e907af4fe3b18d05253755887c", - "IPY_MODEL_6d8a674a2f364810ae85eb2f0a548bfb" - ], - "layout": "IPY_MODEL_019262491e3d4a8a9487914aa611748e" - } - }, - "b812bd0bb5b94ff798b88dccf0a2e399": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "description": "Check all widgets", - "layout": "IPY_MODEL_14f0ac80b7ca44f5b9eceaa552a88588", - "style": "IPY_MODEL_2bba4cc578b14b9eaf66729cd9bd71c6", - "tooltip": null - } - }, - "bdddd623c70e4aca8e6584045e9c2cdc": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-update-reset-cue-button--cue", - "scwidget-update-reset-cue-button" - ], - "description": "Run Code", - "layout": "IPY_MODEL_d26d85bf19ab45379cd0fec8bc618bf5", - "style": "IPY_MODEL_74e3b2e264bd41049127ef6e85cac873", - "tooltip": null - } - }, - "c5d05cb4e9df482da033b9558c420763": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "c73eebb402f14d05bfa5f173a08bd91e": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "c753c8eed57842c395c8f95da365823e": { - "model_module": "anywidget", - "model_module_version": "~0.9.*", - "model_name": "AnyModel", - "state": { - "_anywidget_id": "scwidgets.code._widget_code_input.CodeInput", - "_css": ".forced-indent{width:4em}.CodeMirror{border:1px solid #fff;height:auto}.CodeMirror.widget-code-input-signature{border-bottom:0px}.CodeMirror.widget-code-input-docstring,.CodeMirror.widget-code-input-body{border-top:0px}\n", - "_esm": "var cO=Object.defineProperty;var uO=(i,t)=>{for(var e in t)cO(i,e,{get:t[e],enumerable:!0})};var V=class i{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,r){[t,e]=Li(this,t,e);let n=[];return this.decompose(0,t,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(e,this.length,n,1),qi.from(n,this.length-(e-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Li(this,t,e);let r=[];return this.decompose(t,e,r,0),qi.from(r,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),n=new oi(this),s=new oi(t);for(let o=e,l=e;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=r)return!0}}iter(t=1){return new oi(this,t)}iterRange(t,e=this.length){return new ts(this,t,e)}iterLines(t,e){let r;if(t==null)r=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;r=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new es(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError(\"A document must have at least one line\");return t.length==1&&!t[0]?i.empty:t.length<=32?new Xt(t):qi.from(Xt.split(t,[]))}},Xt=class i extends V{constructor(t,e=dO(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((e?r:l)>=t)return new bl(n,l,r,o);n=l+1,r++}}decompose(t,e,r,n){let s=t<=0&&e>=this.length?this:new i(Ec(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=r.pop(),l=Jn(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new i(l,o.length+s.length));else{let a=l.length>>1;r.push(new i(l.slice(0,a)),new i(l.slice(a)))}}else r.push(s)}replace(t,e,r){if(!(r instanceof i))return super.replace(t,e,r);[t,e]=Li(this,t,e);let n=Jn(this.text,Jn(r.text,Ec(this.text,0,t)),e),s=this.length+r.length-(e-t);return n.length<=32?new i(n,s):qi.from(i.split(n,[]),s)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;s<=e&&ot&&o&&(n+=r),ts&&(n+=l.slice(Math.max(0,t-s),e-s)),s=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let r=[],n=-1;for(let s of t)r.push(s),n+=s.length+1,r.length==32&&(e.push(new i(r,n)),r=[],n=-1);return n>-1&&e.push(new i(r,n)),e}},qi=class i extends V{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=r+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,r,n);n=l+1,r=a+1}}decompose(t,e,r,n){for(let s=0,o=0;o<=e&&s=o){let h=n&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?r.push(l):l.decompose(t-o,e-o,r,h)}o=a+1}}replace(t,e,r){if([t,e]=Li(this,t,e),r.lines=s&&e<=l){let a=o.replace(t-s,e-s,r),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new i(f,this.length-(e-t)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(t,e,r)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;st&&s&&(n+=r),to&&(n+=l.sliceString(t-o,e-o,r)),o=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let r=0,[n,s,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,s+=e){if(n==o||s==l)return r;let a=this.children[n],h=t.children[s];if(a!=h)return r+a.scanIdentical(h,e);r+=a.length+1}}static from(t,e=t.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let d of t)r+=d.lines;if(r<32){let d=[];for(let m of t)m.flatten(d);return new Xt(d,e)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let m;if(d.lines>s&&d instanceof i)for(let O of d.children)c(O);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Xt&&a&&(m=f[f.length-1])instanceof Xt&&d.lines+m.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new Xt(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:i.from(f,h)),h=-1,a=f.length=0)}for(let d of t)c(d);return u(),l.length==1?l[0]:new i(l,e)}};V.empty=new Xt([\"\"],0);function dO(i){let t=-1;for(let e of i)t+=e.length+1;return t}function Jn(i,t,e=0,r=1e9){for(let n=0,s=0,o=!0;s=e&&(a>r&&(l=l.slice(0,r-n)),n0?1:(t instanceof Xt?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,l=n instanceof Xt?n.text.length:n.children.length;if(o==(e>0?l:0)){if(r==0)return this.done=!0,this.value=\"\",this;e>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(e>0?0:1)){if(this.offsets[r]+=e,t==0)return this.lineBreak=!0,this.value=`\n`,this;t--}else if(n instanceof Xt){let a=n.text[o+(e<0?-1:0)];if(this.offsets[r]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=n.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[r]+=e):(e<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof Xt?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},ts=class{constructor(t,e,r){this.value=\"\",this.done=!1,this.cursor=new oi(t,e>r?-1:1),this.pos=e>r?t.length:0,this.from=Math.min(e,r),this.to=Math.max(e,r)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value=\"\",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let r=e<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=r?n:e<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=\"\"}},es=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value=\"\",this.done=!1}next(t=0){let{done:e,lineBreak:r,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value=\"\",this.afterBreak=!1):e?(this.done=!0,this.value=\"\"):r?this.afterBreak?this.value=\"\":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<\"u\"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},oi.prototype[Symbol.iterator]=ts.prototype[Symbol.iterator]=es.prototype[Symbol.iterator]=function(){return this});var bl=class{constructor(t,e,r,n){this.from=t,this.to=e,this.number=r,this.text=n}get length(){return this.to-this.from}};function Li(i,t,e){return t=Math.max(0,Math.min(i.length,t)),[t,Math.max(t,Math.min(i.length,e))]}var Di=\"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(i=>i?parseInt(i,36):1);for(let i=1;ii)return Di[t-1]<=i;return!1}function $c(i){return i>=127462&&i<=127487}var qc=8205;function at(i,t,e=!0,r=!0){return(e?Wc:mO)(i,t,r)}function Wc(i,t,e){if(t==i.length)return t;t&&Ic(i.charCodeAt(t))&&Nc(i.charCodeAt(t-1))&&t--;let r=dt(i,t);for(t+=wt(r);t=0&&$c(dt(i,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function mO(i,t,e){for(;t>0;){let r=Wc(i,t-2,e);if(r=56320&&i<57344}function Nc(i){return i>=55296&&i<56320}function dt(i,t){let e=i.charCodeAt(t);if(!Nc(e)||t+1==i.length)return e;let r=i.charCodeAt(t+1);return Ic(r)?(e-55296<<10)+(r-56320)+65536:e}function vr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function wt(i){return i<65536?1:2}var Sl=/\\r\\n?|\\n/,ut=function(i){return i[i.Simple=0]=\"Simple\",i[i.TrackDel=1]=\"TrackDel\",i[i.TrackBefore=2]=\"TrackBefore\",i[i.TrackAfter=3]=\"TrackAfter\",i}(ut||(ut={})),Me=class i{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=l}else{if(r!=ut.Simple&&h>=t&&(r==ut.TrackDel&&nt||r==ut.TrackBefore&&nt))return null;if(h>t||h==t&&e<0&&!l)return t==n||e<0?s:s+a;s+=a}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let r=0,n=0;r=0&&n<=e&&l>=t)return ne?\"cover\":!0;n=l}return!1}toString(){let t=\"\";for(let e=0;e=0?\":\"+n:\"\")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=\"number\"))throw new RangeError(\"Invalid JSON representation of ChangeDesc\");return new i(t)}static create(t){return new i(t)}},vt=class i extends Me{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError(\"Applying change set to a document with the wrong length\");return wl(this,(e,r,n,s,o)=>t=t.replace(n,n+(r-e),o),!1),t}mapDesc(t,e=!1){return vl(this,t,e,!0)}invert(t){let e=this.sections.slice(),r=[];for(let n=0,s=0;n=0){e[n]=l,e[n+1]=o;let a=n>>1;for(;r.length0&&Ve(r,e,s.text),s.forward(f),l+=f}let h=t[o++];for(;l>1].toJSON()))}return t}static of(t,e,r){let n=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;ou||c<0||u>e)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${e})`);let m=d?typeof d==\"string\"?V.of(d.split(r||Sl)):d:V.empty,O=m.length;if(c==u&&O==0)return;co&&yt(n,c-o,-1),yt(n,u-c,O),Ve(s,n,m),o=u}}return h(t),a(!l),l}static empty(t){return new i(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError(\"Invalid JSON representation of ChangeSet\");let e=[],r=[];for(let n=0;nl&&typeof o!=\"string\"))throw new RangeError(\"Invalid JSON representation of ChangeSet\");if(s.length==1)e.push(s[0],0);else{for(;r.length=0&&e<=0&&e==i[n+1]?i[n]+=t:t==0&&i[n]==0?i[n+1]+=e:r?(i[n]+=t,i[n+1]+=e):i.push(t,e)}function Ve(i,t,e){if(e.length==0)return;let r=t.length-2>>1;if(r>1])),!(e||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];t(n,h,s,f,c),n=h,s=f}}}function vl(i,t,e,r=!1){let n=[],s=r?[]:null,o=new li(i),l=new li(t);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);yt(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>h),s.forward2(a),o.forward(a)}}}}var li=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?V.empty:t[e]}textBit(t){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length&&!t?V.empty:e[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},$i=class i{constructor(t,e,r){this.from=t,this.to=e,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let r,n;return this.empty?r=n=t.mapPos(this.from,e):(r=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return b.range(t,e);let r=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return b.range(this.anchor,r)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!=\"number\"||typeof t.head!=\"number\")throw new RangeError(\"Invalid JSON representation for SelectionRange\");return b.range(t.anchor,t.head)}static create(t,e,r){return new i(t,e,r)}},b=class i{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:i.create(this.ranges.map(r=>r.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;rt.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=\"number\"||t.main>=t.ranges.length)throw new RangeError(\"Invalid JSON representation for EditorSelection\");return new i(t.ranges.map(e=>$i.fromJSON(e)),t.main)}static single(t,e=t){return new i([i.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError(\"A selection needs at least one range\");for(let r=0,n=0;nt?8:0)|s)}static normalized(t,e=0){let r=t[e];t.sort((n,s)=>n.from-s.from),e=t.indexOf(r);for(let n=1;ns.head?i.range(a,l):i.range(l,a))}}return new i(t,e)}};function zc(i,t){for(let e of i.ranges)if(e.to>t)throw new RangeError(\"Selection points outside of document\")}var $l=0,A=class i{constructor(t,e,r,n,s){this.combine=t,this.compareInput=e,this.compare=r,this.isStatic=n,this.id=$l++,this.default=t([]),this.extensions=typeof s==\"function\"?s(this):s}get reader(){return this}static define(t={}){return new i(t.combine||(e=>e),t.compareInput||((e,r)=>e===r),t.compare||(t.combine?(e,r)=>e===r:ql),!!t.static,t.enables)}of(t){return new Bi([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,2,e)}from(t,e){return e||(e=r=>r),this.compute([t],r=>e(r.field(t)))}};function ql(i,t){return i==t||i.length==t.length&&i.every((e,r)=>e===t[r])}var Bi=class{constructor(t,e,r,n){this.dependencies=t,this.facet=e,this.type=r,this.value=n,this.id=$l++}dynamicSlot(t){var e;let r=this.value,n=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c==\"doc\"?a=!0:c==\"selection\"?h=!0:((e=t[c.id])!==null&&e!==void 0?e:1)&1||f.push(t[c.id]);return{create(c){return c.values[o]=r(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||kl(c,f)){let d=r(c);if(l?!Dc(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,m=u.config.address[s];if(m!=null){let O=ns(u,m);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===c.facet(g):g instanceof it?u.field(g,!1)==c.field(g,!1):!0)||(l?Dc(d=r(c),O,n):n(d=r(c),O)))return c.values[o]=O,0}else d=r(c);return c.values[o]=d,1}}}};function Dc(i,t,e){if(i.length!=t.length)return!1;for(let r=0;ri[a.id]),n=e.map(a=>a.type),s=r.filter(a=>!(a&1)),o=i[t.id]>>1;function l(a){let h=[];for(let f=0;fr===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Bc).find(r=>r.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:r=>(r.values[e]=this.create(r),1),update:(r,n)=>{let s=r.values[e],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[e]=o,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[e]=n.field(this),0):(r.values[e]=this.create(r),1)}}init(t){return[this,Bc.of({field:this,create:t})]}get extension(){return this}},ni={lowest:4,low:3,default:2,high:1,highest:0};function xr(i){return t=>new is(t,i)}var ie={highest:xr(ni.highest),high:xr(ni.high),default:xr(ni.default),low:xr(ni.low),lowest:xr(ni.lowest)},is=class{constructor(t,e){this.inner=t,this.prec=e}},pe=class i{of(t){return new br(this,t)}reconfigure(t){return i.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},br=class{constructor(t,e){this.compartment=t,this.inner=e}},rs=class i{constructor(t,e,r,n,s,o){for(this.base=t,this.compartments=e,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,r){let n=[],s=Object.create(null),o=new Map;for(let u of OO(t,e,o))u instanceof it?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=r?.config.facets;for(let u in s){let d=s[u],m=d[0].facet,O=f&&f[u]||[];if(d.every(g=>g.type==0))if(l[m.id]=a.length<<1|1,ql(O,d))a.push(r.facet(m));else{let g=m.combine(d.map(x=>x.value));a.push(r&&m.compare(g,r.facet(m))?r.facet(m):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(x=>g.dynamicSlot(x)));l[m.id]=h.length<<1,h.push(g=>gO(g,m,d))}}let c=h.map(u=>u(l));return new i(t,o,c,l,a,s)}};function OO(i,t,e){let r=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=r[a].indexOf(o);h>-1&&r[a].splice(h,1),o instanceof br&&e.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof br){if(e.has(o.compartment))throw new RangeError(\"Duplicate use of compartment in extensions\");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),s(h,l)}else if(o instanceof is)s(o.inner,o.prec);else if(o instanceof it)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Bi)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,ni.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ni.default),r.reduce((o,l)=>o.concat(l))}function yr(i,t){if(t&1)return 2;let e=t>>1,r=i.status[e];if(r==4)throw new Error(\"Cyclic dependency between fields and/or facets\");if(r&2)return r;i.status[e]=4;let n=i.computeSlot(i,i.config.dynamicSlots[e]);return i.status[e]=2|n}function ns(i,t){return t&1?i.config.staticValues[t>>1]:i.values[t>>1]}var Zc=A.define(),Tl=A.define({combine:i=>i.some(t=>t),static:!0}),Fc=A.define({combine:i=>i.length?i[0]:void 0,static:!0}),_c=A.define(),Gc=A.define(),Hc=A.define(),Uc=A.define({combine:i=>i.length?i[0]:!1}),Et=class{constructor(t,e){this.type=t,this.value=e}static define(){return new Pl}},Pl=class{of(t){return new Et(this,t)}},Cl=class{constructor(t){this.map=t}of(t){return new M(this,t)}},M=class i{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new i(this.type,e)}is(t){return this.type==t}static define(t={}){return new Cl(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let r=[];for(let n of t){let s=n.map(e);s&&r.push(s)}return r}};M.reconfigure=M.define();M.appendConfig=M.define();var lt=class i{constructor(t,e,r,n,s,o){this.startState=t,this.changes=e,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&zc(r,e.newLength),s.some(l=>l.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(t,e,r,n,s,o){return new i(t,e,r,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(i.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]==\".\"))}};lt.time=Et.define();lt.userEvent=Et.define();lt.addToHistory=Et.define();lt.remote=Et.define();function xO(i,t){let e=[];for(let r=0,n=0;;){let s,o;if(r=i[r]))s=i[r++],o=i[r++];else if(n=0;n--){let s=r[n](i);s instanceof lt?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof lt?i=s[0]:i=Kc(t,Xi(s),!1)}return i}function bO(i){let t=i.startState,e=t.facet(Hc),r=i;for(let n=e.length-1;n>=0;n--){let s=e[n](i);s&&Object.keys(s).length&&(r=jc(r,Al(t,s,i.changes.newLength),!0))}return r==i?i:lt.create(t,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var SO=[];function Xi(i){return i==null?SO:Array.isArray(i)?i:[i]}var F=function(i){return i[i.Word=0]=\"Word\",i[i.Space=1]=\"Space\",i[i.Other=2]=\"Other\",i}(F||(F={})),wO=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,Ql;try{Ql=new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\",\"u\")}catch{}function vO(i){if(Ql)return Ql.test(i);for(let t=0;t\"\\x80\"&&(e.toUpperCase()!=e.toLowerCase()||wO.test(e)))return!0}return!1}function kO(i){return t=>{if(!/\\S/.test(t))return F.Space;if(vO(t))return F.Word;for(let e=0;e-1)return F.Word;return F.Other}}var Y=class i{constructor(t,e,r,n,s,o){this.config=t,this.doc=e,this.selection=r,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;ln.set(h,a)),e=null),n.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(e=null,r=l.value):l.is(M.appendConfig)&&(e=null,r=Xi(r).concat(l.value));let s;e?s=t.startState.values.slice():(e=rs.resolve(r,n,this),s=new i(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(Tl)?t.newSelection:t.newSelection.asSingle();new i(e,t.newDoc,o,s,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t==\"string\"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:b.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,r=t(e.ranges[0]),n=this.changes(r.changes),s=[r.range],o=Xi(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return i.create({doc:t.doc,selection:b.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=rs.resolve(t.extensions||[],new Map),r=t.doc instanceof V?t.doc:V.of((t.doc||\"\").split(e.staticFacet(i.lineSeparator)||Sl)),n=t.selection?t.selection instanceof b?t.selection:b.single(t.selection.anchor,t.selection.head):b.single(0);return zc(n,r.length),e.staticFacet(Tl)||(n=n.asSingle()),new i(e,r,n,e.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`\n`}get readOnly(){return this.facet(Uc)}phrase(t,...e){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return e.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(r,n)=>{if(n==\"$\")return\"$\";let s=+(n||1);return!s||s>e.length?r:e[s-1]})),t}languageDataAt(t,e,r=-1){let n=[];for(let s of this.facet(Zc))for(let o of s(this,e,r))Object.prototype.hasOwnProperty.call(o,t)&&n.push(o[t]);return n}charCategorizer(t){return kO(this.languageDataAt(\"wordChars\",t).join(\"\"))}wordAt(t){let{text:e,from:r,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-r,l=t-r;for(;o>0;){let a=at(e,o,!1);if(s(e.slice(a,o))!=F.Word)break;o=a}for(;li.length?i[0]:4});Y.lineSeparator=Fc;Y.readOnly=Uc;Y.phrases=A.define({compare(i,t){let e=Object.keys(i),r=Object.keys(t);return e.length==r.length&&e.every(n=>i[n]==t[n])}});Y.languageData=Zc;Y.changeFilter=_c;Y.transactionFilter=Gc;Y.transactionExtender=Hc;pe.reconfigure=M.define();function kt(i,t,e={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,s))r[s]=e[s](l,o);else throw new Error(\"Config merge conflict for field \"+s)}for(let n in t)r[n]===void 0&&(r[n]=t[n]);return r}var ee=class{eq(t){return this==t}range(t,e=t){return Sr.create(t,e,this)}};ee.prototype.startSide=ee.prototype.endSide=0;ee.prototype.point=!1;ee.prototype.mapMode=ut.TrackDel;var Sr=class i{constructor(t,e,r){this.from=t,this.to=e,this.value=r}static create(t,e,r){return new i(t,e,r)}};function Rl(i,t){return i.from-t.from||i.value.startSide-t.value.startSide}var Ml=class i{constructor(t,e,r,n){this.from=t,this.to=e,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,r,n=0){let s=r?this.to:this.from;for(let o=n,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-t||(r?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,r,n){for(let s=this.findIndex(e,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),r.push(h),n.push(u-o),s.push(d-o))}return{mapped:r.length?new i(n,s,r,l):null,pos:o}}},_=class i{constructor(t,e,r,n){this.chunkPos=t,this.chunk=e,this.nextLayer=r,this.maxPoint=n}static create(t,e,r,n){return new i(t,e,r,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(r&&(e=e.slice().sort(Rl)),this.isEmpty)return e.length?i.of(e):this;let l=new ss(this,null,-1).goto(0),a=0,h=[],f=new Ee;for(;l.value||a=0){let c=e[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+o.length&&o.between(s,t-s,e-s,r)===!1)return}this.nextLayer.between(t,e,r)}}iter(t=0){return wr.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return wr.from(t).goto(e)}static compare(t,e,r,n,s=-1){let o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=Xc(o,l,r),h=new si(o,a,s),f=new si(l,a,s);r.iterGaps((c,u,d)=>Lc(h,c,f,u,d,n)),r.empty&&r.length==0&&Lc(h,0,f,0,0,n)}static eq(t,e,r=0,n){n==null&&(n=999999999);let s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0),o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Xc(s,o),a=new si(s,l,0).goto(r),h=new si(o,l,0).goto(r);for(;;){if(a.to!=h.to||!El(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(t,e,r,n,s=-1){let o=new si(t,null,s).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,r);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(t,e=!1){let r=new Ee;for(let n of t instanceof Sr?[t]:e?TO(t):t)r.add(n.from,n.to,n.value);return r.finish()}static join(t){if(!t.length)return i.empty;let e=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let n=t[r];n!=i.empty;n=n.nextLayer)e=new i(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}};_.empty=new _([],[],null,-1);function TO(i){if(i.length>1)for(let t=i[0],e=1;e0)return i.slice().sort(Rl);t=r}return i}_.empty.nextLayer=_.empty;var Ee=class i{finishChunk(t){this.chunks.push(new Ml(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,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,r){this.addInner(t,e,r)||(this.nextLayer||(this.nextLayer=new i)).add(t,e,r)}addInner(t,e,r){let n=t-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=e,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let r=e.value.length-1;return this.last=e.value[r],this.lastFrom=e.from[r]+t,this.lastTo=e.to[r]+t,!0}finish(){return this.finishInner(_.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=_.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};function Xc(i,t,e){let r=new Map;for(let s of i)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&n.push(new ss(o,e,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let r of this.heap)r.goto(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);return this.next(),this}forward(t,e){for(let r of this.heap)r.forward(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),yl(this.heap,0)}}};function yl(i,t){for(let e=i[t];;){let r=(t<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1=0&&(n=i[r+1],r++),e.compare(n)<0)break;i[r]=e,i[t]=n,t=r}}var si=class{constructor(t,e,r){this.minPoint=r,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=wr.from(t,e,r)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){jn(this.active,t),jn(this.activeTo,t),jn(this.activeRank,t),this.minActive=Vc(this.active,this.activeTo)}addActive(t){let e=0,{value:r,to:n,rank:s}=this.cursor;for(;e0;)e++;Kn(this.active,e,r),Kn(this.activeTo,e,n),Kn(this.activeRank,e,s),t&&Kn(t,e,this.cursor.from),this.minActive=Vc(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&jn(r,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&r[n]=0&&!(this.activeRank[r]t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&e.push(this.active[r]);return e.reverse()}openEnd(t){let e=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)e++;return e}};function Lc(i,t,e,r,n,s){i.goto(t),e.goto(r);let o=r+n,l=r,a=r-t;for(;;){let h=i.to+a-e.to||i.endSide-e.endSide,f=h<0?i.to+a:e.to,c=Math.min(f,o);if(i.point||e.point?i.point&&e.point&&(i.point==e.point||i.point.eq(e.point))&&El(i.activeForPoint(i.to),e.activeForPoint(e.to))||s.comparePoint(l,c,i.point,e.point):c>l&&!El(i.active,e.active)&&s.compareRange(l,c,i.active,e.active),f>o)break;l=f,h<=0&&i.next(),h>=0&&e.next()}}function El(i,t){if(i.length!=t.length)return!1;for(let e=0;e=t;r--)i[r+1]=i[r];i[t]=e}function Vc(i,t){let e=-1,r=1e9;for(let n=0;n=t)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?e-s%e:1,n=at(i,n)}return r===!0?-1:i.length}var Dl=\"\\u037C\",Jc=typeof Symbol>\"u\"?\"__\"+Dl:Symbol.for(Dl),Bl=typeof Symbol>\"u\"?\"__styleSet\"+Math.floor(Math.random()*1e8):Symbol(\"styleSet\"),tu=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:{},Gt=class{constructor(t,e){this.rules=[];let{finish:r}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function s(o,l,a,h){let f=[],c=/^@(\\w+)\\b/.exec(o[0]),u=c&&c[1]==\"keyframes\";if(c&&l==null)return a.push(o[0]+\";\");for(let d in l){let m=l[d];if(/&/.test(d))s(d.split(/,\\s*/).map(O=>o.map(g=>O.replace(/&/,g))).reduce((O,g)=>O.concat(g)),m,a);else if(m&&typeof m==\"object\"){if(!c)throw new RangeError(\"The value of a property (\"+d+\") should be a primitive value.\");s(n(d),m,f,u)}else m!=null&&f.push(d.replace(/_.*/,\"\").replace(/[A-Z]/g,O=>\"-\"+O.toLowerCase())+\": \"+m+\";\")}(f.length||u)&&a.push((r&&!c&&!h?o.map(r):o).join(\", \")+\" {\"+f.join(\" \")+\"}\")}for(let o in t)s(n(o),t[o],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let t=tu[Jc]||1;return tu[Jc]=t+1,Dl+t.toString(36)}static mount(t,e,r){let n=t[Bl],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Xl(t,s),n.mount(Array.isArray(e)?e:[e])}},eu=new Map,Xl=class{constructor(t,e){let r=t.ownerDocument||t,n=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let s=eu.get(r);if(s)return t.adoptedStyleSheets=[s.sheet,...t.adoptedStyleSheets],t[Bl]=s;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],eu.set(r,this)}else{this.styleTag=r.createElement(\"style\"),e&&this.styleTag.setAttribute(\"nonce\",e);let s=t.head||t;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],t[Bl]=this}mount(t){let e=this.sheet,r=0,n=0;for(let s=0;s-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),e)for(let a=0;a\",191:\"?\",192:\"~\",219:\"{\",220:\"|\",221:\"}\",222:'\"'},PO=typeof navigator<\"u\"&&/Mac/.test(navigator.platform),CO=typeof navigator<\"u\"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(ht=0;ht<10;ht++)$e[48+ht]=$e[96+ht]=String(ht);var ht;for(ht=1;ht<=24;ht++)$e[ht+111]=\"F\"+ht;var ht;for(ht=65;ht<=90;ht++)$e[ht]=String.fromCharCode(ht+32),Vi[ht]=String.fromCharCode(ht);var ht;for(ls in $e)Vi.hasOwnProperty(ls)||(Vi[ls]=$e[ls]);var ls;function iu(i){var t=PO&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||CO&&i.shiftKey&&i.key&&i.key.length==1||i.key==\"Unidentified\",e=!t&&i.key||(i.shiftKey?Vi:$e)[i.keyCode]||i.key||\"Unidentified\";return e==\"Esc\"&&(e=\"Escape\"),e==\"Del\"&&(e=\"Delete\"),e==\"Left\"&&(e=\"ArrowLeft\"),e==\"Up\"&&(e=\"ArrowUp\"),e==\"Right\"&&(e=\"ArrowRight\"),e==\"Down\"&&(e=\"ArrowDown\"),e}function Ss(i){let t;return i.nodeType==11?t=i.getSelection?i:i.ownerDocument:t=i,t.getSelection()}function Zl(i,t){return t?i==t||i.contains(t.nodeType!=1?t.parentNode:t):!1}function AO(i){let t=i.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Os(i,t){if(!t.anchorNode)return!1;try{return Zl(i,t.anchorNode)}catch{return!1}}function Xr(i){return i.nodeType==3?ai(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Rr(i,t,e,r){return e?ru(i,t,e,r,-1)||ru(i,t,e,r,1):!1}function Lr(i){for(var t=0;;t++)if(i=i.previousSibling,!i)return t}function ru(i,t,e,r,n){for(;;){if(i==e&&t==r)return!0;if(t==(n<0?0:qe(i))){if(i.nodeName==\"DIV\")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;t=Lr(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[t+(n<0?-1:0)],i.nodeType==1&&i.contentEditable==\"false\")return!1;t=n<0?qe(i):0}else return!1}}function qe(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Aa(i,t){let e=t?i.left:i.right;return{left:e,right:e,top:i.top,bottom:i.bottom}}function QO(i){return{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Iu(i,t){let e=t.width/i.offsetWidth,r=t.height/i.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-i.offsetWidth)<1)&&(e=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-i.offsetHeight)<1)&&(r=1),{scaleX:e,scaleY:r}}function RO(i,t,e,r,n,s,o,l){let a=i.ownerDocument,h=a.defaultView||window;for(let f=i,c=!1;f&&!c;)if(f.nodeType==1){let u,d=f==a.body,m=1,O=1;if(d)u=QO(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:m,scaleY:O}=Iu(f,S)),u={left:S.left,right:S.left+f.clientWidth*m,top:S.top,bottom:S.top+f.clientHeight*O}}let g=0,x=0;if(n==\"nearest\")t.top0&&t.bottom>u.bottom+x&&(x=t.bottom-u.bottom+x+o)):t.bottom>u.bottom&&(x=t.bottom-u.bottom+o,e<0&&t.top-x0&&t.right>u.right+g&&(g=t.right-u.right+g+s)):t.right>u.right&&(g=t.right-u.right+s,e<0&&t.lefte.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}var Fl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:r}=t;this.set(e,Math.min(t.anchorOffset,e?qe(e):0),r,Math.min(t.focusOffset,r?qe(r):0))}set(t,e,r,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=r,this.focusOffset=n}},Wi=null;function Nu(i){if(i.setActive)return i.setActive();if(Wi)return i.focus(Wi);let t=[];for(let e=i;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(i.focus(Wi==null?{get preventScroll(){return Wi={preventScroll:!0},!0}}:void 0),!Wi){Wi=!1;for(let e=0;eMath.max(1,i.scrollHeight-i.clientHeight-4)}var Tt=class i{constructor(t,e,r=!0){this.node=t,this.offset=e,this.precise=r}static before(t,e){return new i(t.parentNode,Lr(t),e)}static after(t,e){return new i(t.parentNode,Lr(t)+1,e)}},Qa=[],rt=class i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let r of this.children){if(r==t)return e;e+=r.length+r.breakAfter}throw new RangeError(\"Invalid child in posBefore\")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(this.flags&2){let r=this.dom,n=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=n?n.nextSibling:r.firstChild)){let l=i.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(t,e),o.flags&=-8}if(s=n?n.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&s!=o.dom&&(e.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=su(s);else r.insertBefore(o.dom,s);n=o.dom}for(s=n?n.nextSibling:r.firstChild,s&&e&&e.node==r&&(e.written=!0);s;)s=su(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(t,e),r.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let r;if(t==this.dom)r=this.dom.childNodes[e];else{let n=qe(t)==0?0:e==0?-1:1;for(;;){let s=t.parentNode;if(s==this.dom)break;n==0&&s.firstChild!=s.lastChild&&(t==s.firstChild?n=-1:n=1),t=s}n<0?r=t:r=t.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!i.get(r);)r=r.nextSibling;if(!r)return this.length;for(let n=0,s=0;;n++){let o=this.children[n];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(t,e,r=0){let n=-1,s=-1,o=-1,l=-1;for(let a=0,h=r,f=r;ae)return c.domBoundsAround(t,e,h);if(u>=t&&n==-1&&(n=a,s=h),h>e&&c.dom.parentNode==this.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,r=Qa){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function Zu(i,t,e,r,n,s,o,l,a){let{children:h}=i,f=h.length?h[t]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:o;if(!(t==r&&f&&!o&&!u&&s.length<2&&f.merge(e,n,s.length?c:null,e==0,l,a))){if(r0&&(!o&&s.length&&f.merge(e,f.length,s[0],!1,l,0)?f.breakAfter=s.shift().breakAfter:(e2),Q={mac:au||/Mac/.test(Lt.platform),windows:/Win/.test(Lt.platform),linux:/Linux|X11/.test(Lt.platform),ie:Bs,ie_version:_u?_l.documentMode||6:Hl?+Hl[1]:Gl?+Gl[1]:0,gecko:ou,gecko_version:ou?+(/Firefox\\/(\\d+)/.exec(Lt.userAgent)||[0,0])[1]:0,chrome:!!Ll,chrome_version:Ll?+Ll[1]:0,ios:au,android:/Android\\b/.test(Lt.userAgent),webkit:lu,safari:Gu,webkit_version:lu?+(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:_l.documentElement.style.tabSize!=null?\"tab-size\":\"-moz-tab-size\"},qO=256,Ye=class i extends rt{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,r){return this.flags&8||r&&(!(r instanceof i)||this.length-(e-t)+r.length>qO||r.flags&8)?!1:(this.text=this.text.slice(0,t)+(r?r.text:\"\")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new i(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Tt(this.dom,t)}domBoundsAround(t,e,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return DO(this.dom,t,e)}},ze=class i extends rt{constructor(t,e=[],r=0){super(),this.mark=t,this.children=e,this.length=r;for(let n of e)n.setParent(this)}setAttrs(t){if(Yu(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,r,n,s,o){return r&&(!(r instanceof i&&r.mark.eq(this.mark))||t&&s<=0||et&&e.push(r=t&&(n=s),r=a,s++}let o=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new i(this.mark,e,o)}domAtPos(t){return Hu(this,t)}coordsAt(t,e){return ju(this,t,e)}};function DO(i,t,e){let r=i.nodeValue.length;t>r&&(t=r);let n=t,s=t,o=0;t==0&&e<0||t==r&&e>=0?Q.chrome||Q.gecko||(t?(n--,o=1):s=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Aa(a,o<0):a||null}var Vr=class i extends rt{static create(t,e,r){return new i(t,e,r)}constructor(t,e,r){super(),this.widget=t,this.length=e,this.side=r,this.prevWidget=null}split(t){let e=i.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable=\"false\"))}getSide(){return this.side}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0)?Tt.before(this.dom):Tt.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let r=this.widget.coordsAt(this.dom,t,e);if(r)return r;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:t>0;for(let l=o?n.length-1:0;s=n[l],!(t>0?l==0:l==n.length-1||s.top0?Tt.before(this.dom):Tt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}};Ye.prototype.children=Vr.prototype.children=Wr.prototype.children=Qa;function Hu(i,t){let e=i.dom,{children:r}=i,n=0;for(let s=0;ns&&t0;s--){let o=r[s-1];if(o.dom.parentNode==e)return o.domAtPos(o.length)}for(let s=n;s0&&t instanceof ze&&n.length&&(r=n[n.length-1])instanceof ze&&r.mark.eq(t.mark)?Uu(r,t.children[0],e-1):(n.push(t),t.setParent(i)),i.length+=t.length}function ju(i,t,e){let r=null,n=-1,s=null,o=-1;function l(h,f){for(let c=0,u=0;c=f&&(d.children.length?l(d,f-u):(!s||s.isHidden&&e>0)&&(m>f||u==m&&d.getSide()>0)?(s=d,o=f-u):(u-1?1:0)!=n.length-(e&&n.indexOf(e)>-1?1:0))return!1;for(let s of r)if(s!=e&&(n.indexOf(s)==-1||i[s]!==t[s]))return!1;return!0}function jl(i,t,e){let r=!1;if(t)for(let n in t)e&&n in e||(r=!0,n==\"style\"?i.style.cssText=\"\":i.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(r=!0,n==\"style\"?i.style.cssText=e[n]:i.setAttribute(n,e[n]));return r}function XO(i){let t=Object.create(null);for(let e=0;e0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Ra(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Uu(this,t,e)}addLineDeco(t){let e=t.spec.attributes,r=t.spec.class;e&&(this.attrs=Ul(e,this.attrs||{})),r&&(this.attrs=Ul({class:r},this.attrs||{}))}domAtPos(t){return Hu(this,t)}reuseDOM(t){t.nodeName==\"DIV\"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var r;this.dom?this.flags&4&&(Yu(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),this.prevAttrs!==void 0&&(jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add(\"cm-line\"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&rt.get(n)instanceof ze;)n=n.lastChild;if(!n||!this.length||n.nodeName!=\"BR\"&&((r=rt.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(s=>s instanceof Ye))){let s=document.createElement(\"BR\");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let r of this.children){if(!(r instanceof Ye)||/[^ -~]/.test(r.text))return null;let n=Xr(r.dom);if(n.length!=1)return null;t+=n[0].width,e=n[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let r=ju(this,t,e);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight=e){if(s instanceof i)return s;if(o>e)break}n=o+s.breakAfter}return null}},Zi=class i extends rt{constructor(t,e,r){super(),this.widget=t,this.length=e,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0}},Ut=class{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},Pt=function(i){return i[i.Text=0]=\"Text\",i[i.WidgetBefore=1]=\"WidgetBefore\",i[i.WidgetAfter=2]=\"WidgetAfter\",i[i.WidgetRange=3]=\"WidgetRange\",i}(Pt||(Pt={})),R=class extends ee{constructor(t,e,r,n){super(),this.startSide=t,this.endSide=e,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Ir(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return e+=r&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ze(t,e,e,r,t.widget||null,!1)}static replace(t){let e=!!t.block,r,n;if(t.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=Ku(t,e);r=(s?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new Ze(t,r,n,e,t.widget||null,!0)}static line(t){return new Nr(t)}static set(t,e=!1){return _.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};R.none=_.empty;var Ir=class i extends R{constructor(t){let{start:e,end:r}=Ku(t);super(e?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||\"span\",this.class=t.class||\"\",this.attrs=t.attributes||null}eq(t){var e,r;return this==t||t instanceof i&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((r=t.attrs)===null||r===void 0?void 0:r.class))&&Ra(this.attrs,t.attrs,\"class\")}range(t,e=t){if(t>=e)throw new RangeError(\"Mark decorations may not be empty\");return super.range(t,e)}};Ir.prototype.point=!1;var Nr=class i extends R{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof i&&this.spec.class==t.spec.class&&Ra(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError(\"Line decoration ranges must be zero-length\");return super.range(t,e)}};Nr.prototype.mapMode=ut.TrackBefore;Nr.prototype.point=!0;var Ze=class i extends R{constructor(t,e,r,n,s,o){super(e,r,s,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?ut.TrackBefore:ut.TrackAfter:ut.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof i&&LO(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError(\"Invalid range for replacement decoration\");if(!this.isReplace&&e!=t)throw new RangeError(\"Widget decorations can only have zero-length ranges\");return super.range(t,e)}};Ze.prototype.point=!0;function Ku(i,t=!1){let{inclusiveStart:e,inclusiveEnd:r}=i;return e==null&&(e=i.inclusive),r==null&&(r=i.inclusive),{start:e??t,end:r??t}}function LO(i,t){return i==t||!!(i&&t&&i.compare(t))}function Kl(i,t,e,r=0){let n=e.length-1;n>=0&&e[n]+r>=i?e[n]=Math.max(e[n],t):e.push(i,t)}var Mr=class i{constructor(t,e,r,n){this.doc=t,this.pos=e,this.end=r,this.disallowBlockEffectsFor=n,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=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof Zi&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new mt),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(as(new Wr(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof Zi)&&this.getLine()}buildText(t,e,r){for(;t>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)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,t--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-r)),this.getLine().append(as(new Ye(this.text.slice(this.textOff,this.textOff+n)),e),r),this.atCursorPos=!0,this.textOff+=n,t-=n,r=0}}span(t,e,r,n){this.buildText(e-t,r,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,r,n,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Ze){if(r.block)throw new RangeError(\"Block decorations may not be specified via plugins\");if(e>this.doc.lineAt(this.pos).to)throw new RangeError(\"Decorations that replace line breaks may not be specified via plugins\")}let l=e-t;if(r instanceof Ze)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Zi(r.widget||new vs(\"div\"),l,r));else{let a=Vr.create(r.widget||new vs(\"span\"),l,l?0:r.startSide),h=this.atCursorPos&&!a.isEditable&&s<=n.length&&(t0),f=!a.isEditable&&(tn.length||r.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(as(new Wr(1),n),s),s=n.length+Math.max(0,s-n.length)),c.append(as(a,n),s),this.atCursorPos=f,this.pendingBuffer=f?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text=\"\",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,r,n,s){let o=new i(t,e,r,s);return o.openEnd=_.spans(n,e,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function as(i,t){for(let e of t)i=new ze(e,[i],i.length);return i}var vs=class extends Ut{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},G=function(i){return i[i.LTR=0]=\"LTR\",i[i.RTL=1]=\"RTL\",i}(G||(G={})),hi=G.LTR,Ma=G.RTL;function Ju(i){let t=[];for(let e=0;e=e){if(l.level==r)return o;(s<0||(n!=0?n<0?l.frome:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError(\"Index out of range\");return s}};function ed(i,t){if(i.length!=t.length)return!1;for(let e=0;e=0;O-=3)if(me[O+1]==-d){let g=me[O+2],x=g&2?n:g&4?g&1?s:n:0;x&&(j[c]=j[me[O]]=x),l=O;break}}else{if(me.length==189)break;me[l++]=c,me[l++]=u,me[l++]=a}else if((m=j[c])==2||m==1){let O=m==n;a=O?0:1;for(let g=l-3;g>=0;g-=3){let x=me[g+2];if(x&2)break;if(O)me[g+2]|=2;else{if(x&4)break;me[g+2]|=4}}}}}function zO(i,t,e,r){for(let n=0,s=r;n<=e.length;n++){let o=n?e[n-1].to:i,l=na;)m==g&&(m=e[--O].from,g=O?e[O-1].to:i),j[--m]=d;a=f}else s=h,a++}}}function ta(i,t,e,r,n,s,o){let l=r%2?2:1;if(r%2==n%2)for(let a=t,h=0;aa&&o.push(new Oe(a,O.from,d));let g=O.direction==hi!=!(d%2);ea(i,g?r+1:r,n,O.inner,O.from,O.to,o),a=O.to}m=O.to}else{if(m==e||(f?j[m]!=l:j[m]==l))break;m++}u?ta(i,a,m,r+1,n,u,o):at;){let f=!0,c=!1;if(!h||a>s[h-1].to){let O=j[a-1];O!=l&&(f=!1,c=O==16)}let u=!f&&l==1?[]:null,d=f?r:r+1,m=a;t:for(;;)if(h&&m==s[h-1].to){if(c)break t;let O=s[--h];if(!f)for(let g=O.from,x=h;;){if(g==t)break t;if(x&&s[x-1].to==g)g=s[--x].from;else{if(j[g-1]==l)break t;break}}if(u)u.push(O);else{O.toj.length;)j[j.length]=256;let r=[],n=t==hi?0:1;return ea(i,n,n,e,0,i.length,r),r}function id(i){return[new Oe(0,i,0)]}var rd=\"\";function FO(i,t,e,r,n){var s;let o=r.head-i.from,l=Oe.find(t,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=t[l],h=a.side(n,e);if(o==h){let u=l+=n?1:-1;if(u<0||u>=t.length)return null;a=t[l=u],o=a.side(!n,e),h=a.side(n,e)}let f=at(i.text,o,a.forward(n,e));(fa.to)&&(f=h),rd=i.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(n?t.length-1:0)?null:t[l+(n?1:-1)];return c&&f==h&&c.level+(n?0:1)i.some(t=>t)}),cd=A.define({combine:i=>i.some(t=>t)}),Er=class i{constructor(t,e=\"nearest\",r=\"nearest\",n=5,s=5,o=!1){this.range=t,this.y=e,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(t){return t.empty?this:new i(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new i(b.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},hs=M.define({map:(i,t)=>i.map(t)});function Ct(i,t,e){let r=i.facet(ld);r.length?r[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+\":\",t):console.error(t)}var Xs=A.define({combine:i=>i.length?i[0]:!0}),GO=0,Tr=A.define(),ft=class i{constructor(t,e,r,n,s){this.id=t,this.create=e,this.domEventHandlers=r,this.domEventObservers=n,this.extension=s(this)}static define(t,e){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=e||{};return new i(GO++,t,r,n,l=>{let a=[Tr.of(l)];return o&&a.push(Yr.of(h=>{let f=h.plugin(l);return f?o(f):R.none})),s&&a.push(s(l)),a})}static fromClass(t,e){return i.define(r=>new t(r),e)}},$r=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(r){if(Ct(e.state,r,\"CodeMirror plugin crashed\"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){Ct(t.state,e,\"CodeMirror plugin crashed\"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(r){Ct(t.state,r,\"CodeMirror plugin crashed\")}}deactivate(){this.spec=this.value=null}},ud=A.define(),Ea=A.define(),Yr=A.define(),dd=A.define(),$a=A.define(),pd=A.define();function fu(i,t){let e=i.state.facet(pd);if(!e.length)return e;let r=e.map(s=>s instanceof Function?s(i):s),n=[];return _.spans(r,t.from,t.to,{point(){},span(s,o,l,a){let h=s-t.from,f=o-t.from,c=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,m;if(d==null&&(d=_O(t.text,h,f)),a>0&&c.length&&(m=c[c.length-1]).to==h&&m.direction==d)m.to=f,c=m.inner;else{let O={from:h,to:f,direction:d,inner:[]};c.push(O),c=O.inner}}}}),n}var md=A.define();function gd(i){let t=0,e=0,r=0,n=0;for(let s of i.state.facet(md)){let o=s(i);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:r,bottom:n}}var Pr=A.define(),xe=class i{constructor(t,e,r,n){this.fromA=t,this.toA=e,this.fromB=r,this.toB=n}join(t){return new i(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,r=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>r.toA)){if(n.toAf)break;s+=2}if(!a)return r;new i(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}},ks=class i{constructor(t,e,r){this.view=t,this.state=e,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=vt.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,l,a)=>n.push(new xe(s,o,l,a))),this.changedRanges=n}static create(t,e,r){return new i(t,e,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Ts=class extends rt{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new mt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xe(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!e0(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let s=n>-1?UO(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new xe(h,f,t.changes.mapPos(h,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Q.ie||Q.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=JO(o,l,t.changes);return r=xe.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,t.startState.doc.length,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+\"px\",this.dom.style.flexBasis=this.minWidth?this.minWidth+\"px\":\"\";let o=Q.chrome||Q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=\"\"}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:f,toB:c}=l,u,d,m,O;if(r&&r.range.fromBf){let v=Mr.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),y=Mr.build(this.view.state.doc,r.range.toB,c,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,m=v.openStart,O=y.openEnd;let k=this.compositionView(r);y.breakAtStart?k.breakAfter=1:y.content.length&&k.merge(k.length,k.length,y.content[0],!1,y.openStart,0)&&(k.breakAfter=y.content[0].breakAfter,y.content.shift()),v.content.length&&k.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),u=v.content.concat(k).concat(y.content)}else({content:u,breakAtStart:d,openStart:m,openEnd:O}=Mr.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:g,off:x}=s.findPos(h,1),{i:S,off:C}=s.findPos(a,-1);Zu(this,S,C,g,x,u,d,m,O)}r&&this.fixCompositionDOM(r)}compositionView(t){let e=new Ye(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new ze(n,[e],e.length);let r=new mt;return r.append(e,0),r}fixCompositionDOM(t){let e=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=rt.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(t.range.fromB,1),n=this.children[r.i];e(t.line,n);for(let s=t.marks.length-1;s>=-1;s--)r=n.childPos(r.off,1),n=n.children[r.i],e(s>=0?t.marks[s].node:t.text,n)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,s=!n&&Os(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||e||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&HO(a)){let c=document.createTextNode(\"\");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=h=new Tt(c,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!Rr(a.node,a.offset,f.anchorNode,f.anchorOffset)||!Rr(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(f.focusNode)&&t0(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Ss(this.view.root);if(c)if(l.empty){if(Q.gecko){let u=jO(a.node,a.offset);if(u&&u!=3){let d=xd(a.node,a.offset,u==1?1:-1);d&&(a=new Tt(d.node,d.offset))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new Tt(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Tt(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Rr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,r=Ss(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!r||!e.empty||!e.assoc||!r.modify)return;let o=mt.find(this,e.head);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(e.head+e.assoc);r.collapse(f.node,f.offset),r.modify(\"move\",e.assoc<0?\"forward\":\"backward\",\"lineboundary\"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&r.collapse(n,s)}moveToLine(t){let e=this.dom,r;if(t.node!=e)return t;for(let n=t.offset;!r&&n=0;n--){let s=rt.get(e.childNodes[n]);s instanceof mt&&(r=s.domAtPos(s.length))}return r?new Tt(r.node,r.offset,!0):t}nearest(t){for(let e=t;e;){let r=rt.get(e);if(r&&r.rootView==this)return r;e=e.parentNode}return null}posFromDOM(t,e){let r=this.nearest(t);if(!r)throw new RangeError(\"Trying to find position for a DOM position outside of the document\");return r.localPosFromDOM(t,e)+r.posAtStart}domAtPos(t){let{i:e,off:r}=this.childCursor().findPos(t,-1);for(;e=0;o--){let l=this.children[o],a=s-l.breakAfter,h=a-l.length;if(at||l.covers(1))&&(!r||l instanceof mt&&!(r instanceof mt&&e>=0))&&(r=l,n=h),s=h}return r?r.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:r}=this.childPos(t,1),n=this.children[e];if(!(n instanceof mt))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(r,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}r=a}if(!(n instanceof Ye))return null;let s=at(n.text,r);if(s==r)return null;let o=ai(n.dom,r,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==G.LTR;for(let h=0,f=0;fn)break;if(h>=r){let d=c.dom.getBoundingClientRect();if(e.push(d.height),o){let m=c.dom.lastChild,O=m?Xr(m):[];if(O.length){let g=O[O.length-1],x=a?g.right-d.left:d.right-g.left;x>l&&(l=x,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction==\"rtl\"?G.RTL:G.LTR}measureTextSize(){for(let s of this.children)if(s instanceof mt){let o=s.measureTextSize();if(o)return o}let t=document.createElement(\"div\"),e,r,n;return t.className=\"cm-line\",t.style.width=\"99999px\",t.style.position=\"absolute\",t.textContent=\"abc def ghi jkl mno pqr stu\",this.view.observer.ignore(()=>{this.dom.appendChild(t);let s=Xr(t.firstChild)[0];e=t.getBoundingClientRect().height,r=s?s.width/27:7,n=s?s.height:e,t.remove()}),{lineHeight:e,charWidth:r,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ws(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let r=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],o=s?s.from-1:this.length;if(o>r){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(r).top)/this.view.scaleY;t.push(R.replace({widget:new Ps(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return R.set(t)}updateDeco(){let t=this.view.state.facet(Yr).map((n,s)=>(this.dynamicDecorationMap[s]=typeof n==\"function\")?n(this.view):n),e=!1,r=this.view.state.facet(dd).map((n,s)=>{let o=typeof n==\"function\";return o&&(e=!0),o?n(this.view):n});r.length&&(this.dynamicDecorationMap[t.length]=e,t.push(_.join(r)));for(let n=t.length;ne.anchor?-1:1),n;if(!r)return;!e.empty&&(n=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=gd(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;RO(this.view.scrollDOM,o,e.head0)r=r.childNodes[n-1],n=qe(r);else break}if(e>=0)for(let r=i,n=t;;){if(r.nodeType==3)return{node:r,offset:n};if(r.nodeType==1&&n=0)r=r.childNodes[n],n=0;else break}return null}function jO(i,t){return i.nodeType!=1?0:(t&&i.childNodes[t-1].contentEditable==\"false\"?1:0)|(t{rt.from&&(e=!0)}),e}function i0(i,t,e=1){let r=i.charCategorizer(t),n=i.doc.lineAt(t),s=t-n.from;if(n.length==0)return b.cursor(t);s==0?e=1:s==n.length&&(e=-1);let o=s,l=s;e<0?o=at(n.text,s,!1):l=at(n.text,s);let a=r(n.text.slice(o,l));for(;o>0;){let h=at(n.text,o,!1);if(r(n.text.slice(h,o))!=a)break;o=h}for(;li?t.left-i:Math.max(0,i-t.right)}function n0(i,t){return t.top>i?t.top-i:Math.max(0,i-t.bottom)}function Vl(i,t){return i.topt.top+1}function cu(i,t){return ti.bottom?{top:i.top,left:i.left,right:i.right,bottom:t}:i}function ra(i,t,e){let r,n,s,o,l=!1,a,h,f,c;for(let m=i.firstChild;m;m=m.nextSibling){let O=Xr(m);for(let g=0;gC||o==C&&s>S){r=m,n=x,s=S,o=C;let v=C?e0?g0)}S==0?e>x.bottom&&(!f||f.bottomx.top)&&(h=m,c=x):f&&Vl(f,x)?f=uu(f,x.bottom):c&&Vl(c,x)&&(c=cu(c,x.top))}}if(f&&f.bottom>=e?(r=a,n=f):c&&c.top<=e&&(r=h,n=c),!r)return{node:i,offset:0};let u=Math.max(n.left,Math.min(n.right,t));if(r.nodeType==3)return du(r,u,e);if(l&&r.contentEditable!=\"false\")return ra(r,u,e);let d=Array.prototype.indexOf.call(i.childNodes,r)+(t>=(n.left+n.right)/2?1:0);return{node:i,offset:d}}function du(i,t,e){let r=i.nodeValue.length,n=-1,s=1e9,o=0;for(let l=0;le?f.top-e:e-f.bottom)-1;if(f.left-1<=t&&f.right+1>=t&&c=(f.left+f.right)/2,d=u;if((Q.chrome||Q.gecko)&&ai(i,l).getBoundingClientRect().left==f.right&&(d=!u),c<=0)return{node:i,offset:l+(d?1:0)};n=l+(d?1:0),s=c}}}return{node:i,offset:n>-1?n:o>0?i.nodeValue.length:0}}function yd(i,t,e,r=-1){var n,s;let o=i.contentDOM.getBoundingClientRect(),l=o.top+i.viewState.paddingTop,a,{docHeight:h}=i.viewState,{x:f,y:c}=t,u=c-l;if(u<0)return 0;if(u>h)return i.state.doc.length;for(let v=i.viewState.heightOracle.textHeight/2,y=!1;a=i.elementAtHeight(u),a.type!=Pt.Text;)for(;u=r>0?a.bottom+v:a.top-v,!(u>=0&&u<=h);){if(y)return e?null:0;y=!0,r=-r}c=l+u;let d=a.from;if(di.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:e?null:pu(i,o,a,f,c);let m=i.dom.ownerDocument,O=i.root.elementFromPoint?i.root:m,g=O.elementFromPoint(f,c);g&&!i.contentDOM.contains(g)&&(g=null),g||(f=Math.max(o.left+1,Math.min(o.right-1,f)),g=O.elementFromPoint(f,c),g&&!i.contentDOM.contains(g)&&(g=null));let x,S=-1;if(g&&((n=i.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let v=m.caretPositionFromPoint(f,c);v&&({offsetNode:x,offset:S}=v)}else if(m.caretRangeFromPoint){let v=m.caretRangeFromPoint(f,c);v&&({startContainer:x,startOffset:S}=v,(!i.contentDOM.contains(x)||Q.safari&&s0(x,S,f)||Q.chrome&&o0(x,S,f))&&(x=void 0))}}if(!x||!i.docView.dom.contains(x)){let v=mt.find(i.docView,d);if(!v)return u>a.top+a.height/2?a.to:a.from;({node:x,offset:S}=ra(v.dom,f,c))}let C=i.docView.nearest(x);if(!C)return null;if(C.isWidget&&((s=C.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=C.dom.getBoundingClientRect();return t.yi.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((n-e.top-(i.defaultLineHeight-l)*.5)/l);s+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(e.from,e.to);return e.from+os(o,s,i.state.tabSize)}function s0(i,t,e){let r;if(i.nodeType!=3||t!=(r=i.nodeValue.length))return!1;for(let n=i.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!=\"BR\")return!1;return ai(i,r-1,r).getBoundingClientRect().left>e}function o0(i,t,e){if(t!=0)return!1;for(let n=i;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains(\"cm-line\"))break;n=s}let r=i.nodeType==1?i.getBoundingClientRect():ai(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return e-r.left>5}function na(i,t){let e=i.lineBlockAt(t);if(Array.isArray(e.type)){for(let r of e.type)if(r.to>t||r.to==t&&(r.to==e.to||r.type==Pt.Text))return r}return e}function l0(i,t,e,r){let n=na(i,t.head),s=!r||n.type!=Pt.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(t.assoc<0&&t.head>n.from?t.head-1:t.head);if(s){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(n.from),a=i.posAtCoords({x:e==(l==G.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return b.cursor(a,e?-1:1)}return b.cursor(e?n.to:n.from,e?-1:1)}function mu(i,t,e,r){let n=i.state.doc.lineAt(t.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let l=t,a=null;;){let h=FO(n,s,o,l,e),f=rd;if(!h){if(n.number==(e?i.state.doc.lines:1))return l;f=`\n`,n=i.state.doc.line(n.number+(e?1:-1)),s=i.bidiSpans(n),h=i.visualLineSide(n,!e)}if(a){if(!a(f))return l}else{if(!r)return h;a=r(f)}l=h}}function a0(i,t,e){let r=i.state.charCategorizer(t),n=r(e);return s=>{let o=r(s);return n==F.Space&&(n=o),n==o}}function h0(i,t,e,r){let n=t.head,s=e?1:-1;if(n==(e?i.state.doc.length:0))return b.cursor(n,t.assoc);let o=t.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(n,t.assoc||-1),f=i.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(n-d.from))),l=(s<0?d.top:d.bottom)+f}let c=a.left+o,u=r??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(u+d)*s,O=yd(i,{x:c,y:m},!1,s);if(ma.bottom||(s<0?On)){let g=i.docView.coordsForChar(O),x=!g||m{if(t>s&&tn(i)),e.from,t.head>e.from?-1:1);return r==e.from?e:b.cursor(r,rnull),Q.gecko&&k0(t.contentDOM.ownerDocument)}handleEvent(t){!g0(this.view,t)||this.ignoreDuringComposition(t)||t.type==\"keydown\"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let r=this.handlers[t];if(r){for(let n of r.observers)n(this.view,e);for(let n of r.handlers){if(e.defaultPrevented)break;if(n(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=f0(t),r=this.handlers,n=this.view.contentDOM;for(let s in e)if(s!=\"scroll\"){let o=!e[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(n.removeEventListener(s,this.handleEvent),l=null),l||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!=\"scroll\"&&!e[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()r.keyCode==t.keyCode))&&!t.ctrlKey||c0.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,zi(this.view.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function gu(i,t){return(e,r)=>{try{return t.call(i,r,e)}catch(n){Ct(e.state,n)}}}function f0(i){let t=Object.create(null);function e(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&e(s).handlers.push(gu(r.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&e(s).observers.push(gu(r.value,o))}}for(let r in re)e(r).handlers.push(re[r]);for(let r in ne)e(r).observers.push(ne[r]);return t}var bd=[{key:\"Backspace\",keyCode:8,inputType:\"deleteContentBackward\"},{key:\"Enter\",keyCode:13,inputType:\"insertParagraph\"},{key:\"Enter\",keyCode:13,inputType:\"insertLineBreak\"},{key:\"Delete\",keyCode:46,inputType:\"deleteContentForward\"}],c0=\"dthko\",Sd=[16,17,18,20,91,92,224,225],fs=6;function cs(i){return Math.max(0,i)*.7+8}function u0(i,t){return Math.max(Math.abs(i.clientX-t.clientX),Math.abs(i.clientY-t.clientY))}var oa=class{constructor(t,e,r,n){this.view=t,this.startEvent=e,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=MO(t.contentDOM),this.atoms=t.state.facet($a).map(o=>o(t));let s=t.contentDOM.ownerDocument;s.addEventListener(\"mousemove\",this.move=this.move.bind(this)),s.addEventListener(\"mouseup\",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Y.allowMultipleSelections)&&d0(t,e),this.dragging=m0(t,e)&&Td(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&u0(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let r=0,n=0,s=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=gd(this.view);t.clientX-o.left<=s.left+fs?r=-cs(s.left-t.clientX):t.clientX+o.right>=s.right-fs&&(r=cs(t.clientX-s.right)),t.clientY-o.top<=s.top+fs?n=-cs(s.top-t.clientY):t.clientY+o.bottom>=s.bottom-fs&&(n=cs(t.clientY-s.bottom)),this.setScrollSpeed(r,n)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener(\"mousemove\",this.move),t.removeEventListener(\"mouseup\",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let r=0;rthis.select(this.lastEvent),20)}};function d0(i,t){let e=i.state.facet(nd);return e.length?e[0](t):Q.mac?t.metaKey:t.ctrlKey}function p0(i,t){let e=i.state.facet(sd);return e.length?e[0](t):Q.mac?!t.altKey:!t.ctrlKey}function m0(i,t){let{main:e}=i.state.selection;if(e.empty)return!1;let r=Ss(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function g0(i,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,r;e!=i.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(r=rt.get(e))&&r.ignoreEvent(t))return!1;return!0}var re=Object.create(null),ne=Object.create(null),wd=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function O0(i){let t=i.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement(\"textarea\"));e.style.cssText=\"position: fixed; left: -10000px; top: 10px\",e.focus(),setTimeout(()=>{i.focus(),e.remove(),vd(i,e.value)},50)}function vd(i,t){let{state:e}=i,r,n=1,s=e.toText(t),o=s.lines==e.selection.ranges.length;if(la!=null&&e.selection.ranges.every(a=>a.empty)&&la==s.toString()){let a=-1;r=e.changeByRange(h=>{let f=e.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=e.toText((o?s.line(n++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:b.cursor(h.from+c.length)}})}else o?r=e.changeByRange(a=>{let h=s.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):r=e.replaceSelection(s);i.dispatch(r,{userEvent:\"input.paste\",scrollIntoView:!0})}ne.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};re.keydown=(i,t)=>(i.inputState.setSelectionOrigin(\"select\"),t.keyCode==27&&(i.inputState.lastEscPress=Date.now()),!1);ne.touchstart=(i,t)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin(\"select.pointer\")};ne.touchmove=i=>{i.inputState.setSelectionOrigin(\"select.pointer\")};re.mousedown=(i,t)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let r of i.state.facet(od))if(e=r(i,t),e)break;if(!e&&t.button==0&&(e=b0(i,t)),e){let r=!i.hasFocus;i.inputState.startMouseSelection(new oa(i,t,e,r)),r&&i.observer.ignore(()=>Nu(i.contentDOM));let n=i.inputState.mouseSelection;if(n)return n.start(t),n.dragging===!1}return!1};function Ou(i,t,e,r){if(r==1)return b.cursor(t,e);if(r==2)return i0(i.state,t,e);{let n=mt.find(i.docView,t),s=i.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:s.from,l=n?n.posAtEnd:s.to;return li>=t.top&&i<=t.bottom,xu=(i,t,e)=>kd(t,e)&&i>=e.left&&i<=e.right;function x0(i,t,e,r){let n=mt.find(i.docView,t);if(!n)return 1;let s=t-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&xu(e,r,o))return-1;let l=n.coordsAt(s,1);return l&&xu(e,r,l)?1:o&&kd(r,o)?-1:1}function yu(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:x0(i,e,t.clientX,t.clientY)}}var y0=Q.ie&&Q.ie_version<=11,bu=null,Su=0,wu=0;function Td(i){if(!y0)return i.detail;let t=bu,e=wu;return bu=i,wu=Date.now(),Su=!t||e>Date.now()-400&&Math.abs(t.clientX-i.clientX)<2&&Math.abs(t.clientY-i.clientY)<2?(Su+1)%3:1}function b0(i,t){let e=yu(i,t),r=Td(t),n=i.state.selection;return{update(s){s.docChanged&&(e.pos=s.changes.mapPos(e.pos),n=n.map(s.changes))},get(s,o,l){let a=yu(i,s),h,f=Ou(i,a.pos,a.bias,r);if(e.pos!=a.pos&&!o){let c=Ou(i,e.pos,e.bias,r),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u1&&(h=S0(n,a.pos))?h:l?n.addRange(f):b.create([f])}}}function S0(i,t){for(let e=0;e=t)return b.create(i.ranges.slice(0,e).concat(i.ranges.slice(e+1)),i.mainIndex==e?0:i.mainIndex-(i.mainIndex>e?1:0))}return null}re.dragstart=(i,t)=>{let{selection:{main:e}}=i.state;if(t.target.draggable){let n=i.docView.nearest(t.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=e.to||o<=e.from)&&(e=b.range(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData(\"Text\",i.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed=\"copyMove\"),!1};re.dragend=i=>(i.inputState.draggedContent=null,!1);function vu(i,t,e,r){if(!e)return;let n=i.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&p0(i,t)?{from:s.from,to:s.to}:null,l={from:n,insert:e},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?\"move.drop\":\"input.drop\"}),i.inputState.draggedContent=null}re.drop=(i,t)=>{if(!t.dataTransfer)return!1;if(i.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let r=Array(e.length),n=0,s=()=>{++n==e.length&&vu(i,t,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(e[o])}return!0}else{let r=t.dataTransfer.getData(\"Text\");if(r)return vu(i,t,r,!0),!0}return!1};re.paste=(i,t)=>{if(i.state.readOnly)return!0;i.observer.flush();let e=wd?null:t.clipboardData;return e?(vd(i,e.getData(\"text/plain\")||e.getData(\"text/uri-text\")),!0):(O0(i),!1)};function w0(i,t){let e=i.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement(\"textarea\"));r.style.cssText=\"position: fixed; left: -10000px; top: 10px\",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function v0(i){let t=[],e=[],r=!1;for(let n of i.selection.ranges)n.empty||(t.push(i.sliceDoc(n.from,n.to)),e.push(n));if(!t.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(t.push(o.text),e.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:t.join(i.lineBreak),ranges:e,linewise:r}}var la=null;re.copy=re.cut=(i,t)=>{let{text:e,ranges:r,linewise:n}=v0(i.state);if(!e&&!n)return!1;la=n?e:null,t.type==\"cut\"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:\"delete.cut\"});let s=wd?null:t.clipboardData;return s?(s.clearData(),s.setData(\"text/plain\",e),!0):(w0(i,e),!1)};var Pd=Et.define();function Cd(i,t){let e=[];for(let r of i.facet(hd)){let n=r(i,t);n&&e.push(n)}return e?i.update({effects:e,annotations:Pd.of(!0)}):null}function Ad(i){setTimeout(()=>{let t=i.hasFocus;if(t!=i.inputState.notifiedFocused){let e=Cd(i.state,t);e?i.dispatch(e):i.update([])}},10)}ne.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Ad(i)};ne.blur=i=>{i.observer.clearSelectionRange(),Ad(i)};ne.compositionstart=ne.compositionupdate=i=>{i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0)};ne.compositionend=i=>{i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Q.chrome&&Q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50)};ne.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};re.beforeinput=(i,t)=>{var e;let r;if(Q.chrome&&Q.android&&(r=bd.find(n=>n.inputType==t.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key==\"Backspace\"||r.key==\"Delete\")){let n=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return!1};var ku=new Set;function k0(i){ku.has(i)||(ku.add(i),i.addEventListener(\"copy\",()=>{}),i.addEventListener(\"cut\",()=>{}))}var Tu=[\"pre-wrap\",\"normal\",\"pre-line\",\"break-spaces\"],aa=class{constructor(t){this.lineWrapping=t,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let r=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((e-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Tu.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let r=0;r-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=r,this.textHeight=n,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>ys&&(t.heightChanged=!0),this.height=e)}replace(t,e,r){return i.of(r)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,r,n){let s=this,o=r.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=s.lineAt(a,et.ByPosNoHeight,r.setDoc(e),0,0),d=u.to>=h?u:s.lineAt(h,et.ByPosNoHeight,r,0,0);for(c+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,as*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),r+=1+l.break,n-=l.size}else if(s>n*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(n=s&&o(this.blockAt(0,r,n,s))}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ht=class i extends Cs{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,r,n){return new ge(n,this.length,r,this.height,this.breaks)}replace(t,e,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof Ne&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Ne?n=new i(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Vt.of(r)}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:\"\"}${this.widgetHeight?\":\"+this.widgetHeight:\"\"})`}},Ne=class i extends Vt{constructor(t){super(t,0)}heightMetrics(t,e){let r=t.doc.lineAt(e).number,n=t.doc.lineAt(e+this.length).number,s=n-r+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:n,perLine:o,perChar:l}}blockAt(t,e,r,n){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length),f=e.doc.lineAt(h),c=l+f.length*a,u=Math.max(r,t-c/2);return new ge(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((t-r)/l))),{from:f,length:c}=e.doc.line(s+h);return new ge(f,c,r+l*h,l,0)}}lineAt(t,e,r,n,s){if(e==et.ByHeight)return this.blockAt(t,r,n,s);if(e==et.ByPosNoHeight){let{from:d,to:m}=r.doc.lineAt(t);return new ge(d,m-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),h=r.doc.lineAt(t),f=l+h.length*a,c=h.number-o,u=n+l*c+a*(h.from-s-c);return new ge(h.from,h.length,Math.max(n,Math.min(u,n+this.height-f)),f,0)}forEachLine(t,e,r,n,s,o){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(r,s);for(let f=t,c=n;f<=e;){let u=r.doc.lineAt(f);if(f==t){let m=u.number-l;c+=a*m+h*(t-s-m)}let d=a+h*u.length;o(new ge(u.from,u.length,c,d,0)),c+=d,f=u.to+1}}replace(t,e,r){let n=this.length-e;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(t>0){let s=r[0];s instanceof i?r[0]=new i(t+s.length):r.unshift(new i(t-1),null)}return Vt.of(r)}decomposeLeft(t,e){e.push(new i(t-1),null)}decomposeRight(t,e){e.push(null,new i(this.length-t-1))}updateHeight(t,e=0,r=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let o=[],l=Math.max(e,n.from),a=-1;for(n.from>e&&o.push(new i(n.from-e-1).updateHeight(t,e));l<=s&&n.more;){let f=t.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++];a==-1?a=c:Math.abs(c-a)>=ys&&(a=-2);let u=new Ht(f,c);u.outdated=!1,o.push(u),l+=f+1}l<=s&&o.push(null,new i(s-l).updateHeight(t,l));let h=Vt.of(o);return(a<0||Math.abs(h.height-this.height)>=ys||Math.abs(a-this.heightMetrics(t,e).perLine)>=ys)&&(t.heightChanged=!0),h}else(r||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},fa=class extends Vt{constructor(t,e,r){super(t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,e,r,n){let s=r+this.left.height;return tl))return h;let f=e==et.ByPosNoHeight?et.ByPosNoHeight:et.ByPos;return a?h.join(this.right.lineAt(l,f,r,o,l)):this.left.lineAt(l,f,r,n,s).join(h)}forEachLine(t,e,r,n,s,o){let l=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,r,l,a,o);else{let h=this.lineAt(a,et.ByPos,r,n,s);t=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,r,l,a,o)}}replace(t,e,r){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,r));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of r)s.push(l);if(t>0&&Pu(s,o-1),e=r&&e.push(null)),t>r&&this.right.decomposeLeft(t-r,e)}decomposeRight(t,e){let r=this.left.length,n=r+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Vt.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,r=!1,n){let{left:s,right:o}=this,l=e+s.length+this.break,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,r,n):s.updateHeight(t,e,r),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(t,l,r,n):o.updateHeight(t,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?\" \":\"-\")+this.right}};function Pu(i,t){let e,r;i[t]==null&&(e=i[t-1])instanceof Ne&&(r=i[t+1])instanceof Ne&&i.splice(t-1,3,new Ne(e.length+1+r.length))}var T0=5,ca=class i{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let r=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ht?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ht(r-this.pos,-1)),this.writtenTo=r,e>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,r){if(t=T0)&&this.addLineDeco(n,s,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ht(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let r=new Ne(e-t);return this.oracle.doc.lineAt(t).to==e&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ht)return t;let e=new Ht(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+r}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Ht)&&!this.isCovered?this.nodes.push(new Ht(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!=\"visible\"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==i.parentNode?u.bottom:Math.min(a,u.bottom)}h=c.position==\"absolute\"||c.position==\"fixed\"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-e.left,right:Math.max(s,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function A0(i,t){let e=i.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}var qr=class{constructor(t,e,r){this.from=t,this.to=e,this.size=r}static same(t,e){if(t.length!=e.length)return!1;for(let r=0;rtypeof r!=\"function\"&&r.class==\"cm-lineWrapping\");this.heightOracle=new aa(e),this.stateDeco=t.facet(Yr).filter(r=>typeof r!=\"function\"),this.heightMap=Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(t.doc),[new xe(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let r=0;r<=1;r++){let n=r?e.head:e.anchor;if(!t.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);t.push(new Ii(s,o))}}this.viewports=t.sort((r,n)=>r.from-n.from),this.scaler=this.heightMap.height<=7e6?Cu:new pa(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Cr(t,this.scaler))})}update(t,e=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Yr).filter(f=>typeof f!=\"function\");let n=t.changedRanges,s=xe.extendWithRanges(n,P0(r,this.stateDeco,t?t.changes:vt.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=!t.changes.empty||t.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(cd)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,r=window.getComputedStyle(e),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction==\"rtl\"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:v,scaleY:y}=Iu(e,l);(this.scaleX!=v||this.scaleY!=y)&&(this.scaleX=v,this.scaleY=y,h|=8,o=a=!0)}let c=(parseInt(r.paddingTop)||0)*this.scaleY,u=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=zu(t.scrollDOM);let m=(this.printing?A0:C0)(e,this.paddingTop),O=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let v=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(S-this.contentDOMWidth)>n.charWidth){let{lineHeight:y,charWidth:k,textHeight:w}=t.docView.measureTextSize();o=y>0&&n.refresh(s,y,k,w,S/k,v),o&&(t.docView.minWidth=0,h|=8)}O>0&&g>0?f=Math.max(O,g):O<0&&g<0&&(f=Math.min(O,g)),n.heightChanged=!1;for(let y of this.viewports){let k=y.from==this.viewport.from?v:t.docView.measureVisibleLineHeights(y);this.heightMap=(o?Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new xe(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new ha(y.from,k))}n.heightChanged&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ii(n.lineAt(o-r*1e3,et.ByHeight,s,0,0).from,n.lineAt(l+(1-r)*1e3,et.ByHeight,s,0,0).to);if(e){let{head:h}=e.range;if(ha.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,et.ByPos,s,0,0),u;e.y==\"center\"?u=(c.top+c.bottom)/2-f/2:e.y==\"start\"||e.y==\"nearest\"&&h=l+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s>1,o=n<<1;if(this.defaultTextDirection!=G.LTR&&!r)return[];let l=[],a=(h,f,c,u)=>{if(f-hh&&gg.from>=c.from&&g.to<=c.to&&Math.abs(g.from-h)g.fromx));if(!O){if(fg.from<=f&&g.to>=f)){let g=e.moveToLineBoundary(b.cursor(f),!1,!0).head;g>h&&(f=g)}O=new qr(h,f,this.gapSize(c,h,f,u))}l.push(O)};for(let h of this.viewportLines){if(h.lengthh.from&&a(h.from,u,h,f),de.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_.spans(t,this.viewport.from,this.viewport.to,{span(n,s){e.push({from:n,to:s})},point(){}},20);let r=e.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=e[s].from||n.to!=e[s].to);return this.visibleRanges=e,r?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Cr(this.heightMap.lineAt(t,et.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Cr(this.heightMap.lineAt(this.scaler.fromDOM(t),et.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Cr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ii=class{constructor(t,e){this.from=t,this.to=e}};function Q0(i,t,e){let r=[],n=i,s=0;return _.spans(e,i,t,{span(){},point(o,l){o>n&&(r.push({from:n,to:o}),s+=o-n),n=l}},20),n=1)return t[t.length-1].to;let r=Math.floor(i*e);for(let n=0;;n++){let{from:s,to:o}=t[n],l=o-s;if(r<=l)return s+r;r-=l}}function ds(i,t){let e=0;for(let{from:r,to:n}of i.ranges){if(t<=n){e+=t-r;break}e+=n-r}return e/i.total}function R0(i,t){for(let e of i)if(t(e))return e}var Cu={toDOM(i){return i},fromDOM(i){return i},scale:1},pa=class{constructor(t,e,r){let n=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let h=e.lineAt(l,et.ByPos,t,0,0).top,f=e.lineAt(a,et.ByPos,t,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let e=0,r=0,n=0;;e++){let s=eCr(n,t)):i._content)}var ps=A.define({combine:i=>i.join(\" \")}),ma=A.define({combine:i=>i.indexOf(!0)>-1}),ga=Gt.newName(),Qd=Gt.newName(),Rd=Gt.newName(),Md={\"&light\":\".\"+Qd,\"&dark\":\".\"+Rd};function Oa(i,t,e){return new Gt(t,{finish(r){return/&/.test(r)?r.replace(/&\\w*/,n=>{if(n==\"&\")return i;if(!e||!e[n])throw new RangeError(`Unsupported selector: ${n}`);return e[n]}):i+\" \"+r}})}var M0=Oa(\".\"+ga,{\"&\":{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\",minHeight:\"100%\",padding:\"4px 0\",outline:\"none\",\"&[contenteditable=true]\":{WebkitUserModify:\"read-write-plaintext-only\"}},\".cm-lineWrapping\":{whiteSpace_fallback:\"pre-wrap\",whiteSpace:\"break-spaces\",wordBreak:\"break-word\",overflowWrap:\"anywhere\",flexShrink:1},\"&light .cm-content\":{caretColor:\"black\"},\"&dark .cm-content\":{caretColor:\"white\"},\".cm-line\":{display:\"block\",padding:\"0 2px 0 6px\"},\".cm-layer\":{position:\"absolute\",left:0,top:0,contain:\"size style\",\"& > *\":{position:\"absolute\"}},\"&light .cm-selectionBackground\":{background:\"#d9d9d9\"},\"&dark .cm-selectionBackground\":{background:\"#222\"},\"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#d7d4f0\"},\"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#233\"},\".cm-cursorLayer\":{pointerEvents:\"none\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer\":{animation:\"steps(1) cm-blink 1.2s infinite\"},\"@keyframes cm-blink\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\"@keyframes cm-blink2\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\".cm-cursor, .cm-dropCursor\":{borderLeft:\"1.2px solid black\",marginLeft:\"-0.6px\",pointerEvents:\"none\"},\".cm-cursor\":{display:\"none\"},\"&dark .cm-cursor\":{borderLeftColor:\"#444\"},\".cm-dropCursor\":{position:\"absolute\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor\":{display:\"block\"},\".cm-iso\":{unicodeBidi:\"isolate\"},\".cm-announced\":{position:\"fixed\",top:\"-10000px\"},\"@media print\":{\".cm-announced\":{display:\"none\"}},\"&light .cm-activeLine\":{backgroundColor:\"#cceeff44\"},\"&dark .cm-activeLine\":{backgroundColor:\"#99eeff33\"},\"&light .cm-specialChar\":{color:\"red\"},\"&dark .cm-specialChar\":{color:\"#f78\"},\".cm-gutters\":{flexShrink:0,display:\"flex\",height:\"100%\",boxSizing:\"border-box\",insetInlineStart: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,')`,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\"}},Md),Ar=\"\\uFFFF\",xa=class{constructor(t,e){this.points=t,this.text=\"\",this.lineSeparator=e.facet(Y.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Ar}readRange(t,e){if(!t)return this;let r=t.parentNode;for(let n=t;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==e)break;let l=rt.get(n),a=rt.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Au(n))||Au(o)&&(n.nodeName!=\"BR\"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(r,e),this}readTextNode(t){let e=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,e.length));for(let r=0,n=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=n.exec(e))&&(s=l.index,o=l[0].length),this.append(e.slice(r,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(t){if(t.cmIgnore)return;let e=rt.get(t),r=e&&e.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName==\"BR\"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}findPointInside(t,e){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(E0(t,r.node,r.offset)?e:0))}};function E0(i,t,e){for(;;){if(!t||e-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,r,0))){let l=s||o?[]:D0(t),a=new xa(l,t.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=B0(l,this.bounds.from)}else{let l=t.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Zl(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Zl(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=t.viewport;if((Q.ios||Q.chrome)&&t.state.selection.main.empty&&a!=h&&(f.from>0||f.toDate.now()-100?i.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,a=n.from,h=null;(s===8||Q.android&&t.text.length=n.from&&e.to<=n.to&&(e.from!=n.from||e.to!=n.to)&&n.to-n.from-(e.to-e.from)<=4?e={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,e.from).append(e.insert).append(i.state.doc.slice(e.to,n.to))}:(Q.mac||Q.android)&&e&&e.from==e.to&&e.from==n.head-1&&/^\\. ?$/.test(e.insert.toString())&&i.contentDOM.getAttribute(\"autocorrect\")==\"off\"?(r&&e.insert.length==2&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}):Q.chrome&&e&&e.from==e.to&&e.from==n.head&&e.insert.toString()==`\n `&&i.lineWrapping&&(r&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}),e){if(Q.ios&&i.inputState.flushIOSKey()||Q.android&&(e.from==n.from&&e.to==n.to&&e.insert.length==1&&e.insert.lines==2&&zi(i.contentDOM,\"Enter\",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||s==8&&e.insert.lengthn.head)&&zi(i.contentDOM,\"Backspace\",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&zi(i.contentDOM,\"Delete\",46)))return!0;let o=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let l,a=()=>l||(l=$0(i,e,r));return i.state.facet(ad).some(h=>h(i,e.from,e.to,o,a))||i.dispatch(a()),!0}else if(r&&!r.main.eq(n)){let o=!1,l=\"select\";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin==\"select\"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function $0(i,t,e){let r,n=i.state,s=n.selection.main;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&i.inputState.composing<0){let l=s.fromt.to?n.sliceDoc(t.to,s.to):\"\";r=n.replaceSelection(i.state.toText(l+t.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=n.changes(t),a=e&&e.main.to<=l.newLength?e.main:void 0;if(n.selection.ranges.length>1&&i.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let h=i.state.sliceDoc(t.from,t.to),f,c=e&&Od(i,e.main.head);if(c){let m=t.insert.length-(t.to-t.from);f={from:c.from,to:c.to-m}}else f=i.state.doc.lineAt(s.head);let u=s.to-t.to,d=s.to-s.from;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let O=m.to-u,g=O-h.length;if(m.to-m.from!=d||i.state.sliceDoc(g,O)!=h||m.to>=f.from&&m.from<=f.to)return{range:m};let x=n.changes({from:g,to:O,insert:t.insert}),S=m.to-s.to;return{changes:x,range:a?b.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S)):m.map(x)}})}else r={changes:l,selection:a&&n.selection.replaceRange(a)}}let o=\"input.type\";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=\".compose\",i.inputState.compositionFirstChange&&(o+=\".start\",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:o,scrollIntoView:!0})}function q0(i,t,e,r){let n=Math.min(i.length,t.length),s=0;for(;s0&&l>0&&i.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(r==\"end\"){let a=Math.max(0,s-Math.min(o,l));e-=o+a-s}if(o=o?s-e:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-e:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function D0(i){let t=[];if(i.root.activeElement!=i.contentDOM)return t;let{anchorNode:e,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return e&&(t.push(new Qs(e,r)),(n!=e||s!=r)&&t.push(new Qs(n,s))),t}function B0(i,t){if(i.length==0)return null;let e=i[0].pos,r=i.length==2?i[1].pos:e;return e>-1&&r>-1?b.single(e+t,r+t):null}var X0={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Il=Q.ie&&Q.ie_version<=11,ba=class{constructor(t){this.view=t,this.active=!1,this.selectionRange=new Fl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let r of e)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&t.composing)&&e.some(r=>r.type==\"childList\"&&r.removedNodes.length||r.type==\"characterData\"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Il&&(this.onCharData=e=>{this.queue.push({target:e.target,type:\"characterData\",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver==\"function\"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(\"Event\")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(\"Event\"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers(\"scroll\",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,r)=>e!=t[r]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Xs)?r.root.activeElement!=this.dom:!Os(r.dom,n))return;let s=n.anchorNode&&r.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&n.focusNode&&Rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Q.safari&&t.root.nodeType==11&&AO(this.dom.ownerDocument)==this.dom&&L0(this.view)||Ss(t.root);if(!e||this.selectionRange.eq(e))return!1;let r=Os(this.dom,e);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&zi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||t==\"Enter\")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,r=-1,n=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),e==-1?{from:e,to:r}=o:(e=Math.min(o.from,e),r=Math.max(o.to,r)))}return{from:e,to:r,typeOver:n}}readChange(){let{from:t,to:e,typeOver:r}=this.processRecords(),n=this.selectionChanged&&Os(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ya(this.view,t,e,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let r=this.view.state,n=Ed(this.view,e);return this.view.state==r&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type==\"attributes\"),t.type==\"attributes\"&&(e.flags|=4),t.type==\"childList\"){let r=Qu(e,t.previousSibling||t.target.previousSibling,-1),n=Qu(e,t.nextSibling||t.target.nextSibling,1);return{from:r?e.posAfter(r):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}else return t.type==\"characterData\"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener(\"resize\",this.onResize),t.addEventListener(\"beforeprint\",this.onPrint),t.addEventListener(\"scroll\",this.onScroll),t.document.addEventListener(\"selectionchange\",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener(\"scroll\",this.onScroll),t.removeEventListener(\"resize\",this.onResize),t.removeEventListener(\"beforeprint\",this.onPrint),t.document.removeEventListener(\"selectionchange\",this.onSelectionChange)}destroy(){var t,e,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener(\"scroll\",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function Qu(i,t,e){for(;t;){let r=rt.get(t);if(r&&r.parent==i)return r;let n=t.parentNode;t=n!=i.dom?n:e>0?t.nextSibling:t.previousSibling}return null}function L0(i){let t=null;function e(a){a.preventDefault(),a.stopImmediatePropagation(),t=a.getTargetRanges()[0]}if(i.contentDOM.addEventListener(\"beforeinput\",e,!0),i.dom.ownerDocument.execCommand(\"indent\"),i.contentDOM.removeEventListener(\"beforeinput\",e,!0),!t)return null;let r=t.startContainer,n=t.startOffset,s=t.endContainer,o=t.endOffset,l=i.docView.domAtPos(i.state.selection.main.anchor);return Rr(l.node,l.offset,s,o)&&([r,n,s,o]=[s,o,r,n]),{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:o}}var T=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement(\"div\"),this.scrollDOM=document.createElement(\"div\"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=\"cm-scroller\",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(\"div\"),this.announceDOM.className=\"cm-announced\",this.announceDOM.setAttribute(\"aria-live\",\"polite\"),this.dom=document.createElement(\"div\"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(r=>r.forEach(n=>e(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||EO(t.parent)||document,this.viewState=new As(t.state||Y.create(t)),t.scrollTo&&t.scrollTo.is(hs)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Tr).map(r=>new $r(r));for(let r of this.plugins)r.update(this);this.observer=new ba(this),this.inputState=new sa(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ts(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=t.length==1&&t[0]instanceof lt?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.update are not allowed while an update is in progress\");let e=!1,r=!1,n,s=this.state;for(let u of t){if(u.startState!=s)throw new RangeError(\"Trying to update state with a transaction that doesn't start from the previous state.\");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;t.some(u=>u.annotation(Pd))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Cd(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(Y.phrases)!=this.state.facet(Y.phrases))return this.setState(s);n=ks.create(this,s,t),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;c=new Er(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(hs)&&(c=d.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Rs.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(Pr)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(u=>u.isUserEvent(\"select.pointer\")))}finally{this.updateState=0}if(n.startState.facet(ps)!=n.state.facet(ps)&&(this.viewState.mustMeasureContent=!0),(e||r||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(ia))try{u(n)}catch(d){Ct(this.state,d,\"update listener\")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!Ed(this,f)&&h.force&&zi(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.setState are not allowed while an update is in progress\");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new As(t),this.plugins=t.facet(Tr).map(r=>new $r(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Ts(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Tr),r=t.state.facet(Tr);if(e!=r){let n=[];for(let s of r){let o=e.indexOf(s);if(o<0)n.push(new $r(s));else{let l=this.plugins[o];l.mustUpdate=t,n.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(zu(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?\"Measure loop restarted more than 5 times\":\"Viewport failed to stabilize\");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(d=>{try{return d.read(this)}catch(m){return Ct(this.state,m),Ru}}),c=ks.create(this,this.state,[]),u=!1;c.flags|=a,e?e.flags|=a:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c));for(let d=0;d1||m<-1){n=n+m,r.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(ia))l(e)}get themeClasses(){return ga+\" \"+(this.state.facet(ma)?Rd:Qd)+\" \"+this.state.facet(ps)}updateAttrs(){let t=Mu(this,ud,{class:\"cm-editor\"+(this.hasFocus?\" cm-focused \":\" \")+this.themeClasses}),e={spellcheck:\"false\",autocorrect:\"off\",autocapitalize:\"off\",translate:\"no\",contenteditable:this.state.facet(Xs)?\"true\":\"false\",class:\"cm-content\",style:`${Q.tabSize}: ${this.state.tabSize}`,role:\"textbox\",\"aria-multiline\":\"true\"};this.state.readOnly&&(e[\"aria-readonly\"]=\"true\"),Mu(this,Ea,e);let r=this.observer.ignore(()=>{let n=jl(this.contentDOM,this.contentAttrs,e),s=jl(this.dom,this.editorAttrs,t);return n||s});return this.editorAttrs=t,this.contentAttrs=e,r}showAnnouncements(t){let e=!0;for(let r of t)for(let n of r.effects)if(n.is(i.announce)){e&&(this.announceDOM.textContent=\"\"),e=!1;let s=this.announceDOM.appendChild(document.createElement(\"div\"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Pr);let t=this.state.facet(i.cspNonce);Gt.mount(this.root,this.styleModules.concat(M0).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error(\"Reading the editor layout isn't allowed during an update\");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;er.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,r){return Wl(this,t,mu(this,t,e,r))}moveByGroup(t,e){return Wl(this,t,mu(this,t,e,r=>a0(this,t.head,r)))}visualLineSide(t,e){let r=this.bidiSpans(t),n=this.textDirectionAt(t.from),s=r[e?r.length-1:0];return b.cursor(s.side(e,n)+t.from,s.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,r=!0){return l0(this,t,e,r)}moveVertically(t,e,r){return Wl(this,t,h0(this,t,e,r))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),yd(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let r=this.docView.coordsAt(t,e);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n),o=s[Oe.find(s,t-n.from,-1,e)];return Aa(r,o.dir==G.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(fd)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>V0)return id(t.length);let e=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==e&&(s.fresh||ed(s.isolates,r=fu(this,t))))return s.order;r||(r=fu(this,t));let n=ZO(t.text,e,r);return this.bidiCache.push(new Rs(t.from,t.to,e,r,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nu(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return hs.of(new Er(typeof t==\"number\"?b.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return hs.of(new Er(b.cursor(r.from),\"start\",\"start\",r.top-t,e,!0))}static domEventHandlers(t){return ft.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ft.define(()=>({}),{eventObservers:t})}static theme(t,e){let r=Gt.newName(),n=[ps.of(r),Pr.of(Oa(`.${r}`,t))];return e&&e.dark&&n.push(ma.of(!0)),n}static baseTheme(t){return ie.lowest(Pr.of(Oa(\".\"+ga,t,Md)))}static findFromDOM(t){var e;let r=t.querySelector(\".cm-content\"),n=r&&rt.get(r)||rt.get(t);return((e=n?.rootView)===null||e===void 0?void 0:e.view)||null}};T.styleModule=Pr;T.inputHandler=ad;T.focusChangeEffect=hd;T.perLineTextDirection=fd;T.exceptionSink=ld;T.updateListener=ia;T.editable=Xs;T.mouseSelectionStyle=od;T.dragMovesSelection=sd;T.clickAddsSelectionRange=nd;T.decorations=Yr;T.outerDecorations=dd;T.atomicRanges=$a;T.bidiIsolatedRanges=pd;T.scrollMargins=md;T.darkTheme=ma;T.cspNonce=A.define({combine:i=>i.length?i[0]:\"\"});T.contentAttributes=Ea;T.editorAttributes=ud;T.lineWrapping=T.contentAttributes.of({class:\"cm-lineWrapping\"});T.announce=M.define();var V0=4096,Ru={},Rs=class i{constructor(t,e,r,n,s,o){this.from=t,this.to=e,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(t,e){if(e.empty&&!t.some(s=>s.fresh))return t;let r=[],n=t.length?t[t.length-1].dir:G.LTR;for(let s=Math.max(0,t.length-10);s=0;n--){let s=r[n],o=typeof s==\"function\"?s(i):s;o&&Ul(o,e)}return e}var W0=Q.mac?\"mac\":Q.windows?\"win\":Q.linux?\"linux\":\"key\";function I0(i,t){let e=i.split(/-(?!$)/),r=e[e.length-1];r==\"Space\"&&(r=\" \");let n,s,o,l;for(let a=0;ar.concat(n),[]))),e}function qd(i,t,e){return Dd($d(i.state),t,i,e)}var Ie=null,Y0=4e3;function z0(i,t=W0){let e=Object.create(null),r=Object.create(null),n=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error(\"Key binding \"+o+\" is used both as a regular binding and as a multi-stroke prefix\")},s=(o,l,a,h,f)=>{var c,u;let d=e[o]||(e[o]=Object.create(null)),m=l.split(/ (?!$)/).map(x=>I0(x,t));for(let x=1;x{let v=Ie={view:C,prefix:S,scope:o};return setTimeout(()=>{Ie==v&&(Ie=null)},Y0),!0}]})}let O=m.join(\" \");n(O,!1);let g=d[O]||(d[O]={preventDefault:!1,stopPropagation:!1,run:((u=(c=d._any)===null||c===void 0?void 0:c.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),f&&(g.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(\" \"):[\"editor\"];if(o.any)for(let h of l){let f=e[h]||(e[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let c in f)f[c].run.push(o.any)}let a=o[t]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,\"Shift-\"+a,o.shift,o.preventDefault,o.stopPropagation)}return e}function Dd(i,t,e,r){let n=iu(t),s=dt(n,0),o=wt(s)==n.length&&n!=\" \",l=\"\",a=!1,h=!1,f=!1;Ie&&Ie.view==e&&Ie.scope==r&&(l=Ie.prefix+\" \",Sd.indexOf(t.keyCode)<0&&(h=!0,Ie=null));let c=new Set,u=g=>{if(g){for(let x of g.run)if(!c.has(x)&&(c.add(x),x(e,t)))return g.stopPropagation&&(f=!0),!0;g.preventDefault&&(g.stopPropagation&&(f=!0),h=!0)}return!1},d=i[r],m,O;return d&&(u(d[l+ms(n,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Q.windows&&t.ctrlKey&&t.altKey)&&(m=$e[t.keyCode])&&m!=n?(u(d[l+ms(m,t,!0)])||t.shiftKey&&(O=Vi[t.keyCode])!=n&&O!=m&&u(d[l+ms(O,t,!1)]))&&(a=!0):o&&t.shiftKey&&u(d[l+ms(n,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&f&&t.stopPropagation(),a}var zr=class i{constructor(t,e,r,n,s){this.className=t,this.left=e,this.top=r,this.width=n,this.height=s}draw(){let t=document.createElement(\"div\");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+\"px\",t.style.top=this.top+\"px\",this.width!=null&&(t.style.width=this.width+\"px\"),t.style.height=this.height+\"px\"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,r){if(r.empty){let n=t.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let s=Bd(t);return[new i(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}else return Z0(t,e,r)}};function Bd(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==G.LTR?t.left:t.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:t.top-i.scrollDOM.scrollTop*i.scaleY}}function $u(i,t,e){let r=b.cursor(t);return{from:Math.max(e.from,i.moveToLineBoundary(r,!1,!0).from),to:Math.min(e.to,i.moveToLineBoundary(r,!0,!0).from),type:Pt.Text}}function Z0(i,t,e){if(e.to<=i.viewport.from||e.from>=i.viewport.to)return[];let r=Math.max(e.from,i.viewport.from),n=Math.min(e.to,i.viewport.to),s=i.textDirection==G.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=Bd(i),h=o.querySelector(\".cm-line\"),f=h&&window.getComputedStyle(h),c=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),u=l.right-(f?parseInt(f.paddingRight):0),d=na(i,r),m=na(i,n),O=d.type==Pt.Text?d:null,g=m.type==Pt.Text?m:null;if(O&&(i.lineWrapping||d.widgetLineBreaks)&&(O=$u(i,r,O)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=$u(i,n,g)),O&&g&&O.from==g.from)return S(C(e.from,e.to,O));{let y=O?C(e.from,null,O):v(d,!1),k=g?C(null,e.to,g):v(m,!0),w=[];return(O||d).to<(g||m).from-(O&&g?1:0)||d.widgetLineBreaks>1&&y.bottom+i.defaultLineHeight/2D&&N.from=Rt)break;ct>nt&&B(Math.max(Ft,nt),y==null&&Ft<=D,Math.min(ct,Rt),k==null&&ct>=U,Bt.dir)}if(nt=Mt.to+1,nt>=Rt)break}return W.length==0&&B(D,y==null,U,k==null,i.textDirection),{top:q,bottom:L,horizontal:W}}function v(y,k){let w=l.top+(k?y.top:y.bottom);return{top:w,bottom:w,horizontal:[]}}}function F0(i,t){return i.constructor==t.constructor&&i.eq(t)}var Sa=class{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement(\"div\")),this.dom.classList.add(\"cm-layer\"),e.above&&this.dom.classList.add(\"cm-layer-above\"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute(\"aria-hidden\",\"true\"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(bs)!=t.state.facet(bs)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,r=t.facet(bs);for(;e!F0(e,this.drawn[r]))){let e=this.dom.firstChild,r=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[r].constructor&&n.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(n.draw(),e);for(;e;){let n=e.nextSibling;e.remove(),e=n}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},bs=A.define();function Xd(i){return[ft.define(t=>new Sa(t,i)),bs.of(i)]}var Ld=!Q.ios,Zr=A.define({combine(i){return kt(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function Ls(i={}){return[Zr.of(i),_0,G0,H0,cd.of(!0)]}function Vd(i){return i.startState.facet(Zr)!=i.state.facet(Zr)}var _0=Xd({above:!0,markers(i){let{state:t}=i,e=t.facet(Zr),r=[];for(let n of t.selection.ranges){let s=n==t.selection.main;if(n.empty?!s||Ld:e.drawRangeCursor){let o=s?\"cm-cursor cm-cursor-primary\":\"cm-cursor cm-cursor-secondary\",l=n.empty?n:b.cursor(n.head,n.head>n.anchor?-1:1);for(let a of zr.forRange(i,o,l))r.push(a)}}return r},update(i,t){i.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName==\"cm-blink\"?\"cm-blink2\":\"cm-blink\");let e=Vd(i);return e&&qu(i.state,t),i.docChanged||i.selectionSet||e},mount(i,t){qu(t.state,i)},class:\"cm-cursorLayer\"});function qu(i,t){t.style.animationDuration=i.facet(Zr).cursorBlinkRate+\"ms\"}var G0=Xd({above:!1,markers(i){return i.state.selection.ranges.map(t=>t.empty?[]:zr.forRange(i,\"cm-selectionBackground\",t)).reduce((t,e)=>t.concat(e))},update(i,t){return i.docChanged||i.selectionSet||i.viewportChanged||Vd(i)},class:\"cm-selectionLayer\"}),wa={\".cm-line\":{\"& ::selection\":{backgroundColor:\"transparent !important\"},\"&::selection\":{backgroundColor:\"transparent !important\"}}};Ld&&(wa[\".cm-line\"].caretColor=\"transparent !important\",wa[\".cm-content\"]={caretColor:\"transparent !important\"});var H0=ie.highest(T.theme(wa)),Wd=M.define({map(i,t){return i==null?null:t.mapPos(i)}}),Qr=it.define({create(){return null},update(i,t){return i!=null&&(i=t.changes.mapPos(i)),t.effects.reduce((e,r)=>r.is(Wd)?r.value:e,i)}}),U0=ft.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var t;let e=i.state.field(Qr);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(\"div\")),this.cursor.className=\"cm-dropCursor\"),(i.startState.field(Qr)!=e||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,t=i.state.field(Qr),e=t!=null&&i.coordsAtPos(t);if(!e)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:e.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:e.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:e.bottom-e.top}}drawCursor(i){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;i?(this.cursor.style.left=i.left/t+\"px\",this.cursor.style.top=i.top/e+\"px\",this.cursor.style.height=i.height/e+\"px\"):this.cursor.style.left=\"-100000px\"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Qr)!=i&&this.view.dispatch({effects:Wd.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Vs(){return[Qr,U0]}var Aw=/x/.unicode!=null?\"gu\":\"g\";var va=2e3;function j0(i,t,e){let r=Math.min(t.line,e.line),n=Math.max(t.line,e.line),s=[];if(t.off>va||e.off>va||t.col<0||e.col<0){let o=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let a=r;a<=n;a++){let h=i.doc.line(a);h.length<=l&&s.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let a=r;a<=n;a++){let h=i.doc.line(a),f=os(h.text,o,i.tabSize,!0);if(f<0)s.push(b.cursor(h.to));else{let c=os(h.text,l,i.tabSize);s.push(b.range(h.from+f,h.from+c))}}}return s}function K0(i,t){let e=i.coordsAtPos(i.viewport.from);return e?Math.round(Math.abs((e.left-t)/i.defaultCharacterWidth)):-1}function Du(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1),r=i.state.doc.lineAt(e),n=e-r.from,s=n>va?-1:n==r.length?K0(i,t.clientX):We(r.text,i.state.tabSize,e-r.from);return{line:r.number,col:s,off:n}}function J0(i,t){let e=Du(i,t),r=i.state.selection;return e?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(e.line).from),o=n.state.doc.lineAt(s);e={line:o.number,col:e.col,off:Math.min(e.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let l=Du(i,n);if(!l)return r;let a=j0(i.state,e,l);return a.length?o?b.create(a.concat(r.ranges)):b.create(a):r}}:null}function qa(i){let t=i?.eventFilter||(e=>e.altKey&&e.button==0);return T.mouseSelectionStyle.of((e,r)=>t(r)?J0(e,r):null)}var tx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},ex={style:\"cursor: crosshair\"};function Ws(i={}){let[t,e]=tx[i.key||\"Alt\"],r=ft.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==t||e(n))},keyup(n){(n.keyCode==t||!e(n))&&this.set(!1)},mousemove(n){this.set(e(n))}}});return[r,T.contentAttributes.of(n=>{var s;return!((s=n.plugin(r))===null||s===void 0)&&s.isDown?ex:null})]}var kr=\"-10000px\",Ms=class{constructor(t,e,r,n){this.facet=e,this.createTooltipView=r,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(t,e){var r;let n=t.state.facet(this.facet),s=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let o=[],l=e?[]:null;for(let a=0;ae[h]=a),e.length=l.length),this.input=n,this.tooltips=s,this.tooltipViews=o,!0}};function ix(i){let{win:t}=i;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}var Nl=A.define({combine:i=>{var t,e,r;return{position:Q.ios?\"absolute\":((t=i.find(n=>n.position))===null||t===void 0?void 0:t.position)||\"fixed\",parent:((e=i.find(n=>n.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((r=i.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||ix}}}),Bu=new WeakMap,Da=ft.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=i.state.facet(Nl);this.position=t.position,this.parent=t.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==\"function\"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ms(i,Fr,(e,r)=>this.createTooltip(e,r),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==\"function\"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener(\"resize\",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(\"div\"),this.container.style.position=\"relative\",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(i,this.above);t&&this.observeIntersection();let e=t||i.geometryChanged,r=i.state.facet(Nl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(i,t){let e=i.create(this.view),r=t?t.dom:null;if(e.dom.classList.add(\"cm-tooltip\"),i.arrow&&!e.dom.querySelector(\".cm-tooltip > .cm-tooltip-arrow\")){let n=document.createElement(\"div\");n.className=\"cm-tooltip-arrow\",e.dom.insertBefore(n,r)}return e.dom.style.position=this.position,e.dom.style.top=kr,e.dom.style.left=\"0px\",this.container.insertBefore(e.dom,r),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var i,t,e;this.view.win.removeEventListener(\"resize\",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),t=1,e=1,r=!1;if(this.position==\"fixed\"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Q.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==kr&&n.style.left==\"0px\"){let s=n.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position==\"absolute\")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((n,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Nl).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:r}}writeMeasure(i){var t;if(i.makeAbsolute){this.madeAbsolute=!0,this.position=\"absolute\";for(let l of this.manager.tooltipViews)l.dom.style.position=\"absolute\"}let{editor:e,space:r,scaleX:n,scaleY:s}=i,o=[];for(let l=0;l=Math.min(e.bottom,r.bottom)||c.rightMath.min(e.right,r.right)+.1){f.style.top=kr;continue}let d=a.arrow?h.dom.querySelector(\".cm-tooltip-arrow\"):null,m=d?7:0,O=u.right-u.left,g=(t=Bu.get(h))!==null&&t!==void 0?t:u.bottom-u.top,x=h.offset||nx,S=this.view.textDirection==G.LTR,C=u.width>r.right-r.left?S?r.left:r.right-u.width:S?Math.min(c.left-(d?14:0)+x.x,r.right-O):Math.max(r.left,c.left-O+(d?14:0)-x.x),v=this.above[l];!a.strictSide&&(v?c.top-(u.bottom-u.top)-x.yr.bottom)&&v==r.bottom-c.bottom>c.top-r.top&&(v=this.above[l]=!v);let y=(v?c.top-r.top:r.bottom-c.bottom)-m;if(yC&&q.topk&&(k=v?q.top-g-2-m:q.bottom+m+2);if(this.position==\"absolute\"?(f.style.top=(k-i.parent.top)/s+\"px\",f.style.left=(C-i.parent.left)/n+\"px\"):(f.style.top=k/s+\"px\",f.style.left=C/n+\"px\"),d){let q=c.left+(S?x.x:-x.x)-(C+14-7);d.style.left=q/n+\"px\"}h.overlap!==!0&&o.push({left:C,top:k,right:w,bottom:k+g}),f.classList.toggle(\"cm-tooltip-above\",v),f.classList.toggle(\"cm-tooltip-below\",!v),h.positioned&&h.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=kr}},{eventObservers:{scroll(){this.maybeMeasure()}}}),rx=T.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:\"7px\",width:`${7*2}px`,position:\"absolute\",zIndex:-1,overflow:\"hidden\",\"&:before, &:after\":{content:\"''\",position:\"absolute\",width:0,height:0,borderLeft:\"7px solid transparent\",borderRight:\"7px solid transparent\"},\".cm-tooltip-above &\":{bottom:\"-7px\",\"&:before\":{borderTop:\"7px solid #bbb\"},\"&:after\":{borderTop:\"7px solid #f5f5f5\",bottom:\"1px\"}},\".cm-tooltip-below &\":{top:\"-7px\",\"&:before\":{borderBottom:\"7px solid #bbb\"},\"&:after\":{borderBottom:\"7px solid #f5f5f5\",top:\"1px\"}}},\"&dark .cm-tooltip .cm-tooltip-arrow\":{\"&:before\":{borderTopColor:\"#333338\",borderBottomColor:\"#333338\"},\"&:after\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"}}}),nx={x:0,y:0},Fr=A.define({enables:[Da,rx]}),Es=A.define({combine:i=>i.reduce((t,e)=>t.concat(e),[])}),$s=class i{static create(t){return new i(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement(\"div\"),this.dom.classList.add(\"cm-tooltip-hover\"),this.manager=new Ms(t,Es,(e,r)=>this.createHostedView(e,r),e=>e.dom.remove())}createHostedView(t,e){let r=t.create(this.view);return r.dom.classList.add(\"cm-tooltip-section\"),this.dom.insertBefore(r.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let r of this.manager.tooltipViews){let n=r[t];if(n!==void 0){if(e===void 0)e=n;else if(e!==n)return}}return e}get offset(){return this.passProp(\"offset\")}get getCoords(){return this.passProp(\"getCoords\")}get overlap(){return this.passProp(\"overlap\")}get resize(){return this.passProp(\"resize\")}},sx=Fr.compute([Es],i=>{let t=i.facet(Es);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var r;return(r=e.end)!==null&&r!==void 0?r:e.pos})),create:$s.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),ka=class{constructor(t,e,r,n,s){this.view=t,this.source=e,this.field=r,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener(\"mouseleave\",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener(\"mousemove\",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;tl.bottom||e.xl.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(n)).find(f=>f.from<=n&&f.to>=n),h=a&&a.dir==G.RTL?-1:1;s=e.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Ct(t.state,a,\"hover tooltip\"))}else o&&!(Array.isArray(o)&&!o.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(Da),e=t?t.manager.tooltips.findIndex(r=>r.create==$s.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!ox(s.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,l=(r=(e=n[0])===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!lx(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=r=>{t.removeEventListener(\"mouseleave\",e),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener(\"mouseleave\",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener(\"mouseleave\",this.mouseleave),this.view.dom.removeEventListener(\"mousemove\",this.mousemove)}},gs=4;function ox(i,t){let e=i.getBoundingClientRect();return t.clientX>=e.left-gs&&t.clientX<=e.right+gs&&t.clientY>=e.top-gs&&t.clientY<=e.bottom+gs}function lx(i,t,e,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),l=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.rightn||Math.min(o.bottom,l)=t&&a<=e}function Id(i,t={}){let e=M.define(),r=it.define({create(){return[]},update(n,s){if(n.length&&(t.hideOnChange&&(s.docChanged||s.selection)?n=[]:t.hideOn&&(n=n.filter(o=>!t.hideOn(s,o))),s.docChanged)){let o=[];for(let l of n){let a=s.changes.mapPos(l.pos,-1,ut.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=s.changes.mapPos(h.end)),o.push(h)}}n=o}for(let o of s.effects)o.is(e)&&(n=o.value),o.is(ax)&&(n=[]);return n},provide:n=>Es.from(n)});return[r,ft.define(n=>new ka(n,i,r,e,t.hoverTime||300)),sx]}function Ba(i,t){let e=i.plugin(Da);if(!e)return null;let r=e.manager.tooltips.indexOf(t);return r<0?null:e.manager.tooltipViews[r]}var ax=M.define();var Xu=A.define({combine(i){let t,e;for(let r of i)t=t||r.topContainer,e=e||r.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ci(i,t){let e=i.plugin(Nd),r=e?e.specs.indexOf(t):-1;return r>-1?e.panels[r]:null}var Nd=ft.fromClass(class{constructor(i){this.input=i.state.facet(fi),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(i));let t=i.state.facet(Xu);this.top=new Ni(i,!0,t.topContainer),this.bottom=new Ni(i,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(\"cm-panel\"),e.mount&&e.mount()}update(i){let t=i.state.facet(Xu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ni(i.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ni(i.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=i.state.facet(fi);if(e!=this.input){let r=e.filter(a=>a),n=[],s=[],o=[],l=[];for(let a of r){let h=this.specs.indexOf(a),f;h<0?(f=a(i.view),l.push(f)):(f=this.panels[h],f.update&&f.update(i)),n.push(f),(f.top?s:o).push(f)}this.specs=r,this.panels=n,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add(\"cm-panel\"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})}),Ni=class{constructor(t,e,r){this.view=t,this.top=e,this.container=r,this.dom=void 0,this.classes=\"\",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement(\"div\"),this.dom.className=this.top?\"cm-panels cm-panels-top\":\"cm-panels cm-panels-bottom\",this.dom.style[this.top?\"top\":\"bottom\"]=\"0\";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Lu(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Lu(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(\" \"))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(\" \"))t&&this.container.classList.add(t)}}};function Lu(i){let t=i.nextSibling;return i.remove(),t}var fi=A.define({enables:Nd}),se=class extends ee{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}};se.prototype.elementClass=\"\";se.prototype.toDOM=void 0;se.prototype.mapMode=ut.TrackBefore;se.prototype.startSide=se.prototype.endSide=-1;se.prototype.point=!0;var Yl=A.define(),hx={class:\"\",renderEmptyElements:!1,elementStyle:\"\",markers:()=>_.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Dr=A.define();function _r(i){return[Yd(),Dr.of(Object.assign(Object.assign({},hx),i))]}var Ta=A.define({combine:i=>i.some(t=>t)});function Yd(i){let t=[fx];return i&&i.fixed===!1&&t.push(Ta.of(!0)),t}var fx=ft.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutters\",this.dom.setAttribute(\"aria-hidden\",\"true\"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+\"px\",this.gutters=i.state.facet(Dr).map(t=>new qs(i,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!i.state.facet(Ta),this.fixed&&(this.dom.style.position=\"sticky\"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let t=this.prevViewport,e=i.view.viewport,r=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(r<(e.to-e.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+\"px\"),this.view.state.facet(Ta)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?\"sticky\":\"\"),this.prevViewport=i.view.viewport}syncGutters(i){let t=this.dom.nextSibling;i&&this.dom.remove();let e=_.iter(this.view.state.facet(Yl),this.view.viewport.from),r=[],n=this.gutters.map(s=>new Ca(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Pt.Text&&o){Pa(e,r,l.from);for(let a of n)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of n)a.widget(this.view,l)}else if(s.type==Pt.Text){Pa(e,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(i){let t=i.startState.facet(Dr),e=i.state.facet(Dr),r=i.docChanged||i.heightChanged||i.viewportChanged||!_.eq(i.startState.facet(Yl),i.state.facet(Yl),i.view.viewport.from,i.view.viewport.to);if(t==e)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of e){let o=t.indexOf(s);o<0?n.push(new qs(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==G.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Vu(i){return Array.isArray(i)?i:[i]}function Pa(i,t,e){for(;i.value&&i.from<=e;)i.from==e&&t.push(i.value),i.next()}var Ca=class{constructor(t,e,r){this.gutter=t,this.height=r,this.i=0,this.cursor=_.iter(t.markers,e.from)}addElement(t,e,r){let{gutter:n}=this,s=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==n.elements.length){let l=new Ds(t,o,s,r);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,o,s,r);this.height=e.bottom,this.i++}line(t,e,r){let n=[];Pa(this.cursor,n,e.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(t,e,n)}widget(t,e){let r=this.gutter.config.widgetMarker(t,e.widget,e);r&&this.addElement(t,e,[r])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}},qs=class{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutter\"+(this.config.class?\" \"+this.config.class:\"\");for(let r in e.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=n.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[r](t,l,n)&&n.preventDefault()});this.markers=Vu(e.markers(t)),e.initialSpacer&&(this.spacer=new Ds(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=\"visibility: hidden; pointer-events: none\")}update(t){let e=this.markers;if(this.markers=Vu(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}let r=t.view.viewport;return!_.eq(this.markers,e,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}},Ds=class{constructor(t,e,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutterElement\",this.update(t,e,r,n)}update(t,e,r,n){this.height!=e&&(this.height=e,this.dom.style.height=e+\"px\"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+\"px\":\"\"),cx(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let r=\"cm-gutterElement\",n=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,h)||o(l,a,h):o}return r}})}}),Br=class extends se{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}};function zl(i,t){return i.state.facet(Yi).formatNumber(t,i.state)}var dx=Dr.compute([Yi],i=>({class:\"cm-lineNumbers\",renderEmptyElements:!1,markers(t){return t.state.facet(ux)},lineMarker(t,e,r){return r.some(n=>n.toDOM)?null:new Br(zl(t,t.state.doc.lineAt(e.from).number))},widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Yi)!=t.state.facet(Yi),initialSpacer(t){return new Br(zl(t,Wu(t.state.doc.lines)))},updateSpacer(t,e){let r=zl(e.view,Wu(e.view.state.doc.lines));return r==t.number?t:new Br(r)},domEventHandlers:i.facet(Yi).domEventHandlers}));function ui(i={}){return[Yi.of(i),Yd(),dx]}function Wu(i){let t=9;for(;t{throw new Error(\"This node type doesn't define a deserialize function\")})}add(t){if(this.perNode)throw new RangeError(\"Can't add per-node props to node types\");return typeof t!=\"function\"&&(t=bt.match(t)),e=>{let r=t(e);return r===void 0?null:[this,r]}}};E.closedBy=new E({deserialize:i=>i.split(\" \")});E.openedBy=new E({deserialize:i=>i.split(\" \")});E.group=new E({deserialize:i=>i.split(\" \")});E.isolate=new E({deserialize:i=>{if(i&&i!=\"rtl\"&&i!=\"ltr\"&&i!=\"auto\")throw new RangeError(\"Invalid value for isolate: \"+i);return i||\"auto\"}});E.contextHash=new E({perNode:!0});E.lookAhead=new E({perNode:!0});E.mounted=new E({perNode:!0});var Fi=class{constructor(t,e,r){this.tree=t,this.overlay=e,this.parser=r}static get(t){return t&&t.props&&t.props[E.mounted.id]}},mx=Object.create(null),bt=class i{constructor(t,e,r,n=0){this.name=t,this.props=e,this.id=r,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):mx,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new i(t.name||\"\",e,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError(\"Can't store a per-node prop on a node type\");e[s[0].id]=s[1]}}return n}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t==\"string\"){if(this.name==t)return!0;let e=this.prop(E.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let r in t)for(let n of r.split(\" \"))e[n]=t[r];return r=>{for(let n=r.prop(E.group),s=-1;s<(n?n.length:0);s++){let o=e[s<0?r.name:n[s]];if(o)return o}}}};bt.none=new bt(\"\",Object.create(null),0,8);var Hr=class i{constructor(t){this.types=t;for(let e=0;e0;for(let a=this.cursor(o|st.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ya(bt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,r,n)=>new i(this.type,e,r,n,this.propValues),t.makeTree||((e,r,n)=>new i(bt.none,e,r,n)))}static build(t){return Ox(t)}};ot.empty=new ot(bt.none,[],[],0);var Xa=class i{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},_e=class i{constructor(t,e,r){this.buffer=t,this.length=e,this.set=r}get type(){return bt.none}toString(){let t=[];for(let e=0;e0));a=o[a+3]);return l}slice(t,e,r){let n=this.buffer,s=new Uint16Array(e-t),o=0;for(let l=t,a=0;l=t&&et;case 1:return e<=t&&r>t;case 2:return r>t;case 4:return!0}}function Ur(i,t,e,r){for(var n;i.from==i.to||(e<1?i.from>=t:i.from>t)||(e>-1?i.to<=t:i.to0?l.length:-1;t!=h;t+=e){let f=l[t],c=a[t]+o.from;if(_d(n,r,c,c+f.length)){if(f instanceof _e){if(s&st.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,e,r-c,n);if(u>-1)return new di(new Va(o,f,t,c),null,u)}else if(s&st.IncludeAnonymous||!f.type.isAnonymous||Na(f)){let u;if(!(s&st.IgnoreMounts)&&(u=Fi.get(f))&&!u.overlay)return new i(u.tree,c,t,o);let d=new i(f,c,t,o);return s&st.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(e<0?f.children.length-1:0,e,r,n)}}}if(s&st.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,r=0){let n;if(!(r&st.IgnoreOverlays)&&(n=Fi.get(this._tree))&&n.overlay){let s=t-this.from;for(let{from:o,to:l}of n.overlay)if((e>0?o<=s:o=s:l>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Zd(i,t,e,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(t)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function La(i,t,e=t.length-1){for(let r=i.parent;e>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[e]&&t[e]!=r.name)return!1;e--}}return!0}var Va=class{constructor(t,e,r,n){this.parent=t,this.buffer=e,this.index=r,this.start=n}},di=class i extends Ys{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,r){super(),this.context=t,this._parent=e,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,e,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,r);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,r=0){if(r&st.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new i(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new i(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];t.push(r.slice(n,s,o)),e.push(0)}return new ot(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Gd(i){if(!i.length)return null;let t=0,e=i[0];for(let s=1;se.from||o.to=t){let l=new jt(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(Ur(l,t,e,!1))}}return n?Gd(n):r}var jr=class{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof jt)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:r,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=r+n.buffer[t+1],this.to=r+n.buffer[t+2],!0}yield(t){return t?t instanceof jt?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,r=this.mode){return this.buffer?r&st.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,r=this.stack.length-1;if(t<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(r<0?e.buffer.length:e.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,r,{buffer:n}=this;if(n){if(t>0){if(this.index-1)for(let s=e+t,o=t<0?-1:r._tree.children.length;s!=o;s+=t){let l=r._tree.children[s];if(this.mode&st.IncludeAnonymous||l instanceof _e||!l.type.isAnonymous||Na(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,r=s+1;break t}n=this.stack[--s]}for(let n=r;n=0;s--){if(s<0)return La(this.node,t,n);let o=r[e.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};function Na(i){return i.children.some(t=>t instanceof _e||!t.type.isAnonymous||Na(t))}function Ox(i){var t;let{buffer:e,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,l=Array.isArray(e)?new Xa(e,e.length):e,a=r.types,h=0,f=0;function c(y,k,w,q,L,W){let{id:B,start:D,end:U,size:N}=l,nt=f;for(;N<0;)if(l.next(),N==-1){let ct=s[B];w.push(ct),q.push(D-y);return}else if(N==-3){h=B;return}else if(N==-4){f=B;return}else throw new RangeError(`Unrecognized record size: ${N}`);let Rt=a[B],Mt,Bt,Ft=D-y;if(U-D<=n&&(Bt=g(l.pos-k,L))){let ct=new Uint16Array(Bt.size-Bt.skip),_t=l.pos-Bt.size,de=ct.length;for(;l.pos>_t;)de=x(Bt.start,ct,de);Mt=new _e(ct,U-Bt.start,r),Ft=Bt.start-y}else{let ct=l.pos-N;l.next();let _t=[],de=[],ri=B>=o?B:-1,Ei=0,Un=U;for(;l.pos>ct;)ri>=0&&l.id==ri&&l.size>=0?(l.end<=Un-n&&(m(_t,de,D,Ei,l.end,Un,ri,nt),Ei=_t.length,Un=l.end),l.next()):W>2500?u(D,ct,_t,de):c(D,ct,_t,de,ri,W+1);if(ri>=0&&Ei>0&&Ei<_t.length&&m(_t,de,D,Ei,D,Un,ri,nt),_t.reverse(),de.reverse(),ri>-1&&Ei>0){let Mc=d(Rt);Mt=Ya(Rt,_t,de,0,_t.length,0,U-D,Mc,Mc)}else Mt=O(Rt,_t,de,U-D,nt-U)}w.push(Mt),q.push(Ft)}function u(y,k,w,q){let L=[],W=0,B=-1;for(;l.pos>k;){let{id:D,start:U,end:N,size:nt}=l;if(nt>4)l.next();else{if(B>-1&&U=0;N-=3)D[nt++]=L[N],D[nt++]=L[N+1]-U,D[nt++]=L[N+2]-U,D[nt++]=nt;w.push(new _e(D,L[2]-U,r)),q.push(U-y)}}function d(y){return(k,w,q)=>{let L=0,W=k.length-1,B,D;if(W>=0&&(B=k[W])instanceof ot){if(!W&&B.type==y&&B.length==q)return B;(D=B.prop(E.lookAhead))&&(L=w[W]+B.length+D)}return O(y,k,w,q,L)}}function m(y,k,w,q,L,W,B,D){let U=[],N=[];for(;y.length>q;)U.push(y.pop()),N.push(k.pop()+w-L);y.push(O(r.types[B],U,N,W-L,D-W)),k.push(L-w)}function O(y,k,w,q,L=0,W){if(h){let B=[E.contextHash,h];W=W?[B].concat(W):[B]}if(L>25){let B=[E.lookAhead,L];W=W?[B].concat(W):[B]}return new ot(y,k,w,q,W)}function g(y,k){let w=l.fork(),q=0,L=0,W=0,B=w.end-n,D={size:0,start:0,skip:0};t:for(let U=w.pos-y;w.pos>U;){let N=w.size;if(w.id==k&&N>=0){D.size=q,D.start=L,D.skip=W,W+=4,q+=4,w.next();continue}let nt=w.pos-N;if(N<0||nt=o?4:0,Mt=w.start;for(w.next();w.pos>nt;){if(w.size<0)if(w.size==-3)Rt+=4;else break t;else w.id>=o&&(Rt+=4);w.next()}L=Mt,q+=N,W+=Rt}return(k<0||q==y)&&(D.size=q,D.start=L,D.skip=W),D.size>4?D:void 0}function x(y,k,w){let{id:q,start:L,end:W,size:B}=l;if(l.next(),B>=0&&q4){let U=l.pos-(B-4);for(;l.pos>U;)w=x(y,k,w)}k[--w]=D,k[--w]=W-y,k[--w]=L-y,k[--w]=q}else B==-3?h=q:B==-4&&(f=q);return w}let S=[],C=[];for(;l.pos>0;)c(i.start||0,i.bufferStart||0,S,C,-1,0);let v=(t=i.length)!==null&&t!==void 0?t:S.length?C[0]+S[0].length:0;return new ot(a[i.topID],S.reverse(),C.reverse(),v)}var Fd=new WeakMap;function Ns(i,t){if(!i.isAnonymous||t instanceof _e||t.type!=i)return 1;let e=Fd.get(t);if(e==null){e=1;for(let r of t.children){if(r.type!=i||!(r instanceof ot)){e=1;break}e+=Ns(i,r)}Fd.set(t,e)}return e}function Ya(i,t,e,r,n,s,o,l,a){let h=0;for(let m=r;m=f)break;k+=w}if(C==v+1){if(k>f){let w=m[v];d(w.children,w.positions,0,w.children.length,O[v]+S);continue}c.push(m[v])}else{let w=O[C-1]+m[C-1].length-y;c.push(Ya(i,m,O,v,C,y,w,null,a))}u.push(y+S-s)}}return d(t,e,r,n,0),(l||a)(c,u,o)}var zs=class{constructor(){this.map=new WeakMap}setBuffer(t,e,r){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,r)}getBuffer(t,e){let r=this.map.get(t);return r&&r.get(e)}set(t,e){t instanceof di?this.setBuffer(t.context.buffer,t.index,e):t instanceof jt&&this.map.set(t.tree,e)}get(t){return t instanceof di?this.getBuffer(t.context.buffer,t.index):t instanceof jt?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},pi=class i{constructor(t,e,r,n,s=!1,o=!1){this.from=t,this.to=e,this.tree=r,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],r=!1){let n=[new i(0,t.length,t,0,!1,r)];for(let s of e)s.to>t.length&&n.push(s);return n}static applyChanges(t,e,r=128){if(!e.length)return t;let n=[],s=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let f=l=r)for(;o&&o.from=u.from||c<=u.to||h){let d=Math.max(u.from,a)-h,m=Math.min(u.to,c)-h;u=d>=m?null:new i(d,m,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=snew Gr(n.from,n.to)):[new Gr(0,0)]:[new Gr(0,t.length)],this.createParse(t,e||[],r)}parse(t,e,r){let n=this.startParse(t,e,r);for(;;){let s=n.advance();if(s)return s}}},Ia=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};var Dw=new E({perNode:!0});var xx=0,we=class i{constructor(t,e,r){this.set=t,this.base=e,this.modified=r,this.id=xx++}static define(t){if(t?.base)throw new Error(\"Can not derive from a modified tag\");let e=new i([],null,[]);if(e.set.push(e),t)for(let r of t.set)e.set.push(r);return e}static defineModifier(){let t=new Gs;return e=>e.modified.indexOf(t)>-1?e:Gs.get(e.base||e,e.modified.concat(t).sort((r,n)=>r.id-n.id))}},yx=0,Gs=class i{constructor(){this.instances=[],this.id=yx++}static get(t,e){if(!e.length)return t;let r=e[0].instances.find(l=>l.base==t&&bx(e,l.modified));if(r)return r;let n=[],s=new we(n,t,e);for(let l of e)l.instances.push(s);let o=Sx(e);for(let l of t.set)if(!l.modified.length)for(let a of o)n.push(i.get(l,a));return s}};function bx(i,t){return i.length==t.length&&i.every((e,r)=>e==t[r])}function Sx(i){let t=[[]];for(let e=0;er.length-e.length)}function Hs(i){let t=Object.create(null);for(let e in i){let r=i[e];Array.isArray(r)||(r=[r]);for(let n of e.split(\" \"))if(n){let s=[],o=2,l=n;for(let c=0;;){if(l==\"...\"&&c>0&&c+3==n.length){o=1;break}let u=/^\"(?:[^\"\\\\]|\\\\.)*?\"|[^\\/!]+/.exec(l);if(!u)throw new RangeError(\"Invalid path: \"+n);if(s.push(u[0]==\"*\"?\"\":u[0][0]=='\"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let d=n[c++];if(c==n.length&&d==\"!\"){o=0;break}if(d!=\"/\")throw new RangeError(\"Invalid path: \"+n);l=n.slice(c)}let a=s.length-1,h=s[a];if(!h)throw new RangeError(\"Invalid path: \"+n);let f=new Gi(r,o,a>0?s.slice(0,a):null);t[h]=f.sort(t[h])}}return jd.add(t)}var jd=new E,Gi=class{constructor(t,e,r,n){this.tags=t,this.mode=e,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=n;for(let l of s)for(let a of l.set){let h=e[a.id];if(h){o=o?o+\" \"+h:h;break}}return o},scope:r}}function wx(i,t){let e=null;for(let r of i){let n=r.style(t);n&&(e=e?e+\" \"+n:n)}return e}function Kd(i,t,e,r=0,n=i.length){let s=new Za(r,Array.isArray(t)?t:[t],e);s.highlightRange(i.cursor(),r,n,\"\",s.highlighters),s.flush(n)}var Za=class{constructor(t,e,r){this.at=t,this.highlighters=e,this.span=r,this.class=\"\"}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,r,n,s){let{type:o,from:l,to:a}=t;if(l>=r||a<=e)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,f=vx(t)||Gi.empty,c=wx(s,f.tags);if(c&&(h&&(h+=\" \"),h+=c,f.mode==1&&(n+=(n?\" \":\"\")+c)),this.startSpan(Math.max(e,l),h),f.opaque)return;let u=t.tree&&t.tree.prop(E.mounted);if(u&&u.overlay){let d=t.node.enter(u.overlay[0].from+l,1),m=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),O=t.firstChild();for(let g=0,x=l;;g++){let S=g=C||!t.nextSibling())););if(!S||C>r)break;x=S.to+l,x>e&&(this.highlightRange(d.cursor(),Math.max(e,S.from+l),Math.min(r,x),\"\",m),this.startSpan(Math.min(r,x),h))}O&&t.parent()}else if(t.firstChild()){u&&(n=\"\");do if(!(t.to<=e)){if(t.from>=r)break;this.highlightRange(t,e,r,n,s),this.startSpan(Math.min(r,t.to),h)}while(t.nextSibling());t.parent()}}};function vx(i){let t=i.type.prop(jd);for(;t&&t.context&&!i.matchContext(t.context);)t=t.next;return t||null}var P=we.define,Zs=P(),Ge=P(),Hd=P(Ge),Ud=P(Ge),He=P(),Fs=P(He),za=P(He),Se=P(),mi=P(Se),ye=P(),be=P(),Fa=P(),Kr=P(Fa),_s=P(),p={comment:Zs,lineComment:P(Zs),blockComment:P(Zs),docComment:P(Zs),name:Ge,variableName:P(Ge),typeName:Hd,tagName:P(Hd),propertyName:Ud,attributeName:P(Ud),className:P(Ge),labelName:P(Ge),namespace:P(Ge),macroName:P(Ge),literal:He,string:Fs,docString:P(Fs),character:P(Fs),attributeValue:P(Fs),number:za,integer:P(za),float:P(za),bool:P(He),regexp:P(He),escape:P(He),color:P(He),url:P(He),keyword:ye,self:P(ye),null:P(ye),atom:P(ye),unit:P(ye),modifier:P(ye),operatorKeyword:P(ye),controlKeyword:P(ye),definitionKeyword:P(ye),moduleKeyword:P(ye),operator:be,derefOperator:P(be),arithmeticOperator:P(be),logicOperator:P(be),bitwiseOperator:P(be),compareOperator:P(be),updateOperator:P(be),definitionOperator:P(be),typeOperator:P(be),controlOperator:P(be),punctuation:Fa,separator:P(Fa),bracket:Kr,angleBracket:P(Kr),squareBracket:P(Kr),paren:P(Kr),brace:P(Kr),content:Se,heading:mi,heading1:P(mi),heading2:P(mi),heading3:P(mi),heading4:P(mi),heading5:P(mi),heading6:P(mi),contentSeparator:P(Se),list:P(Se),quote:P(Se),emphasis:P(Se),strong:P(Se),link:P(Se),monospace:P(Se),strikethrough:P(Se),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:_s,documentMeta:P(_s),annotation:P(_s),processingInstruction:P(_s),definition:we.defineModifier(),constant:we.defineModifier(),function:we.defineModifier(),standard:we.defineModifier(),local:we.defineModifier(),special:we.defineModifier()},Lw=_a([{tag:p.link,class:\"tok-link\"},{tag:p.heading,class:\"tok-heading\"},{tag:p.emphasis,class:\"tok-emphasis\"},{tag:p.strong,class:\"tok-strong\"},{tag:p.keyword,class:\"tok-keyword\"},{tag:p.atom,class:\"tok-atom\"},{tag:p.bool,class:\"tok-bool\"},{tag:p.url,class:\"tok-url\"},{tag:p.labelName,class:\"tok-labelName\"},{tag:p.inserted,class:\"tok-inserted\"},{tag:p.deleted,class:\"tok-deleted\"},{tag:p.literal,class:\"tok-literal\"},{tag:p.string,class:\"tok-string\"},{tag:p.number,class:\"tok-number\"},{tag:[p.regexp,p.escape,p.special(p.string)],class:\"tok-string2\"},{tag:p.variableName,class:\"tok-variableName\"},{tag:p.local(p.variableName),class:\"tok-variableName tok-local\"},{tag:p.definition(p.variableName),class:\"tok-variableName tok-definition\"},{tag:p.special(p.variableName),class:\"tok-variableName2\"},{tag:p.definition(p.propertyName),class:\"tok-propertyName tok-definition\"},{tag:p.typeName,class:\"tok-typeName\"},{tag:p.namespace,class:\"tok-namespace\"},{tag:p.className,class:\"tok-className\"},{tag:p.macroName,class:\"tok-macroName\"},{tag:p.propertyName,class:\"tok-propertyName\"},{tag:p.operator,class:\"tok-operator\"},{tag:p.comment,class:\"tok-comment\"},{tag:p.meta,class:\"tok-meta\"},{tag:p.invalid,class:\"tok-invalid\"},{tag:p.punctuation,class:\"tok-punctuation\"}]);var Ga,Hi=new E;function kx(i){return A.define({combine:i?t=>t.concat(i):void 0})}var Tx=new E,Wt=class{constructor(t,e,r=[],n=\"\"){this.data=t,this.name=n,Y.prototype.hasOwnProperty(\"tree\")||Object.defineProperty(Y.prototype,\"tree\",{get(){return pt(this)}}),this.parser=e,this.extension=[Ui.of(this),Y.languageData.of((s,o,l)=>{let a=Jd(s,o,l),h=a.type.prop(Hi);if(!h)return[];let f=s.facet(h),c=a.type.prop(Tx);if(c){let u=a.resolve(o-a.from,l);for(let d of c)if(d.test(u,s)){let m=s.facet(d.facet);return d.type==\"replace\"?m:m.concat(f)}}return f})].concat(r)}isActiveAt(t,e,r=-1){return Jd(t,e,r).type.prop(Hi)==this.data}findRegions(t){let e=t.facet(Ui);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(Hi)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(E.mounted);if(l){if(l.tree.prop(Hi)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(n(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?e:void 0)]}),t.name)}configure(t,e){return new i(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function pt(i){let t=i.field(Wt.state,!1);return t?t.tree:ot.empty}var Ka=class{constructor(t){this.doc=t,this.cursorPos=0,this.string=\"\",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let r=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-r,e-r)}},Jr=null,Ja=class i{constructor(t,e,r=[],n,s,o,l,a){this.parser=t,this.state=e,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,r){return new i(t,e,[],ot.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Ka(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=ot.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t==\"number\"){let n=Date.now()+t;t=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(pi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Jr;Jr=this;try{return t()}finally{Jr=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=tp(t,e.from,e.to);return t}changes(t,e){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),r=pi.applyChanges(r,a),n=ot.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=t.mapPos(h.from,1),c=t.mapPos(h.to,-1);ft.from&&(this.fragments=tp(this.fragments,n,s),this.skipped.splice(r--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends _i{createParse(e,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let a=Jr;if(a){for(let h of n)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new ot(bt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Jr}};function tp(i,t,e){return pi.applyChanges(i,[{fromA:t,toA:e,fromB:t,toB:e}])}var tn=class i{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,r)||e.takeTree(),new i(e)}static init(t){let e=Math.min(3e3,t.doc.length),r=Ja.create(t.facet(Ui).parser,t,{from:0,to:e});return r.work(20,e)||r.takeTree(),new i(r)}};Wt.state=it.define({create:tn.init,update(i,t){for(let e of t.effects)if(e.is(Wt.setState))return e.value;return t.startState.facet(Ui)!=t.state.facet(Ui)?tn.init(t.state):i.apply(t)}});var sp=i=>{let t=setTimeout(()=>i(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<\"u\"&&(sp=i=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(i,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});var Ha=typeof navigator<\"u\"&&(!((Ga=navigator.scheduling)===null||Ga===void 0)&&Ga.isInputPending)?()=>navigator.scheduling.isInputPending():null,Px=ft.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Wt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=sp(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work(()=>Ha&&Ha()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Wt.setState.of(new tn(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Ct(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ui=A.define({combine(i){return i.length?i[0]:null},enables:i=>[Wt.state,Px,T.contentAttributes.compute([i],t=>{let e=t.facet(i);return e&&e.name?{\"data-language\":e.name}:{}})]}),js=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}};var Cx=A.define(),ke=A.define({combine:i=>{if(!i.length)return\" \";let t=i[0];if(!t||/\\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error(\"Invalid indent unit: \"+JSON.stringify(i[0]));return t}});function en(i){let t=i.facet(ke);return t.charCodeAt(0)==9?i.tabSize*t.length:t.length}function rn(i,t){let e=\"\",r=i.tabSize,n=i.facet(ke)[0];if(n==\"\t\"){for(;t>=r;)e+=\"\t\",t-=r;n=\" \"}for(let s=0;s=t?Ax(i,e,t):null}var gi=class{constructor(t,e={}){this.state=t,this.options=e,this.unit=en(t)}lineAt(t,e=1){let r=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=r.from&&n<=r.to?s&&n==t?{text:\"\",from:t}:(e<0?n-1&&(s+=o-this.countColumn(r,r.search(/\\S|$/))),s}countColumn(t,e=t.length){return We(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:r,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(r,r.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},lh=new E;function Ax(i,t,e){let r=t.resolveStack(e),n=r.node.enterUnfinishedNodesBefore(e);if(n!=r.node){let s=[];for(let o=n;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return op(r,i,e)}function op(i,t,e){for(let r=i;r;r=r.next){let n=Rx(r.node);if(n)return n(th.create(t,e,r))}return 0}function Qx(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function Rx(i){let t=i.type.prop(lh);if(t)return t;let e=i.firstChild,r;if(e&&(r=e.type.prop(E.closedBy))){let n=i.lastChild,s=n&&r.indexOf(n.name)>-1;return o=>lp(o,!0,1,void 0,s&&!Qx(o)?n.from:void 0)}return i.parent==null?Mx:null}function Mx(){return 0}var th=class i extends gi{constructor(t,e,r){super(t.state,t.options),this.base=t,this.pos=e,this.context=r}get node(){return this.context.node}static create(t,e,r){return new i(t,e,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(e.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Ex(r,t))break;e=this.state.doc.lineAt(r.from)}return this.lineIndent(e.from)}continue(){return op(this.context.next,this.base,this.pos)}};function Ex(i,t){for(let e=t;e;e=e.parent)if(i==e)return!0;return!1}function $x(i){let t=i.node,e=t.childAfter(t.from),r=t.lastChild;if(!e)return null;let n=i.options.simulateBreak,s=i.state.doc.lineAt(e.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let l=e.to;;){let a=t.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.fromlp(r,t,e,i)}function lp(i,t,e,r,n){let s=i.textAfter,o=s.match(/^\\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||n==i.pos+o,a=t?$x(i):null;return a?l?i.column(a.from):i.column(a.to):i.baseIndent+(l?0:i.unit*e)}var qx=A.define(),ah=new E;function ap(i){let t=i.firstChild,e=i.lastChild;return t&&t.toe)continue;if(s&&l.from=t&&h.to>e&&(s=h)}}return s}function Bx(i){let t=i.lastChild;return t&&t.to==i.to&&t.type.isError}function hp(i,t,e){for(let r of i.facet(qx)){let n=r(i,t,e);if(n)return n}return Dx(i,t,e)}function fp(i,t){let e=t.mapPos(i.from,1),r=t.mapPos(i.to,-1);return e>=r?void 0:{from:e,to:r}}var hh=M.define({map:fp}),Js=M.define({map:fp});function cp(i){let t=[];for(let{head:e}of i.state.selection.ranges)t.some(r=>r.from<=e&&r.to>=e)||t.push(i.lineBlockAt(e));return t}var nn=it.define({create(){return R.none},update(i,t){i=i.map(t.changes);for(let e of t.effects)if(e.is(hh)&&!Xx(i,e.value.from,e.value.to)){let{preparePlaceholder:r}=t.state.facet(fh),n=r?R.replace({widget:new eh(r(t.state,e.value))}):ep;i=i.update({add:[n.range(e.value.from,e.value.to)]})}else e.is(Js)&&(i=i.update({filter:(r,n)=>e.value.from!=r||e.value.to!=n,filterFrom:e.value.from,filterTo:e.value.to}));if(t.selection){let e=!1,{head:r}=t.selection.main;i.between(r,r,(n,s)=>{nr&&(e=!0)}),e&&(i=i.update({filterFrom:r,filterTo:r,filter:(n,s)=>s<=r||n>=r}))}return i},provide:i=>T.decorations.from(i),toJSON(i,t){let e=[];return i.between(0,t.doc.length,(r,n)=>{e.push(r,n)}),e},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError(\"Invalid JSON for fold state\");let t=[];for(let e=0;e{(!n||n.from>s)&&(n={from:s,to:o})}),n}function Xx(i,t,e){let r=!1;return i.between(t,t,(n,s)=>{n==t&&s==e&&(r=!0)}),r}function dp(i,t){return i.field(nn,!1)?t:t.concat(M.appendConfig.of(Yx()))}var Lx=i=>{for(let t of cp(i)){let e=hp(i.state,t.from,t.to);if(e)return i.dispatch({effects:dp(i.state,[hh.of(e),pp(i,e)])}),!0}return!1},Vx=i=>{if(!i.state.field(nn,!1))return!1;let t=[];for(let e of cp(i)){let r=up(i.state,e.from,e.to);r&&t.push(Js.of(r),pp(i,r,!1))}return t.length&&i.dispatch({effects:t}),t.length>0};function pp(i,t,e=!0){let r=i.state.doc.lineAt(t.from).number,n=i.state.doc.lineAt(t.to).number;return T.announce.of(`${i.state.phrase(e?\"Folded lines\":\"Unfolded lines\")} ${r} ${i.state.phrase(\"to\")} ${n}.`)}var Wx=i=>{let{state:t}=i,e=[];for(let r=0;r{let t=i.state.field(nn,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,i.state.doc.length,(r,n)=>{e.push(Js.of({from:r,to:n}))}),i.dispatch({effects:e}),!0};var to=[{key:\"Ctrl-Shift-[\",mac:\"Cmd-Alt-[\",run:Lx},{key:\"Ctrl-Shift-]\",mac:\"Cmd-Alt-]\",run:Vx},{key:\"Ctrl-Alt-[\",run:Wx},{key:\"Ctrl-Alt-]\",run:Ix}],Nx={placeholderDOM:null,preparePlaceholder:null,placeholderText:\"\\u2026\"},fh=A.define({combine(i){return kt(i,Nx)}});function Yx(i){let t=[nn,zx];return i&&t.push(fh.of(i)),t}function mp(i,t){let{state:e}=i,r=e.facet(fh),n=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=up(i.state,l.from,l.to);a&&i.dispatch({effects:Js.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,t);let s=document.createElement(\"span\");return s.textContent=r.placeholderText,s.setAttribute(\"aria-label\",e.phrase(\"folded code\")),s.title=e.phrase(\"unfold\"),s.className=\"cm-foldPlaceholder\",s.onclick=n,s}var ep=R.replace({widget:new class extends Ut{toDOM(i){return mp(i,null)}}}),eh=class extends Ut{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return mp(t,this.value)}};var zx=T.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\"}}),ve=class i{constructor(t,e){this.specs=t;let r;function n(l){let a=Gt.newName();return(r||(r=Object.create(null)))[\".\"+a]=l,a}let s=typeof e.all==\"string\"?e.all:e.all?n(e.all):void 0,o=e.scope;this.scope=o instanceof Wt?l=>l.prop(Hi)==o.data:o?l=>l==o:void 0,this.style=_a(t.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Gt(r):null,this.themeType=e.themeType}static define(t,e){return new i(t,e||{})}},ih=A.define(),gp=A.define({combine(i){return i.length?[i[0]]:null}});function Ua(i){let t=i.facet(ih);return t.length?t:i.facet(gp)}function Te(i,t){let e=[Zx],r;return i instanceof ve&&(i.module&&e.push(T.styleModule.of(i.module)),r=i.themeType),t?.fallback?e.push(gp.of(i)):r?e.push(ih.computeN([T.darkTheme],n=>n.facet(T.darkTheme)==(r==\"dark\")?[i]:[])):e.push(ih.of(i)),e}var rh=class{constructor(t){this.markCache=Object.create(null),this.tree=pt(t.state),this.decorations=this.buildDeco(t,Ua(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=pt(t.state),r=Ua(t.state),n=r!=Ua(t.startState),{viewport:s}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return R.none;let r=new Ee;for(let{from:n,to:s}of t.visibleRanges)Kd(this.tree,e,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},n,s);return r.finish()}},Zx=ie.high(ft.fromClass(rh,{decorations:i=>i.decorations})),eo=ve.define([{tag:p.meta,color:\"#404740\"},{tag:p.link,textDecoration:\"underline\"},{tag:p.heading,textDecoration:\"underline\",fontWeight:\"bold\"},{tag:p.emphasis,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\"},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.keyword,color:\"#708\"},{tag:[p.atom,p.bool,p.url,p.contentSeparator,p.labelName],color:\"#219\"},{tag:[p.literal,p.inserted],color:\"#164\"},{tag:[p.string,p.deleted],color:\"#a11\"},{tag:[p.regexp,p.escape,p.special(p.string)],color:\"#e40\"},{tag:p.definition(p.variableName),color:\"#00f\"},{tag:p.local(p.variableName),color:\"#30a\"},{tag:[p.typeName,p.namespace],color:\"#085\"},{tag:p.className,color:\"#167\"},{tag:[p.special(p.variableName),p.macroName],color:\"#256\"},{tag:p.definition(p.propertyName),color:\"#00c\"},{tag:p.comment,color:\"#940\"},{tag:p.invalid,color:\"#f00\"}]),Fx=T.baseTheme({\"&.cm-focused .cm-matchingBracket\":{backgroundColor:\"#328c8252\"},\"&.cm-focused .cm-nonmatchingBracket\":{backgroundColor:\"#bb555544\"}}),Op=1e4,xp=\"()[]{}\",yp=A.define({combine(i){return kt(i,{afterCursor:!0,brackets:xp,maxScanDistance:Op,renderMatch:Hx})}}),_x=R.mark({class:\"cm-matchingBracket\"}),Gx=R.mark({class:\"cm-nonmatchingBracket\"});function Hx(i){let t=[],e=i.matched?_x:Gx;return t.push(e.range(i.start.from,i.start.to)),i.end&&t.push(e.range(i.end.from,i.end.to)),t}var Ux=it.define({create(){return R.none},update(i,t){if(!t.docChanged&&!t.selection)return i;let e=[],r=t.state.facet(yp);for(let n of t.state.selection.ranges){if(!n.empty)continue;let s=oe(t.state,n.head,-1,r)||n.head>0&&oe(t.state,n.head-1,1,r)||r.afterCursor&&(oe(t.state,n.head,1,r)||n.headT.decorations.from(i)}),jx=[Ux,Fx];function io(i={}){return[yp.of(i),jx]}var Kx=new E;function nh(i,t,e){let r=i.prop(t<0?E.openedBy:E.closedBy);if(r)return r;if(i.name.length==1){let n=e.indexOf(i.name);if(n>-1&&n%2==(t<0?1:0))return[e[n+t]]}return null}function sh(i){let t=i.type.prop(Kx);return t?t(i.node):i}function oe(i,t,e,r={}){let n=r.maxScanDistance||Op,s=r.brackets||xp,o=pt(i),l=o.resolveInner(t,e);for(let a=l;a;a=a.parent){let h=nh(a.type,e,s);if(h&&a.from0?t>=f.from&&tf.from&&t<=f.to))return Jx(i,t,e,a,f,h,s)}}return t1(i,t,e,o,l.type,n,s)}function Jx(i,t,e,r,n,s,o){let l=r.parent,a={from:n.from,to:n.to},h=0,f=l?.cursor();if(f&&(e<0?f.childBefore(r.from):f.childAfter(r.to)))do if(e<0?f.to<=r.from:f.from>=r.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:e<0?t-1:t,to:e>0?t+1:t},f=i.doc.iterRange(t,e>0?i.doc.length:0),c=0;for(let u=0;!f.next().done&&u<=s;){let d=f.value;e<0&&(u+=d.length);let m=t+u*e;for(let O=e>0?0:d.length-1,g=e>0?d.length:-1;O!=g;O+=e){let x=o.indexOf(d[O]);if(!(x<0||r.resolveInner(m+O,1).type!=n))if(x%2==0==e>0)c++;else{if(c==1)return{start:h,end:{from:m+O,to:m+O+1},matched:x>>1==a>>1};c--}}e>0&&(u+=d.length)}return f.done?{start:h,matched:!1}:null}var e1=Object.create(null),ip=[bt.none];var rp=[],np=Object.create(null),i1=Object.create(null);for(let[i,t]of[[\"variable\",\"variableName\"],[\"variable-2\",\"variableName.special\"],[\"string-2\",\"string.special\"],[\"def\",\"variableName.definition\"],[\"tag\",\"tagName\"],[\"attribute\",\"attributeName\"],[\"type\",\"typeName\"],[\"builtin\",\"variableName.standard\"],[\"qualifier\",\"modifier\"],[\"error\",\"invalid\"],[\"header\",\"heading\"],[\"property\",\"propertyName\"]])i1[i]=r1(e1,t);function ja(i,t){rp.indexOf(i)>-1||(rp.push(i),console.warn(t))}function r1(i,t){let e=[];for(let l of t.split(\" \")){let a=[];for(let h of l.split(\".\")){let f=i[h]||p[h];f?typeof f==\"function\"?a.length?a=a.map(f):ja(h,`Modifier ${h} used at start of tag`):a.length?ja(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:ja(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let r=t.replace(/ /g,\"_\"),n=r+\" \"+e.map(l=>l.id),s=np[n];if(s)return s.id;let o=np[n]=bt.define({id:ip.length,name:r,props:[Hs({[r]:e})]});return ip.push(o),o.id}var Fw={rtl:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"rtl\"},bidiIsolate:G.RTL}),ltr:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"ltr\"},bidiIsolate:G.LTR}),auto:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"auto\"},bidiIsolate:null})};var no=class{constructor(t,e,r){this.state=t,this.pos=e,this.explicit=r,this.abortListeners=[]}tokenBefore(t){let e=pt(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),r=Math.max(e.from,this.pos-250),n=e.text.slice(r-e.from,this.pos-e.from),s=n.search(Qp(t,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,e){t==\"abort\"&&this.abortListeners&&this.abortListeners.push(e)}};function bp(i){let t=Object.keys(i).join(\"\"),e=/\\w/.test(t);return e&&(t=t.replace(/\\w/g,\"\")),`[${e?\"\\\\w\":\"\"}${t.replace(/[^\\w\\s]/g,\"\\\\$&\")}]`}function n1(i){let t=Object.create(null),e=Object.create(null);for(let{label:n}of i){t[n[0]]=!0;for(let s=1;stypeof n==\"string\"?{label:n}:n),[e,r]=t.every(n=>/^\\w+$/.test(n.label))?[/\\w*$/,/\\w+$/]:n1(t);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:t,validFor:e}:null}}function Ap(i,t){return e=>{for(let r=pt(e.state).resolveInner(e.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(e)}}var so=class{constructor(t,e,r,n){this.completion=t,this.source=e,this.match=r,this.score=n}};function Ue(i){return i.selection.main.from}function Qp(i,t){var e;let{source:r}=i,n=t&&r[0]!=\"^\",s=r[r.length-1]!=\"$\";return!n&&!s?i:new RegExp(`${n?\"^\":\"\"}(?:${r})${s?\"$\":\"\"}`,(e=i.flags)!==null&&e!==void 0?e:i.ignoreCase?\"i\":\"\")}var Rp=Et.define();function s1(i,t,e,r){let{main:n}=i.selection,s=e-n.from,o=r-n.from;return Object.assign(Object.assign({},i.changeByRange(l=>l!=n&&e!=r&&i.sliceDoc(l.from+s,l.from+o)!=i.sliceDoc(e,r)?{range:l}:{changes:{from:l.from+s,to:r==n.from?l.to:l.from+o,insert:t},range:b.cursor(l.from+s+t.length)})),{scrollIntoView:!0,userEvent:\"input.complete\"})}var Sp=new WeakMap;function o1(i){if(!Array.isArray(i))return i;let t=Sp.get(i);return t||Sp.set(i,t=wh(i)),t}var oo=M.define(),sn=M.define(),dh=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&y<=57||y>=97&&y<=122?2:y>=65&&y<=90?1:0:(k=vr(y))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!S||w==1&&g||v==0&&w!=0)&&(e[c]==y||r[c]==y&&(u=!0)?o[c++]=S:o.length&&(x=!1)),v=w,S+=wt(y)}return c==a&&o[0]==0&&x?this.result(-100+(u?-200:0),o,t):d==a&&m==0?this.ret(-200-t.length+(O==t.length?0:-100),[0,O]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):d==a?this.ret(-900-t.length,[m,O]):c==a?this.result(-100+(u?-200:0)+-700+(x?0:-1100),o,t):e.length==2?!1:this.result((n[0]?-700:0)+-200+-1100,n,t)}result(t,e,r){let n=[],s=0;for(let o of e){let l=o+(this.astral?wt(dt(r,o)):1);s&&n[s-1]==o?n[s-1]=l:(n[s++]=o,n[s++]=l)}return this.ret(t-r.length,n)}},gt=A.define({combine(i){return kt(i,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>\"\",optionClass:()=>\"\",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:l1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>r=>wp(t(r),e(r)),optionClass:(t,e)=>r=>wp(t(r),e(r)),addToOptions:(t,e)=>t.concat(e)})}});function wp(i,t){return i?t?i+\" \"+t:i:t}function l1(i,t,e,r,n,s){let o=i.textDirection==G.RTL,l=o,a=!1,h=\"top\",f,c,u=t.left-n.left,d=n.right-t.right,m=r.right-r.left,O=r.bottom-r.top;if(l&&u=O||S>t.top?f=e.bottom-t.top:(h=\"bottom\",f=t.bottom-e.top)}let g=(t.bottom-t.top)/s.offsetHeight,x=(t.right-t.left)/s.offsetWidth;return{style:`${h}: ${f/g}px; max-width: ${c/x}px`,class:\"cm-completionInfo-\"+(a?o?\"left-narrow\":\"right-narrow\":l?\"left\":\"right\")}}function a1(i){let t=i.addToOptions.slice();return i.icons&&t.push({render(e){let r=document.createElement(\"div\");return r.classList.add(\"cm-completionIcon\"),e.type&&r.classList.add(...e.type.split(/\\s+/g).map(n=>\"cm-completionIcon-\"+n)),r.setAttribute(\"aria-hidden\",\"true\"),r},position:20}),t.push({render(e,r,n,s){let o=document.createElement(\"span\");o.className=\"cm-completionLabel\";let l=e.displayLabel||e.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,f)));let u=o.appendChild(document.createElement(\"span\"));u.appendChild(document.createTextNode(l.slice(f,c))),u.className=\"cm-completionMatchedText\",a=c}return ae.position-r.position).map(e=>e.render)}function ch(i,t,e){if(i<=e)return{from:0,to:i};if(t<0&&(t=0),t<=i>>1){let n=Math.floor(t/e);return{from:n*e,to:(n+1)*e}}let r=Math.floor((i-t)/e);return{from:i-(r+1)*e,to:i-r*e}}var ph=class{constructor(t,e,r){this.view=t,this.stateField=e,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass=\"\";let n=t.state.field(e),{options:s,selected:o}=n.open,l=t.state.facet(gt);this.optionContent=a1(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ch(s.length,o,l.maxRenderedOptions),this.dom=document.createElement(\"div\"),this.dom.className=\"cm-tooltip-autocomplete\",this.updateTooltipClass(t.state),this.dom.addEventListener(\"mousedown\",a=>{let{options:h}=t.state.field(e).open;for(let f=a.target,c;f&&f!=this.dom;f=f.parentNode)if(f.nodeName==\"LI\"&&(c=/-(\\d+)$/.exec(f.id))&&+c[1]{let h=t.state.field(this.stateField,!1);h&&h.tooltip&&t.state.facet(gt).closeOnBlur&&a.relatedTarget!=t.contentDOM&&t.dispatch({effects:sn.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener(\"scroll\",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let r=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=n){let{options:s,selected:o,disabled:l}=r.open;(!n.open||n.open.options!=s)&&(this.range=ch(s.length,o,t.state.facet(gt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((e=n.open)===null||e===void 0?void 0:e.disabled)&&this.dom.classList.toggle(\"cm-tooltip-autocomplete-disabled\",!!l)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let r of this.currentClass.split(\" \"))r&&this.dom.classList.remove(r);for(let r of e.split(\" \"))r&&this.dom.classList.add(r);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ch(e.options.length,e.selected,this.view.state.facet(gt).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:r}=e.options[e.selected],{info:n}=r;if(!n)return;let s=typeof n==\"string\"?document.createTextNode(n):n(r);if(!s)return;\"then\"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,r)}).catch(o=>Ct(this.view.state,o,\"completion info\")):this.addInfoPane(s,r)}}addInfoPane(t,e){this.destroyInfo();let r=this.info=document.createElement(\"div\");if(r.className=\"cm-tooltip cm-completionInfo\",t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:n,destroy:s}=t;r.appendChild(n),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!=\"LI\"||!r.id?n--:n==t?r.hasAttribute(\"aria-selected\")||(r.setAttribute(\"aria-selected\",\"true\"),e=r):r.hasAttribute(\"aria-selected\")&&r.removeAttribute(\"aria-selected\");return e&&f1(this.list,e),e}measureInfo(){let t=this.dom.querySelector(\"[aria-selected]\");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomr.from||r.from==0))if(s=u,typeof h!=\"string\"&&h.header)n.appendChild(h.header(h));else{let d=n.appendChild(document.createElement(\"completion-section\"));d.textContent=u}}let f=n.appendChild(document.createElement(\"li\"));f.id=e+\"-\"+o,f.setAttribute(\"role\",\"option\");let c=this.optionClass(l);c&&(f.className=c);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&f.appendChild(d)}}return r.from&&n.classList.add(\"cm-completionListIncompleteTop\"),r.tonew ph(e,i,t)}function f1(i,t){let e=i.getBoundingClientRect(),r=t.getBoundingClientRect(),n=e.height/i.offsetHeight;r.tope.bottom&&(i.scrollTop+=(r.bottom-e.bottom)/n)}function vp(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function c1(i,t){let e=[],r=null,n=a=>{e.push(a);let{section:h}=a.completion;if(h){r||(r=[]);let f=typeof h==\"string\"?h:h.name;r.some(c=>c.name==f)||r.push(typeof h==\"string\"?{name:f}:h)}};for(let a of i)if(a.hasResult()){let h=a.result.getMatch;if(a.result.filter===!1)for(let f of a.result.options)n(new so(f,a.source,h?h(f):[],1e9-e.length));else{let f=new dh(t.sliceDoc(a.from,a.to));for(let c of a.result.options)if(f.match(c.label)){let u=c.displayLabel?h?h(c,f.matched):[]:f.matched;n(new so(c,a.source,u,f.score+(c.boost||0)))}}}if(r){let a=Object.create(null),h=0,f=(c,u)=>{var d,m;return((d=c.rank)!==null&&d!==void 0?d:1e9)-((m=u.rank)!==null&&m!==void 0?m:1e9)||(c.namef.score-h.score||l(h.completion,f.completion))){let h=a.completion;!o||o.label!=h.label||o.detail!=h.detail||o.type!=null&&h.type!=null&&o.type!=h.type||o.apply!=h.apply||o.boost!=h.boost?s.push(a):vp(a.completion)>vp(o)&&(s[s.length-1]=a),o=a.completion}return s}var mh=class i{constructor(t,e,r,n,s,o){this.options=t,this.attrs=e,this.tooltip=r,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new i(this.options,kp(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,r,n,s){let o=c1(t,e);if(!o.length)return n&&t.some(a=>a.state==1)?new i(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let l=e.facet(gt).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let a=n.options[n.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:g1,above:s.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(t){return new i(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},gh=class i{constructor(t,e,r){this.active=t,this.id=e,this.open=r}static start(){return new i(p1,\"cm-ac-\"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,r=e.facet(gt),s=(r.override||e.languageDataAt(\"autocomplete\",Ue(e)).map(o1)).map(l=>(this.active.find(h=>h.source==l)||new De(l,this.active.some(h=>h.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&t.docChanged&&(o=o.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!u1(s,this.active)?o=mh.build(s,e,this.id,o,r):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new De(l.source,0):l));for(let l of t.effects)l.is(Ep)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new i(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:d1}};function u1(i,t){if(i==t)return!0;for(let e=0,r=0;;){for(;e-1&&(e[\"aria-activedescendant\"]=i+\"-\"+t),e}var p1=[];function Oh(i){return i.isUserEvent(\"input.type\")?\"input\":i.isUserEvent(\"delete.backward\")?\"delete\":null}var De=class i{constructor(t,e,r=-1){this.source=t,this.state=e,this.explicitPos=r}hasResult(){return!1}update(t,e){let r=Oh(t),n=this;r?n=n.handleUserEvent(t,r,e):t.docChanged?n=n.handleChange(t):t.selection&&n.state!=0&&(n=new i(n.source,0));for(let s of t.effects)if(s.is(oo))n=new i(n.source,1,s.value?Ue(t.state):-1);else if(s.is(sn))n=new i(n.source,0);else if(s.is(Mp))for(let o of s.value)o.source==n.source&&(n=o);return n}handleUserEvent(t,e,r){return e==\"delete\"||!r.activateOnTyping?this.map(t.changes):new i(this.source,1)}handleChange(t){return t.changes.touchesRange(Ue(t.startState))?new i(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new i(this.source,this.state,t.mapPos(this.explicitPos))}},lo=class i extends De{constructor(t,e,r,n,s){super(t,2,e),this.result=r,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,r){var n;let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=Ue(t.state);if((this.explicitPos<0?l<=s:lo||e==\"delete\"&&Ue(t.startState)==this.from)return new De(this.source,e==\"input\"&&r.activateOnTyping?1:0);let a=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos),h;return m1(this.result.validFor,t.state,s,o)?new i(this.source,a,this.result,s,o):this.result.update&&(h=this.result.update(this.result,s,o,new no(t.state,l,a>=0)))?new i(this.source,a,h,h.from,(n=h.to)!==null&&n!==void 0?n:Ue(t.state)):new De(this.source,1,a)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new De(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new i(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}};function m1(i,t,e,r){if(!i)return!1;let n=t.sliceDoc(e,r);return typeof i==\"function\"?i(n,e,r,t):Qp(i,!0).test(n)}var Mp=M.define({map(i,t){return i.map(e=>e.map(t))}}),Ep=M.define(),It=it.define({create(){return gh.start()},update(i,t){return i.update(t)},provide:i=>[Fr.from(i,t=>t.tooltip),T.contentAttributes.from(i,t=>t.attrs)]});function $p(i,t){let e=t.completion.apply||t.completion.label,r=i.state.field(It).active.find(n=>n.source==t.source);return r instanceof lo?(typeof e==\"string\"?i.dispatch(Object.assign(Object.assign({},s1(i.state,e,r.from,r.to)),{annotations:Rp.of(t.completion)})):e(i,t.completion,r.from,r.to),!0):!1}var g1=h1(It,$p);function ro(i,t=\"option\"){return e=>{let r=e.state.field(It,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+n*(i?1:-1):i?0:o-1;return l<0?l=t==\"page\"?0:o-1:l>=o&&(l=t==\"page\"?o-1:0),e.dispatch({effects:Ep.of(l)}),!0}}var O1=i=>{let t=i.state.field(It,!1);return i.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampi.state.field(It,!1)?(i.dispatch({effects:oo.of(!0)}),!0):!1,y1=i=>{let t=i.state.field(It,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(i.dispatch({effects:sn.of(null)}),!0)},xh=class{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}},b1=50,S1=1e3,w1=ft.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of i.state.field(It).active)t.state==1&&this.startQuery(t)}update(i){let t=i.state.field(It);if(!i.selectionSet&&!i.docChanged&&i.startState.field(It)==t)return;let e=i.transactions.some(n=>(n.selection||n.docChanged)&&!Oh(n));for(let n=0;nb1&&Date.now()-s.time>S1){for(let o of s.context.abortListeners)try{o()}catch(l){Ct(this.view.state,l)}s.context.abortListeners=null,this.running.splice(n--,1)}else s.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(n=>n.effects.some(s=>s.is(oo)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.state.facet(gt).activateOnTypingDelay;if(this.debounceUpdate=t.active.some(n=>n.state==1&&!this.running.some(s=>s.active.source==n.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let n of i.transactions)Oh(n)==\"input\"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,t=i.field(It);for(let e of t.active)e.state==1&&!this.running.some(r=>r.active.source==e.source)&&this.startQuery(e)}startQuery(i){let{state:t}=this.view,e=Ue(t),r=new no(t,e,i.explicitPos==e),n=new xh(i,r);this.running.push(n),Promise.resolve(i.source(r)).then(s=>{n.context.aborted||(n.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:sn.of(null)}),Ct(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gt).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(gt);for(let r=0;ro.source==n.active.source);if(s&&s.state==1)if(n.done==null){let o=new De(n.active.source,0);for(let l of n.updates)o=o.update(l,e);o.state!=1&&t.push(o)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:Mp.of(t)})}},{eventHandlers:{blur(i){let t=this.view.state.field(It,!1);if(t&&t.tooltip&&this.view.state.facet(gt).closeOnBlur){let e=t.open&&Ba(this.view,t.open.tooltip);(!e||!e.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:sn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:oo.of(!1)}),20),this.composing=0}}}),qp=T.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:\"400px\",boxSizing:\"border-box\"},\".cm-completionInfo.cm-completionInfo-left\":{right:\"100%\"},\".cm-completionInfo.cm-completionInfo-right\":{left:\"100%\"},\".cm-completionInfo.cm-completionInfo-left-narrow\":{right:\"30px\"},\".cm-completionInfo.cm-completionInfo-right-narrow\":{left:\"30px\"},\"&light .cm-snippetField\":{backgroundColor:\"#00000022\"},\"&dark .cm-snippetField\":{backgroundColor:\"#ffffff22\"},\".cm-snippetFieldPosition\":{verticalAlign:\"text-top\",width:0,height:\"1.15em\",display:\"inline-block\",margin:\"0 -0.7px -.7em\",borderLeft:\"1.4px dotted #888\"},\".cm-completionMatchedText\":{textDecoration:\"underline\"},\".cm-completionDetail\":{marginLeft:\"0.5em\",fontStyle:\"italic\"},\".cm-completionIcon\":{fontSize:\"90%\",width:\".8em\",display:\"inline-block\",textAlign:\"center\",paddingRight:\".6em\",opacity:\"0.6\",boxSizing:\"content-box\"},\".cm-completionIcon-function, .cm-completionIcon-method\":{\"&:after\":{content:\"'\\u0192'\"}},\".cm-completionIcon-class\":{\"&:after\":{content:\"'\\u25CB'\"}},\".cm-completionIcon-interface\":{\"&:after\":{content:\"'\\u25CC'\"}},\".cm-completionIcon-variable\":{\"&:after\":{content:\"'\\u{1D465}'\"}},\".cm-completionIcon-constant\":{\"&:after\":{content:\"'\\u{1D436}'\"}},\".cm-completionIcon-type\":{\"&:after\":{content:\"'\\u{1D461}'\"}},\".cm-completionIcon-enum\":{\"&:after\":{content:\"'\\u222A'\"}},\".cm-completionIcon-property\":{\"&:after\":{content:\"'\\u25A1'\"}},\".cm-completionIcon-keyword\":{\"&:after\":{content:\"'\\u{1F511}\\uFE0E'\"}},\".cm-completionIcon-namespace\":{\"&:after\":{content:\"'\\u25A2'\"}},\".cm-completionIcon-text\":{\"&:after\":{content:\"'abc'\",fontSize:\"50%\",verticalAlign:\"middle\"}}}),yh=class{constructor(t,e,r,n){this.field=t,this.line=e,this.from=r,this.to=n}},bh=class i{constructor(t,e,r){this.field=t,this.from=e,this.to=r}map(t){let e=t.mapPos(this.from,-1,ut.TrackDel),r=t.mapPos(this.to,1,ut.TrackDel);return e==null||r==null?null:new i(this.field,e,r)}},Sh=class i{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let r=[],n=[e],s=t.doc.lineAt(e),o=/^\\s*/.exec(s.text)[0];for(let a of this.lines){if(r.length){let h=o,f=/^\\t*/.exec(a)[0].length;for(let c=0;cnew bh(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:r,ranges:l}}static parse(t){let e=[],r=[],n=[],s;for(let o of t.split(/\\r\\n?|\\n/)){for(;s=/[#$]\\{(?:(\\d+)(?::([^}]*))?|([^}]*))\\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||\"\",h=-1;for(let f=0;f=h&&c.field++}n.push(new yh(h,r.length,s.index,s.index+a.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}for(let l;l=/\\\\([{}])/.exec(o);){o=o.slice(0,l.index)+l[1]+o.slice(l.index+l[0].length);for(let a of n)a.line==r.length&&a.from>l.index&&(a.from--,a.to--)}r.push(o)}return new i(r,n)}},v1=R.widget({widget:new class extends Ut{toDOM(){let i=document.createElement(\"span\");return i.className=\"cm-snippetFieldPosition\",i}ignoreEvent(){return!1}}}),k1=R.mark({class:\"cm-snippetField\"}),ji=class i{constructor(t,e){this.ranges=t,this.active=e,this.deco=R.set(t.map(r=>(r.from==r.to?v1:k1).range(r.from,r.to)))}map(t){let e=[];for(let r of this.ranges){let n=r.map(t);if(!n)return null;e.push(n)}return new i(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(r=>r.field==this.active&&r.from<=e.from&&r.to>=e.to))}},an=M.define({map(i,t){return i&&i.map(t)}}),T1=M.define(),on=it.define({create(){return null},update(i,t){for(let e of t.effects){if(e.is(an))return e.value;if(e.is(T1)&&i)return new ji(i.ranges,e.value)}return i&&t.docChanged&&(i=i.map(t.changes)),i&&t.selection&&!i.selectionInsideField(t.selection)&&(i=null),i},provide:i=>T.decorations.from(i,t=>t?t.deco:R.none)});function vh(i,t){return b.create(i.filter(e=>e.field==t).map(e=>b.range(e.from,e.to)))}function P1(i){let t=Sh.parse(i);return(e,r,n,s)=>{let{text:o,ranges:l}=t.instantiate(e.state,n),a={changes:{from:n,to:s,insert:V.of(o)},scrollIntoView:!0,annotations:r?[Rp.of(r),lt.userEvent.of(\"input.complete\")]:void 0};if(l.length&&(a.selection=vh(l,0)),l.some(h=>h.field>0)){let h=new ji(l,0),f=a.effects=[an.of(h)];e.state.field(on,!1)===void 0&&f.push(M.appendConfig.of([on,M1,E1,qp]))}e.dispatch(e.state.update(a))}}function Dp(i){return({state:t,dispatch:e})=>{let r=t.field(on,!1);if(!r||i<0&&r.active==0)return!1;let n=r.active+i,s=i>0&&!r.ranges.some(o=>o.field==n+i);return e(t.update({selection:vh(r.ranges,n),effects:an.of(s?null:new ji(r.ranges,n)),scrollIntoView:!0})),!0}}var C1=({state:i,dispatch:t})=>i.field(on,!1)?(t(i.update({effects:an.of(null)})),!0):!1,A1=Dp(1),Q1=Dp(-1);var R1=[{key:\"Tab\",run:A1,shift:Q1},{key:\"Escape\",run:C1}],Tp=A.define({combine(i){return i.length?i[0]:R1}}),M1=ie.highest(Fe.compute([Tp],i=>i.facet(Tp)));function Pe(i,t){return Object.assign(Object.assign({},t),{apply:P1(i)})}var E1=T.domEventHandlers({mousedown(i,t){let e=t.state.field(on,!1),r;if(!e||(r=t.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let n=e.ranges.find(s=>s.from<=r&&s.to>=r);return!n||n.field==e.active?!1:(t.dispatch({selection:vh(e.ranges,n.field),effects:an.of(e.ranges.some(s=>s.field>n.field)?new ji(e.ranges,n.field):null),scrollIntoView:!0}),!0)}});var ln={brackets:[\"(\",\"[\",\"{\",\"'\",'\"'],before:\")]}:;>\",stringPrefixes:[]},Oi=M.define({map(i,t){let e=t.mapPos(i,-1,ut.TrackAfter);return e??void 0}}),kh=new class extends ee{};kh.startSide=1;kh.endSide=-1;var Bp=it.define({create(){return _.empty},update(i,t){if(i=i.map(t.changes),t.selection){let e=t.state.doc.lineAt(t.selection.main.head);i=i.update({filter:r=>r>=e.from&&r<=e.to})}for(let e of t.effects)e.is(Oi)&&(i=i.update({add:[kh.range(e.value,e.value+1)]}));return i}});function ao(){return[q1,Bp]}var uh=\"()[]{}<>\";function Xp(i){for(let t=0;t{if(($1?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let n=i.state.selection.main;if(r.length>2||r.length==2&&wt(dt(r,0))==1||t!=n.from||e!=n.to)return!1;let s=B1(i.state,r);return s?(i.dispatch(s),!0):!1}),D1=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let r=Lp(i,i.selection.main.head).brackets||ln.brackets,n=null,s=i.changeByRange(o=>{if(o.empty){let l=X1(i.doc,o.head);for(let a of r)if(a==l&&fo(i.doc,o.head)==Xp(dt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:n=o}});return n||t(i.update(s,{scrollIntoView:!0,userEvent:\"delete.backward\"})),!n},ho=[{key:\"Backspace\",run:D1}];function B1(i,t){let e=Lp(i,i.selection.main.head),r=e.brackets||ln.brackets;for(let n of r){let s=Xp(dt(n,0));if(t==n)return s==n?W1(i,n,r.indexOf(n+n+n)>-1,e):L1(i,n,s,e.before||ln.before);if(t==s&&Vp(i,i.selection.main.from))return V1(i,n,s)}return null}function Vp(i,t){let e=!1;return i.field(Bp).between(0,i.doc.length,r=>{r==t&&(e=!0)}),e}function fo(i,t){let e=i.sliceString(t,t+2);return e.slice(0,wt(dt(e,0)))}function X1(i,t){let e=i.sliceString(t-2,t);return wt(dt(e,0))==e.length?e:e.slice(1)}function L1(i,t,e,r){let n=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:e,from:o.to}],effects:Oi.of(o.to+t.length),range:b.range(o.anchor+t.length,o.head+t.length)};let l=fo(i.doc,o.head);return!l||/\\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+e,from:o.head},effects:Oi.of(o.head+t.length),range:b.cursor(o.head+t.length)}:{range:n=o}});return n?null:i.update(s,{scrollIntoView:!0,userEvent:\"input.type\"})}function V1(i,t,e){let r=null,n=i.changeByRange(s=>s.empty&&fo(i.doc,s.head)==e?{changes:{from:s.head,to:s.head+e.length,insert:e},range:b.cursor(s.head+e.length)}:r={range:s});return r?null:i.update(n,{scrollIntoView:!0,userEvent:\"input.type\"})}function W1(i,t,e,r){let n=r.stringPrefixes||ln.stringPrefixes,s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Oi.of(l.to+t.length),range:b.range(l.anchor+t.length,l.head+t.length)};let a=l.head,h=fo(i.doc,a),f;if(h==t){if(Pp(i,a))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(Vp(i,a)){let u=e&&i.sliceDoc(a,a+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(e&&i.sliceDoc(a-2*t.length,a)==t+t&&(f=Cp(i,a-2*t.length,n))>-1&&Pp(i,f))return{changes:{insert:t+t+t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(i.charCategorizer(a)(h)!=F.Word&&Cp(i,a,n)>-1&&!I1(i,a,t,n))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)}}return{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:\"input.type\"})}function Pp(i,t){let e=pt(i).resolveInner(t+1);return e.parent&&e.from==t}function I1(i,t,e,r){let n=pt(i).resolveInner(t,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(n.from,Math.min(n.to,n.from+e.length+s)),a=l.indexOf(e);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let f=n.firstChild;for(;f&&f.from==n.from&&f.to-f.from>e.length+a;){if(i.sliceDoc(f.to-e.length,f.to)==e)return!1;f=f.firstChild}return!0}let h=n.to==t&&n.parent;if(!h)break;n=h}return!1}function Cp(i,t,e){let r=i.charCategorizer(t);if(r(i.sliceDoc(t-1,t))!=F.Word)return t;for(let n of e){let s=t-n.length;if(i.sliceDoc(s,t)==n&&r(i.sliceDoc(s-1,s))!=F.Word)return s}return-1}function co(i={}){return[It,gt.of(i),w1,N1,qp]}var hn=[{key:\"Ctrl-Space\",run:x1},{key:\"Escape\",run:y1},{key:\"ArrowDown\",run:ro(!0)},{key:\"ArrowUp\",run:ro(!1)},{key:\"PageDown\",run:ro(!0,\"page\")},{key:\"PageUp\",run:ro(!1,\"page\")},{key:\"Enter\",run:O1}],N1=ie.highest(Fe.computeN([gt],i=>i.facet(gt).defaultKeymap?[hn]:[]));var Y1=i=>{let{state:t}=i,e=t.doc.lineAt(t.selection.main.from),r=Mh(i.state,e.from);return r.line?z1(i):r.block?F1(i):!1};function Rh(i,t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=i(t,e);return n?(r(e.update(n)),!0):!1}}var z1=Rh(H1,0);var Z1=Rh(_p,0);var F1=Rh((i,t)=>_p(i,t,G1(t)),0);function Mh(i,t){let e=i.languageDataAt(\"commentTokens\",t);return e.length?e[0]:{}}var fn=50;function _1(i,{open:t,close:e},r,n){let s=i.sliceDoc(r-fn,r),o=i.sliceDoc(n,n+fn),l=/\\s*$/.exec(s)[0].length,a=/^\\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-t.length,h)==t&&o.slice(a,a+e.length)==e)return{open:{pos:r-l,margin:l&&1},close:{pos:n+a,margin:a&&1}};let f,c;n-r<=2*fn?f=c=i.sliceDoc(r,n):(f=i.sliceDoc(r,r+fn),c=i.sliceDoc(n-fn,n));let u=/^\\s*/.exec(f)[0].length,d=/\\s*$/.exec(c)[0].length,m=c.length-d-e.length;return f.slice(u,u+t.length)==t&&c.slice(m,m+e.length)==e?{open:{pos:r+u+t.length,margin:/\\s/.test(f.charAt(u+t.length))?1:0},close:{pos:n-d-e.length,margin:/\\s/.test(c.charAt(m-1))?1:0}}:null}function G1(i){let t=[];for(let e of i.selection.ranges){let r=i.doc.lineAt(e.from),n=e.to<=r.to?r:i.doc.lineAt(e.to),s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=n.to:t.push({from:r.from+/^\\s*/.exec(r.text)[0].length,to:n.to})}return t}function _p(i,t,e=t.selection.ranges){let r=e.map(s=>Mh(t,s.from).block);if(!r.every(s=>s))return null;let n=e.map((s,o)=>_1(t,r[o],s.from,s.to));if(i!=2&&!n.every(s=>s))return{changes:t.changes(e.map((s,o)=>n[o]?[]:[{from:s.from,insert:r[o].open+\" \"},{from:s.to,insert:\" \"+r[o].close}]))};if(i!=1&&n.some(s=>s)){let s=[];for(let o=0,l;on&&(s==o||o>c.from)){n=c.from;let u=/^\\s*/.exec(c.text)[0].length,d=u==c.length,m=c.text.slice(u,u+h.length)==h?u:-1;us.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:f,single:c}of r)(c||!f)&&s.push({from:l.from+h,insert:a+\" \"});let o=t.changes(s);return{changes:o,selection:t.selection.map(o,1)}}else if(i!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let h=o.from+l,f=h+a.length;o.text[f-o.from]==\" \"&&f++,s.push({from:h,to:f})}return{changes:s}}return null}var Ph=Et.define(),U1=Et.define(),j1=A.define(),Gp=A.define({combine(i){return kt(i,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(r,n)=>t(r,n)||e(r,n)})}}),Hp=it.define({create(){return xi.empty},update(i,t){let e=t.state.facet(Gp),r=t.annotation(Ph);if(r){let a=le.fromTransaction(t,r.selection),h=r.side,f=h==0?i.undone:i.done;return a?f=po(f,f.length,e.minDepth,a):f=Kp(f,t.startState.selection),new xi(h==0?r.rest:f,h==0?f:r.rest)}let n=t.annotation(U1);if((n==\"full\"||n==\"before\")&&(i=i.isolate()),t.annotation(lt.addToHistory)===!1)return t.changes.empty?i:i.addMapping(t.changes.desc);let s=le.fromTransaction(t),o=t.annotation(lt.time),l=t.annotation(lt.userEvent);return s?i=i.addChanges(s,o,l,e,t):t.selection&&(i=i.addSelection(t.startState.selection,o,l,e.newGroupDelay)),(n==\"full\"||n==\"after\")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(t=>t.toJSON()),undone:i.undone.map(t=>t.toJSON())}},fromJSON(i){return new xi(i.done.map(le.fromJSON),i.undone.map(le.fromJSON))}});function mo(i={}){return[Hp,Gp.of(i),T.domEventHandlers({beforeinput(t,e){let r=t.inputType==\"historyUndo\"?Up:t.inputType==\"historyRedo\"?Ch:null;return r?(t.preventDefault(),r(e)):!1}})]}function go(i,t){return function({state:e,dispatch:r}){if(!t&&e.readOnly)return!1;let n=e.field(Hp,!1);if(!n)return!1;let s=n.pop(i,e,t);return s?(r(s),!0):!1}}var Up=go(0,!1),Ch=go(1,!1),K1=go(0,!0),J1=go(1,!0);var le=class i{constructor(t,e,r,n,s){this.changes=t,this.effects=e,this.mapped=r,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new i(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(t){return new i(t.changes&&vt.fromJSON(t.changes),[],t.mapped&&Me.fromJSON(t.mapped),t.startSelection&&b.fromJSON(t.startSelection),t.selectionsAfter.map(b.fromJSON))}static fromTransaction(t,e){let r=Kt;for(let n of t.startState.facet(j1)){let s=n(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new i(t.changes.invert(t.startState.doc),r,void 0,e||t.startState.selection,Kt)}static selection(t){return new i(void 0,Kt,void 0,void 0,t)}};function po(i,t,e,r){let n=t+1>e+20?t-e-1:0,s=i.slice(n,t);return s.push(r),s}function ty(i,t){let e=[],r=!1;return i.iterChangedRanges((n,s)=>e.push(n,s)),t.iterChangedRanges((n,s,o,l)=>{for(let a=0;a=h&&o<=f&&(r=!0)}}),r}function ey(i,t){return i.ranges.length==t.ranges.length&&i.ranges.filter((e,r)=>e.empty!=t.ranges[r].empty).length===0}function jp(i,t){return i.length?t.length?i.concat(t):i:t}var Kt=[],iy=200;function Kp(i,t){if(i.length){let e=i[i.length-1],r=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-iy));return r.length&&r[r.length-1].eq(t)?i:(r.push(t),po(i,i.length-1,1e9,e.setSelAfter(r)))}else return[le.selection([t])]}function ry(i){let t=i[i.length-1],e=i.slice();return e[i.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function Th(i,t){if(!i.length)return i;let e=i.length,r=Kt;for(;e;){let n=ny(i[e-1],t,r);if(n.changes&&!n.changes.empty||n.effects.length){let s=i.slice(0,e);return s[e-1]=n,s}else t=n.mapped,e--,r=n.selectionsAfter}return r.length?[le.selection(r)]:Kt}function ny(i,t,e){let r=jp(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(t)):Kt,e);if(!i.changes)return le.selection(r);let n=i.changes.map(t),s=t.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new le(n,M.mapEffects(i.effects,t),o,i.startSelection.map(s),r)}var sy=/^(input\\.type|delete)($|\\.)/,xi=class i{constructor(t,e,r=0,n=void 0){this.done=t,this.undone=e,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(t,e,r,n,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||sy.test(r))&&(!l.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee.empty?i.moveByChar(e,t):xo(e,t))}function St(i){return i.textDirectionAt(i.state.selection.main.head)==G.LTR}var tm=i=>Jp(i,!St(i)),em=i=>Jp(i,St(i));function im(i,t){return ae(i,e=>e.empty?i.moveByGroup(e,t):xo(e,t))}var oy=i=>im(i,!St(i)),ly=i=>im(i,St(i));var lv=typeof Intl<\"u\"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:\"word\"}):null;function ay(i,t,e){if(t.type.prop(e))return!0;let r=t.to-t.from;return r&&(r>2||/[^\\s,.;:]/.test(i.sliceDoc(t.from,t.to)))||t.firstChild}function yo(i,t,e){let r=pt(i).resolveInner(t.head),n=e?E.closedBy:E.openedBy;for(let a=t.head;;){let h=e?r.childAfter(a):r.childBefore(a);if(!h)break;ay(i,h,n)?r=h:a=e?h.to:h.from}let s=r.type.prop(n),o,l;return s&&(o=e?oe(i,r.from,1):oe(i,r.to,-1))&&o.matched?l=e?o.end.to:o.end.from:l=e?r.to:r.from,b.cursor(l,e?-1:1)}var hy=i=>ae(i,t=>yo(i.state,t,!St(i))),fy=i=>ae(i,t=>yo(i.state,t,St(i)));function rm(i,t){return ae(i,e=>{if(!e.empty)return xo(e,t);let r=i.moveVertically(e,t);return r.head!=e.head?r:i.moveToLineBoundary(e,t)})}var nm=i=>rm(i,!1),sm=i=>rm(i,!0);function om(i){let t=i.scrollDOM.clientHeighto.empty?i.moveVertically(o,t,e.height):xo(o,t));if(n.eq(r.selection))return!1;let s;if(e.selfScroll){let o=i.coordsAtPos(r.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+e.marginTop,h=l.bottom-e.marginBottom;o&&o.top>a&&o.bottomlm(i,!1),Ah=i=>lm(i,!0);function je(i,t,e){let r=i.lineBlockAt(t.head),n=i.moveToLineBoundary(t,e);if(n.head==t.head&&n.head!=(e?r.to:r.from)&&(n=i.moveToLineBoundary(t,e,!1)),!e&&n.head==r.from&&r.length){let s=/^\\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(n=b.cursor(r.from+s))}return n}var cy=i=>ae(i,t=>je(i,t,!0)),uy=i=>ae(i,t=>je(i,t,!1)),dy=i=>ae(i,t=>je(i,t,!St(i))),py=i=>ae(i,t=>je(i,t,St(i))),my=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).from,1)),gy=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).to,-1));function Oy(i,t,e){let r=!1,n=Ki(i.selection,s=>{let o=oe(i,s.head,-1)||oe(i,s.head,1)||s.head>0&&oe(i,s.head-1,1)||s.headOy(i,t,!1);function Jt(i,t){let e=Ki(i.state.selection,r=>{let n=t(r);return b.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return e.eq(i.state.selection)?!1:(i.dispatch(Ce(i.state,e)),!0)}function am(i,t){return Jt(i,e=>i.moveByChar(e,t))}var hm=i=>am(i,!St(i)),fm=i=>am(i,St(i));function cm(i,t){return Jt(i,e=>i.moveByGroup(e,t))}var yy=i=>cm(i,!St(i)),by=i=>cm(i,St(i));var Sy=i=>Jt(i,t=>yo(i.state,t,!St(i))),wy=i=>Jt(i,t=>yo(i.state,t,St(i)));function um(i,t){return Jt(i,e=>i.moveVertically(e,t))}var dm=i=>um(i,!1),pm=i=>um(i,!0);function mm(i,t){return Jt(i,e=>i.moveVertically(e,t,om(i).height))}var Ip=i=>mm(i,!1),Np=i=>mm(i,!0),vy=i=>Jt(i,t=>je(i,t,!0)),ky=i=>Jt(i,t=>je(i,t,!1)),Ty=i=>Jt(i,t=>je(i,t,!St(i))),Py=i=>Jt(i,t=>je(i,t,St(i))),Cy=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).from)),Ay=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).to)),Yp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:0})),!0),zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.doc.length})),!0),Zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:0})),!0),Fp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Qy=({state:i,dispatch:t})=>(t(i.update({selection:{anchor:0,head:i.doc.length},userEvent:\"select\"})),!0),Ry=({state:i,dispatch:t})=>{let e=bo(i).map(({from:r,to:n})=>b.range(r,Math.min(n+1,i.doc.length)));return t(i.update({selection:b.create(e),userEvent:\"select\"})),!0},My=({state:i,dispatch:t})=>{let e=Ki(i.selection,r=>{var n;let s=pt(i).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&(!((n=l.parent)===null||n===void 0)&&n.parent))return b.range(l.to,l.from)}return r});return t(Ce(i,e)),!0},Ey=({state:i,dispatch:t})=>{let e=i.selection,r=null;return e.ranges.length>1?r=b.create([e.main]):e.main.empty||(r=b.create([b.cursor(e.main.head)])),r?(t(Ce(i,r)),!0):!1};function cn(i,t){if(i.state.readOnly)return!1;let e=\"delete.selection\",{state:r}=i,n=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=t(s);ao&&(e=\"delete.forward\",a=uo(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=uo(i,o,!1),l=uo(i,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:b.cursor(o,on(i)))r.between(t,t,(n,s)=>{nt&&(t=e?s:n)});return t}var gm=(i,t)=>cn(i,e=>{let r=e.from,{state:n}=i,s=n.doc.lineAt(r),o,l;if(!t&&r>s.from&&rgm(i,!1),Om=i=>gm(i,!0),xm=(i,t)=>cn(i,e=>{let r=e.head,{state:n}=i,s=n.doc.lineAt(r),o=n.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==e.head&&s.number!=(t?n.doc.lines:1)&&(r+=t?1:-1);break}let a=at(s.text,r-s.from,t)+s.from,h=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),f=o(h);if(l!=null&&f!=l)break;(h!=\" \"||r!=e.head)&&(l=f),r=a}return r}),ym=i=>xm(i,!1),$y=i=>xm(i,!0),qy=i=>cn(i,t=>{let e=i.lineBlockAt(t.head).to;return t.headcn(i,t=>{let e=i.moveToLineBoundary(t,!1).head;return t.head>e?e:Math.max(0,t.head-1)}),By=i=>cn(i,t=>{let e=i.moveToLineBoundary(t,!0).head;return t.head{if(i.readOnly)return!1;let e=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:V.of([\"\",\"\"])},range:b.cursor(r.from)}));return t(i.update(e,{scrollIntoView:!0,userEvent:\"input\"})),!0},Ly=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let n=r.from,s=i.doc.lineAt(n),o=n==s.from?n-1:at(s.text,n-s.from,!1)+s.from,l=n==s.to?n+1:at(s.text,n-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:i.doc.slice(n,l).append(i.doc.slice(o,n))},range:b.cursor(l)}});return e.changes.empty?!1:(t(i.update(e,{scrollIntoView:!0,userEvent:\"move.character\"})),!0)};function bo(i){let t=[],e=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.from),s=i.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=i.doc.lineAt(r.to-1)),e>=n.number){let o=t[t.length-1];o.to=s.to,o.ranges.push(r)}else t.push({from:n.from,to:s.to,ranges:[r]});e=s.number+1}return t}function bm(i,t,e){if(i.readOnly)return!1;let r=[],n=[];for(let s of bo(i)){if(e?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(e?s.to+1:s.from-1),l=o.length+1;if(e){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let a of s.ranges)n.push(b.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let a of s.ranges)n.push(b.range(a.anchor-l,a.head-l))}}return r.length?(t(i.update({changes:r,scrollIntoView:!0,selection:b.create(n,i.selection.mainIndex),userEvent:\"move.line\"})),!0):!1}var Vy=({state:i,dispatch:t})=>bm(i,t,!1),Wy=({state:i,dispatch:t})=>bm(i,t,!0);function Sm(i,t,e){if(i.readOnly)return!1;let r=[];for(let n of bo(i))e?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});return t(i.update({changes:r,scrollIntoView:!0,userEvent:\"input.copyline\"})),!0}var Iy=({state:i,dispatch:t})=>Sm(i,t,!1),Ny=({state:i,dispatch:t})=>Sm(i,t,!0),Yy=i=>{if(i.state.readOnly)return!1;let{state:t}=i,e=t.changes(bo(t).map(({from:n,to:s})=>(n>0?n--:si.moveVertically(n,!0)).map(e);return i.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:\"delete.line\"}),!0};function zy(i,t){if(/\\(\\)|\\[\\]|\\{\\}/.test(i.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=pt(i).resolveInner(t),r=e.childBefore(t),n=e.childAfter(t),s;return r&&n&&r.to<=t&&n.from>=t&&(s=r.type.prop(E.closedBy))&&s.indexOf(n.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(n.from).from&&!/\\S/.test(i.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var Zy=wm(!1),Fy=wm(!0);function wm(i){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:s,to:o}=n,l=t.doc.lineAt(s),a=!i&&s==o&&zy(t,s);i&&(s=o=(o<=l.to?l:t.doc.lineAt(o)).to);let h=new gi(t,{simulateBreak:s,simulateDoubleBreak:!!a}),f=oh(h,s);for(f==null&&(f=We(/^\\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));ol.from&&s{let n=[];for(let o=r.from;o<=r.to;){let l=i.doc.lineAt(o);l.number>e&&(r.empty||r.to>l.from)&&(t(l,n,r),e=l.number),o=l.to+1}let s=i.changes(n);return{changes:n,range:b.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var _y=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=Object.create(null),r=new gi(i,{overrideIndentation:s=>{let o=e[s];return o??-1}}),n=Eh(i,(s,o,l)=>{let a=oh(r,s.from);if(a==null)return;/\\S/.test(s.text)||(a=0);let h=/^\\s*/.exec(s.text)[0],f=rn(i,a);(h!=f||l.fromi.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{r.push({from:e.from,insert:i.facet(ke)})}),{userEvent:\"input.indent\"})),!0),Hy=({state:i,dispatch:t})=>i.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{let n=/^\\s*/.exec(e.text)[0];if(!n)return;let s=We(n,i.tabSize),o=0,l=rn(i,Math.max(0,s-en(i)));for(;o({mac:i.key,run:i.run,shift:i.shift}))),So=[{key:\"Alt-ArrowLeft\",mac:\"Ctrl-ArrowLeft\",run:hy,shift:Sy},{key:\"Alt-ArrowRight\",mac:\"Ctrl-ArrowRight\",run:fy,shift:wy},{key:\"Alt-ArrowUp\",run:Vy},{key:\"Shift-Alt-ArrowUp\",run:Iy},{key:\"Alt-ArrowDown\",run:Wy},{key:\"Shift-Alt-ArrowDown\",run:Ny},{key:\"Escape\",run:Ey},{key:\"Mod-Enter\",run:Fy},{key:\"Alt-l\",mac:\"Ctrl-l\",run:Ry},{key:\"Mod-i\",run:My,preventDefault:!0},{key:\"Mod-[\",run:Hy},{key:\"Mod-]\",run:Gy},{key:\"Mod-Alt-\\\\\",run:_y},{key:\"Shift-Mod-k\",run:Yy},{key:\"Shift-Mod-\\\\\",run:xy},{key:\"Mod-/\",run:Y1},{key:\"Alt-A\",run:Z1}].concat(jy);var Dh=class i{constructor(t,e,r,n,s,o,l,a,h,f=0,c){this.p=t,this.stack=e,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=f,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?\"!\"+this.score:\"\"}`}static start(t,e,r=0){let n=t.parser.context;return new i(t,[],e,r,r,0,[],0,n?new wo(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let r=t>>19,n=t&65535,{parser:s}=this.p,o=s.dynamicPrecedence(n);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(!((e=this.p.parser.nodeSet.types[n])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,r,n=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(e==r)return;if(o.buffer[l-2]>=e){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(t,e,r,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(t,e,r,n){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=n,this.shiftContext(e,r),e<=this.p.parser.maxNode&&this.buffer.push(e,r,n,4);else{let s=t,{parser:o}=this.p;(n>this.pos||e<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,r),this.shiftContext(e,r),e<=o.maxNode&&this.buffer.push(e,r,n,4)}}apply(t,e,r,n){t&65536?this.reduce(t):this.shift(t,e,r,n)}useNode(t,e){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let r=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,r?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Bh(this);;){let r=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(r==0)return!1;if(!(r&65536))return!0;e.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let s=0,o;sa&1&&l==o)||n.push(e[s],o)}e=n}let r=[];for(let n=0;n>19,n=e&65535,s=this.stack.length-r*3;if(s<0||t.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],r=(n,s)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&t.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},wo=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},Bh=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,r=t>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},Xh=class i{constructor(t,e,r){this.stack=t,this.pos=e,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new i(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function un(i,t=Uint16Array){if(typeof i!=\"string\")return i;let e=null;for(let r=0,n=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}e?e[n++]=s:e=new t(s)}return e}var Ji=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},vm=new Ji,Lh=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk=\"\",this.chunkOff=0,this.chunk2=\"\",this.chunk2Pos=0,this.next=-1,this.token=vm,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let r=this.range,n=this.rangeIndex,s=this.pos+t;for(;sr.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=o}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,r,n;if(e>=0&&e=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(t,e=0){let r=e?this.resolveOffset(e,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=\"\",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=vm,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let r=\"\";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(r+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return r}},Ke=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:r}=e.p;Am(this.data,t,e,this.id,r.data,r.tokenPrecTable)}};Ke.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var Vh=class{constructor(t,e,r){this.precTable=e,this.elseToken=r,this.data=typeof t==\"string\"?un(t):t}token(t,e){let r=t.pos,n=0;for(;;){let s=t.next<0,o=t.resolveOffset(1,1);if(Am(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(r,t.token),t.acceptToken(this.elseToken,n))}};Vh.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var yi=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};function Am(i,t,e,r,n,s){let o=0,l=1<0){let m=i[d];if(a.allows(m)&&(t.token.value==-1||t.token.value==m||Jy(m,t.token.value,n,s))){t.acceptToken(m);break}}let f=t.next,c=0,u=i[o+2];if(t.next<0&&u>c&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue t}for(;c>1,m=h+d+(d<<1),O=i[m],g=i[m+1]||65536;if(f=g)c=d+1;else{o=i[m+2],t.advance();continue t}}break}}function km(i,t,e){for(let r=t,n;(n=i[r])!=65535;r++)if(n==e)return r-t;return-1}function Jy(i,t,e,r){let n=km(e,r,t);return n<0||km(e,r,i)t)&&!r.type.isError)return e<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(i.length,Math.max(r.from+1,t+25));if(e<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return e<0?0:i.length}}var Wh=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Tm(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Tm(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(s instanceof ot){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+s.length}}},Ih=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new Ji)}getActions(t){let e=0,r=null,{parser:n}=t.p,{tokenizers:s}=n,o=n.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,a=0;for(let h=0;hc.end+25&&(a=Math.max(c.lookAhead,a)),c.value!=0)){let u=e;if(c.extended>-1&&(e=this.addActions(t,c.extended,c.end,e)),e=this.addActions(t,c.value,c.end,e),!f.extend&&(r=c,e>u))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),!r&&t.pos==this.stream.end&&(r=new Ji,r.value=t.p.parser.eofTerm,r.start=r.end=t.pos,e=this.addActions(t,r.value,r.end,e)),this.mainToken=r,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ji,{pos:r,p:n}=t;return e.start=r,e.end=Math.min(r+1,n.stream.end),e.value=r==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,r){let n=this.stream.clipPos(r.pos);if(e.token(this.stream.reset(n,t),r),t.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,r,n){for(let s=0;st.bufferLength*4?new Wh(r,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,r=this.stacks=[],n,s;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oe)r.push(l);else{if(this.advanceStack(l,r,t))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=n&&tb(n);if(o)return Nt&&console.log(\"Finish with \"+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Nt&&n&&console.log(\"Stuck with token \"+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):\"none\")),new SyntaxError(\"No parse at \"+e);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Nt&&console.log(\"Force-finish \"+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>e)&&this.recovering--}else if(r.length>1){t:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue t}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o \":\"\";if(this.stoppedAt!=null&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,f=h?t.curContext.hash:0;for(let c=this.fragments.nodeAt(n);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(t.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(E.contextHash)||0)==f))return t.useNode(c,u),Nt&&console.log(o+this.stackID(t)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof ot)||c.children.length==0||c.positions[0]>0)break;let d=c.children[0];if(d instanceof ot&&c.positions[0]==0)c=d;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Nt&&console.log(o+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let h=0;hn?e.push(m):r.push(m)}return!1}advanceFully(t,e){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return Pm(t,e),!0}}runRecovery(t,e,r){let n=null,s=!1;for(let o=0;o \":\"\";if(l.deadEnd&&(s||(s=!0,l.restart(),Nt&&console.log(f+this.stackID(l)+\" (restarted)\"),this.advanceFully(l,r))))continue;let c=l.split(),u=f;for(let d=0;c.forceReduce()&&d<10&&(Nt&&console.log(u+this.stackID(c)+\" (via force-reduce)\"),!this.advanceFully(c,r));d++)Nt&&(u=this.stackID(c)+\" -> \");for(let d of l.recoverByInsert(a))Nt&&console.log(f+this.stackID(d)+\" (via recover-insert)\"),this.advanceFully(d,r);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Nt&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Pm(l,r)):(!n||n.scorei,vo=class{constructor(t){this.start=t.start,this.shift=t.shift||qh,this.reduce=t.reduce||qh,this.reuse=t.reuse||qh,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},ko=class i extends _i{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(\" \");this.minRepeatTerm=e.length;for(let l=0;lt.topRules[l][1]),n=[];for(let l=0;l=0)s(f,a,l[h++]);else{let c=l[h+-f];for(let u=-f;u>0;u--)s(l[h++],a,c);h++}}}this.nodeSet=new Hr(e.map((l,a)=>bt.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:r.indexOf(a)>-1,error:a==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(a)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=un(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l==\"number\"?new Ke(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,r){let n=new Nh(this,t,e,r);for(let s of this.wrappers)n=s(n,t,e,r);return n}getGoto(t,e,r=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&r)return a;for(let h=s+(o>>1);s0}validAction(t,e){return!!this.allActions(t,r=>r==e?!0:null)}allActions(t,e){let r=this.stateSlot(t,4),n=r?e(r):void 0;for(let s=this.stateSlot(t,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Be(this.data,s+2);else break;n=e(Be(this.data,s+1))}return n}nextStates(t){let e=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Be(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];e.some((s,o)=>o&1&&s==n)||e.push(this.data[r],n)}}return e}configure(t){let e=Object.assign(Object.create(i.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=r}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(r=>{let n=t.tokenizers.find(s=>s.from==r);return n?n.to:r})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=t.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return e.specializers[n]=Cm(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),r=e.map(()=>!1);if(t)for(let s of t.split(\" \")){let o=e.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;sr)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorei.external(e,r)<<1|t}return i.get}var eb=1,Mm=206,Em=207,ib=208,Qm=209,rb=210,nb=211,sb=212,ob=2,lb=213,ab=214,hb=3,fb=215,cb=216,ub=4,db=217,pb=218,mb=5,gb=219,Ob=26,xb=27,yb=51,bb=52,Sb=57,wb=58,vb=59,kb=61,Tb=62,Pb=63,Cb=64,Ab=65,Qb=67,Rb=256,Mb=74,Eb=275,$b=120,qb=138,Db=159,Bb=160,Xb=163,dn=10,pn=13,Fh=32,To=9,_h=35,Lb=40,Vb=46,Rm=123,$m=39,qm=34,Wb=92,Ib=new Set([xb,yb,bb,Eb,Qb,qb,wb,vb,Rb,Cb,Ab,Mb,Tb,Pb,Db,Bb,Xb,$b]);function zh(i){return i==dn||i==pn}var Nb=new yi((i,t)=>{let e;if(i.next<0)i.acceptToken(nb);else if(t.context.depth<0)zh(i.next)&&i.acceptToken(rb,1);else if(((e=i.peek(-1))<0||zh(e))&&t.canShift(Qm)){let r=0;for(;i.next==Fh||i.next==To;)i.advance(),r++;(i.next==dn||i.next==pn||i.next==_h)&&i.acceptToken(Qm,-r)}else zh(i.next)&&i.acceptToken(ib,1)},{contextual:!0}),Yb=new yi((i,t)=>{let e=t.context.depth;if(e<0)return;let r=i.peek(-1);if(r==dn||r==pn){let n=0,s=0;for(;;){if(i.next==Fh)n++;else if(i.next==To)n+=8-n%8;else break;i.advance(),s++}n!=e&&i.next!=dn&&i.next!=pn&&i.next!=_h&&(n{for(let t=0;t<5;t++){if(i.next!=\"print\".charCodeAt(t))return;i.advance()}if(!/\\w/.test(String.fromCharCode(i.next)))for(let t=0;;t++){let e=i.peek(t);if(!(e==Fh||e==To)){e!=Lb&&e!=Vb&&e!=dn&&e!=pn&&e!=_h&&i.acceptToken(eb);return}}});function Po(i,t,e,r,n){return new yi(s=>{let o=s.pos;for(;!(s.next<0);)if(s.next==Rm)if(s.peek(1)==Rm)s.advance(2);else{if(s.pos==o){s.acceptToken(r,1);return}break}else if(s.next==Wb)s.advance(),s.next>=0&&s.advance();else if(s.next==i&&(t==1||s.peek(1)==i&&s.peek(2)==i)){if(s.pos==o){s.acceptToken(n,t);return}break}else s.advance();s.pos>o&&s.acceptToken(e)})}var Gb=Po($m,1,sb,ob,lb),Hb=Po(qm,1,ab,hb,fb),Ub=Po($m,3,cb,ub,db),jb=Po(qm,3,pb,mb,gb),Kb=Hs({'async \"*\" \"**\" FormatConversion FormatSpec':p.modifier,\"for while if elif else try except finally return raise break continue with pass assert await yield match case\":p.controlKeyword,\"in not and or is del\":p.operatorKeyword,\"from def class global nonlocal lambda\":p.definitionKeyword,import:p.moduleKeyword,\"with as print\":p.keyword,Boolean:p.bool,None:p.null,VariableName:p.variableName,\"CallExpression/VariableName\":p.function(p.variableName),\"FunctionDefinition/VariableName\":p.function(p.definition(p.variableName)),\"ClassDefinition/VariableName\":p.definition(p.className),PropertyName:p.propertyName,\"CallExpression/MemberExpression/PropertyName\":p.function(p.propertyName),Comment:p.lineComment,Number:p.number,String:p.string,FormatString:p.special(p.string),UpdateOp:p.updateOperator,\"ArithOp!\":p.arithmeticOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,AssignOp:p.definitionOperator,Ellipsis:p.punctuation,At:p.meta,\"( )\":p.paren,\"[ ]\":p.squareBracket,\"{ }\":p.brace,\".\":p.derefOperator,\", ;\":p.separator}),Jb={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:178,True:180,False:180,del:194,pass:198,break:202,continue:206,return:210,raise:218,import:222,as:224,global:228,nonlocal:230,assert:234,type:239,elif:252,while:256,try:262,except:264,finally:266,with:270,def:274,class:284,match:295,case:301},Dm=ko.deserialize({version:14,states:\"#)WO`Q#yOOP$bOSOOO%kQ&nO'#HhOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HgOOQS'#Hh'#HhOOQS'#DW'#DWOOQS'#Hg'#HgO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HXOOQS'#HX'#HXO'ZQ#xO'#HWO/ZQ&nO'#HWOOQS'#Ej'#EjO/rQ#xO'#EkOOQS'#HV'#HVO/|Q#xO'#HUOOQV'#HU'#HUO0XQ#xO'#FbOOQS'#Gj'#GjO0^Q#xO'#FaOOQV'#I_'#I_OOQV'#HT'#HTOOQV'#Fy'#FyQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HlO1cQ&nO'#E_O'ZQ#xO'#E`OOQS'#Eb'#EbOOQS'#Ed'#EdOOQS'#Ef'#EfO1wQ#xO'#EhO2_Q#xO'#ElO0XQ#xO'#EnO2rQ&nO'#EnO0XQ#xO'#EqO/rQ#xO'#EtO0XQ#xO'#EvO/rQ#xO'#E|O/rQ#xO'#FPO2}Q#xO'#FRO3UQ#xO'#FWO3aQ#xO'#FSO/rQ#xO'#FWO0XQ#xO'#FYO0XQ#xO'#F_O3fQ#xO'#FdP3mO#xO'#HSPOOO)CBv)CBvOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Ck'#CkOOQS'#Cl'#ClOOQS'#Cn'#CnO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO3xQ#xO'#DqOOQS,5:[,5:[O4]Q#xO'#HvOOQS,5:_,5:_O4jQMlO,5:_O4oQ&nO,59[O0lQ#xO,59dO0lQ#xO,59dO0lQ#xO,59dO7_Q#xO,59dO7dQ#xO,59dO7kQ#xO,59lO7rQ#xO'#HgO8xQ#xO'#HfOOQS'#Hf'#HfOOQS'#D^'#D^O9aQ#xO,59cO'ZQ#xO,59cO9oQ#xO,59cOOQS,59{,59{O9tQ#xO,5:TO'ZQ#xO,5:TOOQS,5:S,5:SO:SQ#xO,5:SO:XQ#xO,5:ZO'ZQ#xO,5:ZO'ZQ#xO,5:XOOQS,5:W,5:WO:jQ#xO,5:WO:oQ#xO,5:YOOOO'#GR'#GRO:tO,UO,5:cOOQS,5:c,5:cOOOO'#GS'#GSO:|O7[O,5:cO;UQ#xO'#DyOOOW'#GT'#GTO;fOWO,5:dOOQS,5:d,5:dO;UQ#xO'#EPOOO`'#GW'#GWO;qO`O,5:dO;UQ#xO'#EROOOp'#GX'#GXO;|OpO,5:dO;UQ#xO'#ETOOO!b'#GY'#GYOWOOQS,5>W,5>WO/rQ#xO'#EZOOQS'#E['#E[OGZQ#xO'#G]OGkQ#xO,59OOGkQ#xO,59OO)pQ#xO,5:wOGyQ&nO'#HoOOQS,5:z,5:zOOQS,5;S,5;SOH^Q#xO,5;WOHoQ#xO,5;YOOQS'#G`'#G`OH}Q&nO,5;YOI]Q#xO,5;YOIbQ#xO'#I]OOQS,5;],5;]OIpQ#xO'#IXOOQS,5;`,5;`OJRQ#xO,5;bO3aQ#xO,5;hO3aQ#xO,5;kOJZQ&nO'#I`O'ZQ#xO'#I`OJeQ#xO,5;mO2}Q#xO,5;mO/rQ#xO,5;rO0XQ#xO,5;tOJjQ#yO'#E}OKvQ#{O,5;nO! [Q#xO'#IaO3aQ#xO,5;rO! gQ#xO,5;tO! oQ#xO,5;yO! zQ&nO,5bOOQS'#Du'#DuOOQS1G/y1G/yOOQS1G/O1G/OO!-uQ&nO1G/OO!-|Q&nO1G/OO0lQ#xO1G/OO!.iQ#xO1G/WOOQS'#D]'#D]O/rQ#xO,59vOOQS1G.}1G.}O!.pQ#xO1G/gO!/QQ#xO1G/gO!/YQ#xO1G/hO'ZQ#xO'#HnO!/_Q#xO'#HnO!/dQ&nO1G.}O!/tQ#xO,59kO!0zQ#xO,5>^O!1[Q#xO,5>^O!1dQ#xO1G/oO!1iQ&nO1G/oOOQS1G/n1G/nO!1yQ#xO,5>XO!2pQ#xO,5>XO/rQ#xO1G/sO!3_Q#xO1G/uO!3dQ&nO1G/uO!3tQ&nO1G/sOOQS1G/r1G/rOOQS1G/t1G/tOOOO-E:P-E:POOQS1G/}1G/}OOOO-E:Q-E:QO!4UQ#xO'#IRO/rQ#xO'#IRO!4gQ#xO,5:eOOOW-E:R-E:ROOQS1G0O1G0OO!4uQ#xO,5:kOOO`-E:U-E:UO!5TQ#xO,5:mOOOp-E:V-E:VO!5cQ#xO,5:oOOO!b-E:W-E:WOOQS-E:X-E:XO!5qQ!LUO1G3^O!6bQ&nO1G3^O'ZQ#xO,5tOOQS1G1h1G1hO!7bQ#xO1G1hOOQS'#DX'#DXO/rQ#xO,5>TOOQS,5>T,5>TO!7gQ#xO'#FzO!7rQ#xO,59qO!7zQ#xO1G/ZO!8UQ&nO,5>XOOQS1G3r1G3rOOQS,5:u,5:uO!8uQ#xO'#HWOOQS,5ZO!9vQ#xO,5>ZO/rQ#xO1G0rO/rQ#xO1G0rO0XQ#xO1G0tOOQS-E:^-E:^O!:XQ#xO1G0tO!:dQ#xO1G0tO!:iQ#xO,5>wO!:wQ#xO,5>wO!;VQ#xO,5>sO!;mQ#xO,5>sO!zO!CZQ#xO,5>zO!CcQ&nO,5>zO/rQ#xO1G1XO!CmQ#xO1G1XO3aQ#xO1G1^O! gQ#xO1G1`OOQV,5;i,5;iO!CrQ#zO,5;iO!CwQ#{O1G1YO!G]Q#xO'#GgO3aQ#xO1G1YO3aQ#xO1G1YO!GmQ#xO,5>{O!GzQ#xO,5>{O0XQ#xO,5>{OOQV1G1^1G1^O!HSQ#xO'#F[O!HeQMlO1G1`O!HmQ#xO1G1`OOQV1G1e1G1eO3aQ#xO1G1eO!HrQ#xO1G1eO!HzQ#xO'#FfOOQV1G1j1G1jO! zQ&nO1G1jPOOO1G3Y1G3YP!IPOSO1G3YOOQS,5>a,5>aOOQS'#Dr'#DrO/rQ#xO,5>aO!IUQ#xO,5>`O!IiQ#xO,5>`OOQS1G/w1G/wO!IqQ#xO,5>cO!JRQ#xO,5>cO!JZQ#xO,5>cO!JnQ#xO,5>cO!KOQ#xO,5>cOOQS1G3|1G3|OOQS7+$j7+$jO!7zQ#xO7+$rO!LqQ#xO1G/OO!LxQ#xO1G/OOOQS1G/b1G/bOOQS,5YO'ZQ#xO,5>YOOQS7+$i7+$iO!MfQ#xO7+%RO!MnQ#xO7+%SO!MsQ#xO1G3xOOQS7+%Z7+%ZO!NTQ#xO1G3xO!N]Q#xO7+%ZOOQS,5mO##cQ#xO,5>mO##cQ#xO,5>mOOQS'#Dz'#DzO##tO$ISO'#D|O#$PO#tO'#ISOOOW1G0P1G0PO#$UQ#xO1G0PO#$^Q#xO1G0POOQS'#EQ'#EQOOO`1G0V1G0VO#$iQ#xO1G0VO#$qQ#xO1G0VOOQS'#ES'#ESOOOp1G0X1G0XO#$|Q#xO1G0XO#%UQ#xO1G0XOOQS'#EU'#EUOOO!b1G0Z1G0ZO#%aQ#xO1G0ZO#%iQ#xO1G0ZO#%tQ!LUO7+(xO#&eQ&nO1G2bP#'OQ#xO'#G[OOQS,5n,5>nOOOW7+%k7+%kO#;yQ#xO7+%kOOO`7+%q7+%qO#vO#=xQ#xO,5>vO0XQ#xO,5>vO#>ZQ#xO,5>uOOQS<`Q#xO,5>xO#>nQ#xO,5>xOOQS1G1O1G1OOOQS<vQ&nO1G2lP#?QQ#xO'#GfO#?XQ#xO7+*QO#?cQ#{O<}O#F{Q#xO,5>}OOQS,5>},5>}O#GWQ#xO,5>|O#GiQ#xO,5>|OOQS1G1b1G1bOOQS,5;x,5;xOOQV<XAN>XO#JxQ#xO<eAN>eO/rQ#xO1G2UO#KYQ&nO1G2UP#KdQ#xO'#GOOOQS1G2[1G2[P#KqQ#xO'#GUO#LOQ#xO7+)sO#LiQ#xO,5:iOOOO-E:T-E:TOOOW<[OOQSANBfANBfOOOO7+%o7+%oO$.WQ#xO7+%oOOQS7+(R7+(RO$.`Q#xO<kPP>n?`?cPP'f'fPP?{PP'f'fPP'f'f'f'f'f@P@y'fP@|PASE^H}IRPIUIlIpIsIwIzJOJRJV'fPPPJYJc'^P'^'^P'^P'^P'^P'^P'^'^'^P'^PP'^PP'^P'^PJiJuJ}PKUK[PKUPKUKUPPPKUPMjPMsM}NTMjPKUN^PKUPNeNkPNo! T! r!!]NoNo!!c!!pNoNoNoNo!#U!#[!#_!#d!#g!#q!#w!$T!$g!$m!$w!$}!%k!%q!%w!%}!&X!&_!&e!&k!&q!&w!'Z!'e!'k!'q!'w!(R!(X!(_!(e!(k!(u!({!)V!)]!)f!)l!){!*T!*_!*fPPPPPPPPPPPPPPPPP!*l!*o!*u!+O!+Y!+ePPPPPPPPPPPP!0[!1p!5s!9WPP!9`!9r!9{!:t!:k!:}!;T!;W!;Z!;^!;f!V!>]!>f!>i!>l!>r!>x!?O!?RP!?Z!?d!@`!@c]jOs#v$w*`,p(TeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o}!hQ#r$P$b$q$}%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!P!iQ#r$P$b$q$}%S%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!R!jQ#r$P$b$q$}%S%T%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!T!kQ#r$P$b$q$}%S%T%U%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!V!lQ#r$P$b$q$}%S%T%U%V%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!X!mQ#r$P$b$q$}%S%T%U%V%W%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!]!mQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d(TTOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o&iVOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1o%sXOYZ[isw}!O!S!U!V!Z!n!p#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$VvQ0X/fR1l1n'zeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oW#ym!P!Q$hW$Rv&q/f1nQ$j!RQ$n!TQ${![Q$|!]W%Z!n(O+O-WS&p$S$TQ'e$vQ)b&jQ)p'QU)q'S)r)sU)t'U)u,ZW){'Y,^-z.vQ*l'nW*m'p-P._/OQ,])zS-O*n*oY-t,U-u.s.t/lQ-w,WQ.U,tQ.Y,wQ.|.Wl/R.c/X/Y/[/w/y0O0g0l0q0v1R1W1ZQ/k.rQ0P/ZQ0^/qQ0i/{U0|0r1P1XX1S0w1T1[1]R&o$R!_!|YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WR%k!{Q#QYQ&W#cQ&Z#gQ&]#jQ&_#mQ&x$^Q&{$aR-l+tT/e.j0p![!oQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dQ&m#zQ't$|R*x'uR'}%ZQ%d!rR0[/o(SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oS#pd#q!P/V.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1](SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oT#pd#qT#d`#eR)Q&Wy(}&W&Z&]&_)P)Q)T)U)X)Y)])^+y+{+},P-l.p.q/jT+u(|+vR.q-lT#ha#iR)U&ZT#kb#lR)Y&]T#nc#oR)^&_Q$`xQ,]){R,}*mX$^x$_$`&zQ'[$nQ'r${Q'u$|R*_'eQ)|'YV-y,^-z.vZlOs$w*`,pXpOs*`,pQ$x!YQ']$oQ'^$pQ'o$zQ's$|Q*]'dQ*d'iQ*g'jQ*h'kQ*u'qS*w't'uQ,d*RQ,f*SQ,g*TQ,k*ZS,m*^*vQ,q*bQ,r*cS,s*e*fQ-T*xQ-|,cQ-},eQ.P,lS.Q,n,oQ.V,uQ.X,vQ.w.OQ.y.RQ.z.TQ.{.UQ/m.xQ/n.|Q0T/_R0o0UWpOs*`,pR#|oQ'q${S*^'e'rR,o*_Q,|*mR.],}Q*v'qQ,n*^R.R,oZnOos*`,pQ'w$}R*z'xT.a-U.bu/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1Zt/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZQ0P/ZX1S0w1T1[1]!P/U.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1]Q/t/TR0c/ug/w/W/x0_0f0k0y0{0}1Y1^1_u/].c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZX/r/R/]0^0|R0`/qV1O0r1P1XR0U/_QsOS$Os,pR,p*`Q&r$UR)g&rS%z#W$WS(p%z(sT(s%}&tQ%n#OQ%u#SW(b%n%u(g(kQ(g%rR(k%wQ&}$bR)m&}Q(v&OQ+g(qT+m(v+gQ(P%]R+P(PS(S%`%aY+T(S+U-^.h/cU+U(T(U(VU-^+V+W+XS.h-_-`R/c.iQ#_^R&R#_Q#b_R&T#bQ#e`R&X#eQ(y&US+r(y+sR+s(zQ+v(|R-m+vQ#iaR&[#iQ#lbR&^#lQ#ocR&`#oQ#qdR&a#qQ#tgQ&c#rW&f#t&c)j,RQ)j&wR,R1dQ$_xS&y$_&zR&z$`Q'X$lR)y'XQ&k#yR)c&kQ$h!QR'R$hQ,V)qS-v,V.uR.u-wQ'V$jR)v'VQ,_)|R-{,_Q#wkR&h#wQ*Q']R,b*QQ'`$qS*X'`*YR*Y'aQ'h$xR*a'hQ'm$yS*k'm,zR,z*lQ-Q*qR.`-QWoOs*`,pR#{oQ.b-UR/P.bd/x/W0_0f0k0y0{0}1Y1^1_R0e/xU/p/R0^0|R0]/pQ0x0kS1U0x1VR1V0yS0s0_0`R1Q0sQ/z/WR0h/zR!`PXrOs*`,pWqOs*`,pR'f$wYkOs$w*`,pR&g#v[xOs#v$w*`,pR&x$^&hQOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1oQ!sTQ#rfQ$PtU$by%p(eS$q!W$tQ$}!^Q%S!hQ%T!iQ%U!jQ%V!kQ%W!lQ%X!mQ%r#PQ%w#TQ%}#XQ&O#YQ&t$XQ'a$rQ'x%OQ)`&dU)k&|)l,SW*U'_*W,i,jQ+Z(_Q+d(nQ,h*VQ-g+lQ0n0SR1d1iQ#OYQ#SZQ$o!UQ$p!VQ%`!pQ(V%a^(^%m%t(a(i+]+`+b^+Q(R+S-[-].g/b0WQ+W(TQ+X(UQ,e*RQ-Z+RQ-_+VQ.e-XQ.f-YQ.i-`Q/`.dR0V/a[gOs#v$w*`,p!^!{YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WQ#W[Q#uiS$Ww}Q$e!OW$l!S$a'b*[S$y!Z$uW%Y!n(O+O-WY&U#c#g#j#m+t`&e#s&b)_)a)i,Q-r1hQ&u$YQ&v$[Q&w$^Q'{%[Q(]%kW(m%y(o+e+iQ(q%{Q(z&VQ)e&oS)h&s1fQ)n'OQ)o'PU)w'W)x,[Q*O'ZQ*e'iY*i'l*j,x,y.ZQ*|'}S+Y(Y1gW+k(u+f-d-hW+o(x+q-j-kQ,a*PQ,u*fQ-S*tQ-i+pQ-s,TQ.[,|Q.m-fR.}.]hUOs#s#v$w&b&s(Y)_)a*`,p%Y!zYZ[iw}!O!S!U!V!Z!n!p#c#g#j#m$Y$[$^$a$u%[%a%k%m%t%y%{&V&o'O'P'W'Z'b'i'l'}(O(R(T(U(a(i(o(u(x)i)x*P*R*[*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$QuW%e!t!x1a1kQ%f!uQ%g!vQ%i!yQ%s1`S(X%h1eQ(Z1bQ([1cQ-a+^Q.l-bS/d.j0pR1m1oU$Uv/f1nR)f&q[hOs#v$w*`,pa!}Y#c#g#j#m$^$a+tQ#][Q$ZwR$d}Q%o#OQ%v#SQ%|#WQ'{%YQ(h%rQ(l%wQ(t%}Q(w&OQ+h(qQ-V*|Q.k-aQ/h.lR0Y/gQ$cyQ(d%pR+_(eQ/g.jR0z0pR#VZR#[[R%_!nQ%]!nV*}(O+O-W!]!qQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-l+tQ)O&WQ)S&ZQ)W&]Q)[&_S+x)P)QS+z)T)US+|)X)YS,O)])^Q-n+yQ-o+{Q-p+}Q-q,PQ.o-lS/i.p.qR0Z/jQ$m!SQ&{$aQ*Z'bR,l*[Q#zmQ$f!PQ$i!QR'T$hQ)p'SR,Y)sQ)p'SQ,X)rR,Y)sR$k!RR)}'YXqOs*`,pQ$s!WR'c$tQ$z!ZR'd$uR*s'pQ*q'pV.^-P._/OQ/_.cQ/|/XR/}/YU/W.c/X/YQ0R/[Q0_/qQ0d/wU0f/y0g0vQ0k0OQ0y0lQ0{0qU0}0r1P1XQ1Y1RQ1^1WR1_1ZR0Q/ZR0a/q\",nodeNames:\"\\u26A0 print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard\",maxTerm:288,context:Fb,nodeProps:[[\"isolate\",-8,6,73,74,75,79,81,83,85,\"\"],[\"group\",-15,8,93,95,96,98,100,102,104,106,107,108,110,113,116,118,\"Statement Statement\",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,87,88,89,90,\"Expression\",-10,122,124,127,129,130,134,136,141,143,146,\"Statement\",-9,151,152,155,156,158,159,160,161,162,\"Pattern\"],[\"openedBy\",25,\"(\",56,\"[\",60,\"{\"],[\"closedBy\",26,\")\",57,\"]\",61,\"}\"]],propSources:[Kb],skippedNodes:[0,6],repeatNodeCount:38,tokenData:\"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&w!b&oS&rW%u!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&w!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&w!b&oS&rWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cDXa&w!b&oS&msOYE^YZ%TZ]E^]^%T^rE^rs!)|swE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cEia&w!b&oS&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cFw]&w!b&oS&msOr%Trs'Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cGya&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxIOx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cIXa&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxJ^x#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#_Jg_&w!b&rW&msOYJ^YZ1XZ]J^]^1X^rJ^rsKfs#OJ^#O#PL`#P#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`!!o<%lOJ^#_KmZ&w!b&msOr1Xrs2ys#O1X#O#P3q#P#o1X#o#p4`#p#q1X#q#r4`#r;'S1X;'S;=`7i<%lO1X#_LeW&w!bO#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`! r;=`<%lL}<%lOJ^{MUZ&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l<%lOL}{M|V&msOr4`rs5ds#O4`#O#P5y#P;'S4`;'S;=`6t<%lO4`{NfRO;'SL};'S;=`No;=`OL}{Nv[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lL}<%lOL}{! oP;=`<%lL}#_! y[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lJ^<%lOL}#_!!rP;=`<%lJ^#c!!zW&w!bO#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!(q;=`<%l!#d<%lOE^!P!#m]&oS&rW&msOY!#dYZ8^Z]!#d]^8^^r!#drs!$fsw!#dwx!%Yx#O!#d#O#P!'Y#P;'S!#d;'S;=`!(k<%lO!#d!P!$mX&oS&msOr8^rs9rsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`^s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!>e_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!?ds#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!?k_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!3`s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!@q[U!T&w!bOY!=UYZ1XZ]!=U]^1X^#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!Ec;=`<%l4`<%lO!=U!]!AnZU!T&rWOY!AgYZ4`Z]!Ag]^4`^r!Agrs!Bas#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!BfZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!CXs#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!C^ZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!4Ys#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!DUWU!TOY!AgYZ4`Z]!Ag]^4`^;'S!Ag;'S;=`!Dn;=`<%l4`<%lO!Ag!]!DsW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&w!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&oS&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&oS&rWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&w!b&oS&rW&l`&XsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Jb[i]||-1}],tokenPrec:7500});var Bm=new zs,Vm=new Set([\"Script\",\"Body\",\"FunctionDefinition\",\"ClassDefinition\",\"LambdaExpression\",\"ForStatement\",\"MatchClause\"]);function Co(i){return(t,e,r)=>{if(r)return!1;let n=t.node.getChild(\"VariableName\");return n&&e(n,i),!0}}var tS={FunctionDefinition:Co(\"function\"),ClassDefinition:Co(\"class\"),ForStatement(i,t,e){if(e){for(let r=i.node.firstChild;r;r=r.nextSibling)if(r.name==\"VariableName\")t(r,\"variable\");else if(r.name==\"in\")break}},ImportStatement(i,t){var e,r;let{node:n}=i,s=((e=n.firstChild)===null||e===void 0?void 0:e.name)==\"from\";for(let o=n.getChild(\"import\");o;o=o.nextSibling)o.name==\"VariableName\"&&((r=o.nextSibling)===null||r===void 0?void 0:r.name)!=\"as\"&&t(o,s?\"variable\":\"namespace\")},AssignStatement(i,t){for(let e=i.node.firstChild;e;e=e.nextSibling)if(e.name==\"VariableName\")t(e,\"variable\");else if(e.name==\":\"||e.name==\"AssignOp\")break},ParamList(i,t){for(let e=null,r=i.node.firstChild;r;r=r.nextSibling)r.name==\"VariableName\"&&(!e||!/\\*|AssignOp/.test(e.name))&&t(r,\"variable\"),e=r},CapturePattern:Co(\"variable\"),AsPattern:Co(\"variable\"),__proto__:null};function Wm(i,t){let e=Bm.get(t);if(e)return e;let r=[],n=!0;function s(o,l){let a=i.sliceString(o.from,o.to);r.push({label:a,type:l})}return t.cursor(st.IncludeAnonymous).iterate(o=>{if(o.name){let l=tS[o.name];if(l&&l(o,s,n)||!n&&Vm.has(o.name))return!1;n=!1}else if(o.to-o.from>8192){for(let l of Wm(i,o.node))r.push(l);return!1}}),Bm.set(t,r),r}var Xm=/^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/,Im=[\"String\",\"FormatString\",\"Comment\",\"PropertyName\"];function eS(i){let t=pt(i.state).resolveInner(i.pos,-1);if(Im.indexOf(t.name)>-1)return null;let e=t.name==\"VariableName\"||t.to-t.from<20&&Xm.test(i.state.sliceDoc(t.from,t.to));if(!e&&!i.explicit)return null;let r=[];for(let n=t;n;n=n.parent)Vm.has(n.name)&&(r=r.concat(Wm(i.state.doc,n)));return{options:r,from:e?t.from:i.pos,validFor:Xm}}var iS=[\"__annotations__\",\"__builtins__\",\"__debug__\",\"__doc__\",\"__import__\",\"__name__\",\"__loader__\",\"__package__\",\"__spec__\",\"False\",\"None\",\"True\"].map(i=>({label:i,type:\"constant\"})).concat([\"ArithmeticError\",\"AssertionError\",\"AttributeError\",\"BaseException\",\"BlockingIOError\",\"BrokenPipeError\",\"BufferError\",\"BytesWarning\",\"ChildProcessError\",\"ConnectionAbortedError\",\"ConnectionError\",\"ConnectionRefusedError\",\"ConnectionResetError\",\"DeprecationWarning\",\"EOFError\",\"Ellipsis\",\"EncodingWarning\",\"EnvironmentError\",\"Exception\",\"FileExistsError\",\"FileNotFoundError\",\"FloatingPointError\",\"FutureWarning\",\"GeneratorExit\",\"IOError\",\"ImportError\",\"ImportWarning\",\"IndentationError\",\"IndexError\",\"InterruptedError\",\"IsADirectoryError\",\"KeyError\",\"KeyboardInterrupt\",\"LookupError\",\"MemoryError\",\"ModuleNotFoundError\",\"NameError\",\"NotADirectoryError\",\"NotImplemented\",\"NotImplementedError\",\"OSError\",\"OverflowError\",\"PendingDeprecationWarning\",\"PermissionError\",\"ProcessLookupError\",\"RecursionError\",\"ReferenceError\",\"ResourceWarning\",\"RuntimeError\",\"RuntimeWarning\",\"StopAsyncIteration\",\"StopIteration\",\"SyntaxError\",\"SyntaxWarning\",\"SystemError\",\"SystemExit\",\"TabError\",\"TimeoutError\",\"TypeError\",\"UnboundLocalError\",\"UnicodeDecodeError\",\"UnicodeEncodeError\",\"UnicodeError\",\"UnicodeTranslateError\",\"UnicodeWarning\",\"UserWarning\",\"ValueError\",\"Warning\",\"ZeroDivisionError\"].map(i=>({label:i,type:\"type\"}))).concat([\"bool\",\"bytearray\",\"bytes\",\"classmethod\",\"complex\",\"float\",\"frozenset\",\"int\",\"list\",\"map\",\"memoryview\",\"object\",\"range\",\"set\",\"staticmethod\",\"str\",\"super\",\"tuple\",\"type\"].map(i=>({label:i,type:\"class\"}))).concat([\"abs\",\"aiter\",\"all\",\"anext\",\"any\",\"ascii\",\"bin\",\"breakpoint\",\"callable\",\"chr\",\"compile\",\"delattr\",\"dict\",\"dir\",\"divmod\",\"enumerate\",\"eval\",\"exec\",\"exit\",\"filter\",\"format\",\"getattr\",\"globals\",\"hasattr\",\"hash\",\"help\",\"hex\",\"id\",\"input\",\"isinstance\",\"issubclass\",\"iter\",\"len\",\"license\",\"locals\",\"max\",\"min\",\"next\",\"oct\",\"open\",\"ord\",\"pow\",\"print\",\"property\",\"quit\",\"repr\",\"reversed\",\"round\",\"setattr\",\"slice\",\"sorted\",\"sum\",\"vars\",\"zip\"].map(i=>({label:i,type:\"function\"}))),rS=[Pe(\"def ${name}(${params}):\\n\t${}\",{label:\"def\",detail:\"function\",type:\"keyword\"}),Pe(\"for ${name} in ${collection}:\\n\t${}\",{label:\"for\",detail:\"loop\",type:\"keyword\"}),Pe(\"while ${}:\\n\t${}\",{label:\"while\",detail:\"loop\",type:\"keyword\"}),Pe(\"try:\\n\t${}\\nexcept ${error}:\\n\t${}\",{label:\"try\",detail:\"/ except block\",type:\"keyword\"}),Pe(`if \\${}:\n\t\n`,{label:\"if\",detail:\"block\",type:\"keyword\"}),Pe(\"if ${}:\\n\t${}\\nelse:\\n\t${}\",{label:\"if\",detail:\"/ else block\",type:\"keyword\"}),Pe(\"class ${name}:\\n\tdef __init__(self, ${params}):\\n\t\t\t${}\",{label:\"class\",detail:\"definition\",type:\"keyword\"}),Pe(\"import ${module}\",{label:\"import\",detail:\"statement\",type:\"keyword\"}),Pe(\"from ${module} import ${names}\",{label:\"from\",detail:\"import\",type:\"keyword\"})],nS=Ap(Im,wh(iS.concat(rS)));function Lm(i,t){let e=i.baseIndentFor(t),r=i.lineAt(i.pos,-1),n=r.from+r.text.length;return/^\\s*($|#)/.test(r.text)&&i.node.toe?null:e+i.unit}var Gh=Us.define({name:\"python\",parser:Dm.configure({props:[lh.add({Body:i=>{var t;return(t=Lm(i,i.node))!==null&&t!==void 0?t:i.continue()},IfStatement:i=>/^\\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\\s*(except |finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),\"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression\":Ks({closing:\")\"}),\"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression\":Ks({closing:\"}\"}),\"ArrayExpression ArrayComprehensionExpression\":Ks({closing:\"]\"}),\"String FormatString\":()=>null,Script:i=>{if(i.pos+/\\s*/.exec(i.textAfter)[0].length>=i.node.to){let t=null;for(let e=i.node,r=e.to;e=e.lastChild,!(!e||e.to!=r);)e.type.name==\"Body\"&&(t=e);if(t){let e=Lm(i,t);if(e!=null)return e}}return i.continue()}}),ah.add({\"ArrayExpression DictionaryExpression SetExpression TupleExpression\":ap,Body:(i,t)=>({from:i.from+1,to:i.to-(i.to==t.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:[\"(\",\"[\",\"{\",\"'\",'\"',\"'''\",'\"\"\"'],stringPrefixes:[\"f\",\"fr\",\"rf\",\"r\",\"u\",\"b\",\"br\",\"rb\",\"F\",\"FR\",\"RF\",\"R\",\"U\",\"B\",\"BR\",\"RB\"]},commentTokens:{line:\"#\"},indentOnInput:/^\\s*([\\}\\]\\)]|else:|elif |except |finally:)$/}});function Hh(){return new js(Gh,[Gh.data.of({autocomplete:eS}),Gh.data.of({autocomplete:nS})])}function z(){var i=arguments[0];typeof i==\"string\"&&(i=document.createElement(i));var t=1,e=arguments[1];if(e&&typeof e==\"object\"&&e.nodeType==null&&!Array.isArray(e)){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n==\"string\"?i.setAttribute(r,n):n!=null&&(i[r]=n)}t++}for(;tl.from==l.to||l.from==l.to-1&&r.doc.lineAt(l.from).to==l.from?R.widget({widget:new jh(l),diagnostic:l}).range(l.from):R.mark({attributes:{class:\"cm-lintRange cm-lintRange-\"+l.severity+(l.markClass?\" \"+l.markClass:\"\")},diagnostic:l,inclusive:!0}).range(l.from,l.to)),!0);return new i(o,e,tr(o))}};function tr(i,t=null,e=0){let r=null;return i.between(e,1e9,(n,s,{spec:o})=>{if(!(t&&o.diagnostic!=t))return r=new Uh(n,s,o.diagnostic),!1}),r}function sS(i,t){let e=i.startState.doc.lineAt(t.pos);return!!(i.effects.some(r=>r.is(zm))||i.changes.touchesRange(e.from,e.to))}function oS(i,t){return i.field(Yt,!1)?t:t.concat(M.appendConfig.of(pS))}var zm=M.define(),Kh=M.define(),Zm=M.define(),Yt=it.define({create(){return new bi(R.none,null,null)},update(i,t){if(t.docChanged){let e=i.diagnostics.map(t.changes),r=null;if(i.selected){let n=t.changes.mapPos(i.selected.from,1);r=tr(e,i.selected.diagnostic,n)||tr(e,null,n)}i=new bi(e,i.panel,r)}for(let e of t.effects)e.is(zm)?i=bi.init(e.value,i.panel,t.state):e.is(Kh)?i=new bi(i.diagnostics,e.value?Ro.open:null,i.selected):e.is(Zm)&&(i=new bi(i.diagnostics,i.panel,e.value));return i},provide:i=>[fi.from(i,t=>t.panel),T.decorations.from(i,t=>t.diagnostics)]});var lS=R.mark({class:\"cm-lintRange cm-lintRange-active\",inclusive:!0});function aS(i,t,e){let{diagnostics:r}=i.state.field(Yt),n=[],s=2e8,o=0;r.between(t-(e<0?1:0),t+(e>0?1:0),(a,h,{spec:f})=>{t>=a&&t<=h&&(a==h||(t>a||e>0)&&(tGm(i,e,!1)))}var fS=i=>{let t=i.state.field(Yt,!1);(!t||!t.panel)&&i.dispatch({effects:oS(i.state,[Kh.of(!0)])});let e=ci(i,Ro.open);return e&&e.dom.querySelector(\".cm-panel-lint ul\").focus(),!0},Ym=i=>{let t=i.state.field(Yt,!1);return!t||!t.panel?!1:(i.dispatch({effects:Kh.of(!1)}),!0)},cS=i=>{let t=i.state.field(Yt,!1);if(!t)return!1;let e=i.state.selection.main,r=t.diagnostics.iter(e.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==e.from&&r.to==e.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var Mo=[{key:\"Mod-Shift-m\",run:fS,preventDefault:!0},{key:\"F8\",run:cS}];var Fm=A.define({combine(i){return Object.assign({sources:i.map(t=>t.source).filter(t=>t!=null)},kt(i.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(t,e)=>t?e?r=>t(r)||e(r):t:e}))}});function _m(i){let t=[];if(i)t:for(let{name:e}of i){for(let r=0;rs.toLowerCase()==n.toLowerCase())){t.push(n);continue t}}t.push(\"\")}return t}function Gm(i,t,e){var r;let n=e?_m(t.actions):[];return z(\"li\",{class:\"cm-diagnostic cm-diagnostic-\"+t.severity},z(\"span\",{class:\"cm-diagnosticText\"},t.renderMessage?t.renderMessage():t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=u=>{if(u.preventDefault(),l)return;l=!0;let d=tr(i.state.field(Yt).diagnostics,t);d&&s.apply(i,d.from,d.to)},{name:h}=s,f=n[o]?h.indexOf(n[o]):-1,c=f<0?h:[h.slice(0,f),z(\"u\",h.slice(f,f+1)),h.slice(f+1)];return z(\"button\",{type:\"button\",class:\"cm-diagnosticAction\",onclick:a,onmousedown:a,\"aria-label\":` Action: ${h}${f<0?\"\":` (access key \"${n[o]})\"`}.`},c)}),t.source&&z(\"div\",{class:\"cm-diagnosticSource\"},t.source))}var jh=class extends Ut{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return z(\"span\",{class:\"cm-lintPoint cm-lintPoint-\"+this.diagnostic.severity})}},Qo=class{constructor(t,e){this.diagnostic=e,this.id=\"item_\"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Gm(t,e,!0),this.dom.id=this.id,this.dom.setAttribute(\"role\",\"option\")}},Ro=class i{constructor(t){this.view=t,this.items=[];let e=n=>{if(n.keyCode==27)Ym(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=_m(s.actions);for(let l=0;l{for(let s=0;sYm(this.view)},\"\\xD7\")),this.update()}get selectedIndex(){let t=this.view.state.field(Yt).selected;if(!t)return-1;for(let e=0;e{let h=-1,f;for(let c=r;cr&&(this.items.splice(r,h-r),n=!0)),e&&f.diagnostic==e.diagnostic?f.dom.hasAttribute(\"aria-selected\")||(f.dom.setAttribute(\"aria-selected\",\"true\"),s=f):f.dom.hasAttribute(\"aria-selected\")&&f.dom.removeAttribute(\"aria-selected\"),r++});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute(\"aria-activedescendant\"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)e();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Yt),r=tr(e.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Zm.of(r)})}static open(t){return new i(t)}};function uS(i,t='viewBox=\"0 0 40 40\"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function Ao(i){return uS(``,'width=\"6\" height=\"3\"')}var dS=T.baseTheme({\".cm-diagnostic\":{padding:\"3px 6px 3px 8px\",marginLeft:\"-1px\",display:\"block\",whiteSpace:\"pre-wrap\"},\".cm-diagnostic-error\":{borderLeft:\"5px solid #d11\"},\".cm-diagnostic-warning\":{borderLeft:\"5px solid orange\"},\".cm-diagnostic-info\":{borderLeft:\"5px solid #999\"},\".cm-diagnostic-hint\":{borderLeft:\"5px solid #66d\"},\".cm-diagnosticAction\":{font:\"inherit\",border:\"none\",padding:\"2px 4px\",backgroundColor:\"#444\",color:\"white\",borderRadius:\"3px\",marginLeft:\"8px\",cursor:\"pointer\"},\".cm-diagnosticSource\":{fontSize:\"70%\",opacity:.7},\".cm-lintRange\":{backgroundPosition:\"left bottom\",backgroundRepeat:\"repeat-x\",paddingBottom:\"0.7px\"},\".cm-lintRange-error\":{backgroundImage:Ao(\"#d11\")},\".cm-lintRange-warning\":{backgroundImage:Ao(\"orange\")},\".cm-lintRange-info\":{backgroundImage:Ao(\"#999\")},\".cm-lintRange-hint\":{backgroundImage:Ao(\"#66d\")},\".cm-lintRange-active\":{backgroundColor:\"#ffdd9980\"},\".cm-tooltip-lint\":{padding:0,margin:0},\".cm-lintPoint\":{position:\"relative\",\"&:after\":{content:'\"\"',position:\"absolute\",bottom:0,left:\"-2px\",borderLeft:\"3px solid transparent\",borderRight:\"3px solid transparent\",borderBottom:\"4px solid #d11\"}},\".cm-lintPoint-warning\":{\"&:after\":{borderBottomColor:\"orange\"}},\".cm-lintPoint-info\":{\"&:after\":{borderBottomColor:\"#999\"}},\".cm-lintPoint-hint\":{\"&:after\":{borderBottomColor:\"#66d\"}},\".cm-panel.cm-panel-lint\":{position:\"relative\",\"& ul\":{maxHeight:\"100px\",overflowY:\"auto\",\"& [aria-selected]\":{backgroundColor:\"#ddd\",\"& u\":{textDecoration:\"underline\"}},\"&:focus [aria-selected]\":{background_fallback:\"#bdf\",backgroundColor:\"Highlight\",color_fallback:\"white\",color:\"HighlightText\"},\"& u\":{textDecoration:\"none\"},padding:0,margin:0},\"& [name=close]\":{position:\"absolute\",top:\"0\",right:\"2px\",background:\"inherit\",border:\"none\",font:\"inherit\",padding:0,margin:0}}});var pS=[Yt,T.decorations.compute([Yt],i=>{let{selected:t,panel:e}=i.field(Yt);return!t||!e||t.from==t.to?R.none:R.set([lS.range(t.from,t.to)])}),Id(aS,{hideOn:sS}),dS];var Hm=typeof String.prototype.normalize==\"function\"?i=>i.normalize(\"NFKD\"):i=>i,ti=class{constructor(t,e,r=0,n=t.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=\"\",this.bufferPos=0,this.iter=t.iterRange(r,n),this.bufferStart=r,this.normalize=s?l=>s(Hm(l)):Hm,this.query=this.normalize(e)}peek(){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 dt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=vr(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=wt(t);let n=this.normalize(e);for(let s=0,o=r;;s++){let l=n.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==n.length-1){if(a)return this.value=a,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=\"\":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let r=this.curLineStart+e.index,n=r+e[0].length;if(this.matchPos=Xo(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||n.to<=e){let l=new i(e,t.sliceString(e,r));return Jh.set(t,l),l}if(n.from==e&&n.to==r)return n;let{text:s,from:o}=n;return o>e&&(s=t.sliceString(e,o)+s,o=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let r=this.flat.from+e.index,n=r+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this.matchPos=Xo(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Do.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<\"u\"&&(qo.prototype[Symbol.iterator]=Bo.prototype[Symbol.iterator]=function(){return this});function mS(i){try{return new RegExp(i,of),!0}catch{return!1}}function Xo(i,t){if(t>=i.length)return t;let e=i.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}function tf(i){let t=String(i.state.doc.lineAt(i.state.selection.main.head).number),e=z(\"input\",{class:\"cm-textfield\",name:\"line\",value:t}),r=z(\"form\",{class:\"cm-gotoLine\",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:Lo.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),n())},onsubmit:s=>{s.preventDefault(),n()}},z(\"label\",i.state.phrase(\"Go to line\"),\": \",e),\" \",z(\"button\",{class:\"cm-button\",type:\"submit\"},i.state.phrase(\"go\")));function n(){let s=/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:o}=i,l=o.doc.lineAt(o.selection.main.head),[,a,h,f,c]=s,u=f?+f.slice(1):0,d=h?+h:l.number;if(h&&c){let g=d/100;a&&(g=g*(a==\"-\"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a==\"-\"?-1:1)+l.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),O=b.cursor(m.from+Math.max(0,Math.min(u,m.length)));i.dispatch({effects:[Lo.of(!1),T.scrollIntoView(O.from,{y:\"center\"})],selection:O}),i.focus()}return{dom:r}}var Lo=M.define(),Um=it.define({create(){return!0},update(i,t){for(let e of t.effects)e.is(Lo)&&(i=e.value);return i},provide:i=>fi.from(i,t=>t?tf:null)}),gS=i=>{let t=ci(i,tf);if(!t){let e=[Lo.of(!0)];i.state.field(Um,!1)==null&&e.push(M.appendConfig.of([Um,OS])),i.dispatch({effects:e}),t=ci(i,tf)}return t&&t.dom.querySelector(\"input\").select(),!0},OS=T.baseTheme({\".cm-panel.cm-gotoLine\":{padding:\"2px 6px 4px\",\"& label\":{fontSize:\"80%\"}}}),xS={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tg=A.define({combine(i){return kt(i,xS,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}});function eg(i){let t=[vS,wS];return i&&t.push(tg.of(i)),t}var yS=R.mark({class:\"cm-selectionMatch\"}),bS=R.mark({class:\"cm-selectionMatch cm-selectionMatch-main\"});function jm(i,t,e,r){return(e==0||i(t.sliceDoc(e-1,e))!=F.Word)&&(r==t.doc.length||i(t.sliceDoc(r,r+1))!=F.Word)}function SS(i,t,e,r){return i(t.sliceDoc(e,e+1))==F.Word&&i(t.sliceDoc(r-1,r))==F.Word}var wS=ft.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=i.state.facet(tg),{state:e}=i,r=e.selection;if(r.ranges.length>1)return R.none;let n=r.main,s,o=null;if(n.empty){if(!t.highlightWordAroundCursor)return R.none;let a=e.wordAt(n.head);if(!a)return R.none;o=e.charCategorizer(n.head),s=e.sliceDoc(a.from,a.to)}else{let a=n.to-n.from;if(a200)return R.none;if(t.wholeWords){if(s=e.sliceDoc(n.from,n.to),o=e.charCategorizer(n.head),!(jm(o,e,n.from,n.to)&&SS(o,e,n.from,n.to)))return R.none}else if(s=e.sliceDoc(n.from,n.to),!s)return R.none}let l=[];for(let a of i.visibleRanges){let h=new ti(e.doc,s,a.from,a.to);for(;!h.next().done;){let{from:f,to:c}=h.value;if((!o||jm(o,e,f,c))&&(n.empty&&f<=n.from&&c>=n.to?l.push(bS.range(f,c)):(f>=n.to||c<=n.from)&&l.push(yS.range(f,c)),l.length>t.maxMatches))return R.none}}return R.set(l)}},{decorations:i=>i.decorations}),vS=T.baseTheme({\".cm-selectionMatch\":{backgroundColor:\"#99ff7780\"},\".cm-searchMatch .cm-selectionMatch\":{backgroundColor:\"transparent\"}}),kS=({state:i,dispatch:t})=>{let{selection:e}=i,r=b.create(e.ranges.map(n=>i.wordAt(n.head)||b.cursor(n.head)),e.mainIndex);return r.eq(e)?!1:(t(i.update({selection:r})),!0)};function TS(i,t){let{main:e,ranges:r}=i.selection,n=i.wordAt(e.head),s=n&&n.from==e.from&&n.to==e.to;for(let o=!1,l=new ti(i.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ti(i.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var PS=({state:i,dispatch:t})=>{let{ranges:e}=i.selection;if(e.some(s=>s.from===s.to))return kS({state:i,dispatch:t});let r=i.sliceDoc(e[0].from,e[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=r))return!1;let n=TS(i,r);return n?(t(i.update({selection:i.selection.addRange(b.range(n.from,n.to),!1),effects:T.scrollIntoView(n.to)})),!0):!1},rr=A.define({combine(i){return kt(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new sf(t),scrollToMatch:t=>T.scrollIntoView(t)})}});var Vo=class{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||\"\",this.valid=!!this.search&&(!this.regexp||mS(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\\\([nrt\\\\])/g,(e,r)=>r==\"n\"?`\n`:r==\"r\"?\"\\r\":r==\"t\"?\"\t\":\"\\\\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new rf(this):new ef(this)}getCursor(t,e=0,r){let n=t.doc?t:Y.create({doc:t});return r==null&&(r=n.doc.length),this.regexp?ir(this,n,e,r):er(this,n,e,r)}},Wo=class{constructor(t){this.spec=t}};function er(i,t,e,r){return new ti(t.doc,i.unquoted,e,r,i.caseSensitive?void 0:n=>n.toLowerCase(),i.wholeWord?CS(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function CS(i,t){return(e,r,n,s)=>((s>e||s+n.length=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=er(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function ir(i,t,e,r){return new qo(t.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?AS(t.charCategorizer(t.selection.main.head)):void 0},e,r)}function Io(i,t){return i.slice(at(i,t,!1),t)}function No(i,t){return i.slice(t,at(i,t))}function AS(i){return(t,e,r)=>!r[0].length||(i(Io(r.input,r.index))!=F.Word||i(No(r.input,r.index))!=F.Word)&&(i(No(r.input,r.index+r[0].length))!=F.Word||i(Io(r.input,r.index+r[0].length))!=F.Word)}var rf=class extends Wo{nextMatch(t,e,r){let n=ir(this.spec,t,r,t.doc.length).next();return n.done&&(n=ir(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,r){for(let n=1;;n++){let s=Math.max(e,r-n*1e4),o=ir(this.spec,t,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==e||l.from>s+10))return l;if(s==e)return null}}prevMatch(t,e,r){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\\$([$&\\d+])/g,(e,r)=>r==\"$\"?\"$\":r==\"&\"?t.match[0]:r!=\"0\"&&+r=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=ir(this.spec,t,Math.max(0,e-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},gn=M.define(),lf=M.define(),Je=it.define({create(i){return new mn(nf(i).create(),null)},update(i,t){for(let e of t.effects)e.is(gn)?i=new mn(e.value.create(),i.panel):e.is(lf)&&(i=new mn(i.query,e.value?af:null));return i},provide:i=>fi.from(i,t=>t.panel)});var mn=class{constructor(t,e){this.query=t,this.panel=e}},QS=R.mark({class:\"cm-searchMatch\"}),RS=R.mark({class:\"cm-searchMatch cm-searchMatch-selected\"}),MS=ft.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Je))}update(i){let t=i.state.field(Je);(t!=i.startState.field(Je)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:i,panel:t}){if(!t||!i.spec.valid)return R.none;let{view:e}=this,r=new Ee;for(let n=0,s=e.visibleRanges,o=s.length;ns[n+1].from-2*250;)a=s[++n].to;i.highlight(e.state,l,a,(h,f)=>{let c=e.state.selection.ranges.some(u=>u.from==h&&u.to==f);r.add(h,f,c?RS:QS)})}return r.finish()}},{decorations:i=>i.decorations});function On(i){return t=>{let e=t.state.field(Je,!1);return e&&e.query.spec.valid?i(t,e):ng(t)}}var Yo=On((i,{query:t})=>{let{to:e}=i.state.selection.main,r=t.nextMatch(i.state,e,e);if(!r)return!1;let n=b.single(r.from,r.to),s=i.state.facet(rr);return i.dispatch({selection:n,effects:[hf(i,r),s.scrollToMatch(n.main,i)],userEvent:\"select.search\"}),rg(i),!0}),zo=On((i,{query:t})=>{let{state:e}=i,{from:r}=e.selection.main,n=t.prevMatch(e,r,r);if(!n)return!1;let s=b.single(n.from,n.to),o=i.state.facet(rr);return i.dispatch({selection:s,effects:[hf(i,n),o.scrollToMatch(s.main,i)],userEvent:\"select.search\"}),rg(i),!0}),ES=On((i,{query:t})=>{let e=t.matchAll(i.state,1e3);return!e||!e.length?!1:(i.dispatch({selection:b.create(e.map(r=>b.range(r.from,r.to))),userEvent:\"select.search.matches\"}),!0)}),$S=({state:i,dispatch:t})=>{let e=i.selection;if(e.ranges.length>1||e.main.empty)return!1;let{from:r,to:n}=e.main,s=[],o=0;for(let l=new ti(i.doc,i.sliceDoc(r,n));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(b.range(l.value.from,l.value.to))}return t(i.update({selection:b.create(s,o),userEvent:\"select.search.matches\"})),!0},Km=On((i,{query:t})=>{let{state:e}=i,{from:r,to:n}=e.selection.main;if(e.readOnly)return!1;let s=t.nextMatch(e,r,r);if(!s)return!1;let o=[],l,a,h=[];if(s.from==r&&s.to==n&&(a=e.toText(t.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(e,s.from,s.to),h.push(T.announce.of(e.phrase(\"replaced match on line $\",e.doc.lineAt(r).number)+\".\"))),s){let f=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=b.single(s.from-f,s.to-f),h.push(hf(i,s)),h.push(e.facet(rr).scrollToMatch(l.main,i))}return i.dispatch({changes:o,selection:l,effects:h,userEvent:\"input.replace\"}),!0}),qS=On((i,{query:t})=>{if(i.state.readOnly)return!1;let e=t.matchAll(i.state,1e9).map(n=>{let{from:s,to:o}=n;return{from:s,to:o,insert:t.getReplacement(n)}});if(!e.length)return!1;let r=i.state.phrase(\"replaced $ matches\",e.length)+\".\";return i.dispatch({changes:e,effects:T.announce.of(r),userEvent:\"input.replace.all\"}),!0});function af(i){return i.state.facet(rr).createPanel(i)}function nf(i,t){var e,r,n,s,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?\"\":i.sliceDoc(l.from,l.to);if(t&&!a)return t;let h=i.facet(rr);return new Vo({search:((e=t?.literal)!==null&&e!==void 0?e:h.literal)?a:a.replace(/\\n/g,\"\\\\n\"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(n=t?.literal)!==null&&n!==void 0?n:h.literal,regexp:(s=t?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=t?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function ig(i){let t=ci(i,af);return t&&t.dom.querySelector(\"[main-field]\")}function rg(i){let t=ig(i);t&&t==i.root.activeElement&&t.select()}var ng=i=>{let t=i.state.field(Je,!1);if(t&&t.panel){let e=ig(i);if(e&&e!=i.root.activeElement){let r=nf(i.state,t.query.spec);r.valid&&i.dispatch({effects:gn.of(r)}),e.focus(),e.select()}}else i.dispatch({effects:[lf.of(!0),t?gn.of(nf(i.state,t.query.spec)):M.appendConfig.of(BS)]});return!0},sg=i=>{let t=i.state.field(Je,!1);if(!t||!t.panel)return!1;let e=ci(i,af);return e&&e.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:lf.of(!1)}),!0},Zo=[{key:\"Mod-f\",run:ng,scope:\"editor search-panel\"},{key:\"F3\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Mod-g\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Escape\",run:sg,scope:\"editor search-panel\"},{key:\"Mod-Shift-l\",run:$S},{key:\"Mod-Alt-g\",run:gS},{key:\"Mod-d\",run:PS,preventDefault:!0}],sf=class{constructor(t){this.view=t;let e=this.query=t.state.field(Je).query.spec;this.commit=this.commit.bind(this),this.searchField=z(\"input\",{value:e.search,placeholder:zt(t,\"Find\"),\"aria-label\":zt(t,\"Find\"),class:\"cm-textfield\",name:\"search\",form:\"\",\"main-field\":\"true\",onchange:this.commit,onkeyup:this.commit}),this.replaceField=z(\"input\",{value:e.replace,placeholder:zt(t,\"Replace\"),\"aria-label\":zt(t,\"Replace\"),class:\"cm-textfield\",name:\"replace\",form:\"\",onchange:this.commit,onkeyup:this.commit}),this.caseField=z(\"input\",{type:\"checkbox\",name:\"case\",form:\"\",checked:e.caseSensitive,onchange:this.commit}),this.reField=z(\"input\",{type:\"checkbox\",name:\"re\",form:\"\",checked:e.regexp,onchange:this.commit}),this.wordField=z(\"input\",{type:\"checkbox\",name:\"word\",form:\"\",checked:e.wholeWord,onchange:this.commit});function r(n,s,o){return z(\"button\",{class:\"cm-button\",name:n,onclick:s,type:\"button\"},o)}this.dom=z(\"div\",{onkeydown:n=>this.keydown(n),class:\"cm-search\"},[this.searchField,r(\"next\",()=>Yo(t),[zt(t,\"next\")]),r(\"prev\",()=>zo(t),[zt(t,\"previous\")]),r(\"select\",()=>ES(t),[zt(t,\"all\")]),z(\"label\",null,[this.caseField,zt(t,\"match case\")]),z(\"label\",null,[this.reField,zt(t,\"regexp\")]),z(\"label\",null,[this.wordField,zt(t,\"by word\")]),...t.state.readOnly?[]:[z(\"br\"),this.replaceField,r(\"replace\",()=>Km(t),[zt(t,\"replace\")]),r(\"replaceAll\",()=>qS(t),[zt(t,\"replace all\")])],z(\"button\",{name:\"close\",onclick:()=>sg(t),\"aria-label\":zt(t,\"close\"),type:\"button\"},[\"\\xD7\"])])}commit(){let t=new Vo({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:gn.of(t)}))}keydown(t){qd(this.view,t,\"search-panel\")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?zo:Yo)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Km(this.view))}update(t){for(let e of t.transactions)for(let r of e.effects)r.is(gn)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(rr).top}};function zt(i,t){return i.state.phrase(t)}var Eo=30,$o=/[\\s\\.,:;?!]/;function hf(i,{from:t,to:e}){let r=i.state.doc.lineAt(t),n=i.state.doc.lineAt(e).to,s=Math.max(r.from,t-Eo),o=Math.min(n,e+Eo),l=i.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;al.length-Eo;a--)if(!$o.test(l[a-1])&&$o.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${i.state.phrase(\"current match\")}. ${l} ${i.state.phrase(\"on line\")} ${r.number}.`)}var DS=T.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\"}}),BS=[Je,ie.low(MS),DS];var fc={};uO(fc,{VERSION:()=>Fo,after:()=>_f,all:()=>cl,allKeys:()=>he,any:()=>ul,assign:()=>ki,before:()=>qn,bind:()=>sl,bindAll:()=>Eg,chain:()=>Wf,chunk:()=>hc,clone:()=>Rf,collect:()=>Dt,compact:()=>nc,compose:()=>Ff,constant:()=>wn,contains:()=>Qt,countBy:()=>Lg,create:()=>Qf,debounce:()=>zf,default:()=>zg,defaults:()=>il,defer:()=>ll,delay:()=>ol,detect:()=>ur,difference:()=>pl,drop:()=>Ri,each:()=>xt,escape:()=>Ag,every:()=>cl,extend:()=>el,extendOwn:()=>ki,filter:()=>te,find:()=>ur,findIndex:()=>cr,findKey:()=>Dn,findLastIndex:()=>al,findWhere:()=>Gf,first:()=>zn,flatten:()=>sc,foldl:()=>fl,foldr:()=>Hf,forEach:()=>xt,functions:()=>ar,get:()=>Qn,groupBy:()=>Bg,has:()=>Ef,head:()=>zn,identity:()=>Pi,include:()=>Qt,includes:()=>Qt,indexBy:()=>Xg,indexOf:()=>hl,initial:()=>Yn,inject:()=>fl,intersection:()=>oc,invert:()=>Cn,invoke:()=>Dg,isArguments:()=>or,isArray:()=>$t,isArrayBuffer:()=>jo,isBoolean:()=>bn,isDataView:()=>Si,isDate:()=>dg,isElement:()=>xf,isEmpty:()=>wf,isEqual:()=>kf,isError:()=>mg,isFinite:()=>Sf,isFunction:()=>K,isMap:()=>kg,isMatch:()=>Pn,isNaN:()=>Sn,isNull:()=>Of,isNumber:()=>Ho,isObject:()=>At,isRegExp:()=>pg,isSet:()=>Pg,isString:()=>nr,isSymbol:()=>Uo,isTypedArray:()=>Jo,isUndefined:()=>yn,isWeakMap:()=>Tg,isWeakSet:()=>Cg,iteratee:()=>hr,keys:()=>X,last:()=>rc,lastIndexOf:()=>qg,map:()=>Dt,mapObject:()=>$f,matcher:()=>Qe,matches:()=>Qe,max:()=>Wn,memoize:()=>Nf,methods:()=>ar,min:()=>Kf,mixin:()=>Zn,negate:()=>Ai,noop:()=>Mn,now:()=>ei,object:()=>lc,omit:()=>Wg,once:()=>$g,pairs:()=>Af,partial:()=>ii,partition:()=>Vg,pick:()=>dl,pluck:()=>Qi,property:()=>Ci,propertyOf:()=>qf,random:()=>fr,range:()=>ac,reduce:()=>fl,reduceRight:()=>Hf,reject:()=>Uf,rest:()=>Ri,restArguments:()=>H,result:()=>Lf,sample:()=>Nn,select:()=>te,shuffle:()=>Jf,size:()=>ec,some:()=>ul,sortBy:()=>tc,sortedIndex:()=>Xn,tail:()=>Ri,take:()=>zn,tap:()=>Mf,template:()=>Xf,templateSettings:()=>Mg,throttle:()=>Yf,times:()=>Df,toArray:()=>In,toPath:()=>rl,transpose:()=>pr,unescape:()=>Rg,union:()=>Ng,uniq:()=>dr,unique:()=>dr,uniqueId:()=>Vf,unzip:()=>pr,values:()=>Zt,where:()=>jf,without:()=>Ig,wrap:()=>Zf,zip:()=>Yg});var Fo=\"1.13.6\",ff=typeof self==\"object\"&&self.self===self&&self||typeof global==\"object\"&&global.global===global&&global||Function(\"return this\")()||{},xn=Array.prototype,_o=Object.prototype,cf=typeof Symbol<\"u\"?Symbol.prototype:null,og=xn.push,Ae=xn.slice,Xe=_o.toString,lg=_o.hasOwnProperty,uf=typeof ArrayBuffer<\"u\",ag=typeof DataView<\"u\",hg=Array.isArray,df=Object.keys,pf=Object.create,mf=uf&&ArrayBuffer.isView,fg=isNaN,cg=isFinite,Go=!{toString:null}.propertyIsEnumerable(\"toString\"),gf=[\"valueOf\",\"isPrototypeOf\",\"toString\",\"propertyIsEnumerable\",\"hasOwnProperty\",\"toLocaleString\"],ug=Math.pow(2,53)-1;function H(i,t){return t=t==null?i.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),n=0;n=0&&e<=ug}}function kn(i){return function(t){return t?.[i]}}var wi=kn(\"byteLength\");var Og=vn(wi);var WS=/\\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\\]/;function IS(i){return mf?mf(i)&&!Si(i):Og(i)&&WS.test(Xe.call(i))}var Jo=uf?IS:wn(!1);var J=kn(\"length\");function NS(i){for(var t={},e=i.length,r=0;r\":\">\",'\"':\""\",\"'\":\"'\",\"`\":\"`\"};var Ag=En(nl);var Qg=Cn(nl);var Rg=En(Qg);var Mg=$.templateSettings={evaluate:/<%([\\s\\S]+?)%>/g,interpolate:/<%=([\\s\\S]+?)%>/g,escape:/<%-([\\s\\S]+?)%>/g};var Bf=/(.)^/,zS={\"'\":\"'\",\"\\\\\":\"\\\\\",\"\\r\":\"r\",\"\\n\":\"n\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},ZS=/\\\\|'|\\r|\\n|\\u2028|\\u2029/g;function FS(i){return\"\\\\\"+zS[i]}var _S=/^\\s*(\\w|\\$)+\\s*$/;function Xf(i,t,e){!t&&e&&(t=e),t=il({},t,$.templateSettings);var r=RegExp([(t.escape||Bf).source,(t.interpolate||Bf).source,(t.evaluate||Bf).source].join(\"|\")+\"|$\",\"g\"),n=0,s=\"__p+='\";i.replace(r,function(h,f,c,u,d){return s+=i.slice(n,d).replace(ZS,FS),n=d+h.length,f?s+=`'+\n((__t=(`+f+`))==null?'':_.escape(__t))+\n'`:c?s+=`'+\n((__t=(`+c+`))==null?'':__t)+\n'`:u&&(s+=`';\n`+u+`\n__p+='`),h}),s+=`';\n`;var o=t.variable;if(o){if(!_S.test(o))throw new Error(\"variable is not a bare identifier: \"+o)}else s=`with(obj||{}){\n`+s+`}\n`,o=\"obj\";s=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n`+s+`return __p;\n`;var l;try{l=new Function(o,\"_\",s)}catch(h){throw h.source=s,h}var a=function(h){return l.call(this,h,$)};return a.source=\"function(\"+o+`){\n`+s+\"}\",a}function Lf(i,t,e){t=fe(t);var r=t.length;if(!r)return K(e)?e.call(i):e;for(var n=0;n1)qt(l,t-1,e,r),n=r.length;else for(var a=0,h=l.length;at?(r&&(clearTimeout(r),r=null),l=f,o=i.apply(n,s),r||(n=s=null)):!r&&e.trailing!==!1&&(r=setTimeout(a,c)),o};return h.cancel=function(){clearTimeout(r),l=0,r=n=s=null},h}function zf(i,t,e){var r,n,s,o,l,a=function(){var f=ei()-n;t>f?r=setTimeout(a,t-f):(r=null,e||(o=i.apply(l,s)),r||(s=l=null))},h=H(function(f){return l=this,s=f,n=ei(),r||(r=setTimeout(a,t),e&&(o=i.apply(l,s))),o});return h.cancel=function(){clearTimeout(r),r=s=l=null},h}function Zf(i,t){return ii(t,i)}function Ai(i){return function(){return!i.apply(this,arguments)}}function Ff(){var i=arguments,t=i.length-1;return function(){for(var e=t,r=i[t].apply(this,arguments);e--;)r=i[e].call(this,r);return r}}function _f(i,t){return function(){if(--i<1)return t.apply(this,arguments)}}function qn(i,t){var e;return function(){return--i>0&&(e=t.apply(this,arguments)),i<=1&&(t=null),e}}var $g=ii(qn,2);function Dn(i,t,e){t=Z(t,e);for(var r=X(i),n,s=0,o=r.length;s0?0:n-1;s>=0&&s0?o=s>=0?s:Math.max(s+l,o):l=s>=0?Math.min(s+1,l):s+l+1;else if(e&&s&&l)return s=e(r,n),r[s]===n?s:-1;if(n!==n)return s=t(Ae.call(r,o,l),Sn),s>=0?s+o:-1;for(s=i>0?o:l-1;s>=0&&s0?0:l-1;for(s||(n=e[o?o[a]:a],a+=i);a>=0&&a=3;return t(e,ce(r,s,4),n,o)}}var fl=Vn(1);var Hf=Vn(-1);function te(i,t,e){var r=[];return t=Z(t,e),xt(i,function(n,s,o){t(n,s,o)&&r.push(n)}),r}function Uf(i,t,e){return te(i,Ai(Z(t)),e)}function cl(i,t,e){t=Z(t,e);for(var r=!tt(i)&&X(i),n=(r||i).length,s=0;s=0}var Dg=H(function(i,t,e){var r,n;return K(t)?n=t:(t=fe(t),r=t.slice(0,-1),t=t[t.length-1]),Dt(i,function(s){var o=n;if(!o){if(r&&r.length&&(s=Ti(s,r)),s==null)return;o=s[t]}return o==null?o:o.apply(s,e)})});function Qi(i,t){return Dt(i,Ci(t))}function jf(i,t){return te(i,Qe(t))}function Wn(i,t,e){var r=-1/0,n=-1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;lr&&(r=s)}else t=Z(t,e),xt(i,function(h,f,c){o=t(h,f,c),(o>n||o===-1/0&&r===-1/0)&&(r=h,n=o)});return r}function Kf(i,t,e){var r=1/0,n=1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;ll||o===void 0)return 1;if(o1&&(r=ce(r,t[1])),t=he(i)):(r=ic,t=qt(t,!1,!1),i=Object(i));for(var n=0,s=t.length;n1&&(r=t[1])):(t=Dt(qt(t,!1,!1),String),e=function(n,s){return!Qt(t,s)}),dl(i,e,r)});function Yn(i,t,e){return Ae.call(i,0,Math.max(0,i.length-(t==null||e?1:t)))}function zn(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[0]:Yn(i,i.length-t)}function Ri(i,t,e){return Ae.call(i,t==null||e?1:t)}function rc(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[i.length-1]:Ri(i,Math.max(0,i.length-t))}function nc(i){return te(i,Boolean)}function sc(i,t){return qt(i,t,!1)}var pl=H(function(i,t){return t=qt(t,!0,!0),te(i,function(e){return!Qt(t,e)})});var Ig=H(function(i,t){return pl(i,t)});function dr(i,t,e,r){bn(t)||(r=e,e=t,t=!1),e!=null&&(e=Z(e,r));for(var n=[],s=[],o=0,l=J(i);o ul > li[aria-selected]\":{backgroundColor:dc,color:gr}}},{dark:!0}),sw=ve.define([{tag:p.keyword,color:Re},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Fg},{tag:[p.variableName],color:Mi},{tag:[p.function(p.variableName)],color:Mi},{tag:[p.labelName],color:JS},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:Re},{tag:[p.definition(p.name),p.separator],color:ml},{tag:[p.brace],color:Mi},{tag:[p.annotation],color:Gg},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:uc},{tag:[p.typeName,p.className],color:cc},{tag:[p.operator,p.operatorKeyword],color:ml},{tag:[p.tagName],color:uc},{tag:[p.squareBracket],color:tw},{tag:[p.angleBracket],color:_g},{tag:[p.attributeName],color:cc},{tag:[p.regexp],color:Re},{tag:[p.quote],color:uc},{tag:[p.string],color:ml},{tag:p.link,color:ml,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Mi},{tag:[p.meta],color:Fg},{tag:[p.monospace],color:Fn,fontStyle:\"italic\"},{tag:[p.comment],color:gr,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:Re},{tag:p.emphasis,fontStyle:\"italic\",color:Re},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:Re},{tag:p.special(p.heading1),fontWeight:\"bold\",color:Re},{tag:p.heading1,fontWeight:\"bold\",color:Re},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Re},{tag:[p.heading5,p.heading6],color:Re},{tag:[p.atom,p.bool,p.special(p.variableName)],color:_g},{tag:[p.processingInstruction,p.inserted],color:Mi},{tag:[p.contentSeparator],color:cc},{tag:p.invalid,color:jg,borderBottom:`1px dotted ${Gg}`}]),Kg=[nw,Te(sw)];var Jg=\"#657b83\",wc=\"#586e75\",gc=\"#073642\",Gn=\"#002b36\",iO=\"#93a1a1\",ow=\"#fdf6e3\",gl=\"#dc322f\",lw=\"#cb4b16\",_n=\"#b58900\",Oc=\"#859900\",xc=\"#2aa198\",yc=\"#268bd2\",aw=\"#6c71c4\",Ol=\"#d33682\",tO=\"#d30102\",vc=\"#dfd9c8\",bc=vc,hw=ow,Sc=wc,fw=vc,eO=wc,cw=T.theme({\"&\":{color:Jg,backgroundColor:hw},\".cm-content\":{caretColor:eO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:eO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:fw},\".cm-panels\":{backgroundColor:vc,color:Gn},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:\"1px solid #457dff\"},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:\"#6199ff2f\"},\".cm-activeLine\":{backgroundColor:bc},\".cm-selectionMatch\":{backgroundColor:\"#aafe661a\"},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${iO}`},\".cm-gutters\":{backgroundColor:\"#00000010\",color:Jg,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:bc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Sc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Sc,borderBottomColor:Sc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:bc,color:Gn}}},{dark:!1}),uw=ve.define([{tag:p.keyword,color:Oc},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:xc},{tag:[p.variableName],color:yc},{tag:[p.function(p.variableName)],color:yc},{tag:[p.labelName],color:Ol},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:_n},{tag:[p.definition(p.name),p.separator],color:xc},{tag:[p.brace],color:Ol},{tag:[p.annotation],color:tO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:Ol},{tag:[p.typeName,p.className],color:lw},{tag:[p.operator,p.operatorKeyword],color:aw},{tag:[p.tagName],color:yc},{tag:[p.squareBracket],color:gl},{tag:[p.angleBracket],color:gc},{tag:[p.attributeName],color:iO},{tag:[p.regexp],color:tO},{tag:[p.quote],color:Oc},{tag:[p.string],color:_n},{tag:p.link,color:xc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:_n},{tag:[p.meta],color:gl},{tag:[p.comment],color:gc,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:wc},{tag:p.emphasis,fontStyle:\"italic\",color:Oc},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:_n},{tag:p.heading1,fontWeight:\"bold\",color:Gn},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Gn},{tag:[p.heading5,p.heading6],color:Gn},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Ol},{tag:[p.processingInstruction,p.inserted,p.contentSeparator],color:gl},{tag:[p.contentSeparator],color:_n},{tag:p.invalid,color:gc,borderBottom:`1px dotted ${gl}`}]),rO=[cw,Te(uw)];var nO=\"#2e3440\",Qc=\"#3b4252\",sO=\"#434c5e\",xl=\"#4c566a\",oO=\"#e5e9f0\",Ac=\"#eceff4\",kc=\"#8fbcbb\",lO=\"#88c0d0\",dw=\"#81a1c1\",ue=\"#5e81ac\",pw=\"#bf616a\",Or=\"#d08770\",Tc=\"#ebcb8b\",aO=\"#a3be8c\",mw=\"#b48ead\",hO=\"#d30102\",Rc=Ac,Pc=Rc,gw=\"#ffffff\",Cc=Qc,Ow=Rc,fO=Qc,xw=T.theme({\"&\":{color:nO,backgroundColor:gw},\".cm-content\":{caretColor:fO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:fO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:Ow},\".cm-panels\":{backgroundColor:Rc,color:xl},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:`1px solid ${xl}`},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:oO},\".cm-activeLine\":{backgroundColor:Pc},\".cm-selectionMatch\":{backgroundColor:oO},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${xl}`},\"&.cm-focused .cm-matchingBracket\":{backgroundColor:Ac},\".cm-gutters\":{backgroundColor:Ac,color:nO,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:Pc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Cc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Cc,borderBottomColor:Cc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:Pc,color:xl}}},{dark:!1}),yw=ve.define([{tag:p.keyword,color:ue},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Or},{tag:[p.variableName],color:Or},{tag:[p.function(p.variableName)],color:ue},{tag:[p.labelName],color:dw},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:ue},{tag:[p.definition(p.name),p.separator],color:aO},{tag:[p.brace],color:kc},{tag:[p.annotation],color:hO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:lO},{tag:[p.typeName,p.className],color:Tc},{tag:[p.operator,p.operatorKeyword],color:aO},{tag:[p.tagName],color:mw},{tag:[p.squareBracket],color:pw},{tag:[p.angleBracket],color:Or},{tag:[p.attributeName],color:Tc},{tag:[p.regexp],color:ue},{tag:[p.quote],color:Qc},{tag:[p.string],color:Or},{tag:p.link,color:kc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Or},{tag:[p.meta],color:lO},{tag:[p.comment],color:sO,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:ue},{tag:p.emphasis,fontStyle:\"italic\",color:ue},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:ue},{tag:p.special(p.heading1),fontWeight:\"bold\",color:ue},{tag:p.heading1,fontWeight:\"bold\",color:ue},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:ue},{tag:[p.heading5,p.heading6],color:ue},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Or},{tag:[p.processingInstruction,p.inserted],color:kc},{tag:[p.contentSeparator],color:Tc},{tag:p.invalid,color:sO,borderBottom:`1px dotted ${hO}`}]),Hn=[xw,Te(yw)];var hq={initialize({model:i}){},render({model:i,el:t}){var e=i.get(\"widget_instance_count_trait\");i.attributes={function_body_id:e};let r=\"\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "Please return as string the answer to this riddle:\n\nWhat has wings but in the air it not swings.\nI looked to the north, but it was not worth.\nWhat I am looking for?", - "function_body": "return \"\"\n", - "function_name": "riddle", - "function_parameters": "", - "layout": "IPY_MODEL_dec3a4358a89485390065863dbc3cff9", - "name": "", - "widget_instance_count_trait": "3" - } - }, - "c841f0178b08416db75c78a926d433cb": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_f2c6dcb313d54d8db9b39bc7b4dad23a", - "IPY_MODEL_4580593cf2ea41dc99f75f7de2e8ddd8" - ], - "layout": "IPY_MODEL_14a5c0affc4c44608d28d251b9a5d83c" - } - }, - "cb3d77260a544aa68299e09578d1394a": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-check-cue-box" - ], - "children": [ - "IPY_MODEL_ef6a8d3adef34264a35bc93bed8ebf56" - ], - "layout": "IPY_MODEL_8f56636a69404858a0d3bafd7e3efe8c" - } - }, - "cb7fcdad52f4419bbd65471779179eb4": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "cd3d2676db144d46b05bf0aca5f7ac61": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "ce893ef3da2549969b84af55600cf08d": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLStyleModel", - "state": { - "description_width": "", - "font_size": null, - "text_color": null - } - }, - "d1a60bd51f8d489f91843d472de4301f": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "d26d85bf19ab45379cd0fec8bc618bf5": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "d2f739cc8d7845baa1b885e6ba99e971": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "d3b0e468f0454f77bf8fe1ea953cdded": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "d44b33a5a2884e98921ad5b8747b9bd8": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "d5332f700374460f82d9609cb87a3cb5": { - "model_module": "anywidget", - "model_module_version": "~0.9.*", - "model_name": "AnyModel", - "state": { - "_anywidget_id": "scwidgets.code._widget_code_input.CodeInput", - "_css": ".forced-indent{width:4em}.CodeMirror{border:1px solid #fff;height:auto}.CodeMirror.widget-code-input-signature{border-bottom:0px}.CodeMirror.widget-code-input-docstring,.CodeMirror.widget-code-input-body{border-top:0px}\n", - "_esm": "var cO=Object.defineProperty;var uO=(i,t)=>{for(var e in t)cO(i,e,{get:t[e],enumerable:!0})};var V=class i{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,r){[t,e]=Li(this,t,e);let n=[];return this.decompose(0,t,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(e,this.length,n,1),qi.from(n,this.length-(e-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Li(this,t,e);let r=[];return this.decompose(t,e,r,0),qi.from(r,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),n=new oi(this),s=new oi(t);for(let o=e,l=e;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=r)return!0}}iter(t=1){return new oi(this,t)}iterRange(t,e=this.length){return new ts(this,t,e)}iterLines(t,e){let r;if(t==null)r=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;r=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new es(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError(\"A document must have at least one line\");return t.length==1&&!t[0]?i.empty:t.length<=32?new Xt(t):qi.from(Xt.split(t,[]))}},Xt=class i extends V{constructor(t,e=dO(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((e?r:l)>=t)return new bl(n,l,r,o);n=l+1,r++}}decompose(t,e,r,n){let s=t<=0&&e>=this.length?this:new i(Ec(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=r.pop(),l=Jn(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new i(l,o.length+s.length));else{let a=l.length>>1;r.push(new i(l.slice(0,a)),new i(l.slice(a)))}}else r.push(s)}replace(t,e,r){if(!(r instanceof i))return super.replace(t,e,r);[t,e]=Li(this,t,e);let n=Jn(this.text,Jn(r.text,Ec(this.text,0,t)),e),s=this.length+r.length-(e-t);return n.length<=32?new i(n,s):qi.from(i.split(n,[]),s)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;s<=e&&ot&&o&&(n+=r),ts&&(n+=l.slice(Math.max(0,t-s),e-s)),s=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let r=[],n=-1;for(let s of t)r.push(s),n+=s.length+1,r.length==32&&(e.push(new i(r,n)),r=[],n=-1);return n>-1&&e.push(new i(r,n)),e}},qi=class i extends V{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=r+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,r,n);n=l+1,r=a+1}}decompose(t,e,r,n){for(let s=0,o=0;o<=e&&s=o){let h=n&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?r.push(l):l.decompose(t-o,e-o,r,h)}o=a+1}}replace(t,e,r){if([t,e]=Li(this,t,e),r.lines=s&&e<=l){let a=o.replace(t-s,e-s,r),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new i(f,this.length-(e-t)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(t,e,r)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;st&&s&&(n+=r),to&&(n+=l.sliceString(t-o,e-o,r)),o=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let r=0,[n,s,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,s+=e){if(n==o||s==l)return r;let a=this.children[n],h=t.children[s];if(a!=h)return r+a.scanIdentical(h,e);r+=a.length+1}}static from(t,e=t.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let d of t)r+=d.lines;if(r<32){let d=[];for(let m of t)m.flatten(d);return new Xt(d,e)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let m;if(d.lines>s&&d instanceof i)for(let O of d.children)c(O);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Xt&&a&&(m=f[f.length-1])instanceof Xt&&d.lines+m.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new Xt(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:i.from(f,h)),h=-1,a=f.length=0)}for(let d of t)c(d);return u(),l.length==1?l[0]:new i(l,e)}};V.empty=new Xt([\"\"],0);function dO(i){let t=-1;for(let e of i)t+=e.length+1;return t}function Jn(i,t,e=0,r=1e9){for(let n=0,s=0,o=!0;s=e&&(a>r&&(l=l.slice(0,r-n)),n0?1:(t instanceof Xt?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,l=n instanceof Xt?n.text.length:n.children.length;if(o==(e>0?l:0)){if(r==0)return this.done=!0,this.value=\"\",this;e>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(e>0?0:1)){if(this.offsets[r]+=e,t==0)return this.lineBreak=!0,this.value=`\n`,this;t--}else if(n instanceof Xt){let a=n.text[o+(e<0?-1:0)];if(this.offsets[r]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=n.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[r]+=e):(e<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof Xt?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},ts=class{constructor(t,e,r){this.value=\"\",this.done=!1,this.cursor=new oi(t,e>r?-1:1),this.pos=e>r?t.length:0,this.from=Math.min(e,r),this.to=Math.max(e,r)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value=\"\",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let r=e<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=r?n:e<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=\"\"}},es=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value=\"\",this.done=!1}next(t=0){let{done:e,lineBreak:r,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value=\"\",this.afterBreak=!1):e?(this.done=!0,this.value=\"\"):r?this.afterBreak?this.value=\"\":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<\"u\"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},oi.prototype[Symbol.iterator]=ts.prototype[Symbol.iterator]=es.prototype[Symbol.iterator]=function(){return this});var bl=class{constructor(t,e,r,n){this.from=t,this.to=e,this.number=r,this.text=n}get length(){return this.to-this.from}};function Li(i,t,e){return t=Math.max(0,Math.min(i.length,t)),[t,Math.max(t,Math.min(i.length,e))]}var Di=\"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(i=>i?parseInt(i,36):1);for(let i=1;ii)return Di[t-1]<=i;return!1}function $c(i){return i>=127462&&i<=127487}var qc=8205;function at(i,t,e=!0,r=!0){return(e?Wc:mO)(i,t,r)}function Wc(i,t,e){if(t==i.length)return t;t&&Ic(i.charCodeAt(t))&&Nc(i.charCodeAt(t-1))&&t--;let r=dt(i,t);for(t+=wt(r);t=0&&$c(dt(i,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function mO(i,t,e){for(;t>0;){let r=Wc(i,t-2,e);if(r=56320&&i<57344}function Nc(i){return i>=55296&&i<56320}function dt(i,t){let e=i.charCodeAt(t);if(!Nc(e)||t+1==i.length)return e;let r=i.charCodeAt(t+1);return Ic(r)?(e-55296<<10)+(r-56320)+65536:e}function vr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function wt(i){return i<65536?1:2}var Sl=/\\r\\n?|\\n/,ut=function(i){return i[i.Simple=0]=\"Simple\",i[i.TrackDel=1]=\"TrackDel\",i[i.TrackBefore=2]=\"TrackBefore\",i[i.TrackAfter=3]=\"TrackAfter\",i}(ut||(ut={})),Me=class i{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=l}else{if(r!=ut.Simple&&h>=t&&(r==ut.TrackDel&&nt||r==ut.TrackBefore&&nt))return null;if(h>t||h==t&&e<0&&!l)return t==n||e<0?s:s+a;s+=a}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let r=0,n=0;r=0&&n<=e&&l>=t)return ne?\"cover\":!0;n=l}return!1}toString(){let t=\"\";for(let e=0;e=0?\":\"+n:\"\")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=\"number\"))throw new RangeError(\"Invalid JSON representation of ChangeDesc\");return new i(t)}static create(t){return new i(t)}},vt=class i extends Me{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError(\"Applying change set to a document with the wrong length\");return wl(this,(e,r,n,s,o)=>t=t.replace(n,n+(r-e),o),!1),t}mapDesc(t,e=!1){return vl(this,t,e,!0)}invert(t){let e=this.sections.slice(),r=[];for(let n=0,s=0;n=0){e[n]=l,e[n+1]=o;let a=n>>1;for(;r.length0&&Ve(r,e,s.text),s.forward(f),l+=f}let h=t[o++];for(;l>1].toJSON()))}return t}static of(t,e,r){let n=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;ou||c<0||u>e)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${e})`);let m=d?typeof d==\"string\"?V.of(d.split(r||Sl)):d:V.empty,O=m.length;if(c==u&&O==0)return;co&&yt(n,c-o,-1),yt(n,u-c,O),Ve(s,n,m),o=u}}return h(t),a(!l),l}static empty(t){return new i(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError(\"Invalid JSON representation of ChangeSet\");let e=[],r=[];for(let n=0;nl&&typeof o!=\"string\"))throw new RangeError(\"Invalid JSON representation of ChangeSet\");if(s.length==1)e.push(s[0],0);else{for(;r.length=0&&e<=0&&e==i[n+1]?i[n]+=t:t==0&&i[n]==0?i[n+1]+=e:r?(i[n]+=t,i[n+1]+=e):i.push(t,e)}function Ve(i,t,e){if(e.length==0)return;let r=t.length-2>>1;if(r>1])),!(e||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];t(n,h,s,f,c),n=h,s=f}}}function vl(i,t,e,r=!1){let n=[],s=r?[]:null,o=new li(i),l=new li(t);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);yt(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>h),s.forward2(a),o.forward(a)}}}}var li=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?V.empty:t[e]}textBit(t){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length&&!t?V.empty:e[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},$i=class i{constructor(t,e,r){this.from=t,this.to=e,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let r,n;return this.empty?r=n=t.mapPos(this.from,e):(r=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return b.range(t,e);let r=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return b.range(this.anchor,r)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!=\"number\"||typeof t.head!=\"number\")throw new RangeError(\"Invalid JSON representation for SelectionRange\");return b.range(t.anchor,t.head)}static create(t,e,r){return new i(t,e,r)}},b=class i{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:i.create(this.ranges.map(r=>r.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;rt.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=\"number\"||t.main>=t.ranges.length)throw new RangeError(\"Invalid JSON representation for EditorSelection\");return new i(t.ranges.map(e=>$i.fromJSON(e)),t.main)}static single(t,e=t){return new i([i.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError(\"A selection needs at least one range\");for(let r=0,n=0;nt?8:0)|s)}static normalized(t,e=0){let r=t[e];t.sort((n,s)=>n.from-s.from),e=t.indexOf(r);for(let n=1;ns.head?i.range(a,l):i.range(l,a))}}return new i(t,e)}};function zc(i,t){for(let e of i.ranges)if(e.to>t)throw new RangeError(\"Selection points outside of document\")}var $l=0,A=class i{constructor(t,e,r,n,s){this.combine=t,this.compareInput=e,this.compare=r,this.isStatic=n,this.id=$l++,this.default=t([]),this.extensions=typeof s==\"function\"?s(this):s}get reader(){return this}static define(t={}){return new i(t.combine||(e=>e),t.compareInput||((e,r)=>e===r),t.compare||(t.combine?(e,r)=>e===r:ql),!!t.static,t.enables)}of(t){return new Bi([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,2,e)}from(t,e){return e||(e=r=>r),this.compute([t],r=>e(r.field(t)))}};function ql(i,t){return i==t||i.length==t.length&&i.every((e,r)=>e===t[r])}var Bi=class{constructor(t,e,r,n){this.dependencies=t,this.facet=e,this.type=r,this.value=n,this.id=$l++}dynamicSlot(t){var e;let r=this.value,n=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c==\"doc\"?a=!0:c==\"selection\"?h=!0:((e=t[c.id])!==null&&e!==void 0?e:1)&1||f.push(t[c.id]);return{create(c){return c.values[o]=r(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||kl(c,f)){let d=r(c);if(l?!Dc(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,m=u.config.address[s];if(m!=null){let O=ns(u,m);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===c.facet(g):g instanceof it?u.field(g,!1)==c.field(g,!1):!0)||(l?Dc(d=r(c),O,n):n(d=r(c),O)))return c.values[o]=O,0}else d=r(c);return c.values[o]=d,1}}}};function Dc(i,t,e){if(i.length!=t.length)return!1;for(let r=0;ri[a.id]),n=e.map(a=>a.type),s=r.filter(a=>!(a&1)),o=i[t.id]>>1;function l(a){let h=[];for(let f=0;fr===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Bc).find(r=>r.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:r=>(r.values[e]=this.create(r),1),update:(r,n)=>{let s=r.values[e],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[e]=o,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[e]=n.field(this),0):(r.values[e]=this.create(r),1)}}init(t){return[this,Bc.of({field:this,create:t})]}get extension(){return this}},ni={lowest:4,low:3,default:2,high:1,highest:0};function xr(i){return t=>new is(t,i)}var ie={highest:xr(ni.highest),high:xr(ni.high),default:xr(ni.default),low:xr(ni.low),lowest:xr(ni.lowest)},is=class{constructor(t,e){this.inner=t,this.prec=e}},pe=class i{of(t){return new br(this,t)}reconfigure(t){return i.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},br=class{constructor(t,e){this.compartment=t,this.inner=e}},rs=class i{constructor(t,e,r,n,s,o){for(this.base=t,this.compartments=e,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,r){let n=[],s=Object.create(null),o=new Map;for(let u of OO(t,e,o))u instanceof it?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=r?.config.facets;for(let u in s){let d=s[u],m=d[0].facet,O=f&&f[u]||[];if(d.every(g=>g.type==0))if(l[m.id]=a.length<<1|1,ql(O,d))a.push(r.facet(m));else{let g=m.combine(d.map(x=>x.value));a.push(r&&m.compare(g,r.facet(m))?r.facet(m):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(x=>g.dynamicSlot(x)));l[m.id]=h.length<<1,h.push(g=>gO(g,m,d))}}let c=h.map(u=>u(l));return new i(t,o,c,l,a,s)}};function OO(i,t,e){let r=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=r[a].indexOf(o);h>-1&&r[a].splice(h,1),o instanceof br&&e.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof br){if(e.has(o.compartment))throw new RangeError(\"Duplicate use of compartment in extensions\");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),s(h,l)}else if(o instanceof is)s(o.inner,o.prec);else if(o instanceof it)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Bi)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,ni.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ni.default),r.reduce((o,l)=>o.concat(l))}function yr(i,t){if(t&1)return 2;let e=t>>1,r=i.status[e];if(r==4)throw new Error(\"Cyclic dependency between fields and/or facets\");if(r&2)return r;i.status[e]=4;let n=i.computeSlot(i,i.config.dynamicSlots[e]);return i.status[e]=2|n}function ns(i,t){return t&1?i.config.staticValues[t>>1]:i.values[t>>1]}var Zc=A.define(),Tl=A.define({combine:i=>i.some(t=>t),static:!0}),Fc=A.define({combine:i=>i.length?i[0]:void 0,static:!0}),_c=A.define(),Gc=A.define(),Hc=A.define(),Uc=A.define({combine:i=>i.length?i[0]:!1}),Et=class{constructor(t,e){this.type=t,this.value=e}static define(){return new Pl}},Pl=class{of(t){return new Et(this,t)}},Cl=class{constructor(t){this.map=t}of(t){return new M(this,t)}},M=class i{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new i(this.type,e)}is(t){return this.type==t}static define(t={}){return new Cl(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let r=[];for(let n of t){let s=n.map(e);s&&r.push(s)}return r}};M.reconfigure=M.define();M.appendConfig=M.define();var lt=class i{constructor(t,e,r,n,s,o){this.startState=t,this.changes=e,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&zc(r,e.newLength),s.some(l=>l.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(t,e,r,n,s,o){return new i(t,e,r,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(i.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]==\".\"))}};lt.time=Et.define();lt.userEvent=Et.define();lt.addToHistory=Et.define();lt.remote=Et.define();function xO(i,t){let e=[];for(let r=0,n=0;;){let s,o;if(r=i[r]))s=i[r++],o=i[r++];else if(n=0;n--){let s=r[n](i);s instanceof lt?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof lt?i=s[0]:i=Kc(t,Xi(s),!1)}return i}function bO(i){let t=i.startState,e=t.facet(Hc),r=i;for(let n=e.length-1;n>=0;n--){let s=e[n](i);s&&Object.keys(s).length&&(r=jc(r,Al(t,s,i.changes.newLength),!0))}return r==i?i:lt.create(t,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var SO=[];function Xi(i){return i==null?SO:Array.isArray(i)?i:[i]}var F=function(i){return i[i.Word=0]=\"Word\",i[i.Space=1]=\"Space\",i[i.Other=2]=\"Other\",i}(F||(F={})),wO=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,Ql;try{Ql=new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\",\"u\")}catch{}function vO(i){if(Ql)return Ql.test(i);for(let t=0;t\"\\x80\"&&(e.toUpperCase()!=e.toLowerCase()||wO.test(e)))return!0}return!1}function kO(i){return t=>{if(!/\\S/.test(t))return F.Space;if(vO(t))return F.Word;for(let e=0;e-1)return F.Word;return F.Other}}var Y=class i{constructor(t,e,r,n,s,o){this.config=t,this.doc=e,this.selection=r,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;ln.set(h,a)),e=null),n.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(e=null,r=l.value):l.is(M.appendConfig)&&(e=null,r=Xi(r).concat(l.value));let s;e?s=t.startState.values.slice():(e=rs.resolve(r,n,this),s=new i(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(Tl)?t.newSelection:t.newSelection.asSingle();new i(e,t.newDoc,o,s,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t==\"string\"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:b.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,r=t(e.ranges[0]),n=this.changes(r.changes),s=[r.range],o=Xi(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return i.create({doc:t.doc,selection:b.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=rs.resolve(t.extensions||[],new Map),r=t.doc instanceof V?t.doc:V.of((t.doc||\"\").split(e.staticFacet(i.lineSeparator)||Sl)),n=t.selection?t.selection instanceof b?t.selection:b.single(t.selection.anchor,t.selection.head):b.single(0);return zc(n,r.length),e.staticFacet(Tl)||(n=n.asSingle()),new i(e,r,n,e.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`\n`}get readOnly(){return this.facet(Uc)}phrase(t,...e){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return e.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(r,n)=>{if(n==\"$\")return\"$\";let s=+(n||1);return!s||s>e.length?r:e[s-1]})),t}languageDataAt(t,e,r=-1){let n=[];for(let s of this.facet(Zc))for(let o of s(this,e,r))Object.prototype.hasOwnProperty.call(o,t)&&n.push(o[t]);return n}charCategorizer(t){return kO(this.languageDataAt(\"wordChars\",t).join(\"\"))}wordAt(t){let{text:e,from:r,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-r,l=t-r;for(;o>0;){let a=at(e,o,!1);if(s(e.slice(a,o))!=F.Word)break;o=a}for(;li.length?i[0]:4});Y.lineSeparator=Fc;Y.readOnly=Uc;Y.phrases=A.define({compare(i,t){let e=Object.keys(i),r=Object.keys(t);return e.length==r.length&&e.every(n=>i[n]==t[n])}});Y.languageData=Zc;Y.changeFilter=_c;Y.transactionFilter=Gc;Y.transactionExtender=Hc;pe.reconfigure=M.define();function kt(i,t,e={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,s))r[s]=e[s](l,o);else throw new Error(\"Config merge conflict for field \"+s)}for(let n in t)r[n]===void 0&&(r[n]=t[n]);return r}var ee=class{eq(t){return this==t}range(t,e=t){return Sr.create(t,e,this)}};ee.prototype.startSide=ee.prototype.endSide=0;ee.prototype.point=!1;ee.prototype.mapMode=ut.TrackDel;var Sr=class i{constructor(t,e,r){this.from=t,this.to=e,this.value=r}static create(t,e,r){return new i(t,e,r)}};function Rl(i,t){return i.from-t.from||i.value.startSide-t.value.startSide}var Ml=class i{constructor(t,e,r,n){this.from=t,this.to=e,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,r,n=0){let s=r?this.to:this.from;for(let o=n,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-t||(r?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,r,n){for(let s=this.findIndex(e,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),r.push(h),n.push(u-o),s.push(d-o))}return{mapped:r.length?new i(n,s,r,l):null,pos:o}}},_=class i{constructor(t,e,r,n){this.chunkPos=t,this.chunk=e,this.nextLayer=r,this.maxPoint=n}static create(t,e,r,n){return new i(t,e,r,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(r&&(e=e.slice().sort(Rl)),this.isEmpty)return e.length?i.of(e):this;let l=new ss(this,null,-1).goto(0),a=0,h=[],f=new Ee;for(;l.value||a=0){let c=e[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+o.length&&o.between(s,t-s,e-s,r)===!1)return}this.nextLayer.between(t,e,r)}}iter(t=0){return wr.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return wr.from(t).goto(e)}static compare(t,e,r,n,s=-1){let o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=Xc(o,l,r),h=new si(o,a,s),f=new si(l,a,s);r.iterGaps((c,u,d)=>Lc(h,c,f,u,d,n)),r.empty&&r.length==0&&Lc(h,0,f,0,0,n)}static eq(t,e,r=0,n){n==null&&(n=999999999);let s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0),o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Xc(s,o),a=new si(s,l,0).goto(r),h=new si(o,l,0).goto(r);for(;;){if(a.to!=h.to||!El(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(t,e,r,n,s=-1){let o=new si(t,null,s).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,r);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(t,e=!1){let r=new Ee;for(let n of t instanceof Sr?[t]:e?TO(t):t)r.add(n.from,n.to,n.value);return r.finish()}static join(t){if(!t.length)return i.empty;let e=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let n=t[r];n!=i.empty;n=n.nextLayer)e=new i(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}};_.empty=new _([],[],null,-1);function TO(i){if(i.length>1)for(let t=i[0],e=1;e0)return i.slice().sort(Rl);t=r}return i}_.empty.nextLayer=_.empty;var Ee=class i{finishChunk(t){this.chunks.push(new Ml(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,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,r){this.addInner(t,e,r)||(this.nextLayer||(this.nextLayer=new i)).add(t,e,r)}addInner(t,e,r){let n=t-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=e,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let r=e.value.length-1;return this.last=e.value[r],this.lastFrom=e.from[r]+t,this.lastTo=e.to[r]+t,!0}finish(){return this.finishInner(_.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=_.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};function Xc(i,t,e){let r=new Map;for(let s of i)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&n.push(new ss(o,e,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let r of this.heap)r.goto(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);return this.next(),this}forward(t,e){for(let r of this.heap)r.forward(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),yl(this.heap,0)}}};function yl(i,t){for(let e=i[t];;){let r=(t<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1=0&&(n=i[r+1],r++),e.compare(n)<0)break;i[r]=e,i[t]=n,t=r}}var si=class{constructor(t,e,r){this.minPoint=r,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=wr.from(t,e,r)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){jn(this.active,t),jn(this.activeTo,t),jn(this.activeRank,t),this.minActive=Vc(this.active,this.activeTo)}addActive(t){let e=0,{value:r,to:n,rank:s}=this.cursor;for(;e0;)e++;Kn(this.active,e,r),Kn(this.activeTo,e,n),Kn(this.activeRank,e,s),t&&Kn(t,e,this.cursor.from),this.minActive=Vc(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&jn(r,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&r[n]=0&&!(this.activeRank[r]t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&e.push(this.active[r]);return e.reverse()}openEnd(t){let e=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)e++;return e}};function Lc(i,t,e,r,n,s){i.goto(t),e.goto(r);let o=r+n,l=r,a=r-t;for(;;){let h=i.to+a-e.to||i.endSide-e.endSide,f=h<0?i.to+a:e.to,c=Math.min(f,o);if(i.point||e.point?i.point&&e.point&&(i.point==e.point||i.point.eq(e.point))&&El(i.activeForPoint(i.to),e.activeForPoint(e.to))||s.comparePoint(l,c,i.point,e.point):c>l&&!El(i.active,e.active)&&s.compareRange(l,c,i.active,e.active),f>o)break;l=f,h<=0&&i.next(),h>=0&&e.next()}}function El(i,t){if(i.length!=t.length)return!1;for(let e=0;e=t;r--)i[r+1]=i[r];i[t]=e}function Vc(i,t){let e=-1,r=1e9;for(let n=0;n=t)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?e-s%e:1,n=at(i,n)}return r===!0?-1:i.length}var Dl=\"\\u037C\",Jc=typeof Symbol>\"u\"?\"__\"+Dl:Symbol.for(Dl),Bl=typeof Symbol>\"u\"?\"__styleSet\"+Math.floor(Math.random()*1e8):Symbol(\"styleSet\"),tu=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:{},Gt=class{constructor(t,e){this.rules=[];let{finish:r}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function s(o,l,a,h){let f=[],c=/^@(\\w+)\\b/.exec(o[0]),u=c&&c[1]==\"keyframes\";if(c&&l==null)return a.push(o[0]+\";\");for(let d in l){let m=l[d];if(/&/.test(d))s(d.split(/,\\s*/).map(O=>o.map(g=>O.replace(/&/,g))).reduce((O,g)=>O.concat(g)),m,a);else if(m&&typeof m==\"object\"){if(!c)throw new RangeError(\"The value of a property (\"+d+\") should be a primitive value.\");s(n(d),m,f,u)}else m!=null&&f.push(d.replace(/_.*/,\"\").replace(/[A-Z]/g,O=>\"-\"+O.toLowerCase())+\": \"+m+\";\")}(f.length||u)&&a.push((r&&!c&&!h?o.map(r):o).join(\", \")+\" {\"+f.join(\" \")+\"}\")}for(let o in t)s(n(o),t[o],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let t=tu[Jc]||1;return tu[Jc]=t+1,Dl+t.toString(36)}static mount(t,e,r){let n=t[Bl],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Xl(t,s),n.mount(Array.isArray(e)?e:[e])}},eu=new Map,Xl=class{constructor(t,e){let r=t.ownerDocument||t,n=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let s=eu.get(r);if(s)return t.adoptedStyleSheets=[s.sheet,...t.adoptedStyleSheets],t[Bl]=s;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],eu.set(r,this)}else{this.styleTag=r.createElement(\"style\"),e&&this.styleTag.setAttribute(\"nonce\",e);let s=t.head||t;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],t[Bl]=this}mount(t){let e=this.sheet,r=0,n=0;for(let s=0;s-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),e)for(let a=0;a\",191:\"?\",192:\"~\",219:\"{\",220:\"|\",221:\"}\",222:'\"'},PO=typeof navigator<\"u\"&&/Mac/.test(navigator.platform),CO=typeof navigator<\"u\"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(ht=0;ht<10;ht++)$e[48+ht]=$e[96+ht]=String(ht);var ht;for(ht=1;ht<=24;ht++)$e[ht+111]=\"F\"+ht;var ht;for(ht=65;ht<=90;ht++)$e[ht]=String.fromCharCode(ht+32),Vi[ht]=String.fromCharCode(ht);var ht;for(ls in $e)Vi.hasOwnProperty(ls)||(Vi[ls]=$e[ls]);var ls;function iu(i){var t=PO&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||CO&&i.shiftKey&&i.key&&i.key.length==1||i.key==\"Unidentified\",e=!t&&i.key||(i.shiftKey?Vi:$e)[i.keyCode]||i.key||\"Unidentified\";return e==\"Esc\"&&(e=\"Escape\"),e==\"Del\"&&(e=\"Delete\"),e==\"Left\"&&(e=\"ArrowLeft\"),e==\"Up\"&&(e=\"ArrowUp\"),e==\"Right\"&&(e=\"ArrowRight\"),e==\"Down\"&&(e=\"ArrowDown\"),e}function Ss(i){let t;return i.nodeType==11?t=i.getSelection?i:i.ownerDocument:t=i,t.getSelection()}function Zl(i,t){return t?i==t||i.contains(t.nodeType!=1?t.parentNode:t):!1}function AO(i){let t=i.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Os(i,t){if(!t.anchorNode)return!1;try{return Zl(i,t.anchorNode)}catch{return!1}}function Xr(i){return i.nodeType==3?ai(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Rr(i,t,e,r){return e?ru(i,t,e,r,-1)||ru(i,t,e,r,1):!1}function Lr(i){for(var t=0;;t++)if(i=i.previousSibling,!i)return t}function ru(i,t,e,r,n){for(;;){if(i==e&&t==r)return!0;if(t==(n<0?0:qe(i))){if(i.nodeName==\"DIV\")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;t=Lr(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[t+(n<0?-1:0)],i.nodeType==1&&i.contentEditable==\"false\")return!1;t=n<0?qe(i):0}else return!1}}function qe(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Aa(i,t){let e=t?i.left:i.right;return{left:e,right:e,top:i.top,bottom:i.bottom}}function QO(i){return{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Iu(i,t){let e=t.width/i.offsetWidth,r=t.height/i.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-i.offsetWidth)<1)&&(e=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-i.offsetHeight)<1)&&(r=1),{scaleX:e,scaleY:r}}function RO(i,t,e,r,n,s,o,l){let a=i.ownerDocument,h=a.defaultView||window;for(let f=i,c=!1;f&&!c;)if(f.nodeType==1){let u,d=f==a.body,m=1,O=1;if(d)u=QO(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:m,scaleY:O}=Iu(f,S)),u={left:S.left,right:S.left+f.clientWidth*m,top:S.top,bottom:S.top+f.clientHeight*O}}let g=0,x=0;if(n==\"nearest\")t.top0&&t.bottom>u.bottom+x&&(x=t.bottom-u.bottom+x+o)):t.bottom>u.bottom&&(x=t.bottom-u.bottom+o,e<0&&t.top-x0&&t.right>u.right+g&&(g=t.right-u.right+g+s)):t.right>u.right&&(g=t.right-u.right+s,e<0&&t.lefte.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}var Fl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:r}=t;this.set(e,Math.min(t.anchorOffset,e?qe(e):0),r,Math.min(t.focusOffset,r?qe(r):0))}set(t,e,r,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=r,this.focusOffset=n}},Wi=null;function Nu(i){if(i.setActive)return i.setActive();if(Wi)return i.focus(Wi);let t=[];for(let e=i;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(i.focus(Wi==null?{get preventScroll(){return Wi={preventScroll:!0},!0}}:void 0),!Wi){Wi=!1;for(let e=0;eMath.max(1,i.scrollHeight-i.clientHeight-4)}var Tt=class i{constructor(t,e,r=!0){this.node=t,this.offset=e,this.precise=r}static before(t,e){return new i(t.parentNode,Lr(t),e)}static after(t,e){return new i(t.parentNode,Lr(t)+1,e)}},Qa=[],rt=class i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let r of this.children){if(r==t)return e;e+=r.length+r.breakAfter}throw new RangeError(\"Invalid child in posBefore\")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(this.flags&2){let r=this.dom,n=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=n?n.nextSibling:r.firstChild)){let l=i.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(t,e),o.flags&=-8}if(s=n?n.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&s!=o.dom&&(e.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=su(s);else r.insertBefore(o.dom,s);n=o.dom}for(s=n?n.nextSibling:r.firstChild,s&&e&&e.node==r&&(e.written=!0);s;)s=su(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(t,e),r.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let r;if(t==this.dom)r=this.dom.childNodes[e];else{let n=qe(t)==0?0:e==0?-1:1;for(;;){let s=t.parentNode;if(s==this.dom)break;n==0&&s.firstChild!=s.lastChild&&(t==s.firstChild?n=-1:n=1),t=s}n<0?r=t:r=t.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!i.get(r);)r=r.nextSibling;if(!r)return this.length;for(let n=0,s=0;;n++){let o=this.children[n];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(t,e,r=0){let n=-1,s=-1,o=-1,l=-1;for(let a=0,h=r,f=r;ae)return c.domBoundsAround(t,e,h);if(u>=t&&n==-1&&(n=a,s=h),h>e&&c.dom.parentNode==this.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,r=Qa){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function Zu(i,t,e,r,n,s,o,l,a){let{children:h}=i,f=h.length?h[t]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:o;if(!(t==r&&f&&!o&&!u&&s.length<2&&f.merge(e,n,s.length?c:null,e==0,l,a))){if(r0&&(!o&&s.length&&f.merge(e,f.length,s[0],!1,l,0)?f.breakAfter=s.shift().breakAfter:(e2),Q={mac:au||/Mac/.test(Lt.platform),windows:/Win/.test(Lt.platform),linux:/Linux|X11/.test(Lt.platform),ie:Bs,ie_version:_u?_l.documentMode||6:Hl?+Hl[1]:Gl?+Gl[1]:0,gecko:ou,gecko_version:ou?+(/Firefox\\/(\\d+)/.exec(Lt.userAgent)||[0,0])[1]:0,chrome:!!Ll,chrome_version:Ll?+Ll[1]:0,ios:au,android:/Android\\b/.test(Lt.userAgent),webkit:lu,safari:Gu,webkit_version:lu?+(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:_l.documentElement.style.tabSize!=null?\"tab-size\":\"-moz-tab-size\"},qO=256,Ye=class i extends rt{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,r){return this.flags&8||r&&(!(r instanceof i)||this.length-(e-t)+r.length>qO||r.flags&8)?!1:(this.text=this.text.slice(0,t)+(r?r.text:\"\")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new i(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Tt(this.dom,t)}domBoundsAround(t,e,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return DO(this.dom,t,e)}},ze=class i extends rt{constructor(t,e=[],r=0){super(),this.mark=t,this.children=e,this.length=r;for(let n of e)n.setParent(this)}setAttrs(t){if(Yu(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,r,n,s,o){return r&&(!(r instanceof i&&r.mark.eq(this.mark))||t&&s<=0||et&&e.push(r=t&&(n=s),r=a,s++}let o=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new i(this.mark,e,o)}domAtPos(t){return Hu(this,t)}coordsAt(t,e){return ju(this,t,e)}};function DO(i,t,e){let r=i.nodeValue.length;t>r&&(t=r);let n=t,s=t,o=0;t==0&&e<0||t==r&&e>=0?Q.chrome||Q.gecko||(t?(n--,o=1):s=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Aa(a,o<0):a||null}var Vr=class i extends rt{static create(t,e,r){return new i(t,e,r)}constructor(t,e,r){super(),this.widget=t,this.length=e,this.side=r,this.prevWidget=null}split(t){let e=i.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable=\"false\"))}getSide(){return this.side}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0)?Tt.before(this.dom):Tt.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let r=this.widget.coordsAt(this.dom,t,e);if(r)return r;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:t>0;for(let l=o?n.length-1:0;s=n[l],!(t>0?l==0:l==n.length-1||s.top0?Tt.before(this.dom):Tt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}};Ye.prototype.children=Vr.prototype.children=Wr.prototype.children=Qa;function Hu(i,t){let e=i.dom,{children:r}=i,n=0;for(let s=0;ns&&t0;s--){let o=r[s-1];if(o.dom.parentNode==e)return o.domAtPos(o.length)}for(let s=n;s0&&t instanceof ze&&n.length&&(r=n[n.length-1])instanceof ze&&r.mark.eq(t.mark)?Uu(r,t.children[0],e-1):(n.push(t),t.setParent(i)),i.length+=t.length}function ju(i,t,e){let r=null,n=-1,s=null,o=-1;function l(h,f){for(let c=0,u=0;c=f&&(d.children.length?l(d,f-u):(!s||s.isHidden&&e>0)&&(m>f||u==m&&d.getSide()>0)?(s=d,o=f-u):(u-1?1:0)!=n.length-(e&&n.indexOf(e)>-1?1:0))return!1;for(let s of r)if(s!=e&&(n.indexOf(s)==-1||i[s]!==t[s]))return!1;return!0}function jl(i,t,e){let r=!1;if(t)for(let n in t)e&&n in e||(r=!0,n==\"style\"?i.style.cssText=\"\":i.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(r=!0,n==\"style\"?i.style.cssText=e[n]:i.setAttribute(n,e[n]));return r}function XO(i){let t=Object.create(null);for(let e=0;e0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Ra(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Uu(this,t,e)}addLineDeco(t){let e=t.spec.attributes,r=t.spec.class;e&&(this.attrs=Ul(e,this.attrs||{})),r&&(this.attrs=Ul({class:r},this.attrs||{}))}domAtPos(t){return Hu(this,t)}reuseDOM(t){t.nodeName==\"DIV\"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var r;this.dom?this.flags&4&&(Yu(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),this.prevAttrs!==void 0&&(jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add(\"cm-line\"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&rt.get(n)instanceof ze;)n=n.lastChild;if(!n||!this.length||n.nodeName!=\"BR\"&&((r=rt.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(s=>s instanceof Ye))){let s=document.createElement(\"BR\");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let r of this.children){if(!(r instanceof Ye)||/[^ -~]/.test(r.text))return null;let n=Xr(r.dom);if(n.length!=1)return null;t+=n[0].width,e=n[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let r=ju(this,t,e);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight=e){if(s instanceof i)return s;if(o>e)break}n=o+s.breakAfter}return null}},Zi=class i extends rt{constructor(t,e,r){super(),this.widget=t,this.length=e,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0}},Ut=class{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},Pt=function(i){return i[i.Text=0]=\"Text\",i[i.WidgetBefore=1]=\"WidgetBefore\",i[i.WidgetAfter=2]=\"WidgetAfter\",i[i.WidgetRange=3]=\"WidgetRange\",i}(Pt||(Pt={})),R=class extends ee{constructor(t,e,r,n){super(),this.startSide=t,this.endSide=e,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Ir(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return e+=r&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ze(t,e,e,r,t.widget||null,!1)}static replace(t){let e=!!t.block,r,n;if(t.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=Ku(t,e);r=(s?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new Ze(t,r,n,e,t.widget||null,!0)}static line(t){return new Nr(t)}static set(t,e=!1){return _.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};R.none=_.empty;var Ir=class i extends R{constructor(t){let{start:e,end:r}=Ku(t);super(e?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||\"span\",this.class=t.class||\"\",this.attrs=t.attributes||null}eq(t){var e,r;return this==t||t instanceof i&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((r=t.attrs)===null||r===void 0?void 0:r.class))&&Ra(this.attrs,t.attrs,\"class\")}range(t,e=t){if(t>=e)throw new RangeError(\"Mark decorations may not be empty\");return super.range(t,e)}};Ir.prototype.point=!1;var Nr=class i extends R{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof i&&this.spec.class==t.spec.class&&Ra(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError(\"Line decoration ranges must be zero-length\");return super.range(t,e)}};Nr.prototype.mapMode=ut.TrackBefore;Nr.prototype.point=!0;var Ze=class i extends R{constructor(t,e,r,n,s,o){super(e,r,s,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?ut.TrackBefore:ut.TrackAfter:ut.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof i&&LO(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError(\"Invalid range for replacement decoration\");if(!this.isReplace&&e!=t)throw new RangeError(\"Widget decorations can only have zero-length ranges\");return super.range(t,e)}};Ze.prototype.point=!0;function Ku(i,t=!1){let{inclusiveStart:e,inclusiveEnd:r}=i;return e==null&&(e=i.inclusive),r==null&&(r=i.inclusive),{start:e??t,end:r??t}}function LO(i,t){return i==t||!!(i&&t&&i.compare(t))}function Kl(i,t,e,r=0){let n=e.length-1;n>=0&&e[n]+r>=i?e[n]=Math.max(e[n],t):e.push(i,t)}var Mr=class i{constructor(t,e,r,n){this.doc=t,this.pos=e,this.end=r,this.disallowBlockEffectsFor=n,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=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof Zi&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new mt),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(as(new Wr(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof Zi)&&this.getLine()}buildText(t,e,r){for(;t>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)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,t--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-r)),this.getLine().append(as(new Ye(this.text.slice(this.textOff,this.textOff+n)),e),r),this.atCursorPos=!0,this.textOff+=n,t-=n,r=0}}span(t,e,r,n){this.buildText(e-t,r,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,r,n,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Ze){if(r.block)throw new RangeError(\"Block decorations may not be specified via plugins\");if(e>this.doc.lineAt(this.pos).to)throw new RangeError(\"Decorations that replace line breaks may not be specified via plugins\")}let l=e-t;if(r instanceof Ze)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Zi(r.widget||new vs(\"div\"),l,r));else{let a=Vr.create(r.widget||new vs(\"span\"),l,l?0:r.startSide),h=this.atCursorPos&&!a.isEditable&&s<=n.length&&(t0),f=!a.isEditable&&(tn.length||r.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(as(new Wr(1),n),s),s=n.length+Math.max(0,s-n.length)),c.append(as(a,n),s),this.atCursorPos=f,this.pendingBuffer=f?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text=\"\",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,r,n,s){let o=new i(t,e,r,s);return o.openEnd=_.spans(n,e,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function as(i,t){for(let e of t)i=new ze(e,[i],i.length);return i}var vs=class extends Ut{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},G=function(i){return i[i.LTR=0]=\"LTR\",i[i.RTL=1]=\"RTL\",i}(G||(G={})),hi=G.LTR,Ma=G.RTL;function Ju(i){let t=[];for(let e=0;e=e){if(l.level==r)return o;(s<0||(n!=0?n<0?l.frome:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError(\"Index out of range\");return s}};function ed(i,t){if(i.length!=t.length)return!1;for(let e=0;e=0;O-=3)if(me[O+1]==-d){let g=me[O+2],x=g&2?n:g&4?g&1?s:n:0;x&&(j[c]=j[me[O]]=x),l=O;break}}else{if(me.length==189)break;me[l++]=c,me[l++]=u,me[l++]=a}else if((m=j[c])==2||m==1){let O=m==n;a=O?0:1;for(let g=l-3;g>=0;g-=3){let x=me[g+2];if(x&2)break;if(O)me[g+2]|=2;else{if(x&4)break;me[g+2]|=4}}}}}function zO(i,t,e,r){for(let n=0,s=r;n<=e.length;n++){let o=n?e[n-1].to:i,l=na;)m==g&&(m=e[--O].from,g=O?e[O-1].to:i),j[--m]=d;a=f}else s=h,a++}}}function ta(i,t,e,r,n,s,o){let l=r%2?2:1;if(r%2==n%2)for(let a=t,h=0;aa&&o.push(new Oe(a,O.from,d));let g=O.direction==hi!=!(d%2);ea(i,g?r+1:r,n,O.inner,O.from,O.to,o),a=O.to}m=O.to}else{if(m==e||(f?j[m]!=l:j[m]==l))break;m++}u?ta(i,a,m,r+1,n,u,o):at;){let f=!0,c=!1;if(!h||a>s[h-1].to){let O=j[a-1];O!=l&&(f=!1,c=O==16)}let u=!f&&l==1?[]:null,d=f?r:r+1,m=a;t:for(;;)if(h&&m==s[h-1].to){if(c)break t;let O=s[--h];if(!f)for(let g=O.from,x=h;;){if(g==t)break t;if(x&&s[x-1].to==g)g=s[--x].from;else{if(j[g-1]==l)break t;break}}if(u)u.push(O);else{O.toj.length;)j[j.length]=256;let r=[],n=t==hi?0:1;return ea(i,n,n,e,0,i.length,r),r}function id(i){return[new Oe(0,i,0)]}var rd=\"\";function FO(i,t,e,r,n){var s;let o=r.head-i.from,l=Oe.find(t,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=t[l],h=a.side(n,e);if(o==h){let u=l+=n?1:-1;if(u<0||u>=t.length)return null;a=t[l=u],o=a.side(!n,e),h=a.side(n,e)}let f=at(i.text,o,a.forward(n,e));(fa.to)&&(f=h),rd=i.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(n?t.length-1:0)?null:t[l+(n?1:-1)];return c&&f==h&&c.level+(n?0:1)i.some(t=>t)}),cd=A.define({combine:i=>i.some(t=>t)}),Er=class i{constructor(t,e=\"nearest\",r=\"nearest\",n=5,s=5,o=!1){this.range=t,this.y=e,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(t){return t.empty?this:new i(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new i(b.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},hs=M.define({map:(i,t)=>i.map(t)});function Ct(i,t,e){let r=i.facet(ld);r.length?r[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+\":\",t):console.error(t)}var Xs=A.define({combine:i=>i.length?i[0]:!0}),GO=0,Tr=A.define(),ft=class i{constructor(t,e,r,n,s){this.id=t,this.create=e,this.domEventHandlers=r,this.domEventObservers=n,this.extension=s(this)}static define(t,e){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=e||{};return new i(GO++,t,r,n,l=>{let a=[Tr.of(l)];return o&&a.push(Yr.of(h=>{let f=h.plugin(l);return f?o(f):R.none})),s&&a.push(s(l)),a})}static fromClass(t,e){return i.define(r=>new t(r),e)}},$r=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(r){if(Ct(e.state,r,\"CodeMirror plugin crashed\"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){Ct(t.state,e,\"CodeMirror plugin crashed\"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(r){Ct(t.state,r,\"CodeMirror plugin crashed\")}}deactivate(){this.spec=this.value=null}},ud=A.define(),Ea=A.define(),Yr=A.define(),dd=A.define(),$a=A.define(),pd=A.define();function fu(i,t){let e=i.state.facet(pd);if(!e.length)return e;let r=e.map(s=>s instanceof Function?s(i):s),n=[];return _.spans(r,t.from,t.to,{point(){},span(s,o,l,a){let h=s-t.from,f=o-t.from,c=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,m;if(d==null&&(d=_O(t.text,h,f)),a>0&&c.length&&(m=c[c.length-1]).to==h&&m.direction==d)m.to=f,c=m.inner;else{let O={from:h,to:f,direction:d,inner:[]};c.push(O),c=O.inner}}}}),n}var md=A.define();function gd(i){let t=0,e=0,r=0,n=0;for(let s of i.state.facet(md)){let o=s(i);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:r,bottom:n}}var Pr=A.define(),xe=class i{constructor(t,e,r,n){this.fromA=t,this.toA=e,this.fromB=r,this.toB=n}join(t){return new i(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,r=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>r.toA)){if(n.toAf)break;s+=2}if(!a)return r;new i(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}},ks=class i{constructor(t,e,r){this.view=t,this.state=e,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=vt.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,l,a)=>n.push(new xe(s,o,l,a))),this.changedRanges=n}static create(t,e,r){return new i(t,e,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Ts=class extends rt{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new mt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xe(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!e0(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let s=n>-1?UO(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new xe(h,f,t.changes.mapPos(h,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Q.ie||Q.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=JO(o,l,t.changes);return r=xe.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,t.startState.doc.length,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+\"px\",this.dom.style.flexBasis=this.minWidth?this.minWidth+\"px\":\"\";let o=Q.chrome||Q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=\"\"}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:f,toB:c}=l,u,d,m,O;if(r&&r.range.fromBf){let v=Mr.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),y=Mr.build(this.view.state.doc,r.range.toB,c,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,m=v.openStart,O=y.openEnd;let k=this.compositionView(r);y.breakAtStart?k.breakAfter=1:y.content.length&&k.merge(k.length,k.length,y.content[0],!1,y.openStart,0)&&(k.breakAfter=y.content[0].breakAfter,y.content.shift()),v.content.length&&k.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),u=v.content.concat(k).concat(y.content)}else({content:u,breakAtStart:d,openStart:m,openEnd:O}=Mr.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:g,off:x}=s.findPos(h,1),{i:S,off:C}=s.findPos(a,-1);Zu(this,S,C,g,x,u,d,m,O)}r&&this.fixCompositionDOM(r)}compositionView(t){let e=new Ye(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new ze(n,[e],e.length);let r=new mt;return r.append(e,0),r}fixCompositionDOM(t){let e=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=rt.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(t.range.fromB,1),n=this.children[r.i];e(t.line,n);for(let s=t.marks.length-1;s>=-1;s--)r=n.childPos(r.off,1),n=n.children[r.i],e(s>=0?t.marks[s].node:t.text,n)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,s=!n&&Os(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||e||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&HO(a)){let c=document.createTextNode(\"\");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=h=new Tt(c,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!Rr(a.node,a.offset,f.anchorNode,f.anchorOffset)||!Rr(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(f.focusNode)&&t0(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Ss(this.view.root);if(c)if(l.empty){if(Q.gecko){let u=jO(a.node,a.offset);if(u&&u!=3){let d=xd(a.node,a.offset,u==1?1:-1);d&&(a=new Tt(d.node,d.offset))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new Tt(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Tt(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Rr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,r=Ss(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!r||!e.empty||!e.assoc||!r.modify)return;let o=mt.find(this,e.head);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(e.head+e.assoc);r.collapse(f.node,f.offset),r.modify(\"move\",e.assoc<0?\"forward\":\"backward\",\"lineboundary\"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&r.collapse(n,s)}moveToLine(t){let e=this.dom,r;if(t.node!=e)return t;for(let n=t.offset;!r&&n=0;n--){let s=rt.get(e.childNodes[n]);s instanceof mt&&(r=s.domAtPos(s.length))}return r?new Tt(r.node,r.offset,!0):t}nearest(t){for(let e=t;e;){let r=rt.get(e);if(r&&r.rootView==this)return r;e=e.parentNode}return null}posFromDOM(t,e){let r=this.nearest(t);if(!r)throw new RangeError(\"Trying to find position for a DOM position outside of the document\");return r.localPosFromDOM(t,e)+r.posAtStart}domAtPos(t){let{i:e,off:r}=this.childCursor().findPos(t,-1);for(;e=0;o--){let l=this.children[o],a=s-l.breakAfter,h=a-l.length;if(at||l.covers(1))&&(!r||l instanceof mt&&!(r instanceof mt&&e>=0))&&(r=l,n=h),s=h}return r?r.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:r}=this.childPos(t,1),n=this.children[e];if(!(n instanceof mt))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(r,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}r=a}if(!(n instanceof Ye))return null;let s=at(n.text,r);if(s==r)return null;let o=ai(n.dom,r,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==G.LTR;for(let h=0,f=0;fn)break;if(h>=r){let d=c.dom.getBoundingClientRect();if(e.push(d.height),o){let m=c.dom.lastChild,O=m?Xr(m):[];if(O.length){let g=O[O.length-1],x=a?g.right-d.left:d.right-g.left;x>l&&(l=x,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction==\"rtl\"?G.RTL:G.LTR}measureTextSize(){for(let s of this.children)if(s instanceof mt){let o=s.measureTextSize();if(o)return o}let t=document.createElement(\"div\"),e,r,n;return t.className=\"cm-line\",t.style.width=\"99999px\",t.style.position=\"absolute\",t.textContent=\"abc def ghi jkl mno pqr stu\",this.view.observer.ignore(()=>{this.dom.appendChild(t);let s=Xr(t.firstChild)[0];e=t.getBoundingClientRect().height,r=s?s.width/27:7,n=s?s.height:e,t.remove()}),{lineHeight:e,charWidth:r,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ws(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let r=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],o=s?s.from-1:this.length;if(o>r){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(r).top)/this.view.scaleY;t.push(R.replace({widget:new Ps(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return R.set(t)}updateDeco(){let t=this.view.state.facet(Yr).map((n,s)=>(this.dynamicDecorationMap[s]=typeof n==\"function\")?n(this.view):n),e=!1,r=this.view.state.facet(dd).map((n,s)=>{let o=typeof n==\"function\";return o&&(e=!0),o?n(this.view):n});r.length&&(this.dynamicDecorationMap[t.length]=e,t.push(_.join(r)));for(let n=t.length;ne.anchor?-1:1),n;if(!r)return;!e.empty&&(n=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=gd(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;RO(this.view.scrollDOM,o,e.head0)r=r.childNodes[n-1],n=qe(r);else break}if(e>=0)for(let r=i,n=t;;){if(r.nodeType==3)return{node:r,offset:n};if(r.nodeType==1&&n=0)r=r.childNodes[n],n=0;else break}return null}function jO(i,t){return i.nodeType!=1?0:(t&&i.childNodes[t-1].contentEditable==\"false\"?1:0)|(t{rt.from&&(e=!0)}),e}function i0(i,t,e=1){let r=i.charCategorizer(t),n=i.doc.lineAt(t),s=t-n.from;if(n.length==0)return b.cursor(t);s==0?e=1:s==n.length&&(e=-1);let o=s,l=s;e<0?o=at(n.text,s,!1):l=at(n.text,s);let a=r(n.text.slice(o,l));for(;o>0;){let h=at(n.text,o,!1);if(r(n.text.slice(h,o))!=a)break;o=h}for(;li?t.left-i:Math.max(0,i-t.right)}function n0(i,t){return t.top>i?t.top-i:Math.max(0,i-t.bottom)}function Vl(i,t){return i.topt.top+1}function cu(i,t){return ti.bottom?{top:i.top,left:i.left,right:i.right,bottom:t}:i}function ra(i,t,e){let r,n,s,o,l=!1,a,h,f,c;for(let m=i.firstChild;m;m=m.nextSibling){let O=Xr(m);for(let g=0;gC||o==C&&s>S){r=m,n=x,s=S,o=C;let v=C?e0?g0)}S==0?e>x.bottom&&(!f||f.bottomx.top)&&(h=m,c=x):f&&Vl(f,x)?f=uu(f,x.bottom):c&&Vl(c,x)&&(c=cu(c,x.top))}}if(f&&f.bottom>=e?(r=a,n=f):c&&c.top<=e&&(r=h,n=c),!r)return{node:i,offset:0};let u=Math.max(n.left,Math.min(n.right,t));if(r.nodeType==3)return du(r,u,e);if(l&&r.contentEditable!=\"false\")return ra(r,u,e);let d=Array.prototype.indexOf.call(i.childNodes,r)+(t>=(n.left+n.right)/2?1:0);return{node:i,offset:d}}function du(i,t,e){let r=i.nodeValue.length,n=-1,s=1e9,o=0;for(let l=0;le?f.top-e:e-f.bottom)-1;if(f.left-1<=t&&f.right+1>=t&&c=(f.left+f.right)/2,d=u;if((Q.chrome||Q.gecko)&&ai(i,l).getBoundingClientRect().left==f.right&&(d=!u),c<=0)return{node:i,offset:l+(d?1:0)};n=l+(d?1:0),s=c}}}return{node:i,offset:n>-1?n:o>0?i.nodeValue.length:0}}function yd(i,t,e,r=-1){var n,s;let o=i.contentDOM.getBoundingClientRect(),l=o.top+i.viewState.paddingTop,a,{docHeight:h}=i.viewState,{x:f,y:c}=t,u=c-l;if(u<0)return 0;if(u>h)return i.state.doc.length;for(let v=i.viewState.heightOracle.textHeight/2,y=!1;a=i.elementAtHeight(u),a.type!=Pt.Text;)for(;u=r>0?a.bottom+v:a.top-v,!(u>=0&&u<=h);){if(y)return e?null:0;y=!0,r=-r}c=l+u;let d=a.from;if(di.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:e?null:pu(i,o,a,f,c);let m=i.dom.ownerDocument,O=i.root.elementFromPoint?i.root:m,g=O.elementFromPoint(f,c);g&&!i.contentDOM.contains(g)&&(g=null),g||(f=Math.max(o.left+1,Math.min(o.right-1,f)),g=O.elementFromPoint(f,c),g&&!i.contentDOM.contains(g)&&(g=null));let x,S=-1;if(g&&((n=i.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let v=m.caretPositionFromPoint(f,c);v&&({offsetNode:x,offset:S}=v)}else if(m.caretRangeFromPoint){let v=m.caretRangeFromPoint(f,c);v&&({startContainer:x,startOffset:S}=v,(!i.contentDOM.contains(x)||Q.safari&&s0(x,S,f)||Q.chrome&&o0(x,S,f))&&(x=void 0))}}if(!x||!i.docView.dom.contains(x)){let v=mt.find(i.docView,d);if(!v)return u>a.top+a.height/2?a.to:a.from;({node:x,offset:S}=ra(v.dom,f,c))}let C=i.docView.nearest(x);if(!C)return null;if(C.isWidget&&((s=C.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=C.dom.getBoundingClientRect();return t.yi.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((n-e.top-(i.defaultLineHeight-l)*.5)/l);s+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(e.from,e.to);return e.from+os(o,s,i.state.tabSize)}function s0(i,t,e){let r;if(i.nodeType!=3||t!=(r=i.nodeValue.length))return!1;for(let n=i.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!=\"BR\")return!1;return ai(i,r-1,r).getBoundingClientRect().left>e}function o0(i,t,e){if(t!=0)return!1;for(let n=i;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains(\"cm-line\"))break;n=s}let r=i.nodeType==1?i.getBoundingClientRect():ai(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return e-r.left>5}function na(i,t){let e=i.lineBlockAt(t);if(Array.isArray(e.type)){for(let r of e.type)if(r.to>t||r.to==t&&(r.to==e.to||r.type==Pt.Text))return r}return e}function l0(i,t,e,r){let n=na(i,t.head),s=!r||n.type!=Pt.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(t.assoc<0&&t.head>n.from?t.head-1:t.head);if(s){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(n.from),a=i.posAtCoords({x:e==(l==G.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return b.cursor(a,e?-1:1)}return b.cursor(e?n.to:n.from,e?-1:1)}function mu(i,t,e,r){let n=i.state.doc.lineAt(t.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let l=t,a=null;;){let h=FO(n,s,o,l,e),f=rd;if(!h){if(n.number==(e?i.state.doc.lines:1))return l;f=`\n`,n=i.state.doc.line(n.number+(e?1:-1)),s=i.bidiSpans(n),h=i.visualLineSide(n,!e)}if(a){if(!a(f))return l}else{if(!r)return h;a=r(f)}l=h}}function a0(i,t,e){let r=i.state.charCategorizer(t),n=r(e);return s=>{let o=r(s);return n==F.Space&&(n=o),n==o}}function h0(i,t,e,r){let n=t.head,s=e?1:-1;if(n==(e?i.state.doc.length:0))return b.cursor(n,t.assoc);let o=t.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(n,t.assoc||-1),f=i.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(n-d.from))),l=(s<0?d.top:d.bottom)+f}let c=a.left+o,u=r??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(u+d)*s,O=yd(i,{x:c,y:m},!1,s);if(ma.bottom||(s<0?On)){let g=i.docView.coordsForChar(O),x=!g||m{if(t>s&&tn(i)),e.from,t.head>e.from?-1:1);return r==e.from?e:b.cursor(r,rnull),Q.gecko&&k0(t.contentDOM.ownerDocument)}handleEvent(t){!g0(this.view,t)||this.ignoreDuringComposition(t)||t.type==\"keydown\"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let r=this.handlers[t];if(r){for(let n of r.observers)n(this.view,e);for(let n of r.handlers){if(e.defaultPrevented)break;if(n(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=f0(t),r=this.handlers,n=this.view.contentDOM;for(let s in e)if(s!=\"scroll\"){let o=!e[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(n.removeEventListener(s,this.handleEvent),l=null),l||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!=\"scroll\"&&!e[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()r.keyCode==t.keyCode))&&!t.ctrlKey||c0.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,zi(this.view.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function gu(i,t){return(e,r)=>{try{return t.call(i,r,e)}catch(n){Ct(e.state,n)}}}function f0(i){let t=Object.create(null);function e(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&e(s).handlers.push(gu(r.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&e(s).observers.push(gu(r.value,o))}}for(let r in re)e(r).handlers.push(re[r]);for(let r in ne)e(r).observers.push(ne[r]);return t}var bd=[{key:\"Backspace\",keyCode:8,inputType:\"deleteContentBackward\"},{key:\"Enter\",keyCode:13,inputType:\"insertParagraph\"},{key:\"Enter\",keyCode:13,inputType:\"insertLineBreak\"},{key:\"Delete\",keyCode:46,inputType:\"deleteContentForward\"}],c0=\"dthko\",Sd=[16,17,18,20,91,92,224,225],fs=6;function cs(i){return Math.max(0,i)*.7+8}function u0(i,t){return Math.max(Math.abs(i.clientX-t.clientX),Math.abs(i.clientY-t.clientY))}var oa=class{constructor(t,e,r,n){this.view=t,this.startEvent=e,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=MO(t.contentDOM),this.atoms=t.state.facet($a).map(o=>o(t));let s=t.contentDOM.ownerDocument;s.addEventListener(\"mousemove\",this.move=this.move.bind(this)),s.addEventListener(\"mouseup\",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Y.allowMultipleSelections)&&d0(t,e),this.dragging=m0(t,e)&&Td(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&u0(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let r=0,n=0,s=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=gd(this.view);t.clientX-o.left<=s.left+fs?r=-cs(s.left-t.clientX):t.clientX+o.right>=s.right-fs&&(r=cs(t.clientX-s.right)),t.clientY-o.top<=s.top+fs?n=-cs(s.top-t.clientY):t.clientY+o.bottom>=s.bottom-fs&&(n=cs(t.clientY-s.bottom)),this.setScrollSpeed(r,n)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener(\"mousemove\",this.move),t.removeEventListener(\"mouseup\",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let r=0;rthis.select(this.lastEvent),20)}};function d0(i,t){let e=i.state.facet(nd);return e.length?e[0](t):Q.mac?t.metaKey:t.ctrlKey}function p0(i,t){let e=i.state.facet(sd);return e.length?e[0](t):Q.mac?!t.altKey:!t.ctrlKey}function m0(i,t){let{main:e}=i.state.selection;if(e.empty)return!1;let r=Ss(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function g0(i,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,r;e!=i.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(r=rt.get(e))&&r.ignoreEvent(t))return!1;return!0}var re=Object.create(null),ne=Object.create(null),wd=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function O0(i){let t=i.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement(\"textarea\"));e.style.cssText=\"position: fixed; left: -10000px; top: 10px\",e.focus(),setTimeout(()=>{i.focus(),e.remove(),vd(i,e.value)},50)}function vd(i,t){let{state:e}=i,r,n=1,s=e.toText(t),o=s.lines==e.selection.ranges.length;if(la!=null&&e.selection.ranges.every(a=>a.empty)&&la==s.toString()){let a=-1;r=e.changeByRange(h=>{let f=e.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=e.toText((o?s.line(n++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:b.cursor(h.from+c.length)}})}else o?r=e.changeByRange(a=>{let h=s.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):r=e.replaceSelection(s);i.dispatch(r,{userEvent:\"input.paste\",scrollIntoView:!0})}ne.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};re.keydown=(i,t)=>(i.inputState.setSelectionOrigin(\"select\"),t.keyCode==27&&(i.inputState.lastEscPress=Date.now()),!1);ne.touchstart=(i,t)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin(\"select.pointer\")};ne.touchmove=i=>{i.inputState.setSelectionOrigin(\"select.pointer\")};re.mousedown=(i,t)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let r of i.state.facet(od))if(e=r(i,t),e)break;if(!e&&t.button==0&&(e=b0(i,t)),e){let r=!i.hasFocus;i.inputState.startMouseSelection(new oa(i,t,e,r)),r&&i.observer.ignore(()=>Nu(i.contentDOM));let n=i.inputState.mouseSelection;if(n)return n.start(t),n.dragging===!1}return!1};function Ou(i,t,e,r){if(r==1)return b.cursor(t,e);if(r==2)return i0(i.state,t,e);{let n=mt.find(i.docView,t),s=i.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:s.from,l=n?n.posAtEnd:s.to;return li>=t.top&&i<=t.bottom,xu=(i,t,e)=>kd(t,e)&&i>=e.left&&i<=e.right;function x0(i,t,e,r){let n=mt.find(i.docView,t);if(!n)return 1;let s=t-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&xu(e,r,o))return-1;let l=n.coordsAt(s,1);return l&&xu(e,r,l)?1:o&&kd(r,o)?-1:1}function yu(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:x0(i,e,t.clientX,t.clientY)}}var y0=Q.ie&&Q.ie_version<=11,bu=null,Su=0,wu=0;function Td(i){if(!y0)return i.detail;let t=bu,e=wu;return bu=i,wu=Date.now(),Su=!t||e>Date.now()-400&&Math.abs(t.clientX-i.clientX)<2&&Math.abs(t.clientY-i.clientY)<2?(Su+1)%3:1}function b0(i,t){let e=yu(i,t),r=Td(t),n=i.state.selection;return{update(s){s.docChanged&&(e.pos=s.changes.mapPos(e.pos),n=n.map(s.changes))},get(s,o,l){let a=yu(i,s),h,f=Ou(i,a.pos,a.bias,r);if(e.pos!=a.pos&&!o){let c=Ou(i,e.pos,e.bias,r),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u1&&(h=S0(n,a.pos))?h:l?n.addRange(f):b.create([f])}}}function S0(i,t){for(let e=0;e=t)return b.create(i.ranges.slice(0,e).concat(i.ranges.slice(e+1)),i.mainIndex==e?0:i.mainIndex-(i.mainIndex>e?1:0))}return null}re.dragstart=(i,t)=>{let{selection:{main:e}}=i.state;if(t.target.draggable){let n=i.docView.nearest(t.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=e.to||o<=e.from)&&(e=b.range(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData(\"Text\",i.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed=\"copyMove\"),!1};re.dragend=i=>(i.inputState.draggedContent=null,!1);function vu(i,t,e,r){if(!e)return;let n=i.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&p0(i,t)?{from:s.from,to:s.to}:null,l={from:n,insert:e},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?\"move.drop\":\"input.drop\"}),i.inputState.draggedContent=null}re.drop=(i,t)=>{if(!t.dataTransfer)return!1;if(i.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let r=Array(e.length),n=0,s=()=>{++n==e.length&&vu(i,t,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(e[o])}return!0}else{let r=t.dataTransfer.getData(\"Text\");if(r)return vu(i,t,r,!0),!0}return!1};re.paste=(i,t)=>{if(i.state.readOnly)return!0;i.observer.flush();let e=wd?null:t.clipboardData;return e?(vd(i,e.getData(\"text/plain\")||e.getData(\"text/uri-text\")),!0):(O0(i),!1)};function w0(i,t){let e=i.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement(\"textarea\"));r.style.cssText=\"position: fixed; left: -10000px; top: 10px\",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function v0(i){let t=[],e=[],r=!1;for(let n of i.selection.ranges)n.empty||(t.push(i.sliceDoc(n.from,n.to)),e.push(n));if(!t.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(t.push(o.text),e.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:t.join(i.lineBreak),ranges:e,linewise:r}}var la=null;re.copy=re.cut=(i,t)=>{let{text:e,ranges:r,linewise:n}=v0(i.state);if(!e&&!n)return!1;la=n?e:null,t.type==\"cut\"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:\"delete.cut\"});let s=wd?null:t.clipboardData;return s?(s.clearData(),s.setData(\"text/plain\",e),!0):(w0(i,e),!1)};var Pd=Et.define();function Cd(i,t){let e=[];for(let r of i.facet(hd)){let n=r(i,t);n&&e.push(n)}return e?i.update({effects:e,annotations:Pd.of(!0)}):null}function Ad(i){setTimeout(()=>{let t=i.hasFocus;if(t!=i.inputState.notifiedFocused){let e=Cd(i.state,t);e?i.dispatch(e):i.update([])}},10)}ne.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Ad(i)};ne.blur=i=>{i.observer.clearSelectionRange(),Ad(i)};ne.compositionstart=ne.compositionupdate=i=>{i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0)};ne.compositionend=i=>{i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Q.chrome&&Q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50)};ne.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};re.beforeinput=(i,t)=>{var e;let r;if(Q.chrome&&Q.android&&(r=bd.find(n=>n.inputType==t.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key==\"Backspace\"||r.key==\"Delete\")){let n=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return!1};var ku=new Set;function k0(i){ku.has(i)||(ku.add(i),i.addEventListener(\"copy\",()=>{}),i.addEventListener(\"cut\",()=>{}))}var Tu=[\"pre-wrap\",\"normal\",\"pre-line\",\"break-spaces\"],aa=class{constructor(t){this.lineWrapping=t,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let r=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((e-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Tu.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let r=0;r-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=r,this.textHeight=n,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>ys&&(t.heightChanged=!0),this.height=e)}replace(t,e,r){return i.of(r)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,r,n){let s=this,o=r.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=s.lineAt(a,et.ByPosNoHeight,r.setDoc(e),0,0),d=u.to>=h?u:s.lineAt(h,et.ByPosNoHeight,r,0,0);for(c+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,as*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),r+=1+l.break,n-=l.size}else if(s>n*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(n=s&&o(this.blockAt(0,r,n,s))}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ht=class i extends Cs{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,r,n){return new ge(n,this.length,r,this.height,this.breaks)}replace(t,e,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof Ne&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Ne?n=new i(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Vt.of(r)}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:\"\"}${this.widgetHeight?\":\"+this.widgetHeight:\"\"})`}},Ne=class i extends Vt{constructor(t){super(t,0)}heightMetrics(t,e){let r=t.doc.lineAt(e).number,n=t.doc.lineAt(e+this.length).number,s=n-r+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:n,perLine:o,perChar:l}}blockAt(t,e,r,n){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length),f=e.doc.lineAt(h),c=l+f.length*a,u=Math.max(r,t-c/2);return new ge(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((t-r)/l))),{from:f,length:c}=e.doc.line(s+h);return new ge(f,c,r+l*h,l,0)}}lineAt(t,e,r,n,s){if(e==et.ByHeight)return this.blockAt(t,r,n,s);if(e==et.ByPosNoHeight){let{from:d,to:m}=r.doc.lineAt(t);return new ge(d,m-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),h=r.doc.lineAt(t),f=l+h.length*a,c=h.number-o,u=n+l*c+a*(h.from-s-c);return new ge(h.from,h.length,Math.max(n,Math.min(u,n+this.height-f)),f,0)}forEachLine(t,e,r,n,s,o){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(r,s);for(let f=t,c=n;f<=e;){let u=r.doc.lineAt(f);if(f==t){let m=u.number-l;c+=a*m+h*(t-s-m)}let d=a+h*u.length;o(new ge(u.from,u.length,c,d,0)),c+=d,f=u.to+1}}replace(t,e,r){let n=this.length-e;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(t>0){let s=r[0];s instanceof i?r[0]=new i(t+s.length):r.unshift(new i(t-1),null)}return Vt.of(r)}decomposeLeft(t,e){e.push(new i(t-1),null)}decomposeRight(t,e){e.push(null,new i(this.length-t-1))}updateHeight(t,e=0,r=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let o=[],l=Math.max(e,n.from),a=-1;for(n.from>e&&o.push(new i(n.from-e-1).updateHeight(t,e));l<=s&&n.more;){let f=t.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++];a==-1?a=c:Math.abs(c-a)>=ys&&(a=-2);let u=new Ht(f,c);u.outdated=!1,o.push(u),l+=f+1}l<=s&&o.push(null,new i(s-l).updateHeight(t,l));let h=Vt.of(o);return(a<0||Math.abs(h.height-this.height)>=ys||Math.abs(a-this.heightMetrics(t,e).perLine)>=ys)&&(t.heightChanged=!0),h}else(r||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},fa=class extends Vt{constructor(t,e,r){super(t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,e,r,n){let s=r+this.left.height;return tl))return h;let f=e==et.ByPosNoHeight?et.ByPosNoHeight:et.ByPos;return a?h.join(this.right.lineAt(l,f,r,o,l)):this.left.lineAt(l,f,r,n,s).join(h)}forEachLine(t,e,r,n,s,o){let l=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,r,l,a,o);else{let h=this.lineAt(a,et.ByPos,r,n,s);t=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,r,l,a,o)}}replace(t,e,r){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,r));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of r)s.push(l);if(t>0&&Pu(s,o-1),e=r&&e.push(null)),t>r&&this.right.decomposeLeft(t-r,e)}decomposeRight(t,e){let r=this.left.length,n=r+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Vt.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,r=!1,n){let{left:s,right:o}=this,l=e+s.length+this.break,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,r,n):s.updateHeight(t,e,r),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(t,l,r,n):o.updateHeight(t,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?\" \":\"-\")+this.right}};function Pu(i,t){let e,r;i[t]==null&&(e=i[t-1])instanceof Ne&&(r=i[t+1])instanceof Ne&&i.splice(t-1,3,new Ne(e.length+1+r.length))}var T0=5,ca=class i{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let r=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ht?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ht(r-this.pos,-1)),this.writtenTo=r,e>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,r){if(t=T0)&&this.addLineDeco(n,s,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ht(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let r=new Ne(e-t);return this.oracle.doc.lineAt(t).to==e&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ht)return t;let e=new Ht(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+r}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Ht)&&!this.isCovered?this.nodes.push(new Ht(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!=\"visible\"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==i.parentNode?u.bottom:Math.min(a,u.bottom)}h=c.position==\"absolute\"||c.position==\"fixed\"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-e.left,right:Math.max(s,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function A0(i,t){let e=i.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}var qr=class{constructor(t,e,r){this.from=t,this.to=e,this.size=r}static same(t,e){if(t.length!=e.length)return!1;for(let r=0;rtypeof r!=\"function\"&&r.class==\"cm-lineWrapping\");this.heightOracle=new aa(e),this.stateDeco=t.facet(Yr).filter(r=>typeof r!=\"function\"),this.heightMap=Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(t.doc),[new xe(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let r=0;r<=1;r++){let n=r?e.head:e.anchor;if(!t.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);t.push(new Ii(s,o))}}this.viewports=t.sort((r,n)=>r.from-n.from),this.scaler=this.heightMap.height<=7e6?Cu:new pa(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Cr(t,this.scaler))})}update(t,e=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Yr).filter(f=>typeof f!=\"function\");let n=t.changedRanges,s=xe.extendWithRanges(n,P0(r,this.stateDeco,t?t.changes:vt.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=!t.changes.empty||t.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(cd)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,r=window.getComputedStyle(e),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction==\"rtl\"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:v,scaleY:y}=Iu(e,l);(this.scaleX!=v||this.scaleY!=y)&&(this.scaleX=v,this.scaleY=y,h|=8,o=a=!0)}let c=(parseInt(r.paddingTop)||0)*this.scaleY,u=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=zu(t.scrollDOM);let m=(this.printing?A0:C0)(e,this.paddingTop),O=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let v=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(S-this.contentDOMWidth)>n.charWidth){let{lineHeight:y,charWidth:k,textHeight:w}=t.docView.measureTextSize();o=y>0&&n.refresh(s,y,k,w,S/k,v),o&&(t.docView.minWidth=0,h|=8)}O>0&&g>0?f=Math.max(O,g):O<0&&g<0&&(f=Math.min(O,g)),n.heightChanged=!1;for(let y of this.viewports){let k=y.from==this.viewport.from?v:t.docView.measureVisibleLineHeights(y);this.heightMap=(o?Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new xe(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new ha(y.from,k))}n.heightChanged&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ii(n.lineAt(o-r*1e3,et.ByHeight,s,0,0).from,n.lineAt(l+(1-r)*1e3,et.ByHeight,s,0,0).to);if(e){let{head:h}=e.range;if(ha.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,et.ByPos,s,0,0),u;e.y==\"center\"?u=(c.top+c.bottom)/2-f/2:e.y==\"start\"||e.y==\"nearest\"&&h=l+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s>1,o=n<<1;if(this.defaultTextDirection!=G.LTR&&!r)return[];let l=[],a=(h,f,c,u)=>{if(f-hh&&gg.from>=c.from&&g.to<=c.to&&Math.abs(g.from-h)g.fromx));if(!O){if(fg.from<=f&&g.to>=f)){let g=e.moveToLineBoundary(b.cursor(f),!1,!0).head;g>h&&(f=g)}O=new qr(h,f,this.gapSize(c,h,f,u))}l.push(O)};for(let h of this.viewportLines){if(h.lengthh.from&&a(h.from,u,h,f),de.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_.spans(t,this.viewport.from,this.viewport.to,{span(n,s){e.push({from:n,to:s})},point(){}},20);let r=e.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=e[s].from||n.to!=e[s].to);return this.visibleRanges=e,r?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Cr(this.heightMap.lineAt(t,et.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Cr(this.heightMap.lineAt(this.scaler.fromDOM(t),et.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Cr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ii=class{constructor(t,e){this.from=t,this.to=e}};function Q0(i,t,e){let r=[],n=i,s=0;return _.spans(e,i,t,{span(){},point(o,l){o>n&&(r.push({from:n,to:o}),s+=o-n),n=l}},20),n=1)return t[t.length-1].to;let r=Math.floor(i*e);for(let n=0;;n++){let{from:s,to:o}=t[n],l=o-s;if(r<=l)return s+r;r-=l}}function ds(i,t){let e=0;for(let{from:r,to:n}of i.ranges){if(t<=n){e+=t-r;break}e+=n-r}return e/i.total}function R0(i,t){for(let e of i)if(t(e))return e}var Cu={toDOM(i){return i},fromDOM(i){return i},scale:1},pa=class{constructor(t,e,r){let n=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let h=e.lineAt(l,et.ByPos,t,0,0).top,f=e.lineAt(a,et.ByPos,t,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let e=0,r=0,n=0;;e++){let s=eCr(n,t)):i._content)}var ps=A.define({combine:i=>i.join(\" \")}),ma=A.define({combine:i=>i.indexOf(!0)>-1}),ga=Gt.newName(),Qd=Gt.newName(),Rd=Gt.newName(),Md={\"&light\":\".\"+Qd,\"&dark\":\".\"+Rd};function Oa(i,t,e){return new Gt(t,{finish(r){return/&/.test(r)?r.replace(/&\\w*/,n=>{if(n==\"&\")return i;if(!e||!e[n])throw new RangeError(`Unsupported selector: ${n}`);return e[n]}):i+\" \"+r}})}var M0=Oa(\".\"+ga,{\"&\":{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\",minHeight:\"100%\",padding:\"4px 0\",outline:\"none\",\"&[contenteditable=true]\":{WebkitUserModify:\"read-write-plaintext-only\"}},\".cm-lineWrapping\":{whiteSpace_fallback:\"pre-wrap\",whiteSpace:\"break-spaces\",wordBreak:\"break-word\",overflowWrap:\"anywhere\",flexShrink:1},\"&light .cm-content\":{caretColor:\"black\"},\"&dark .cm-content\":{caretColor:\"white\"},\".cm-line\":{display:\"block\",padding:\"0 2px 0 6px\"},\".cm-layer\":{position:\"absolute\",left:0,top:0,contain:\"size style\",\"& > *\":{position:\"absolute\"}},\"&light .cm-selectionBackground\":{background:\"#d9d9d9\"},\"&dark .cm-selectionBackground\":{background:\"#222\"},\"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#d7d4f0\"},\"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#233\"},\".cm-cursorLayer\":{pointerEvents:\"none\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer\":{animation:\"steps(1) cm-blink 1.2s infinite\"},\"@keyframes cm-blink\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\"@keyframes cm-blink2\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\".cm-cursor, .cm-dropCursor\":{borderLeft:\"1.2px solid black\",marginLeft:\"-0.6px\",pointerEvents:\"none\"},\".cm-cursor\":{display:\"none\"},\"&dark .cm-cursor\":{borderLeftColor:\"#444\"},\".cm-dropCursor\":{position:\"absolute\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor\":{display:\"block\"},\".cm-iso\":{unicodeBidi:\"isolate\"},\".cm-announced\":{position:\"fixed\",top:\"-10000px\"},\"@media print\":{\".cm-announced\":{display:\"none\"}},\"&light .cm-activeLine\":{backgroundColor:\"#cceeff44\"},\"&dark .cm-activeLine\":{backgroundColor:\"#99eeff33\"},\"&light .cm-specialChar\":{color:\"red\"},\"&dark .cm-specialChar\":{color:\"#f78\"},\".cm-gutters\":{flexShrink:0,display:\"flex\",height:\"100%\",boxSizing:\"border-box\",insetInlineStart: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,')`,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\"}},Md),Ar=\"\\uFFFF\",xa=class{constructor(t,e){this.points=t,this.text=\"\",this.lineSeparator=e.facet(Y.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Ar}readRange(t,e){if(!t)return this;let r=t.parentNode;for(let n=t;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==e)break;let l=rt.get(n),a=rt.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Au(n))||Au(o)&&(n.nodeName!=\"BR\"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(r,e),this}readTextNode(t){let e=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,e.length));for(let r=0,n=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=n.exec(e))&&(s=l.index,o=l[0].length),this.append(e.slice(r,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(t){if(t.cmIgnore)return;let e=rt.get(t),r=e&&e.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName==\"BR\"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}findPointInside(t,e){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(E0(t,r.node,r.offset)?e:0))}};function E0(i,t,e){for(;;){if(!t||e-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,r,0))){let l=s||o?[]:D0(t),a=new xa(l,t.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=B0(l,this.bounds.from)}else{let l=t.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Zl(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Zl(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=t.viewport;if((Q.ios||Q.chrome)&&t.state.selection.main.empty&&a!=h&&(f.from>0||f.toDate.now()-100?i.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,a=n.from,h=null;(s===8||Q.android&&t.text.length=n.from&&e.to<=n.to&&(e.from!=n.from||e.to!=n.to)&&n.to-n.from-(e.to-e.from)<=4?e={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,e.from).append(e.insert).append(i.state.doc.slice(e.to,n.to))}:(Q.mac||Q.android)&&e&&e.from==e.to&&e.from==n.head-1&&/^\\. ?$/.test(e.insert.toString())&&i.contentDOM.getAttribute(\"autocorrect\")==\"off\"?(r&&e.insert.length==2&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}):Q.chrome&&e&&e.from==e.to&&e.from==n.head&&e.insert.toString()==`\n `&&i.lineWrapping&&(r&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}),e){if(Q.ios&&i.inputState.flushIOSKey()||Q.android&&(e.from==n.from&&e.to==n.to&&e.insert.length==1&&e.insert.lines==2&&zi(i.contentDOM,\"Enter\",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||s==8&&e.insert.lengthn.head)&&zi(i.contentDOM,\"Backspace\",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&zi(i.contentDOM,\"Delete\",46)))return!0;let o=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let l,a=()=>l||(l=$0(i,e,r));return i.state.facet(ad).some(h=>h(i,e.from,e.to,o,a))||i.dispatch(a()),!0}else if(r&&!r.main.eq(n)){let o=!1,l=\"select\";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin==\"select\"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function $0(i,t,e){let r,n=i.state,s=n.selection.main;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&i.inputState.composing<0){let l=s.fromt.to?n.sliceDoc(t.to,s.to):\"\";r=n.replaceSelection(i.state.toText(l+t.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=n.changes(t),a=e&&e.main.to<=l.newLength?e.main:void 0;if(n.selection.ranges.length>1&&i.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let h=i.state.sliceDoc(t.from,t.to),f,c=e&&Od(i,e.main.head);if(c){let m=t.insert.length-(t.to-t.from);f={from:c.from,to:c.to-m}}else f=i.state.doc.lineAt(s.head);let u=s.to-t.to,d=s.to-s.from;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let O=m.to-u,g=O-h.length;if(m.to-m.from!=d||i.state.sliceDoc(g,O)!=h||m.to>=f.from&&m.from<=f.to)return{range:m};let x=n.changes({from:g,to:O,insert:t.insert}),S=m.to-s.to;return{changes:x,range:a?b.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S)):m.map(x)}})}else r={changes:l,selection:a&&n.selection.replaceRange(a)}}let o=\"input.type\";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=\".compose\",i.inputState.compositionFirstChange&&(o+=\".start\",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:o,scrollIntoView:!0})}function q0(i,t,e,r){let n=Math.min(i.length,t.length),s=0;for(;s0&&l>0&&i.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(r==\"end\"){let a=Math.max(0,s-Math.min(o,l));e-=o+a-s}if(o=o?s-e:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-e:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function D0(i){let t=[];if(i.root.activeElement!=i.contentDOM)return t;let{anchorNode:e,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return e&&(t.push(new Qs(e,r)),(n!=e||s!=r)&&t.push(new Qs(n,s))),t}function B0(i,t){if(i.length==0)return null;let e=i[0].pos,r=i.length==2?i[1].pos:e;return e>-1&&r>-1?b.single(e+t,r+t):null}var X0={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Il=Q.ie&&Q.ie_version<=11,ba=class{constructor(t){this.view=t,this.active=!1,this.selectionRange=new Fl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let r of e)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&t.composing)&&e.some(r=>r.type==\"childList\"&&r.removedNodes.length||r.type==\"characterData\"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Il&&(this.onCharData=e=>{this.queue.push({target:e.target,type:\"characterData\",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver==\"function\"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(\"Event\")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(\"Event\"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers(\"scroll\",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,r)=>e!=t[r]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Xs)?r.root.activeElement!=this.dom:!Os(r.dom,n))return;let s=n.anchorNode&&r.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&n.focusNode&&Rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Q.safari&&t.root.nodeType==11&&AO(this.dom.ownerDocument)==this.dom&&L0(this.view)||Ss(t.root);if(!e||this.selectionRange.eq(e))return!1;let r=Os(this.dom,e);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&zi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||t==\"Enter\")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,r=-1,n=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),e==-1?{from:e,to:r}=o:(e=Math.min(o.from,e),r=Math.max(o.to,r)))}return{from:e,to:r,typeOver:n}}readChange(){let{from:t,to:e,typeOver:r}=this.processRecords(),n=this.selectionChanged&&Os(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ya(this.view,t,e,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let r=this.view.state,n=Ed(this.view,e);return this.view.state==r&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type==\"attributes\"),t.type==\"attributes\"&&(e.flags|=4),t.type==\"childList\"){let r=Qu(e,t.previousSibling||t.target.previousSibling,-1),n=Qu(e,t.nextSibling||t.target.nextSibling,1);return{from:r?e.posAfter(r):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}else return t.type==\"characterData\"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener(\"resize\",this.onResize),t.addEventListener(\"beforeprint\",this.onPrint),t.addEventListener(\"scroll\",this.onScroll),t.document.addEventListener(\"selectionchange\",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener(\"scroll\",this.onScroll),t.removeEventListener(\"resize\",this.onResize),t.removeEventListener(\"beforeprint\",this.onPrint),t.document.removeEventListener(\"selectionchange\",this.onSelectionChange)}destroy(){var t,e,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener(\"scroll\",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function Qu(i,t,e){for(;t;){let r=rt.get(t);if(r&&r.parent==i)return r;let n=t.parentNode;t=n!=i.dom?n:e>0?t.nextSibling:t.previousSibling}return null}function L0(i){let t=null;function e(a){a.preventDefault(),a.stopImmediatePropagation(),t=a.getTargetRanges()[0]}if(i.contentDOM.addEventListener(\"beforeinput\",e,!0),i.dom.ownerDocument.execCommand(\"indent\"),i.contentDOM.removeEventListener(\"beforeinput\",e,!0),!t)return null;let r=t.startContainer,n=t.startOffset,s=t.endContainer,o=t.endOffset,l=i.docView.domAtPos(i.state.selection.main.anchor);return Rr(l.node,l.offset,s,o)&&([r,n,s,o]=[s,o,r,n]),{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:o}}var T=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement(\"div\"),this.scrollDOM=document.createElement(\"div\"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=\"cm-scroller\",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(\"div\"),this.announceDOM.className=\"cm-announced\",this.announceDOM.setAttribute(\"aria-live\",\"polite\"),this.dom=document.createElement(\"div\"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(r=>r.forEach(n=>e(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||EO(t.parent)||document,this.viewState=new As(t.state||Y.create(t)),t.scrollTo&&t.scrollTo.is(hs)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Tr).map(r=>new $r(r));for(let r of this.plugins)r.update(this);this.observer=new ba(this),this.inputState=new sa(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ts(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=t.length==1&&t[0]instanceof lt?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.update are not allowed while an update is in progress\");let e=!1,r=!1,n,s=this.state;for(let u of t){if(u.startState!=s)throw new RangeError(\"Trying to update state with a transaction that doesn't start from the previous state.\");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;t.some(u=>u.annotation(Pd))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Cd(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(Y.phrases)!=this.state.facet(Y.phrases))return this.setState(s);n=ks.create(this,s,t),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;c=new Er(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(hs)&&(c=d.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Rs.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(Pr)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(u=>u.isUserEvent(\"select.pointer\")))}finally{this.updateState=0}if(n.startState.facet(ps)!=n.state.facet(ps)&&(this.viewState.mustMeasureContent=!0),(e||r||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(ia))try{u(n)}catch(d){Ct(this.state,d,\"update listener\")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!Ed(this,f)&&h.force&&zi(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.setState are not allowed while an update is in progress\");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new As(t),this.plugins=t.facet(Tr).map(r=>new $r(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Ts(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Tr),r=t.state.facet(Tr);if(e!=r){let n=[];for(let s of r){let o=e.indexOf(s);if(o<0)n.push(new $r(s));else{let l=this.plugins[o];l.mustUpdate=t,n.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(zu(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?\"Measure loop restarted more than 5 times\":\"Viewport failed to stabilize\");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(d=>{try{return d.read(this)}catch(m){return Ct(this.state,m),Ru}}),c=ks.create(this,this.state,[]),u=!1;c.flags|=a,e?e.flags|=a:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c));for(let d=0;d1||m<-1){n=n+m,r.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(ia))l(e)}get themeClasses(){return ga+\" \"+(this.state.facet(ma)?Rd:Qd)+\" \"+this.state.facet(ps)}updateAttrs(){let t=Mu(this,ud,{class:\"cm-editor\"+(this.hasFocus?\" cm-focused \":\" \")+this.themeClasses}),e={spellcheck:\"false\",autocorrect:\"off\",autocapitalize:\"off\",translate:\"no\",contenteditable:this.state.facet(Xs)?\"true\":\"false\",class:\"cm-content\",style:`${Q.tabSize}: ${this.state.tabSize}`,role:\"textbox\",\"aria-multiline\":\"true\"};this.state.readOnly&&(e[\"aria-readonly\"]=\"true\"),Mu(this,Ea,e);let r=this.observer.ignore(()=>{let n=jl(this.contentDOM,this.contentAttrs,e),s=jl(this.dom,this.editorAttrs,t);return n||s});return this.editorAttrs=t,this.contentAttrs=e,r}showAnnouncements(t){let e=!0;for(let r of t)for(let n of r.effects)if(n.is(i.announce)){e&&(this.announceDOM.textContent=\"\"),e=!1;let s=this.announceDOM.appendChild(document.createElement(\"div\"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Pr);let t=this.state.facet(i.cspNonce);Gt.mount(this.root,this.styleModules.concat(M0).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error(\"Reading the editor layout isn't allowed during an update\");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;er.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,r){return Wl(this,t,mu(this,t,e,r))}moveByGroup(t,e){return Wl(this,t,mu(this,t,e,r=>a0(this,t.head,r)))}visualLineSide(t,e){let r=this.bidiSpans(t),n=this.textDirectionAt(t.from),s=r[e?r.length-1:0];return b.cursor(s.side(e,n)+t.from,s.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,r=!0){return l0(this,t,e,r)}moveVertically(t,e,r){return Wl(this,t,h0(this,t,e,r))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),yd(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let r=this.docView.coordsAt(t,e);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n),o=s[Oe.find(s,t-n.from,-1,e)];return Aa(r,o.dir==G.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(fd)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>V0)return id(t.length);let e=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==e&&(s.fresh||ed(s.isolates,r=fu(this,t))))return s.order;r||(r=fu(this,t));let n=ZO(t.text,e,r);return this.bidiCache.push(new Rs(t.from,t.to,e,r,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nu(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return hs.of(new Er(typeof t==\"number\"?b.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return hs.of(new Er(b.cursor(r.from),\"start\",\"start\",r.top-t,e,!0))}static domEventHandlers(t){return ft.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ft.define(()=>({}),{eventObservers:t})}static theme(t,e){let r=Gt.newName(),n=[ps.of(r),Pr.of(Oa(`.${r}`,t))];return e&&e.dark&&n.push(ma.of(!0)),n}static baseTheme(t){return ie.lowest(Pr.of(Oa(\".\"+ga,t,Md)))}static findFromDOM(t){var e;let r=t.querySelector(\".cm-content\"),n=r&&rt.get(r)||rt.get(t);return((e=n?.rootView)===null||e===void 0?void 0:e.view)||null}};T.styleModule=Pr;T.inputHandler=ad;T.focusChangeEffect=hd;T.perLineTextDirection=fd;T.exceptionSink=ld;T.updateListener=ia;T.editable=Xs;T.mouseSelectionStyle=od;T.dragMovesSelection=sd;T.clickAddsSelectionRange=nd;T.decorations=Yr;T.outerDecorations=dd;T.atomicRanges=$a;T.bidiIsolatedRanges=pd;T.scrollMargins=md;T.darkTheme=ma;T.cspNonce=A.define({combine:i=>i.length?i[0]:\"\"});T.contentAttributes=Ea;T.editorAttributes=ud;T.lineWrapping=T.contentAttributes.of({class:\"cm-lineWrapping\"});T.announce=M.define();var V0=4096,Ru={},Rs=class i{constructor(t,e,r,n,s,o){this.from=t,this.to=e,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(t,e){if(e.empty&&!t.some(s=>s.fresh))return t;let r=[],n=t.length?t[t.length-1].dir:G.LTR;for(let s=Math.max(0,t.length-10);s=0;n--){let s=r[n],o=typeof s==\"function\"?s(i):s;o&&Ul(o,e)}return e}var W0=Q.mac?\"mac\":Q.windows?\"win\":Q.linux?\"linux\":\"key\";function I0(i,t){let e=i.split(/-(?!$)/),r=e[e.length-1];r==\"Space\"&&(r=\" \");let n,s,o,l;for(let a=0;ar.concat(n),[]))),e}function qd(i,t,e){return Dd($d(i.state),t,i,e)}var Ie=null,Y0=4e3;function z0(i,t=W0){let e=Object.create(null),r=Object.create(null),n=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error(\"Key binding \"+o+\" is used both as a regular binding and as a multi-stroke prefix\")},s=(o,l,a,h,f)=>{var c,u;let d=e[o]||(e[o]=Object.create(null)),m=l.split(/ (?!$)/).map(x=>I0(x,t));for(let x=1;x{let v=Ie={view:C,prefix:S,scope:o};return setTimeout(()=>{Ie==v&&(Ie=null)},Y0),!0}]})}let O=m.join(\" \");n(O,!1);let g=d[O]||(d[O]={preventDefault:!1,stopPropagation:!1,run:((u=(c=d._any)===null||c===void 0?void 0:c.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),f&&(g.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(\" \"):[\"editor\"];if(o.any)for(let h of l){let f=e[h]||(e[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let c in f)f[c].run.push(o.any)}let a=o[t]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,\"Shift-\"+a,o.shift,o.preventDefault,o.stopPropagation)}return e}function Dd(i,t,e,r){let n=iu(t),s=dt(n,0),o=wt(s)==n.length&&n!=\" \",l=\"\",a=!1,h=!1,f=!1;Ie&&Ie.view==e&&Ie.scope==r&&(l=Ie.prefix+\" \",Sd.indexOf(t.keyCode)<0&&(h=!0,Ie=null));let c=new Set,u=g=>{if(g){for(let x of g.run)if(!c.has(x)&&(c.add(x),x(e,t)))return g.stopPropagation&&(f=!0),!0;g.preventDefault&&(g.stopPropagation&&(f=!0),h=!0)}return!1},d=i[r],m,O;return d&&(u(d[l+ms(n,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Q.windows&&t.ctrlKey&&t.altKey)&&(m=$e[t.keyCode])&&m!=n?(u(d[l+ms(m,t,!0)])||t.shiftKey&&(O=Vi[t.keyCode])!=n&&O!=m&&u(d[l+ms(O,t,!1)]))&&(a=!0):o&&t.shiftKey&&u(d[l+ms(n,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&f&&t.stopPropagation(),a}var zr=class i{constructor(t,e,r,n,s){this.className=t,this.left=e,this.top=r,this.width=n,this.height=s}draw(){let t=document.createElement(\"div\");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+\"px\",t.style.top=this.top+\"px\",this.width!=null&&(t.style.width=this.width+\"px\"),t.style.height=this.height+\"px\"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,r){if(r.empty){let n=t.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let s=Bd(t);return[new i(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}else return Z0(t,e,r)}};function Bd(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==G.LTR?t.left:t.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:t.top-i.scrollDOM.scrollTop*i.scaleY}}function $u(i,t,e){let r=b.cursor(t);return{from:Math.max(e.from,i.moveToLineBoundary(r,!1,!0).from),to:Math.min(e.to,i.moveToLineBoundary(r,!0,!0).from),type:Pt.Text}}function Z0(i,t,e){if(e.to<=i.viewport.from||e.from>=i.viewport.to)return[];let r=Math.max(e.from,i.viewport.from),n=Math.min(e.to,i.viewport.to),s=i.textDirection==G.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=Bd(i),h=o.querySelector(\".cm-line\"),f=h&&window.getComputedStyle(h),c=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),u=l.right-(f?parseInt(f.paddingRight):0),d=na(i,r),m=na(i,n),O=d.type==Pt.Text?d:null,g=m.type==Pt.Text?m:null;if(O&&(i.lineWrapping||d.widgetLineBreaks)&&(O=$u(i,r,O)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=$u(i,n,g)),O&&g&&O.from==g.from)return S(C(e.from,e.to,O));{let y=O?C(e.from,null,O):v(d,!1),k=g?C(null,e.to,g):v(m,!0),w=[];return(O||d).to<(g||m).from-(O&&g?1:0)||d.widgetLineBreaks>1&&y.bottom+i.defaultLineHeight/2D&&N.from=Rt)break;ct>nt&&B(Math.max(Ft,nt),y==null&&Ft<=D,Math.min(ct,Rt),k==null&&ct>=U,Bt.dir)}if(nt=Mt.to+1,nt>=Rt)break}return W.length==0&&B(D,y==null,U,k==null,i.textDirection),{top:q,bottom:L,horizontal:W}}function v(y,k){let w=l.top+(k?y.top:y.bottom);return{top:w,bottom:w,horizontal:[]}}}function F0(i,t){return i.constructor==t.constructor&&i.eq(t)}var Sa=class{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement(\"div\")),this.dom.classList.add(\"cm-layer\"),e.above&&this.dom.classList.add(\"cm-layer-above\"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute(\"aria-hidden\",\"true\"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(bs)!=t.state.facet(bs)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,r=t.facet(bs);for(;e!F0(e,this.drawn[r]))){let e=this.dom.firstChild,r=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[r].constructor&&n.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(n.draw(),e);for(;e;){let n=e.nextSibling;e.remove(),e=n}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},bs=A.define();function Xd(i){return[ft.define(t=>new Sa(t,i)),bs.of(i)]}var Ld=!Q.ios,Zr=A.define({combine(i){return kt(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function Ls(i={}){return[Zr.of(i),_0,G0,H0,cd.of(!0)]}function Vd(i){return i.startState.facet(Zr)!=i.state.facet(Zr)}var _0=Xd({above:!0,markers(i){let{state:t}=i,e=t.facet(Zr),r=[];for(let n of t.selection.ranges){let s=n==t.selection.main;if(n.empty?!s||Ld:e.drawRangeCursor){let o=s?\"cm-cursor cm-cursor-primary\":\"cm-cursor cm-cursor-secondary\",l=n.empty?n:b.cursor(n.head,n.head>n.anchor?-1:1);for(let a of zr.forRange(i,o,l))r.push(a)}}return r},update(i,t){i.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName==\"cm-blink\"?\"cm-blink2\":\"cm-blink\");let e=Vd(i);return e&&qu(i.state,t),i.docChanged||i.selectionSet||e},mount(i,t){qu(t.state,i)},class:\"cm-cursorLayer\"});function qu(i,t){t.style.animationDuration=i.facet(Zr).cursorBlinkRate+\"ms\"}var G0=Xd({above:!1,markers(i){return i.state.selection.ranges.map(t=>t.empty?[]:zr.forRange(i,\"cm-selectionBackground\",t)).reduce((t,e)=>t.concat(e))},update(i,t){return i.docChanged||i.selectionSet||i.viewportChanged||Vd(i)},class:\"cm-selectionLayer\"}),wa={\".cm-line\":{\"& ::selection\":{backgroundColor:\"transparent !important\"},\"&::selection\":{backgroundColor:\"transparent !important\"}}};Ld&&(wa[\".cm-line\"].caretColor=\"transparent !important\",wa[\".cm-content\"]={caretColor:\"transparent !important\"});var H0=ie.highest(T.theme(wa)),Wd=M.define({map(i,t){return i==null?null:t.mapPos(i)}}),Qr=it.define({create(){return null},update(i,t){return i!=null&&(i=t.changes.mapPos(i)),t.effects.reduce((e,r)=>r.is(Wd)?r.value:e,i)}}),U0=ft.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var t;let e=i.state.field(Qr);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(\"div\")),this.cursor.className=\"cm-dropCursor\"),(i.startState.field(Qr)!=e||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,t=i.state.field(Qr),e=t!=null&&i.coordsAtPos(t);if(!e)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:e.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:e.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:e.bottom-e.top}}drawCursor(i){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;i?(this.cursor.style.left=i.left/t+\"px\",this.cursor.style.top=i.top/e+\"px\",this.cursor.style.height=i.height/e+\"px\"):this.cursor.style.left=\"-100000px\"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Qr)!=i&&this.view.dispatch({effects:Wd.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Vs(){return[Qr,U0]}var Aw=/x/.unicode!=null?\"gu\":\"g\";var va=2e3;function j0(i,t,e){let r=Math.min(t.line,e.line),n=Math.max(t.line,e.line),s=[];if(t.off>va||e.off>va||t.col<0||e.col<0){let o=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let a=r;a<=n;a++){let h=i.doc.line(a);h.length<=l&&s.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let a=r;a<=n;a++){let h=i.doc.line(a),f=os(h.text,o,i.tabSize,!0);if(f<0)s.push(b.cursor(h.to));else{let c=os(h.text,l,i.tabSize);s.push(b.range(h.from+f,h.from+c))}}}return s}function K0(i,t){let e=i.coordsAtPos(i.viewport.from);return e?Math.round(Math.abs((e.left-t)/i.defaultCharacterWidth)):-1}function Du(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1),r=i.state.doc.lineAt(e),n=e-r.from,s=n>va?-1:n==r.length?K0(i,t.clientX):We(r.text,i.state.tabSize,e-r.from);return{line:r.number,col:s,off:n}}function J0(i,t){let e=Du(i,t),r=i.state.selection;return e?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(e.line).from),o=n.state.doc.lineAt(s);e={line:o.number,col:e.col,off:Math.min(e.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let l=Du(i,n);if(!l)return r;let a=j0(i.state,e,l);return a.length?o?b.create(a.concat(r.ranges)):b.create(a):r}}:null}function qa(i){let t=i?.eventFilter||(e=>e.altKey&&e.button==0);return T.mouseSelectionStyle.of((e,r)=>t(r)?J0(e,r):null)}var tx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},ex={style:\"cursor: crosshair\"};function Ws(i={}){let[t,e]=tx[i.key||\"Alt\"],r=ft.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==t||e(n))},keyup(n){(n.keyCode==t||!e(n))&&this.set(!1)},mousemove(n){this.set(e(n))}}});return[r,T.contentAttributes.of(n=>{var s;return!((s=n.plugin(r))===null||s===void 0)&&s.isDown?ex:null})]}var kr=\"-10000px\",Ms=class{constructor(t,e,r,n){this.facet=e,this.createTooltipView=r,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(t,e){var r;let n=t.state.facet(this.facet),s=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let o=[],l=e?[]:null;for(let a=0;ae[h]=a),e.length=l.length),this.input=n,this.tooltips=s,this.tooltipViews=o,!0}};function ix(i){let{win:t}=i;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}var Nl=A.define({combine:i=>{var t,e,r;return{position:Q.ios?\"absolute\":((t=i.find(n=>n.position))===null||t===void 0?void 0:t.position)||\"fixed\",parent:((e=i.find(n=>n.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((r=i.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||ix}}}),Bu=new WeakMap,Da=ft.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=i.state.facet(Nl);this.position=t.position,this.parent=t.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==\"function\"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ms(i,Fr,(e,r)=>this.createTooltip(e,r),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==\"function\"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener(\"resize\",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(\"div\"),this.container.style.position=\"relative\",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(i,this.above);t&&this.observeIntersection();let e=t||i.geometryChanged,r=i.state.facet(Nl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(i,t){let e=i.create(this.view),r=t?t.dom:null;if(e.dom.classList.add(\"cm-tooltip\"),i.arrow&&!e.dom.querySelector(\".cm-tooltip > .cm-tooltip-arrow\")){let n=document.createElement(\"div\");n.className=\"cm-tooltip-arrow\",e.dom.insertBefore(n,r)}return e.dom.style.position=this.position,e.dom.style.top=kr,e.dom.style.left=\"0px\",this.container.insertBefore(e.dom,r),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var i,t,e;this.view.win.removeEventListener(\"resize\",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),t=1,e=1,r=!1;if(this.position==\"fixed\"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Q.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==kr&&n.style.left==\"0px\"){let s=n.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position==\"absolute\")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((n,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Nl).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:r}}writeMeasure(i){var t;if(i.makeAbsolute){this.madeAbsolute=!0,this.position=\"absolute\";for(let l of this.manager.tooltipViews)l.dom.style.position=\"absolute\"}let{editor:e,space:r,scaleX:n,scaleY:s}=i,o=[];for(let l=0;l=Math.min(e.bottom,r.bottom)||c.rightMath.min(e.right,r.right)+.1){f.style.top=kr;continue}let d=a.arrow?h.dom.querySelector(\".cm-tooltip-arrow\"):null,m=d?7:0,O=u.right-u.left,g=(t=Bu.get(h))!==null&&t!==void 0?t:u.bottom-u.top,x=h.offset||nx,S=this.view.textDirection==G.LTR,C=u.width>r.right-r.left?S?r.left:r.right-u.width:S?Math.min(c.left-(d?14:0)+x.x,r.right-O):Math.max(r.left,c.left-O+(d?14:0)-x.x),v=this.above[l];!a.strictSide&&(v?c.top-(u.bottom-u.top)-x.yr.bottom)&&v==r.bottom-c.bottom>c.top-r.top&&(v=this.above[l]=!v);let y=(v?c.top-r.top:r.bottom-c.bottom)-m;if(yC&&q.topk&&(k=v?q.top-g-2-m:q.bottom+m+2);if(this.position==\"absolute\"?(f.style.top=(k-i.parent.top)/s+\"px\",f.style.left=(C-i.parent.left)/n+\"px\"):(f.style.top=k/s+\"px\",f.style.left=C/n+\"px\"),d){let q=c.left+(S?x.x:-x.x)-(C+14-7);d.style.left=q/n+\"px\"}h.overlap!==!0&&o.push({left:C,top:k,right:w,bottom:k+g}),f.classList.toggle(\"cm-tooltip-above\",v),f.classList.toggle(\"cm-tooltip-below\",!v),h.positioned&&h.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=kr}},{eventObservers:{scroll(){this.maybeMeasure()}}}),rx=T.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:\"7px\",width:`${7*2}px`,position:\"absolute\",zIndex:-1,overflow:\"hidden\",\"&:before, &:after\":{content:\"''\",position:\"absolute\",width:0,height:0,borderLeft:\"7px solid transparent\",borderRight:\"7px solid transparent\"},\".cm-tooltip-above &\":{bottom:\"-7px\",\"&:before\":{borderTop:\"7px solid #bbb\"},\"&:after\":{borderTop:\"7px solid #f5f5f5\",bottom:\"1px\"}},\".cm-tooltip-below &\":{top:\"-7px\",\"&:before\":{borderBottom:\"7px solid #bbb\"},\"&:after\":{borderBottom:\"7px solid #f5f5f5\",top:\"1px\"}}},\"&dark .cm-tooltip .cm-tooltip-arrow\":{\"&:before\":{borderTopColor:\"#333338\",borderBottomColor:\"#333338\"},\"&:after\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"}}}),nx={x:0,y:0},Fr=A.define({enables:[Da,rx]}),Es=A.define({combine:i=>i.reduce((t,e)=>t.concat(e),[])}),$s=class i{static create(t){return new i(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement(\"div\"),this.dom.classList.add(\"cm-tooltip-hover\"),this.manager=new Ms(t,Es,(e,r)=>this.createHostedView(e,r),e=>e.dom.remove())}createHostedView(t,e){let r=t.create(this.view);return r.dom.classList.add(\"cm-tooltip-section\"),this.dom.insertBefore(r.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let r of this.manager.tooltipViews){let n=r[t];if(n!==void 0){if(e===void 0)e=n;else if(e!==n)return}}return e}get offset(){return this.passProp(\"offset\")}get getCoords(){return this.passProp(\"getCoords\")}get overlap(){return this.passProp(\"overlap\")}get resize(){return this.passProp(\"resize\")}},sx=Fr.compute([Es],i=>{let t=i.facet(Es);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var r;return(r=e.end)!==null&&r!==void 0?r:e.pos})),create:$s.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),ka=class{constructor(t,e,r,n,s){this.view=t,this.source=e,this.field=r,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener(\"mouseleave\",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener(\"mousemove\",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;tl.bottom||e.xl.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(n)).find(f=>f.from<=n&&f.to>=n),h=a&&a.dir==G.RTL?-1:1;s=e.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Ct(t.state,a,\"hover tooltip\"))}else o&&!(Array.isArray(o)&&!o.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(Da),e=t?t.manager.tooltips.findIndex(r=>r.create==$s.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!ox(s.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,l=(r=(e=n[0])===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!lx(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=r=>{t.removeEventListener(\"mouseleave\",e),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener(\"mouseleave\",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener(\"mouseleave\",this.mouseleave),this.view.dom.removeEventListener(\"mousemove\",this.mousemove)}},gs=4;function ox(i,t){let e=i.getBoundingClientRect();return t.clientX>=e.left-gs&&t.clientX<=e.right+gs&&t.clientY>=e.top-gs&&t.clientY<=e.bottom+gs}function lx(i,t,e,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),l=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.rightn||Math.min(o.bottom,l)=t&&a<=e}function Id(i,t={}){let e=M.define(),r=it.define({create(){return[]},update(n,s){if(n.length&&(t.hideOnChange&&(s.docChanged||s.selection)?n=[]:t.hideOn&&(n=n.filter(o=>!t.hideOn(s,o))),s.docChanged)){let o=[];for(let l of n){let a=s.changes.mapPos(l.pos,-1,ut.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=s.changes.mapPos(h.end)),o.push(h)}}n=o}for(let o of s.effects)o.is(e)&&(n=o.value),o.is(ax)&&(n=[]);return n},provide:n=>Es.from(n)});return[r,ft.define(n=>new ka(n,i,r,e,t.hoverTime||300)),sx]}function Ba(i,t){let e=i.plugin(Da);if(!e)return null;let r=e.manager.tooltips.indexOf(t);return r<0?null:e.manager.tooltipViews[r]}var ax=M.define();var Xu=A.define({combine(i){let t,e;for(let r of i)t=t||r.topContainer,e=e||r.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ci(i,t){let e=i.plugin(Nd),r=e?e.specs.indexOf(t):-1;return r>-1?e.panels[r]:null}var Nd=ft.fromClass(class{constructor(i){this.input=i.state.facet(fi),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(i));let t=i.state.facet(Xu);this.top=new Ni(i,!0,t.topContainer),this.bottom=new Ni(i,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(\"cm-panel\"),e.mount&&e.mount()}update(i){let t=i.state.facet(Xu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ni(i.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ni(i.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=i.state.facet(fi);if(e!=this.input){let r=e.filter(a=>a),n=[],s=[],o=[],l=[];for(let a of r){let h=this.specs.indexOf(a),f;h<0?(f=a(i.view),l.push(f)):(f=this.panels[h],f.update&&f.update(i)),n.push(f),(f.top?s:o).push(f)}this.specs=r,this.panels=n,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add(\"cm-panel\"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})}),Ni=class{constructor(t,e,r){this.view=t,this.top=e,this.container=r,this.dom=void 0,this.classes=\"\",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement(\"div\"),this.dom.className=this.top?\"cm-panels cm-panels-top\":\"cm-panels cm-panels-bottom\",this.dom.style[this.top?\"top\":\"bottom\"]=\"0\";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Lu(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Lu(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(\" \"))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(\" \"))t&&this.container.classList.add(t)}}};function Lu(i){let t=i.nextSibling;return i.remove(),t}var fi=A.define({enables:Nd}),se=class extends ee{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}};se.prototype.elementClass=\"\";se.prototype.toDOM=void 0;se.prototype.mapMode=ut.TrackBefore;se.prototype.startSide=se.prototype.endSide=-1;se.prototype.point=!0;var Yl=A.define(),hx={class:\"\",renderEmptyElements:!1,elementStyle:\"\",markers:()=>_.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Dr=A.define();function _r(i){return[Yd(),Dr.of(Object.assign(Object.assign({},hx),i))]}var Ta=A.define({combine:i=>i.some(t=>t)});function Yd(i){let t=[fx];return i&&i.fixed===!1&&t.push(Ta.of(!0)),t}var fx=ft.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutters\",this.dom.setAttribute(\"aria-hidden\",\"true\"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+\"px\",this.gutters=i.state.facet(Dr).map(t=>new qs(i,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!i.state.facet(Ta),this.fixed&&(this.dom.style.position=\"sticky\"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let t=this.prevViewport,e=i.view.viewport,r=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(r<(e.to-e.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+\"px\"),this.view.state.facet(Ta)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?\"sticky\":\"\"),this.prevViewport=i.view.viewport}syncGutters(i){let t=this.dom.nextSibling;i&&this.dom.remove();let e=_.iter(this.view.state.facet(Yl),this.view.viewport.from),r=[],n=this.gutters.map(s=>new Ca(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Pt.Text&&o){Pa(e,r,l.from);for(let a of n)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of n)a.widget(this.view,l)}else if(s.type==Pt.Text){Pa(e,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(i){let t=i.startState.facet(Dr),e=i.state.facet(Dr),r=i.docChanged||i.heightChanged||i.viewportChanged||!_.eq(i.startState.facet(Yl),i.state.facet(Yl),i.view.viewport.from,i.view.viewport.to);if(t==e)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of e){let o=t.indexOf(s);o<0?n.push(new qs(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==G.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Vu(i){return Array.isArray(i)?i:[i]}function Pa(i,t,e){for(;i.value&&i.from<=e;)i.from==e&&t.push(i.value),i.next()}var Ca=class{constructor(t,e,r){this.gutter=t,this.height=r,this.i=0,this.cursor=_.iter(t.markers,e.from)}addElement(t,e,r){let{gutter:n}=this,s=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==n.elements.length){let l=new Ds(t,o,s,r);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,o,s,r);this.height=e.bottom,this.i++}line(t,e,r){let n=[];Pa(this.cursor,n,e.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(t,e,n)}widget(t,e){let r=this.gutter.config.widgetMarker(t,e.widget,e);r&&this.addElement(t,e,[r])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}},qs=class{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutter\"+(this.config.class?\" \"+this.config.class:\"\");for(let r in e.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=n.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[r](t,l,n)&&n.preventDefault()});this.markers=Vu(e.markers(t)),e.initialSpacer&&(this.spacer=new Ds(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=\"visibility: hidden; pointer-events: none\")}update(t){let e=this.markers;if(this.markers=Vu(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}let r=t.view.viewport;return!_.eq(this.markers,e,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}},Ds=class{constructor(t,e,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutterElement\",this.update(t,e,r,n)}update(t,e,r,n){this.height!=e&&(this.height=e,this.dom.style.height=e+\"px\"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+\"px\":\"\"),cx(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let r=\"cm-gutterElement\",n=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,h)||o(l,a,h):o}return r}})}}),Br=class extends se{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}};function zl(i,t){return i.state.facet(Yi).formatNumber(t,i.state)}var dx=Dr.compute([Yi],i=>({class:\"cm-lineNumbers\",renderEmptyElements:!1,markers(t){return t.state.facet(ux)},lineMarker(t,e,r){return r.some(n=>n.toDOM)?null:new Br(zl(t,t.state.doc.lineAt(e.from).number))},widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Yi)!=t.state.facet(Yi),initialSpacer(t){return new Br(zl(t,Wu(t.state.doc.lines)))},updateSpacer(t,e){let r=zl(e.view,Wu(e.view.state.doc.lines));return r==t.number?t:new Br(r)},domEventHandlers:i.facet(Yi).domEventHandlers}));function ui(i={}){return[Yi.of(i),Yd(),dx]}function Wu(i){let t=9;for(;t{throw new Error(\"This node type doesn't define a deserialize function\")})}add(t){if(this.perNode)throw new RangeError(\"Can't add per-node props to node types\");return typeof t!=\"function\"&&(t=bt.match(t)),e=>{let r=t(e);return r===void 0?null:[this,r]}}};E.closedBy=new E({deserialize:i=>i.split(\" \")});E.openedBy=new E({deserialize:i=>i.split(\" \")});E.group=new E({deserialize:i=>i.split(\" \")});E.isolate=new E({deserialize:i=>{if(i&&i!=\"rtl\"&&i!=\"ltr\"&&i!=\"auto\")throw new RangeError(\"Invalid value for isolate: \"+i);return i||\"auto\"}});E.contextHash=new E({perNode:!0});E.lookAhead=new E({perNode:!0});E.mounted=new E({perNode:!0});var Fi=class{constructor(t,e,r){this.tree=t,this.overlay=e,this.parser=r}static get(t){return t&&t.props&&t.props[E.mounted.id]}},mx=Object.create(null),bt=class i{constructor(t,e,r,n=0){this.name=t,this.props=e,this.id=r,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):mx,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new i(t.name||\"\",e,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError(\"Can't store a per-node prop on a node type\");e[s[0].id]=s[1]}}return n}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t==\"string\"){if(this.name==t)return!0;let e=this.prop(E.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let r in t)for(let n of r.split(\" \"))e[n]=t[r];return r=>{for(let n=r.prop(E.group),s=-1;s<(n?n.length:0);s++){let o=e[s<0?r.name:n[s]];if(o)return o}}}};bt.none=new bt(\"\",Object.create(null),0,8);var Hr=class i{constructor(t){this.types=t;for(let e=0;e0;for(let a=this.cursor(o|st.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ya(bt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,r,n)=>new i(this.type,e,r,n,this.propValues),t.makeTree||((e,r,n)=>new i(bt.none,e,r,n)))}static build(t){return Ox(t)}};ot.empty=new ot(bt.none,[],[],0);var Xa=class i{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},_e=class i{constructor(t,e,r){this.buffer=t,this.length=e,this.set=r}get type(){return bt.none}toString(){let t=[];for(let e=0;e0));a=o[a+3]);return l}slice(t,e,r){let n=this.buffer,s=new Uint16Array(e-t),o=0;for(let l=t,a=0;l=t&&et;case 1:return e<=t&&r>t;case 2:return r>t;case 4:return!0}}function Ur(i,t,e,r){for(var n;i.from==i.to||(e<1?i.from>=t:i.from>t)||(e>-1?i.to<=t:i.to0?l.length:-1;t!=h;t+=e){let f=l[t],c=a[t]+o.from;if(_d(n,r,c,c+f.length)){if(f instanceof _e){if(s&st.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,e,r-c,n);if(u>-1)return new di(new Va(o,f,t,c),null,u)}else if(s&st.IncludeAnonymous||!f.type.isAnonymous||Na(f)){let u;if(!(s&st.IgnoreMounts)&&(u=Fi.get(f))&&!u.overlay)return new i(u.tree,c,t,o);let d=new i(f,c,t,o);return s&st.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(e<0?f.children.length-1:0,e,r,n)}}}if(s&st.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,r=0){let n;if(!(r&st.IgnoreOverlays)&&(n=Fi.get(this._tree))&&n.overlay){let s=t-this.from;for(let{from:o,to:l}of n.overlay)if((e>0?o<=s:o=s:l>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Zd(i,t,e,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(t)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function La(i,t,e=t.length-1){for(let r=i.parent;e>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[e]&&t[e]!=r.name)return!1;e--}}return!0}var Va=class{constructor(t,e,r,n){this.parent=t,this.buffer=e,this.index=r,this.start=n}},di=class i extends Ys{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,r){super(),this.context=t,this._parent=e,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,e,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,r);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,r=0){if(r&st.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new i(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new i(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];t.push(r.slice(n,s,o)),e.push(0)}return new ot(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Gd(i){if(!i.length)return null;let t=0,e=i[0];for(let s=1;se.from||o.to=t){let l=new jt(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(Ur(l,t,e,!1))}}return n?Gd(n):r}var jr=class{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof jt)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:r,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=r+n.buffer[t+1],this.to=r+n.buffer[t+2],!0}yield(t){return t?t instanceof jt?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,r=this.mode){return this.buffer?r&st.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,r=this.stack.length-1;if(t<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(r<0?e.buffer.length:e.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,r,{buffer:n}=this;if(n){if(t>0){if(this.index-1)for(let s=e+t,o=t<0?-1:r._tree.children.length;s!=o;s+=t){let l=r._tree.children[s];if(this.mode&st.IncludeAnonymous||l instanceof _e||!l.type.isAnonymous||Na(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,r=s+1;break t}n=this.stack[--s]}for(let n=r;n=0;s--){if(s<0)return La(this.node,t,n);let o=r[e.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};function Na(i){return i.children.some(t=>t instanceof _e||!t.type.isAnonymous||Na(t))}function Ox(i){var t;let{buffer:e,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,l=Array.isArray(e)?new Xa(e,e.length):e,a=r.types,h=0,f=0;function c(y,k,w,q,L,W){let{id:B,start:D,end:U,size:N}=l,nt=f;for(;N<0;)if(l.next(),N==-1){let ct=s[B];w.push(ct),q.push(D-y);return}else if(N==-3){h=B;return}else if(N==-4){f=B;return}else throw new RangeError(`Unrecognized record size: ${N}`);let Rt=a[B],Mt,Bt,Ft=D-y;if(U-D<=n&&(Bt=g(l.pos-k,L))){let ct=new Uint16Array(Bt.size-Bt.skip),_t=l.pos-Bt.size,de=ct.length;for(;l.pos>_t;)de=x(Bt.start,ct,de);Mt=new _e(ct,U-Bt.start,r),Ft=Bt.start-y}else{let ct=l.pos-N;l.next();let _t=[],de=[],ri=B>=o?B:-1,Ei=0,Un=U;for(;l.pos>ct;)ri>=0&&l.id==ri&&l.size>=0?(l.end<=Un-n&&(m(_t,de,D,Ei,l.end,Un,ri,nt),Ei=_t.length,Un=l.end),l.next()):W>2500?u(D,ct,_t,de):c(D,ct,_t,de,ri,W+1);if(ri>=0&&Ei>0&&Ei<_t.length&&m(_t,de,D,Ei,D,Un,ri,nt),_t.reverse(),de.reverse(),ri>-1&&Ei>0){let Mc=d(Rt);Mt=Ya(Rt,_t,de,0,_t.length,0,U-D,Mc,Mc)}else Mt=O(Rt,_t,de,U-D,nt-U)}w.push(Mt),q.push(Ft)}function u(y,k,w,q){let L=[],W=0,B=-1;for(;l.pos>k;){let{id:D,start:U,end:N,size:nt}=l;if(nt>4)l.next();else{if(B>-1&&U=0;N-=3)D[nt++]=L[N],D[nt++]=L[N+1]-U,D[nt++]=L[N+2]-U,D[nt++]=nt;w.push(new _e(D,L[2]-U,r)),q.push(U-y)}}function d(y){return(k,w,q)=>{let L=0,W=k.length-1,B,D;if(W>=0&&(B=k[W])instanceof ot){if(!W&&B.type==y&&B.length==q)return B;(D=B.prop(E.lookAhead))&&(L=w[W]+B.length+D)}return O(y,k,w,q,L)}}function m(y,k,w,q,L,W,B,D){let U=[],N=[];for(;y.length>q;)U.push(y.pop()),N.push(k.pop()+w-L);y.push(O(r.types[B],U,N,W-L,D-W)),k.push(L-w)}function O(y,k,w,q,L=0,W){if(h){let B=[E.contextHash,h];W=W?[B].concat(W):[B]}if(L>25){let B=[E.lookAhead,L];W=W?[B].concat(W):[B]}return new ot(y,k,w,q,W)}function g(y,k){let w=l.fork(),q=0,L=0,W=0,B=w.end-n,D={size:0,start:0,skip:0};t:for(let U=w.pos-y;w.pos>U;){let N=w.size;if(w.id==k&&N>=0){D.size=q,D.start=L,D.skip=W,W+=4,q+=4,w.next();continue}let nt=w.pos-N;if(N<0||nt=o?4:0,Mt=w.start;for(w.next();w.pos>nt;){if(w.size<0)if(w.size==-3)Rt+=4;else break t;else w.id>=o&&(Rt+=4);w.next()}L=Mt,q+=N,W+=Rt}return(k<0||q==y)&&(D.size=q,D.start=L,D.skip=W),D.size>4?D:void 0}function x(y,k,w){let{id:q,start:L,end:W,size:B}=l;if(l.next(),B>=0&&q4){let U=l.pos-(B-4);for(;l.pos>U;)w=x(y,k,w)}k[--w]=D,k[--w]=W-y,k[--w]=L-y,k[--w]=q}else B==-3?h=q:B==-4&&(f=q);return w}let S=[],C=[];for(;l.pos>0;)c(i.start||0,i.bufferStart||0,S,C,-1,0);let v=(t=i.length)!==null&&t!==void 0?t:S.length?C[0]+S[0].length:0;return new ot(a[i.topID],S.reverse(),C.reverse(),v)}var Fd=new WeakMap;function Ns(i,t){if(!i.isAnonymous||t instanceof _e||t.type!=i)return 1;let e=Fd.get(t);if(e==null){e=1;for(let r of t.children){if(r.type!=i||!(r instanceof ot)){e=1;break}e+=Ns(i,r)}Fd.set(t,e)}return e}function Ya(i,t,e,r,n,s,o,l,a){let h=0;for(let m=r;m=f)break;k+=w}if(C==v+1){if(k>f){let w=m[v];d(w.children,w.positions,0,w.children.length,O[v]+S);continue}c.push(m[v])}else{let w=O[C-1]+m[C-1].length-y;c.push(Ya(i,m,O,v,C,y,w,null,a))}u.push(y+S-s)}}return d(t,e,r,n,0),(l||a)(c,u,o)}var zs=class{constructor(){this.map=new WeakMap}setBuffer(t,e,r){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,r)}getBuffer(t,e){let r=this.map.get(t);return r&&r.get(e)}set(t,e){t instanceof di?this.setBuffer(t.context.buffer,t.index,e):t instanceof jt&&this.map.set(t.tree,e)}get(t){return t instanceof di?this.getBuffer(t.context.buffer,t.index):t instanceof jt?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},pi=class i{constructor(t,e,r,n,s=!1,o=!1){this.from=t,this.to=e,this.tree=r,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],r=!1){let n=[new i(0,t.length,t,0,!1,r)];for(let s of e)s.to>t.length&&n.push(s);return n}static applyChanges(t,e,r=128){if(!e.length)return t;let n=[],s=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let f=l=r)for(;o&&o.from=u.from||c<=u.to||h){let d=Math.max(u.from,a)-h,m=Math.min(u.to,c)-h;u=d>=m?null:new i(d,m,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=snew Gr(n.from,n.to)):[new Gr(0,0)]:[new Gr(0,t.length)],this.createParse(t,e||[],r)}parse(t,e,r){let n=this.startParse(t,e,r);for(;;){let s=n.advance();if(s)return s}}},Ia=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};var Dw=new E({perNode:!0});var xx=0,we=class i{constructor(t,e,r){this.set=t,this.base=e,this.modified=r,this.id=xx++}static define(t){if(t?.base)throw new Error(\"Can not derive from a modified tag\");let e=new i([],null,[]);if(e.set.push(e),t)for(let r of t.set)e.set.push(r);return e}static defineModifier(){let t=new Gs;return e=>e.modified.indexOf(t)>-1?e:Gs.get(e.base||e,e.modified.concat(t).sort((r,n)=>r.id-n.id))}},yx=0,Gs=class i{constructor(){this.instances=[],this.id=yx++}static get(t,e){if(!e.length)return t;let r=e[0].instances.find(l=>l.base==t&&bx(e,l.modified));if(r)return r;let n=[],s=new we(n,t,e);for(let l of e)l.instances.push(s);let o=Sx(e);for(let l of t.set)if(!l.modified.length)for(let a of o)n.push(i.get(l,a));return s}};function bx(i,t){return i.length==t.length&&i.every((e,r)=>e==t[r])}function Sx(i){let t=[[]];for(let e=0;er.length-e.length)}function Hs(i){let t=Object.create(null);for(let e in i){let r=i[e];Array.isArray(r)||(r=[r]);for(let n of e.split(\" \"))if(n){let s=[],o=2,l=n;for(let c=0;;){if(l==\"...\"&&c>0&&c+3==n.length){o=1;break}let u=/^\"(?:[^\"\\\\]|\\\\.)*?\"|[^\\/!]+/.exec(l);if(!u)throw new RangeError(\"Invalid path: \"+n);if(s.push(u[0]==\"*\"?\"\":u[0][0]=='\"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let d=n[c++];if(c==n.length&&d==\"!\"){o=0;break}if(d!=\"/\")throw new RangeError(\"Invalid path: \"+n);l=n.slice(c)}let a=s.length-1,h=s[a];if(!h)throw new RangeError(\"Invalid path: \"+n);let f=new Gi(r,o,a>0?s.slice(0,a):null);t[h]=f.sort(t[h])}}return jd.add(t)}var jd=new E,Gi=class{constructor(t,e,r,n){this.tags=t,this.mode=e,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=n;for(let l of s)for(let a of l.set){let h=e[a.id];if(h){o=o?o+\" \"+h:h;break}}return o},scope:r}}function wx(i,t){let e=null;for(let r of i){let n=r.style(t);n&&(e=e?e+\" \"+n:n)}return e}function Kd(i,t,e,r=0,n=i.length){let s=new Za(r,Array.isArray(t)?t:[t],e);s.highlightRange(i.cursor(),r,n,\"\",s.highlighters),s.flush(n)}var Za=class{constructor(t,e,r){this.at=t,this.highlighters=e,this.span=r,this.class=\"\"}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,r,n,s){let{type:o,from:l,to:a}=t;if(l>=r||a<=e)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,f=vx(t)||Gi.empty,c=wx(s,f.tags);if(c&&(h&&(h+=\" \"),h+=c,f.mode==1&&(n+=(n?\" \":\"\")+c)),this.startSpan(Math.max(e,l),h),f.opaque)return;let u=t.tree&&t.tree.prop(E.mounted);if(u&&u.overlay){let d=t.node.enter(u.overlay[0].from+l,1),m=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),O=t.firstChild();for(let g=0,x=l;;g++){let S=g=C||!t.nextSibling())););if(!S||C>r)break;x=S.to+l,x>e&&(this.highlightRange(d.cursor(),Math.max(e,S.from+l),Math.min(r,x),\"\",m),this.startSpan(Math.min(r,x),h))}O&&t.parent()}else if(t.firstChild()){u&&(n=\"\");do if(!(t.to<=e)){if(t.from>=r)break;this.highlightRange(t,e,r,n,s),this.startSpan(Math.min(r,t.to),h)}while(t.nextSibling());t.parent()}}};function vx(i){let t=i.type.prop(jd);for(;t&&t.context&&!i.matchContext(t.context);)t=t.next;return t||null}var P=we.define,Zs=P(),Ge=P(),Hd=P(Ge),Ud=P(Ge),He=P(),Fs=P(He),za=P(He),Se=P(),mi=P(Se),ye=P(),be=P(),Fa=P(),Kr=P(Fa),_s=P(),p={comment:Zs,lineComment:P(Zs),blockComment:P(Zs),docComment:P(Zs),name:Ge,variableName:P(Ge),typeName:Hd,tagName:P(Hd),propertyName:Ud,attributeName:P(Ud),className:P(Ge),labelName:P(Ge),namespace:P(Ge),macroName:P(Ge),literal:He,string:Fs,docString:P(Fs),character:P(Fs),attributeValue:P(Fs),number:za,integer:P(za),float:P(za),bool:P(He),regexp:P(He),escape:P(He),color:P(He),url:P(He),keyword:ye,self:P(ye),null:P(ye),atom:P(ye),unit:P(ye),modifier:P(ye),operatorKeyword:P(ye),controlKeyword:P(ye),definitionKeyword:P(ye),moduleKeyword:P(ye),operator:be,derefOperator:P(be),arithmeticOperator:P(be),logicOperator:P(be),bitwiseOperator:P(be),compareOperator:P(be),updateOperator:P(be),definitionOperator:P(be),typeOperator:P(be),controlOperator:P(be),punctuation:Fa,separator:P(Fa),bracket:Kr,angleBracket:P(Kr),squareBracket:P(Kr),paren:P(Kr),brace:P(Kr),content:Se,heading:mi,heading1:P(mi),heading2:P(mi),heading3:P(mi),heading4:P(mi),heading5:P(mi),heading6:P(mi),contentSeparator:P(Se),list:P(Se),quote:P(Se),emphasis:P(Se),strong:P(Se),link:P(Se),monospace:P(Se),strikethrough:P(Se),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:_s,documentMeta:P(_s),annotation:P(_s),processingInstruction:P(_s),definition:we.defineModifier(),constant:we.defineModifier(),function:we.defineModifier(),standard:we.defineModifier(),local:we.defineModifier(),special:we.defineModifier()},Lw=_a([{tag:p.link,class:\"tok-link\"},{tag:p.heading,class:\"tok-heading\"},{tag:p.emphasis,class:\"tok-emphasis\"},{tag:p.strong,class:\"tok-strong\"},{tag:p.keyword,class:\"tok-keyword\"},{tag:p.atom,class:\"tok-atom\"},{tag:p.bool,class:\"tok-bool\"},{tag:p.url,class:\"tok-url\"},{tag:p.labelName,class:\"tok-labelName\"},{tag:p.inserted,class:\"tok-inserted\"},{tag:p.deleted,class:\"tok-deleted\"},{tag:p.literal,class:\"tok-literal\"},{tag:p.string,class:\"tok-string\"},{tag:p.number,class:\"tok-number\"},{tag:[p.regexp,p.escape,p.special(p.string)],class:\"tok-string2\"},{tag:p.variableName,class:\"tok-variableName\"},{tag:p.local(p.variableName),class:\"tok-variableName tok-local\"},{tag:p.definition(p.variableName),class:\"tok-variableName tok-definition\"},{tag:p.special(p.variableName),class:\"tok-variableName2\"},{tag:p.definition(p.propertyName),class:\"tok-propertyName tok-definition\"},{tag:p.typeName,class:\"tok-typeName\"},{tag:p.namespace,class:\"tok-namespace\"},{tag:p.className,class:\"tok-className\"},{tag:p.macroName,class:\"tok-macroName\"},{tag:p.propertyName,class:\"tok-propertyName\"},{tag:p.operator,class:\"tok-operator\"},{tag:p.comment,class:\"tok-comment\"},{tag:p.meta,class:\"tok-meta\"},{tag:p.invalid,class:\"tok-invalid\"},{tag:p.punctuation,class:\"tok-punctuation\"}]);var Ga,Hi=new E;function kx(i){return A.define({combine:i?t=>t.concat(i):void 0})}var Tx=new E,Wt=class{constructor(t,e,r=[],n=\"\"){this.data=t,this.name=n,Y.prototype.hasOwnProperty(\"tree\")||Object.defineProperty(Y.prototype,\"tree\",{get(){return pt(this)}}),this.parser=e,this.extension=[Ui.of(this),Y.languageData.of((s,o,l)=>{let a=Jd(s,o,l),h=a.type.prop(Hi);if(!h)return[];let f=s.facet(h),c=a.type.prop(Tx);if(c){let u=a.resolve(o-a.from,l);for(let d of c)if(d.test(u,s)){let m=s.facet(d.facet);return d.type==\"replace\"?m:m.concat(f)}}return f})].concat(r)}isActiveAt(t,e,r=-1){return Jd(t,e,r).type.prop(Hi)==this.data}findRegions(t){let e=t.facet(Ui);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(Hi)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(E.mounted);if(l){if(l.tree.prop(Hi)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(n(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?e:void 0)]}),t.name)}configure(t,e){return new i(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function pt(i){let t=i.field(Wt.state,!1);return t?t.tree:ot.empty}var Ka=class{constructor(t){this.doc=t,this.cursorPos=0,this.string=\"\",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let r=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-r,e-r)}},Jr=null,Ja=class i{constructor(t,e,r=[],n,s,o,l,a){this.parser=t,this.state=e,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,r){return new i(t,e,[],ot.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Ka(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=ot.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t==\"number\"){let n=Date.now()+t;t=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(pi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Jr;Jr=this;try{return t()}finally{Jr=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=tp(t,e.from,e.to);return t}changes(t,e){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),r=pi.applyChanges(r,a),n=ot.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=t.mapPos(h.from,1),c=t.mapPos(h.to,-1);ft.from&&(this.fragments=tp(this.fragments,n,s),this.skipped.splice(r--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends _i{createParse(e,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let a=Jr;if(a){for(let h of n)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new ot(bt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Jr}};function tp(i,t,e){return pi.applyChanges(i,[{fromA:t,toA:e,fromB:t,toB:e}])}var tn=class i{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,r)||e.takeTree(),new i(e)}static init(t){let e=Math.min(3e3,t.doc.length),r=Ja.create(t.facet(Ui).parser,t,{from:0,to:e});return r.work(20,e)||r.takeTree(),new i(r)}};Wt.state=it.define({create:tn.init,update(i,t){for(let e of t.effects)if(e.is(Wt.setState))return e.value;return t.startState.facet(Ui)!=t.state.facet(Ui)?tn.init(t.state):i.apply(t)}});var sp=i=>{let t=setTimeout(()=>i(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<\"u\"&&(sp=i=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(i,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});var Ha=typeof navigator<\"u\"&&(!((Ga=navigator.scheduling)===null||Ga===void 0)&&Ga.isInputPending)?()=>navigator.scheduling.isInputPending():null,Px=ft.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Wt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=sp(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work(()=>Ha&&Ha()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Wt.setState.of(new tn(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Ct(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ui=A.define({combine(i){return i.length?i[0]:null},enables:i=>[Wt.state,Px,T.contentAttributes.compute([i],t=>{let e=t.facet(i);return e&&e.name?{\"data-language\":e.name}:{}})]}),js=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}};var Cx=A.define(),ke=A.define({combine:i=>{if(!i.length)return\" \";let t=i[0];if(!t||/\\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error(\"Invalid indent unit: \"+JSON.stringify(i[0]));return t}});function en(i){let t=i.facet(ke);return t.charCodeAt(0)==9?i.tabSize*t.length:t.length}function rn(i,t){let e=\"\",r=i.tabSize,n=i.facet(ke)[0];if(n==\"\t\"){for(;t>=r;)e+=\"\t\",t-=r;n=\" \"}for(let s=0;s=t?Ax(i,e,t):null}var gi=class{constructor(t,e={}){this.state=t,this.options=e,this.unit=en(t)}lineAt(t,e=1){let r=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=r.from&&n<=r.to?s&&n==t?{text:\"\",from:t}:(e<0?n-1&&(s+=o-this.countColumn(r,r.search(/\\S|$/))),s}countColumn(t,e=t.length){return We(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:r,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(r,r.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},lh=new E;function Ax(i,t,e){let r=t.resolveStack(e),n=r.node.enterUnfinishedNodesBefore(e);if(n!=r.node){let s=[];for(let o=n;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return op(r,i,e)}function op(i,t,e){for(let r=i;r;r=r.next){let n=Rx(r.node);if(n)return n(th.create(t,e,r))}return 0}function Qx(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function Rx(i){let t=i.type.prop(lh);if(t)return t;let e=i.firstChild,r;if(e&&(r=e.type.prop(E.closedBy))){let n=i.lastChild,s=n&&r.indexOf(n.name)>-1;return o=>lp(o,!0,1,void 0,s&&!Qx(o)?n.from:void 0)}return i.parent==null?Mx:null}function Mx(){return 0}var th=class i extends gi{constructor(t,e,r){super(t.state,t.options),this.base=t,this.pos=e,this.context=r}get node(){return this.context.node}static create(t,e,r){return new i(t,e,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(e.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Ex(r,t))break;e=this.state.doc.lineAt(r.from)}return this.lineIndent(e.from)}continue(){return op(this.context.next,this.base,this.pos)}};function Ex(i,t){for(let e=t;e;e=e.parent)if(i==e)return!0;return!1}function $x(i){let t=i.node,e=t.childAfter(t.from),r=t.lastChild;if(!e)return null;let n=i.options.simulateBreak,s=i.state.doc.lineAt(e.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let l=e.to;;){let a=t.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.fromlp(r,t,e,i)}function lp(i,t,e,r,n){let s=i.textAfter,o=s.match(/^\\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||n==i.pos+o,a=t?$x(i):null;return a?l?i.column(a.from):i.column(a.to):i.baseIndent+(l?0:i.unit*e)}var qx=A.define(),ah=new E;function ap(i){let t=i.firstChild,e=i.lastChild;return t&&t.toe)continue;if(s&&l.from=t&&h.to>e&&(s=h)}}return s}function Bx(i){let t=i.lastChild;return t&&t.to==i.to&&t.type.isError}function hp(i,t,e){for(let r of i.facet(qx)){let n=r(i,t,e);if(n)return n}return Dx(i,t,e)}function fp(i,t){let e=t.mapPos(i.from,1),r=t.mapPos(i.to,-1);return e>=r?void 0:{from:e,to:r}}var hh=M.define({map:fp}),Js=M.define({map:fp});function cp(i){let t=[];for(let{head:e}of i.state.selection.ranges)t.some(r=>r.from<=e&&r.to>=e)||t.push(i.lineBlockAt(e));return t}var nn=it.define({create(){return R.none},update(i,t){i=i.map(t.changes);for(let e of t.effects)if(e.is(hh)&&!Xx(i,e.value.from,e.value.to)){let{preparePlaceholder:r}=t.state.facet(fh),n=r?R.replace({widget:new eh(r(t.state,e.value))}):ep;i=i.update({add:[n.range(e.value.from,e.value.to)]})}else e.is(Js)&&(i=i.update({filter:(r,n)=>e.value.from!=r||e.value.to!=n,filterFrom:e.value.from,filterTo:e.value.to}));if(t.selection){let e=!1,{head:r}=t.selection.main;i.between(r,r,(n,s)=>{nr&&(e=!0)}),e&&(i=i.update({filterFrom:r,filterTo:r,filter:(n,s)=>s<=r||n>=r}))}return i},provide:i=>T.decorations.from(i),toJSON(i,t){let e=[];return i.between(0,t.doc.length,(r,n)=>{e.push(r,n)}),e},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError(\"Invalid JSON for fold state\");let t=[];for(let e=0;e{(!n||n.from>s)&&(n={from:s,to:o})}),n}function Xx(i,t,e){let r=!1;return i.between(t,t,(n,s)=>{n==t&&s==e&&(r=!0)}),r}function dp(i,t){return i.field(nn,!1)?t:t.concat(M.appendConfig.of(Yx()))}var Lx=i=>{for(let t of cp(i)){let e=hp(i.state,t.from,t.to);if(e)return i.dispatch({effects:dp(i.state,[hh.of(e),pp(i,e)])}),!0}return!1},Vx=i=>{if(!i.state.field(nn,!1))return!1;let t=[];for(let e of cp(i)){let r=up(i.state,e.from,e.to);r&&t.push(Js.of(r),pp(i,r,!1))}return t.length&&i.dispatch({effects:t}),t.length>0};function pp(i,t,e=!0){let r=i.state.doc.lineAt(t.from).number,n=i.state.doc.lineAt(t.to).number;return T.announce.of(`${i.state.phrase(e?\"Folded lines\":\"Unfolded lines\")} ${r} ${i.state.phrase(\"to\")} ${n}.`)}var Wx=i=>{let{state:t}=i,e=[];for(let r=0;r{let t=i.state.field(nn,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,i.state.doc.length,(r,n)=>{e.push(Js.of({from:r,to:n}))}),i.dispatch({effects:e}),!0};var to=[{key:\"Ctrl-Shift-[\",mac:\"Cmd-Alt-[\",run:Lx},{key:\"Ctrl-Shift-]\",mac:\"Cmd-Alt-]\",run:Vx},{key:\"Ctrl-Alt-[\",run:Wx},{key:\"Ctrl-Alt-]\",run:Ix}],Nx={placeholderDOM:null,preparePlaceholder:null,placeholderText:\"\\u2026\"},fh=A.define({combine(i){return kt(i,Nx)}});function Yx(i){let t=[nn,zx];return i&&t.push(fh.of(i)),t}function mp(i,t){let{state:e}=i,r=e.facet(fh),n=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=up(i.state,l.from,l.to);a&&i.dispatch({effects:Js.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,t);let s=document.createElement(\"span\");return s.textContent=r.placeholderText,s.setAttribute(\"aria-label\",e.phrase(\"folded code\")),s.title=e.phrase(\"unfold\"),s.className=\"cm-foldPlaceholder\",s.onclick=n,s}var ep=R.replace({widget:new class extends Ut{toDOM(i){return mp(i,null)}}}),eh=class extends Ut{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return mp(t,this.value)}};var zx=T.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\"}}),ve=class i{constructor(t,e){this.specs=t;let r;function n(l){let a=Gt.newName();return(r||(r=Object.create(null)))[\".\"+a]=l,a}let s=typeof e.all==\"string\"?e.all:e.all?n(e.all):void 0,o=e.scope;this.scope=o instanceof Wt?l=>l.prop(Hi)==o.data:o?l=>l==o:void 0,this.style=_a(t.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Gt(r):null,this.themeType=e.themeType}static define(t,e){return new i(t,e||{})}},ih=A.define(),gp=A.define({combine(i){return i.length?[i[0]]:null}});function Ua(i){let t=i.facet(ih);return t.length?t:i.facet(gp)}function Te(i,t){let e=[Zx],r;return i instanceof ve&&(i.module&&e.push(T.styleModule.of(i.module)),r=i.themeType),t?.fallback?e.push(gp.of(i)):r?e.push(ih.computeN([T.darkTheme],n=>n.facet(T.darkTheme)==(r==\"dark\")?[i]:[])):e.push(ih.of(i)),e}var rh=class{constructor(t){this.markCache=Object.create(null),this.tree=pt(t.state),this.decorations=this.buildDeco(t,Ua(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=pt(t.state),r=Ua(t.state),n=r!=Ua(t.startState),{viewport:s}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return R.none;let r=new Ee;for(let{from:n,to:s}of t.visibleRanges)Kd(this.tree,e,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},n,s);return r.finish()}},Zx=ie.high(ft.fromClass(rh,{decorations:i=>i.decorations})),eo=ve.define([{tag:p.meta,color:\"#404740\"},{tag:p.link,textDecoration:\"underline\"},{tag:p.heading,textDecoration:\"underline\",fontWeight:\"bold\"},{tag:p.emphasis,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\"},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.keyword,color:\"#708\"},{tag:[p.atom,p.bool,p.url,p.contentSeparator,p.labelName],color:\"#219\"},{tag:[p.literal,p.inserted],color:\"#164\"},{tag:[p.string,p.deleted],color:\"#a11\"},{tag:[p.regexp,p.escape,p.special(p.string)],color:\"#e40\"},{tag:p.definition(p.variableName),color:\"#00f\"},{tag:p.local(p.variableName),color:\"#30a\"},{tag:[p.typeName,p.namespace],color:\"#085\"},{tag:p.className,color:\"#167\"},{tag:[p.special(p.variableName),p.macroName],color:\"#256\"},{tag:p.definition(p.propertyName),color:\"#00c\"},{tag:p.comment,color:\"#940\"},{tag:p.invalid,color:\"#f00\"}]),Fx=T.baseTheme({\"&.cm-focused .cm-matchingBracket\":{backgroundColor:\"#328c8252\"},\"&.cm-focused .cm-nonmatchingBracket\":{backgroundColor:\"#bb555544\"}}),Op=1e4,xp=\"()[]{}\",yp=A.define({combine(i){return kt(i,{afterCursor:!0,brackets:xp,maxScanDistance:Op,renderMatch:Hx})}}),_x=R.mark({class:\"cm-matchingBracket\"}),Gx=R.mark({class:\"cm-nonmatchingBracket\"});function Hx(i){let t=[],e=i.matched?_x:Gx;return t.push(e.range(i.start.from,i.start.to)),i.end&&t.push(e.range(i.end.from,i.end.to)),t}var Ux=it.define({create(){return R.none},update(i,t){if(!t.docChanged&&!t.selection)return i;let e=[],r=t.state.facet(yp);for(let n of t.state.selection.ranges){if(!n.empty)continue;let s=oe(t.state,n.head,-1,r)||n.head>0&&oe(t.state,n.head-1,1,r)||r.afterCursor&&(oe(t.state,n.head,1,r)||n.headT.decorations.from(i)}),jx=[Ux,Fx];function io(i={}){return[yp.of(i),jx]}var Kx=new E;function nh(i,t,e){let r=i.prop(t<0?E.openedBy:E.closedBy);if(r)return r;if(i.name.length==1){let n=e.indexOf(i.name);if(n>-1&&n%2==(t<0?1:0))return[e[n+t]]}return null}function sh(i){let t=i.type.prop(Kx);return t?t(i.node):i}function oe(i,t,e,r={}){let n=r.maxScanDistance||Op,s=r.brackets||xp,o=pt(i),l=o.resolveInner(t,e);for(let a=l;a;a=a.parent){let h=nh(a.type,e,s);if(h&&a.from0?t>=f.from&&tf.from&&t<=f.to))return Jx(i,t,e,a,f,h,s)}}return t1(i,t,e,o,l.type,n,s)}function Jx(i,t,e,r,n,s,o){let l=r.parent,a={from:n.from,to:n.to},h=0,f=l?.cursor();if(f&&(e<0?f.childBefore(r.from):f.childAfter(r.to)))do if(e<0?f.to<=r.from:f.from>=r.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:e<0?t-1:t,to:e>0?t+1:t},f=i.doc.iterRange(t,e>0?i.doc.length:0),c=0;for(let u=0;!f.next().done&&u<=s;){let d=f.value;e<0&&(u+=d.length);let m=t+u*e;for(let O=e>0?0:d.length-1,g=e>0?d.length:-1;O!=g;O+=e){let x=o.indexOf(d[O]);if(!(x<0||r.resolveInner(m+O,1).type!=n))if(x%2==0==e>0)c++;else{if(c==1)return{start:h,end:{from:m+O,to:m+O+1},matched:x>>1==a>>1};c--}}e>0&&(u+=d.length)}return f.done?{start:h,matched:!1}:null}var e1=Object.create(null),ip=[bt.none];var rp=[],np=Object.create(null),i1=Object.create(null);for(let[i,t]of[[\"variable\",\"variableName\"],[\"variable-2\",\"variableName.special\"],[\"string-2\",\"string.special\"],[\"def\",\"variableName.definition\"],[\"tag\",\"tagName\"],[\"attribute\",\"attributeName\"],[\"type\",\"typeName\"],[\"builtin\",\"variableName.standard\"],[\"qualifier\",\"modifier\"],[\"error\",\"invalid\"],[\"header\",\"heading\"],[\"property\",\"propertyName\"]])i1[i]=r1(e1,t);function ja(i,t){rp.indexOf(i)>-1||(rp.push(i),console.warn(t))}function r1(i,t){let e=[];for(let l of t.split(\" \")){let a=[];for(let h of l.split(\".\")){let f=i[h]||p[h];f?typeof f==\"function\"?a.length?a=a.map(f):ja(h,`Modifier ${h} used at start of tag`):a.length?ja(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:ja(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let r=t.replace(/ /g,\"_\"),n=r+\" \"+e.map(l=>l.id),s=np[n];if(s)return s.id;let o=np[n]=bt.define({id:ip.length,name:r,props:[Hs({[r]:e})]});return ip.push(o),o.id}var Fw={rtl:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"rtl\"},bidiIsolate:G.RTL}),ltr:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"ltr\"},bidiIsolate:G.LTR}),auto:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"auto\"},bidiIsolate:null})};var no=class{constructor(t,e,r){this.state=t,this.pos=e,this.explicit=r,this.abortListeners=[]}tokenBefore(t){let e=pt(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),r=Math.max(e.from,this.pos-250),n=e.text.slice(r-e.from,this.pos-e.from),s=n.search(Qp(t,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,e){t==\"abort\"&&this.abortListeners&&this.abortListeners.push(e)}};function bp(i){let t=Object.keys(i).join(\"\"),e=/\\w/.test(t);return e&&(t=t.replace(/\\w/g,\"\")),`[${e?\"\\\\w\":\"\"}${t.replace(/[^\\w\\s]/g,\"\\\\$&\")}]`}function n1(i){let t=Object.create(null),e=Object.create(null);for(let{label:n}of i){t[n[0]]=!0;for(let s=1;stypeof n==\"string\"?{label:n}:n),[e,r]=t.every(n=>/^\\w+$/.test(n.label))?[/\\w*$/,/\\w+$/]:n1(t);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:t,validFor:e}:null}}function Ap(i,t){return e=>{for(let r=pt(e.state).resolveInner(e.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(e)}}var so=class{constructor(t,e,r,n){this.completion=t,this.source=e,this.match=r,this.score=n}};function Ue(i){return i.selection.main.from}function Qp(i,t){var e;let{source:r}=i,n=t&&r[0]!=\"^\",s=r[r.length-1]!=\"$\";return!n&&!s?i:new RegExp(`${n?\"^\":\"\"}(?:${r})${s?\"$\":\"\"}`,(e=i.flags)!==null&&e!==void 0?e:i.ignoreCase?\"i\":\"\")}var Rp=Et.define();function s1(i,t,e,r){let{main:n}=i.selection,s=e-n.from,o=r-n.from;return Object.assign(Object.assign({},i.changeByRange(l=>l!=n&&e!=r&&i.sliceDoc(l.from+s,l.from+o)!=i.sliceDoc(e,r)?{range:l}:{changes:{from:l.from+s,to:r==n.from?l.to:l.from+o,insert:t},range:b.cursor(l.from+s+t.length)})),{scrollIntoView:!0,userEvent:\"input.complete\"})}var Sp=new WeakMap;function o1(i){if(!Array.isArray(i))return i;let t=Sp.get(i);return t||Sp.set(i,t=wh(i)),t}var oo=M.define(),sn=M.define(),dh=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&y<=57||y>=97&&y<=122?2:y>=65&&y<=90?1:0:(k=vr(y))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!S||w==1&&g||v==0&&w!=0)&&(e[c]==y||r[c]==y&&(u=!0)?o[c++]=S:o.length&&(x=!1)),v=w,S+=wt(y)}return c==a&&o[0]==0&&x?this.result(-100+(u?-200:0),o,t):d==a&&m==0?this.ret(-200-t.length+(O==t.length?0:-100),[0,O]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):d==a?this.ret(-900-t.length,[m,O]):c==a?this.result(-100+(u?-200:0)+-700+(x?0:-1100),o,t):e.length==2?!1:this.result((n[0]?-700:0)+-200+-1100,n,t)}result(t,e,r){let n=[],s=0;for(let o of e){let l=o+(this.astral?wt(dt(r,o)):1);s&&n[s-1]==o?n[s-1]=l:(n[s++]=o,n[s++]=l)}return this.ret(t-r.length,n)}},gt=A.define({combine(i){return kt(i,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>\"\",optionClass:()=>\"\",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:l1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>r=>wp(t(r),e(r)),optionClass:(t,e)=>r=>wp(t(r),e(r)),addToOptions:(t,e)=>t.concat(e)})}});function wp(i,t){return i?t?i+\" \"+t:i:t}function l1(i,t,e,r,n,s){let o=i.textDirection==G.RTL,l=o,a=!1,h=\"top\",f,c,u=t.left-n.left,d=n.right-t.right,m=r.right-r.left,O=r.bottom-r.top;if(l&&u=O||S>t.top?f=e.bottom-t.top:(h=\"bottom\",f=t.bottom-e.top)}let g=(t.bottom-t.top)/s.offsetHeight,x=(t.right-t.left)/s.offsetWidth;return{style:`${h}: ${f/g}px; max-width: ${c/x}px`,class:\"cm-completionInfo-\"+(a?o?\"left-narrow\":\"right-narrow\":l?\"left\":\"right\")}}function a1(i){let t=i.addToOptions.slice();return i.icons&&t.push({render(e){let r=document.createElement(\"div\");return r.classList.add(\"cm-completionIcon\"),e.type&&r.classList.add(...e.type.split(/\\s+/g).map(n=>\"cm-completionIcon-\"+n)),r.setAttribute(\"aria-hidden\",\"true\"),r},position:20}),t.push({render(e,r,n,s){let o=document.createElement(\"span\");o.className=\"cm-completionLabel\";let l=e.displayLabel||e.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,f)));let u=o.appendChild(document.createElement(\"span\"));u.appendChild(document.createTextNode(l.slice(f,c))),u.className=\"cm-completionMatchedText\",a=c}return ae.position-r.position).map(e=>e.render)}function ch(i,t,e){if(i<=e)return{from:0,to:i};if(t<0&&(t=0),t<=i>>1){let n=Math.floor(t/e);return{from:n*e,to:(n+1)*e}}let r=Math.floor((i-t)/e);return{from:i-(r+1)*e,to:i-r*e}}var ph=class{constructor(t,e,r){this.view=t,this.stateField=e,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass=\"\";let n=t.state.field(e),{options:s,selected:o}=n.open,l=t.state.facet(gt);this.optionContent=a1(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ch(s.length,o,l.maxRenderedOptions),this.dom=document.createElement(\"div\"),this.dom.className=\"cm-tooltip-autocomplete\",this.updateTooltipClass(t.state),this.dom.addEventListener(\"mousedown\",a=>{let{options:h}=t.state.field(e).open;for(let f=a.target,c;f&&f!=this.dom;f=f.parentNode)if(f.nodeName==\"LI\"&&(c=/-(\\d+)$/.exec(f.id))&&+c[1]{let h=t.state.field(this.stateField,!1);h&&h.tooltip&&t.state.facet(gt).closeOnBlur&&a.relatedTarget!=t.contentDOM&&t.dispatch({effects:sn.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener(\"scroll\",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let r=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=n){let{options:s,selected:o,disabled:l}=r.open;(!n.open||n.open.options!=s)&&(this.range=ch(s.length,o,t.state.facet(gt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((e=n.open)===null||e===void 0?void 0:e.disabled)&&this.dom.classList.toggle(\"cm-tooltip-autocomplete-disabled\",!!l)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let r of this.currentClass.split(\" \"))r&&this.dom.classList.remove(r);for(let r of e.split(\" \"))r&&this.dom.classList.add(r);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ch(e.options.length,e.selected,this.view.state.facet(gt).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:r}=e.options[e.selected],{info:n}=r;if(!n)return;let s=typeof n==\"string\"?document.createTextNode(n):n(r);if(!s)return;\"then\"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,r)}).catch(o=>Ct(this.view.state,o,\"completion info\")):this.addInfoPane(s,r)}}addInfoPane(t,e){this.destroyInfo();let r=this.info=document.createElement(\"div\");if(r.className=\"cm-tooltip cm-completionInfo\",t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:n,destroy:s}=t;r.appendChild(n),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!=\"LI\"||!r.id?n--:n==t?r.hasAttribute(\"aria-selected\")||(r.setAttribute(\"aria-selected\",\"true\"),e=r):r.hasAttribute(\"aria-selected\")&&r.removeAttribute(\"aria-selected\");return e&&f1(this.list,e),e}measureInfo(){let t=this.dom.querySelector(\"[aria-selected]\");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomr.from||r.from==0))if(s=u,typeof h!=\"string\"&&h.header)n.appendChild(h.header(h));else{let d=n.appendChild(document.createElement(\"completion-section\"));d.textContent=u}}let f=n.appendChild(document.createElement(\"li\"));f.id=e+\"-\"+o,f.setAttribute(\"role\",\"option\");let c=this.optionClass(l);c&&(f.className=c);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&f.appendChild(d)}}return r.from&&n.classList.add(\"cm-completionListIncompleteTop\"),r.tonew ph(e,i,t)}function f1(i,t){let e=i.getBoundingClientRect(),r=t.getBoundingClientRect(),n=e.height/i.offsetHeight;r.tope.bottom&&(i.scrollTop+=(r.bottom-e.bottom)/n)}function vp(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function c1(i,t){let e=[],r=null,n=a=>{e.push(a);let{section:h}=a.completion;if(h){r||(r=[]);let f=typeof h==\"string\"?h:h.name;r.some(c=>c.name==f)||r.push(typeof h==\"string\"?{name:f}:h)}};for(let a of i)if(a.hasResult()){let h=a.result.getMatch;if(a.result.filter===!1)for(let f of a.result.options)n(new so(f,a.source,h?h(f):[],1e9-e.length));else{let f=new dh(t.sliceDoc(a.from,a.to));for(let c of a.result.options)if(f.match(c.label)){let u=c.displayLabel?h?h(c,f.matched):[]:f.matched;n(new so(c,a.source,u,f.score+(c.boost||0)))}}}if(r){let a=Object.create(null),h=0,f=(c,u)=>{var d,m;return((d=c.rank)!==null&&d!==void 0?d:1e9)-((m=u.rank)!==null&&m!==void 0?m:1e9)||(c.namef.score-h.score||l(h.completion,f.completion))){let h=a.completion;!o||o.label!=h.label||o.detail!=h.detail||o.type!=null&&h.type!=null&&o.type!=h.type||o.apply!=h.apply||o.boost!=h.boost?s.push(a):vp(a.completion)>vp(o)&&(s[s.length-1]=a),o=a.completion}return s}var mh=class i{constructor(t,e,r,n,s,o){this.options=t,this.attrs=e,this.tooltip=r,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new i(this.options,kp(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,r,n,s){let o=c1(t,e);if(!o.length)return n&&t.some(a=>a.state==1)?new i(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let l=e.facet(gt).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let a=n.options[n.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:g1,above:s.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(t){return new i(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},gh=class i{constructor(t,e,r){this.active=t,this.id=e,this.open=r}static start(){return new i(p1,\"cm-ac-\"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,r=e.facet(gt),s=(r.override||e.languageDataAt(\"autocomplete\",Ue(e)).map(o1)).map(l=>(this.active.find(h=>h.source==l)||new De(l,this.active.some(h=>h.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&t.docChanged&&(o=o.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!u1(s,this.active)?o=mh.build(s,e,this.id,o,r):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new De(l.source,0):l));for(let l of t.effects)l.is(Ep)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new i(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:d1}};function u1(i,t){if(i==t)return!0;for(let e=0,r=0;;){for(;e-1&&(e[\"aria-activedescendant\"]=i+\"-\"+t),e}var p1=[];function Oh(i){return i.isUserEvent(\"input.type\")?\"input\":i.isUserEvent(\"delete.backward\")?\"delete\":null}var De=class i{constructor(t,e,r=-1){this.source=t,this.state=e,this.explicitPos=r}hasResult(){return!1}update(t,e){let r=Oh(t),n=this;r?n=n.handleUserEvent(t,r,e):t.docChanged?n=n.handleChange(t):t.selection&&n.state!=0&&(n=new i(n.source,0));for(let s of t.effects)if(s.is(oo))n=new i(n.source,1,s.value?Ue(t.state):-1);else if(s.is(sn))n=new i(n.source,0);else if(s.is(Mp))for(let o of s.value)o.source==n.source&&(n=o);return n}handleUserEvent(t,e,r){return e==\"delete\"||!r.activateOnTyping?this.map(t.changes):new i(this.source,1)}handleChange(t){return t.changes.touchesRange(Ue(t.startState))?new i(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new i(this.source,this.state,t.mapPos(this.explicitPos))}},lo=class i extends De{constructor(t,e,r,n,s){super(t,2,e),this.result=r,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,r){var n;let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=Ue(t.state);if((this.explicitPos<0?l<=s:lo||e==\"delete\"&&Ue(t.startState)==this.from)return new De(this.source,e==\"input\"&&r.activateOnTyping?1:0);let a=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos),h;return m1(this.result.validFor,t.state,s,o)?new i(this.source,a,this.result,s,o):this.result.update&&(h=this.result.update(this.result,s,o,new no(t.state,l,a>=0)))?new i(this.source,a,h,h.from,(n=h.to)!==null&&n!==void 0?n:Ue(t.state)):new De(this.source,1,a)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new De(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new i(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}};function m1(i,t,e,r){if(!i)return!1;let n=t.sliceDoc(e,r);return typeof i==\"function\"?i(n,e,r,t):Qp(i,!0).test(n)}var Mp=M.define({map(i,t){return i.map(e=>e.map(t))}}),Ep=M.define(),It=it.define({create(){return gh.start()},update(i,t){return i.update(t)},provide:i=>[Fr.from(i,t=>t.tooltip),T.contentAttributes.from(i,t=>t.attrs)]});function $p(i,t){let e=t.completion.apply||t.completion.label,r=i.state.field(It).active.find(n=>n.source==t.source);return r instanceof lo?(typeof e==\"string\"?i.dispatch(Object.assign(Object.assign({},s1(i.state,e,r.from,r.to)),{annotations:Rp.of(t.completion)})):e(i,t.completion,r.from,r.to),!0):!1}var g1=h1(It,$p);function ro(i,t=\"option\"){return e=>{let r=e.state.field(It,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+n*(i?1:-1):i?0:o-1;return l<0?l=t==\"page\"?0:o-1:l>=o&&(l=t==\"page\"?o-1:0),e.dispatch({effects:Ep.of(l)}),!0}}var O1=i=>{let t=i.state.field(It,!1);return i.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampi.state.field(It,!1)?(i.dispatch({effects:oo.of(!0)}),!0):!1,y1=i=>{let t=i.state.field(It,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(i.dispatch({effects:sn.of(null)}),!0)},xh=class{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}},b1=50,S1=1e3,w1=ft.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of i.state.field(It).active)t.state==1&&this.startQuery(t)}update(i){let t=i.state.field(It);if(!i.selectionSet&&!i.docChanged&&i.startState.field(It)==t)return;let e=i.transactions.some(n=>(n.selection||n.docChanged)&&!Oh(n));for(let n=0;nb1&&Date.now()-s.time>S1){for(let o of s.context.abortListeners)try{o()}catch(l){Ct(this.view.state,l)}s.context.abortListeners=null,this.running.splice(n--,1)}else s.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(n=>n.effects.some(s=>s.is(oo)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.state.facet(gt).activateOnTypingDelay;if(this.debounceUpdate=t.active.some(n=>n.state==1&&!this.running.some(s=>s.active.source==n.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let n of i.transactions)Oh(n)==\"input\"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,t=i.field(It);for(let e of t.active)e.state==1&&!this.running.some(r=>r.active.source==e.source)&&this.startQuery(e)}startQuery(i){let{state:t}=this.view,e=Ue(t),r=new no(t,e,i.explicitPos==e),n=new xh(i,r);this.running.push(n),Promise.resolve(i.source(r)).then(s=>{n.context.aborted||(n.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:sn.of(null)}),Ct(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gt).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(gt);for(let r=0;ro.source==n.active.source);if(s&&s.state==1)if(n.done==null){let o=new De(n.active.source,0);for(let l of n.updates)o=o.update(l,e);o.state!=1&&t.push(o)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:Mp.of(t)})}},{eventHandlers:{blur(i){let t=this.view.state.field(It,!1);if(t&&t.tooltip&&this.view.state.facet(gt).closeOnBlur){let e=t.open&&Ba(this.view,t.open.tooltip);(!e||!e.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:sn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:oo.of(!1)}),20),this.composing=0}}}),qp=T.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:\"400px\",boxSizing:\"border-box\"},\".cm-completionInfo.cm-completionInfo-left\":{right:\"100%\"},\".cm-completionInfo.cm-completionInfo-right\":{left:\"100%\"},\".cm-completionInfo.cm-completionInfo-left-narrow\":{right:\"30px\"},\".cm-completionInfo.cm-completionInfo-right-narrow\":{left:\"30px\"},\"&light .cm-snippetField\":{backgroundColor:\"#00000022\"},\"&dark .cm-snippetField\":{backgroundColor:\"#ffffff22\"},\".cm-snippetFieldPosition\":{verticalAlign:\"text-top\",width:0,height:\"1.15em\",display:\"inline-block\",margin:\"0 -0.7px -.7em\",borderLeft:\"1.4px dotted #888\"},\".cm-completionMatchedText\":{textDecoration:\"underline\"},\".cm-completionDetail\":{marginLeft:\"0.5em\",fontStyle:\"italic\"},\".cm-completionIcon\":{fontSize:\"90%\",width:\".8em\",display:\"inline-block\",textAlign:\"center\",paddingRight:\".6em\",opacity:\"0.6\",boxSizing:\"content-box\"},\".cm-completionIcon-function, .cm-completionIcon-method\":{\"&:after\":{content:\"'\\u0192'\"}},\".cm-completionIcon-class\":{\"&:after\":{content:\"'\\u25CB'\"}},\".cm-completionIcon-interface\":{\"&:after\":{content:\"'\\u25CC'\"}},\".cm-completionIcon-variable\":{\"&:after\":{content:\"'\\u{1D465}'\"}},\".cm-completionIcon-constant\":{\"&:after\":{content:\"'\\u{1D436}'\"}},\".cm-completionIcon-type\":{\"&:after\":{content:\"'\\u{1D461}'\"}},\".cm-completionIcon-enum\":{\"&:after\":{content:\"'\\u222A'\"}},\".cm-completionIcon-property\":{\"&:after\":{content:\"'\\u25A1'\"}},\".cm-completionIcon-keyword\":{\"&:after\":{content:\"'\\u{1F511}\\uFE0E'\"}},\".cm-completionIcon-namespace\":{\"&:after\":{content:\"'\\u25A2'\"}},\".cm-completionIcon-text\":{\"&:after\":{content:\"'abc'\",fontSize:\"50%\",verticalAlign:\"middle\"}}}),yh=class{constructor(t,e,r,n){this.field=t,this.line=e,this.from=r,this.to=n}},bh=class i{constructor(t,e,r){this.field=t,this.from=e,this.to=r}map(t){let e=t.mapPos(this.from,-1,ut.TrackDel),r=t.mapPos(this.to,1,ut.TrackDel);return e==null||r==null?null:new i(this.field,e,r)}},Sh=class i{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let r=[],n=[e],s=t.doc.lineAt(e),o=/^\\s*/.exec(s.text)[0];for(let a of this.lines){if(r.length){let h=o,f=/^\\t*/.exec(a)[0].length;for(let c=0;cnew bh(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:r,ranges:l}}static parse(t){let e=[],r=[],n=[],s;for(let o of t.split(/\\r\\n?|\\n/)){for(;s=/[#$]\\{(?:(\\d+)(?::([^}]*))?|([^}]*))\\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||\"\",h=-1;for(let f=0;f=h&&c.field++}n.push(new yh(h,r.length,s.index,s.index+a.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}for(let l;l=/\\\\([{}])/.exec(o);){o=o.slice(0,l.index)+l[1]+o.slice(l.index+l[0].length);for(let a of n)a.line==r.length&&a.from>l.index&&(a.from--,a.to--)}r.push(o)}return new i(r,n)}},v1=R.widget({widget:new class extends Ut{toDOM(){let i=document.createElement(\"span\");return i.className=\"cm-snippetFieldPosition\",i}ignoreEvent(){return!1}}}),k1=R.mark({class:\"cm-snippetField\"}),ji=class i{constructor(t,e){this.ranges=t,this.active=e,this.deco=R.set(t.map(r=>(r.from==r.to?v1:k1).range(r.from,r.to)))}map(t){let e=[];for(let r of this.ranges){let n=r.map(t);if(!n)return null;e.push(n)}return new i(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(r=>r.field==this.active&&r.from<=e.from&&r.to>=e.to))}},an=M.define({map(i,t){return i&&i.map(t)}}),T1=M.define(),on=it.define({create(){return null},update(i,t){for(let e of t.effects){if(e.is(an))return e.value;if(e.is(T1)&&i)return new ji(i.ranges,e.value)}return i&&t.docChanged&&(i=i.map(t.changes)),i&&t.selection&&!i.selectionInsideField(t.selection)&&(i=null),i},provide:i=>T.decorations.from(i,t=>t?t.deco:R.none)});function vh(i,t){return b.create(i.filter(e=>e.field==t).map(e=>b.range(e.from,e.to)))}function P1(i){let t=Sh.parse(i);return(e,r,n,s)=>{let{text:o,ranges:l}=t.instantiate(e.state,n),a={changes:{from:n,to:s,insert:V.of(o)},scrollIntoView:!0,annotations:r?[Rp.of(r),lt.userEvent.of(\"input.complete\")]:void 0};if(l.length&&(a.selection=vh(l,0)),l.some(h=>h.field>0)){let h=new ji(l,0),f=a.effects=[an.of(h)];e.state.field(on,!1)===void 0&&f.push(M.appendConfig.of([on,M1,E1,qp]))}e.dispatch(e.state.update(a))}}function Dp(i){return({state:t,dispatch:e})=>{let r=t.field(on,!1);if(!r||i<0&&r.active==0)return!1;let n=r.active+i,s=i>0&&!r.ranges.some(o=>o.field==n+i);return e(t.update({selection:vh(r.ranges,n),effects:an.of(s?null:new ji(r.ranges,n)),scrollIntoView:!0})),!0}}var C1=({state:i,dispatch:t})=>i.field(on,!1)?(t(i.update({effects:an.of(null)})),!0):!1,A1=Dp(1),Q1=Dp(-1);var R1=[{key:\"Tab\",run:A1,shift:Q1},{key:\"Escape\",run:C1}],Tp=A.define({combine(i){return i.length?i[0]:R1}}),M1=ie.highest(Fe.compute([Tp],i=>i.facet(Tp)));function Pe(i,t){return Object.assign(Object.assign({},t),{apply:P1(i)})}var E1=T.domEventHandlers({mousedown(i,t){let e=t.state.field(on,!1),r;if(!e||(r=t.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let n=e.ranges.find(s=>s.from<=r&&s.to>=r);return!n||n.field==e.active?!1:(t.dispatch({selection:vh(e.ranges,n.field),effects:an.of(e.ranges.some(s=>s.field>n.field)?new ji(e.ranges,n.field):null),scrollIntoView:!0}),!0)}});var ln={brackets:[\"(\",\"[\",\"{\",\"'\",'\"'],before:\")]}:;>\",stringPrefixes:[]},Oi=M.define({map(i,t){let e=t.mapPos(i,-1,ut.TrackAfter);return e??void 0}}),kh=new class extends ee{};kh.startSide=1;kh.endSide=-1;var Bp=it.define({create(){return _.empty},update(i,t){if(i=i.map(t.changes),t.selection){let e=t.state.doc.lineAt(t.selection.main.head);i=i.update({filter:r=>r>=e.from&&r<=e.to})}for(let e of t.effects)e.is(Oi)&&(i=i.update({add:[kh.range(e.value,e.value+1)]}));return i}});function ao(){return[q1,Bp]}var uh=\"()[]{}<>\";function Xp(i){for(let t=0;t{if(($1?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let n=i.state.selection.main;if(r.length>2||r.length==2&&wt(dt(r,0))==1||t!=n.from||e!=n.to)return!1;let s=B1(i.state,r);return s?(i.dispatch(s),!0):!1}),D1=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let r=Lp(i,i.selection.main.head).brackets||ln.brackets,n=null,s=i.changeByRange(o=>{if(o.empty){let l=X1(i.doc,o.head);for(let a of r)if(a==l&&fo(i.doc,o.head)==Xp(dt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:n=o}});return n||t(i.update(s,{scrollIntoView:!0,userEvent:\"delete.backward\"})),!n},ho=[{key:\"Backspace\",run:D1}];function B1(i,t){let e=Lp(i,i.selection.main.head),r=e.brackets||ln.brackets;for(let n of r){let s=Xp(dt(n,0));if(t==n)return s==n?W1(i,n,r.indexOf(n+n+n)>-1,e):L1(i,n,s,e.before||ln.before);if(t==s&&Vp(i,i.selection.main.from))return V1(i,n,s)}return null}function Vp(i,t){let e=!1;return i.field(Bp).between(0,i.doc.length,r=>{r==t&&(e=!0)}),e}function fo(i,t){let e=i.sliceString(t,t+2);return e.slice(0,wt(dt(e,0)))}function X1(i,t){let e=i.sliceString(t-2,t);return wt(dt(e,0))==e.length?e:e.slice(1)}function L1(i,t,e,r){let n=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:e,from:o.to}],effects:Oi.of(o.to+t.length),range:b.range(o.anchor+t.length,o.head+t.length)};let l=fo(i.doc,o.head);return!l||/\\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+e,from:o.head},effects:Oi.of(o.head+t.length),range:b.cursor(o.head+t.length)}:{range:n=o}});return n?null:i.update(s,{scrollIntoView:!0,userEvent:\"input.type\"})}function V1(i,t,e){let r=null,n=i.changeByRange(s=>s.empty&&fo(i.doc,s.head)==e?{changes:{from:s.head,to:s.head+e.length,insert:e},range:b.cursor(s.head+e.length)}:r={range:s});return r?null:i.update(n,{scrollIntoView:!0,userEvent:\"input.type\"})}function W1(i,t,e,r){let n=r.stringPrefixes||ln.stringPrefixes,s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Oi.of(l.to+t.length),range:b.range(l.anchor+t.length,l.head+t.length)};let a=l.head,h=fo(i.doc,a),f;if(h==t){if(Pp(i,a))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(Vp(i,a)){let u=e&&i.sliceDoc(a,a+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(e&&i.sliceDoc(a-2*t.length,a)==t+t&&(f=Cp(i,a-2*t.length,n))>-1&&Pp(i,f))return{changes:{insert:t+t+t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(i.charCategorizer(a)(h)!=F.Word&&Cp(i,a,n)>-1&&!I1(i,a,t,n))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)}}return{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:\"input.type\"})}function Pp(i,t){let e=pt(i).resolveInner(t+1);return e.parent&&e.from==t}function I1(i,t,e,r){let n=pt(i).resolveInner(t,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(n.from,Math.min(n.to,n.from+e.length+s)),a=l.indexOf(e);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let f=n.firstChild;for(;f&&f.from==n.from&&f.to-f.from>e.length+a;){if(i.sliceDoc(f.to-e.length,f.to)==e)return!1;f=f.firstChild}return!0}let h=n.to==t&&n.parent;if(!h)break;n=h}return!1}function Cp(i,t,e){let r=i.charCategorizer(t);if(r(i.sliceDoc(t-1,t))!=F.Word)return t;for(let n of e){let s=t-n.length;if(i.sliceDoc(s,t)==n&&r(i.sliceDoc(s-1,s))!=F.Word)return s}return-1}function co(i={}){return[It,gt.of(i),w1,N1,qp]}var hn=[{key:\"Ctrl-Space\",run:x1},{key:\"Escape\",run:y1},{key:\"ArrowDown\",run:ro(!0)},{key:\"ArrowUp\",run:ro(!1)},{key:\"PageDown\",run:ro(!0,\"page\")},{key:\"PageUp\",run:ro(!1,\"page\")},{key:\"Enter\",run:O1}],N1=ie.highest(Fe.computeN([gt],i=>i.facet(gt).defaultKeymap?[hn]:[]));var Y1=i=>{let{state:t}=i,e=t.doc.lineAt(t.selection.main.from),r=Mh(i.state,e.from);return r.line?z1(i):r.block?F1(i):!1};function Rh(i,t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=i(t,e);return n?(r(e.update(n)),!0):!1}}var z1=Rh(H1,0);var Z1=Rh(_p,0);var F1=Rh((i,t)=>_p(i,t,G1(t)),0);function Mh(i,t){let e=i.languageDataAt(\"commentTokens\",t);return e.length?e[0]:{}}var fn=50;function _1(i,{open:t,close:e},r,n){let s=i.sliceDoc(r-fn,r),o=i.sliceDoc(n,n+fn),l=/\\s*$/.exec(s)[0].length,a=/^\\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-t.length,h)==t&&o.slice(a,a+e.length)==e)return{open:{pos:r-l,margin:l&&1},close:{pos:n+a,margin:a&&1}};let f,c;n-r<=2*fn?f=c=i.sliceDoc(r,n):(f=i.sliceDoc(r,r+fn),c=i.sliceDoc(n-fn,n));let u=/^\\s*/.exec(f)[0].length,d=/\\s*$/.exec(c)[0].length,m=c.length-d-e.length;return f.slice(u,u+t.length)==t&&c.slice(m,m+e.length)==e?{open:{pos:r+u+t.length,margin:/\\s/.test(f.charAt(u+t.length))?1:0},close:{pos:n-d-e.length,margin:/\\s/.test(c.charAt(m-1))?1:0}}:null}function G1(i){let t=[];for(let e of i.selection.ranges){let r=i.doc.lineAt(e.from),n=e.to<=r.to?r:i.doc.lineAt(e.to),s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=n.to:t.push({from:r.from+/^\\s*/.exec(r.text)[0].length,to:n.to})}return t}function _p(i,t,e=t.selection.ranges){let r=e.map(s=>Mh(t,s.from).block);if(!r.every(s=>s))return null;let n=e.map((s,o)=>_1(t,r[o],s.from,s.to));if(i!=2&&!n.every(s=>s))return{changes:t.changes(e.map((s,o)=>n[o]?[]:[{from:s.from,insert:r[o].open+\" \"},{from:s.to,insert:\" \"+r[o].close}]))};if(i!=1&&n.some(s=>s)){let s=[];for(let o=0,l;on&&(s==o||o>c.from)){n=c.from;let u=/^\\s*/.exec(c.text)[0].length,d=u==c.length,m=c.text.slice(u,u+h.length)==h?u:-1;us.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:f,single:c}of r)(c||!f)&&s.push({from:l.from+h,insert:a+\" \"});let o=t.changes(s);return{changes:o,selection:t.selection.map(o,1)}}else if(i!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let h=o.from+l,f=h+a.length;o.text[f-o.from]==\" \"&&f++,s.push({from:h,to:f})}return{changes:s}}return null}var Ph=Et.define(),U1=Et.define(),j1=A.define(),Gp=A.define({combine(i){return kt(i,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(r,n)=>t(r,n)||e(r,n)})}}),Hp=it.define({create(){return xi.empty},update(i,t){let e=t.state.facet(Gp),r=t.annotation(Ph);if(r){let a=le.fromTransaction(t,r.selection),h=r.side,f=h==0?i.undone:i.done;return a?f=po(f,f.length,e.minDepth,a):f=Kp(f,t.startState.selection),new xi(h==0?r.rest:f,h==0?f:r.rest)}let n=t.annotation(U1);if((n==\"full\"||n==\"before\")&&(i=i.isolate()),t.annotation(lt.addToHistory)===!1)return t.changes.empty?i:i.addMapping(t.changes.desc);let s=le.fromTransaction(t),o=t.annotation(lt.time),l=t.annotation(lt.userEvent);return s?i=i.addChanges(s,o,l,e,t):t.selection&&(i=i.addSelection(t.startState.selection,o,l,e.newGroupDelay)),(n==\"full\"||n==\"after\")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(t=>t.toJSON()),undone:i.undone.map(t=>t.toJSON())}},fromJSON(i){return new xi(i.done.map(le.fromJSON),i.undone.map(le.fromJSON))}});function mo(i={}){return[Hp,Gp.of(i),T.domEventHandlers({beforeinput(t,e){let r=t.inputType==\"historyUndo\"?Up:t.inputType==\"historyRedo\"?Ch:null;return r?(t.preventDefault(),r(e)):!1}})]}function go(i,t){return function({state:e,dispatch:r}){if(!t&&e.readOnly)return!1;let n=e.field(Hp,!1);if(!n)return!1;let s=n.pop(i,e,t);return s?(r(s),!0):!1}}var Up=go(0,!1),Ch=go(1,!1),K1=go(0,!0),J1=go(1,!0);var le=class i{constructor(t,e,r,n,s){this.changes=t,this.effects=e,this.mapped=r,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new i(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(t){return new i(t.changes&&vt.fromJSON(t.changes),[],t.mapped&&Me.fromJSON(t.mapped),t.startSelection&&b.fromJSON(t.startSelection),t.selectionsAfter.map(b.fromJSON))}static fromTransaction(t,e){let r=Kt;for(let n of t.startState.facet(j1)){let s=n(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new i(t.changes.invert(t.startState.doc),r,void 0,e||t.startState.selection,Kt)}static selection(t){return new i(void 0,Kt,void 0,void 0,t)}};function po(i,t,e,r){let n=t+1>e+20?t-e-1:0,s=i.slice(n,t);return s.push(r),s}function ty(i,t){let e=[],r=!1;return i.iterChangedRanges((n,s)=>e.push(n,s)),t.iterChangedRanges((n,s,o,l)=>{for(let a=0;a=h&&o<=f&&(r=!0)}}),r}function ey(i,t){return i.ranges.length==t.ranges.length&&i.ranges.filter((e,r)=>e.empty!=t.ranges[r].empty).length===0}function jp(i,t){return i.length?t.length?i.concat(t):i:t}var Kt=[],iy=200;function Kp(i,t){if(i.length){let e=i[i.length-1],r=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-iy));return r.length&&r[r.length-1].eq(t)?i:(r.push(t),po(i,i.length-1,1e9,e.setSelAfter(r)))}else return[le.selection([t])]}function ry(i){let t=i[i.length-1],e=i.slice();return e[i.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function Th(i,t){if(!i.length)return i;let e=i.length,r=Kt;for(;e;){let n=ny(i[e-1],t,r);if(n.changes&&!n.changes.empty||n.effects.length){let s=i.slice(0,e);return s[e-1]=n,s}else t=n.mapped,e--,r=n.selectionsAfter}return r.length?[le.selection(r)]:Kt}function ny(i,t,e){let r=jp(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(t)):Kt,e);if(!i.changes)return le.selection(r);let n=i.changes.map(t),s=t.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new le(n,M.mapEffects(i.effects,t),o,i.startSelection.map(s),r)}var sy=/^(input\\.type|delete)($|\\.)/,xi=class i{constructor(t,e,r=0,n=void 0){this.done=t,this.undone=e,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(t,e,r,n,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||sy.test(r))&&(!l.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee.empty?i.moveByChar(e,t):xo(e,t))}function St(i){return i.textDirectionAt(i.state.selection.main.head)==G.LTR}var tm=i=>Jp(i,!St(i)),em=i=>Jp(i,St(i));function im(i,t){return ae(i,e=>e.empty?i.moveByGroup(e,t):xo(e,t))}var oy=i=>im(i,!St(i)),ly=i=>im(i,St(i));var lv=typeof Intl<\"u\"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:\"word\"}):null;function ay(i,t,e){if(t.type.prop(e))return!0;let r=t.to-t.from;return r&&(r>2||/[^\\s,.;:]/.test(i.sliceDoc(t.from,t.to)))||t.firstChild}function yo(i,t,e){let r=pt(i).resolveInner(t.head),n=e?E.closedBy:E.openedBy;for(let a=t.head;;){let h=e?r.childAfter(a):r.childBefore(a);if(!h)break;ay(i,h,n)?r=h:a=e?h.to:h.from}let s=r.type.prop(n),o,l;return s&&(o=e?oe(i,r.from,1):oe(i,r.to,-1))&&o.matched?l=e?o.end.to:o.end.from:l=e?r.to:r.from,b.cursor(l,e?-1:1)}var hy=i=>ae(i,t=>yo(i.state,t,!St(i))),fy=i=>ae(i,t=>yo(i.state,t,St(i)));function rm(i,t){return ae(i,e=>{if(!e.empty)return xo(e,t);let r=i.moveVertically(e,t);return r.head!=e.head?r:i.moveToLineBoundary(e,t)})}var nm=i=>rm(i,!1),sm=i=>rm(i,!0);function om(i){let t=i.scrollDOM.clientHeighto.empty?i.moveVertically(o,t,e.height):xo(o,t));if(n.eq(r.selection))return!1;let s;if(e.selfScroll){let o=i.coordsAtPos(r.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+e.marginTop,h=l.bottom-e.marginBottom;o&&o.top>a&&o.bottomlm(i,!1),Ah=i=>lm(i,!0);function je(i,t,e){let r=i.lineBlockAt(t.head),n=i.moveToLineBoundary(t,e);if(n.head==t.head&&n.head!=(e?r.to:r.from)&&(n=i.moveToLineBoundary(t,e,!1)),!e&&n.head==r.from&&r.length){let s=/^\\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(n=b.cursor(r.from+s))}return n}var cy=i=>ae(i,t=>je(i,t,!0)),uy=i=>ae(i,t=>je(i,t,!1)),dy=i=>ae(i,t=>je(i,t,!St(i))),py=i=>ae(i,t=>je(i,t,St(i))),my=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).from,1)),gy=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).to,-1));function Oy(i,t,e){let r=!1,n=Ki(i.selection,s=>{let o=oe(i,s.head,-1)||oe(i,s.head,1)||s.head>0&&oe(i,s.head-1,1)||s.headOy(i,t,!1);function Jt(i,t){let e=Ki(i.state.selection,r=>{let n=t(r);return b.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return e.eq(i.state.selection)?!1:(i.dispatch(Ce(i.state,e)),!0)}function am(i,t){return Jt(i,e=>i.moveByChar(e,t))}var hm=i=>am(i,!St(i)),fm=i=>am(i,St(i));function cm(i,t){return Jt(i,e=>i.moveByGroup(e,t))}var yy=i=>cm(i,!St(i)),by=i=>cm(i,St(i));var Sy=i=>Jt(i,t=>yo(i.state,t,!St(i))),wy=i=>Jt(i,t=>yo(i.state,t,St(i)));function um(i,t){return Jt(i,e=>i.moveVertically(e,t))}var dm=i=>um(i,!1),pm=i=>um(i,!0);function mm(i,t){return Jt(i,e=>i.moveVertically(e,t,om(i).height))}var Ip=i=>mm(i,!1),Np=i=>mm(i,!0),vy=i=>Jt(i,t=>je(i,t,!0)),ky=i=>Jt(i,t=>je(i,t,!1)),Ty=i=>Jt(i,t=>je(i,t,!St(i))),Py=i=>Jt(i,t=>je(i,t,St(i))),Cy=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).from)),Ay=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).to)),Yp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:0})),!0),zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.doc.length})),!0),Zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:0})),!0),Fp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Qy=({state:i,dispatch:t})=>(t(i.update({selection:{anchor:0,head:i.doc.length},userEvent:\"select\"})),!0),Ry=({state:i,dispatch:t})=>{let e=bo(i).map(({from:r,to:n})=>b.range(r,Math.min(n+1,i.doc.length)));return t(i.update({selection:b.create(e),userEvent:\"select\"})),!0},My=({state:i,dispatch:t})=>{let e=Ki(i.selection,r=>{var n;let s=pt(i).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&(!((n=l.parent)===null||n===void 0)&&n.parent))return b.range(l.to,l.from)}return r});return t(Ce(i,e)),!0},Ey=({state:i,dispatch:t})=>{let e=i.selection,r=null;return e.ranges.length>1?r=b.create([e.main]):e.main.empty||(r=b.create([b.cursor(e.main.head)])),r?(t(Ce(i,r)),!0):!1};function cn(i,t){if(i.state.readOnly)return!1;let e=\"delete.selection\",{state:r}=i,n=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=t(s);ao&&(e=\"delete.forward\",a=uo(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=uo(i,o,!1),l=uo(i,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:b.cursor(o,on(i)))r.between(t,t,(n,s)=>{nt&&(t=e?s:n)});return t}var gm=(i,t)=>cn(i,e=>{let r=e.from,{state:n}=i,s=n.doc.lineAt(r),o,l;if(!t&&r>s.from&&rgm(i,!1),Om=i=>gm(i,!0),xm=(i,t)=>cn(i,e=>{let r=e.head,{state:n}=i,s=n.doc.lineAt(r),o=n.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==e.head&&s.number!=(t?n.doc.lines:1)&&(r+=t?1:-1);break}let a=at(s.text,r-s.from,t)+s.from,h=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),f=o(h);if(l!=null&&f!=l)break;(h!=\" \"||r!=e.head)&&(l=f),r=a}return r}),ym=i=>xm(i,!1),$y=i=>xm(i,!0),qy=i=>cn(i,t=>{let e=i.lineBlockAt(t.head).to;return t.headcn(i,t=>{let e=i.moveToLineBoundary(t,!1).head;return t.head>e?e:Math.max(0,t.head-1)}),By=i=>cn(i,t=>{let e=i.moveToLineBoundary(t,!0).head;return t.head{if(i.readOnly)return!1;let e=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:V.of([\"\",\"\"])},range:b.cursor(r.from)}));return t(i.update(e,{scrollIntoView:!0,userEvent:\"input\"})),!0},Ly=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let n=r.from,s=i.doc.lineAt(n),o=n==s.from?n-1:at(s.text,n-s.from,!1)+s.from,l=n==s.to?n+1:at(s.text,n-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:i.doc.slice(n,l).append(i.doc.slice(o,n))},range:b.cursor(l)}});return e.changes.empty?!1:(t(i.update(e,{scrollIntoView:!0,userEvent:\"move.character\"})),!0)};function bo(i){let t=[],e=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.from),s=i.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=i.doc.lineAt(r.to-1)),e>=n.number){let o=t[t.length-1];o.to=s.to,o.ranges.push(r)}else t.push({from:n.from,to:s.to,ranges:[r]});e=s.number+1}return t}function bm(i,t,e){if(i.readOnly)return!1;let r=[],n=[];for(let s of bo(i)){if(e?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(e?s.to+1:s.from-1),l=o.length+1;if(e){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let a of s.ranges)n.push(b.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let a of s.ranges)n.push(b.range(a.anchor-l,a.head-l))}}return r.length?(t(i.update({changes:r,scrollIntoView:!0,selection:b.create(n,i.selection.mainIndex),userEvent:\"move.line\"})),!0):!1}var Vy=({state:i,dispatch:t})=>bm(i,t,!1),Wy=({state:i,dispatch:t})=>bm(i,t,!0);function Sm(i,t,e){if(i.readOnly)return!1;let r=[];for(let n of bo(i))e?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});return t(i.update({changes:r,scrollIntoView:!0,userEvent:\"input.copyline\"})),!0}var Iy=({state:i,dispatch:t})=>Sm(i,t,!1),Ny=({state:i,dispatch:t})=>Sm(i,t,!0),Yy=i=>{if(i.state.readOnly)return!1;let{state:t}=i,e=t.changes(bo(t).map(({from:n,to:s})=>(n>0?n--:si.moveVertically(n,!0)).map(e);return i.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:\"delete.line\"}),!0};function zy(i,t){if(/\\(\\)|\\[\\]|\\{\\}/.test(i.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=pt(i).resolveInner(t),r=e.childBefore(t),n=e.childAfter(t),s;return r&&n&&r.to<=t&&n.from>=t&&(s=r.type.prop(E.closedBy))&&s.indexOf(n.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(n.from).from&&!/\\S/.test(i.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var Zy=wm(!1),Fy=wm(!0);function wm(i){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:s,to:o}=n,l=t.doc.lineAt(s),a=!i&&s==o&&zy(t,s);i&&(s=o=(o<=l.to?l:t.doc.lineAt(o)).to);let h=new gi(t,{simulateBreak:s,simulateDoubleBreak:!!a}),f=oh(h,s);for(f==null&&(f=We(/^\\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));ol.from&&s{let n=[];for(let o=r.from;o<=r.to;){let l=i.doc.lineAt(o);l.number>e&&(r.empty||r.to>l.from)&&(t(l,n,r),e=l.number),o=l.to+1}let s=i.changes(n);return{changes:n,range:b.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var _y=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=Object.create(null),r=new gi(i,{overrideIndentation:s=>{let o=e[s];return o??-1}}),n=Eh(i,(s,o,l)=>{let a=oh(r,s.from);if(a==null)return;/\\S/.test(s.text)||(a=0);let h=/^\\s*/.exec(s.text)[0],f=rn(i,a);(h!=f||l.fromi.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{r.push({from:e.from,insert:i.facet(ke)})}),{userEvent:\"input.indent\"})),!0),Hy=({state:i,dispatch:t})=>i.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{let n=/^\\s*/.exec(e.text)[0];if(!n)return;let s=We(n,i.tabSize),o=0,l=rn(i,Math.max(0,s-en(i)));for(;o({mac:i.key,run:i.run,shift:i.shift}))),So=[{key:\"Alt-ArrowLeft\",mac:\"Ctrl-ArrowLeft\",run:hy,shift:Sy},{key:\"Alt-ArrowRight\",mac:\"Ctrl-ArrowRight\",run:fy,shift:wy},{key:\"Alt-ArrowUp\",run:Vy},{key:\"Shift-Alt-ArrowUp\",run:Iy},{key:\"Alt-ArrowDown\",run:Wy},{key:\"Shift-Alt-ArrowDown\",run:Ny},{key:\"Escape\",run:Ey},{key:\"Mod-Enter\",run:Fy},{key:\"Alt-l\",mac:\"Ctrl-l\",run:Ry},{key:\"Mod-i\",run:My,preventDefault:!0},{key:\"Mod-[\",run:Hy},{key:\"Mod-]\",run:Gy},{key:\"Mod-Alt-\\\\\",run:_y},{key:\"Shift-Mod-k\",run:Yy},{key:\"Shift-Mod-\\\\\",run:xy},{key:\"Mod-/\",run:Y1},{key:\"Alt-A\",run:Z1}].concat(jy);var Dh=class i{constructor(t,e,r,n,s,o,l,a,h,f=0,c){this.p=t,this.stack=e,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=f,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?\"!\"+this.score:\"\"}`}static start(t,e,r=0){let n=t.parser.context;return new i(t,[],e,r,r,0,[],0,n?new wo(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let r=t>>19,n=t&65535,{parser:s}=this.p,o=s.dynamicPrecedence(n);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(!((e=this.p.parser.nodeSet.types[n])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,r,n=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(e==r)return;if(o.buffer[l-2]>=e){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(t,e,r,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(t,e,r,n){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=n,this.shiftContext(e,r),e<=this.p.parser.maxNode&&this.buffer.push(e,r,n,4);else{let s=t,{parser:o}=this.p;(n>this.pos||e<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,r),this.shiftContext(e,r),e<=o.maxNode&&this.buffer.push(e,r,n,4)}}apply(t,e,r,n){t&65536?this.reduce(t):this.shift(t,e,r,n)}useNode(t,e){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let r=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,r?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Bh(this);;){let r=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(r==0)return!1;if(!(r&65536))return!0;e.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let s=0,o;sa&1&&l==o)||n.push(e[s],o)}e=n}let r=[];for(let n=0;n>19,n=e&65535,s=this.stack.length-r*3;if(s<0||t.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],r=(n,s)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&t.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},wo=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},Bh=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,r=t>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},Xh=class i{constructor(t,e,r){this.stack=t,this.pos=e,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new i(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function un(i,t=Uint16Array){if(typeof i!=\"string\")return i;let e=null;for(let r=0,n=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}e?e[n++]=s:e=new t(s)}return e}var Ji=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},vm=new Ji,Lh=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk=\"\",this.chunkOff=0,this.chunk2=\"\",this.chunk2Pos=0,this.next=-1,this.token=vm,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let r=this.range,n=this.rangeIndex,s=this.pos+t;for(;sr.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=o}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,r,n;if(e>=0&&e=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(t,e=0){let r=e?this.resolveOffset(e,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=\"\",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=vm,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let r=\"\";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(r+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return r}},Ke=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:r}=e.p;Am(this.data,t,e,this.id,r.data,r.tokenPrecTable)}};Ke.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var Vh=class{constructor(t,e,r){this.precTable=e,this.elseToken=r,this.data=typeof t==\"string\"?un(t):t}token(t,e){let r=t.pos,n=0;for(;;){let s=t.next<0,o=t.resolveOffset(1,1);if(Am(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(r,t.token),t.acceptToken(this.elseToken,n))}};Vh.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var yi=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};function Am(i,t,e,r,n,s){let o=0,l=1<0){let m=i[d];if(a.allows(m)&&(t.token.value==-1||t.token.value==m||Jy(m,t.token.value,n,s))){t.acceptToken(m);break}}let f=t.next,c=0,u=i[o+2];if(t.next<0&&u>c&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue t}for(;c>1,m=h+d+(d<<1),O=i[m],g=i[m+1]||65536;if(f=g)c=d+1;else{o=i[m+2],t.advance();continue t}}break}}function km(i,t,e){for(let r=t,n;(n=i[r])!=65535;r++)if(n==e)return r-t;return-1}function Jy(i,t,e,r){let n=km(e,r,t);return n<0||km(e,r,i)t)&&!r.type.isError)return e<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(i.length,Math.max(r.from+1,t+25));if(e<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return e<0?0:i.length}}var Wh=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Tm(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Tm(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(s instanceof ot){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+s.length}}},Ih=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new Ji)}getActions(t){let e=0,r=null,{parser:n}=t.p,{tokenizers:s}=n,o=n.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,a=0;for(let h=0;hc.end+25&&(a=Math.max(c.lookAhead,a)),c.value!=0)){let u=e;if(c.extended>-1&&(e=this.addActions(t,c.extended,c.end,e)),e=this.addActions(t,c.value,c.end,e),!f.extend&&(r=c,e>u))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),!r&&t.pos==this.stream.end&&(r=new Ji,r.value=t.p.parser.eofTerm,r.start=r.end=t.pos,e=this.addActions(t,r.value,r.end,e)),this.mainToken=r,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ji,{pos:r,p:n}=t;return e.start=r,e.end=Math.min(r+1,n.stream.end),e.value=r==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,r){let n=this.stream.clipPos(r.pos);if(e.token(this.stream.reset(n,t),r),t.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,r,n){for(let s=0;st.bufferLength*4?new Wh(r,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,r=this.stacks=[],n,s;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oe)r.push(l);else{if(this.advanceStack(l,r,t))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=n&&tb(n);if(o)return Nt&&console.log(\"Finish with \"+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Nt&&n&&console.log(\"Stuck with token \"+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):\"none\")),new SyntaxError(\"No parse at \"+e);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Nt&&console.log(\"Force-finish \"+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>e)&&this.recovering--}else if(r.length>1){t:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue t}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o \":\"\";if(this.stoppedAt!=null&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,f=h?t.curContext.hash:0;for(let c=this.fragments.nodeAt(n);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(t.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(E.contextHash)||0)==f))return t.useNode(c,u),Nt&&console.log(o+this.stackID(t)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof ot)||c.children.length==0||c.positions[0]>0)break;let d=c.children[0];if(d instanceof ot&&c.positions[0]==0)c=d;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Nt&&console.log(o+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let h=0;hn?e.push(m):r.push(m)}return!1}advanceFully(t,e){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return Pm(t,e),!0}}runRecovery(t,e,r){let n=null,s=!1;for(let o=0;o \":\"\";if(l.deadEnd&&(s||(s=!0,l.restart(),Nt&&console.log(f+this.stackID(l)+\" (restarted)\"),this.advanceFully(l,r))))continue;let c=l.split(),u=f;for(let d=0;c.forceReduce()&&d<10&&(Nt&&console.log(u+this.stackID(c)+\" (via force-reduce)\"),!this.advanceFully(c,r));d++)Nt&&(u=this.stackID(c)+\" -> \");for(let d of l.recoverByInsert(a))Nt&&console.log(f+this.stackID(d)+\" (via recover-insert)\"),this.advanceFully(d,r);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Nt&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Pm(l,r)):(!n||n.scorei,vo=class{constructor(t){this.start=t.start,this.shift=t.shift||qh,this.reduce=t.reduce||qh,this.reuse=t.reuse||qh,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},ko=class i extends _i{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(\" \");this.minRepeatTerm=e.length;for(let l=0;lt.topRules[l][1]),n=[];for(let l=0;l=0)s(f,a,l[h++]);else{let c=l[h+-f];for(let u=-f;u>0;u--)s(l[h++],a,c);h++}}}this.nodeSet=new Hr(e.map((l,a)=>bt.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:r.indexOf(a)>-1,error:a==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(a)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=un(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l==\"number\"?new Ke(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,r){let n=new Nh(this,t,e,r);for(let s of this.wrappers)n=s(n,t,e,r);return n}getGoto(t,e,r=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&r)return a;for(let h=s+(o>>1);s0}validAction(t,e){return!!this.allActions(t,r=>r==e?!0:null)}allActions(t,e){let r=this.stateSlot(t,4),n=r?e(r):void 0;for(let s=this.stateSlot(t,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Be(this.data,s+2);else break;n=e(Be(this.data,s+1))}return n}nextStates(t){let e=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Be(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];e.some((s,o)=>o&1&&s==n)||e.push(this.data[r],n)}}return e}configure(t){let e=Object.assign(Object.create(i.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=r}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(r=>{let n=t.tokenizers.find(s=>s.from==r);return n?n.to:r})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=t.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return e.specializers[n]=Cm(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),r=e.map(()=>!1);if(t)for(let s of t.split(\" \")){let o=e.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;sr)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorei.external(e,r)<<1|t}return i.get}var eb=1,Mm=206,Em=207,ib=208,Qm=209,rb=210,nb=211,sb=212,ob=2,lb=213,ab=214,hb=3,fb=215,cb=216,ub=4,db=217,pb=218,mb=5,gb=219,Ob=26,xb=27,yb=51,bb=52,Sb=57,wb=58,vb=59,kb=61,Tb=62,Pb=63,Cb=64,Ab=65,Qb=67,Rb=256,Mb=74,Eb=275,$b=120,qb=138,Db=159,Bb=160,Xb=163,dn=10,pn=13,Fh=32,To=9,_h=35,Lb=40,Vb=46,Rm=123,$m=39,qm=34,Wb=92,Ib=new Set([xb,yb,bb,Eb,Qb,qb,wb,vb,Rb,Cb,Ab,Mb,Tb,Pb,Db,Bb,Xb,$b]);function zh(i){return i==dn||i==pn}var Nb=new yi((i,t)=>{let e;if(i.next<0)i.acceptToken(nb);else if(t.context.depth<0)zh(i.next)&&i.acceptToken(rb,1);else if(((e=i.peek(-1))<0||zh(e))&&t.canShift(Qm)){let r=0;for(;i.next==Fh||i.next==To;)i.advance(),r++;(i.next==dn||i.next==pn||i.next==_h)&&i.acceptToken(Qm,-r)}else zh(i.next)&&i.acceptToken(ib,1)},{contextual:!0}),Yb=new yi((i,t)=>{let e=t.context.depth;if(e<0)return;let r=i.peek(-1);if(r==dn||r==pn){let n=0,s=0;for(;;){if(i.next==Fh)n++;else if(i.next==To)n+=8-n%8;else break;i.advance(),s++}n!=e&&i.next!=dn&&i.next!=pn&&i.next!=_h&&(n{for(let t=0;t<5;t++){if(i.next!=\"print\".charCodeAt(t))return;i.advance()}if(!/\\w/.test(String.fromCharCode(i.next)))for(let t=0;;t++){let e=i.peek(t);if(!(e==Fh||e==To)){e!=Lb&&e!=Vb&&e!=dn&&e!=pn&&e!=_h&&i.acceptToken(eb);return}}});function Po(i,t,e,r,n){return new yi(s=>{let o=s.pos;for(;!(s.next<0);)if(s.next==Rm)if(s.peek(1)==Rm)s.advance(2);else{if(s.pos==o){s.acceptToken(r,1);return}break}else if(s.next==Wb)s.advance(),s.next>=0&&s.advance();else if(s.next==i&&(t==1||s.peek(1)==i&&s.peek(2)==i)){if(s.pos==o){s.acceptToken(n,t);return}break}else s.advance();s.pos>o&&s.acceptToken(e)})}var Gb=Po($m,1,sb,ob,lb),Hb=Po(qm,1,ab,hb,fb),Ub=Po($m,3,cb,ub,db),jb=Po(qm,3,pb,mb,gb),Kb=Hs({'async \"*\" \"**\" FormatConversion FormatSpec':p.modifier,\"for while if elif else try except finally return raise break continue with pass assert await yield match case\":p.controlKeyword,\"in not and or is del\":p.operatorKeyword,\"from def class global nonlocal lambda\":p.definitionKeyword,import:p.moduleKeyword,\"with as print\":p.keyword,Boolean:p.bool,None:p.null,VariableName:p.variableName,\"CallExpression/VariableName\":p.function(p.variableName),\"FunctionDefinition/VariableName\":p.function(p.definition(p.variableName)),\"ClassDefinition/VariableName\":p.definition(p.className),PropertyName:p.propertyName,\"CallExpression/MemberExpression/PropertyName\":p.function(p.propertyName),Comment:p.lineComment,Number:p.number,String:p.string,FormatString:p.special(p.string),UpdateOp:p.updateOperator,\"ArithOp!\":p.arithmeticOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,AssignOp:p.definitionOperator,Ellipsis:p.punctuation,At:p.meta,\"( )\":p.paren,\"[ ]\":p.squareBracket,\"{ }\":p.brace,\".\":p.derefOperator,\", ;\":p.separator}),Jb={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:178,True:180,False:180,del:194,pass:198,break:202,continue:206,return:210,raise:218,import:222,as:224,global:228,nonlocal:230,assert:234,type:239,elif:252,while:256,try:262,except:264,finally:266,with:270,def:274,class:284,match:295,case:301},Dm=ko.deserialize({version:14,states:\"#)WO`Q#yOOP$bOSOOO%kQ&nO'#HhOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HgOOQS'#Hh'#HhOOQS'#DW'#DWOOQS'#Hg'#HgO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HXOOQS'#HX'#HXO'ZQ#xO'#HWO/ZQ&nO'#HWOOQS'#Ej'#EjO/rQ#xO'#EkOOQS'#HV'#HVO/|Q#xO'#HUOOQV'#HU'#HUO0XQ#xO'#FbOOQS'#Gj'#GjO0^Q#xO'#FaOOQV'#I_'#I_OOQV'#HT'#HTOOQV'#Fy'#FyQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HlO1cQ&nO'#E_O'ZQ#xO'#E`OOQS'#Eb'#EbOOQS'#Ed'#EdOOQS'#Ef'#EfO1wQ#xO'#EhO2_Q#xO'#ElO0XQ#xO'#EnO2rQ&nO'#EnO0XQ#xO'#EqO/rQ#xO'#EtO0XQ#xO'#EvO/rQ#xO'#E|O/rQ#xO'#FPO2}Q#xO'#FRO3UQ#xO'#FWO3aQ#xO'#FSO/rQ#xO'#FWO0XQ#xO'#FYO0XQ#xO'#F_O3fQ#xO'#FdP3mO#xO'#HSPOOO)CBv)CBvOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Ck'#CkOOQS'#Cl'#ClOOQS'#Cn'#CnO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO3xQ#xO'#DqOOQS,5:[,5:[O4]Q#xO'#HvOOQS,5:_,5:_O4jQMlO,5:_O4oQ&nO,59[O0lQ#xO,59dO0lQ#xO,59dO0lQ#xO,59dO7_Q#xO,59dO7dQ#xO,59dO7kQ#xO,59lO7rQ#xO'#HgO8xQ#xO'#HfOOQS'#Hf'#HfOOQS'#D^'#D^O9aQ#xO,59cO'ZQ#xO,59cO9oQ#xO,59cOOQS,59{,59{O9tQ#xO,5:TO'ZQ#xO,5:TOOQS,5:S,5:SO:SQ#xO,5:SO:XQ#xO,5:ZO'ZQ#xO,5:ZO'ZQ#xO,5:XOOQS,5:W,5:WO:jQ#xO,5:WO:oQ#xO,5:YOOOO'#GR'#GRO:tO,UO,5:cOOQS,5:c,5:cOOOO'#GS'#GSO:|O7[O,5:cO;UQ#xO'#DyOOOW'#GT'#GTO;fOWO,5:dOOQS,5:d,5:dO;UQ#xO'#EPOOO`'#GW'#GWO;qO`O,5:dO;UQ#xO'#EROOOp'#GX'#GXO;|OpO,5:dO;UQ#xO'#ETOOO!b'#GY'#GYOWOOQS,5>W,5>WO/rQ#xO'#EZOOQS'#E['#E[OGZQ#xO'#G]OGkQ#xO,59OOGkQ#xO,59OO)pQ#xO,5:wOGyQ&nO'#HoOOQS,5:z,5:zOOQS,5;S,5;SOH^Q#xO,5;WOHoQ#xO,5;YOOQS'#G`'#G`OH}Q&nO,5;YOI]Q#xO,5;YOIbQ#xO'#I]OOQS,5;],5;]OIpQ#xO'#IXOOQS,5;`,5;`OJRQ#xO,5;bO3aQ#xO,5;hO3aQ#xO,5;kOJZQ&nO'#I`O'ZQ#xO'#I`OJeQ#xO,5;mO2}Q#xO,5;mO/rQ#xO,5;rO0XQ#xO,5;tOJjQ#yO'#E}OKvQ#{O,5;nO! [Q#xO'#IaO3aQ#xO,5;rO! gQ#xO,5;tO! oQ#xO,5;yO! zQ&nO,5bOOQS'#Du'#DuOOQS1G/y1G/yOOQS1G/O1G/OO!-uQ&nO1G/OO!-|Q&nO1G/OO0lQ#xO1G/OO!.iQ#xO1G/WOOQS'#D]'#D]O/rQ#xO,59vOOQS1G.}1G.}O!.pQ#xO1G/gO!/QQ#xO1G/gO!/YQ#xO1G/hO'ZQ#xO'#HnO!/_Q#xO'#HnO!/dQ&nO1G.}O!/tQ#xO,59kO!0zQ#xO,5>^O!1[Q#xO,5>^O!1dQ#xO1G/oO!1iQ&nO1G/oOOQS1G/n1G/nO!1yQ#xO,5>XO!2pQ#xO,5>XO/rQ#xO1G/sO!3_Q#xO1G/uO!3dQ&nO1G/uO!3tQ&nO1G/sOOQS1G/r1G/rOOQS1G/t1G/tOOOO-E:P-E:POOQS1G/}1G/}OOOO-E:Q-E:QO!4UQ#xO'#IRO/rQ#xO'#IRO!4gQ#xO,5:eOOOW-E:R-E:ROOQS1G0O1G0OO!4uQ#xO,5:kOOO`-E:U-E:UO!5TQ#xO,5:mOOOp-E:V-E:VO!5cQ#xO,5:oOOO!b-E:W-E:WOOQS-E:X-E:XO!5qQ!LUO1G3^O!6bQ&nO1G3^O'ZQ#xO,5tOOQS1G1h1G1hO!7bQ#xO1G1hOOQS'#DX'#DXO/rQ#xO,5>TOOQS,5>T,5>TO!7gQ#xO'#FzO!7rQ#xO,59qO!7zQ#xO1G/ZO!8UQ&nO,5>XOOQS1G3r1G3rOOQS,5:u,5:uO!8uQ#xO'#HWOOQS,5ZO!9vQ#xO,5>ZO/rQ#xO1G0rO/rQ#xO1G0rO0XQ#xO1G0tOOQS-E:^-E:^O!:XQ#xO1G0tO!:dQ#xO1G0tO!:iQ#xO,5>wO!:wQ#xO,5>wO!;VQ#xO,5>sO!;mQ#xO,5>sO!zO!CZQ#xO,5>zO!CcQ&nO,5>zO/rQ#xO1G1XO!CmQ#xO1G1XO3aQ#xO1G1^O! gQ#xO1G1`OOQV,5;i,5;iO!CrQ#zO,5;iO!CwQ#{O1G1YO!G]Q#xO'#GgO3aQ#xO1G1YO3aQ#xO1G1YO!GmQ#xO,5>{O!GzQ#xO,5>{O0XQ#xO,5>{OOQV1G1^1G1^O!HSQ#xO'#F[O!HeQMlO1G1`O!HmQ#xO1G1`OOQV1G1e1G1eO3aQ#xO1G1eO!HrQ#xO1G1eO!HzQ#xO'#FfOOQV1G1j1G1jO! zQ&nO1G1jPOOO1G3Y1G3YP!IPOSO1G3YOOQS,5>a,5>aOOQS'#Dr'#DrO/rQ#xO,5>aO!IUQ#xO,5>`O!IiQ#xO,5>`OOQS1G/w1G/wO!IqQ#xO,5>cO!JRQ#xO,5>cO!JZQ#xO,5>cO!JnQ#xO,5>cO!KOQ#xO,5>cOOQS1G3|1G3|OOQS7+$j7+$jO!7zQ#xO7+$rO!LqQ#xO1G/OO!LxQ#xO1G/OOOQS1G/b1G/bOOQS,5YO'ZQ#xO,5>YOOQS7+$i7+$iO!MfQ#xO7+%RO!MnQ#xO7+%SO!MsQ#xO1G3xOOQS7+%Z7+%ZO!NTQ#xO1G3xO!N]Q#xO7+%ZOOQS,5mO##cQ#xO,5>mO##cQ#xO,5>mOOQS'#Dz'#DzO##tO$ISO'#D|O#$PO#tO'#ISOOOW1G0P1G0PO#$UQ#xO1G0PO#$^Q#xO1G0POOQS'#EQ'#EQOOO`1G0V1G0VO#$iQ#xO1G0VO#$qQ#xO1G0VOOQS'#ES'#ESOOOp1G0X1G0XO#$|Q#xO1G0XO#%UQ#xO1G0XOOQS'#EU'#EUOOO!b1G0Z1G0ZO#%aQ#xO1G0ZO#%iQ#xO1G0ZO#%tQ!LUO7+(xO#&eQ&nO1G2bP#'OQ#xO'#G[OOQS,5n,5>nOOOW7+%k7+%kO#;yQ#xO7+%kOOO`7+%q7+%qO#vO#=xQ#xO,5>vO0XQ#xO,5>vO#>ZQ#xO,5>uOOQS<`Q#xO,5>xO#>nQ#xO,5>xOOQS1G1O1G1OOOQS<vQ&nO1G2lP#?QQ#xO'#GfO#?XQ#xO7+*QO#?cQ#{O<}O#F{Q#xO,5>}OOQS,5>},5>}O#GWQ#xO,5>|O#GiQ#xO,5>|OOQS1G1b1G1bOOQS,5;x,5;xOOQV<XAN>XO#JxQ#xO<eAN>eO/rQ#xO1G2UO#KYQ&nO1G2UP#KdQ#xO'#GOOOQS1G2[1G2[P#KqQ#xO'#GUO#LOQ#xO7+)sO#LiQ#xO,5:iOOOO-E:T-E:TOOOW<[OOQSANBfANBfOOOO7+%o7+%oO$.WQ#xO7+%oOOQS7+(R7+(RO$.`Q#xO<kPP>n?`?cPP'f'fPP?{PP'f'fPP'f'f'f'f'f@P@y'fP@|PASE^H}IRPIUIlIpIsIwIzJOJRJV'fPPPJYJc'^P'^'^P'^P'^P'^P'^P'^'^'^P'^PP'^PP'^P'^PJiJuJ}PKUK[PKUPKUKUPPPKUPMjPMsM}NTMjPKUN^PKUPNeNkPNo! T! r!!]NoNo!!c!!pNoNoNoNo!#U!#[!#_!#d!#g!#q!#w!$T!$g!$m!$w!$}!%k!%q!%w!%}!&X!&_!&e!&k!&q!&w!'Z!'e!'k!'q!'w!(R!(X!(_!(e!(k!(u!({!)V!)]!)f!)l!){!*T!*_!*fPPPPPPPPPPPPPPPPP!*l!*o!*u!+O!+Y!+ePPPPPPPPPPPP!0[!1p!5s!9WPP!9`!9r!9{!:t!:k!:}!;T!;W!;Z!;^!;f!V!>]!>f!>i!>l!>r!>x!?O!?RP!?Z!?d!@`!@c]jOs#v$w*`,p(TeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o}!hQ#r$P$b$q$}%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!P!iQ#r$P$b$q$}%S%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!R!jQ#r$P$b$q$}%S%T%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!T!kQ#r$P$b$q$}%S%T%U%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!V!lQ#r$P$b$q$}%S%T%U%V%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!X!mQ#r$P$b$q$}%S%T%U%V%W%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!]!mQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d(TTOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o&iVOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1o%sXOYZ[isw}!O!S!U!V!Z!n!p#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$VvQ0X/fR1l1n'zeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oW#ym!P!Q$hW$Rv&q/f1nQ$j!RQ$n!TQ${![Q$|!]W%Z!n(O+O-WS&p$S$TQ'e$vQ)b&jQ)p'QU)q'S)r)sU)t'U)u,ZW){'Y,^-z.vQ*l'nW*m'p-P._/OQ,])zS-O*n*oY-t,U-u.s.t/lQ-w,WQ.U,tQ.Y,wQ.|.Wl/R.c/X/Y/[/w/y0O0g0l0q0v1R1W1ZQ/k.rQ0P/ZQ0^/qQ0i/{U0|0r1P1XX1S0w1T1[1]R&o$R!_!|YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WR%k!{Q#QYQ&W#cQ&Z#gQ&]#jQ&_#mQ&x$^Q&{$aR-l+tT/e.j0p![!oQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dQ&m#zQ't$|R*x'uR'}%ZQ%d!rR0[/o(SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oS#pd#q!P/V.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1](SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oT#pd#qT#d`#eR)Q&Wy(}&W&Z&]&_)P)Q)T)U)X)Y)])^+y+{+},P-l.p.q/jT+u(|+vR.q-lT#ha#iR)U&ZT#kb#lR)Y&]T#nc#oR)^&_Q$`xQ,]){R,}*mX$^x$_$`&zQ'[$nQ'r${Q'u$|R*_'eQ)|'YV-y,^-z.vZlOs$w*`,pXpOs*`,pQ$x!YQ']$oQ'^$pQ'o$zQ's$|Q*]'dQ*d'iQ*g'jQ*h'kQ*u'qS*w't'uQ,d*RQ,f*SQ,g*TQ,k*ZS,m*^*vQ,q*bQ,r*cS,s*e*fQ-T*xQ-|,cQ-},eQ.P,lS.Q,n,oQ.V,uQ.X,vQ.w.OQ.y.RQ.z.TQ.{.UQ/m.xQ/n.|Q0T/_R0o0UWpOs*`,pR#|oQ'q${S*^'e'rR,o*_Q,|*mR.],}Q*v'qQ,n*^R.R,oZnOos*`,pQ'w$}R*z'xT.a-U.bu/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1Zt/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZQ0P/ZX1S0w1T1[1]!P/U.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1]Q/t/TR0c/ug/w/W/x0_0f0k0y0{0}1Y1^1_u/].c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZX/r/R/]0^0|R0`/qV1O0r1P1XR0U/_QsOS$Os,pR,p*`Q&r$UR)g&rS%z#W$WS(p%z(sT(s%}&tQ%n#OQ%u#SW(b%n%u(g(kQ(g%rR(k%wQ&}$bR)m&}Q(v&OQ+g(qT+m(v+gQ(P%]R+P(PS(S%`%aY+T(S+U-^.h/cU+U(T(U(VU-^+V+W+XS.h-_-`R/c.iQ#_^R&R#_Q#b_R&T#bQ#e`R&X#eQ(y&US+r(y+sR+s(zQ+v(|R-m+vQ#iaR&[#iQ#lbR&^#lQ#ocR&`#oQ#qdR&a#qQ#tgQ&c#rW&f#t&c)j,RQ)j&wR,R1dQ$_xS&y$_&zR&z$`Q'X$lR)y'XQ&k#yR)c&kQ$h!QR'R$hQ,V)qS-v,V.uR.u-wQ'V$jR)v'VQ,_)|R-{,_Q#wkR&h#wQ*Q']R,b*QQ'`$qS*X'`*YR*Y'aQ'h$xR*a'hQ'm$yS*k'm,zR,z*lQ-Q*qR.`-QWoOs*`,pR#{oQ.b-UR/P.bd/x/W0_0f0k0y0{0}1Y1^1_R0e/xU/p/R0^0|R0]/pQ0x0kS1U0x1VR1V0yS0s0_0`R1Q0sQ/z/WR0h/zR!`PXrOs*`,pWqOs*`,pR'f$wYkOs$w*`,pR&g#v[xOs#v$w*`,pR&x$^&hQOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1oQ!sTQ#rfQ$PtU$by%p(eS$q!W$tQ$}!^Q%S!hQ%T!iQ%U!jQ%V!kQ%W!lQ%X!mQ%r#PQ%w#TQ%}#XQ&O#YQ&t$XQ'a$rQ'x%OQ)`&dU)k&|)l,SW*U'_*W,i,jQ+Z(_Q+d(nQ,h*VQ-g+lQ0n0SR1d1iQ#OYQ#SZQ$o!UQ$p!VQ%`!pQ(V%a^(^%m%t(a(i+]+`+b^+Q(R+S-[-].g/b0WQ+W(TQ+X(UQ,e*RQ-Z+RQ-_+VQ.e-XQ.f-YQ.i-`Q/`.dR0V/a[gOs#v$w*`,p!^!{YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WQ#W[Q#uiS$Ww}Q$e!OW$l!S$a'b*[S$y!Z$uW%Y!n(O+O-WY&U#c#g#j#m+t`&e#s&b)_)a)i,Q-r1hQ&u$YQ&v$[Q&w$^Q'{%[Q(]%kW(m%y(o+e+iQ(q%{Q(z&VQ)e&oS)h&s1fQ)n'OQ)o'PU)w'W)x,[Q*O'ZQ*e'iY*i'l*j,x,y.ZQ*|'}S+Y(Y1gW+k(u+f-d-hW+o(x+q-j-kQ,a*PQ,u*fQ-S*tQ-i+pQ-s,TQ.[,|Q.m-fR.}.]hUOs#s#v$w&b&s(Y)_)a*`,p%Y!zYZ[iw}!O!S!U!V!Z!n!p#c#g#j#m$Y$[$^$a$u%[%a%k%m%t%y%{&V&o'O'P'W'Z'b'i'l'}(O(R(T(U(a(i(o(u(x)i)x*P*R*[*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$QuW%e!t!x1a1kQ%f!uQ%g!vQ%i!yQ%s1`S(X%h1eQ(Z1bQ([1cQ-a+^Q.l-bS/d.j0pR1m1oU$Uv/f1nR)f&q[hOs#v$w*`,pa!}Y#c#g#j#m$^$a+tQ#][Q$ZwR$d}Q%o#OQ%v#SQ%|#WQ'{%YQ(h%rQ(l%wQ(t%}Q(w&OQ+h(qQ-V*|Q.k-aQ/h.lR0Y/gQ$cyQ(d%pR+_(eQ/g.jR0z0pR#VZR#[[R%_!nQ%]!nV*}(O+O-W!]!qQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-l+tQ)O&WQ)S&ZQ)W&]Q)[&_S+x)P)QS+z)T)US+|)X)YS,O)])^Q-n+yQ-o+{Q-p+}Q-q,PQ.o-lS/i.p.qR0Z/jQ$m!SQ&{$aQ*Z'bR,l*[Q#zmQ$f!PQ$i!QR'T$hQ)p'SR,Y)sQ)p'SQ,X)rR,Y)sR$k!RR)}'YXqOs*`,pQ$s!WR'c$tQ$z!ZR'd$uR*s'pQ*q'pV.^-P._/OQ/_.cQ/|/XR/}/YU/W.c/X/YQ0R/[Q0_/qQ0d/wU0f/y0g0vQ0k0OQ0y0lQ0{0qU0}0r1P1XQ1Y1RQ1^1WR1_1ZR0Q/ZR0a/q\",nodeNames:\"\\u26A0 print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard\",maxTerm:288,context:Fb,nodeProps:[[\"isolate\",-8,6,73,74,75,79,81,83,85,\"\"],[\"group\",-15,8,93,95,96,98,100,102,104,106,107,108,110,113,116,118,\"Statement Statement\",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,87,88,89,90,\"Expression\",-10,122,124,127,129,130,134,136,141,143,146,\"Statement\",-9,151,152,155,156,158,159,160,161,162,\"Pattern\"],[\"openedBy\",25,\"(\",56,\"[\",60,\"{\"],[\"closedBy\",26,\")\",57,\"]\",61,\"}\"]],propSources:[Kb],skippedNodes:[0,6],repeatNodeCount:38,tokenData:\"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&w!b&oS&rW%u!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&w!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&w!b&oS&rWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cDXa&w!b&oS&msOYE^YZ%TZ]E^]^%T^rE^rs!)|swE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cEia&w!b&oS&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cFw]&w!b&oS&msOr%Trs'Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cGya&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxIOx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cIXa&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxJ^x#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#_Jg_&w!b&rW&msOYJ^YZ1XZ]J^]^1X^rJ^rsKfs#OJ^#O#PL`#P#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`!!o<%lOJ^#_KmZ&w!b&msOr1Xrs2ys#O1X#O#P3q#P#o1X#o#p4`#p#q1X#q#r4`#r;'S1X;'S;=`7i<%lO1X#_LeW&w!bO#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`! r;=`<%lL}<%lOJ^{MUZ&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l<%lOL}{M|V&msOr4`rs5ds#O4`#O#P5y#P;'S4`;'S;=`6t<%lO4`{NfRO;'SL};'S;=`No;=`OL}{Nv[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lL}<%lOL}{! oP;=`<%lL}#_! y[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lJ^<%lOL}#_!!rP;=`<%lJ^#c!!zW&w!bO#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!(q;=`<%l!#d<%lOE^!P!#m]&oS&rW&msOY!#dYZ8^Z]!#d]^8^^r!#drs!$fsw!#dwx!%Yx#O!#d#O#P!'Y#P;'S!#d;'S;=`!(k<%lO!#d!P!$mX&oS&msOr8^rs9rsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`^s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!>e_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!?ds#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!?k_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!3`s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!@q[U!T&w!bOY!=UYZ1XZ]!=U]^1X^#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!Ec;=`<%l4`<%lO!=U!]!AnZU!T&rWOY!AgYZ4`Z]!Ag]^4`^r!Agrs!Bas#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!BfZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!CXs#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!C^ZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!4Ys#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!DUWU!TOY!AgYZ4`Z]!Ag]^4`^;'S!Ag;'S;=`!Dn;=`<%l4`<%lO!Ag!]!DsW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&w!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&oS&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&oS&rWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&w!b&oS&rW&l`&XsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Jb[i]||-1}],tokenPrec:7500});var Bm=new zs,Vm=new Set([\"Script\",\"Body\",\"FunctionDefinition\",\"ClassDefinition\",\"LambdaExpression\",\"ForStatement\",\"MatchClause\"]);function Co(i){return(t,e,r)=>{if(r)return!1;let n=t.node.getChild(\"VariableName\");return n&&e(n,i),!0}}var tS={FunctionDefinition:Co(\"function\"),ClassDefinition:Co(\"class\"),ForStatement(i,t,e){if(e){for(let r=i.node.firstChild;r;r=r.nextSibling)if(r.name==\"VariableName\")t(r,\"variable\");else if(r.name==\"in\")break}},ImportStatement(i,t){var e,r;let{node:n}=i,s=((e=n.firstChild)===null||e===void 0?void 0:e.name)==\"from\";for(let o=n.getChild(\"import\");o;o=o.nextSibling)o.name==\"VariableName\"&&((r=o.nextSibling)===null||r===void 0?void 0:r.name)!=\"as\"&&t(o,s?\"variable\":\"namespace\")},AssignStatement(i,t){for(let e=i.node.firstChild;e;e=e.nextSibling)if(e.name==\"VariableName\")t(e,\"variable\");else if(e.name==\":\"||e.name==\"AssignOp\")break},ParamList(i,t){for(let e=null,r=i.node.firstChild;r;r=r.nextSibling)r.name==\"VariableName\"&&(!e||!/\\*|AssignOp/.test(e.name))&&t(r,\"variable\"),e=r},CapturePattern:Co(\"variable\"),AsPattern:Co(\"variable\"),__proto__:null};function Wm(i,t){let e=Bm.get(t);if(e)return e;let r=[],n=!0;function s(o,l){let a=i.sliceString(o.from,o.to);r.push({label:a,type:l})}return t.cursor(st.IncludeAnonymous).iterate(o=>{if(o.name){let l=tS[o.name];if(l&&l(o,s,n)||!n&&Vm.has(o.name))return!1;n=!1}else if(o.to-o.from>8192){for(let l of Wm(i,o.node))r.push(l);return!1}}),Bm.set(t,r),r}var Xm=/^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/,Im=[\"String\",\"FormatString\",\"Comment\",\"PropertyName\"];function eS(i){let t=pt(i.state).resolveInner(i.pos,-1);if(Im.indexOf(t.name)>-1)return null;let e=t.name==\"VariableName\"||t.to-t.from<20&&Xm.test(i.state.sliceDoc(t.from,t.to));if(!e&&!i.explicit)return null;let r=[];for(let n=t;n;n=n.parent)Vm.has(n.name)&&(r=r.concat(Wm(i.state.doc,n)));return{options:r,from:e?t.from:i.pos,validFor:Xm}}var iS=[\"__annotations__\",\"__builtins__\",\"__debug__\",\"__doc__\",\"__import__\",\"__name__\",\"__loader__\",\"__package__\",\"__spec__\",\"False\",\"None\",\"True\"].map(i=>({label:i,type:\"constant\"})).concat([\"ArithmeticError\",\"AssertionError\",\"AttributeError\",\"BaseException\",\"BlockingIOError\",\"BrokenPipeError\",\"BufferError\",\"BytesWarning\",\"ChildProcessError\",\"ConnectionAbortedError\",\"ConnectionError\",\"ConnectionRefusedError\",\"ConnectionResetError\",\"DeprecationWarning\",\"EOFError\",\"Ellipsis\",\"EncodingWarning\",\"EnvironmentError\",\"Exception\",\"FileExistsError\",\"FileNotFoundError\",\"FloatingPointError\",\"FutureWarning\",\"GeneratorExit\",\"IOError\",\"ImportError\",\"ImportWarning\",\"IndentationError\",\"IndexError\",\"InterruptedError\",\"IsADirectoryError\",\"KeyError\",\"KeyboardInterrupt\",\"LookupError\",\"MemoryError\",\"ModuleNotFoundError\",\"NameError\",\"NotADirectoryError\",\"NotImplemented\",\"NotImplementedError\",\"OSError\",\"OverflowError\",\"PendingDeprecationWarning\",\"PermissionError\",\"ProcessLookupError\",\"RecursionError\",\"ReferenceError\",\"ResourceWarning\",\"RuntimeError\",\"RuntimeWarning\",\"StopAsyncIteration\",\"StopIteration\",\"SyntaxError\",\"SyntaxWarning\",\"SystemError\",\"SystemExit\",\"TabError\",\"TimeoutError\",\"TypeError\",\"UnboundLocalError\",\"UnicodeDecodeError\",\"UnicodeEncodeError\",\"UnicodeError\",\"UnicodeTranslateError\",\"UnicodeWarning\",\"UserWarning\",\"ValueError\",\"Warning\",\"ZeroDivisionError\"].map(i=>({label:i,type:\"type\"}))).concat([\"bool\",\"bytearray\",\"bytes\",\"classmethod\",\"complex\",\"float\",\"frozenset\",\"int\",\"list\",\"map\",\"memoryview\",\"object\",\"range\",\"set\",\"staticmethod\",\"str\",\"super\",\"tuple\",\"type\"].map(i=>({label:i,type:\"class\"}))).concat([\"abs\",\"aiter\",\"all\",\"anext\",\"any\",\"ascii\",\"bin\",\"breakpoint\",\"callable\",\"chr\",\"compile\",\"delattr\",\"dict\",\"dir\",\"divmod\",\"enumerate\",\"eval\",\"exec\",\"exit\",\"filter\",\"format\",\"getattr\",\"globals\",\"hasattr\",\"hash\",\"help\",\"hex\",\"id\",\"input\",\"isinstance\",\"issubclass\",\"iter\",\"len\",\"license\",\"locals\",\"max\",\"min\",\"next\",\"oct\",\"open\",\"ord\",\"pow\",\"print\",\"property\",\"quit\",\"repr\",\"reversed\",\"round\",\"setattr\",\"slice\",\"sorted\",\"sum\",\"vars\",\"zip\"].map(i=>({label:i,type:\"function\"}))),rS=[Pe(\"def ${name}(${params}):\\n\t${}\",{label:\"def\",detail:\"function\",type:\"keyword\"}),Pe(\"for ${name} in ${collection}:\\n\t${}\",{label:\"for\",detail:\"loop\",type:\"keyword\"}),Pe(\"while ${}:\\n\t${}\",{label:\"while\",detail:\"loop\",type:\"keyword\"}),Pe(\"try:\\n\t${}\\nexcept ${error}:\\n\t${}\",{label:\"try\",detail:\"/ except block\",type:\"keyword\"}),Pe(`if \\${}:\n\t\n`,{label:\"if\",detail:\"block\",type:\"keyword\"}),Pe(\"if ${}:\\n\t${}\\nelse:\\n\t${}\",{label:\"if\",detail:\"/ else block\",type:\"keyword\"}),Pe(\"class ${name}:\\n\tdef __init__(self, ${params}):\\n\t\t\t${}\",{label:\"class\",detail:\"definition\",type:\"keyword\"}),Pe(\"import ${module}\",{label:\"import\",detail:\"statement\",type:\"keyword\"}),Pe(\"from ${module} import ${names}\",{label:\"from\",detail:\"import\",type:\"keyword\"})],nS=Ap(Im,wh(iS.concat(rS)));function Lm(i,t){let e=i.baseIndentFor(t),r=i.lineAt(i.pos,-1),n=r.from+r.text.length;return/^\\s*($|#)/.test(r.text)&&i.node.toe?null:e+i.unit}var Gh=Us.define({name:\"python\",parser:Dm.configure({props:[lh.add({Body:i=>{var t;return(t=Lm(i,i.node))!==null&&t!==void 0?t:i.continue()},IfStatement:i=>/^\\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\\s*(except |finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),\"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression\":Ks({closing:\")\"}),\"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression\":Ks({closing:\"}\"}),\"ArrayExpression ArrayComprehensionExpression\":Ks({closing:\"]\"}),\"String FormatString\":()=>null,Script:i=>{if(i.pos+/\\s*/.exec(i.textAfter)[0].length>=i.node.to){let t=null;for(let e=i.node,r=e.to;e=e.lastChild,!(!e||e.to!=r);)e.type.name==\"Body\"&&(t=e);if(t){let e=Lm(i,t);if(e!=null)return e}}return i.continue()}}),ah.add({\"ArrayExpression DictionaryExpression SetExpression TupleExpression\":ap,Body:(i,t)=>({from:i.from+1,to:i.to-(i.to==t.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:[\"(\",\"[\",\"{\",\"'\",'\"',\"'''\",'\"\"\"'],stringPrefixes:[\"f\",\"fr\",\"rf\",\"r\",\"u\",\"b\",\"br\",\"rb\",\"F\",\"FR\",\"RF\",\"R\",\"U\",\"B\",\"BR\",\"RB\"]},commentTokens:{line:\"#\"},indentOnInput:/^\\s*([\\}\\]\\)]|else:|elif |except |finally:)$/}});function Hh(){return new js(Gh,[Gh.data.of({autocomplete:eS}),Gh.data.of({autocomplete:nS})])}function z(){var i=arguments[0];typeof i==\"string\"&&(i=document.createElement(i));var t=1,e=arguments[1];if(e&&typeof e==\"object\"&&e.nodeType==null&&!Array.isArray(e)){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n==\"string\"?i.setAttribute(r,n):n!=null&&(i[r]=n)}t++}for(;tl.from==l.to||l.from==l.to-1&&r.doc.lineAt(l.from).to==l.from?R.widget({widget:new jh(l),diagnostic:l}).range(l.from):R.mark({attributes:{class:\"cm-lintRange cm-lintRange-\"+l.severity+(l.markClass?\" \"+l.markClass:\"\")},diagnostic:l,inclusive:!0}).range(l.from,l.to)),!0);return new i(o,e,tr(o))}};function tr(i,t=null,e=0){let r=null;return i.between(e,1e9,(n,s,{spec:o})=>{if(!(t&&o.diagnostic!=t))return r=new Uh(n,s,o.diagnostic),!1}),r}function sS(i,t){let e=i.startState.doc.lineAt(t.pos);return!!(i.effects.some(r=>r.is(zm))||i.changes.touchesRange(e.from,e.to))}function oS(i,t){return i.field(Yt,!1)?t:t.concat(M.appendConfig.of(pS))}var zm=M.define(),Kh=M.define(),Zm=M.define(),Yt=it.define({create(){return new bi(R.none,null,null)},update(i,t){if(t.docChanged){let e=i.diagnostics.map(t.changes),r=null;if(i.selected){let n=t.changes.mapPos(i.selected.from,1);r=tr(e,i.selected.diagnostic,n)||tr(e,null,n)}i=new bi(e,i.panel,r)}for(let e of t.effects)e.is(zm)?i=bi.init(e.value,i.panel,t.state):e.is(Kh)?i=new bi(i.diagnostics,e.value?Ro.open:null,i.selected):e.is(Zm)&&(i=new bi(i.diagnostics,i.panel,e.value));return i},provide:i=>[fi.from(i,t=>t.panel),T.decorations.from(i,t=>t.diagnostics)]});var lS=R.mark({class:\"cm-lintRange cm-lintRange-active\",inclusive:!0});function aS(i,t,e){let{diagnostics:r}=i.state.field(Yt),n=[],s=2e8,o=0;r.between(t-(e<0?1:0),t+(e>0?1:0),(a,h,{spec:f})=>{t>=a&&t<=h&&(a==h||(t>a||e>0)&&(tGm(i,e,!1)))}var fS=i=>{let t=i.state.field(Yt,!1);(!t||!t.panel)&&i.dispatch({effects:oS(i.state,[Kh.of(!0)])});let e=ci(i,Ro.open);return e&&e.dom.querySelector(\".cm-panel-lint ul\").focus(),!0},Ym=i=>{let t=i.state.field(Yt,!1);return!t||!t.panel?!1:(i.dispatch({effects:Kh.of(!1)}),!0)},cS=i=>{let t=i.state.field(Yt,!1);if(!t)return!1;let e=i.state.selection.main,r=t.diagnostics.iter(e.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==e.from&&r.to==e.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var Mo=[{key:\"Mod-Shift-m\",run:fS,preventDefault:!0},{key:\"F8\",run:cS}];var Fm=A.define({combine(i){return Object.assign({sources:i.map(t=>t.source).filter(t=>t!=null)},kt(i.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(t,e)=>t?e?r=>t(r)||e(r):t:e}))}});function _m(i){let t=[];if(i)t:for(let{name:e}of i){for(let r=0;rs.toLowerCase()==n.toLowerCase())){t.push(n);continue t}}t.push(\"\")}return t}function Gm(i,t,e){var r;let n=e?_m(t.actions):[];return z(\"li\",{class:\"cm-diagnostic cm-diagnostic-\"+t.severity},z(\"span\",{class:\"cm-diagnosticText\"},t.renderMessage?t.renderMessage():t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=u=>{if(u.preventDefault(),l)return;l=!0;let d=tr(i.state.field(Yt).diagnostics,t);d&&s.apply(i,d.from,d.to)},{name:h}=s,f=n[o]?h.indexOf(n[o]):-1,c=f<0?h:[h.slice(0,f),z(\"u\",h.slice(f,f+1)),h.slice(f+1)];return z(\"button\",{type:\"button\",class:\"cm-diagnosticAction\",onclick:a,onmousedown:a,\"aria-label\":` Action: ${h}${f<0?\"\":` (access key \"${n[o]})\"`}.`},c)}),t.source&&z(\"div\",{class:\"cm-diagnosticSource\"},t.source))}var jh=class extends Ut{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return z(\"span\",{class:\"cm-lintPoint cm-lintPoint-\"+this.diagnostic.severity})}},Qo=class{constructor(t,e){this.diagnostic=e,this.id=\"item_\"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Gm(t,e,!0),this.dom.id=this.id,this.dom.setAttribute(\"role\",\"option\")}},Ro=class i{constructor(t){this.view=t,this.items=[];let e=n=>{if(n.keyCode==27)Ym(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=_m(s.actions);for(let l=0;l{for(let s=0;sYm(this.view)},\"\\xD7\")),this.update()}get selectedIndex(){let t=this.view.state.field(Yt).selected;if(!t)return-1;for(let e=0;e{let h=-1,f;for(let c=r;cr&&(this.items.splice(r,h-r),n=!0)),e&&f.diagnostic==e.diagnostic?f.dom.hasAttribute(\"aria-selected\")||(f.dom.setAttribute(\"aria-selected\",\"true\"),s=f):f.dom.hasAttribute(\"aria-selected\")&&f.dom.removeAttribute(\"aria-selected\"),r++});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute(\"aria-activedescendant\"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)e();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Yt),r=tr(e.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Zm.of(r)})}static open(t){return new i(t)}};function uS(i,t='viewBox=\"0 0 40 40\"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function Ao(i){return uS(``,'width=\"6\" height=\"3\"')}var dS=T.baseTheme({\".cm-diagnostic\":{padding:\"3px 6px 3px 8px\",marginLeft:\"-1px\",display:\"block\",whiteSpace:\"pre-wrap\"},\".cm-diagnostic-error\":{borderLeft:\"5px solid #d11\"},\".cm-diagnostic-warning\":{borderLeft:\"5px solid orange\"},\".cm-diagnostic-info\":{borderLeft:\"5px solid #999\"},\".cm-diagnostic-hint\":{borderLeft:\"5px solid #66d\"},\".cm-diagnosticAction\":{font:\"inherit\",border:\"none\",padding:\"2px 4px\",backgroundColor:\"#444\",color:\"white\",borderRadius:\"3px\",marginLeft:\"8px\",cursor:\"pointer\"},\".cm-diagnosticSource\":{fontSize:\"70%\",opacity:.7},\".cm-lintRange\":{backgroundPosition:\"left bottom\",backgroundRepeat:\"repeat-x\",paddingBottom:\"0.7px\"},\".cm-lintRange-error\":{backgroundImage:Ao(\"#d11\")},\".cm-lintRange-warning\":{backgroundImage:Ao(\"orange\")},\".cm-lintRange-info\":{backgroundImage:Ao(\"#999\")},\".cm-lintRange-hint\":{backgroundImage:Ao(\"#66d\")},\".cm-lintRange-active\":{backgroundColor:\"#ffdd9980\"},\".cm-tooltip-lint\":{padding:0,margin:0},\".cm-lintPoint\":{position:\"relative\",\"&:after\":{content:'\"\"',position:\"absolute\",bottom:0,left:\"-2px\",borderLeft:\"3px solid transparent\",borderRight:\"3px solid transparent\",borderBottom:\"4px solid #d11\"}},\".cm-lintPoint-warning\":{\"&:after\":{borderBottomColor:\"orange\"}},\".cm-lintPoint-info\":{\"&:after\":{borderBottomColor:\"#999\"}},\".cm-lintPoint-hint\":{\"&:after\":{borderBottomColor:\"#66d\"}},\".cm-panel.cm-panel-lint\":{position:\"relative\",\"& ul\":{maxHeight:\"100px\",overflowY:\"auto\",\"& [aria-selected]\":{backgroundColor:\"#ddd\",\"& u\":{textDecoration:\"underline\"}},\"&:focus [aria-selected]\":{background_fallback:\"#bdf\",backgroundColor:\"Highlight\",color_fallback:\"white\",color:\"HighlightText\"},\"& u\":{textDecoration:\"none\"},padding:0,margin:0},\"& [name=close]\":{position:\"absolute\",top:\"0\",right:\"2px\",background:\"inherit\",border:\"none\",font:\"inherit\",padding:0,margin:0}}});var pS=[Yt,T.decorations.compute([Yt],i=>{let{selected:t,panel:e}=i.field(Yt);return!t||!e||t.from==t.to?R.none:R.set([lS.range(t.from,t.to)])}),Id(aS,{hideOn:sS}),dS];var Hm=typeof String.prototype.normalize==\"function\"?i=>i.normalize(\"NFKD\"):i=>i,ti=class{constructor(t,e,r=0,n=t.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=\"\",this.bufferPos=0,this.iter=t.iterRange(r,n),this.bufferStart=r,this.normalize=s?l=>s(Hm(l)):Hm,this.query=this.normalize(e)}peek(){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 dt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=vr(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=wt(t);let n=this.normalize(e);for(let s=0,o=r;;s++){let l=n.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==n.length-1){if(a)return this.value=a,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=\"\":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let r=this.curLineStart+e.index,n=r+e[0].length;if(this.matchPos=Xo(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||n.to<=e){let l=new i(e,t.sliceString(e,r));return Jh.set(t,l),l}if(n.from==e&&n.to==r)return n;let{text:s,from:o}=n;return o>e&&(s=t.sliceString(e,o)+s,o=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let r=this.flat.from+e.index,n=r+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this.matchPos=Xo(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Do.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<\"u\"&&(qo.prototype[Symbol.iterator]=Bo.prototype[Symbol.iterator]=function(){return this});function mS(i){try{return new RegExp(i,of),!0}catch{return!1}}function Xo(i,t){if(t>=i.length)return t;let e=i.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}function tf(i){let t=String(i.state.doc.lineAt(i.state.selection.main.head).number),e=z(\"input\",{class:\"cm-textfield\",name:\"line\",value:t}),r=z(\"form\",{class:\"cm-gotoLine\",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:Lo.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),n())},onsubmit:s=>{s.preventDefault(),n()}},z(\"label\",i.state.phrase(\"Go to line\"),\": \",e),\" \",z(\"button\",{class:\"cm-button\",type:\"submit\"},i.state.phrase(\"go\")));function n(){let s=/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:o}=i,l=o.doc.lineAt(o.selection.main.head),[,a,h,f,c]=s,u=f?+f.slice(1):0,d=h?+h:l.number;if(h&&c){let g=d/100;a&&(g=g*(a==\"-\"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a==\"-\"?-1:1)+l.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),O=b.cursor(m.from+Math.max(0,Math.min(u,m.length)));i.dispatch({effects:[Lo.of(!1),T.scrollIntoView(O.from,{y:\"center\"})],selection:O}),i.focus()}return{dom:r}}var Lo=M.define(),Um=it.define({create(){return!0},update(i,t){for(let e of t.effects)e.is(Lo)&&(i=e.value);return i},provide:i=>fi.from(i,t=>t?tf:null)}),gS=i=>{let t=ci(i,tf);if(!t){let e=[Lo.of(!0)];i.state.field(Um,!1)==null&&e.push(M.appendConfig.of([Um,OS])),i.dispatch({effects:e}),t=ci(i,tf)}return t&&t.dom.querySelector(\"input\").select(),!0},OS=T.baseTheme({\".cm-panel.cm-gotoLine\":{padding:\"2px 6px 4px\",\"& label\":{fontSize:\"80%\"}}}),xS={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tg=A.define({combine(i){return kt(i,xS,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}});function eg(i){let t=[vS,wS];return i&&t.push(tg.of(i)),t}var yS=R.mark({class:\"cm-selectionMatch\"}),bS=R.mark({class:\"cm-selectionMatch cm-selectionMatch-main\"});function jm(i,t,e,r){return(e==0||i(t.sliceDoc(e-1,e))!=F.Word)&&(r==t.doc.length||i(t.sliceDoc(r,r+1))!=F.Word)}function SS(i,t,e,r){return i(t.sliceDoc(e,e+1))==F.Word&&i(t.sliceDoc(r-1,r))==F.Word}var wS=ft.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=i.state.facet(tg),{state:e}=i,r=e.selection;if(r.ranges.length>1)return R.none;let n=r.main,s,o=null;if(n.empty){if(!t.highlightWordAroundCursor)return R.none;let a=e.wordAt(n.head);if(!a)return R.none;o=e.charCategorizer(n.head),s=e.sliceDoc(a.from,a.to)}else{let a=n.to-n.from;if(a200)return R.none;if(t.wholeWords){if(s=e.sliceDoc(n.from,n.to),o=e.charCategorizer(n.head),!(jm(o,e,n.from,n.to)&&SS(o,e,n.from,n.to)))return R.none}else if(s=e.sliceDoc(n.from,n.to),!s)return R.none}let l=[];for(let a of i.visibleRanges){let h=new ti(e.doc,s,a.from,a.to);for(;!h.next().done;){let{from:f,to:c}=h.value;if((!o||jm(o,e,f,c))&&(n.empty&&f<=n.from&&c>=n.to?l.push(bS.range(f,c)):(f>=n.to||c<=n.from)&&l.push(yS.range(f,c)),l.length>t.maxMatches))return R.none}}return R.set(l)}},{decorations:i=>i.decorations}),vS=T.baseTheme({\".cm-selectionMatch\":{backgroundColor:\"#99ff7780\"},\".cm-searchMatch .cm-selectionMatch\":{backgroundColor:\"transparent\"}}),kS=({state:i,dispatch:t})=>{let{selection:e}=i,r=b.create(e.ranges.map(n=>i.wordAt(n.head)||b.cursor(n.head)),e.mainIndex);return r.eq(e)?!1:(t(i.update({selection:r})),!0)};function TS(i,t){let{main:e,ranges:r}=i.selection,n=i.wordAt(e.head),s=n&&n.from==e.from&&n.to==e.to;for(let o=!1,l=new ti(i.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ti(i.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var PS=({state:i,dispatch:t})=>{let{ranges:e}=i.selection;if(e.some(s=>s.from===s.to))return kS({state:i,dispatch:t});let r=i.sliceDoc(e[0].from,e[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=r))return!1;let n=TS(i,r);return n?(t(i.update({selection:i.selection.addRange(b.range(n.from,n.to),!1),effects:T.scrollIntoView(n.to)})),!0):!1},rr=A.define({combine(i){return kt(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new sf(t),scrollToMatch:t=>T.scrollIntoView(t)})}});var Vo=class{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||\"\",this.valid=!!this.search&&(!this.regexp||mS(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\\\([nrt\\\\])/g,(e,r)=>r==\"n\"?`\n`:r==\"r\"?\"\\r\":r==\"t\"?\"\t\":\"\\\\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new rf(this):new ef(this)}getCursor(t,e=0,r){let n=t.doc?t:Y.create({doc:t});return r==null&&(r=n.doc.length),this.regexp?ir(this,n,e,r):er(this,n,e,r)}},Wo=class{constructor(t){this.spec=t}};function er(i,t,e,r){return new ti(t.doc,i.unquoted,e,r,i.caseSensitive?void 0:n=>n.toLowerCase(),i.wholeWord?CS(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function CS(i,t){return(e,r,n,s)=>((s>e||s+n.length=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=er(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function ir(i,t,e,r){return new qo(t.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?AS(t.charCategorizer(t.selection.main.head)):void 0},e,r)}function Io(i,t){return i.slice(at(i,t,!1),t)}function No(i,t){return i.slice(t,at(i,t))}function AS(i){return(t,e,r)=>!r[0].length||(i(Io(r.input,r.index))!=F.Word||i(No(r.input,r.index))!=F.Word)&&(i(No(r.input,r.index+r[0].length))!=F.Word||i(Io(r.input,r.index+r[0].length))!=F.Word)}var rf=class extends Wo{nextMatch(t,e,r){let n=ir(this.spec,t,r,t.doc.length).next();return n.done&&(n=ir(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,r){for(let n=1;;n++){let s=Math.max(e,r-n*1e4),o=ir(this.spec,t,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==e||l.from>s+10))return l;if(s==e)return null}}prevMatch(t,e,r){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\\$([$&\\d+])/g,(e,r)=>r==\"$\"?\"$\":r==\"&\"?t.match[0]:r!=\"0\"&&+r=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=ir(this.spec,t,Math.max(0,e-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},gn=M.define(),lf=M.define(),Je=it.define({create(i){return new mn(nf(i).create(),null)},update(i,t){for(let e of t.effects)e.is(gn)?i=new mn(e.value.create(),i.panel):e.is(lf)&&(i=new mn(i.query,e.value?af:null));return i},provide:i=>fi.from(i,t=>t.panel)});var mn=class{constructor(t,e){this.query=t,this.panel=e}},QS=R.mark({class:\"cm-searchMatch\"}),RS=R.mark({class:\"cm-searchMatch cm-searchMatch-selected\"}),MS=ft.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Je))}update(i){let t=i.state.field(Je);(t!=i.startState.field(Je)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:i,panel:t}){if(!t||!i.spec.valid)return R.none;let{view:e}=this,r=new Ee;for(let n=0,s=e.visibleRanges,o=s.length;ns[n+1].from-2*250;)a=s[++n].to;i.highlight(e.state,l,a,(h,f)=>{let c=e.state.selection.ranges.some(u=>u.from==h&&u.to==f);r.add(h,f,c?RS:QS)})}return r.finish()}},{decorations:i=>i.decorations});function On(i){return t=>{let e=t.state.field(Je,!1);return e&&e.query.spec.valid?i(t,e):ng(t)}}var Yo=On((i,{query:t})=>{let{to:e}=i.state.selection.main,r=t.nextMatch(i.state,e,e);if(!r)return!1;let n=b.single(r.from,r.to),s=i.state.facet(rr);return i.dispatch({selection:n,effects:[hf(i,r),s.scrollToMatch(n.main,i)],userEvent:\"select.search\"}),rg(i),!0}),zo=On((i,{query:t})=>{let{state:e}=i,{from:r}=e.selection.main,n=t.prevMatch(e,r,r);if(!n)return!1;let s=b.single(n.from,n.to),o=i.state.facet(rr);return i.dispatch({selection:s,effects:[hf(i,n),o.scrollToMatch(s.main,i)],userEvent:\"select.search\"}),rg(i),!0}),ES=On((i,{query:t})=>{let e=t.matchAll(i.state,1e3);return!e||!e.length?!1:(i.dispatch({selection:b.create(e.map(r=>b.range(r.from,r.to))),userEvent:\"select.search.matches\"}),!0)}),$S=({state:i,dispatch:t})=>{let e=i.selection;if(e.ranges.length>1||e.main.empty)return!1;let{from:r,to:n}=e.main,s=[],o=0;for(let l=new ti(i.doc,i.sliceDoc(r,n));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(b.range(l.value.from,l.value.to))}return t(i.update({selection:b.create(s,o),userEvent:\"select.search.matches\"})),!0},Km=On((i,{query:t})=>{let{state:e}=i,{from:r,to:n}=e.selection.main;if(e.readOnly)return!1;let s=t.nextMatch(e,r,r);if(!s)return!1;let o=[],l,a,h=[];if(s.from==r&&s.to==n&&(a=e.toText(t.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(e,s.from,s.to),h.push(T.announce.of(e.phrase(\"replaced match on line $\",e.doc.lineAt(r).number)+\".\"))),s){let f=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=b.single(s.from-f,s.to-f),h.push(hf(i,s)),h.push(e.facet(rr).scrollToMatch(l.main,i))}return i.dispatch({changes:o,selection:l,effects:h,userEvent:\"input.replace\"}),!0}),qS=On((i,{query:t})=>{if(i.state.readOnly)return!1;let e=t.matchAll(i.state,1e9).map(n=>{let{from:s,to:o}=n;return{from:s,to:o,insert:t.getReplacement(n)}});if(!e.length)return!1;let r=i.state.phrase(\"replaced $ matches\",e.length)+\".\";return i.dispatch({changes:e,effects:T.announce.of(r),userEvent:\"input.replace.all\"}),!0});function af(i){return i.state.facet(rr).createPanel(i)}function nf(i,t){var e,r,n,s,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?\"\":i.sliceDoc(l.from,l.to);if(t&&!a)return t;let h=i.facet(rr);return new Vo({search:((e=t?.literal)!==null&&e!==void 0?e:h.literal)?a:a.replace(/\\n/g,\"\\\\n\"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(n=t?.literal)!==null&&n!==void 0?n:h.literal,regexp:(s=t?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=t?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function ig(i){let t=ci(i,af);return t&&t.dom.querySelector(\"[main-field]\")}function rg(i){let t=ig(i);t&&t==i.root.activeElement&&t.select()}var ng=i=>{let t=i.state.field(Je,!1);if(t&&t.panel){let e=ig(i);if(e&&e!=i.root.activeElement){let r=nf(i.state,t.query.spec);r.valid&&i.dispatch({effects:gn.of(r)}),e.focus(),e.select()}}else i.dispatch({effects:[lf.of(!0),t?gn.of(nf(i.state,t.query.spec)):M.appendConfig.of(BS)]});return!0},sg=i=>{let t=i.state.field(Je,!1);if(!t||!t.panel)return!1;let e=ci(i,af);return e&&e.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:lf.of(!1)}),!0},Zo=[{key:\"Mod-f\",run:ng,scope:\"editor search-panel\"},{key:\"F3\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Mod-g\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Escape\",run:sg,scope:\"editor search-panel\"},{key:\"Mod-Shift-l\",run:$S},{key:\"Mod-Alt-g\",run:gS},{key:\"Mod-d\",run:PS,preventDefault:!0}],sf=class{constructor(t){this.view=t;let e=this.query=t.state.field(Je).query.spec;this.commit=this.commit.bind(this),this.searchField=z(\"input\",{value:e.search,placeholder:zt(t,\"Find\"),\"aria-label\":zt(t,\"Find\"),class:\"cm-textfield\",name:\"search\",form:\"\",\"main-field\":\"true\",onchange:this.commit,onkeyup:this.commit}),this.replaceField=z(\"input\",{value:e.replace,placeholder:zt(t,\"Replace\"),\"aria-label\":zt(t,\"Replace\"),class:\"cm-textfield\",name:\"replace\",form:\"\",onchange:this.commit,onkeyup:this.commit}),this.caseField=z(\"input\",{type:\"checkbox\",name:\"case\",form:\"\",checked:e.caseSensitive,onchange:this.commit}),this.reField=z(\"input\",{type:\"checkbox\",name:\"re\",form:\"\",checked:e.regexp,onchange:this.commit}),this.wordField=z(\"input\",{type:\"checkbox\",name:\"word\",form:\"\",checked:e.wholeWord,onchange:this.commit});function r(n,s,o){return z(\"button\",{class:\"cm-button\",name:n,onclick:s,type:\"button\"},o)}this.dom=z(\"div\",{onkeydown:n=>this.keydown(n),class:\"cm-search\"},[this.searchField,r(\"next\",()=>Yo(t),[zt(t,\"next\")]),r(\"prev\",()=>zo(t),[zt(t,\"previous\")]),r(\"select\",()=>ES(t),[zt(t,\"all\")]),z(\"label\",null,[this.caseField,zt(t,\"match case\")]),z(\"label\",null,[this.reField,zt(t,\"regexp\")]),z(\"label\",null,[this.wordField,zt(t,\"by word\")]),...t.state.readOnly?[]:[z(\"br\"),this.replaceField,r(\"replace\",()=>Km(t),[zt(t,\"replace\")]),r(\"replaceAll\",()=>qS(t),[zt(t,\"replace all\")])],z(\"button\",{name:\"close\",onclick:()=>sg(t),\"aria-label\":zt(t,\"close\"),type:\"button\"},[\"\\xD7\"])])}commit(){let t=new Vo({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:gn.of(t)}))}keydown(t){qd(this.view,t,\"search-panel\")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?zo:Yo)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Km(this.view))}update(t){for(let e of t.transactions)for(let r of e.effects)r.is(gn)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(rr).top}};function zt(i,t){return i.state.phrase(t)}var Eo=30,$o=/[\\s\\.,:;?!]/;function hf(i,{from:t,to:e}){let r=i.state.doc.lineAt(t),n=i.state.doc.lineAt(e).to,s=Math.max(r.from,t-Eo),o=Math.min(n,e+Eo),l=i.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;al.length-Eo;a--)if(!$o.test(l[a-1])&&$o.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${i.state.phrase(\"current match\")}. ${l} ${i.state.phrase(\"on line\")} ${r.number}.`)}var DS=T.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\"}}),BS=[Je,ie.low(MS),DS];var fc={};uO(fc,{VERSION:()=>Fo,after:()=>_f,all:()=>cl,allKeys:()=>he,any:()=>ul,assign:()=>ki,before:()=>qn,bind:()=>sl,bindAll:()=>Eg,chain:()=>Wf,chunk:()=>hc,clone:()=>Rf,collect:()=>Dt,compact:()=>nc,compose:()=>Ff,constant:()=>wn,contains:()=>Qt,countBy:()=>Lg,create:()=>Qf,debounce:()=>zf,default:()=>zg,defaults:()=>il,defer:()=>ll,delay:()=>ol,detect:()=>ur,difference:()=>pl,drop:()=>Ri,each:()=>xt,escape:()=>Ag,every:()=>cl,extend:()=>el,extendOwn:()=>ki,filter:()=>te,find:()=>ur,findIndex:()=>cr,findKey:()=>Dn,findLastIndex:()=>al,findWhere:()=>Gf,first:()=>zn,flatten:()=>sc,foldl:()=>fl,foldr:()=>Hf,forEach:()=>xt,functions:()=>ar,get:()=>Qn,groupBy:()=>Bg,has:()=>Ef,head:()=>zn,identity:()=>Pi,include:()=>Qt,includes:()=>Qt,indexBy:()=>Xg,indexOf:()=>hl,initial:()=>Yn,inject:()=>fl,intersection:()=>oc,invert:()=>Cn,invoke:()=>Dg,isArguments:()=>or,isArray:()=>$t,isArrayBuffer:()=>jo,isBoolean:()=>bn,isDataView:()=>Si,isDate:()=>dg,isElement:()=>xf,isEmpty:()=>wf,isEqual:()=>kf,isError:()=>mg,isFinite:()=>Sf,isFunction:()=>K,isMap:()=>kg,isMatch:()=>Pn,isNaN:()=>Sn,isNull:()=>Of,isNumber:()=>Ho,isObject:()=>At,isRegExp:()=>pg,isSet:()=>Pg,isString:()=>nr,isSymbol:()=>Uo,isTypedArray:()=>Jo,isUndefined:()=>yn,isWeakMap:()=>Tg,isWeakSet:()=>Cg,iteratee:()=>hr,keys:()=>X,last:()=>rc,lastIndexOf:()=>qg,map:()=>Dt,mapObject:()=>$f,matcher:()=>Qe,matches:()=>Qe,max:()=>Wn,memoize:()=>Nf,methods:()=>ar,min:()=>Kf,mixin:()=>Zn,negate:()=>Ai,noop:()=>Mn,now:()=>ei,object:()=>lc,omit:()=>Wg,once:()=>$g,pairs:()=>Af,partial:()=>ii,partition:()=>Vg,pick:()=>dl,pluck:()=>Qi,property:()=>Ci,propertyOf:()=>qf,random:()=>fr,range:()=>ac,reduce:()=>fl,reduceRight:()=>Hf,reject:()=>Uf,rest:()=>Ri,restArguments:()=>H,result:()=>Lf,sample:()=>Nn,select:()=>te,shuffle:()=>Jf,size:()=>ec,some:()=>ul,sortBy:()=>tc,sortedIndex:()=>Xn,tail:()=>Ri,take:()=>zn,tap:()=>Mf,template:()=>Xf,templateSettings:()=>Mg,throttle:()=>Yf,times:()=>Df,toArray:()=>In,toPath:()=>rl,transpose:()=>pr,unescape:()=>Rg,union:()=>Ng,uniq:()=>dr,unique:()=>dr,uniqueId:()=>Vf,unzip:()=>pr,values:()=>Zt,where:()=>jf,without:()=>Ig,wrap:()=>Zf,zip:()=>Yg});var Fo=\"1.13.6\",ff=typeof self==\"object\"&&self.self===self&&self||typeof global==\"object\"&&global.global===global&&global||Function(\"return this\")()||{},xn=Array.prototype,_o=Object.prototype,cf=typeof Symbol<\"u\"?Symbol.prototype:null,og=xn.push,Ae=xn.slice,Xe=_o.toString,lg=_o.hasOwnProperty,uf=typeof ArrayBuffer<\"u\",ag=typeof DataView<\"u\",hg=Array.isArray,df=Object.keys,pf=Object.create,mf=uf&&ArrayBuffer.isView,fg=isNaN,cg=isFinite,Go=!{toString:null}.propertyIsEnumerable(\"toString\"),gf=[\"valueOf\",\"isPrototypeOf\",\"toString\",\"propertyIsEnumerable\",\"hasOwnProperty\",\"toLocaleString\"],ug=Math.pow(2,53)-1;function H(i,t){return t=t==null?i.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),n=0;n=0&&e<=ug}}function kn(i){return function(t){return t?.[i]}}var wi=kn(\"byteLength\");var Og=vn(wi);var WS=/\\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\\]/;function IS(i){return mf?mf(i)&&!Si(i):Og(i)&&WS.test(Xe.call(i))}var Jo=uf?IS:wn(!1);var J=kn(\"length\");function NS(i){for(var t={},e=i.length,r=0;r\":\">\",'\"':\""\",\"'\":\"'\",\"`\":\"`\"};var Ag=En(nl);var Qg=Cn(nl);var Rg=En(Qg);var Mg=$.templateSettings={evaluate:/<%([\\s\\S]+?)%>/g,interpolate:/<%=([\\s\\S]+?)%>/g,escape:/<%-([\\s\\S]+?)%>/g};var Bf=/(.)^/,zS={\"'\":\"'\",\"\\\\\":\"\\\\\",\"\\r\":\"r\",\"\\n\":\"n\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},ZS=/\\\\|'|\\r|\\n|\\u2028|\\u2029/g;function FS(i){return\"\\\\\"+zS[i]}var _S=/^\\s*(\\w|\\$)+\\s*$/;function Xf(i,t,e){!t&&e&&(t=e),t=il({},t,$.templateSettings);var r=RegExp([(t.escape||Bf).source,(t.interpolate||Bf).source,(t.evaluate||Bf).source].join(\"|\")+\"|$\",\"g\"),n=0,s=\"__p+='\";i.replace(r,function(h,f,c,u,d){return s+=i.slice(n,d).replace(ZS,FS),n=d+h.length,f?s+=`'+\n((__t=(`+f+`))==null?'':_.escape(__t))+\n'`:c?s+=`'+\n((__t=(`+c+`))==null?'':__t)+\n'`:u&&(s+=`';\n`+u+`\n__p+='`),h}),s+=`';\n`;var o=t.variable;if(o){if(!_S.test(o))throw new Error(\"variable is not a bare identifier: \"+o)}else s=`with(obj||{}){\n`+s+`}\n`,o=\"obj\";s=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n`+s+`return __p;\n`;var l;try{l=new Function(o,\"_\",s)}catch(h){throw h.source=s,h}var a=function(h){return l.call(this,h,$)};return a.source=\"function(\"+o+`){\n`+s+\"}\",a}function Lf(i,t,e){t=fe(t);var r=t.length;if(!r)return K(e)?e.call(i):e;for(var n=0;n1)qt(l,t-1,e,r),n=r.length;else for(var a=0,h=l.length;at?(r&&(clearTimeout(r),r=null),l=f,o=i.apply(n,s),r||(n=s=null)):!r&&e.trailing!==!1&&(r=setTimeout(a,c)),o};return h.cancel=function(){clearTimeout(r),l=0,r=n=s=null},h}function zf(i,t,e){var r,n,s,o,l,a=function(){var f=ei()-n;t>f?r=setTimeout(a,t-f):(r=null,e||(o=i.apply(l,s)),r||(s=l=null))},h=H(function(f){return l=this,s=f,n=ei(),r||(r=setTimeout(a,t),e&&(o=i.apply(l,s))),o});return h.cancel=function(){clearTimeout(r),r=s=l=null},h}function Zf(i,t){return ii(t,i)}function Ai(i){return function(){return!i.apply(this,arguments)}}function Ff(){var i=arguments,t=i.length-1;return function(){for(var e=t,r=i[t].apply(this,arguments);e--;)r=i[e].call(this,r);return r}}function _f(i,t){return function(){if(--i<1)return t.apply(this,arguments)}}function qn(i,t){var e;return function(){return--i>0&&(e=t.apply(this,arguments)),i<=1&&(t=null),e}}var $g=ii(qn,2);function Dn(i,t,e){t=Z(t,e);for(var r=X(i),n,s=0,o=r.length;s0?0:n-1;s>=0&&s0?o=s>=0?s:Math.max(s+l,o):l=s>=0?Math.min(s+1,l):s+l+1;else if(e&&s&&l)return s=e(r,n),r[s]===n?s:-1;if(n!==n)return s=t(Ae.call(r,o,l),Sn),s>=0?s+o:-1;for(s=i>0?o:l-1;s>=0&&s0?0:l-1;for(s||(n=e[o?o[a]:a],a+=i);a>=0&&a=3;return t(e,ce(r,s,4),n,o)}}var fl=Vn(1);var Hf=Vn(-1);function te(i,t,e){var r=[];return t=Z(t,e),xt(i,function(n,s,o){t(n,s,o)&&r.push(n)}),r}function Uf(i,t,e){return te(i,Ai(Z(t)),e)}function cl(i,t,e){t=Z(t,e);for(var r=!tt(i)&&X(i),n=(r||i).length,s=0;s=0}var Dg=H(function(i,t,e){var r,n;return K(t)?n=t:(t=fe(t),r=t.slice(0,-1),t=t[t.length-1]),Dt(i,function(s){var o=n;if(!o){if(r&&r.length&&(s=Ti(s,r)),s==null)return;o=s[t]}return o==null?o:o.apply(s,e)})});function Qi(i,t){return Dt(i,Ci(t))}function jf(i,t){return te(i,Qe(t))}function Wn(i,t,e){var r=-1/0,n=-1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;lr&&(r=s)}else t=Z(t,e),xt(i,function(h,f,c){o=t(h,f,c),(o>n||o===-1/0&&r===-1/0)&&(r=h,n=o)});return r}function Kf(i,t,e){var r=1/0,n=1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;ll||o===void 0)return 1;if(o1&&(r=ce(r,t[1])),t=he(i)):(r=ic,t=qt(t,!1,!1),i=Object(i));for(var n=0,s=t.length;n1&&(r=t[1])):(t=Dt(qt(t,!1,!1),String),e=function(n,s){return!Qt(t,s)}),dl(i,e,r)});function Yn(i,t,e){return Ae.call(i,0,Math.max(0,i.length-(t==null||e?1:t)))}function zn(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[0]:Yn(i,i.length-t)}function Ri(i,t,e){return Ae.call(i,t==null||e?1:t)}function rc(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[i.length-1]:Ri(i,Math.max(0,i.length-t))}function nc(i){return te(i,Boolean)}function sc(i,t){return qt(i,t,!1)}var pl=H(function(i,t){return t=qt(t,!0,!0),te(i,function(e){return!Qt(t,e)})});var Ig=H(function(i,t){return pl(i,t)});function dr(i,t,e,r){bn(t)||(r=e,e=t,t=!1),e!=null&&(e=Z(e,r));for(var n=[],s=[],o=0,l=J(i);o ul > li[aria-selected]\":{backgroundColor:dc,color:gr}}},{dark:!0}),sw=ve.define([{tag:p.keyword,color:Re},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Fg},{tag:[p.variableName],color:Mi},{tag:[p.function(p.variableName)],color:Mi},{tag:[p.labelName],color:JS},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:Re},{tag:[p.definition(p.name),p.separator],color:ml},{tag:[p.brace],color:Mi},{tag:[p.annotation],color:Gg},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:uc},{tag:[p.typeName,p.className],color:cc},{tag:[p.operator,p.operatorKeyword],color:ml},{tag:[p.tagName],color:uc},{tag:[p.squareBracket],color:tw},{tag:[p.angleBracket],color:_g},{tag:[p.attributeName],color:cc},{tag:[p.regexp],color:Re},{tag:[p.quote],color:uc},{tag:[p.string],color:ml},{tag:p.link,color:ml,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Mi},{tag:[p.meta],color:Fg},{tag:[p.monospace],color:Fn,fontStyle:\"italic\"},{tag:[p.comment],color:gr,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:Re},{tag:p.emphasis,fontStyle:\"italic\",color:Re},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:Re},{tag:p.special(p.heading1),fontWeight:\"bold\",color:Re},{tag:p.heading1,fontWeight:\"bold\",color:Re},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Re},{tag:[p.heading5,p.heading6],color:Re},{tag:[p.atom,p.bool,p.special(p.variableName)],color:_g},{tag:[p.processingInstruction,p.inserted],color:Mi},{tag:[p.contentSeparator],color:cc},{tag:p.invalid,color:jg,borderBottom:`1px dotted ${Gg}`}]),Kg=[nw,Te(sw)];var Jg=\"#657b83\",wc=\"#586e75\",gc=\"#073642\",Gn=\"#002b36\",iO=\"#93a1a1\",ow=\"#fdf6e3\",gl=\"#dc322f\",lw=\"#cb4b16\",_n=\"#b58900\",Oc=\"#859900\",xc=\"#2aa198\",yc=\"#268bd2\",aw=\"#6c71c4\",Ol=\"#d33682\",tO=\"#d30102\",vc=\"#dfd9c8\",bc=vc,hw=ow,Sc=wc,fw=vc,eO=wc,cw=T.theme({\"&\":{color:Jg,backgroundColor:hw},\".cm-content\":{caretColor:eO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:eO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:fw},\".cm-panels\":{backgroundColor:vc,color:Gn},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:\"1px solid #457dff\"},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:\"#6199ff2f\"},\".cm-activeLine\":{backgroundColor:bc},\".cm-selectionMatch\":{backgroundColor:\"#aafe661a\"},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${iO}`},\".cm-gutters\":{backgroundColor:\"#00000010\",color:Jg,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:bc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Sc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Sc,borderBottomColor:Sc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:bc,color:Gn}}},{dark:!1}),uw=ve.define([{tag:p.keyword,color:Oc},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:xc},{tag:[p.variableName],color:yc},{tag:[p.function(p.variableName)],color:yc},{tag:[p.labelName],color:Ol},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:_n},{tag:[p.definition(p.name),p.separator],color:xc},{tag:[p.brace],color:Ol},{tag:[p.annotation],color:tO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:Ol},{tag:[p.typeName,p.className],color:lw},{tag:[p.operator,p.operatorKeyword],color:aw},{tag:[p.tagName],color:yc},{tag:[p.squareBracket],color:gl},{tag:[p.angleBracket],color:gc},{tag:[p.attributeName],color:iO},{tag:[p.regexp],color:tO},{tag:[p.quote],color:Oc},{tag:[p.string],color:_n},{tag:p.link,color:xc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:_n},{tag:[p.meta],color:gl},{tag:[p.comment],color:gc,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:wc},{tag:p.emphasis,fontStyle:\"italic\",color:Oc},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:_n},{tag:p.heading1,fontWeight:\"bold\",color:Gn},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Gn},{tag:[p.heading5,p.heading6],color:Gn},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Ol},{tag:[p.processingInstruction,p.inserted,p.contentSeparator],color:gl},{tag:[p.contentSeparator],color:_n},{tag:p.invalid,color:gc,borderBottom:`1px dotted ${gl}`}]),rO=[cw,Te(uw)];var nO=\"#2e3440\",Qc=\"#3b4252\",sO=\"#434c5e\",xl=\"#4c566a\",oO=\"#e5e9f0\",Ac=\"#eceff4\",kc=\"#8fbcbb\",lO=\"#88c0d0\",dw=\"#81a1c1\",ue=\"#5e81ac\",pw=\"#bf616a\",Or=\"#d08770\",Tc=\"#ebcb8b\",aO=\"#a3be8c\",mw=\"#b48ead\",hO=\"#d30102\",Rc=Ac,Pc=Rc,gw=\"#ffffff\",Cc=Qc,Ow=Rc,fO=Qc,xw=T.theme({\"&\":{color:nO,backgroundColor:gw},\".cm-content\":{caretColor:fO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:fO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:Ow},\".cm-panels\":{backgroundColor:Rc,color:xl},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:`1px solid ${xl}`},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:oO},\".cm-activeLine\":{backgroundColor:Pc},\".cm-selectionMatch\":{backgroundColor:oO},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${xl}`},\"&.cm-focused .cm-matchingBracket\":{backgroundColor:Ac},\".cm-gutters\":{backgroundColor:Ac,color:nO,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:Pc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Cc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Cc,borderBottomColor:Cc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:Pc,color:xl}}},{dark:!1}),yw=ve.define([{tag:p.keyword,color:ue},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Or},{tag:[p.variableName],color:Or},{tag:[p.function(p.variableName)],color:ue},{tag:[p.labelName],color:dw},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:ue},{tag:[p.definition(p.name),p.separator],color:aO},{tag:[p.brace],color:kc},{tag:[p.annotation],color:hO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:lO},{tag:[p.typeName,p.className],color:Tc},{tag:[p.operator,p.operatorKeyword],color:aO},{tag:[p.tagName],color:mw},{tag:[p.squareBracket],color:pw},{tag:[p.angleBracket],color:Or},{tag:[p.attributeName],color:Tc},{tag:[p.regexp],color:ue},{tag:[p.quote],color:Qc},{tag:[p.string],color:Or},{tag:p.link,color:kc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Or},{tag:[p.meta],color:lO},{tag:[p.comment],color:sO,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:ue},{tag:p.emphasis,fontStyle:\"italic\",color:ue},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:ue},{tag:p.special(p.heading1),fontWeight:\"bold\",color:ue},{tag:p.heading1,fontWeight:\"bold\",color:ue},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:ue},{tag:[p.heading5,p.heading6],color:ue},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Or},{tag:[p.processingInstruction,p.inserted],color:kc},{tag:[p.contentSeparator],color:Tc},{tag:p.invalid,color:sO,borderBottom:`1px dotted ${hO}`}]),Hn=[xw,Te(yw)];var hq={initialize({model:i}){},render({model:i,el:t}){var e=i.get(\"widget_instance_count_trait\");i.attributes={function_body_id:e};let r=\"\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "\n", - "function_body": "import numpy as np\nreturn np.cos(arr) # oops! wrong solution\n", - "function_name": "sinus", - "function_parameters": "arr", - "layout": "IPY_MODEL_27b1b841690f4a20a10ca7d2f106ad8a", - "name": "", - "widget_instance_count_trait": "2" - } - }, - "d5ffea92d5704163821ab7c16a7a593c": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "d67ed645e940436fadf6e1b212f60811": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-update-cue-box", - "scwidget-update-cue-box--cue" - ], - "children": [ - "IPY_MODEL_110b7364876d4f5d91676b1d40667b70" - ], - "layout": "IPY_MODEL_cd3d2676db144d46b05bf0aca5f7ac61" - } - }, - "d7419301abf4451b9a50367277504df9": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "BoxModel", - "state": { - "layout": "IPY_MODEL_8269507afc4f4942bc0eecfc6d3abb84" - } - }, - "d7dab1ae26b1473fba6b27605bd8da09": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_d89f434dfbc74024832c1f0b1f7d415f", - "IPY_MODEL_d7419301abf4451b9a50367277504df9" - ], - "layout": "IPY_MODEL_175da6146e6d40ceb52c21c0852b3417" - } - }, - "d8131b64c014484b8382217bdf43dafa": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLModel", - "state": { - "_dom_classes": [ - "exercise-title" - ], - "layout": "IPY_MODEL_52dcae1ea61a4d0d80b57f01f299c2c3", - "style": "IPY_MODEL_6e79551ea44547c1b467dafe42d51ebb", - "value": "sinus_with_references_2" - } - }, - "d89f434dfbc74024832c1f0b1f7d415f": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_dd62c2d87d6a4f9c9f19878025e823fd", - "IPY_MODEL_bdddd623c70e4aca8e6584045e9c2cdc" - ], - "layout": "IPY_MODEL_298df2fa02574c18956846d522e09c74" - } - }, - "d8a5315c617643319e1f0ad2e9568454": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "layout": "IPY_MODEL_e19ed24c68754406a150da047bc8c383", - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": "\u001b[1m\u001b[31mWidget sinus_with_references_1: 𐄂 (failed)\u001b[0m\n\u001b[1m\u001b[31mWidget sinus_with_references_2: 𐄂 (failed)\u001b[0m\n\u001b[1m\u001b[32mWidget sinus_functional_behavior: ✓ (success)\u001b[0m\n\u001b[1m\u001b[31mWidget riddle: 𐄂 (failed)\u001b[0m\n\u001b[1m\u001b[31mWidget error: ‼ (error)\u001b[0m\n" - } - ] - } - }, - "dd62c2d87d6a4f9c9f19878025e823fd": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-check-reset-cue-button" - ], - "description": "Check Code", - "layout": "IPY_MODEL_a1431e60339b404a89d8626a9cb32342", - "style": "IPY_MODEL_01dcef3ca0174377a2d32dfc18648568", - "tooltip": null - } - }, - "de846c857a12459f8aefd0e79ffb7774": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "description": "Set all references", - "layout": "IPY_MODEL_89c8420829d14cf38ba8814f5ce01ac5", - "style": "IPY_MODEL_0730b06d214341f69adee66610feb7c2", - "tooltip": null - } - }, - "dec3a4358a89485390065863dbc3cff9": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "e19ed24c68754406a150da047bc8c383": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "e321edaecf554abe8017b307957479d1": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "e4e866f1478c4d17b370407bc831567e": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "e88b13538696446f9c785444122ea9ae": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-update-cue-box", - "scwidget-update-cue-box--cue" - ], - "children": [ - "IPY_MODEL_44695f8c538142d2af32de53ddc069d4" - ], - "layout": "IPY_MODEL_493cc835cb304c58ab517e5e13cedbb2" - } - }, - "ed5e3fbefd2249de86cd5e64542387d2": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "justify_content": "space-between" - } - }, - "ef194c877a184d35b2325c5be98ac4f1": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "ef6a8d3adef34264a35bc93bed8ebf56": { - "model_module": "anywidget", - "model_module_version": "~0.9.*", - "model_name": "AnyModel", - "state": { - "_anywidget_id": "scwidgets.code._widget_code_input.CodeInput", - "_css": ".forced-indent{width:4em}.CodeMirror{border:1px solid #fff;height:auto}.CodeMirror.widget-code-input-signature{border-bottom:0px}.CodeMirror.widget-code-input-docstring,.CodeMirror.widget-code-input-body{border-top:0px}\n", - "_esm": "var cO=Object.defineProperty;var uO=(i,t)=>{for(var e in t)cO(i,e,{get:t[e],enumerable:!0})};var V=class i{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,r){[t,e]=Li(this,t,e);let n=[];return this.decompose(0,t,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(e,this.length,n,1),qi.from(n,this.length-(e-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Li(this,t,e);let r=[];return this.decompose(t,e,r,0),qi.from(r,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),n=new oi(this),s=new oi(t);for(let o=e,l=e;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=r)return!0}}iter(t=1){return new oi(this,t)}iterRange(t,e=this.length){return new ts(this,t,e)}iterLines(t,e){let r;if(t==null)r=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;r=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new es(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError(\"A document must have at least one line\");return t.length==1&&!t[0]?i.empty:t.length<=32?new Xt(t):qi.from(Xt.split(t,[]))}},Xt=class i extends V{constructor(t,e=dO(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((e?r:l)>=t)return new bl(n,l,r,o);n=l+1,r++}}decompose(t,e,r,n){let s=t<=0&&e>=this.length?this:new i(Ec(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=r.pop(),l=Jn(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new i(l,o.length+s.length));else{let a=l.length>>1;r.push(new i(l.slice(0,a)),new i(l.slice(a)))}}else r.push(s)}replace(t,e,r){if(!(r instanceof i))return super.replace(t,e,r);[t,e]=Li(this,t,e);let n=Jn(this.text,Jn(r.text,Ec(this.text,0,t)),e),s=this.length+r.length-(e-t);return n.length<=32?new i(n,s):qi.from(i.split(n,[]),s)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;s<=e&&ot&&o&&(n+=r),ts&&(n+=l.slice(Math.max(0,t-s),e-s)),s=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let r=[],n=-1;for(let s of t)r.push(s),n+=s.length+1,r.length==32&&(e.push(new i(r,n)),r=[],n=-1);return n>-1&&e.push(new i(r,n)),e}},qi=class i extends V{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=r+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,r,n);n=l+1,r=a+1}}decompose(t,e,r,n){for(let s=0,o=0;o<=e&&s=o){let h=n&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?r.push(l):l.decompose(t-o,e-o,r,h)}o=a+1}}replace(t,e,r){if([t,e]=Li(this,t,e),r.lines=s&&e<=l){let a=o.replace(t-s,e-s,r),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new i(f,this.length-(e-t)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(t,e,r)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;st&&s&&(n+=r),to&&(n+=l.sliceString(t-o,e-o,r)),o=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let r=0,[n,s,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,s+=e){if(n==o||s==l)return r;let a=this.children[n],h=t.children[s];if(a!=h)return r+a.scanIdentical(h,e);r+=a.length+1}}static from(t,e=t.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let d of t)r+=d.lines;if(r<32){let d=[];for(let m of t)m.flatten(d);return new Xt(d,e)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let m;if(d.lines>s&&d instanceof i)for(let O of d.children)c(O);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Xt&&a&&(m=f[f.length-1])instanceof Xt&&d.lines+m.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new Xt(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:i.from(f,h)),h=-1,a=f.length=0)}for(let d of t)c(d);return u(),l.length==1?l[0]:new i(l,e)}};V.empty=new Xt([\"\"],0);function dO(i){let t=-1;for(let e of i)t+=e.length+1;return t}function Jn(i,t,e=0,r=1e9){for(let n=0,s=0,o=!0;s=e&&(a>r&&(l=l.slice(0,r-n)),n0?1:(t instanceof Xt?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,l=n instanceof Xt?n.text.length:n.children.length;if(o==(e>0?l:0)){if(r==0)return this.done=!0,this.value=\"\",this;e>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(e>0?0:1)){if(this.offsets[r]+=e,t==0)return this.lineBreak=!0,this.value=`\n`,this;t--}else if(n instanceof Xt){let a=n.text[o+(e<0?-1:0)];if(this.offsets[r]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=n.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[r]+=e):(e<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof Xt?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},ts=class{constructor(t,e,r){this.value=\"\",this.done=!1,this.cursor=new oi(t,e>r?-1:1),this.pos=e>r?t.length:0,this.from=Math.min(e,r),this.to=Math.max(e,r)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value=\"\",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let r=e<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=r?n:e<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=\"\"}},es=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value=\"\",this.done=!1}next(t=0){let{done:e,lineBreak:r,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value=\"\",this.afterBreak=!1):e?(this.done=!0,this.value=\"\"):r?this.afterBreak?this.value=\"\":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<\"u\"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},oi.prototype[Symbol.iterator]=ts.prototype[Symbol.iterator]=es.prototype[Symbol.iterator]=function(){return this});var bl=class{constructor(t,e,r,n){this.from=t,this.to=e,this.number=r,this.text=n}get length(){return this.to-this.from}};function Li(i,t,e){return t=Math.max(0,Math.min(i.length,t)),[t,Math.max(t,Math.min(i.length,e))]}var Di=\"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(i=>i?parseInt(i,36):1);for(let i=1;ii)return Di[t-1]<=i;return!1}function $c(i){return i>=127462&&i<=127487}var qc=8205;function at(i,t,e=!0,r=!0){return(e?Wc:mO)(i,t,r)}function Wc(i,t,e){if(t==i.length)return t;t&&Ic(i.charCodeAt(t))&&Nc(i.charCodeAt(t-1))&&t--;let r=dt(i,t);for(t+=wt(r);t=0&&$c(dt(i,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function mO(i,t,e){for(;t>0;){let r=Wc(i,t-2,e);if(r=56320&&i<57344}function Nc(i){return i>=55296&&i<56320}function dt(i,t){let e=i.charCodeAt(t);if(!Nc(e)||t+1==i.length)return e;let r=i.charCodeAt(t+1);return Ic(r)?(e-55296<<10)+(r-56320)+65536:e}function vr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function wt(i){return i<65536?1:2}var Sl=/\\r\\n?|\\n/,ut=function(i){return i[i.Simple=0]=\"Simple\",i[i.TrackDel=1]=\"TrackDel\",i[i.TrackBefore=2]=\"TrackBefore\",i[i.TrackAfter=3]=\"TrackAfter\",i}(ut||(ut={})),Me=class i{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=l}else{if(r!=ut.Simple&&h>=t&&(r==ut.TrackDel&&nt||r==ut.TrackBefore&&nt))return null;if(h>t||h==t&&e<0&&!l)return t==n||e<0?s:s+a;s+=a}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let r=0,n=0;r=0&&n<=e&&l>=t)return ne?\"cover\":!0;n=l}return!1}toString(){let t=\"\";for(let e=0;e=0?\":\"+n:\"\")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=\"number\"))throw new RangeError(\"Invalid JSON representation of ChangeDesc\");return new i(t)}static create(t){return new i(t)}},vt=class i extends Me{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError(\"Applying change set to a document with the wrong length\");return wl(this,(e,r,n,s,o)=>t=t.replace(n,n+(r-e),o),!1),t}mapDesc(t,e=!1){return vl(this,t,e,!0)}invert(t){let e=this.sections.slice(),r=[];for(let n=0,s=0;n=0){e[n]=l,e[n+1]=o;let a=n>>1;for(;r.length0&&Ve(r,e,s.text),s.forward(f),l+=f}let h=t[o++];for(;l>1].toJSON()))}return t}static of(t,e,r){let n=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;ou||c<0||u>e)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${e})`);let m=d?typeof d==\"string\"?V.of(d.split(r||Sl)):d:V.empty,O=m.length;if(c==u&&O==0)return;co&&yt(n,c-o,-1),yt(n,u-c,O),Ve(s,n,m),o=u}}return h(t),a(!l),l}static empty(t){return new i(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError(\"Invalid JSON representation of ChangeSet\");let e=[],r=[];for(let n=0;nl&&typeof o!=\"string\"))throw new RangeError(\"Invalid JSON representation of ChangeSet\");if(s.length==1)e.push(s[0],0);else{for(;r.length=0&&e<=0&&e==i[n+1]?i[n]+=t:t==0&&i[n]==0?i[n+1]+=e:r?(i[n]+=t,i[n+1]+=e):i.push(t,e)}function Ve(i,t,e){if(e.length==0)return;let r=t.length-2>>1;if(r>1])),!(e||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];t(n,h,s,f,c),n=h,s=f}}}function vl(i,t,e,r=!1){let n=[],s=r?[]:null,o=new li(i),l=new li(t);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);yt(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>h),s.forward2(a),o.forward(a)}}}}var li=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?V.empty:t[e]}textBit(t){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length&&!t?V.empty:e[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},$i=class i{constructor(t,e,r){this.from=t,this.to=e,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let r,n;return this.empty?r=n=t.mapPos(this.from,e):(r=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return b.range(t,e);let r=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return b.range(this.anchor,r)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!=\"number\"||typeof t.head!=\"number\")throw new RangeError(\"Invalid JSON representation for SelectionRange\");return b.range(t.anchor,t.head)}static create(t,e,r){return new i(t,e,r)}},b=class i{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:i.create(this.ranges.map(r=>r.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;rt.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=\"number\"||t.main>=t.ranges.length)throw new RangeError(\"Invalid JSON representation for EditorSelection\");return new i(t.ranges.map(e=>$i.fromJSON(e)),t.main)}static single(t,e=t){return new i([i.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError(\"A selection needs at least one range\");for(let r=0,n=0;nt?8:0)|s)}static normalized(t,e=0){let r=t[e];t.sort((n,s)=>n.from-s.from),e=t.indexOf(r);for(let n=1;ns.head?i.range(a,l):i.range(l,a))}}return new i(t,e)}};function zc(i,t){for(let e of i.ranges)if(e.to>t)throw new RangeError(\"Selection points outside of document\")}var $l=0,A=class i{constructor(t,e,r,n,s){this.combine=t,this.compareInput=e,this.compare=r,this.isStatic=n,this.id=$l++,this.default=t([]),this.extensions=typeof s==\"function\"?s(this):s}get reader(){return this}static define(t={}){return new i(t.combine||(e=>e),t.compareInput||((e,r)=>e===r),t.compare||(t.combine?(e,r)=>e===r:ql),!!t.static,t.enables)}of(t){return new Bi([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,2,e)}from(t,e){return e||(e=r=>r),this.compute([t],r=>e(r.field(t)))}};function ql(i,t){return i==t||i.length==t.length&&i.every((e,r)=>e===t[r])}var Bi=class{constructor(t,e,r,n){this.dependencies=t,this.facet=e,this.type=r,this.value=n,this.id=$l++}dynamicSlot(t){var e;let r=this.value,n=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c==\"doc\"?a=!0:c==\"selection\"?h=!0:((e=t[c.id])!==null&&e!==void 0?e:1)&1||f.push(t[c.id]);return{create(c){return c.values[o]=r(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||kl(c,f)){let d=r(c);if(l?!Dc(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,m=u.config.address[s];if(m!=null){let O=ns(u,m);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===c.facet(g):g instanceof it?u.field(g,!1)==c.field(g,!1):!0)||(l?Dc(d=r(c),O,n):n(d=r(c),O)))return c.values[o]=O,0}else d=r(c);return c.values[o]=d,1}}}};function Dc(i,t,e){if(i.length!=t.length)return!1;for(let r=0;ri[a.id]),n=e.map(a=>a.type),s=r.filter(a=>!(a&1)),o=i[t.id]>>1;function l(a){let h=[];for(let f=0;fr===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Bc).find(r=>r.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:r=>(r.values[e]=this.create(r),1),update:(r,n)=>{let s=r.values[e],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[e]=o,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[e]=n.field(this),0):(r.values[e]=this.create(r),1)}}init(t){return[this,Bc.of({field:this,create:t})]}get extension(){return this}},ni={lowest:4,low:3,default:2,high:1,highest:0};function xr(i){return t=>new is(t,i)}var ie={highest:xr(ni.highest),high:xr(ni.high),default:xr(ni.default),low:xr(ni.low),lowest:xr(ni.lowest)},is=class{constructor(t,e){this.inner=t,this.prec=e}},pe=class i{of(t){return new br(this,t)}reconfigure(t){return i.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},br=class{constructor(t,e){this.compartment=t,this.inner=e}},rs=class i{constructor(t,e,r,n,s,o){for(this.base=t,this.compartments=e,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,r){let n=[],s=Object.create(null),o=new Map;for(let u of OO(t,e,o))u instanceof it?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=r?.config.facets;for(let u in s){let d=s[u],m=d[0].facet,O=f&&f[u]||[];if(d.every(g=>g.type==0))if(l[m.id]=a.length<<1|1,ql(O,d))a.push(r.facet(m));else{let g=m.combine(d.map(x=>x.value));a.push(r&&m.compare(g,r.facet(m))?r.facet(m):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(x=>g.dynamicSlot(x)));l[m.id]=h.length<<1,h.push(g=>gO(g,m,d))}}let c=h.map(u=>u(l));return new i(t,o,c,l,a,s)}};function OO(i,t,e){let r=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=r[a].indexOf(o);h>-1&&r[a].splice(h,1),o instanceof br&&e.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof br){if(e.has(o.compartment))throw new RangeError(\"Duplicate use of compartment in extensions\");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),s(h,l)}else if(o instanceof is)s(o.inner,o.prec);else if(o instanceof it)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Bi)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,ni.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ni.default),r.reduce((o,l)=>o.concat(l))}function yr(i,t){if(t&1)return 2;let e=t>>1,r=i.status[e];if(r==4)throw new Error(\"Cyclic dependency between fields and/or facets\");if(r&2)return r;i.status[e]=4;let n=i.computeSlot(i,i.config.dynamicSlots[e]);return i.status[e]=2|n}function ns(i,t){return t&1?i.config.staticValues[t>>1]:i.values[t>>1]}var Zc=A.define(),Tl=A.define({combine:i=>i.some(t=>t),static:!0}),Fc=A.define({combine:i=>i.length?i[0]:void 0,static:!0}),_c=A.define(),Gc=A.define(),Hc=A.define(),Uc=A.define({combine:i=>i.length?i[0]:!1}),Et=class{constructor(t,e){this.type=t,this.value=e}static define(){return new Pl}},Pl=class{of(t){return new Et(this,t)}},Cl=class{constructor(t){this.map=t}of(t){return new M(this,t)}},M=class i{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new i(this.type,e)}is(t){return this.type==t}static define(t={}){return new Cl(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let r=[];for(let n of t){let s=n.map(e);s&&r.push(s)}return r}};M.reconfigure=M.define();M.appendConfig=M.define();var lt=class i{constructor(t,e,r,n,s,o){this.startState=t,this.changes=e,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&zc(r,e.newLength),s.some(l=>l.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(t,e,r,n,s,o){return new i(t,e,r,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(i.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]==\".\"))}};lt.time=Et.define();lt.userEvent=Et.define();lt.addToHistory=Et.define();lt.remote=Et.define();function xO(i,t){let e=[];for(let r=0,n=0;;){let s,o;if(r=i[r]))s=i[r++],o=i[r++];else if(n=0;n--){let s=r[n](i);s instanceof lt?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof lt?i=s[0]:i=Kc(t,Xi(s),!1)}return i}function bO(i){let t=i.startState,e=t.facet(Hc),r=i;for(let n=e.length-1;n>=0;n--){let s=e[n](i);s&&Object.keys(s).length&&(r=jc(r,Al(t,s,i.changes.newLength),!0))}return r==i?i:lt.create(t,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var SO=[];function Xi(i){return i==null?SO:Array.isArray(i)?i:[i]}var F=function(i){return i[i.Word=0]=\"Word\",i[i.Space=1]=\"Space\",i[i.Other=2]=\"Other\",i}(F||(F={})),wO=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,Ql;try{Ql=new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\",\"u\")}catch{}function vO(i){if(Ql)return Ql.test(i);for(let t=0;t\"\\x80\"&&(e.toUpperCase()!=e.toLowerCase()||wO.test(e)))return!0}return!1}function kO(i){return t=>{if(!/\\S/.test(t))return F.Space;if(vO(t))return F.Word;for(let e=0;e-1)return F.Word;return F.Other}}var Y=class i{constructor(t,e,r,n,s,o){this.config=t,this.doc=e,this.selection=r,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;ln.set(h,a)),e=null),n.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(e=null,r=l.value):l.is(M.appendConfig)&&(e=null,r=Xi(r).concat(l.value));let s;e?s=t.startState.values.slice():(e=rs.resolve(r,n,this),s=new i(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(Tl)?t.newSelection:t.newSelection.asSingle();new i(e,t.newDoc,o,s,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t==\"string\"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:b.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,r=t(e.ranges[0]),n=this.changes(r.changes),s=[r.range],o=Xi(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return i.create({doc:t.doc,selection:b.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=rs.resolve(t.extensions||[],new Map),r=t.doc instanceof V?t.doc:V.of((t.doc||\"\").split(e.staticFacet(i.lineSeparator)||Sl)),n=t.selection?t.selection instanceof b?t.selection:b.single(t.selection.anchor,t.selection.head):b.single(0);return zc(n,r.length),e.staticFacet(Tl)||(n=n.asSingle()),new i(e,r,n,e.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`\n`}get readOnly(){return this.facet(Uc)}phrase(t,...e){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return e.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(r,n)=>{if(n==\"$\")return\"$\";let s=+(n||1);return!s||s>e.length?r:e[s-1]})),t}languageDataAt(t,e,r=-1){let n=[];for(let s of this.facet(Zc))for(let o of s(this,e,r))Object.prototype.hasOwnProperty.call(o,t)&&n.push(o[t]);return n}charCategorizer(t){return kO(this.languageDataAt(\"wordChars\",t).join(\"\"))}wordAt(t){let{text:e,from:r,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-r,l=t-r;for(;o>0;){let a=at(e,o,!1);if(s(e.slice(a,o))!=F.Word)break;o=a}for(;li.length?i[0]:4});Y.lineSeparator=Fc;Y.readOnly=Uc;Y.phrases=A.define({compare(i,t){let e=Object.keys(i),r=Object.keys(t);return e.length==r.length&&e.every(n=>i[n]==t[n])}});Y.languageData=Zc;Y.changeFilter=_c;Y.transactionFilter=Gc;Y.transactionExtender=Hc;pe.reconfigure=M.define();function kt(i,t,e={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,s))r[s]=e[s](l,o);else throw new Error(\"Config merge conflict for field \"+s)}for(let n in t)r[n]===void 0&&(r[n]=t[n]);return r}var ee=class{eq(t){return this==t}range(t,e=t){return Sr.create(t,e,this)}};ee.prototype.startSide=ee.prototype.endSide=0;ee.prototype.point=!1;ee.prototype.mapMode=ut.TrackDel;var Sr=class i{constructor(t,e,r){this.from=t,this.to=e,this.value=r}static create(t,e,r){return new i(t,e,r)}};function Rl(i,t){return i.from-t.from||i.value.startSide-t.value.startSide}var Ml=class i{constructor(t,e,r,n){this.from=t,this.to=e,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,r,n=0){let s=r?this.to:this.from;for(let o=n,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-t||(r?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,r,n){for(let s=this.findIndex(e,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),r.push(h),n.push(u-o),s.push(d-o))}return{mapped:r.length?new i(n,s,r,l):null,pos:o}}},_=class i{constructor(t,e,r,n){this.chunkPos=t,this.chunk=e,this.nextLayer=r,this.maxPoint=n}static create(t,e,r,n){return new i(t,e,r,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(r&&(e=e.slice().sort(Rl)),this.isEmpty)return e.length?i.of(e):this;let l=new ss(this,null,-1).goto(0),a=0,h=[],f=new Ee;for(;l.value||a=0){let c=e[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+o.length&&o.between(s,t-s,e-s,r)===!1)return}this.nextLayer.between(t,e,r)}}iter(t=0){return wr.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return wr.from(t).goto(e)}static compare(t,e,r,n,s=-1){let o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=Xc(o,l,r),h=new si(o,a,s),f=new si(l,a,s);r.iterGaps((c,u,d)=>Lc(h,c,f,u,d,n)),r.empty&&r.length==0&&Lc(h,0,f,0,0,n)}static eq(t,e,r=0,n){n==null&&(n=999999999);let s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0),o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Xc(s,o),a=new si(s,l,0).goto(r),h=new si(o,l,0).goto(r);for(;;){if(a.to!=h.to||!El(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(t,e,r,n,s=-1){let o=new si(t,null,s).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,r);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(t,e=!1){let r=new Ee;for(let n of t instanceof Sr?[t]:e?TO(t):t)r.add(n.from,n.to,n.value);return r.finish()}static join(t){if(!t.length)return i.empty;let e=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let n=t[r];n!=i.empty;n=n.nextLayer)e=new i(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}};_.empty=new _([],[],null,-1);function TO(i){if(i.length>1)for(let t=i[0],e=1;e0)return i.slice().sort(Rl);t=r}return i}_.empty.nextLayer=_.empty;var Ee=class i{finishChunk(t){this.chunks.push(new Ml(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,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,r){this.addInner(t,e,r)||(this.nextLayer||(this.nextLayer=new i)).add(t,e,r)}addInner(t,e,r){let n=t-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=e,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let r=e.value.length-1;return this.last=e.value[r],this.lastFrom=e.from[r]+t,this.lastTo=e.to[r]+t,!0}finish(){return this.finishInner(_.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=_.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};function Xc(i,t,e){let r=new Map;for(let s of i)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&n.push(new ss(o,e,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let r of this.heap)r.goto(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);return this.next(),this}forward(t,e){for(let r of this.heap)r.forward(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),yl(this.heap,0)}}};function yl(i,t){for(let e=i[t];;){let r=(t<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1=0&&(n=i[r+1],r++),e.compare(n)<0)break;i[r]=e,i[t]=n,t=r}}var si=class{constructor(t,e,r){this.minPoint=r,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=wr.from(t,e,r)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){jn(this.active,t),jn(this.activeTo,t),jn(this.activeRank,t),this.minActive=Vc(this.active,this.activeTo)}addActive(t){let e=0,{value:r,to:n,rank:s}=this.cursor;for(;e0;)e++;Kn(this.active,e,r),Kn(this.activeTo,e,n),Kn(this.activeRank,e,s),t&&Kn(t,e,this.cursor.from),this.minActive=Vc(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&jn(r,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&r[n]=0&&!(this.activeRank[r]t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&e.push(this.active[r]);return e.reverse()}openEnd(t){let e=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)e++;return e}};function Lc(i,t,e,r,n,s){i.goto(t),e.goto(r);let o=r+n,l=r,a=r-t;for(;;){let h=i.to+a-e.to||i.endSide-e.endSide,f=h<0?i.to+a:e.to,c=Math.min(f,o);if(i.point||e.point?i.point&&e.point&&(i.point==e.point||i.point.eq(e.point))&&El(i.activeForPoint(i.to),e.activeForPoint(e.to))||s.comparePoint(l,c,i.point,e.point):c>l&&!El(i.active,e.active)&&s.compareRange(l,c,i.active,e.active),f>o)break;l=f,h<=0&&i.next(),h>=0&&e.next()}}function El(i,t){if(i.length!=t.length)return!1;for(let e=0;e=t;r--)i[r+1]=i[r];i[t]=e}function Vc(i,t){let e=-1,r=1e9;for(let n=0;n=t)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?e-s%e:1,n=at(i,n)}return r===!0?-1:i.length}var Dl=\"\\u037C\",Jc=typeof Symbol>\"u\"?\"__\"+Dl:Symbol.for(Dl),Bl=typeof Symbol>\"u\"?\"__styleSet\"+Math.floor(Math.random()*1e8):Symbol(\"styleSet\"),tu=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:{},Gt=class{constructor(t,e){this.rules=[];let{finish:r}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function s(o,l,a,h){let f=[],c=/^@(\\w+)\\b/.exec(o[0]),u=c&&c[1]==\"keyframes\";if(c&&l==null)return a.push(o[0]+\";\");for(let d in l){let m=l[d];if(/&/.test(d))s(d.split(/,\\s*/).map(O=>o.map(g=>O.replace(/&/,g))).reduce((O,g)=>O.concat(g)),m,a);else if(m&&typeof m==\"object\"){if(!c)throw new RangeError(\"The value of a property (\"+d+\") should be a primitive value.\");s(n(d),m,f,u)}else m!=null&&f.push(d.replace(/_.*/,\"\").replace(/[A-Z]/g,O=>\"-\"+O.toLowerCase())+\": \"+m+\";\")}(f.length||u)&&a.push((r&&!c&&!h?o.map(r):o).join(\", \")+\" {\"+f.join(\" \")+\"}\")}for(let o in t)s(n(o),t[o],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let t=tu[Jc]||1;return tu[Jc]=t+1,Dl+t.toString(36)}static mount(t,e,r){let n=t[Bl],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Xl(t,s),n.mount(Array.isArray(e)?e:[e])}},eu=new Map,Xl=class{constructor(t,e){let r=t.ownerDocument||t,n=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let s=eu.get(r);if(s)return t.adoptedStyleSheets=[s.sheet,...t.adoptedStyleSheets],t[Bl]=s;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],eu.set(r,this)}else{this.styleTag=r.createElement(\"style\"),e&&this.styleTag.setAttribute(\"nonce\",e);let s=t.head||t;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],t[Bl]=this}mount(t){let e=this.sheet,r=0,n=0;for(let s=0;s-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),e)for(let a=0;a\",191:\"?\",192:\"~\",219:\"{\",220:\"|\",221:\"}\",222:'\"'},PO=typeof navigator<\"u\"&&/Mac/.test(navigator.platform),CO=typeof navigator<\"u\"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(ht=0;ht<10;ht++)$e[48+ht]=$e[96+ht]=String(ht);var ht;for(ht=1;ht<=24;ht++)$e[ht+111]=\"F\"+ht;var ht;for(ht=65;ht<=90;ht++)$e[ht]=String.fromCharCode(ht+32),Vi[ht]=String.fromCharCode(ht);var ht;for(ls in $e)Vi.hasOwnProperty(ls)||(Vi[ls]=$e[ls]);var ls;function iu(i){var t=PO&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||CO&&i.shiftKey&&i.key&&i.key.length==1||i.key==\"Unidentified\",e=!t&&i.key||(i.shiftKey?Vi:$e)[i.keyCode]||i.key||\"Unidentified\";return e==\"Esc\"&&(e=\"Escape\"),e==\"Del\"&&(e=\"Delete\"),e==\"Left\"&&(e=\"ArrowLeft\"),e==\"Up\"&&(e=\"ArrowUp\"),e==\"Right\"&&(e=\"ArrowRight\"),e==\"Down\"&&(e=\"ArrowDown\"),e}function Ss(i){let t;return i.nodeType==11?t=i.getSelection?i:i.ownerDocument:t=i,t.getSelection()}function Zl(i,t){return t?i==t||i.contains(t.nodeType!=1?t.parentNode:t):!1}function AO(i){let t=i.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Os(i,t){if(!t.anchorNode)return!1;try{return Zl(i,t.anchorNode)}catch{return!1}}function Xr(i){return i.nodeType==3?ai(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Rr(i,t,e,r){return e?ru(i,t,e,r,-1)||ru(i,t,e,r,1):!1}function Lr(i){for(var t=0;;t++)if(i=i.previousSibling,!i)return t}function ru(i,t,e,r,n){for(;;){if(i==e&&t==r)return!0;if(t==(n<0?0:qe(i))){if(i.nodeName==\"DIV\")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;t=Lr(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[t+(n<0?-1:0)],i.nodeType==1&&i.contentEditable==\"false\")return!1;t=n<0?qe(i):0}else return!1}}function qe(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Aa(i,t){let e=t?i.left:i.right;return{left:e,right:e,top:i.top,bottom:i.bottom}}function QO(i){return{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Iu(i,t){let e=t.width/i.offsetWidth,r=t.height/i.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-i.offsetWidth)<1)&&(e=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-i.offsetHeight)<1)&&(r=1),{scaleX:e,scaleY:r}}function RO(i,t,e,r,n,s,o,l){let a=i.ownerDocument,h=a.defaultView||window;for(let f=i,c=!1;f&&!c;)if(f.nodeType==1){let u,d=f==a.body,m=1,O=1;if(d)u=QO(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:m,scaleY:O}=Iu(f,S)),u={left:S.left,right:S.left+f.clientWidth*m,top:S.top,bottom:S.top+f.clientHeight*O}}let g=0,x=0;if(n==\"nearest\")t.top0&&t.bottom>u.bottom+x&&(x=t.bottom-u.bottom+x+o)):t.bottom>u.bottom&&(x=t.bottom-u.bottom+o,e<0&&t.top-x0&&t.right>u.right+g&&(g=t.right-u.right+g+s)):t.right>u.right&&(g=t.right-u.right+s,e<0&&t.lefte.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}var Fl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:r}=t;this.set(e,Math.min(t.anchorOffset,e?qe(e):0),r,Math.min(t.focusOffset,r?qe(r):0))}set(t,e,r,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=r,this.focusOffset=n}},Wi=null;function Nu(i){if(i.setActive)return i.setActive();if(Wi)return i.focus(Wi);let t=[];for(let e=i;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(i.focus(Wi==null?{get preventScroll(){return Wi={preventScroll:!0},!0}}:void 0),!Wi){Wi=!1;for(let e=0;eMath.max(1,i.scrollHeight-i.clientHeight-4)}var Tt=class i{constructor(t,e,r=!0){this.node=t,this.offset=e,this.precise=r}static before(t,e){return new i(t.parentNode,Lr(t),e)}static after(t,e){return new i(t.parentNode,Lr(t)+1,e)}},Qa=[],rt=class i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let r of this.children){if(r==t)return e;e+=r.length+r.breakAfter}throw new RangeError(\"Invalid child in posBefore\")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(this.flags&2){let r=this.dom,n=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=n?n.nextSibling:r.firstChild)){let l=i.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(t,e),o.flags&=-8}if(s=n?n.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&s!=o.dom&&(e.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=su(s);else r.insertBefore(o.dom,s);n=o.dom}for(s=n?n.nextSibling:r.firstChild,s&&e&&e.node==r&&(e.written=!0);s;)s=su(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(t,e),r.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let r;if(t==this.dom)r=this.dom.childNodes[e];else{let n=qe(t)==0?0:e==0?-1:1;for(;;){let s=t.parentNode;if(s==this.dom)break;n==0&&s.firstChild!=s.lastChild&&(t==s.firstChild?n=-1:n=1),t=s}n<0?r=t:r=t.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!i.get(r);)r=r.nextSibling;if(!r)return this.length;for(let n=0,s=0;;n++){let o=this.children[n];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(t,e,r=0){let n=-1,s=-1,o=-1,l=-1;for(let a=0,h=r,f=r;ae)return c.domBoundsAround(t,e,h);if(u>=t&&n==-1&&(n=a,s=h),h>e&&c.dom.parentNode==this.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,r=Qa){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function Zu(i,t,e,r,n,s,o,l,a){let{children:h}=i,f=h.length?h[t]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:o;if(!(t==r&&f&&!o&&!u&&s.length<2&&f.merge(e,n,s.length?c:null,e==0,l,a))){if(r0&&(!o&&s.length&&f.merge(e,f.length,s[0],!1,l,0)?f.breakAfter=s.shift().breakAfter:(e2),Q={mac:au||/Mac/.test(Lt.platform),windows:/Win/.test(Lt.platform),linux:/Linux|X11/.test(Lt.platform),ie:Bs,ie_version:_u?_l.documentMode||6:Hl?+Hl[1]:Gl?+Gl[1]:0,gecko:ou,gecko_version:ou?+(/Firefox\\/(\\d+)/.exec(Lt.userAgent)||[0,0])[1]:0,chrome:!!Ll,chrome_version:Ll?+Ll[1]:0,ios:au,android:/Android\\b/.test(Lt.userAgent),webkit:lu,safari:Gu,webkit_version:lu?+(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:_l.documentElement.style.tabSize!=null?\"tab-size\":\"-moz-tab-size\"},qO=256,Ye=class i extends rt{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,r){return this.flags&8||r&&(!(r instanceof i)||this.length-(e-t)+r.length>qO||r.flags&8)?!1:(this.text=this.text.slice(0,t)+(r?r.text:\"\")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new i(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Tt(this.dom,t)}domBoundsAround(t,e,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return DO(this.dom,t,e)}},ze=class i extends rt{constructor(t,e=[],r=0){super(),this.mark=t,this.children=e,this.length=r;for(let n of e)n.setParent(this)}setAttrs(t){if(Yu(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,r,n,s,o){return r&&(!(r instanceof i&&r.mark.eq(this.mark))||t&&s<=0||et&&e.push(r=t&&(n=s),r=a,s++}let o=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new i(this.mark,e,o)}domAtPos(t){return Hu(this,t)}coordsAt(t,e){return ju(this,t,e)}};function DO(i,t,e){let r=i.nodeValue.length;t>r&&(t=r);let n=t,s=t,o=0;t==0&&e<0||t==r&&e>=0?Q.chrome||Q.gecko||(t?(n--,o=1):s=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Aa(a,o<0):a||null}var Vr=class i extends rt{static create(t,e,r){return new i(t,e,r)}constructor(t,e,r){super(),this.widget=t,this.length=e,this.side=r,this.prevWidget=null}split(t){let e=i.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable=\"false\"))}getSide(){return this.side}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0)?Tt.before(this.dom):Tt.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let r=this.widget.coordsAt(this.dom,t,e);if(r)return r;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:t>0;for(let l=o?n.length-1:0;s=n[l],!(t>0?l==0:l==n.length-1||s.top0?Tt.before(this.dom):Tt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}};Ye.prototype.children=Vr.prototype.children=Wr.prototype.children=Qa;function Hu(i,t){let e=i.dom,{children:r}=i,n=0;for(let s=0;ns&&t0;s--){let o=r[s-1];if(o.dom.parentNode==e)return o.domAtPos(o.length)}for(let s=n;s0&&t instanceof ze&&n.length&&(r=n[n.length-1])instanceof ze&&r.mark.eq(t.mark)?Uu(r,t.children[0],e-1):(n.push(t),t.setParent(i)),i.length+=t.length}function ju(i,t,e){let r=null,n=-1,s=null,o=-1;function l(h,f){for(let c=0,u=0;c=f&&(d.children.length?l(d,f-u):(!s||s.isHidden&&e>0)&&(m>f||u==m&&d.getSide()>0)?(s=d,o=f-u):(u-1?1:0)!=n.length-(e&&n.indexOf(e)>-1?1:0))return!1;for(let s of r)if(s!=e&&(n.indexOf(s)==-1||i[s]!==t[s]))return!1;return!0}function jl(i,t,e){let r=!1;if(t)for(let n in t)e&&n in e||(r=!0,n==\"style\"?i.style.cssText=\"\":i.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(r=!0,n==\"style\"?i.style.cssText=e[n]:i.setAttribute(n,e[n]));return r}function XO(i){let t=Object.create(null);for(let e=0;e0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Ra(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Uu(this,t,e)}addLineDeco(t){let e=t.spec.attributes,r=t.spec.class;e&&(this.attrs=Ul(e,this.attrs||{})),r&&(this.attrs=Ul({class:r},this.attrs||{}))}domAtPos(t){return Hu(this,t)}reuseDOM(t){t.nodeName==\"DIV\"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var r;this.dom?this.flags&4&&(Yu(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),this.prevAttrs!==void 0&&(jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add(\"cm-line\"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&rt.get(n)instanceof ze;)n=n.lastChild;if(!n||!this.length||n.nodeName!=\"BR\"&&((r=rt.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(s=>s instanceof Ye))){let s=document.createElement(\"BR\");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let r of this.children){if(!(r instanceof Ye)||/[^ -~]/.test(r.text))return null;let n=Xr(r.dom);if(n.length!=1)return null;t+=n[0].width,e=n[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let r=ju(this,t,e);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight=e){if(s instanceof i)return s;if(o>e)break}n=o+s.breakAfter}return null}},Zi=class i extends rt{constructor(t,e,r){super(),this.widget=t,this.length=e,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0}},Ut=class{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},Pt=function(i){return i[i.Text=0]=\"Text\",i[i.WidgetBefore=1]=\"WidgetBefore\",i[i.WidgetAfter=2]=\"WidgetAfter\",i[i.WidgetRange=3]=\"WidgetRange\",i}(Pt||(Pt={})),R=class extends ee{constructor(t,e,r,n){super(),this.startSide=t,this.endSide=e,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Ir(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return e+=r&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ze(t,e,e,r,t.widget||null,!1)}static replace(t){let e=!!t.block,r,n;if(t.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=Ku(t,e);r=(s?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new Ze(t,r,n,e,t.widget||null,!0)}static line(t){return new Nr(t)}static set(t,e=!1){return _.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};R.none=_.empty;var Ir=class i extends R{constructor(t){let{start:e,end:r}=Ku(t);super(e?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||\"span\",this.class=t.class||\"\",this.attrs=t.attributes||null}eq(t){var e,r;return this==t||t instanceof i&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((r=t.attrs)===null||r===void 0?void 0:r.class))&&Ra(this.attrs,t.attrs,\"class\")}range(t,e=t){if(t>=e)throw new RangeError(\"Mark decorations may not be empty\");return super.range(t,e)}};Ir.prototype.point=!1;var Nr=class i extends R{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof i&&this.spec.class==t.spec.class&&Ra(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError(\"Line decoration ranges must be zero-length\");return super.range(t,e)}};Nr.prototype.mapMode=ut.TrackBefore;Nr.prototype.point=!0;var Ze=class i extends R{constructor(t,e,r,n,s,o){super(e,r,s,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?ut.TrackBefore:ut.TrackAfter:ut.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof i&&LO(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError(\"Invalid range for replacement decoration\");if(!this.isReplace&&e!=t)throw new RangeError(\"Widget decorations can only have zero-length ranges\");return super.range(t,e)}};Ze.prototype.point=!0;function Ku(i,t=!1){let{inclusiveStart:e,inclusiveEnd:r}=i;return e==null&&(e=i.inclusive),r==null&&(r=i.inclusive),{start:e??t,end:r??t}}function LO(i,t){return i==t||!!(i&&t&&i.compare(t))}function Kl(i,t,e,r=0){let n=e.length-1;n>=0&&e[n]+r>=i?e[n]=Math.max(e[n],t):e.push(i,t)}var Mr=class i{constructor(t,e,r,n){this.doc=t,this.pos=e,this.end=r,this.disallowBlockEffectsFor=n,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=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof Zi&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new mt),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(as(new Wr(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof Zi)&&this.getLine()}buildText(t,e,r){for(;t>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)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,t--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-r)),this.getLine().append(as(new Ye(this.text.slice(this.textOff,this.textOff+n)),e),r),this.atCursorPos=!0,this.textOff+=n,t-=n,r=0}}span(t,e,r,n){this.buildText(e-t,r,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,r,n,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Ze){if(r.block)throw new RangeError(\"Block decorations may not be specified via plugins\");if(e>this.doc.lineAt(this.pos).to)throw new RangeError(\"Decorations that replace line breaks may not be specified via plugins\")}let l=e-t;if(r instanceof Ze)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Zi(r.widget||new vs(\"div\"),l,r));else{let a=Vr.create(r.widget||new vs(\"span\"),l,l?0:r.startSide),h=this.atCursorPos&&!a.isEditable&&s<=n.length&&(t0),f=!a.isEditable&&(tn.length||r.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(as(new Wr(1),n),s),s=n.length+Math.max(0,s-n.length)),c.append(as(a,n),s),this.atCursorPos=f,this.pendingBuffer=f?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text=\"\",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,r,n,s){let o=new i(t,e,r,s);return o.openEnd=_.spans(n,e,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function as(i,t){for(let e of t)i=new ze(e,[i],i.length);return i}var vs=class extends Ut{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},G=function(i){return i[i.LTR=0]=\"LTR\",i[i.RTL=1]=\"RTL\",i}(G||(G={})),hi=G.LTR,Ma=G.RTL;function Ju(i){let t=[];for(let e=0;e=e){if(l.level==r)return o;(s<0||(n!=0?n<0?l.frome:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError(\"Index out of range\");return s}};function ed(i,t){if(i.length!=t.length)return!1;for(let e=0;e=0;O-=3)if(me[O+1]==-d){let g=me[O+2],x=g&2?n:g&4?g&1?s:n:0;x&&(j[c]=j[me[O]]=x),l=O;break}}else{if(me.length==189)break;me[l++]=c,me[l++]=u,me[l++]=a}else if((m=j[c])==2||m==1){let O=m==n;a=O?0:1;for(let g=l-3;g>=0;g-=3){let x=me[g+2];if(x&2)break;if(O)me[g+2]|=2;else{if(x&4)break;me[g+2]|=4}}}}}function zO(i,t,e,r){for(let n=0,s=r;n<=e.length;n++){let o=n?e[n-1].to:i,l=na;)m==g&&(m=e[--O].from,g=O?e[O-1].to:i),j[--m]=d;a=f}else s=h,a++}}}function ta(i,t,e,r,n,s,o){let l=r%2?2:1;if(r%2==n%2)for(let a=t,h=0;aa&&o.push(new Oe(a,O.from,d));let g=O.direction==hi!=!(d%2);ea(i,g?r+1:r,n,O.inner,O.from,O.to,o),a=O.to}m=O.to}else{if(m==e||(f?j[m]!=l:j[m]==l))break;m++}u?ta(i,a,m,r+1,n,u,o):at;){let f=!0,c=!1;if(!h||a>s[h-1].to){let O=j[a-1];O!=l&&(f=!1,c=O==16)}let u=!f&&l==1?[]:null,d=f?r:r+1,m=a;t:for(;;)if(h&&m==s[h-1].to){if(c)break t;let O=s[--h];if(!f)for(let g=O.from,x=h;;){if(g==t)break t;if(x&&s[x-1].to==g)g=s[--x].from;else{if(j[g-1]==l)break t;break}}if(u)u.push(O);else{O.toj.length;)j[j.length]=256;let r=[],n=t==hi?0:1;return ea(i,n,n,e,0,i.length,r),r}function id(i){return[new Oe(0,i,0)]}var rd=\"\";function FO(i,t,e,r,n){var s;let o=r.head-i.from,l=Oe.find(t,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=t[l],h=a.side(n,e);if(o==h){let u=l+=n?1:-1;if(u<0||u>=t.length)return null;a=t[l=u],o=a.side(!n,e),h=a.side(n,e)}let f=at(i.text,o,a.forward(n,e));(fa.to)&&(f=h),rd=i.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(n?t.length-1:0)?null:t[l+(n?1:-1)];return c&&f==h&&c.level+(n?0:1)i.some(t=>t)}),cd=A.define({combine:i=>i.some(t=>t)}),Er=class i{constructor(t,e=\"nearest\",r=\"nearest\",n=5,s=5,o=!1){this.range=t,this.y=e,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(t){return t.empty?this:new i(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new i(b.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},hs=M.define({map:(i,t)=>i.map(t)});function Ct(i,t,e){let r=i.facet(ld);r.length?r[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+\":\",t):console.error(t)}var Xs=A.define({combine:i=>i.length?i[0]:!0}),GO=0,Tr=A.define(),ft=class i{constructor(t,e,r,n,s){this.id=t,this.create=e,this.domEventHandlers=r,this.domEventObservers=n,this.extension=s(this)}static define(t,e){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=e||{};return new i(GO++,t,r,n,l=>{let a=[Tr.of(l)];return o&&a.push(Yr.of(h=>{let f=h.plugin(l);return f?o(f):R.none})),s&&a.push(s(l)),a})}static fromClass(t,e){return i.define(r=>new t(r),e)}},$r=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(r){if(Ct(e.state,r,\"CodeMirror plugin crashed\"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){Ct(t.state,e,\"CodeMirror plugin crashed\"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(r){Ct(t.state,r,\"CodeMirror plugin crashed\")}}deactivate(){this.spec=this.value=null}},ud=A.define(),Ea=A.define(),Yr=A.define(),dd=A.define(),$a=A.define(),pd=A.define();function fu(i,t){let e=i.state.facet(pd);if(!e.length)return e;let r=e.map(s=>s instanceof Function?s(i):s),n=[];return _.spans(r,t.from,t.to,{point(){},span(s,o,l,a){let h=s-t.from,f=o-t.from,c=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,m;if(d==null&&(d=_O(t.text,h,f)),a>0&&c.length&&(m=c[c.length-1]).to==h&&m.direction==d)m.to=f,c=m.inner;else{let O={from:h,to:f,direction:d,inner:[]};c.push(O),c=O.inner}}}}),n}var md=A.define();function gd(i){let t=0,e=0,r=0,n=0;for(let s of i.state.facet(md)){let o=s(i);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:r,bottom:n}}var Pr=A.define(),xe=class i{constructor(t,e,r,n){this.fromA=t,this.toA=e,this.fromB=r,this.toB=n}join(t){return new i(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,r=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>r.toA)){if(n.toAf)break;s+=2}if(!a)return r;new i(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}},ks=class i{constructor(t,e,r){this.view=t,this.state=e,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=vt.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,l,a)=>n.push(new xe(s,o,l,a))),this.changedRanges=n}static create(t,e,r){return new i(t,e,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Ts=class extends rt{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new mt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xe(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!e0(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let s=n>-1?UO(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new xe(h,f,t.changes.mapPos(h,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Q.ie||Q.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=JO(o,l,t.changes);return r=xe.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,t.startState.doc.length,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+\"px\",this.dom.style.flexBasis=this.minWidth?this.minWidth+\"px\":\"\";let o=Q.chrome||Q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=\"\"}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:f,toB:c}=l,u,d,m,O;if(r&&r.range.fromBf){let v=Mr.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),y=Mr.build(this.view.state.doc,r.range.toB,c,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,m=v.openStart,O=y.openEnd;let k=this.compositionView(r);y.breakAtStart?k.breakAfter=1:y.content.length&&k.merge(k.length,k.length,y.content[0],!1,y.openStart,0)&&(k.breakAfter=y.content[0].breakAfter,y.content.shift()),v.content.length&&k.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),u=v.content.concat(k).concat(y.content)}else({content:u,breakAtStart:d,openStart:m,openEnd:O}=Mr.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:g,off:x}=s.findPos(h,1),{i:S,off:C}=s.findPos(a,-1);Zu(this,S,C,g,x,u,d,m,O)}r&&this.fixCompositionDOM(r)}compositionView(t){let e=new Ye(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new ze(n,[e],e.length);let r=new mt;return r.append(e,0),r}fixCompositionDOM(t){let e=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=rt.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(t.range.fromB,1),n=this.children[r.i];e(t.line,n);for(let s=t.marks.length-1;s>=-1;s--)r=n.childPos(r.off,1),n=n.children[r.i],e(s>=0?t.marks[s].node:t.text,n)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,s=!n&&Os(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||e||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&HO(a)){let c=document.createTextNode(\"\");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=h=new Tt(c,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!Rr(a.node,a.offset,f.anchorNode,f.anchorOffset)||!Rr(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(f.focusNode)&&t0(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Ss(this.view.root);if(c)if(l.empty){if(Q.gecko){let u=jO(a.node,a.offset);if(u&&u!=3){let d=xd(a.node,a.offset,u==1?1:-1);d&&(a=new Tt(d.node,d.offset))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new Tt(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Tt(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Rr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,r=Ss(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!r||!e.empty||!e.assoc||!r.modify)return;let o=mt.find(this,e.head);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(e.head+e.assoc);r.collapse(f.node,f.offset),r.modify(\"move\",e.assoc<0?\"forward\":\"backward\",\"lineboundary\"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&r.collapse(n,s)}moveToLine(t){let e=this.dom,r;if(t.node!=e)return t;for(let n=t.offset;!r&&n=0;n--){let s=rt.get(e.childNodes[n]);s instanceof mt&&(r=s.domAtPos(s.length))}return r?new Tt(r.node,r.offset,!0):t}nearest(t){for(let e=t;e;){let r=rt.get(e);if(r&&r.rootView==this)return r;e=e.parentNode}return null}posFromDOM(t,e){let r=this.nearest(t);if(!r)throw new RangeError(\"Trying to find position for a DOM position outside of the document\");return r.localPosFromDOM(t,e)+r.posAtStart}domAtPos(t){let{i:e,off:r}=this.childCursor().findPos(t,-1);for(;e=0;o--){let l=this.children[o],a=s-l.breakAfter,h=a-l.length;if(at||l.covers(1))&&(!r||l instanceof mt&&!(r instanceof mt&&e>=0))&&(r=l,n=h),s=h}return r?r.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:r}=this.childPos(t,1),n=this.children[e];if(!(n instanceof mt))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(r,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}r=a}if(!(n instanceof Ye))return null;let s=at(n.text,r);if(s==r)return null;let o=ai(n.dom,r,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==G.LTR;for(let h=0,f=0;fn)break;if(h>=r){let d=c.dom.getBoundingClientRect();if(e.push(d.height),o){let m=c.dom.lastChild,O=m?Xr(m):[];if(O.length){let g=O[O.length-1],x=a?g.right-d.left:d.right-g.left;x>l&&(l=x,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction==\"rtl\"?G.RTL:G.LTR}measureTextSize(){for(let s of this.children)if(s instanceof mt){let o=s.measureTextSize();if(o)return o}let t=document.createElement(\"div\"),e,r,n;return t.className=\"cm-line\",t.style.width=\"99999px\",t.style.position=\"absolute\",t.textContent=\"abc def ghi jkl mno pqr stu\",this.view.observer.ignore(()=>{this.dom.appendChild(t);let s=Xr(t.firstChild)[0];e=t.getBoundingClientRect().height,r=s?s.width/27:7,n=s?s.height:e,t.remove()}),{lineHeight:e,charWidth:r,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ws(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let r=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],o=s?s.from-1:this.length;if(o>r){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(r).top)/this.view.scaleY;t.push(R.replace({widget:new Ps(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return R.set(t)}updateDeco(){let t=this.view.state.facet(Yr).map((n,s)=>(this.dynamicDecorationMap[s]=typeof n==\"function\")?n(this.view):n),e=!1,r=this.view.state.facet(dd).map((n,s)=>{let o=typeof n==\"function\";return o&&(e=!0),o?n(this.view):n});r.length&&(this.dynamicDecorationMap[t.length]=e,t.push(_.join(r)));for(let n=t.length;ne.anchor?-1:1),n;if(!r)return;!e.empty&&(n=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=gd(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;RO(this.view.scrollDOM,o,e.head0)r=r.childNodes[n-1],n=qe(r);else break}if(e>=0)for(let r=i,n=t;;){if(r.nodeType==3)return{node:r,offset:n};if(r.nodeType==1&&n=0)r=r.childNodes[n],n=0;else break}return null}function jO(i,t){return i.nodeType!=1?0:(t&&i.childNodes[t-1].contentEditable==\"false\"?1:0)|(t{rt.from&&(e=!0)}),e}function i0(i,t,e=1){let r=i.charCategorizer(t),n=i.doc.lineAt(t),s=t-n.from;if(n.length==0)return b.cursor(t);s==0?e=1:s==n.length&&(e=-1);let o=s,l=s;e<0?o=at(n.text,s,!1):l=at(n.text,s);let a=r(n.text.slice(o,l));for(;o>0;){let h=at(n.text,o,!1);if(r(n.text.slice(h,o))!=a)break;o=h}for(;li?t.left-i:Math.max(0,i-t.right)}function n0(i,t){return t.top>i?t.top-i:Math.max(0,i-t.bottom)}function Vl(i,t){return i.topt.top+1}function cu(i,t){return ti.bottom?{top:i.top,left:i.left,right:i.right,bottom:t}:i}function ra(i,t,e){let r,n,s,o,l=!1,a,h,f,c;for(let m=i.firstChild;m;m=m.nextSibling){let O=Xr(m);for(let g=0;gC||o==C&&s>S){r=m,n=x,s=S,o=C;let v=C?e0?g0)}S==0?e>x.bottom&&(!f||f.bottomx.top)&&(h=m,c=x):f&&Vl(f,x)?f=uu(f,x.bottom):c&&Vl(c,x)&&(c=cu(c,x.top))}}if(f&&f.bottom>=e?(r=a,n=f):c&&c.top<=e&&(r=h,n=c),!r)return{node:i,offset:0};let u=Math.max(n.left,Math.min(n.right,t));if(r.nodeType==3)return du(r,u,e);if(l&&r.contentEditable!=\"false\")return ra(r,u,e);let d=Array.prototype.indexOf.call(i.childNodes,r)+(t>=(n.left+n.right)/2?1:0);return{node:i,offset:d}}function du(i,t,e){let r=i.nodeValue.length,n=-1,s=1e9,o=0;for(let l=0;le?f.top-e:e-f.bottom)-1;if(f.left-1<=t&&f.right+1>=t&&c=(f.left+f.right)/2,d=u;if((Q.chrome||Q.gecko)&&ai(i,l).getBoundingClientRect().left==f.right&&(d=!u),c<=0)return{node:i,offset:l+(d?1:0)};n=l+(d?1:0),s=c}}}return{node:i,offset:n>-1?n:o>0?i.nodeValue.length:0}}function yd(i,t,e,r=-1){var n,s;let o=i.contentDOM.getBoundingClientRect(),l=o.top+i.viewState.paddingTop,a,{docHeight:h}=i.viewState,{x:f,y:c}=t,u=c-l;if(u<0)return 0;if(u>h)return i.state.doc.length;for(let v=i.viewState.heightOracle.textHeight/2,y=!1;a=i.elementAtHeight(u),a.type!=Pt.Text;)for(;u=r>0?a.bottom+v:a.top-v,!(u>=0&&u<=h);){if(y)return e?null:0;y=!0,r=-r}c=l+u;let d=a.from;if(di.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:e?null:pu(i,o,a,f,c);let m=i.dom.ownerDocument,O=i.root.elementFromPoint?i.root:m,g=O.elementFromPoint(f,c);g&&!i.contentDOM.contains(g)&&(g=null),g||(f=Math.max(o.left+1,Math.min(o.right-1,f)),g=O.elementFromPoint(f,c),g&&!i.contentDOM.contains(g)&&(g=null));let x,S=-1;if(g&&((n=i.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let v=m.caretPositionFromPoint(f,c);v&&({offsetNode:x,offset:S}=v)}else if(m.caretRangeFromPoint){let v=m.caretRangeFromPoint(f,c);v&&({startContainer:x,startOffset:S}=v,(!i.contentDOM.contains(x)||Q.safari&&s0(x,S,f)||Q.chrome&&o0(x,S,f))&&(x=void 0))}}if(!x||!i.docView.dom.contains(x)){let v=mt.find(i.docView,d);if(!v)return u>a.top+a.height/2?a.to:a.from;({node:x,offset:S}=ra(v.dom,f,c))}let C=i.docView.nearest(x);if(!C)return null;if(C.isWidget&&((s=C.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=C.dom.getBoundingClientRect();return t.yi.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((n-e.top-(i.defaultLineHeight-l)*.5)/l);s+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(e.from,e.to);return e.from+os(o,s,i.state.tabSize)}function s0(i,t,e){let r;if(i.nodeType!=3||t!=(r=i.nodeValue.length))return!1;for(let n=i.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!=\"BR\")return!1;return ai(i,r-1,r).getBoundingClientRect().left>e}function o0(i,t,e){if(t!=0)return!1;for(let n=i;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains(\"cm-line\"))break;n=s}let r=i.nodeType==1?i.getBoundingClientRect():ai(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return e-r.left>5}function na(i,t){let e=i.lineBlockAt(t);if(Array.isArray(e.type)){for(let r of e.type)if(r.to>t||r.to==t&&(r.to==e.to||r.type==Pt.Text))return r}return e}function l0(i,t,e,r){let n=na(i,t.head),s=!r||n.type!=Pt.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(t.assoc<0&&t.head>n.from?t.head-1:t.head);if(s){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(n.from),a=i.posAtCoords({x:e==(l==G.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return b.cursor(a,e?-1:1)}return b.cursor(e?n.to:n.from,e?-1:1)}function mu(i,t,e,r){let n=i.state.doc.lineAt(t.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let l=t,a=null;;){let h=FO(n,s,o,l,e),f=rd;if(!h){if(n.number==(e?i.state.doc.lines:1))return l;f=`\n`,n=i.state.doc.line(n.number+(e?1:-1)),s=i.bidiSpans(n),h=i.visualLineSide(n,!e)}if(a){if(!a(f))return l}else{if(!r)return h;a=r(f)}l=h}}function a0(i,t,e){let r=i.state.charCategorizer(t),n=r(e);return s=>{let o=r(s);return n==F.Space&&(n=o),n==o}}function h0(i,t,e,r){let n=t.head,s=e?1:-1;if(n==(e?i.state.doc.length:0))return b.cursor(n,t.assoc);let o=t.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(n,t.assoc||-1),f=i.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(n-d.from))),l=(s<0?d.top:d.bottom)+f}let c=a.left+o,u=r??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(u+d)*s,O=yd(i,{x:c,y:m},!1,s);if(ma.bottom||(s<0?On)){let g=i.docView.coordsForChar(O),x=!g||m{if(t>s&&tn(i)),e.from,t.head>e.from?-1:1);return r==e.from?e:b.cursor(r,rnull),Q.gecko&&k0(t.contentDOM.ownerDocument)}handleEvent(t){!g0(this.view,t)||this.ignoreDuringComposition(t)||t.type==\"keydown\"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let r=this.handlers[t];if(r){for(let n of r.observers)n(this.view,e);for(let n of r.handlers){if(e.defaultPrevented)break;if(n(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=f0(t),r=this.handlers,n=this.view.contentDOM;for(let s in e)if(s!=\"scroll\"){let o=!e[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(n.removeEventListener(s,this.handleEvent),l=null),l||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!=\"scroll\"&&!e[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()r.keyCode==t.keyCode))&&!t.ctrlKey||c0.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,zi(this.view.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function gu(i,t){return(e,r)=>{try{return t.call(i,r,e)}catch(n){Ct(e.state,n)}}}function f0(i){let t=Object.create(null);function e(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&e(s).handlers.push(gu(r.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&e(s).observers.push(gu(r.value,o))}}for(let r in re)e(r).handlers.push(re[r]);for(let r in ne)e(r).observers.push(ne[r]);return t}var bd=[{key:\"Backspace\",keyCode:8,inputType:\"deleteContentBackward\"},{key:\"Enter\",keyCode:13,inputType:\"insertParagraph\"},{key:\"Enter\",keyCode:13,inputType:\"insertLineBreak\"},{key:\"Delete\",keyCode:46,inputType:\"deleteContentForward\"}],c0=\"dthko\",Sd=[16,17,18,20,91,92,224,225],fs=6;function cs(i){return Math.max(0,i)*.7+8}function u0(i,t){return Math.max(Math.abs(i.clientX-t.clientX),Math.abs(i.clientY-t.clientY))}var oa=class{constructor(t,e,r,n){this.view=t,this.startEvent=e,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=MO(t.contentDOM),this.atoms=t.state.facet($a).map(o=>o(t));let s=t.contentDOM.ownerDocument;s.addEventListener(\"mousemove\",this.move=this.move.bind(this)),s.addEventListener(\"mouseup\",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Y.allowMultipleSelections)&&d0(t,e),this.dragging=m0(t,e)&&Td(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&u0(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let r=0,n=0,s=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=gd(this.view);t.clientX-o.left<=s.left+fs?r=-cs(s.left-t.clientX):t.clientX+o.right>=s.right-fs&&(r=cs(t.clientX-s.right)),t.clientY-o.top<=s.top+fs?n=-cs(s.top-t.clientY):t.clientY+o.bottom>=s.bottom-fs&&(n=cs(t.clientY-s.bottom)),this.setScrollSpeed(r,n)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener(\"mousemove\",this.move),t.removeEventListener(\"mouseup\",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let r=0;rthis.select(this.lastEvent),20)}};function d0(i,t){let e=i.state.facet(nd);return e.length?e[0](t):Q.mac?t.metaKey:t.ctrlKey}function p0(i,t){let e=i.state.facet(sd);return e.length?e[0](t):Q.mac?!t.altKey:!t.ctrlKey}function m0(i,t){let{main:e}=i.state.selection;if(e.empty)return!1;let r=Ss(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function g0(i,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,r;e!=i.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(r=rt.get(e))&&r.ignoreEvent(t))return!1;return!0}var re=Object.create(null),ne=Object.create(null),wd=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function O0(i){let t=i.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement(\"textarea\"));e.style.cssText=\"position: fixed; left: -10000px; top: 10px\",e.focus(),setTimeout(()=>{i.focus(),e.remove(),vd(i,e.value)},50)}function vd(i,t){let{state:e}=i,r,n=1,s=e.toText(t),o=s.lines==e.selection.ranges.length;if(la!=null&&e.selection.ranges.every(a=>a.empty)&&la==s.toString()){let a=-1;r=e.changeByRange(h=>{let f=e.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=e.toText((o?s.line(n++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:b.cursor(h.from+c.length)}})}else o?r=e.changeByRange(a=>{let h=s.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):r=e.replaceSelection(s);i.dispatch(r,{userEvent:\"input.paste\",scrollIntoView:!0})}ne.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};re.keydown=(i,t)=>(i.inputState.setSelectionOrigin(\"select\"),t.keyCode==27&&(i.inputState.lastEscPress=Date.now()),!1);ne.touchstart=(i,t)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin(\"select.pointer\")};ne.touchmove=i=>{i.inputState.setSelectionOrigin(\"select.pointer\")};re.mousedown=(i,t)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let r of i.state.facet(od))if(e=r(i,t),e)break;if(!e&&t.button==0&&(e=b0(i,t)),e){let r=!i.hasFocus;i.inputState.startMouseSelection(new oa(i,t,e,r)),r&&i.observer.ignore(()=>Nu(i.contentDOM));let n=i.inputState.mouseSelection;if(n)return n.start(t),n.dragging===!1}return!1};function Ou(i,t,e,r){if(r==1)return b.cursor(t,e);if(r==2)return i0(i.state,t,e);{let n=mt.find(i.docView,t),s=i.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:s.from,l=n?n.posAtEnd:s.to;return li>=t.top&&i<=t.bottom,xu=(i,t,e)=>kd(t,e)&&i>=e.left&&i<=e.right;function x0(i,t,e,r){let n=mt.find(i.docView,t);if(!n)return 1;let s=t-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&xu(e,r,o))return-1;let l=n.coordsAt(s,1);return l&&xu(e,r,l)?1:o&&kd(r,o)?-1:1}function yu(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:x0(i,e,t.clientX,t.clientY)}}var y0=Q.ie&&Q.ie_version<=11,bu=null,Su=0,wu=0;function Td(i){if(!y0)return i.detail;let t=bu,e=wu;return bu=i,wu=Date.now(),Su=!t||e>Date.now()-400&&Math.abs(t.clientX-i.clientX)<2&&Math.abs(t.clientY-i.clientY)<2?(Su+1)%3:1}function b0(i,t){let e=yu(i,t),r=Td(t),n=i.state.selection;return{update(s){s.docChanged&&(e.pos=s.changes.mapPos(e.pos),n=n.map(s.changes))},get(s,o,l){let a=yu(i,s),h,f=Ou(i,a.pos,a.bias,r);if(e.pos!=a.pos&&!o){let c=Ou(i,e.pos,e.bias,r),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u1&&(h=S0(n,a.pos))?h:l?n.addRange(f):b.create([f])}}}function S0(i,t){for(let e=0;e=t)return b.create(i.ranges.slice(0,e).concat(i.ranges.slice(e+1)),i.mainIndex==e?0:i.mainIndex-(i.mainIndex>e?1:0))}return null}re.dragstart=(i,t)=>{let{selection:{main:e}}=i.state;if(t.target.draggable){let n=i.docView.nearest(t.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=e.to||o<=e.from)&&(e=b.range(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData(\"Text\",i.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed=\"copyMove\"),!1};re.dragend=i=>(i.inputState.draggedContent=null,!1);function vu(i,t,e,r){if(!e)return;let n=i.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&p0(i,t)?{from:s.from,to:s.to}:null,l={from:n,insert:e},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?\"move.drop\":\"input.drop\"}),i.inputState.draggedContent=null}re.drop=(i,t)=>{if(!t.dataTransfer)return!1;if(i.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let r=Array(e.length),n=0,s=()=>{++n==e.length&&vu(i,t,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(e[o])}return!0}else{let r=t.dataTransfer.getData(\"Text\");if(r)return vu(i,t,r,!0),!0}return!1};re.paste=(i,t)=>{if(i.state.readOnly)return!0;i.observer.flush();let e=wd?null:t.clipboardData;return e?(vd(i,e.getData(\"text/plain\")||e.getData(\"text/uri-text\")),!0):(O0(i),!1)};function w0(i,t){let e=i.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement(\"textarea\"));r.style.cssText=\"position: fixed; left: -10000px; top: 10px\",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function v0(i){let t=[],e=[],r=!1;for(let n of i.selection.ranges)n.empty||(t.push(i.sliceDoc(n.from,n.to)),e.push(n));if(!t.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(t.push(o.text),e.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:t.join(i.lineBreak),ranges:e,linewise:r}}var la=null;re.copy=re.cut=(i,t)=>{let{text:e,ranges:r,linewise:n}=v0(i.state);if(!e&&!n)return!1;la=n?e:null,t.type==\"cut\"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:\"delete.cut\"});let s=wd?null:t.clipboardData;return s?(s.clearData(),s.setData(\"text/plain\",e),!0):(w0(i,e),!1)};var Pd=Et.define();function Cd(i,t){let e=[];for(let r of i.facet(hd)){let n=r(i,t);n&&e.push(n)}return e?i.update({effects:e,annotations:Pd.of(!0)}):null}function Ad(i){setTimeout(()=>{let t=i.hasFocus;if(t!=i.inputState.notifiedFocused){let e=Cd(i.state,t);e?i.dispatch(e):i.update([])}},10)}ne.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Ad(i)};ne.blur=i=>{i.observer.clearSelectionRange(),Ad(i)};ne.compositionstart=ne.compositionupdate=i=>{i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0)};ne.compositionend=i=>{i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Q.chrome&&Q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50)};ne.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};re.beforeinput=(i,t)=>{var e;let r;if(Q.chrome&&Q.android&&(r=bd.find(n=>n.inputType==t.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key==\"Backspace\"||r.key==\"Delete\")){let n=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return!1};var ku=new Set;function k0(i){ku.has(i)||(ku.add(i),i.addEventListener(\"copy\",()=>{}),i.addEventListener(\"cut\",()=>{}))}var Tu=[\"pre-wrap\",\"normal\",\"pre-line\",\"break-spaces\"],aa=class{constructor(t){this.lineWrapping=t,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let r=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((e-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Tu.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let r=0;r-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=r,this.textHeight=n,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>ys&&(t.heightChanged=!0),this.height=e)}replace(t,e,r){return i.of(r)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,r,n){let s=this,o=r.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=s.lineAt(a,et.ByPosNoHeight,r.setDoc(e),0,0),d=u.to>=h?u:s.lineAt(h,et.ByPosNoHeight,r,0,0);for(c+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,as*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),r+=1+l.break,n-=l.size}else if(s>n*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(n=s&&o(this.blockAt(0,r,n,s))}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ht=class i extends Cs{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,r,n){return new ge(n,this.length,r,this.height,this.breaks)}replace(t,e,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof Ne&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Ne?n=new i(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Vt.of(r)}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:\"\"}${this.widgetHeight?\":\"+this.widgetHeight:\"\"})`}},Ne=class i extends Vt{constructor(t){super(t,0)}heightMetrics(t,e){let r=t.doc.lineAt(e).number,n=t.doc.lineAt(e+this.length).number,s=n-r+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:n,perLine:o,perChar:l}}blockAt(t,e,r,n){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length),f=e.doc.lineAt(h),c=l+f.length*a,u=Math.max(r,t-c/2);return new ge(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((t-r)/l))),{from:f,length:c}=e.doc.line(s+h);return new ge(f,c,r+l*h,l,0)}}lineAt(t,e,r,n,s){if(e==et.ByHeight)return this.blockAt(t,r,n,s);if(e==et.ByPosNoHeight){let{from:d,to:m}=r.doc.lineAt(t);return new ge(d,m-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),h=r.doc.lineAt(t),f=l+h.length*a,c=h.number-o,u=n+l*c+a*(h.from-s-c);return new ge(h.from,h.length,Math.max(n,Math.min(u,n+this.height-f)),f,0)}forEachLine(t,e,r,n,s,o){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(r,s);for(let f=t,c=n;f<=e;){let u=r.doc.lineAt(f);if(f==t){let m=u.number-l;c+=a*m+h*(t-s-m)}let d=a+h*u.length;o(new ge(u.from,u.length,c,d,0)),c+=d,f=u.to+1}}replace(t,e,r){let n=this.length-e;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(t>0){let s=r[0];s instanceof i?r[0]=new i(t+s.length):r.unshift(new i(t-1),null)}return Vt.of(r)}decomposeLeft(t,e){e.push(new i(t-1),null)}decomposeRight(t,e){e.push(null,new i(this.length-t-1))}updateHeight(t,e=0,r=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let o=[],l=Math.max(e,n.from),a=-1;for(n.from>e&&o.push(new i(n.from-e-1).updateHeight(t,e));l<=s&&n.more;){let f=t.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++];a==-1?a=c:Math.abs(c-a)>=ys&&(a=-2);let u=new Ht(f,c);u.outdated=!1,o.push(u),l+=f+1}l<=s&&o.push(null,new i(s-l).updateHeight(t,l));let h=Vt.of(o);return(a<0||Math.abs(h.height-this.height)>=ys||Math.abs(a-this.heightMetrics(t,e).perLine)>=ys)&&(t.heightChanged=!0),h}else(r||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},fa=class extends Vt{constructor(t,e,r){super(t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,e,r,n){let s=r+this.left.height;return tl))return h;let f=e==et.ByPosNoHeight?et.ByPosNoHeight:et.ByPos;return a?h.join(this.right.lineAt(l,f,r,o,l)):this.left.lineAt(l,f,r,n,s).join(h)}forEachLine(t,e,r,n,s,o){let l=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,r,l,a,o);else{let h=this.lineAt(a,et.ByPos,r,n,s);t=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,r,l,a,o)}}replace(t,e,r){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,r));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of r)s.push(l);if(t>0&&Pu(s,o-1),e=r&&e.push(null)),t>r&&this.right.decomposeLeft(t-r,e)}decomposeRight(t,e){let r=this.left.length,n=r+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Vt.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,r=!1,n){let{left:s,right:o}=this,l=e+s.length+this.break,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,r,n):s.updateHeight(t,e,r),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(t,l,r,n):o.updateHeight(t,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?\" \":\"-\")+this.right}};function Pu(i,t){let e,r;i[t]==null&&(e=i[t-1])instanceof Ne&&(r=i[t+1])instanceof Ne&&i.splice(t-1,3,new Ne(e.length+1+r.length))}var T0=5,ca=class i{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let r=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ht?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ht(r-this.pos,-1)),this.writtenTo=r,e>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,r){if(t=T0)&&this.addLineDeco(n,s,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ht(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let r=new Ne(e-t);return this.oracle.doc.lineAt(t).to==e&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ht)return t;let e=new Ht(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+r}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Ht)&&!this.isCovered?this.nodes.push(new Ht(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!=\"visible\"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==i.parentNode?u.bottom:Math.min(a,u.bottom)}h=c.position==\"absolute\"||c.position==\"fixed\"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-e.left,right:Math.max(s,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function A0(i,t){let e=i.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}var qr=class{constructor(t,e,r){this.from=t,this.to=e,this.size=r}static same(t,e){if(t.length!=e.length)return!1;for(let r=0;rtypeof r!=\"function\"&&r.class==\"cm-lineWrapping\");this.heightOracle=new aa(e),this.stateDeco=t.facet(Yr).filter(r=>typeof r!=\"function\"),this.heightMap=Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(t.doc),[new xe(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let r=0;r<=1;r++){let n=r?e.head:e.anchor;if(!t.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);t.push(new Ii(s,o))}}this.viewports=t.sort((r,n)=>r.from-n.from),this.scaler=this.heightMap.height<=7e6?Cu:new pa(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Cr(t,this.scaler))})}update(t,e=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Yr).filter(f=>typeof f!=\"function\");let n=t.changedRanges,s=xe.extendWithRanges(n,P0(r,this.stateDeco,t?t.changes:vt.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=!t.changes.empty||t.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(cd)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,r=window.getComputedStyle(e),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction==\"rtl\"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:v,scaleY:y}=Iu(e,l);(this.scaleX!=v||this.scaleY!=y)&&(this.scaleX=v,this.scaleY=y,h|=8,o=a=!0)}let c=(parseInt(r.paddingTop)||0)*this.scaleY,u=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=zu(t.scrollDOM);let m=(this.printing?A0:C0)(e,this.paddingTop),O=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let v=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(S-this.contentDOMWidth)>n.charWidth){let{lineHeight:y,charWidth:k,textHeight:w}=t.docView.measureTextSize();o=y>0&&n.refresh(s,y,k,w,S/k,v),o&&(t.docView.minWidth=0,h|=8)}O>0&&g>0?f=Math.max(O,g):O<0&&g<0&&(f=Math.min(O,g)),n.heightChanged=!1;for(let y of this.viewports){let k=y.from==this.viewport.from?v:t.docView.measureVisibleLineHeights(y);this.heightMap=(o?Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new xe(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new ha(y.from,k))}n.heightChanged&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ii(n.lineAt(o-r*1e3,et.ByHeight,s,0,0).from,n.lineAt(l+(1-r)*1e3,et.ByHeight,s,0,0).to);if(e){let{head:h}=e.range;if(ha.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,et.ByPos,s,0,0),u;e.y==\"center\"?u=(c.top+c.bottom)/2-f/2:e.y==\"start\"||e.y==\"nearest\"&&h=l+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s>1,o=n<<1;if(this.defaultTextDirection!=G.LTR&&!r)return[];let l=[],a=(h,f,c,u)=>{if(f-hh&&gg.from>=c.from&&g.to<=c.to&&Math.abs(g.from-h)g.fromx));if(!O){if(fg.from<=f&&g.to>=f)){let g=e.moveToLineBoundary(b.cursor(f),!1,!0).head;g>h&&(f=g)}O=new qr(h,f,this.gapSize(c,h,f,u))}l.push(O)};for(let h of this.viewportLines){if(h.lengthh.from&&a(h.from,u,h,f),de.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_.spans(t,this.viewport.from,this.viewport.to,{span(n,s){e.push({from:n,to:s})},point(){}},20);let r=e.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=e[s].from||n.to!=e[s].to);return this.visibleRanges=e,r?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Cr(this.heightMap.lineAt(t,et.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Cr(this.heightMap.lineAt(this.scaler.fromDOM(t),et.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Cr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ii=class{constructor(t,e){this.from=t,this.to=e}};function Q0(i,t,e){let r=[],n=i,s=0;return _.spans(e,i,t,{span(){},point(o,l){o>n&&(r.push({from:n,to:o}),s+=o-n),n=l}},20),n=1)return t[t.length-1].to;let r=Math.floor(i*e);for(let n=0;;n++){let{from:s,to:o}=t[n],l=o-s;if(r<=l)return s+r;r-=l}}function ds(i,t){let e=0;for(let{from:r,to:n}of i.ranges){if(t<=n){e+=t-r;break}e+=n-r}return e/i.total}function R0(i,t){for(let e of i)if(t(e))return e}var Cu={toDOM(i){return i},fromDOM(i){return i},scale:1},pa=class{constructor(t,e,r){let n=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let h=e.lineAt(l,et.ByPos,t,0,0).top,f=e.lineAt(a,et.ByPos,t,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let e=0,r=0,n=0;;e++){let s=eCr(n,t)):i._content)}var ps=A.define({combine:i=>i.join(\" \")}),ma=A.define({combine:i=>i.indexOf(!0)>-1}),ga=Gt.newName(),Qd=Gt.newName(),Rd=Gt.newName(),Md={\"&light\":\".\"+Qd,\"&dark\":\".\"+Rd};function Oa(i,t,e){return new Gt(t,{finish(r){return/&/.test(r)?r.replace(/&\\w*/,n=>{if(n==\"&\")return i;if(!e||!e[n])throw new RangeError(`Unsupported selector: ${n}`);return e[n]}):i+\" \"+r}})}var M0=Oa(\".\"+ga,{\"&\":{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\",minHeight:\"100%\",padding:\"4px 0\",outline:\"none\",\"&[contenteditable=true]\":{WebkitUserModify:\"read-write-plaintext-only\"}},\".cm-lineWrapping\":{whiteSpace_fallback:\"pre-wrap\",whiteSpace:\"break-spaces\",wordBreak:\"break-word\",overflowWrap:\"anywhere\",flexShrink:1},\"&light .cm-content\":{caretColor:\"black\"},\"&dark .cm-content\":{caretColor:\"white\"},\".cm-line\":{display:\"block\",padding:\"0 2px 0 6px\"},\".cm-layer\":{position:\"absolute\",left:0,top:0,contain:\"size style\",\"& > *\":{position:\"absolute\"}},\"&light .cm-selectionBackground\":{background:\"#d9d9d9\"},\"&dark .cm-selectionBackground\":{background:\"#222\"},\"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#d7d4f0\"},\"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#233\"},\".cm-cursorLayer\":{pointerEvents:\"none\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer\":{animation:\"steps(1) cm-blink 1.2s infinite\"},\"@keyframes cm-blink\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\"@keyframes cm-blink2\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\".cm-cursor, .cm-dropCursor\":{borderLeft:\"1.2px solid black\",marginLeft:\"-0.6px\",pointerEvents:\"none\"},\".cm-cursor\":{display:\"none\"},\"&dark .cm-cursor\":{borderLeftColor:\"#444\"},\".cm-dropCursor\":{position:\"absolute\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor\":{display:\"block\"},\".cm-iso\":{unicodeBidi:\"isolate\"},\".cm-announced\":{position:\"fixed\",top:\"-10000px\"},\"@media print\":{\".cm-announced\":{display:\"none\"}},\"&light .cm-activeLine\":{backgroundColor:\"#cceeff44\"},\"&dark .cm-activeLine\":{backgroundColor:\"#99eeff33\"},\"&light .cm-specialChar\":{color:\"red\"},\"&dark .cm-specialChar\":{color:\"#f78\"},\".cm-gutters\":{flexShrink:0,display:\"flex\",height:\"100%\",boxSizing:\"border-box\",insetInlineStart: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,')`,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\"}},Md),Ar=\"\\uFFFF\",xa=class{constructor(t,e){this.points=t,this.text=\"\",this.lineSeparator=e.facet(Y.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Ar}readRange(t,e){if(!t)return this;let r=t.parentNode;for(let n=t;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==e)break;let l=rt.get(n),a=rt.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Au(n))||Au(o)&&(n.nodeName!=\"BR\"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(r,e),this}readTextNode(t){let e=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,e.length));for(let r=0,n=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=n.exec(e))&&(s=l.index,o=l[0].length),this.append(e.slice(r,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(t){if(t.cmIgnore)return;let e=rt.get(t),r=e&&e.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName==\"BR\"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}findPointInside(t,e){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(E0(t,r.node,r.offset)?e:0))}};function E0(i,t,e){for(;;){if(!t||e-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,r,0))){let l=s||o?[]:D0(t),a=new xa(l,t.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=B0(l,this.bounds.from)}else{let l=t.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Zl(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Zl(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=t.viewport;if((Q.ios||Q.chrome)&&t.state.selection.main.empty&&a!=h&&(f.from>0||f.toDate.now()-100?i.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,a=n.from,h=null;(s===8||Q.android&&t.text.length=n.from&&e.to<=n.to&&(e.from!=n.from||e.to!=n.to)&&n.to-n.from-(e.to-e.from)<=4?e={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,e.from).append(e.insert).append(i.state.doc.slice(e.to,n.to))}:(Q.mac||Q.android)&&e&&e.from==e.to&&e.from==n.head-1&&/^\\. ?$/.test(e.insert.toString())&&i.contentDOM.getAttribute(\"autocorrect\")==\"off\"?(r&&e.insert.length==2&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}):Q.chrome&&e&&e.from==e.to&&e.from==n.head&&e.insert.toString()==`\n `&&i.lineWrapping&&(r&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}),e){if(Q.ios&&i.inputState.flushIOSKey()||Q.android&&(e.from==n.from&&e.to==n.to&&e.insert.length==1&&e.insert.lines==2&&zi(i.contentDOM,\"Enter\",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||s==8&&e.insert.lengthn.head)&&zi(i.contentDOM,\"Backspace\",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&zi(i.contentDOM,\"Delete\",46)))return!0;let o=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let l,a=()=>l||(l=$0(i,e,r));return i.state.facet(ad).some(h=>h(i,e.from,e.to,o,a))||i.dispatch(a()),!0}else if(r&&!r.main.eq(n)){let o=!1,l=\"select\";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin==\"select\"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function $0(i,t,e){let r,n=i.state,s=n.selection.main;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&i.inputState.composing<0){let l=s.fromt.to?n.sliceDoc(t.to,s.to):\"\";r=n.replaceSelection(i.state.toText(l+t.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=n.changes(t),a=e&&e.main.to<=l.newLength?e.main:void 0;if(n.selection.ranges.length>1&&i.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let h=i.state.sliceDoc(t.from,t.to),f,c=e&&Od(i,e.main.head);if(c){let m=t.insert.length-(t.to-t.from);f={from:c.from,to:c.to-m}}else f=i.state.doc.lineAt(s.head);let u=s.to-t.to,d=s.to-s.from;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let O=m.to-u,g=O-h.length;if(m.to-m.from!=d||i.state.sliceDoc(g,O)!=h||m.to>=f.from&&m.from<=f.to)return{range:m};let x=n.changes({from:g,to:O,insert:t.insert}),S=m.to-s.to;return{changes:x,range:a?b.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S)):m.map(x)}})}else r={changes:l,selection:a&&n.selection.replaceRange(a)}}let o=\"input.type\";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=\".compose\",i.inputState.compositionFirstChange&&(o+=\".start\",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:o,scrollIntoView:!0})}function q0(i,t,e,r){let n=Math.min(i.length,t.length),s=0;for(;s0&&l>0&&i.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(r==\"end\"){let a=Math.max(0,s-Math.min(o,l));e-=o+a-s}if(o=o?s-e:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-e:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function D0(i){let t=[];if(i.root.activeElement!=i.contentDOM)return t;let{anchorNode:e,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return e&&(t.push(new Qs(e,r)),(n!=e||s!=r)&&t.push(new Qs(n,s))),t}function B0(i,t){if(i.length==0)return null;let e=i[0].pos,r=i.length==2?i[1].pos:e;return e>-1&&r>-1?b.single(e+t,r+t):null}var X0={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Il=Q.ie&&Q.ie_version<=11,ba=class{constructor(t){this.view=t,this.active=!1,this.selectionRange=new Fl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let r of e)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&t.composing)&&e.some(r=>r.type==\"childList\"&&r.removedNodes.length||r.type==\"characterData\"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Il&&(this.onCharData=e=>{this.queue.push({target:e.target,type:\"characterData\",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver==\"function\"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(\"Event\")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(\"Event\"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers(\"scroll\",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,r)=>e!=t[r]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Xs)?r.root.activeElement!=this.dom:!Os(r.dom,n))return;let s=n.anchorNode&&r.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&n.focusNode&&Rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Q.safari&&t.root.nodeType==11&&AO(this.dom.ownerDocument)==this.dom&&L0(this.view)||Ss(t.root);if(!e||this.selectionRange.eq(e))return!1;let r=Os(this.dom,e);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&zi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||t==\"Enter\")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,r=-1,n=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),e==-1?{from:e,to:r}=o:(e=Math.min(o.from,e),r=Math.max(o.to,r)))}return{from:e,to:r,typeOver:n}}readChange(){let{from:t,to:e,typeOver:r}=this.processRecords(),n=this.selectionChanged&&Os(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ya(this.view,t,e,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let r=this.view.state,n=Ed(this.view,e);return this.view.state==r&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type==\"attributes\"),t.type==\"attributes\"&&(e.flags|=4),t.type==\"childList\"){let r=Qu(e,t.previousSibling||t.target.previousSibling,-1),n=Qu(e,t.nextSibling||t.target.nextSibling,1);return{from:r?e.posAfter(r):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}else return t.type==\"characterData\"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener(\"resize\",this.onResize),t.addEventListener(\"beforeprint\",this.onPrint),t.addEventListener(\"scroll\",this.onScroll),t.document.addEventListener(\"selectionchange\",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener(\"scroll\",this.onScroll),t.removeEventListener(\"resize\",this.onResize),t.removeEventListener(\"beforeprint\",this.onPrint),t.document.removeEventListener(\"selectionchange\",this.onSelectionChange)}destroy(){var t,e,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener(\"scroll\",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function Qu(i,t,e){for(;t;){let r=rt.get(t);if(r&&r.parent==i)return r;let n=t.parentNode;t=n!=i.dom?n:e>0?t.nextSibling:t.previousSibling}return null}function L0(i){let t=null;function e(a){a.preventDefault(),a.stopImmediatePropagation(),t=a.getTargetRanges()[0]}if(i.contentDOM.addEventListener(\"beforeinput\",e,!0),i.dom.ownerDocument.execCommand(\"indent\"),i.contentDOM.removeEventListener(\"beforeinput\",e,!0),!t)return null;let r=t.startContainer,n=t.startOffset,s=t.endContainer,o=t.endOffset,l=i.docView.domAtPos(i.state.selection.main.anchor);return Rr(l.node,l.offset,s,o)&&([r,n,s,o]=[s,o,r,n]),{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:o}}var T=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement(\"div\"),this.scrollDOM=document.createElement(\"div\"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=\"cm-scroller\",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(\"div\"),this.announceDOM.className=\"cm-announced\",this.announceDOM.setAttribute(\"aria-live\",\"polite\"),this.dom=document.createElement(\"div\"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(r=>r.forEach(n=>e(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||EO(t.parent)||document,this.viewState=new As(t.state||Y.create(t)),t.scrollTo&&t.scrollTo.is(hs)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Tr).map(r=>new $r(r));for(let r of this.plugins)r.update(this);this.observer=new ba(this),this.inputState=new sa(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ts(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=t.length==1&&t[0]instanceof lt?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.update are not allowed while an update is in progress\");let e=!1,r=!1,n,s=this.state;for(let u of t){if(u.startState!=s)throw new RangeError(\"Trying to update state with a transaction that doesn't start from the previous state.\");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;t.some(u=>u.annotation(Pd))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Cd(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(Y.phrases)!=this.state.facet(Y.phrases))return this.setState(s);n=ks.create(this,s,t),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;c=new Er(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(hs)&&(c=d.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Rs.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(Pr)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(u=>u.isUserEvent(\"select.pointer\")))}finally{this.updateState=0}if(n.startState.facet(ps)!=n.state.facet(ps)&&(this.viewState.mustMeasureContent=!0),(e||r||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(ia))try{u(n)}catch(d){Ct(this.state,d,\"update listener\")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!Ed(this,f)&&h.force&&zi(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.setState are not allowed while an update is in progress\");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new As(t),this.plugins=t.facet(Tr).map(r=>new $r(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Ts(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Tr),r=t.state.facet(Tr);if(e!=r){let n=[];for(let s of r){let o=e.indexOf(s);if(o<0)n.push(new $r(s));else{let l=this.plugins[o];l.mustUpdate=t,n.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(zu(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?\"Measure loop restarted more than 5 times\":\"Viewport failed to stabilize\");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(d=>{try{return d.read(this)}catch(m){return Ct(this.state,m),Ru}}),c=ks.create(this,this.state,[]),u=!1;c.flags|=a,e?e.flags|=a:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c));for(let d=0;d1||m<-1){n=n+m,r.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(ia))l(e)}get themeClasses(){return ga+\" \"+(this.state.facet(ma)?Rd:Qd)+\" \"+this.state.facet(ps)}updateAttrs(){let t=Mu(this,ud,{class:\"cm-editor\"+(this.hasFocus?\" cm-focused \":\" \")+this.themeClasses}),e={spellcheck:\"false\",autocorrect:\"off\",autocapitalize:\"off\",translate:\"no\",contenteditable:this.state.facet(Xs)?\"true\":\"false\",class:\"cm-content\",style:`${Q.tabSize}: ${this.state.tabSize}`,role:\"textbox\",\"aria-multiline\":\"true\"};this.state.readOnly&&(e[\"aria-readonly\"]=\"true\"),Mu(this,Ea,e);let r=this.observer.ignore(()=>{let n=jl(this.contentDOM,this.contentAttrs,e),s=jl(this.dom,this.editorAttrs,t);return n||s});return this.editorAttrs=t,this.contentAttrs=e,r}showAnnouncements(t){let e=!0;for(let r of t)for(let n of r.effects)if(n.is(i.announce)){e&&(this.announceDOM.textContent=\"\"),e=!1;let s=this.announceDOM.appendChild(document.createElement(\"div\"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Pr);let t=this.state.facet(i.cspNonce);Gt.mount(this.root,this.styleModules.concat(M0).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error(\"Reading the editor layout isn't allowed during an update\");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;er.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,r){return Wl(this,t,mu(this,t,e,r))}moveByGroup(t,e){return Wl(this,t,mu(this,t,e,r=>a0(this,t.head,r)))}visualLineSide(t,e){let r=this.bidiSpans(t),n=this.textDirectionAt(t.from),s=r[e?r.length-1:0];return b.cursor(s.side(e,n)+t.from,s.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,r=!0){return l0(this,t,e,r)}moveVertically(t,e,r){return Wl(this,t,h0(this,t,e,r))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),yd(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let r=this.docView.coordsAt(t,e);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n),o=s[Oe.find(s,t-n.from,-1,e)];return Aa(r,o.dir==G.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(fd)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>V0)return id(t.length);let e=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==e&&(s.fresh||ed(s.isolates,r=fu(this,t))))return s.order;r||(r=fu(this,t));let n=ZO(t.text,e,r);return this.bidiCache.push(new Rs(t.from,t.to,e,r,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nu(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return hs.of(new Er(typeof t==\"number\"?b.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return hs.of(new Er(b.cursor(r.from),\"start\",\"start\",r.top-t,e,!0))}static domEventHandlers(t){return ft.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ft.define(()=>({}),{eventObservers:t})}static theme(t,e){let r=Gt.newName(),n=[ps.of(r),Pr.of(Oa(`.${r}`,t))];return e&&e.dark&&n.push(ma.of(!0)),n}static baseTheme(t){return ie.lowest(Pr.of(Oa(\".\"+ga,t,Md)))}static findFromDOM(t){var e;let r=t.querySelector(\".cm-content\"),n=r&&rt.get(r)||rt.get(t);return((e=n?.rootView)===null||e===void 0?void 0:e.view)||null}};T.styleModule=Pr;T.inputHandler=ad;T.focusChangeEffect=hd;T.perLineTextDirection=fd;T.exceptionSink=ld;T.updateListener=ia;T.editable=Xs;T.mouseSelectionStyle=od;T.dragMovesSelection=sd;T.clickAddsSelectionRange=nd;T.decorations=Yr;T.outerDecorations=dd;T.atomicRanges=$a;T.bidiIsolatedRanges=pd;T.scrollMargins=md;T.darkTheme=ma;T.cspNonce=A.define({combine:i=>i.length?i[0]:\"\"});T.contentAttributes=Ea;T.editorAttributes=ud;T.lineWrapping=T.contentAttributes.of({class:\"cm-lineWrapping\"});T.announce=M.define();var V0=4096,Ru={},Rs=class i{constructor(t,e,r,n,s,o){this.from=t,this.to=e,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(t,e){if(e.empty&&!t.some(s=>s.fresh))return t;let r=[],n=t.length?t[t.length-1].dir:G.LTR;for(let s=Math.max(0,t.length-10);s=0;n--){let s=r[n],o=typeof s==\"function\"?s(i):s;o&&Ul(o,e)}return e}var W0=Q.mac?\"mac\":Q.windows?\"win\":Q.linux?\"linux\":\"key\";function I0(i,t){let e=i.split(/-(?!$)/),r=e[e.length-1];r==\"Space\"&&(r=\" \");let n,s,o,l;for(let a=0;ar.concat(n),[]))),e}function qd(i,t,e){return Dd($d(i.state),t,i,e)}var Ie=null,Y0=4e3;function z0(i,t=W0){let e=Object.create(null),r=Object.create(null),n=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error(\"Key binding \"+o+\" is used both as a regular binding and as a multi-stroke prefix\")},s=(o,l,a,h,f)=>{var c,u;let d=e[o]||(e[o]=Object.create(null)),m=l.split(/ (?!$)/).map(x=>I0(x,t));for(let x=1;x{let v=Ie={view:C,prefix:S,scope:o};return setTimeout(()=>{Ie==v&&(Ie=null)},Y0),!0}]})}let O=m.join(\" \");n(O,!1);let g=d[O]||(d[O]={preventDefault:!1,stopPropagation:!1,run:((u=(c=d._any)===null||c===void 0?void 0:c.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),f&&(g.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(\" \"):[\"editor\"];if(o.any)for(let h of l){let f=e[h]||(e[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let c in f)f[c].run.push(o.any)}let a=o[t]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,\"Shift-\"+a,o.shift,o.preventDefault,o.stopPropagation)}return e}function Dd(i,t,e,r){let n=iu(t),s=dt(n,0),o=wt(s)==n.length&&n!=\" \",l=\"\",a=!1,h=!1,f=!1;Ie&&Ie.view==e&&Ie.scope==r&&(l=Ie.prefix+\" \",Sd.indexOf(t.keyCode)<0&&(h=!0,Ie=null));let c=new Set,u=g=>{if(g){for(let x of g.run)if(!c.has(x)&&(c.add(x),x(e,t)))return g.stopPropagation&&(f=!0),!0;g.preventDefault&&(g.stopPropagation&&(f=!0),h=!0)}return!1},d=i[r],m,O;return d&&(u(d[l+ms(n,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Q.windows&&t.ctrlKey&&t.altKey)&&(m=$e[t.keyCode])&&m!=n?(u(d[l+ms(m,t,!0)])||t.shiftKey&&(O=Vi[t.keyCode])!=n&&O!=m&&u(d[l+ms(O,t,!1)]))&&(a=!0):o&&t.shiftKey&&u(d[l+ms(n,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&f&&t.stopPropagation(),a}var zr=class i{constructor(t,e,r,n,s){this.className=t,this.left=e,this.top=r,this.width=n,this.height=s}draw(){let t=document.createElement(\"div\");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+\"px\",t.style.top=this.top+\"px\",this.width!=null&&(t.style.width=this.width+\"px\"),t.style.height=this.height+\"px\"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,r){if(r.empty){let n=t.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let s=Bd(t);return[new i(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}else return Z0(t,e,r)}};function Bd(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==G.LTR?t.left:t.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:t.top-i.scrollDOM.scrollTop*i.scaleY}}function $u(i,t,e){let r=b.cursor(t);return{from:Math.max(e.from,i.moveToLineBoundary(r,!1,!0).from),to:Math.min(e.to,i.moveToLineBoundary(r,!0,!0).from),type:Pt.Text}}function Z0(i,t,e){if(e.to<=i.viewport.from||e.from>=i.viewport.to)return[];let r=Math.max(e.from,i.viewport.from),n=Math.min(e.to,i.viewport.to),s=i.textDirection==G.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=Bd(i),h=o.querySelector(\".cm-line\"),f=h&&window.getComputedStyle(h),c=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),u=l.right-(f?parseInt(f.paddingRight):0),d=na(i,r),m=na(i,n),O=d.type==Pt.Text?d:null,g=m.type==Pt.Text?m:null;if(O&&(i.lineWrapping||d.widgetLineBreaks)&&(O=$u(i,r,O)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=$u(i,n,g)),O&&g&&O.from==g.from)return S(C(e.from,e.to,O));{let y=O?C(e.from,null,O):v(d,!1),k=g?C(null,e.to,g):v(m,!0),w=[];return(O||d).to<(g||m).from-(O&&g?1:0)||d.widgetLineBreaks>1&&y.bottom+i.defaultLineHeight/2D&&N.from=Rt)break;ct>nt&&B(Math.max(Ft,nt),y==null&&Ft<=D,Math.min(ct,Rt),k==null&&ct>=U,Bt.dir)}if(nt=Mt.to+1,nt>=Rt)break}return W.length==0&&B(D,y==null,U,k==null,i.textDirection),{top:q,bottom:L,horizontal:W}}function v(y,k){let w=l.top+(k?y.top:y.bottom);return{top:w,bottom:w,horizontal:[]}}}function F0(i,t){return i.constructor==t.constructor&&i.eq(t)}var Sa=class{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement(\"div\")),this.dom.classList.add(\"cm-layer\"),e.above&&this.dom.classList.add(\"cm-layer-above\"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute(\"aria-hidden\",\"true\"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(bs)!=t.state.facet(bs)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,r=t.facet(bs);for(;e!F0(e,this.drawn[r]))){let e=this.dom.firstChild,r=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[r].constructor&&n.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(n.draw(),e);for(;e;){let n=e.nextSibling;e.remove(),e=n}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},bs=A.define();function Xd(i){return[ft.define(t=>new Sa(t,i)),bs.of(i)]}var Ld=!Q.ios,Zr=A.define({combine(i){return kt(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function Ls(i={}){return[Zr.of(i),_0,G0,H0,cd.of(!0)]}function Vd(i){return i.startState.facet(Zr)!=i.state.facet(Zr)}var _0=Xd({above:!0,markers(i){let{state:t}=i,e=t.facet(Zr),r=[];for(let n of t.selection.ranges){let s=n==t.selection.main;if(n.empty?!s||Ld:e.drawRangeCursor){let o=s?\"cm-cursor cm-cursor-primary\":\"cm-cursor cm-cursor-secondary\",l=n.empty?n:b.cursor(n.head,n.head>n.anchor?-1:1);for(let a of zr.forRange(i,o,l))r.push(a)}}return r},update(i,t){i.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName==\"cm-blink\"?\"cm-blink2\":\"cm-blink\");let e=Vd(i);return e&&qu(i.state,t),i.docChanged||i.selectionSet||e},mount(i,t){qu(t.state,i)},class:\"cm-cursorLayer\"});function qu(i,t){t.style.animationDuration=i.facet(Zr).cursorBlinkRate+\"ms\"}var G0=Xd({above:!1,markers(i){return i.state.selection.ranges.map(t=>t.empty?[]:zr.forRange(i,\"cm-selectionBackground\",t)).reduce((t,e)=>t.concat(e))},update(i,t){return i.docChanged||i.selectionSet||i.viewportChanged||Vd(i)},class:\"cm-selectionLayer\"}),wa={\".cm-line\":{\"& ::selection\":{backgroundColor:\"transparent !important\"},\"&::selection\":{backgroundColor:\"transparent !important\"}}};Ld&&(wa[\".cm-line\"].caretColor=\"transparent !important\",wa[\".cm-content\"]={caretColor:\"transparent !important\"});var H0=ie.highest(T.theme(wa)),Wd=M.define({map(i,t){return i==null?null:t.mapPos(i)}}),Qr=it.define({create(){return null},update(i,t){return i!=null&&(i=t.changes.mapPos(i)),t.effects.reduce((e,r)=>r.is(Wd)?r.value:e,i)}}),U0=ft.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var t;let e=i.state.field(Qr);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(\"div\")),this.cursor.className=\"cm-dropCursor\"),(i.startState.field(Qr)!=e||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,t=i.state.field(Qr),e=t!=null&&i.coordsAtPos(t);if(!e)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:e.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:e.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:e.bottom-e.top}}drawCursor(i){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;i?(this.cursor.style.left=i.left/t+\"px\",this.cursor.style.top=i.top/e+\"px\",this.cursor.style.height=i.height/e+\"px\"):this.cursor.style.left=\"-100000px\"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Qr)!=i&&this.view.dispatch({effects:Wd.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Vs(){return[Qr,U0]}var Aw=/x/.unicode!=null?\"gu\":\"g\";var va=2e3;function j0(i,t,e){let r=Math.min(t.line,e.line),n=Math.max(t.line,e.line),s=[];if(t.off>va||e.off>va||t.col<0||e.col<0){let o=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let a=r;a<=n;a++){let h=i.doc.line(a);h.length<=l&&s.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let a=r;a<=n;a++){let h=i.doc.line(a),f=os(h.text,o,i.tabSize,!0);if(f<0)s.push(b.cursor(h.to));else{let c=os(h.text,l,i.tabSize);s.push(b.range(h.from+f,h.from+c))}}}return s}function K0(i,t){let e=i.coordsAtPos(i.viewport.from);return e?Math.round(Math.abs((e.left-t)/i.defaultCharacterWidth)):-1}function Du(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1),r=i.state.doc.lineAt(e),n=e-r.from,s=n>va?-1:n==r.length?K0(i,t.clientX):We(r.text,i.state.tabSize,e-r.from);return{line:r.number,col:s,off:n}}function J0(i,t){let e=Du(i,t),r=i.state.selection;return e?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(e.line).from),o=n.state.doc.lineAt(s);e={line:o.number,col:e.col,off:Math.min(e.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let l=Du(i,n);if(!l)return r;let a=j0(i.state,e,l);return a.length?o?b.create(a.concat(r.ranges)):b.create(a):r}}:null}function qa(i){let t=i?.eventFilter||(e=>e.altKey&&e.button==0);return T.mouseSelectionStyle.of((e,r)=>t(r)?J0(e,r):null)}var tx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},ex={style:\"cursor: crosshair\"};function Ws(i={}){let[t,e]=tx[i.key||\"Alt\"],r=ft.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==t||e(n))},keyup(n){(n.keyCode==t||!e(n))&&this.set(!1)},mousemove(n){this.set(e(n))}}});return[r,T.contentAttributes.of(n=>{var s;return!((s=n.plugin(r))===null||s===void 0)&&s.isDown?ex:null})]}var kr=\"-10000px\",Ms=class{constructor(t,e,r,n){this.facet=e,this.createTooltipView=r,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(t,e){var r;let n=t.state.facet(this.facet),s=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let o=[],l=e?[]:null;for(let a=0;ae[h]=a),e.length=l.length),this.input=n,this.tooltips=s,this.tooltipViews=o,!0}};function ix(i){let{win:t}=i;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}var Nl=A.define({combine:i=>{var t,e,r;return{position:Q.ios?\"absolute\":((t=i.find(n=>n.position))===null||t===void 0?void 0:t.position)||\"fixed\",parent:((e=i.find(n=>n.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((r=i.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||ix}}}),Bu=new WeakMap,Da=ft.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=i.state.facet(Nl);this.position=t.position,this.parent=t.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==\"function\"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ms(i,Fr,(e,r)=>this.createTooltip(e,r),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==\"function\"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener(\"resize\",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(\"div\"),this.container.style.position=\"relative\",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(i,this.above);t&&this.observeIntersection();let e=t||i.geometryChanged,r=i.state.facet(Nl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(i,t){let e=i.create(this.view),r=t?t.dom:null;if(e.dom.classList.add(\"cm-tooltip\"),i.arrow&&!e.dom.querySelector(\".cm-tooltip > .cm-tooltip-arrow\")){let n=document.createElement(\"div\");n.className=\"cm-tooltip-arrow\",e.dom.insertBefore(n,r)}return e.dom.style.position=this.position,e.dom.style.top=kr,e.dom.style.left=\"0px\",this.container.insertBefore(e.dom,r),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var i,t,e;this.view.win.removeEventListener(\"resize\",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),t=1,e=1,r=!1;if(this.position==\"fixed\"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Q.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==kr&&n.style.left==\"0px\"){let s=n.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position==\"absolute\")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((n,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Nl).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:r}}writeMeasure(i){var t;if(i.makeAbsolute){this.madeAbsolute=!0,this.position=\"absolute\";for(let l of this.manager.tooltipViews)l.dom.style.position=\"absolute\"}let{editor:e,space:r,scaleX:n,scaleY:s}=i,o=[];for(let l=0;l=Math.min(e.bottom,r.bottom)||c.rightMath.min(e.right,r.right)+.1){f.style.top=kr;continue}let d=a.arrow?h.dom.querySelector(\".cm-tooltip-arrow\"):null,m=d?7:0,O=u.right-u.left,g=(t=Bu.get(h))!==null&&t!==void 0?t:u.bottom-u.top,x=h.offset||nx,S=this.view.textDirection==G.LTR,C=u.width>r.right-r.left?S?r.left:r.right-u.width:S?Math.min(c.left-(d?14:0)+x.x,r.right-O):Math.max(r.left,c.left-O+(d?14:0)-x.x),v=this.above[l];!a.strictSide&&(v?c.top-(u.bottom-u.top)-x.yr.bottom)&&v==r.bottom-c.bottom>c.top-r.top&&(v=this.above[l]=!v);let y=(v?c.top-r.top:r.bottom-c.bottom)-m;if(yC&&q.topk&&(k=v?q.top-g-2-m:q.bottom+m+2);if(this.position==\"absolute\"?(f.style.top=(k-i.parent.top)/s+\"px\",f.style.left=(C-i.parent.left)/n+\"px\"):(f.style.top=k/s+\"px\",f.style.left=C/n+\"px\"),d){let q=c.left+(S?x.x:-x.x)-(C+14-7);d.style.left=q/n+\"px\"}h.overlap!==!0&&o.push({left:C,top:k,right:w,bottom:k+g}),f.classList.toggle(\"cm-tooltip-above\",v),f.classList.toggle(\"cm-tooltip-below\",!v),h.positioned&&h.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=kr}},{eventObservers:{scroll(){this.maybeMeasure()}}}),rx=T.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:\"7px\",width:`${7*2}px`,position:\"absolute\",zIndex:-1,overflow:\"hidden\",\"&:before, &:after\":{content:\"''\",position:\"absolute\",width:0,height:0,borderLeft:\"7px solid transparent\",borderRight:\"7px solid transparent\"},\".cm-tooltip-above &\":{bottom:\"-7px\",\"&:before\":{borderTop:\"7px solid #bbb\"},\"&:after\":{borderTop:\"7px solid #f5f5f5\",bottom:\"1px\"}},\".cm-tooltip-below &\":{top:\"-7px\",\"&:before\":{borderBottom:\"7px solid #bbb\"},\"&:after\":{borderBottom:\"7px solid #f5f5f5\",top:\"1px\"}}},\"&dark .cm-tooltip .cm-tooltip-arrow\":{\"&:before\":{borderTopColor:\"#333338\",borderBottomColor:\"#333338\"},\"&:after\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"}}}),nx={x:0,y:0},Fr=A.define({enables:[Da,rx]}),Es=A.define({combine:i=>i.reduce((t,e)=>t.concat(e),[])}),$s=class i{static create(t){return new i(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement(\"div\"),this.dom.classList.add(\"cm-tooltip-hover\"),this.manager=new Ms(t,Es,(e,r)=>this.createHostedView(e,r),e=>e.dom.remove())}createHostedView(t,e){let r=t.create(this.view);return r.dom.classList.add(\"cm-tooltip-section\"),this.dom.insertBefore(r.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let r of this.manager.tooltipViews){let n=r[t];if(n!==void 0){if(e===void 0)e=n;else if(e!==n)return}}return e}get offset(){return this.passProp(\"offset\")}get getCoords(){return this.passProp(\"getCoords\")}get overlap(){return this.passProp(\"overlap\")}get resize(){return this.passProp(\"resize\")}},sx=Fr.compute([Es],i=>{let t=i.facet(Es);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var r;return(r=e.end)!==null&&r!==void 0?r:e.pos})),create:$s.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),ka=class{constructor(t,e,r,n,s){this.view=t,this.source=e,this.field=r,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener(\"mouseleave\",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener(\"mousemove\",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;tl.bottom||e.xl.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(n)).find(f=>f.from<=n&&f.to>=n),h=a&&a.dir==G.RTL?-1:1;s=e.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Ct(t.state,a,\"hover tooltip\"))}else o&&!(Array.isArray(o)&&!o.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(Da),e=t?t.manager.tooltips.findIndex(r=>r.create==$s.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!ox(s.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,l=(r=(e=n[0])===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!lx(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=r=>{t.removeEventListener(\"mouseleave\",e),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener(\"mouseleave\",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener(\"mouseleave\",this.mouseleave),this.view.dom.removeEventListener(\"mousemove\",this.mousemove)}},gs=4;function ox(i,t){let e=i.getBoundingClientRect();return t.clientX>=e.left-gs&&t.clientX<=e.right+gs&&t.clientY>=e.top-gs&&t.clientY<=e.bottom+gs}function lx(i,t,e,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),l=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.rightn||Math.min(o.bottom,l)=t&&a<=e}function Id(i,t={}){let e=M.define(),r=it.define({create(){return[]},update(n,s){if(n.length&&(t.hideOnChange&&(s.docChanged||s.selection)?n=[]:t.hideOn&&(n=n.filter(o=>!t.hideOn(s,o))),s.docChanged)){let o=[];for(let l of n){let a=s.changes.mapPos(l.pos,-1,ut.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=s.changes.mapPos(h.end)),o.push(h)}}n=o}for(let o of s.effects)o.is(e)&&(n=o.value),o.is(ax)&&(n=[]);return n},provide:n=>Es.from(n)});return[r,ft.define(n=>new ka(n,i,r,e,t.hoverTime||300)),sx]}function Ba(i,t){let e=i.plugin(Da);if(!e)return null;let r=e.manager.tooltips.indexOf(t);return r<0?null:e.manager.tooltipViews[r]}var ax=M.define();var Xu=A.define({combine(i){let t,e;for(let r of i)t=t||r.topContainer,e=e||r.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ci(i,t){let e=i.plugin(Nd),r=e?e.specs.indexOf(t):-1;return r>-1?e.panels[r]:null}var Nd=ft.fromClass(class{constructor(i){this.input=i.state.facet(fi),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(i));let t=i.state.facet(Xu);this.top=new Ni(i,!0,t.topContainer),this.bottom=new Ni(i,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(\"cm-panel\"),e.mount&&e.mount()}update(i){let t=i.state.facet(Xu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ni(i.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ni(i.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=i.state.facet(fi);if(e!=this.input){let r=e.filter(a=>a),n=[],s=[],o=[],l=[];for(let a of r){let h=this.specs.indexOf(a),f;h<0?(f=a(i.view),l.push(f)):(f=this.panels[h],f.update&&f.update(i)),n.push(f),(f.top?s:o).push(f)}this.specs=r,this.panels=n,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add(\"cm-panel\"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})}),Ni=class{constructor(t,e,r){this.view=t,this.top=e,this.container=r,this.dom=void 0,this.classes=\"\",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement(\"div\"),this.dom.className=this.top?\"cm-panels cm-panels-top\":\"cm-panels cm-panels-bottom\",this.dom.style[this.top?\"top\":\"bottom\"]=\"0\";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Lu(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Lu(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(\" \"))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(\" \"))t&&this.container.classList.add(t)}}};function Lu(i){let t=i.nextSibling;return i.remove(),t}var fi=A.define({enables:Nd}),se=class extends ee{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}};se.prototype.elementClass=\"\";se.prototype.toDOM=void 0;se.prototype.mapMode=ut.TrackBefore;se.prototype.startSide=se.prototype.endSide=-1;se.prototype.point=!0;var Yl=A.define(),hx={class:\"\",renderEmptyElements:!1,elementStyle:\"\",markers:()=>_.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Dr=A.define();function _r(i){return[Yd(),Dr.of(Object.assign(Object.assign({},hx),i))]}var Ta=A.define({combine:i=>i.some(t=>t)});function Yd(i){let t=[fx];return i&&i.fixed===!1&&t.push(Ta.of(!0)),t}var fx=ft.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutters\",this.dom.setAttribute(\"aria-hidden\",\"true\"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+\"px\",this.gutters=i.state.facet(Dr).map(t=>new qs(i,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!i.state.facet(Ta),this.fixed&&(this.dom.style.position=\"sticky\"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let t=this.prevViewport,e=i.view.viewport,r=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(r<(e.to-e.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+\"px\"),this.view.state.facet(Ta)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?\"sticky\":\"\"),this.prevViewport=i.view.viewport}syncGutters(i){let t=this.dom.nextSibling;i&&this.dom.remove();let e=_.iter(this.view.state.facet(Yl),this.view.viewport.from),r=[],n=this.gutters.map(s=>new Ca(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Pt.Text&&o){Pa(e,r,l.from);for(let a of n)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of n)a.widget(this.view,l)}else if(s.type==Pt.Text){Pa(e,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(i){let t=i.startState.facet(Dr),e=i.state.facet(Dr),r=i.docChanged||i.heightChanged||i.viewportChanged||!_.eq(i.startState.facet(Yl),i.state.facet(Yl),i.view.viewport.from,i.view.viewport.to);if(t==e)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of e){let o=t.indexOf(s);o<0?n.push(new qs(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==G.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Vu(i){return Array.isArray(i)?i:[i]}function Pa(i,t,e){for(;i.value&&i.from<=e;)i.from==e&&t.push(i.value),i.next()}var Ca=class{constructor(t,e,r){this.gutter=t,this.height=r,this.i=0,this.cursor=_.iter(t.markers,e.from)}addElement(t,e,r){let{gutter:n}=this,s=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==n.elements.length){let l=new Ds(t,o,s,r);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,o,s,r);this.height=e.bottom,this.i++}line(t,e,r){let n=[];Pa(this.cursor,n,e.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(t,e,n)}widget(t,e){let r=this.gutter.config.widgetMarker(t,e.widget,e);r&&this.addElement(t,e,[r])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}},qs=class{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutter\"+(this.config.class?\" \"+this.config.class:\"\");for(let r in e.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=n.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[r](t,l,n)&&n.preventDefault()});this.markers=Vu(e.markers(t)),e.initialSpacer&&(this.spacer=new Ds(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=\"visibility: hidden; pointer-events: none\")}update(t){let e=this.markers;if(this.markers=Vu(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}let r=t.view.viewport;return!_.eq(this.markers,e,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}},Ds=class{constructor(t,e,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutterElement\",this.update(t,e,r,n)}update(t,e,r,n){this.height!=e&&(this.height=e,this.dom.style.height=e+\"px\"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+\"px\":\"\"),cx(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let r=\"cm-gutterElement\",n=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,h)||o(l,a,h):o}return r}})}}),Br=class extends se{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}};function zl(i,t){return i.state.facet(Yi).formatNumber(t,i.state)}var dx=Dr.compute([Yi],i=>({class:\"cm-lineNumbers\",renderEmptyElements:!1,markers(t){return t.state.facet(ux)},lineMarker(t,e,r){return r.some(n=>n.toDOM)?null:new Br(zl(t,t.state.doc.lineAt(e.from).number))},widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Yi)!=t.state.facet(Yi),initialSpacer(t){return new Br(zl(t,Wu(t.state.doc.lines)))},updateSpacer(t,e){let r=zl(e.view,Wu(e.view.state.doc.lines));return r==t.number?t:new Br(r)},domEventHandlers:i.facet(Yi).domEventHandlers}));function ui(i={}){return[Yi.of(i),Yd(),dx]}function Wu(i){let t=9;for(;t{throw new Error(\"This node type doesn't define a deserialize function\")})}add(t){if(this.perNode)throw new RangeError(\"Can't add per-node props to node types\");return typeof t!=\"function\"&&(t=bt.match(t)),e=>{let r=t(e);return r===void 0?null:[this,r]}}};E.closedBy=new E({deserialize:i=>i.split(\" \")});E.openedBy=new E({deserialize:i=>i.split(\" \")});E.group=new E({deserialize:i=>i.split(\" \")});E.isolate=new E({deserialize:i=>{if(i&&i!=\"rtl\"&&i!=\"ltr\"&&i!=\"auto\")throw new RangeError(\"Invalid value for isolate: \"+i);return i||\"auto\"}});E.contextHash=new E({perNode:!0});E.lookAhead=new E({perNode:!0});E.mounted=new E({perNode:!0});var Fi=class{constructor(t,e,r){this.tree=t,this.overlay=e,this.parser=r}static get(t){return t&&t.props&&t.props[E.mounted.id]}},mx=Object.create(null),bt=class i{constructor(t,e,r,n=0){this.name=t,this.props=e,this.id=r,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):mx,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new i(t.name||\"\",e,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError(\"Can't store a per-node prop on a node type\");e[s[0].id]=s[1]}}return n}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t==\"string\"){if(this.name==t)return!0;let e=this.prop(E.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let r in t)for(let n of r.split(\" \"))e[n]=t[r];return r=>{for(let n=r.prop(E.group),s=-1;s<(n?n.length:0);s++){let o=e[s<0?r.name:n[s]];if(o)return o}}}};bt.none=new bt(\"\",Object.create(null),0,8);var Hr=class i{constructor(t){this.types=t;for(let e=0;e0;for(let a=this.cursor(o|st.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ya(bt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,r,n)=>new i(this.type,e,r,n,this.propValues),t.makeTree||((e,r,n)=>new i(bt.none,e,r,n)))}static build(t){return Ox(t)}};ot.empty=new ot(bt.none,[],[],0);var Xa=class i{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},_e=class i{constructor(t,e,r){this.buffer=t,this.length=e,this.set=r}get type(){return bt.none}toString(){let t=[];for(let e=0;e0));a=o[a+3]);return l}slice(t,e,r){let n=this.buffer,s=new Uint16Array(e-t),o=0;for(let l=t,a=0;l=t&&et;case 1:return e<=t&&r>t;case 2:return r>t;case 4:return!0}}function Ur(i,t,e,r){for(var n;i.from==i.to||(e<1?i.from>=t:i.from>t)||(e>-1?i.to<=t:i.to0?l.length:-1;t!=h;t+=e){let f=l[t],c=a[t]+o.from;if(_d(n,r,c,c+f.length)){if(f instanceof _e){if(s&st.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,e,r-c,n);if(u>-1)return new di(new Va(o,f,t,c),null,u)}else if(s&st.IncludeAnonymous||!f.type.isAnonymous||Na(f)){let u;if(!(s&st.IgnoreMounts)&&(u=Fi.get(f))&&!u.overlay)return new i(u.tree,c,t,o);let d=new i(f,c,t,o);return s&st.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(e<0?f.children.length-1:0,e,r,n)}}}if(s&st.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,r=0){let n;if(!(r&st.IgnoreOverlays)&&(n=Fi.get(this._tree))&&n.overlay){let s=t-this.from;for(let{from:o,to:l}of n.overlay)if((e>0?o<=s:o=s:l>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Zd(i,t,e,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(t)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function La(i,t,e=t.length-1){for(let r=i.parent;e>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[e]&&t[e]!=r.name)return!1;e--}}return!0}var Va=class{constructor(t,e,r,n){this.parent=t,this.buffer=e,this.index=r,this.start=n}},di=class i extends Ys{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,r){super(),this.context=t,this._parent=e,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,e,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,r);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,r=0){if(r&st.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new i(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new i(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];t.push(r.slice(n,s,o)),e.push(0)}return new ot(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Gd(i){if(!i.length)return null;let t=0,e=i[0];for(let s=1;se.from||o.to=t){let l=new jt(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(Ur(l,t,e,!1))}}return n?Gd(n):r}var jr=class{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof jt)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:r,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=r+n.buffer[t+1],this.to=r+n.buffer[t+2],!0}yield(t){return t?t instanceof jt?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,r=this.mode){return this.buffer?r&st.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,r=this.stack.length-1;if(t<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(r<0?e.buffer.length:e.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,r,{buffer:n}=this;if(n){if(t>0){if(this.index-1)for(let s=e+t,o=t<0?-1:r._tree.children.length;s!=o;s+=t){let l=r._tree.children[s];if(this.mode&st.IncludeAnonymous||l instanceof _e||!l.type.isAnonymous||Na(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,r=s+1;break t}n=this.stack[--s]}for(let n=r;n=0;s--){if(s<0)return La(this.node,t,n);let o=r[e.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};function Na(i){return i.children.some(t=>t instanceof _e||!t.type.isAnonymous||Na(t))}function Ox(i){var t;let{buffer:e,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,l=Array.isArray(e)?new Xa(e,e.length):e,a=r.types,h=0,f=0;function c(y,k,w,q,L,W){let{id:B,start:D,end:U,size:N}=l,nt=f;for(;N<0;)if(l.next(),N==-1){let ct=s[B];w.push(ct),q.push(D-y);return}else if(N==-3){h=B;return}else if(N==-4){f=B;return}else throw new RangeError(`Unrecognized record size: ${N}`);let Rt=a[B],Mt,Bt,Ft=D-y;if(U-D<=n&&(Bt=g(l.pos-k,L))){let ct=new Uint16Array(Bt.size-Bt.skip),_t=l.pos-Bt.size,de=ct.length;for(;l.pos>_t;)de=x(Bt.start,ct,de);Mt=new _e(ct,U-Bt.start,r),Ft=Bt.start-y}else{let ct=l.pos-N;l.next();let _t=[],de=[],ri=B>=o?B:-1,Ei=0,Un=U;for(;l.pos>ct;)ri>=0&&l.id==ri&&l.size>=0?(l.end<=Un-n&&(m(_t,de,D,Ei,l.end,Un,ri,nt),Ei=_t.length,Un=l.end),l.next()):W>2500?u(D,ct,_t,de):c(D,ct,_t,de,ri,W+1);if(ri>=0&&Ei>0&&Ei<_t.length&&m(_t,de,D,Ei,D,Un,ri,nt),_t.reverse(),de.reverse(),ri>-1&&Ei>0){let Mc=d(Rt);Mt=Ya(Rt,_t,de,0,_t.length,0,U-D,Mc,Mc)}else Mt=O(Rt,_t,de,U-D,nt-U)}w.push(Mt),q.push(Ft)}function u(y,k,w,q){let L=[],W=0,B=-1;for(;l.pos>k;){let{id:D,start:U,end:N,size:nt}=l;if(nt>4)l.next();else{if(B>-1&&U=0;N-=3)D[nt++]=L[N],D[nt++]=L[N+1]-U,D[nt++]=L[N+2]-U,D[nt++]=nt;w.push(new _e(D,L[2]-U,r)),q.push(U-y)}}function d(y){return(k,w,q)=>{let L=0,W=k.length-1,B,D;if(W>=0&&(B=k[W])instanceof ot){if(!W&&B.type==y&&B.length==q)return B;(D=B.prop(E.lookAhead))&&(L=w[W]+B.length+D)}return O(y,k,w,q,L)}}function m(y,k,w,q,L,W,B,D){let U=[],N=[];for(;y.length>q;)U.push(y.pop()),N.push(k.pop()+w-L);y.push(O(r.types[B],U,N,W-L,D-W)),k.push(L-w)}function O(y,k,w,q,L=0,W){if(h){let B=[E.contextHash,h];W=W?[B].concat(W):[B]}if(L>25){let B=[E.lookAhead,L];W=W?[B].concat(W):[B]}return new ot(y,k,w,q,W)}function g(y,k){let w=l.fork(),q=0,L=0,W=0,B=w.end-n,D={size:0,start:0,skip:0};t:for(let U=w.pos-y;w.pos>U;){let N=w.size;if(w.id==k&&N>=0){D.size=q,D.start=L,D.skip=W,W+=4,q+=4,w.next();continue}let nt=w.pos-N;if(N<0||nt=o?4:0,Mt=w.start;for(w.next();w.pos>nt;){if(w.size<0)if(w.size==-3)Rt+=4;else break t;else w.id>=o&&(Rt+=4);w.next()}L=Mt,q+=N,W+=Rt}return(k<0||q==y)&&(D.size=q,D.start=L,D.skip=W),D.size>4?D:void 0}function x(y,k,w){let{id:q,start:L,end:W,size:B}=l;if(l.next(),B>=0&&q4){let U=l.pos-(B-4);for(;l.pos>U;)w=x(y,k,w)}k[--w]=D,k[--w]=W-y,k[--w]=L-y,k[--w]=q}else B==-3?h=q:B==-4&&(f=q);return w}let S=[],C=[];for(;l.pos>0;)c(i.start||0,i.bufferStart||0,S,C,-1,0);let v=(t=i.length)!==null&&t!==void 0?t:S.length?C[0]+S[0].length:0;return new ot(a[i.topID],S.reverse(),C.reverse(),v)}var Fd=new WeakMap;function Ns(i,t){if(!i.isAnonymous||t instanceof _e||t.type!=i)return 1;let e=Fd.get(t);if(e==null){e=1;for(let r of t.children){if(r.type!=i||!(r instanceof ot)){e=1;break}e+=Ns(i,r)}Fd.set(t,e)}return e}function Ya(i,t,e,r,n,s,o,l,a){let h=0;for(let m=r;m=f)break;k+=w}if(C==v+1){if(k>f){let w=m[v];d(w.children,w.positions,0,w.children.length,O[v]+S);continue}c.push(m[v])}else{let w=O[C-1]+m[C-1].length-y;c.push(Ya(i,m,O,v,C,y,w,null,a))}u.push(y+S-s)}}return d(t,e,r,n,0),(l||a)(c,u,o)}var zs=class{constructor(){this.map=new WeakMap}setBuffer(t,e,r){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,r)}getBuffer(t,e){let r=this.map.get(t);return r&&r.get(e)}set(t,e){t instanceof di?this.setBuffer(t.context.buffer,t.index,e):t instanceof jt&&this.map.set(t.tree,e)}get(t){return t instanceof di?this.getBuffer(t.context.buffer,t.index):t instanceof jt?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},pi=class i{constructor(t,e,r,n,s=!1,o=!1){this.from=t,this.to=e,this.tree=r,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],r=!1){let n=[new i(0,t.length,t,0,!1,r)];for(let s of e)s.to>t.length&&n.push(s);return n}static applyChanges(t,e,r=128){if(!e.length)return t;let n=[],s=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let f=l=r)for(;o&&o.from=u.from||c<=u.to||h){let d=Math.max(u.from,a)-h,m=Math.min(u.to,c)-h;u=d>=m?null:new i(d,m,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=snew Gr(n.from,n.to)):[new Gr(0,0)]:[new Gr(0,t.length)],this.createParse(t,e||[],r)}parse(t,e,r){let n=this.startParse(t,e,r);for(;;){let s=n.advance();if(s)return s}}},Ia=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};var Dw=new E({perNode:!0});var xx=0,we=class i{constructor(t,e,r){this.set=t,this.base=e,this.modified=r,this.id=xx++}static define(t){if(t?.base)throw new Error(\"Can not derive from a modified tag\");let e=new i([],null,[]);if(e.set.push(e),t)for(let r of t.set)e.set.push(r);return e}static defineModifier(){let t=new Gs;return e=>e.modified.indexOf(t)>-1?e:Gs.get(e.base||e,e.modified.concat(t).sort((r,n)=>r.id-n.id))}},yx=0,Gs=class i{constructor(){this.instances=[],this.id=yx++}static get(t,e){if(!e.length)return t;let r=e[0].instances.find(l=>l.base==t&&bx(e,l.modified));if(r)return r;let n=[],s=new we(n,t,e);for(let l of e)l.instances.push(s);let o=Sx(e);for(let l of t.set)if(!l.modified.length)for(let a of o)n.push(i.get(l,a));return s}};function bx(i,t){return i.length==t.length&&i.every((e,r)=>e==t[r])}function Sx(i){let t=[[]];for(let e=0;er.length-e.length)}function Hs(i){let t=Object.create(null);for(let e in i){let r=i[e];Array.isArray(r)||(r=[r]);for(let n of e.split(\" \"))if(n){let s=[],o=2,l=n;for(let c=0;;){if(l==\"...\"&&c>0&&c+3==n.length){o=1;break}let u=/^\"(?:[^\"\\\\]|\\\\.)*?\"|[^\\/!]+/.exec(l);if(!u)throw new RangeError(\"Invalid path: \"+n);if(s.push(u[0]==\"*\"?\"\":u[0][0]=='\"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let d=n[c++];if(c==n.length&&d==\"!\"){o=0;break}if(d!=\"/\")throw new RangeError(\"Invalid path: \"+n);l=n.slice(c)}let a=s.length-1,h=s[a];if(!h)throw new RangeError(\"Invalid path: \"+n);let f=new Gi(r,o,a>0?s.slice(0,a):null);t[h]=f.sort(t[h])}}return jd.add(t)}var jd=new E,Gi=class{constructor(t,e,r,n){this.tags=t,this.mode=e,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=n;for(let l of s)for(let a of l.set){let h=e[a.id];if(h){o=o?o+\" \"+h:h;break}}return o},scope:r}}function wx(i,t){let e=null;for(let r of i){let n=r.style(t);n&&(e=e?e+\" \"+n:n)}return e}function Kd(i,t,e,r=0,n=i.length){let s=new Za(r,Array.isArray(t)?t:[t],e);s.highlightRange(i.cursor(),r,n,\"\",s.highlighters),s.flush(n)}var Za=class{constructor(t,e,r){this.at=t,this.highlighters=e,this.span=r,this.class=\"\"}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,r,n,s){let{type:o,from:l,to:a}=t;if(l>=r||a<=e)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,f=vx(t)||Gi.empty,c=wx(s,f.tags);if(c&&(h&&(h+=\" \"),h+=c,f.mode==1&&(n+=(n?\" \":\"\")+c)),this.startSpan(Math.max(e,l),h),f.opaque)return;let u=t.tree&&t.tree.prop(E.mounted);if(u&&u.overlay){let d=t.node.enter(u.overlay[0].from+l,1),m=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),O=t.firstChild();for(let g=0,x=l;;g++){let S=g=C||!t.nextSibling())););if(!S||C>r)break;x=S.to+l,x>e&&(this.highlightRange(d.cursor(),Math.max(e,S.from+l),Math.min(r,x),\"\",m),this.startSpan(Math.min(r,x),h))}O&&t.parent()}else if(t.firstChild()){u&&(n=\"\");do if(!(t.to<=e)){if(t.from>=r)break;this.highlightRange(t,e,r,n,s),this.startSpan(Math.min(r,t.to),h)}while(t.nextSibling());t.parent()}}};function vx(i){let t=i.type.prop(jd);for(;t&&t.context&&!i.matchContext(t.context);)t=t.next;return t||null}var P=we.define,Zs=P(),Ge=P(),Hd=P(Ge),Ud=P(Ge),He=P(),Fs=P(He),za=P(He),Se=P(),mi=P(Se),ye=P(),be=P(),Fa=P(),Kr=P(Fa),_s=P(),p={comment:Zs,lineComment:P(Zs),blockComment:P(Zs),docComment:P(Zs),name:Ge,variableName:P(Ge),typeName:Hd,tagName:P(Hd),propertyName:Ud,attributeName:P(Ud),className:P(Ge),labelName:P(Ge),namespace:P(Ge),macroName:P(Ge),literal:He,string:Fs,docString:P(Fs),character:P(Fs),attributeValue:P(Fs),number:za,integer:P(za),float:P(za),bool:P(He),regexp:P(He),escape:P(He),color:P(He),url:P(He),keyword:ye,self:P(ye),null:P(ye),atom:P(ye),unit:P(ye),modifier:P(ye),operatorKeyword:P(ye),controlKeyword:P(ye),definitionKeyword:P(ye),moduleKeyword:P(ye),operator:be,derefOperator:P(be),arithmeticOperator:P(be),logicOperator:P(be),bitwiseOperator:P(be),compareOperator:P(be),updateOperator:P(be),definitionOperator:P(be),typeOperator:P(be),controlOperator:P(be),punctuation:Fa,separator:P(Fa),bracket:Kr,angleBracket:P(Kr),squareBracket:P(Kr),paren:P(Kr),brace:P(Kr),content:Se,heading:mi,heading1:P(mi),heading2:P(mi),heading3:P(mi),heading4:P(mi),heading5:P(mi),heading6:P(mi),contentSeparator:P(Se),list:P(Se),quote:P(Se),emphasis:P(Se),strong:P(Se),link:P(Se),monospace:P(Se),strikethrough:P(Se),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:_s,documentMeta:P(_s),annotation:P(_s),processingInstruction:P(_s),definition:we.defineModifier(),constant:we.defineModifier(),function:we.defineModifier(),standard:we.defineModifier(),local:we.defineModifier(),special:we.defineModifier()},Lw=_a([{tag:p.link,class:\"tok-link\"},{tag:p.heading,class:\"tok-heading\"},{tag:p.emphasis,class:\"tok-emphasis\"},{tag:p.strong,class:\"tok-strong\"},{tag:p.keyword,class:\"tok-keyword\"},{tag:p.atom,class:\"tok-atom\"},{tag:p.bool,class:\"tok-bool\"},{tag:p.url,class:\"tok-url\"},{tag:p.labelName,class:\"tok-labelName\"},{tag:p.inserted,class:\"tok-inserted\"},{tag:p.deleted,class:\"tok-deleted\"},{tag:p.literal,class:\"tok-literal\"},{tag:p.string,class:\"tok-string\"},{tag:p.number,class:\"tok-number\"},{tag:[p.regexp,p.escape,p.special(p.string)],class:\"tok-string2\"},{tag:p.variableName,class:\"tok-variableName\"},{tag:p.local(p.variableName),class:\"tok-variableName tok-local\"},{tag:p.definition(p.variableName),class:\"tok-variableName tok-definition\"},{tag:p.special(p.variableName),class:\"tok-variableName2\"},{tag:p.definition(p.propertyName),class:\"tok-propertyName tok-definition\"},{tag:p.typeName,class:\"tok-typeName\"},{tag:p.namespace,class:\"tok-namespace\"},{tag:p.className,class:\"tok-className\"},{tag:p.macroName,class:\"tok-macroName\"},{tag:p.propertyName,class:\"tok-propertyName\"},{tag:p.operator,class:\"tok-operator\"},{tag:p.comment,class:\"tok-comment\"},{tag:p.meta,class:\"tok-meta\"},{tag:p.invalid,class:\"tok-invalid\"},{tag:p.punctuation,class:\"tok-punctuation\"}]);var Ga,Hi=new E;function kx(i){return A.define({combine:i?t=>t.concat(i):void 0})}var Tx=new E,Wt=class{constructor(t,e,r=[],n=\"\"){this.data=t,this.name=n,Y.prototype.hasOwnProperty(\"tree\")||Object.defineProperty(Y.prototype,\"tree\",{get(){return pt(this)}}),this.parser=e,this.extension=[Ui.of(this),Y.languageData.of((s,o,l)=>{let a=Jd(s,o,l),h=a.type.prop(Hi);if(!h)return[];let f=s.facet(h),c=a.type.prop(Tx);if(c){let u=a.resolve(o-a.from,l);for(let d of c)if(d.test(u,s)){let m=s.facet(d.facet);return d.type==\"replace\"?m:m.concat(f)}}return f})].concat(r)}isActiveAt(t,e,r=-1){return Jd(t,e,r).type.prop(Hi)==this.data}findRegions(t){let e=t.facet(Ui);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(Hi)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(E.mounted);if(l){if(l.tree.prop(Hi)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(n(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?e:void 0)]}),t.name)}configure(t,e){return new i(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function pt(i){let t=i.field(Wt.state,!1);return t?t.tree:ot.empty}var Ka=class{constructor(t){this.doc=t,this.cursorPos=0,this.string=\"\",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let r=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-r,e-r)}},Jr=null,Ja=class i{constructor(t,e,r=[],n,s,o,l,a){this.parser=t,this.state=e,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,r){return new i(t,e,[],ot.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Ka(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=ot.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t==\"number\"){let n=Date.now()+t;t=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(pi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Jr;Jr=this;try{return t()}finally{Jr=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=tp(t,e.from,e.to);return t}changes(t,e){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),r=pi.applyChanges(r,a),n=ot.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=t.mapPos(h.from,1),c=t.mapPos(h.to,-1);ft.from&&(this.fragments=tp(this.fragments,n,s),this.skipped.splice(r--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends _i{createParse(e,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let a=Jr;if(a){for(let h of n)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new ot(bt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Jr}};function tp(i,t,e){return pi.applyChanges(i,[{fromA:t,toA:e,fromB:t,toB:e}])}var tn=class i{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,r)||e.takeTree(),new i(e)}static init(t){let e=Math.min(3e3,t.doc.length),r=Ja.create(t.facet(Ui).parser,t,{from:0,to:e});return r.work(20,e)||r.takeTree(),new i(r)}};Wt.state=it.define({create:tn.init,update(i,t){for(let e of t.effects)if(e.is(Wt.setState))return e.value;return t.startState.facet(Ui)!=t.state.facet(Ui)?tn.init(t.state):i.apply(t)}});var sp=i=>{let t=setTimeout(()=>i(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<\"u\"&&(sp=i=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(i,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});var Ha=typeof navigator<\"u\"&&(!((Ga=navigator.scheduling)===null||Ga===void 0)&&Ga.isInputPending)?()=>navigator.scheduling.isInputPending():null,Px=ft.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Wt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=sp(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work(()=>Ha&&Ha()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Wt.setState.of(new tn(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Ct(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ui=A.define({combine(i){return i.length?i[0]:null},enables:i=>[Wt.state,Px,T.contentAttributes.compute([i],t=>{let e=t.facet(i);return e&&e.name?{\"data-language\":e.name}:{}})]}),js=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}};var Cx=A.define(),ke=A.define({combine:i=>{if(!i.length)return\" \";let t=i[0];if(!t||/\\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error(\"Invalid indent unit: \"+JSON.stringify(i[0]));return t}});function en(i){let t=i.facet(ke);return t.charCodeAt(0)==9?i.tabSize*t.length:t.length}function rn(i,t){let e=\"\",r=i.tabSize,n=i.facet(ke)[0];if(n==\"\t\"){for(;t>=r;)e+=\"\t\",t-=r;n=\" \"}for(let s=0;s=t?Ax(i,e,t):null}var gi=class{constructor(t,e={}){this.state=t,this.options=e,this.unit=en(t)}lineAt(t,e=1){let r=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=r.from&&n<=r.to?s&&n==t?{text:\"\",from:t}:(e<0?n-1&&(s+=o-this.countColumn(r,r.search(/\\S|$/))),s}countColumn(t,e=t.length){return We(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:r,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(r,r.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},lh=new E;function Ax(i,t,e){let r=t.resolveStack(e),n=r.node.enterUnfinishedNodesBefore(e);if(n!=r.node){let s=[];for(let o=n;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return op(r,i,e)}function op(i,t,e){for(let r=i;r;r=r.next){let n=Rx(r.node);if(n)return n(th.create(t,e,r))}return 0}function Qx(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function Rx(i){let t=i.type.prop(lh);if(t)return t;let e=i.firstChild,r;if(e&&(r=e.type.prop(E.closedBy))){let n=i.lastChild,s=n&&r.indexOf(n.name)>-1;return o=>lp(o,!0,1,void 0,s&&!Qx(o)?n.from:void 0)}return i.parent==null?Mx:null}function Mx(){return 0}var th=class i extends gi{constructor(t,e,r){super(t.state,t.options),this.base=t,this.pos=e,this.context=r}get node(){return this.context.node}static create(t,e,r){return new i(t,e,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(e.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Ex(r,t))break;e=this.state.doc.lineAt(r.from)}return this.lineIndent(e.from)}continue(){return op(this.context.next,this.base,this.pos)}};function Ex(i,t){for(let e=t;e;e=e.parent)if(i==e)return!0;return!1}function $x(i){let t=i.node,e=t.childAfter(t.from),r=t.lastChild;if(!e)return null;let n=i.options.simulateBreak,s=i.state.doc.lineAt(e.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let l=e.to;;){let a=t.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.fromlp(r,t,e,i)}function lp(i,t,e,r,n){let s=i.textAfter,o=s.match(/^\\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||n==i.pos+o,a=t?$x(i):null;return a?l?i.column(a.from):i.column(a.to):i.baseIndent+(l?0:i.unit*e)}var qx=A.define(),ah=new E;function ap(i){let t=i.firstChild,e=i.lastChild;return t&&t.toe)continue;if(s&&l.from=t&&h.to>e&&(s=h)}}return s}function Bx(i){let t=i.lastChild;return t&&t.to==i.to&&t.type.isError}function hp(i,t,e){for(let r of i.facet(qx)){let n=r(i,t,e);if(n)return n}return Dx(i,t,e)}function fp(i,t){let e=t.mapPos(i.from,1),r=t.mapPos(i.to,-1);return e>=r?void 0:{from:e,to:r}}var hh=M.define({map:fp}),Js=M.define({map:fp});function cp(i){let t=[];for(let{head:e}of i.state.selection.ranges)t.some(r=>r.from<=e&&r.to>=e)||t.push(i.lineBlockAt(e));return t}var nn=it.define({create(){return R.none},update(i,t){i=i.map(t.changes);for(let e of t.effects)if(e.is(hh)&&!Xx(i,e.value.from,e.value.to)){let{preparePlaceholder:r}=t.state.facet(fh),n=r?R.replace({widget:new eh(r(t.state,e.value))}):ep;i=i.update({add:[n.range(e.value.from,e.value.to)]})}else e.is(Js)&&(i=i.update({filter:(r,n)=>e.value.from!=r||e.value.to!=n,filterFrom:e.value.from,filterTo:e.value.to}));if(t.selection){let e=!1,{head:r}=t.selection.main;i.between(r,r,(n,s)=>{nr&&(e=!0)}),e&&(i=i.update({filterFrom:r,filterTo:r,filter:(n,s)=>s<=r||n>=r}))}return i},provide:i=>T.decorations.from(i),toJSON(i,t){let e=[];return i.between(0,t.doc.length,(r,n)=>{e.push(r,n)}),e},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError(\"Invalid JSON for fold state\");let t=[];for(let e=0;e{(!n||n.from>s)&&(n={from:s,to:o})}),n}function Xx(i,t,e){let r=!1;return i.between(t,t,(n,s)=>{n==t&&s==e&&(r=!0)}),r}function dp(i,t){return i.field(nn,!1)?t:t.concat(M.appendConfig.of(Yx()))}var Lx=i=>{for(let t of cp(i)){let e=hp(i.state,t.from,t.to);if(e)return i.dispatch({effects:dp(i.state,[hh.of(e),pp(i,e)])}),!0}return!1},Vx=i=>{if(!i.state.field(nn,!1))return!1;let t=[];for(let e of cp(i)){let r=up(i.state,e.from,e.to);r&&t.push(Js.of(r),pp(i,r,!1))}return t.length&&i.dispatch({effects:t}),t.length>0};function pp(i,t,e=!0){let r=i.state.doc.lineAt(t.from).number,n=i.state.doc.lineAt(t.to).number;return T.announce.of(`${i.state.phrase(e?\"Folded lines\":\"Unfolded lines\")} ${r} ${i.state.phrase(\"to\")} ${n}.`)}var Wx=i=>{let{state:t}=i,e=[];for(let r=0;r{let t=i.state.field(nn,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,i.state.doc.length,(r,n)=>{e.push(Js.of({from:r,to:n}))}),i.dispatch({effects:e}),!0};var to=[{key:\"Ctrl-Shift-[\",mac:\"Cmd-Alt-[\",run:Lx},{key:\"Ctrl-Shift-]\",mac:\"Cmd-Alt-]\",run:Vx},{key:\"Ctrl-Alt-[\",run:Wx},{key:\"Ctrl-Alt-]\",run:Ix}],Nx={placeholderDOM:null,preparePlaceholder:null,placeholderText:\"\\u2026\"},fh=A.define({combine(i){return kt(i,Nx)}});function Yx(i){let t=[nn,zx];return i&&t.push(fh.of(i)),t}function mp(i,t){let{state:e}=i,r=e.facet(fh),n=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=up(i.state,l.from,l.to);a&&i.dispatch({effects:Js.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,t);let s=document.createElement(\"span\");return s.textContent=r.placeholderText,s.setAttribute(\"aria-label\",e.phrase(\"folded code\")),s.title=e.phrase(\"unfold\"),s.className=\"cm-foldPlaceholder\",s.onclick=n,s}var ep=R.replace({widget:new class extends Ut{toDOM(i){return mp(i,null)}}}),eh=class extends Ut{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return mp(t,this.value)}};var zx=T.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\"}}),ve=class i{constructor(t,e){this.specs=t;let r;function n(l){let a=Gt.newName();return(r||(r=Object.create(null)))[\".\"+a]=l,a}let s=typeof e.all==\"string\"?e.all:e.all?n(e.all):void 0,o=e.scope;this.scope=o instanceof Wt?l=>l.prop(Hi)==o.data:o?l=>l==o:void 0,this.style=_a(t.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Gt(r):null,this.themeType=e.themeType}static define(t,e){return new i(t,e||{})}},ih=A.define(),gp=A.define({combine(i){return i.length?[i[0]]:null}});function Ua(i){let t=i.facet(ih);return t.length?t:i.facet(gp)}function Te(i,t){let e=[Zx],r;return i instanceof ve&&(i.module&&e.push(T.styleModule.of(i.module)),r=i.themeType),t?.fallback?e.push(gp.of(i)):r?e.push(ih.computeN([T.darkTheme],n=>n.facet(T.darkTheme)==(r==\"dark\")?[i]:[])):e.push(ih.of(i)),e}var rh=class{constructor(t){this.markCache=Object.create(null),this.tree=pt(t.state),this.decorations=this.buildDeco(t,Ua(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=pt(t.state),r=Ua(t.state),n=r!=Ua(t.startState),{viewport:s}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return R.none;let r=new Ee;for(let{from:n,to:s}of t.visibleRanges)Kd(this.tree,e,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},n,s);return r.finish()}},Zx=ie.high(ft.fromClass(rh,{decorations:i=>i.decorations})),eo=ve.define([{tag:p.meta,color:\"#404740\"},{tag:p.link,textDecoration:\"underline\"},{tag:p.heading,textDecoration:\"underline\",fontWeight:\"bold\"},{tag:p.emphasis,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\"},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.keyword,color:\"#708\"},{tag:[p.atom,p.bool,p.url,p.contentSeparator,p.labelName],color:\"#219\"},{tag:[p.literal,p.inserted],color:\"#164\"},{tag:[p.string,p.deleted],color:\"#a11\"},{tag:[p.regexp,p.escape,p.special(p.string)],color:\"#e40\"},{tag:p.definition(p.variableName),color:\"#00f\"},{tag:p.local(p.variableName),color:\"#30a\"},{tag:[p.typeName,p.namespace],color:\"#085\"},{tag:p.className,color:\"#167\"},{tag:[p.special(p.variableName),p.macroName],color:\"#256\"},{tag:p.definition(p.propertyName),color:\"#00c\"},{tag:p.comment,color:\"#940\"},{tag:p.invalid,color:\"#f00\"}]),Fx=T.baseTheme({\"&.cm-focused .cm-matchingBracket\":{backgroundColor:\"#328c8252\"},\"&.cm-focused .cm-nonmatchingBracket\":{backgroundColor:\"#bb555544\"}}),Op=1e4,xp=\"()[]{}\",yp=A.define({combine(i){return kt(i,{afterCursor:!0,brackets:xp,maxScanDistance:Op,renderMatch:Hx})}}),_x=R.mark({class:\"cm-matchingBracket\"}),Gx=R.mark({class:\"cm-nonmatchingBracket\"});function Hx(i){let t=[],e=i.matched?_x:Gx;return t.push(e.range(i.start.from,i.start.to)),i.end&&t.push(e.range(i.end.from,i.end.to)),t}var Ux=it.define({create(){return R.none},update(i,t){if(!t.docChanged&&!t.selection)return i;let e=[],r=t.state.facet(yp);for(let n of t.state.selection.ranges){if(!n.empty)continue;let s=oe(t.state,n.head,-1,r)||n.head>0&&oe(t.state,n.head-1,1,r)||r.afterCursor&&(oe(t.state,n.head,1,r)||n.headT.decorations.from(i)}),jx=[Ux,Fx];function io(i={}){return[yp.of(i),jx]}var Kx=new E;function nh(i,t,e){let r=i.prop(t<0?E.openedBy:E.closedBy);if(r)return r;if(i.name.length==1){let n=e.indexOf(i.name);if(n>-1&&n%2==(t<0?1:0))return[e[n+t]]}return null}function sh(i){let t=i.type.prop(Kx);return t?t(i.node):i}function oe(i,t,e,r={}){let n=r.maxScanDistance||Op,s=r.brackets||xp,o=pt(i),l=o.resolveInner(t,e);for(let a=l;a;a=a.parent){let h=nh(a.type,e,s);if(h&&a.from0?t>=f.from&&tf.from&&t<=f.to))return Jx(i,t,e,a,f,h,s)}}return t1(i,t,e,o,l.type,n,s)}function Jx(i,t,e,r,n,s,o){let l=r.parent,a={from:n.from,to:n.to},h=0,f=l?.cursor();if(f&&(e<0?f.childBefore(r.from):f.childAfter(r.to)))do if(e<0?f.to<=r.from:f.from>=r.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:e<0?t-1:t,to:e>0?t+1:t},f=i.doc.iterRange(t,e>0?i.doc.length:0),c=0;for(let u=0;!f.next().done&&u<=s;){let d=f.value;e<0&&(u+=d.length);let m=t+u*e;for(let O=e>0?0:d.length-1,g=e>0?d.length:-1;O!=g;O+=e){let x=o.indexOf(d[O]);if(!(x<0||r.resolveInner(m+O,1).type!=n))if(x%2==0==e>0)c++;else{if(c==1)return{start:h,end:{from:m+O,to:m+O+1},matched:x>>1==a>>1};c--}}e>0&&(u+=d.length)}return f.done?{start:h,matched:!1}:null}var e1=Object.create(null),ip=[bt.none];var rp=[],np=Object.create(null),i1=Object.create(null);for(let[i,t]of[[\"variable\",\"variableName\"],[\"variable-2\",\"variableName.special\"],[\"string-2\",\"string.special\"],[\"def\",\"variableName.definition\"],[\"tag\",\"tagName\"],[\"attribute\",\"attributeName\"],[\"type\",\"typeName\"],[\"builtin\",\"variableName.standard\"],[\"qualifier\",\"modifier\"],[\"error\",\"invalid\"],[\"header\",\"heading\"],[\"property\",\"propertyName\"]])i1[i]=r1(e1,t);function ja(i,t){rp.indexOf(i)>-1||(rp.push(i),console.warn(t))}function r1(i,t){let e=[];for(let l of t.split(\" \")){let a=[];for(let h of l.split(\".\")){let f=i[h]||p[h];f?typeof f==\"function\"?a.length?a=a.map(f):ja(h,`Modifier ${h} used at start of tag`):a.length?ja(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:ja(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let r=t.replace(/ /g,\"_\"),n=r+\" \"+e.map(l=>l.id),s=np[n];if(s)return s.id;let o=np[n]=bt.define({id:ip.length,name:r,props:[Hs({[r]:e})]});return ip.push(o),o.id}var Fw={rtl:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"rtl\"},bidiIsolate:G.RTL}),ltr:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"ltr\"},bidiIsolate:G.LTR}),auto:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"auto\"},bidiIsolate:null})};var no=class{constructor(t,e,r){this.state=t,this.pos=e,this.explicit=r,this.abortListeners=[]}tokenBefore(t){let e=pt(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),r=Math.max(e.from,this.pos-250),n=e.text.slice(r-e.from,this.pos-e.from),s=n.search(Qp(t,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,e){t==\"abort\"&&this.abortListeners&&this.abortListeners.push(e)}};function bp(i){let t=Object.keys(i).join(\"\"),e=/\\w/.test(t);return e&&(t=t.replace(/\\w/g,\"\")),`[${e?\"\\\\w\":\"\"}${t.replace(/[^\\w\\s]/g,\"\\\\$&\")}]`}function n1(i){let t=Object.create(null),e=Object.create(null);for(let{label:n}of i){t[n[0]]=!0;for(let s=1;stypeof n==\"string\"?{label:n}:n),[e,r]=t.every(n=>/^\\w+$/.test(n.label))?[/\\w*$/,/\\w+$/]:n1(t);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:t,validFor:e}:null}}function Ap(i,t){return e=>{for(let r=pt(e.state).resolveInner(e.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(e)}}var so=class{constructor(t,e,r,n){this.completion=t,this.source=e,this.match=r,this.score=n}};function Ue(i){return i.selection.main.from}function Qp(i,t){var e;let{source:r}=i,n=t&&r[0]!=\"^\",s=r[r.length-1]!=\"$\";return!n&&!s?i:new RegExp(`${n?\"^\":\"\"}(?:${r})${s?\"$\":\"\"}`,(e=i.flags)!==null&&e!==void 0?e:i.ignoreCase?\"i\":\"\")}var Rp=Et.define();function s1(i,t,e,r){let{main:n}=i.selection,s=e-n.from,o=r-n.from;return Object.assign(Object.assign({},i.changeByRange(l=>l!=n&&e!=r&&i.sliceDoc(l.from+s,l.from+o)!=i.sliceDoc(e,r)?{range:l}:{changes:{from:l.from+s,to:r==n.from?l.to:l.from+o,insert:t},range:b.cursor(l.from+s+t.length)})),{scrollIntoView:!0,userEvent:\"input.complete\"})}var Sp=new WeakMap;function o1(i){if(!Array.isArray(i))return i;let t=Sp.get(i);return t||Sp.set(i,t=wh(i)),t}var oo=M.define(),sn=M.define(),dh=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&y<=57||y>=97&&y<=122?2:y>=65&&y<=90?1:0:(k=vr(y))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!S||w==1&&g||v==0&&w!=0)&&(e[c]==y||r[c]==y&&(u=!0)?o[c++]=S:o.length&&(x=!1)),v=w,S+=wt(y)}return c==a&&o[0]==0&&x?this.result(-100+(u?-200:0),o,t):d==a&&m==0?this.ret(-200-t.length+(O==t.length?0:-100),[0,O]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):d==a?this.ret(-900-t.length,[m,O]):c==a?this.result(-100+(u?-200:0)+-700+(x?0:-1100),o,t):e.length==2?!1:this.result((n[0]?-700:0)+-200+-1100,n,t)}result(t,e,r){let n=[],s=0;for(let o of e){let l=o+(this.astral?wt(dt(r,o)):1);s&&n[s-1]==o?n[s-1]=l:(n[s++]=o,n[s++]=l)}return this.ret(t-r.length,n)}},gt=A.define({combine(i){return kt(i,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>\"\",optionClass:()=>\"\",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:l1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>r=>wp(t(r),e(r)),optionClass:(t,e)=>r=>wp(t(r),e(r)),addToOptions:(t,e)=>t.concat(e)})}});function wp(i,t){return i?t?i+\" \"+t:i:t}function l1(i,t,e,r,n,s){let o=i.textDirection==G.RTL,l=o,a=!1,h=\"top\",f,c,u=t.left-n.left,d=n.right-t.right,m=r.right-r.left,O=r.bottom-r.top;if(l&&u=O||S>t.top?f=e.bottom-t.top:(h=\"bottom\",f=t.bottom-e.top)}let g=(t.bottom-t.top)/s.offsetHeight,x=(t.right-t.left)/s.offsetWidth;return{style:`${h}: ${f/g}px; max-width: ${c/x}px`,class:\"cm-completionInfo-\"+(a?o?\"left-narrow\":\"right-narrow\":l?\"left\":\"right\")}}function a1(i){let t=i.addToOptions.slice();return i.icons&&t.push({render(e){let r=document.createElement(\"div\");return r.classList.add(\"cm-completionIcon\"),e.type&&r.classList.add(...e.type.split(/\\s+/g).map(n=>\"cm-completionIcon-\"+n)),r.setAttribute(\"aria-hidden\",\"true\"),r},position:20}),t.push({render(e,r,n,s){let o=document.createElement(\"span\");o.className=\"cm-completionLabel\";let l=e.displayLabel||e.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,f)));let u=o.appendChild(document.createElement(\"span\"));u.appendChild(document.createTextNode(l.slice(f,c))),u.className=\"cm-completionMatchedText\",a=c}return ae.position-r.position).map(e=>e.render)}function ch(i,t,e){if(i<=e)return{from:0,to:i};if(t<0&&(t=0),t<=i>>1){let n=Math.floor(t/e);return{from:n*e,to:(n+1)*e}}let r=Math.floor((i-t)/e);return{from:i-(r+1)*e,to:i-r*e}}var ph=class{constructor(t,e,r){this.view=t,this.stateField=e,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass=\"\";let n=t.state.field(e),{options:s,selected:o}=n.open,l=t.state.facet(gt);this.optionContent=a1(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ch(s.length,o,l.maxRenderedOptions),this.dom=document.createElement(\"div\"),this.dom.className=\"cm-tooltip-autocomplete\",this.updateTooltipClass(t.state),this.dom.addEventListener(\"mousedown\",a=>{let{options:h}=t.state.field(e).open;for(let f=a.target,c;f&&f!=this.dom;f=f.parentNode)if(f.nodeName==\"LI\"&&(c=/-(\\d+)$/.exec(f.id))&&+c[1]{let h=t.state.field(this.stateField,!1);h&&h.tooltip&&t.state.facet(gt).closeOnBlur&&a.relatedTarget!=t.contentDOM&&t.dispatch({effects:sn.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener(\"scroll\",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let r=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=n){let{options:s,selected:o,disabled:l}=r.open;(!n.open||n.open.options!=s)&&(this.range=ch(s.length,o,t.state.facet(gt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((e=n.open)===null||e===void 0?void 0:e.disabled)&&this.dom.classList.toggle(\"cm-tooltip-autocomplete-disabled\",!!l)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let r of this.currentClass.split(\" \"))r&&this.dom.classList.remove(r);for(let r of e.split(\" \"))r&&this.dom.classList.add(r);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ch(e.options.length,e.selected,this.view.state.facet(gt).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:r}=e.options[e.selected],{info:n}=r;if(!n)return;let s=typeof n==\"string\"?document.createTextNode(n):n(r);if(!s)return;\"then\"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,r)}).catch(o=>Ct(this.view.state,o,\"completion info\")):this.addInfoPane(s,r)}}addInfoPane(t,e){this.destroyInfo();let r=this.info=document.createElement(\"div\");if(r.className=\"cm-tooltip cm-completionInfo\",t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:n,destroy:s}=t;r.appendChild(n),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!=\"LI\"||!r.id?n--:n==t?r.hasAttribute(\"aria-selected\")||(r.setAttribute(\"aria-selected\",\"true\"),e=r):r.hasAttribute(\"aria-selected\")&&r.removeAttribute(\"aria-selected\");return e&&f1(this.list,e),e}measureInfo(){let t=this.dom.querySelector(\"[aria-selected]\");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomr.from||r.from==0))if(s=u,typeof h!=\"string\"&&h.header)n.appendChild(h.header(h));else{let d=n.appendChild(document.createElement(\"completion-section\"));d.textContent=u}}let f=n.appendChild(document.createElement(\"li\"));f.id=e+\"-\"+o,f.setAttribute(\"role\",\"option\");let c=this.optionClass(l);c&&(f.className=c);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&f.appendChild(d)}}return r.from&&n.classList.add(\"cm-completionListIncompleteTop\"),r.tonew ph(e,i,t)}function f1(i,t){let e=i.getBoundingClientRect(),r=t.getBoundingClientRect(),n=e.height/i.offsetHeight;r.tope.bottom&&(i.scrollTop+=(r.bottom-e.bottom)/n)}function vp(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function c1(i,t){let e=[],r=null,n=a=>{e.push(a);let{section:h}=a.completion;if(h){r||(r=[]);let f=typeof h==\"string\"?h:h.name;r.some(c=>c.name==f)||r.push(typeof h==\"string\"?{name:f}:h)}};for(let a of i)if(a.hasResult()){let h=a.result.getMatch;if(a.result.filter===!1)for(let f of a.result.options)n(new so(f,a.source,h?h(f):[],1e9-e.length));else{let f=new dh(t.sliceDoc(a.from,a.to));for(let c of a.result.options)if(f.match(c.label)){let u=c.displayLabel?h?h(c,f.matched):[]:f.matched;n(new so(c,a.source,u,f.score+(c.boost||0)))}}}if(r){let a=Object.create(null),h=0,f=(c,u)=>{var d,m;return((d=c.rank)!==null&&d!==void 0?d:1e9)-((m=u.rank)!==null&&m!==void 0?m:1e9)||(c.namef.score-h.score||l(h.completion,f.completion))){let h=a.completion;!o||o.label!=h.label||o.detail!=h.detail||o.type!=null&&h.type!=null&&o.type!=h.type||o.apply!=h.apply||o.boost!=h.boost?s.push(a):vp(a.completion)>vp(o)&&(s[s.length-1]=a),o=a.completion}return s}var mh=class i{constructor(t,e,r,n,s,o){this.options=t,this.attrs=e,this.tooltip=r,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new i(this.options,kp(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,r,n,s){let o=c1(t,e);if(!o.length)return n&&t.some(a=>a.state==1)?new i(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let l=e.facet(gt).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let a=n.options[n.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:g1,above:s.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(t){return new i(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},gh=class i{constructor(t,e,r){this.active=t,this.id=e,this.open=r}static start(){return new i(p1,\"cm-ac-\"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,r=e.facet(gt),s=(r.override||e.languageDataAt(\"autocomplete\",Ue(e)).map(o1)).map(l=>(this.active.find(h=>h.source==l)||new De(l,this.active.some(h=>h.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&t.docChanged&&(o=o.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!u1(s,this.active)?o=mh.build(s,e,this.id,o,r):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new De(l.source,0):l));for(let l of t.effects)l.is(Ep)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new i(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:d1}};function u1(i,t){if(i==t)return!0;for(let e=0,r=0;;){for(;e-1&&(e[\"aria-activedescendant\"]=i+\"-\"+t),e}var p1=[];function Oh(i){return i.isUserEvent(\"input.type\")?\"input\":i.isUserEvent(\"delete.backward\")?\"delete\":null}var De=class i{constructor(t,e,r=-1){this.source=t,this.state=e,this.explicitPos=r}hasResult(){return!1}update(t,e){let r=Oh(t),n=this;r?n=n.handleUserEvent(t,r,e):t.docChanged?n=n.handleChange(t):t.selection&&n.state!=0&&(n=new i(n.source,0));for(let s of t.effects)if(s.is(oo))n=new i(n.source,1,s.value?Ue(t.state):-1);else if(s.is(sn))n=new i(n.source,0);else if(s.is(Mp))for(let o of s.value)o.source==n.source&&(n=o);return n}handleUserEvent(t,e,r){return e==\"delete\"||!r.activateOnTyping?this.map(t.changes):new i(this.source,1)}handleChange(t){return t.changes.touchesRange(Ue(t.startState))?new i(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new i(this.source,this.state,t.mapPos(this.explicitPos))}},lo=class i extends De{constructor(t,e,r,n,s){super(t,2,e),this.result=r,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,r){var n;let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=Ue(t.state);if((this.explicitPos<0?l<=s:lo||e==\"delete\"&&Ue(t.startState)==this.from)return new De(this.source,e==\"input\"&&r.activateOnTyping?1:0);let a=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos),h;return m1(this.result.validFor,t.state,s,o)?new i(this.source,a,this.result,s,o):this.result.update&&(h=this.result.update(this.result,s,o,new no(t.state,l,a>=0)))?new i(this.source,a,h,h.from,(n=h.to)!==null&&n!==void 0?n:Ue(t.state)):new De(this.source,1,a)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new De(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new i(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}};function m1(i,t,e,r){if(!i)return!1;let n=t.sliceDoc(e,r);return typeof i==\"function\"?i(n,e,r,t):Qp(i,!0).test(n)}var Mp=M.define({map(i,t){return i.map(e=>e.map(t))}}),Ep=M.define(),It=it.define({create(){return gh.start()},update(i,t){return i.update(t)},provide:i=>[Fr.from(i,t=>t.tooltip),T.contentAttributes.from(i,t=>t.attrs)]});function $p(i,t){let e=t.completion.apply||t.completion.label,r=i.state.field(It).active.find(n=>n.source==t.source);return r instanceof lo?(typeof e==\"string\"?i.dispatch(Object.assign(Object.assign({},s1(i.state,e,r.from,r.to)),{annotations:Rp.of(t.completion)})):e(i,t.completion,r.from,r.to),!0):!1}var g1=h1(It,$p);function ro(i,t=\"option\"){return e=>{let r=e.state.field(It,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+n*(i?1:-1):i?0:o-1;return l<0?l=t==\"page\"?0:o-1:l>=o&&(l=t==\"page\"?o-1:0),e.dispatch({effects:Ep.of(l)}),!0}}var O1=i=>{let t=i.state.field(It,!1);return i.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampi.state.field(It,!1)?(i.dispatch({effects:oo.of(!0)}),!0):!1,y1=i=>{let t=i.state.field(It,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(i.dispatch({effects:sn.of(null)}),!0)},xh=class{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}},b1=50,S1=1e3,w1=ft.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of i.state.field(It).active)t.state==1&&this.startQuery(t)}update(i){let t=i.state.field(It);if(!i.selectionSet&&!i.docChanged&&i.startState.field(It)==t)return;let e=i.transactions.some(n=>(n.selection||n.docChanged)&&!Oh(n));for(let n=0;nb1&&Date.now()-s.time>S1){for(let o of s.context.abortListeners)try{o()}catch(l){Ct(this.view.state,l)}s.context.abortListeners=null,this.running.splice(n--,1)}else s.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(n=>n.effects.some(s=>s.is(oo)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.state.facet(gt).activateOnTypingDelay;if(this.debounceUpdate=t.active.some(n=>n.state==1&&!this.running.some(s=>s.active.source==n.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let n of i.transactions)Oh(n)==\"input\"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,t=i.field(It);for(let e of t.active)e.state==1&&!this.running.some(r=>r.active.source==e.source)&&this.startQuery(e)}startQuery(i){let{state:t}=this.view,e=Ue(t),r=new no(t,e,i.explicitPos==e),n=new xh(i,r);this.running.push(n),Promise.resolve(i.source(r)).then(s=>{n.context.aborted||(n.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:sn.of(null)}),Ct(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gt).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(gt);for(let r=0;ro.source==n.active.source);if(s&&s.state==1)if(n.done==null){let o=new De(n.active.source,0);for(let l of n.updates)o=o.update(l,e);o.state!=1&&t.push(o)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:Mp.of(t)})}},{eventHandlers:{blur(i){let t=this.view.state.field(It,!1);if(t&&t.tooltip&&this.view.state.facet(gt).closeOnBlur){let e=t.open&&Ba(this.view,t.open.tooltip);(!e||!e.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:sn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:oo.of(!1)}),20),this.composing=0}}}),qp=T.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:\"400px\",boxSizing:\"border-box\"},\".cm-completionInfo.cm-completionInfo-left\":{right:\"100%\"},\".cm-completionInfo.cm-completionInfo-right\":{left:\"100%\"},\".cm-completionInfo.cm-completionInfo-left-narrow\":{right:\"30px\"},\".cm-completionInfo.cm-completionInfo-right-narrow\":{left:\"30px\"},\"&light .cm-snippetField\":{backgroundColor:\"#00000022\"},\"&dark .cm-snippetField\":{backgroundColor:\"#ffffff22\"},\".cm-snippetFieldPosition\":{verticalAlign:\"text-top\",width:0,height:\"1.15em\",display:\"inline-block\",margin:\"0 -0.7px -.7em\",borderLeft:\"1.4px dotted #888\"},\".cm-completionMatchedText\":{textDecoration:\"underline\"},\".cm-completionDetail\":{marginLeft:\"0.5em\",fontStyle:\"italic\"},\".cm-completionIcon\":{fontSize:\"90%\",width:\".8em\",display:\"inline-block\",textAlign:\"center\",paddingRight:\".6em\",opacity:\"0.6\",boxSizing:\"content-box\"},\".cm-completionIcon-function, .cm-completionIcon-method\":{\"&:after\":{content:\"'\\u0192'\"}},\".cm-completionIcon-class\":{\"&:after\":{content:\"'\\u25CB'\"}},\".cm-completionIcon-interface\":{\"&:after\":{content:\"'\\u25CC'\"}},\".cm-completionIcon-variable\":{\"&:after\":{content:\"'\\u{1D465}'\"}},\".cm-completionIcon-constant\":{\"&:after\":{content:\"'\\u{1D436}'\"}},\".cm-completionIcon-type\":{\"&:after\":{content:\"'\\u{1D461}'\"}},\".cm-completionIcon-enum\":{\"&:after\":{content:\"'\\u222A'\"}},\".cm-completionIcon-property\":{\"&:after\":{content:\"'\\u25A1'\"}},\".cm-completionIcon-keyword\":{\"&:after\":{content:\"'\\u{1F511}\\uFE0E'\"}},\".cm-completionIcon-namespace\":{\"&:after\":{content:\"'\\u25A2'\"}},\".cm-completionIcon-text\":{\"&:after\":{content:\"'abc'\",fontSize:\"50%\",verticalAlign:\"middle\"}}}),yh=class{constructor(t,e,r,n){this.field=t,this.line=e,this.from=r,this.to=n}},bh=class i{constructor(t,e,r){this.field=t,this.from=e,this.to=r}map(t){let e=t.mapPos(this.from,-1,ut.TrackDel),r=t.mapPos(this.to,1,ut.TrackDel);return e==null||r==null?null:new i(this.field,e,r)}},Sh=class i{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let r=[],n=[e],s=t.doc.lineAt(e),o=/^\\s*/.exec(s.text)[0];for(let a of this.lines){if(r.length){let h=o,f=/^\\t*/.exec(a)[0].length;for(let c=0;cnew bh(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:r,ranges:l}}static parse(t){let e=[],r=[],n=[],s;for(let o of t.split(/\\r\\n?|\\n/)){for(;s=/[#$]\\{(?:(\\d+)(?::([^}]*))?|([^}]*))\\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||\"\",h=-1;for(let f=0;f=h&&c.field++}n.push(new yh(h,r.length,s.index,s.index+a.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}for(let l;l=/\\\\([{}])/.exec(o);){o=o.slice(0,l.index)+l[1]+o.slice(l.index+l[0].length);for(let a of n)a.line==r.length&&a.from>l.index&&(a.from--,a.to--)}r.push(o)}return new i(r,n)}},v1=R.widget({widget:new class extends Ut{toDOM(){let i=document.createElement(\"span\");return i.className=\"cm-snippetFieldPosition\",i}ignoreEvent(){return!1}}}),k1=R.mark({class:\"cm-snippetField\"}),ji=class i{constructor(t,e){this.ranges=t,this.active=e,this.deco=R.set(t.map(r=>(r.from==r.to?v1:k1).range(r.from,r.to)))}map(t){let e=[];for(let r of this.ranges){let n=r.map(t);if(!n)return null;e.push(n)}return new i(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(r=>r.field==this.active&&r.from<=e.from&&r.to>=e.to))}},an=M.define({map(i,t){return i&&i.map(t)}}),T1=M.define(),on=it.define({create(){return null},update(i,t){for(let e of t.effects){if(e.is(an))return e.value;if(e.is(T1)&&i)return new ji(i.ranges,e.value)}return i&&t.docChanged&&(i=i.map(t.changes)),i&&t.selection&&!i.selectionInsideField(t.selection)&&(i=null),i},provide:i=>T.decorations.from(i,t=>t?t.deco:R.none)});function vh(i,t){return b.create(i.filter(e=>e.field==t).map(e=>b.range(e.from,e.to)))}function P1(i){let t=Sh.parse(i);return(e,r,n,s)=>{let{text:o,ranges:l}=t.instantiate(e.state,n),a={changes:{from:n,to:s,insert:V.of(o)},scrollIntoView:!0,annotations:r?[Rp.of(r),lt.userEvent.of(\"input.complete\")]:void 0};if(l.length&&(a.selection=vh(l,0)),l.some(h=>h.field>0)){let h=new ji(l,0),f=a.effects=[an.of(h)];e.state.field(on,!1)===void 0&&f.push(M.appendConfig.of([on,M1,E1,qp]))}e.dispatch(e.state.update(a))}}function Dp(i){return({state:t,dispatch:e})=>{let r=t.field(on,!1);if(!r||i<0&&r.active==0)return!1;let n=r.active+i,s=i>0&&!r.ranges.some(o=>o.field==n+i);return e(t.update({selection:vh(r.ranges,n),effects:an.of(s?null:new ji(r.ranges,n)),scrollIntoView:!0})),!0}}var C1=({state:i,dispatch:t})=>i.field(on,!1)?(t(i.update({effects:an.of(null)})),!0):!1,A1=Dp(1),Q1=Dp(-1);var R1=[{key:\"Tab\",run:A1,shift:Q1},{key:\"Escape\",run:C1}],Tp=A.define({combine(i){return i.length?i[0]:R1}}),M1=ie.highest(Fe.compute([Tp],i=>i.facet(Tp)));function Pe(i,t){return Object.assign(Object.assign({},t),{apply:P1(i)})}var E1=T.domEventHandlers({mousedown(i,t){let e=t.state.field(on,!1),r;if(!e||(r=t.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let n=e.ranges.find(s=>s.from<=r&&s.to>=r);return!n||n.field==e.active?!1:(t.dispatch({selection:vh(e.ranges,n.field),effects:an.of(e.ranges.some(s=>s.field>n.field)?new ji(e.ranges,n.field):null),scrollIntoView:!0}),!0)}});var ln={brackets:[\"(\",\"[\",\"{\",\"'\",'\"'],before:\")]}:;>\",stringPrefixes:[]},Oi=M.define({map(i,t){let e=t.mapPos(i,-1,ut.TrackAfter);return e??void 0}}),kh=new class extends ee{};kh.startSide=1;kh.endSide=-1;var Bp=it.define({create(){return _.empty},update(i,t){if(i=i.map(t.changes),t.selection){let e=t.state.doc.lineAt(t.selection.main.head);i=i.update({filter:r=>r>=e.from&&r<=e.to})}for(let e of t.effects)e.is(Oi)&&(i=i.update({add:[kh.range(e.value,e.value+1)]}));return i}});function ao(){return[q1,Bp]}var uh=\"()[]{}<>\";function Xp(i){for(let t=0;t{if(($1?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let n=i.state.selection.main;if(r.length>2||r.length==2&&wt(dt(r,0))==1||t!=n.from||e!=n.to)return!1;let s=B1(i.state,r);return s?(i.dispatch(s),!0):!1}),D1=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let r=Lp(i,i.selection.main.head).brackets||ln.brackets,n=null,s=i.changeByRange(o=>{if(o.empty){let l=X1(i.doc,o.head);for(let a of r)if(a==l&&fo(i.doc,o.head)==Xp(dt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:n=o}});return n||t(i.update(s,{scrollIntoView:!0,userEvent:\"delete.backward\"})),!n},ho=[{key:\"Backspace\",run:D1}];function B1(i,t){let e=Lp(i,i.selection.main.head),r=e.brackets||ln.brackets;for(let n of r){let s=Xp(dt(n,0));if(t==n)return s==n?W1(i,n,r.indexOf(n+n+n)>-1,e):L1(i,n,s,e.before||ln.before);if(t==s&&Vp(i,i.selection.main.from))return V1(i,n,s)}return null}function Vp(i,t){let e=!1;return i.field(Bp).between(0,i.doc.length,r=>{r==t&&(e=!0)}),e}function fo(i,t){let e=i.sliceString(t,t+2);return e.slice(0,wt(dt(e,0)))}function X1(i,t){let e=i.sliceString(t-2,t);return wt(dt(e,0))==e.length?e:e.slice(1)}function L1(i,t,e,r){let n=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:e,from:o.to}],effects:Oi.of(o.to+t.length),range:b.range(o.anchor+t.length,o.head+t.length)};let l=fo(i.doc,o.head);return!l||/\\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+e,from:o.head},effects:Oi.of(o.head+t.length),range:b.cursor(o.head+t.length)}:{range:n=o}});return n?null:i.update(s,{scrollIntoView:!0,userEvent:\"input.type\"})}function V1(i,t,e){let r=null,n=i.changeByRange(s=>s.empty&&fo(i.doc,s.head)==e?{changes:{from:s.head,to:s.head+e.length,insert:e},range:b.cursor(s.head+e.length)}:r={range:s});return r?null:i.update(n,{scrollIntoView:!0,userEvent:\"input.type\"})}function W1(i,t,e,r){let n=r.stringPrefixes||ln.stringPrefixes,s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Oi.of(l.to+t.length),range:b.range(l.anchor+t.length,l.head+t.length)};let a=l.head,h=fo(i.doc,a),f;if(h==t){if(Pp(i,a))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(Vp(i,a)){let u=e&&i.sliceDoc(a,a+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(e&&i.sliceDoc(a-2*t.length,a)==t+t&&(f=Cp(i,a-2*t.length,n))>-1&&Pp(i,f))return{changes:{insert:t+t+t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(i.charCategorizer(a)(h)!=F.Word&&Cp(i,a,n)>-1&&!I1(i,a,t,n))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)}}return{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:\"input.type\"})}function Pp(i,t){let e=pt(i).resolveInner(t+1);return e.parent&&e.from==t}function I1(i,t,e,r){let n=pt(i).resolveInner(t,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(n.from,Math.min(n.to,n.from+e.length+s)),a=l.indexOf(e);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let f=n.firstChild;for(;f&&f.from==n.from&&f.to-f.from>e.length+a;){if(i.sliceDoc(f.to-e.length,f.to)==e)return!1;f=f.firstChild}return!0}let h=n.to==t&&n.parent;if(!h)break;n=h}return!1}function Cp(i,t,e){let r=i.charCategorizer(t);if(r(i.sliceDoc(t-1,t))!=F.Word)return t;for(let n of e){let s=t-n.length;if(i.sliceDoc(s,t)==n&&r(i.sliceDoc(s-1,s))!=F.Word)return s}return-1}function co(i={}){return[It,gt.of(i),w1,N1,qp]}var hn=[{key:\"Ctrl-Space\",run:x1},{key:\"Escape\",run:y1},{key:\"ArrowDown\",run:ro(!0)},{key:\"ArrowUp\",run:ro(!1)},{key:\"PageDown\",run:ro(!0,\"page\")},{key:\"PageUp\",run:ro(!1,\"page\")},{key:\"Enter\",run:O1}],N1=ie.highest(Fe.computeN([gt],i=>i.facet(gt).defaultKeymap?[hn]:[]));var Y1=i=>{let{state:t}=i,e=t.doc.lineAt(t.selection.main.from),r=Mh(i.state,e.from);return r.line?z1(i):r.block?F1(i):!1};function Rh(i,t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=i(t,e);return n?(r(e.update(n)),!0):!1}}var z1=Rh(H1,0);var Z1=Rh(_p,0);var F1=Rh((i,t)=>_p(i,t,G1(t)),0);function Mh(i,t){let e=i.languageDataAt(\"commentTokens\",t);return e.length?e[0]:{}}var fn=50;function _1(i,{open:t,close:e},r,n){let s=i.sliceDoc(r-fn,r),o=i.sliceDoc(n,n+fn),l=/\\s*$/.exec(s)[0].length,a=/^\\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-t.length,h)==t&&o.slice(a,a+e.length)==e)return{open:{pos:r-l,margin:l&&1},close:{pos:n+a,margin:a&&1}};let f,c;n-r<=2*fn?f=c=i.sliceDoc(r,n):(f=i.sliceDoc(r,r+fn),c=i.sliceDoc(n-fn,n));let u=/^\\s*/.exec(f)[0].length,d=/\\s*$/.exec(c)[0].length,m=c.length-d-e.length;return f.slice(u,u+t.length)==t&&c.slice(m,m+e.length)==e?{open:{pos:r+u+t.length,margin:/\\s/.test(f.charAt(u+t.length))?1:0},close:{pos:n-d-e.length,margin:/\\s/.test(c.charAt(m-1))?1:0}}:null}function G1(i){let t=[];for(let e of i.selection.ranges){let r=i.doc.lineAt(e.from),n=e.to<=r.to?r:i.doc.lineAt(e.to),s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=n.to:t.push({from:r.from+/^\\s*/.exec(r.text)[0].length,to:n.to})}return t}function _p(i,t,e=t.selection.ranges){let r=e.map(s=>Mh(t,s.from).block);if(!r.every(s=>s))return null;let n=e.map((s,o)=>_1(t,r[o],s.from,s.to));if(i!=2&&!n.every(s=>s))return{changes:t.changes(e.map((s,o)=>n[o]?[]:[{from:s.from,insert:r[o].open+\" \"},{from:s.to,insert:\" \"+r[o].close}]))};if(i!=1&&n.some(s=>s)){let s=[];for(let o=0,l;on&&(s==o||o>c.from)){n=c.from;let u=/^\\s*/.exec(c.text)[0].length,d=u==c.length,m=c.text.slice(u,u+h.length)==h?u:-1;us.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:f,single:c}of r)(c||!f)&&s.push({from:l.from+h,insert:a+\" \"});let o=t.changes(s);return{changes:o,selection:t.selection.map(o,1)}}else if(i!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let h=o.from+l,f=h+a.length;o.text[f-o.from]==\" \"&&f++,s.push({from:h,to:f})}return{changes:s}}return null}var Ph=Et.define(),U1=Et.define(),j1=A.define(),Gp=A.define({combine(i){return kt(i,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(r,n)=>t(r,n)||e(r,n)})}}),Hp=it.define({create(){return xi.empty},update(i,t){let e=t.state.facet(Gp),r=t.annotation(Ph);if(r){let a=le.fromTransaction(t,r.selection),h=r.side,f=h==0?i.undone:i.done;return a?f=po(f,f.length,e.minDepth,a):f=Kp(f,t.startState.selection),new xi(h==0?r.rest:f,h==0?f:r.rest)}let n=t.annotation(U1);if((n==\"full\"||n==\"before\")&&(i=i.isolate()),t.annotation(lt.addToHistory)===!1)return t.changes.empty?i:i.addMapping(t.changes.desc);let s=le.fromTransaction(t),o=t.annotation(lt.time),l=t.annotation(lt.userEvent);return s?i=i.addChanges(s,o,l,e,t):t.selection&&(i=i.addSelection(t.startState.selection,o,l,e.newGroupDelay)),(n==\"full\"||n==\"after\")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(t=>t.toJSON()),undone:i.undone.map(t=>t.toJSON())}},fromJSON(i){return new xi(i.done.map(le.fromJSON),i.undone.map(le.fromJSON))}});function mo(i={}){return[Hp,Gp.of(i),T.domEventHandlers({beforeinput(t,e){let r=t.inputType==\"historyUndo\"?Up:t.inputType==\"historyRedo\"?Ch:null;return r?(t.preventDefault(),r(e)):!1}})]}function go(i,t){return function({state:e,dispatch:r}){if(!t&&e.readOnly)return!1;let n=e.field(Hp,!1);if(!n)return!1;let s=n.pop(i,e,t);return s?(r(s),!0):!1}}var Up=go(0,!1),Ch=go(1,!1),K1=go(0,!0),J1=go(1,!0);var le=class i{constructor(t,e,r,n,s){this.changes=t,this.effects=e,this.mapped=r,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new i(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(t){return new i(t.changes&&vt.fromJSON(t.changes),[],t.mapped&&Me.fromJSON(t.mapped),t.startSelection&&b.fromJSON(t.startSelection),t.selectionsAfter.map(b.fromJSON))}static fromTransaction(t,e){let r=Kt;for(let n of t.startState.facet(j1)){let s=n(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new i(t.changes.invert(t.startState.doc),r,void 0,e||t.startState.selection,Kt)}static selection(t){return new i(void 0,Kt,void 0,void 0,t)}};function po(i,t,e,r){let n=t+1>e+20?t-e-1:0,s=i.slice(n,t);return s.push(r),s}function ty(i,t){let e=[],r=!1;return i.iterChangedRanges((n,s)=>e.push(n,s)),t.iterChangedRanges((n,s,o,l)=>{for(let a=0;a=h&&o<=f&&(r=!0)}}),r}function ey(i,t){return i.ranges.length==t.ranges.length&&i.ranges.filter((e,r)=>e.empty!=t.ranges[r].empty).length===0}function jp(i,t){return i.length?t.length?i.concat(t):i:t}var Kt=[],iy=200;function Kp(i,t){if(i.length){let e=i[i.length-1],r=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-iy));return r.length&&r[r.length-1].eq(t)?i:(r.push(t),po(i,i.length-1,1e9,e.setSelAfter(r)))}else return[le.selection([t])]}function ry(i){let t=i[i.length-1],e=i.slice();return e[i.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function Th(i,t){if(!i.length)return i;let e=i.length,r=Kt;for(;e;){let n=ny(i[e-1],t,r);if(n.changes&&!n.changes.empty||n.effects.length){let s=i.slice(0,e);return s[e-1]=n,s}else t=n.mapped,e--,r=n.selectionsAfter}return r.length?[le.selection(r)]:Kt}function ny(i,t,e){let r=jp(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(t)):Kt,e);if(!i.changes)return le.selection(r);let n=i.changes.map(t),s=t.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new le(n,M.mapEffects(i.effects,t),o,i.startSelection.map(s),r)}var sy=/^(input\\.type|delete)($|\\.)/,xi=class i{constructor(t,e,r=0,n=void 0){this.done=t,this.undone=e,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(t,e,r,n,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||sy.test(r))&&(!l.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee.empty?i.moveByChar(e,t):xo(e,t))}function St(i){return i.textDirectionAt(i.state.selection.main.head)==G.LTR}var tm=i=>Jp(i,!St(i)),em=i=>Jp(i,St(i));function im(i,t){return ae(i,e=>e.empty?i.moveByGroup(e,t):xo(e,t))}var oy=i=>im(i,!St(i)),ly=i=>im(i,St(i));var lv=typeof Intl<\"u\"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:\"word\"}):null;function ay(i,t,e){if(t.type.prop(e))return!0;let r=t.to-t.from;return r&&(r>2||/[^\\s,.;:]/.test(i.sliceDoc(t.from,t.to)))||t.firstChild}function yo(i,t,e){let r=pt(i).resolveInner(t.head),n=e?E.closedBy:E.openedBy;for(let a=t.head;;){let h=e?r.childAfter(a):r.childBefore(a);if(!h)break;ay(i,h,n)?r=h:a=e?h.to:h.from}let s=r.type.prop(n),o,l;return s&&(o=e?oe(i,r.from,1):oe(i,r.to,-1))&&o.matched?l=e?o.end.to:o.end.from:l=e?r.to:r.from,b.cursor(l,e?-1:1)}var hy=i=>ae(i,t=>yo(i.state,t,!St(i))),fy=i=>ae(i,t=>yo(i.state,t,St(i)));function rm(i,t){return ae(i,e=>{if(!e.empty)return xo(e,t);let r=i.moveVertically(e,t);return r.head!=e.head?r:i.moveToLineBoundary(e,t)})}var nm=i=>rm(i,!1),sm=i=>rm(i,!0);function om(i){let t=i.scrollDOM.clientHeighto.empty?i.moveVertically(o,t,e.height):xo(o,t));if(n.eq(r.selection))return!1;let s;if(e.selfScroll){let o=i.coordsAtPos(r.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+e.marginTop,h=l.bottom-e.marginBottom;o&&o.top>a&&o.bottomlm(i,!1),Ah=i=>lm(i,!0);function je(i,t,e){let r=i.lineBlockAt(t.head),n=i.moveToLineBoundary(t,e);if(n.head==t.head&&n.head!=(e?r.to:r.from)&&(n=i.moveToLineBoundary(t,e,!1)),!e&&n.head==r.from&&r.length){let s=/^\\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(n=b.cursor(r.from+s))}return n}var cy=i=>ae(i,t=>je(i,t,!0)),uy=i=>ae(i,t=>je(i,t,!1)),dy=i=>ae(i,t=>je(i,t,!St(i))),py=i=>ae(i,t=>je(i,t,St(i))),my=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).from,1)),gy=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).to,-1));function Oy(i,t,e){let r=!1,n=Ki(i.selection,s=>{let o=oe(i,s.head,-1)||oe(i,s.head,1)||s.head>0&&oe(i,s.head-1,1)||s.headOy(i,t,!1);function Jt(i,t){let e=Ki(i.state.selection,r=>{let n=t(r);return b.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return e.eq(i.state.selection)?!1:(i.dispatch(Ce(i.state,e)),!0)}function am(i,t){return Jt(i,e=>i.moveByChar(e,t))}var hm=i=>am(i,!St(i)),fm=i=>am(i,St(i));function cm(i,t){return Jt(i,e=>i.moveByGroup(e,t))}var yy=i=>cm(i,!St(i)),by=i=>cm(i,St(i));var Sy=i=>Jt(i,t=>yo(i.state,t,!St(i))),wy=i=>Jt(i,t=>yo(i.state,t,St(i)));function um(i,t){return Jt(i,e=>i.moveVertically(e,t))}var dm=i=>um(i,!1),pm=i=>um(i,!0);function mm(i,t){return Jt(i,e=>i.moveVertically(e,t,om(i).height))}var Ip=i=>mm(i,!1),Np=i=>mm(i,!0),vy=i=>Jt(i,t=>je(i,t,!0)),ky=i=>Jt(i,t=>je(i,t,!1)),Ty=i=>Jt(i,t=>je(i,t,!St(i))),Py=i=>Jt(i,t=>je(i,t,St(i))),Cy=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).from)),Ay=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).to)),Yp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:0})),!0),zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.doc.length})),!0),Zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:0})),!0),Fp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Qy=({state:i,dispatch:t})=>(t(i.update({selection:{anchor:0,head:i.doc.length},userEvent:\"select\"})),!0),Ry=({state:i,dispatch:t})=>{let e=bo(i).map(({from:r,to:n})=>b.range(r,Math.min(n+1,i.doc.length)));return t(i.update({selection:b.create(e),userEvent:\"select\"})),!0},My=({state:i,dispatch:t})=>{let e=Ki(i.selection,r=>{var n;let s=pt(i).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&(!((n=l.parent)===null||n===void 0)&&n.parent))return b.range(l.to,l.from)}return r});return t(Ce(i,e)),!0},Ey=({state:i,dispatch:t})=>{let e=i.selection,r=null;return e.ranges.length>1?r=b.create([e.main]):e.main.empty||(r=b.create([b.cursor(e.main.head)])),r?(t(Ce(i,r)),!0):!1};function cn(i,t){if(i.state.readOnly)return!1;let e=\"delete.selection\",{state:r}=i,n=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=t(s);ao&&(e=\"delete.forward\",a=uo(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=uo(i,o,!1),l=uo(i,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:b.cursor(o,on(i)))r.between(t,t,(n,s)=>{nt&&(t=e?s:n)});return t}var gm=(i,t)=>cn(i,e=>{let r=e.from,{state:n}=i,s=n.doc.lineAt(r),o,l;if(!t&&r>s.from&&rgm(i,!1),Om=i=>gm(i,!0),xm=(i,t)=>cn(i,e=>{let r=e.head,{state:n}=i,s=n.doc.lineAt(r),o=n.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==e.head&&s.number!=(t?n.doc.lines:1)&&(r+=t?1:-1);break}let a=at(s.text,r-s.from,t)+s.from,h=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),f=o(h);if(l!=null&&f!=l)break;(h!=\" \"||r!=e.head)&&(l=f),r=a}return r}),ym=i=>xm(i,!1),$y=i=>xm(i,!0),qy=i=>cn(i,t=>{let e=i.lineBlockAt(t.head).to;return t.headcn(i,t=>{let e=i.moveToLineBoundary(t,!1).head;return t.head>e?e:Math.max(0,t.head-1)}),By=i=>cn(i,t=>{let e=i.moveToLineBoundary(t,!0).head;return t.head{if(i.readOnly)return!1;let e=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:V.of([\"\",\"\"])},range:b.cursor(r.from)}));return t(i.update(e,{scrollIntoView:!0,userEvent:\"input\"})),!0},Ly=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let n=r.from,s=i.doc.lineAt(n),o=n==s.from?n-1:at(s.text,n-s.from,!1)+s.from,l=n==s.to?n+1:at(s.text,n-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:i.doc.slice(n,l).append(i.doc.slice(o,n))},range:b.cursor(l)}});return e.changes.empty?!1:(t(i.update(e,{scrollIntoView:!0,userEvent:\"move.character\"})),!0)};function bo(i){let t=[],e=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.from),s=i.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=i.doc.lineAt(r.to-1)),e>=n.number){let o=t[t.length-1];o.to=s.to,o.ranges.push(r)}else t.push({from:n.from,to:s.to,ranges:[r]});e=s.number+1}return t}function bm(i,t,e){if(i.readOnly)return!1;let r=[],n=[];for(let s of bo(i)){if(e?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(e?s.to+1:s.from-1),l=o.length+1;if(e){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let a of s.ranges)n.push(b.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let a of s.ranges)n.push(b.range(a.anchor-l,a.head-l))}}return r.length?(t(i.update({changes:r,scrollIntoView:!0,selection:b.create(n,i.selection.mainIndex),userEvent:\"move.line\"})),!0):!1}var Vy=({state:i,dispatch:t})=>bm(i,t,!1),Wy=({state:i,dispatch:t})=>bm(i,t,!0);function Sm(i,t,e){if(i.readOnly)return!1;let r=[];for(let n of bo(i))e?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});return t(i.update({changes:r,scrollIntoView:!0,userEvent:\"input.copyline\"})),!0}var Iy=({state:i,dispatch:t})=>Sm(i,t,!1),Ny=({state:i,dispatch:t})=>Sm(i,t,!0),Yy=i=>{if(i.state.readOnly)return!1;let{state:t}=i,e=t.changes(bo(t).map(({from:n,to:s})=>(n>0?n--:si.moveVertically(n,!0)).map(e);return i.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:\"delete.line\"}),!0};function zy(i,t){if(/\\(\\)|\\[\\]|\\{\\}/.test(i.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=pt(i).resolveInner(t),r=e.childBefore(t),n=e.childAfter(t),s;return r&&n&&r.to<=t&&n.from>=t&&(s=r.type.prop(E.closedBy))&&s.indexOf(n.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(n.from).from&&!/\\S/.test(i.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var Zy=wm(!1),Fy=wm(!0);function wm(i){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:s,to:o}=n,l=t.doc.lineAt(s),a=!i&&s==o&&zy(t,s);i&&(s=o=(o<=l.to?l:t.doc.lineAt(o)).to);let h=new gi(t,{simulateBreak:s,simulateDoubleBreak:!!a}),f=oh(h,s);for(f==null&&(f=We(/^\\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));ol.from&&s{let n=[];for(let o=r.from;o<=r.to;){let l=i.doc.lineAt(o);l.number>e&&(r.empty||r.to>l.from)&&(t(l,n,r),e=l.number),o=l.to+1}let s=i.changes(n);return{changes:n,range:b.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var _y=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=Object.create(null),r=new gi(i,{overrideIndentation:s=>{let o=e[s];return o??-1}}),n=Eh(i,(s,o,l)=>{let a=oh(r,s.from);if(a==null)return;/\\S/.test(s.text)||(a=0);let h=/^\\s*/.exec(s.text)[0],f=rn(i,a);(h!=f||l.fromi.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{r.push({from:e.from,insert:i.facet(ke)})}),{userEvent:\"input.indent\"})),!0),Hy=({state:i,dispatch:t})=>i.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{let n=/^\\s*/.exec(e.text)[0];if(!n)return;let s=We(n,i.tabSize),o=0,l=rn(i,Math.max(0,s-en(i)));for(;o({mac:i.key,run:i.run,shift:i.shift}))),So=[{key:\"Alt-ArrowLeft\",mac:\"Ctrl-ArrowLeft\",run:hy,shift:Sy},{key:\"Alt-ArrowRight\",mac:\"Ctrl-ArrowRight\",run:fy,shift:wy},{key:\"Alt-ArrowUp\",run:Vy},{key:\"Shift-Alt-ArrowUp\",run:Iy},{key:\"Alt-ArrowDown\",run:Wy},{key:\"Shift-Alt-ArrowDown\",run:Ny},{key:\"Escape\",run:Ey},{key:\"Mod-Enter\",run:Fy},{key:\"Alt-l\",mac:\"Ctrl-l\",run:Ry},{key:\"Mod-i\",run:My,preventDefault:!0},{key:\"Mod-[\",run:Hy},{key:\"Mod-]\",run:Gy},{key:\"Mod-Alt-\\\\\",run:_y},{key:\"Shift-Mod-k\",run:Yy},{key:\"Shift-Mod-\\\\\",run:xy},{key:\"Mod-/\",run:Y1},{key:\"Alt-A\",run:Z1}].concat(jy);var Dh=class i{constructor(t,e,r,n,s,o,l,a,h,f=0,c){this.p=t,this.stack=e,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=f,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?\"!\"+this.score:\"\"}`}static start(t,e,r=0){let n=t.parser.context;return new i(t,[],e,r,r,0,[],0,n?new wo(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let r=t>>19,n=t&65535,{parser:s}=this.p,o=s.dynamicPrecedence(n);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(!((e=this.p.parser.nodeSet.types[n])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,r,n=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(e==r)return;if(o.buffer[l-2]>=e){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(t,e,r,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(t,e,r,n){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=n,this.shiftContext(e,r),e<=this.p.parser.maxNode&&this.buffer.push(e,r,n,4);else{let s=t,{parser:o}=this.p;(n>this.pos||e<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,r),this.shiftContext(e,r),e<=o.maxNode&&this.buffer.push(e,r,n,4)}}apply(t,e,r,n){t&65536?this.reduce(t):this.shift(t,e,r,n)}useNode(t,e){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let r=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,r?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Bh(this);;){let r=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(r==0)return!1;if(!(r&65536))return!0;e.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let s=0,o;sa&1&&l==o)||n.push(e[s],o)}e=n}let r=[];for(let n=0;n>19,n=e&65535,s=this.stack.length-r*3;if(s<0||t.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],r=(n,s)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&t.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},wo=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},Bh=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,r=t>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},Xh=class i{constructor(t,e,r){this.stack=t,this.pos=e,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new i(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function un(i,t=Uint16Array){if(typeof i!=\"string\")return i;let e=null;for(let r=0,n=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}e?e[n++]=s:e=new t(s)}return e}var Ji=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},vm=new Ji,Lh=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk=\"\",this.chunkOff=0,this.chunk2=\"\",this.chunk2Pos=0,this.next=-1,this.token=vm,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let r=this.range,n=this.rangeIndex,s=this.pos+t;for(;sr.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=o}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,r,n;if(e>=0&&e=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(t,e=0){let r=e?this.resolveOffset(e,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=\"\",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=vm,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let r=\"\";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(r+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return r}},Ke=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:r}=e.p;Am(this.data,t,e,this.id,r.data,r.tokenPrecTable)}};Ke.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var Vh=class{constructor(t,e,r){this.precTable=e,this.elseToken=r,this.data=typeof t==\"string\"?un(t):t}token(t,e){let r=t.pos,n=0;for(;;){let s=t.next<0,o=t.resolveOffset(1,1);if(Am(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(r,t.token),t.acceptToken(this.elseToken,n))}};Vh.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var yi=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};function Am(i,t,e,r,n,s){let o=0,l=1<0){let m=i[d];if(a.allows(m)&&(t.token.value==-1||t.token.value==m||Jy(m,t.token.value,n,s))){t.acceptToken(m);break}}let f=t.next,c=0,u=i[o+2];if(t.next<0&&u>c&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue t}for(;c>1,m=h+d+(d<<1),O=i[m],g=i[m+1]||65536;if(f=g)c=d+1;else{o=i[m+2],t.advance();continue t}}break}}function km(i,t,e){for(let r=t,n;(n=i[r])!=65535;r++)if(n==e)return r-t;return-1}function Jy(i,t,e,r){let n=km(e,r,t);return n<0||km(e,r,i)t)&&!r.type.isError)return e<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(i.length,Math.max(r.from+1,t+25));if(e<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return e<0?0:i.length}}var Wh=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Tm(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Tm(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(s instanceof ot){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+s.length}}},Ih=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new Ji)}getActions(t){let e=0,r=null,{parser:n}=t.p,{tokenizers:s}=n,o=n.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,a=0;for(let h=0;hc.end+25&&(a=Math.max(c.lookAhead,a)),c.value!=0)){let u=e;if(c.extended>-1&&(e=this.addActions(t,c.extended,c.end,e)),e=this.addActions(t,c.value,c.end,e),!f.extend&&(r=c,e>u))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),!r&&t.pos==this.stream.end&&(r=new Ji,r.value=t.p.parser.eofTerm,r.start=r.end=t.pos,e=this.addActions(t,r.value,r.end,e)),this.mainToken=r,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ji,{pos:r,p:n}=t;return e.start=r,e.end=Math.min(r+1,n.stream.end),e.value=r==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,r){let n=this.stream.clipPos(r.pos);if(e.token(this.stream.reset(n,t),r),t.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,r,n){for(let s=0;st.bufferLength*4?new Wh(r,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,r=this.stacks=[],n,s;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oe)r.push(l);else{if(this.advanceStack(l,r,t))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=n&&tb(n);if(o)return Nt&&console.log(\"Finish with \"+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Nt&&n&&console.log(\"Stuck with token \"+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):\"none\")),new SyntaxError(\"No parse at \"+e);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Nt&&console.log(\"Force-finish \"+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>e)&&this.recovering--}else if(r.length>1){t:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue t}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o \":\"\";if(this.stoppedAt!=null&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,f=h?t.curContext.hash:0;for(let c=this.fragments.nodeAt(n);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(t.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(E.contextHash)||0)==f))return t.useNode(c,u),Nt&&console.log(o+this.stackID(t)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof ot)||c.children.length==0||c.positions[0]>0)break;let d=c.children[0];if(d instanceof ot&&c.positions[0]==0)c=d;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Nt&&console.log(o+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let h=0;hn?e.push(m):r.push(m)}return!1}advanceFully(t,e){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return Pm(t,e),!0}}runRecovery(t,e,r){let n=null,s=!1;for(let o=0;o \":\"\";if(l.deadEnd&&(s||(s=!0,l.restart(),Nt&&console.log(f+this.stackID(l)+\" (restarted)\"),this.advanceFully(l,r))))continue;let c=l.split(),u=f;for(let d=0;c.forceReduce()&&d<10&&(Nt&&console.log(u+this.stackID(c)+\" (via force-reduce)\"),!this.advanceFully(c,r));d++)Nt&&(u=this.stackID(c)+\" -> \");for(let d of l.recoverByInsert(a))Nt&&console.log(f+this.stackID(d)+\" (via recover-insert)\"),this.advanceFully(d,r);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Nt&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Pm(l,r)):(!n||n.scorei,vo=class{constructor(t){this.start=t.start,this.shift=t.shift||qh,this.reduce=t.reduce||qh,this.reuse=t.reuse||qh,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},ko=class i extends _i{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(\" \");this.minRepeatTerm=e.length;for(let l=0;lt.topRules[l][1]),n=[];for(let l=0;l=0)s(f,a,l[h++]);else{let c=l[h+-f];for(let u=-f;u>0;u--)s(l[h++],a,c);h++}}}this.nodeSet=new Hr(e.map((l,a)=>bt.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:r.indexOf(a)>-1,error:a==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(a)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=un(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l==\"number\"?new Ke(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,r){let n=new Nh(this,t,e,r);for(let s of this.wrappers)n=s(n,t,e,r);return n}getGoto(t,e,r=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&r)return a;for(let h=s+(o>>1);s0}validAction(t,e){return!!this.allActions(t,r=>r==e?!0:null)}allActions(t,e){let r=this.stateSlot(t,4),n=r?e(r):void 0;for(let s=this.stateSlot(t,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Be(this.data,s+2);else break;n=e(Be(this.data,s+1))}return n}nextStates(t){let e=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Be(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];e.some((s,o)=>o&1&&s==n)||e.push(this.data[r],n)}}return e}configure(t){let e=Object.assign(Object.create(i.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=r}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(r=>{let n=t.tokenizers.find(s=>s.from==r);return n?n.to:r})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=t.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return e.specializers[n]=Cm(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),r=e.map(()=>!1);if(t)for(let s of t.split(\" \")){let o=e.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;sr)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorei.external(e,r)<<1|t}return i.get}var eb=1,Mm=206,Em=207,ib=208,Qm=209,rb=210,nb=211,sb=212,ob=2,lb=213,ab=214,hb=3,fb=215,cb=216,ub=4,db=217,pb=218,mb=5,gb=219,Ob=26,xb=27,yb=51,bb=52,Sb=57,wb=58,vb=59,kb=61,Tb=62,Pb=63,Cb=64,Ab=65,Qb=67,Rb=256,Mb=74,Eb=275,$b=120,qb=138,Db=159,Bb=160,Xb=163,dn=10,pn=13,Fh=32,To=9,_h=35,Lb=40,Vb=46,Rm=123,$m=39,qm=34,Wb=92,Ib=new Set([xb,yb,bb,Eb,Qb,qb,wb,vb,Rb,Cb,Ab,Mb,Tb,Pb,Db,Bb,Xb,$b]);function zh(i){return i==dn||i==pn}var Nb=new yi((i,t)=>{let e;if(i.next<0)i.acceptToken(nb);else if(t.context.depth<0)zh(i.next)&&i.acceptToken(rb,1);else if(((e=i.peek(-1))<0||zh(e))&&t.canShift(Qm)){let r=0;for(;i.next==Fh||i.next==To;)i.advance(),r++;(i.next==dn||i.next==pn||i.next==_h)&&i.acceptToken(Qm,-r)}else zh(i.next)&&i.acceptToken(ib,1)},{contextual:!0}),Yb=new yi((i,t)=>{let e=t.context.depth;if(e<0)return;let r=i.peek(-1);if(r==dn||r==pn){let n=0,s=0;for(;;){if(i.next==Fh)n++;else if(i.next==To)n+=8-n%8;else break;i.advance(),s++}n!=e&&i.next!=dn&&i.next!=pn&&i.next!=_h&&(n{for(let t=0;t<5;t++){if(i.next!=\"print\".charCodeAt(t))return;i.advance()}if(!/\\w/.test(String.fromCharCode(i.next)))for(let t=0;;t++){let e=i.peek(t);if(!(e==Fh||e==To)){e!=Lb&&e!=Vb&&e!=dn&&e!=pn&&e!=_h&&i.acceptToken(eb);return}}});function Po(i,t,e,r,n){return new yi(s=>{let o=s.pos;for(;!(s.next<0);)if(s.next==Rm)if(s.peek(1)==Rm)s.advance(2);else{if(s.pos==o){s.acceptToken(r,1);return}break}else if(s.next==Wb)s.advance(),s.next>=0&&s.advance();else if(s.next==i&&(t==1||s.peek(1)==i&&s.peek(2)==i)){if(s.pos==o){s.acceptToken(n,t);return}break}else s.advance();s.pos>o&&s.acceptToken(e)})}var Gb=Po($m,1,sb,ob,lb),Hb=Po(qm,1,ab,hb,fb),Ub=Po($m,3,cb,ub,db),jb=Po(qm,3,pb,mb,gb),Kb=Hs({'async \"*\" \"**\" FormatConversion FormatSpec':p.modifier,\"for while if elif else try except finally return raise break continue with pass assert await yield match case\":p.controlKeyword,\"in not and or is del\":p.operatorKeyword,\"from def class global nonlocal lambda\":p.definitionKeyword,import:p.moduleKeyword,\"with as print\":p.keyword,Boolean:p.bool,None:p.null,VariableName:p.variableName,\"CallExpression/VariableName\":p.function(p.variableName),\"FunctionDefinition/VariableName\":p.function(p.definition(p.variableName)),\"ClassDefinition/VariableName\":p.definition(p.className),PropertyName:p.propertyName,\"CallExpression/MemberExpression/PropertyName\":p.function(p.propertyName),Comment:p.lineComment,Number:p.number,String:p.string,FormatString:p.special(p.string),UpdateOp:p.updateOperator,\"ArithOp!\":p.arithmeticOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,AssignOp:p.definitionOperator,Ellipsis:p.punctuation,At:p.meta,\"( )\":p.paren,\"[ ]\":p.squareBracket,\"{ }\":p.brace,\".\":p.derefOperator,\", ;\":p.separator}),Jb={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:178,True:180,False:180,del:194,pass:198,break:202,continue:206,return:210,raise:218,import:222,as:224,global:228,nonlocal:230,assert:234,type:239,elif:252,while:256,try:262,except:264,finally:266,with:270,def:274,class:284,match:295,case:301},Dm=ko.deserialize({version:14,states:\"#)WO`Q#yOOP$bOSOOO%kQ&nO'#HhOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HgOOQS'#Hh'#HhOOQS'#DW'#DWOOQS'#Hg'#HgO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HXOOQS'#HX'#HXO'ZQ#xO'#HWO/ZQ&nO'#HWOOQS'#Ej'#EjO/rQ#xO'#EkOOQS'#HV'#HVO/|Q#xO'#HUOOQV'#HU'#HUO0XQ#xO'#FbOOQS'#Gj'#GjO0^Q#xO'#FaOOQV'#I_'#I_OOQV'#HT'#HTOOQV'#Fy'#FyQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HlO1cQ&nO'#E_O'ZQ#xO'#E`OOQS'#Eb'#EbOOQS'#Ed'#EdOOQS'#Ef'#EfO1wQ#xO'#EhO2_Q#xO'#ElO0XQ#xO'#EnO2rQ&nO'#EnO0XQ#xO'#EqO/rQ#xO'#EtO0XQ#xO'#EvO/rQ#xO'#E|O/rQ#xO'#FPO2}Q#xO'#FRO3UQ#xO'#FWO3aQ#xO'#FSO/rQ#xO'#FWO0XQ#xO'#FYO0XQ#xO'#F_O3fQ#xO'#FdP3mO#xO'#HSPOOO)CBv)CBvOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Ck'#CkOOQS'#Cl'#ClOOQS'#Cn'#CnO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO3xQ#xO'#DqOOQS,5:[,5:[O4]Q#xO'#HvOOQS,5:_,5:_O4jQMlO,5:_O4oQ&nO,59[O0lQ#xO,59dO0lQ#xO,59dO0lQ#xO,59dO7_Q#xO,59dO7dQ#xO,59dO7kQ#xO,59lO7rQ#xO'#HgO8xQ#xO'#HfOOQS'#Hf'#HfOOQS'#D^'#D^O9aQ#xO,59cO'ZQ#xO,59cO9oQ#xO,59cOOQS,59{,59{O9tQ#xO,5:TO'ZQ#xO,5:TOOQS,5:S,5:SO:SQ#xO,5:SO:XQ#xO,5:ZO'ZQ#xO,5:ZO'ZQ#xO,5:XOOQS,5:W,5:WO:jQ#xO,5:WO:oQ#xO,5:YOOOO'#GR'#GRO:tO,UO,5:cOOQS,5:c,5:cOOOO'#GS'#GSO:|O7[O,5:cO;UQ#xO'#DyOOOW'#GT'#GTO;fOWO,5:dOOQS,5:d,5:dO;UQ#xO'#EPOOO`'#GW'#GWO;qO`O,5:dO;UQ#xO'#EROOOp'#GX'#GXO;|OpO,5:dO;UQ#xO'#ETOOO!b'#GY'#GYOWOOQS,5>W,5>WO/rQ#xO'#EZOOQS'#E['#E[OGZQ#xO'#G]OGkQ#xO,59OOGkQ#xO,59OO)pQ#xO,5:wOGyQ&nO'#HoOOQS,5:z,5:zOOQS,5;S,5;SOH^Q#xO,5;WOHoQ#xO,5;YOOQS'#G`'#G`OH}Q&nO,5;YOI]Q#xO,5;YOIbQ#xO'#I]OOQS,5;],5;]OIpQ#xO'#IXOOQS,5;`,5;`OJRQ#xO,5;bO3aQ#xO,5;hO3aQ#xO,5;kOJZQ&nO'#I`O'ZQ#xO'#I`OJeQ#xO,5;mO2}Q#xO,5;mO/rQ#xO,5;rO0XQ#xO,5;tOJjQ#yO'#E}OKvQ#{O,5;nO! [Q#xO'#IaO3aQ#xO,5;rO! gQ#xO,5;tO! oQ#xO,5;yO! zQ&nO,5bOOQS'#Du'#DuOOQS1G/y1G/yOOQS1G/O1G/OO!-uQ&nO1G/OO!-|Q&nO1G/OO0lQ#xO1G/OO!.iQ#xO1G/WOOQS'#D]'#D]O/rQ#xO,59vOOQS1G.}1G.}O!.pQ#xO1G/gO!/QQ#xO1G/gO!/YQ#xO1G/hO'ZQ#xO'#HnO!/_Q#xO'#HnO!/dQ&nO1G.}O!/tQ#xO,59kO!0zQ#xO,5>^O!1[Q#xO,5>^O!1dQ#xO1G/oO!1iQ&nO1G/oOOQS1G/n1G/nO!1yQ#xO,5>XO!2pQ#xO,5>XO/rQ#xO1G/sO!3_Q#xO1G/uO!3dQ&nO1G/uO!3tQ&nO1G/sOOQS1G/r1G/rOOQS1G/t1G/tOOOO-E:P-E:POOQS1G/}1G/}OOOO-E:Q-E:QO!4UQ#xO'#IRO/rQ#xO'#IRO!4gQ#xO,5:eOOOW-E:R-E:ROOQS1G0O1G0OO!4uQ#xO,5:kOOO`-E:U-E:UO!5TQ#xO,5:mOOOp-E:V-E:VO!5cQ#xO,5:oOOO!b-E:W-E:WOOQS-E:X-E:XO!5qQ!LUO1G3^O!6bQ&nO1G3^O'ZQ#xO,5tOOQS1G1h1G1hO!7bQ#xO1G1hOOQS'#DX'#DXO/rQ#xO,5>TOOQS,5>T,5>TO!7gQ#xO'#FzO!7rQ#xO,59qO!7zQ#xO1G/ZO!8UQ&nO,5>XOOQS1G3r1G3rOOQS,5:u,5:uO!8uQ#xO'#HWOOQS,5ZO!9vQ#xO,5>ZO/rQ#xO1G0rO/rQ#xO1G0rO0XQ#xO1G0tOOQS-E:^-E:^O!:XQ#xO1G0tO!:dQ#xO1G0tO!:iQ#xO,5>wO!:wQ#xO,5>wO!;VQ#xO,5>sO!;mQ#xO,5>sO!zO!CZQ#xO,5>zO!CcQ&nO,5>zO/rQ#xO1G1XO!CmQ#xO1G1XO3aQ#xO1G1^O! gQ#xO1G1`OOQV,5;i,5;iO!CrQ#zO,5;iO!CwQ#{O1G1YO!G]Q#xO'#GgO3aQ#xO1G1YO3aQ#xO1G1YO!GmQ#xO,5>{O!GzQ#xO,5>{O0XQ#xO,5>{OOQV1G1^1G1^O!HSQ#xO'#F[O!HeQMlO1G1`O!HmQ#xO1G1`OOQV1G1e1G1eO3aQ#xO1G1eO!HrQ#xO1G1eO!HzQ#xO'#FfOOQV1G1j1G1jO! zQ&nO1G1jPOOO1G3Y1G3YP!IPOSO1G3YOOQS,5>a,5>aOOQS'#Dr'#DrO/rQ#xO,5>aO!IUQ#xO,5>`O!IiQ#xO,5>`OOQS1G/w1G/wO!IqQ#xO,5>cO!JRQ#xO,5>cO!JZQ#xO,5>cO!JnQ#xO,5>cO!KOQ#xO,5>cOOQS1G3|1G3|OOQS7+$j7+$jO!7zQ#xO7+$rO!LqQ#xO1G/OO!LxQ#xO1G/OOOQS1G/b1G/bOOQS,5YO'ZQ#xO,5>YOOQS7+$i7+$iO!MfQ#xO7+%RO!MnQ#xO7+%SO!MsQ#xO1G3xOOQS7+%Z7+%ZO!NTQ#xO1G3xO!N]Q#xO7+%ZOOQS,5mO##cQ#xO,5>mO##cQ#xO,5>mOOQS'#Dz'#DzO##tO$ISO'#D|O#$PO#tO'#ISOOOW1G0P1G0PO#$UQ#xO1G0PO#$^Q#xO1G0POOQS'#EQ'#EQOOO`1G0V1G0VO#$iQ#xO1G0VO#$qQ#xO1G0VOOQS'#ES'#ESOOOp1G0X1G0XO#$|Q#xO1G0XO#%UQ#xO1G0XOOQS'#EU'#EUOOO!b1G0Z1G0ZO#%aQ#xO1G0ZO#%iQ#xO1G0ZO#%tQ!LUO7+(xO#&eQ&nO1G2bP#'OQ#xO'#G[OOQS,5n,5>nOOOW7+%k7+%kO#;yQ#xO7+%kOOO`7+%q7+%qO#vO#=xQ#xO,5>vO0XQ#xO,5>vO#>ZQ#xO,5>uOOQS<`Q#xO,5>xO#>nQ#xO,5>xOOQS1G1O1G1OOOQS<vQ&nO1G2lP#?QQ#xO'#GfO#?XQ#xO7+*QO#?cQ#{O<}O#F{Q#xO,5>}OOQS,5>},5>}O#GWQ#xO,5>|O#GiQ#xO,5>|OOQS1G1b1G1bOOQS,5;x,5;xOOQV<XAN>XO#JxQ#xO<eAN>eO/rQ#xO1G2UO#KYQ&nO1G2UP#KdQ#xO'#GOOOQS1G2[1G2[P#KqQ#xO'#GUO#LOQ#xO7+)sO#LiQ#xO,5:iOOOO-E:T-E:TOOOW<[OOQSANBfANBfOOOO7+%o7+%oO$.WQ#xO7+%oOOQS7+(R7+(RO$.`Q#xO<kPP>n?`?cPP'f'fPP?{PP'f'fPP'f'f'f'f'f@P@y'fP@|PASE^H}IRPIUIlIpIsIwIzJOJRJV'fPPPJYJc'^P'^'^P'^P'^P'^P'^P'^'^'^P'^PP'^PP'^P'^PJiJuJ}PKUK[PKUPKUKUPPPKUPMjPMsM}NTMjPKUN^PKUPNeNkPNo! T! r!!]NoNo!!c!!pNoNoNoNo!#U!#[!#_!#d!#g!#q!#w!$T!$g!$m!$w!$}!%k!%q!%w!%}!&X!&_!&e!&k!&q!&w!'Z!'e!'k!'q!'w!(R!(X!(_!(e!(k!(u!({!)V!)]!)f!)l!){!*T!*_!*fPPPPPPPPPPPPPPPPP!*l!*o!*u!+O!+Y!+ePPPPPPPPPPPP!0[!1p!5s!9WPP!9`!9r!9{!:t!:k!:}!;T!;W!;Z!;^!;f!V!>]!>f!>i!>l!>r!>x!?O!?RP!?Z!?d!@`!@c]jOs#v$w*`,p(TeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o}!hQ#r$P$b$q$}%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!P!iQ#r$P$b$q$}%S%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!R!jQ#r$P$b$q$}%S%T%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!T!kQ#r$P$b$q$}%S%T%U%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!V!lQ#r$P$b$q$}%S%T%U%V%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!X!mQ#r$P$b$q$}%S%T%U%V%W%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!]!mQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d(TTOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o&iVOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1o%sXOYZ[isw}!O!S!U!V!Z!n!p#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$VvQ0X/fR1l1n'zeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oW#ym!P!Q$hW$Rv&q/f1nQ$j!RQ$n!TQ${![Q$|!]W%Z!n(O+O-WS&p$S$TQ'e$vQ)b&jQ)p'QU)q'S)r)sU)t'U)u,ZW){'Y,^-z.vQ*l'nW*m'p-P._/OQ,])zS-O*n*oY-t,U-u.s.t/lQ-w,WQ.U,tQ.Y,wQ.|.Wl/R.c/X/Y/[/w/y0O0g0l0q0v1R1W1ZQ/k.rQ0P/ZQ0^/qQ0i/{U0|0r1P1XX1S0w1T1[1]R&o$R!_!|YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WR%k!{Q#QYQ&W#cQ&Z#gQ&]#jQ&_#mQ&x$^Q&{$aR-l+tT/e.j0p![!oQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dQ&m#zQ't$|R*x'uR'}%ZQ%d!rR0[/o(SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oS#pd#q!P/V.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1](SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oT#pd#qT#d`#eR)Q&Wy(}&W&Z&]&_)P)Q)T)U)X)Y)])^+y+{+},P-l.p.q/jT+u(|+vR.q-lT#ha#iR)U&ZT#kb#lR)Y&]T#nc#oR)^&_Q$`xQ,]){R,}*mX$^x$_$`&zQ'[$nQ'r${Q'u$|R*_'eQ)|'YV-y,^-z.vZlOs$w*`,pXpOs*`,pQ$x!YQ']$oQ'^$pQ'o$zQ's$|Q*]'dQ*d'iQ*g'jQ*h'kQ*u'qS*w't'uQ,d*RQ,f*SQ,g*TQ,k*ZS,m*^*vQ,q*bQ,r*cS,s*e*fQ-T*xQ-|,cQ-},eQ.P,lS.Q,n,oQ.V,uQ.X,vQ.w.OQ.y.RQ.z.TQ.{.UQ/m.xQ/n.|Q0T/_R0o0UWpOs*`,pR#|oQ'q${S*^'e'rR,o*_Q,|*mR.],}Q*v'qQ,n*^R.R,oZnOos*`,pQ'w$}R*z'xT.a-U.bu/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1Zt/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZQ0P/ZX1S0w1T1[1]!P/U.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1]Q/t/TR0c/ug/w/W/x0_0f0k0y0{0}1Y1^1_u/].c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZX/r/R/]0^0|R0`/qV1O0r1P1XR0U/_QsOS$Os,pR,p*`Q&r$UR)g&rS%z#W$WS(p%z(sT(s%}&tQ%n#OQ%u#SW(b%n%u(g(kQ(g%rR(k%wQ&}$bR)m&}Q(v&OQ+g(qT+m(v+gQ(P%]R+P(PS(S%`%aY+T(S+U-^.h/cU+U(T(U(VU-^+V+W+XS.h-_-`R/c.iQ#_^R&R#_Q#b_R&T#bQ#e`R&X#eQ(y&US+r(y+sR+s(zQ+v(|R-m+vQ#iaR&[#iQ#lbR&^#lQ#ocR&`#oQ#qdR&a#qQ#tgQ&c#rW&f#t&c)j,RQ)j&wR,R1dQ$_xS&y$_&zR&z$`Q'X$lR)y'XQ&k#yR)c&kQ$h!QR'R$hQ,V)qS-v,V.uR.u-wQ'V$jR)v'VQ,_)|R-{,_Q#wkR&h#wQ*Q']R,b*QQ'`$qS*X'`*YR*Y'aQ'h$xR*a'hQ'm$yS*k'm,zR,z*lQ-Q*qR.`-QWoOs*`,pR#{oQ.b-UR/P.bd/x/W0_0f0k0y0{0}1Y1^1_R0e/xU/p/R0^0|R0]/pQ0x0kS1U0x1VR1V0yS0s0_0`R1Q0sQ/z/WR0h/zR!`PXrOs*`,pWqOs*`,pR'f$wYkOs$w*`,pR&g#v[xOs#v$w*`,pR&x$^&hQOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1oQ!sTQ#rfQ$PtU$by%p(eS$q!W$tQ$}!^Q%S!hQ%T!iQ%U!jQ%V!kQ%W!lQ%X!mQ%r#PQ%w#TQ%}#XQ&O#YQ&t$XQ'a$rQ'x%OQ)`&dU)k&|)l,SW*U'_*W,i,jQ+Z(_Q+d(nQ,h*VQ-g+lQ0n0SR1d1iQ#OYQ#SZQ$o!UQ$p!VQ%`!pQ(V%a^(^%m%t(a(i+]+`+b^+Q(R+S-[-].g/b0WQ+W(TQ+X(UQ,e*RQ-Z+RQ-_+VQ.e-XQ.f-YQ.i-`Q/`.dR0V/a[gOs#v$w*`,p!^!{YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WQ#W[Q#uiS$Ww}Q$e!OW$l!S$a'b*[S$y!Z$uW%Y!n(O+O-WY&U#c#g#j#m+t`&e#s&b)_)a)i,Q-r1hQ&u$YQ&v$[Q&w$^Q'{%[Q(]%kW(m%y(o+e+iQ(q%{Q(z&VQ)e&oS)h&s1fQ)n'OQ)o'PU)w'W)x,[Q*O'ZQ*e'iY*i'l*j,x,y.ZQ*|'}S+Y(Y1gW+k(u+f-d-hW+o(x+q-j-kQ,a*PQ,u*fQ-S*tQ-i+pQ-s,TQ.[,|Q.m-fR.}.]hUOs#s#v$w&b&s(Y)_)a*`,p%Y!zYZ[iw}!O!S!U!V!Z!n!p#c#g#j#m$Y$[$^$a$u%[%a%k%m%t%y%{&V&o'O'P'W'Z'b'i'l'}(O(R(T(U(a(i(o(u(x)i)x*P*R*[*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$QuW%e!t!x1a1kQ%f!uQ%g!vQ%i!yQ%s1`S(X%h1eQ(Z1bQ([1cQ-a+^Q.l-bS/d.j0pR1m1oU$Uv/f1nR)f&q[hOs#v$w*`,pa!}Y#c#g#j#m$^$a+tQ#][Q$ZwR$d}Q%o#OQ%v#SQ%|#WQ'{%YQ(h%rQ(l%wQ(t%}Q(w&OQ+h(qQ-V*|Q.k-aQ/h.lR0Y/gQ$cyQ(d%pR+_(eQ/g.jR0z0pR#VZR#[[R%_!nQ%]!nV*}(O+O-W!]!qQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-l+tQ)O&WQ)S&ZQ)W&]Q)[&_S+x)P)QS+z)T)US+|)X)YS,O)])^Q-n+yQ-o+{Q-p+}Q-q,PQ.o-lS/i.p.qR0Z/jQ$m!SQ&{$aQ*Z'bR,l*[Q#zmQ$f!PQ$i!QR'T$hQ)p'SR,Y)sQ)p'SQ,X)rR,Y)sR$k!RR)}'YXqOs*`,pQ$s!WR'c$tQ$z!ZR'd$uR*s'pQ*q'pV.^-P._/OQ/_.cQ/|/XR/}/YU/W.c/X/YQ0R/[Q0_/qQ0d/wU0f/y0g0vQ0k0OQ0y0lQ0{0qU0}0r1P1XQ1Y1RQ1^1WR1_1ZR0Q/ZR0a/q\",nodeNames:\"\\u26A0 print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard\",maxTerm:288,context:Fb,nodeProps:[[\"isolate\",-8,6,73,74,75,79,81,83,85,\"\"],[\"group\",-15,8,93,95,96,98,100,102,104,106,107,108,110,113,116,118,\"Statement Statement\",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,87,88,89,90,\"Expression\",-10,122,124,127,129,130,134,136,141,143,146,\"Statement\",-9,151,152,155,156,158,159,160,161,162,\"Pattern\"],[\"openedBy\",25,\"(\",56,\"[\",60,\"{\"],[\"closedBy\",26,\")\",57,\"]\",61,\"}\"]],propSources:[Kb],skippedNodes:[0,6],repeatNodeCount:38,tokenData:\"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&w!b&oS&rW%u!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&w!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&w!b&oS&rWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cDXa&w!b&oS&msOYE^YZ%TZ]E^]^%T^rE^rs!)|swE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cEia&w!b&oS&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cFw]&w!b&oS&msOr%Trs'Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cGya&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxIOx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cIXa&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxJ^x#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#_Jg_&w!b&rW&msOYJ^YZ1XZ]J^]^1X^rJ^rsKfs#OJ^#O#PL`#P#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`!!o<%lOJ^#_KmZ&w!b&msOr1Xrs2ys#O1X#O#P3q#P#o1X#o#p4`#p#q1X#q#r4`#r;'S1X;'S;=`7i<%lO1X#_LeW&w!bO#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`! r;=`<%lL}<%lOJ^{MUZ&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l<%lOL}{M|V&msOr4`rs5ds#O4`#O#P5y#P;'S4`;'S;=`6t<%lO4`{NfRO;'SL};'S;=`No;=`OL}{Nv[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lL}<%lOL}{! oP;=`<%lL}#_! y[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lJ^<%lOL}#_!!rP;=`<%lJ^#c!!zW&w!bO#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!(q;=`<%l!#d<%lOE^!P!#m]&oS&rW&msOY!#dYZ8^Z]!#d]^8^^r!#drs!$fsw!#dwx!%Yx#O!#d#O#P!'Y#P;'S!#d;'S;=`!(k<%lO!#d!P!$mX&oS&msOr8^rs9rsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`^s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!>e_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!?ds#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!?k_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!3`s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!@q[U!T&w!bOY!=UYZ1XZ]!=U]^1X^#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!Ec;=`<%l4`<%lO!=U!]!AnZU!T&rWOY!AgYZ4`Z]!Ag]^4`^r!Agrs!Bas#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!BfZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!CXs#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!C^ZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!4Ys#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!DUWU!TOY!AgYZ4`Z]!Ag]^4`^;'S!Ag;'S;=`!Dn;=`<%l4`<%lO!Ag!]!DsW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&w!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&oS&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&oS&rWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&w!b&oS&rW&l`&XsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Jb[i]||-1}],tokenPrec:7500});var Bm=new zs,Vm=new Set([\"Script\",\"Body\",\"FunctionDefinition\",\"ClassDefinition\",\"LambdaExpression\",\"ForStatement\",\"MatchClause\"]);function Co(i){return(t,e,r)=>{if(r)return!1;let n=t.node.getChild(\"VariableName\");return n&&e(n,i),!0}}var tS={FunctionDefinition:Co(\"function\"),ClassDefinition:Co(\"class\"),ForStatement(i,t,e){if(e){for(let r=i.node.firstChild;r;r=r.nextSibling)if(r.name==\"VariableName\")t(r,\"variable\");else if(r.name==\"in\")break}},ImportStatement(i,t){var e,r;let{node:n}=i,s=((e=n.firstChild)===null||e===void 0?void 0:e.name)==\"from\";for(let o=n.getChild(\"import\");o;o=o.nextSibling)o.name==\"VariableName\"&&((r=o.nextSibling)===null||r===void 0?void 0:r.name)!=\"as\"&&t(o,s?\"variable\":\"namespace\")},AssignStatement(i,t){for(let e=i.node.firstChild;e;e=e.nextSibling)if(e.name==\"VariableName\")t(e,\"variable\");else if(e.name==\":\"||e.name==\"AssignOp\")break},ParamList(i,t){for(let e=null,r=i.node.firstChild;r;r=r.nextSibling)r.name==\"VariableName\"&&(!e||!/\\*|AssignOp/.test(e.name))&&t(r,\"variable\"),e=r},CapturePattern:Co(\"variable\"),AsPattern:Co(\"variable\"),__proto__:null};function Wm(i,t){let e=Bm.get(t);if(e)return e;let r=[],n=!0;function s(o,l){let a=i.sliceString(o.from,o.to);r.push({label:a,type:l})}return t.cursor(st.IncludeAnonymous).iterate(o=>{if(o.name){let l=tS[o.name];if(l&&l(o,s,n)||!n&&Vm.has(o.name))return!1;n=!1}else if(o.to-o.from>8192){for(let l of Wm(i,o.node))r.push(l);return!1}}),Bm.set(t,r),r}var Xm=/^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/,Im=[\"String\",\"FormatString\",\"Comment\",\"PropertyName\"];function eS(i){let t=pt(i.state).resolveInner(i.pos,-1);if(Im.indexOf(t.name)>-1)return null;let e=t.name==\"VariableName\"||t.to-t.from<20&&Xm.test(i.state.sliceDoc(t.from,t.to));if(!e&&!i.explicit)return null;let r=[];for(let n=t;n;n=n.parent)Vm.has(n.name)&&(r=r.concat(Wm(i.state.doc,n)));return{options:r,from:e?t.from:i.pos,validFor:Xm}}var iS=[\"__annotations__\",\"__builtins__\",\"__debug__\",\"__doc__\",\"__import__\",\"__name__\",\"__loader__\",\"__package__\",\"__spec__\",\"False\",\"None\",\"True\"].map(i=>({label:i,type:\"constant\"})).concat([\"ArithmeticError\",\"AssertionError\",\"AttributeError\",\"BaseException\",\"BlockingIOError\",\"BrokenPipeError\",\"BufferError\",\"BytesWarning\",\"ChildProcessError\",\"ConnectionAbortedError\",\"ConnectionError\",\"ConnectionRefusedError\",\"ConnectionResetError\",\"DeprecationWarning\",\"EOFError\",\"Ellipsis\",\"EncodingWarning\",\"EnvironmentError\",\"Exception\",\"FileExistsError\",\"FileNotFoundError\",\"FloatingPointError\",\"FutureWarning\",\"GeneratorExit\",\"IOError\",\"ImportError\",\"ImportWarning\",\"IndentationError\",\"IndexError\",\"InterruptedError\",\"IsADirectoryError\",\"KeyError\",\"KeyboardInterrupt\",\"LookupError\",\"MemoryError\",\"ModuleNotFoundError\",\"NameError\",\"NotADirectoryError\",\"NotImplemented\",\"NotImplementedError\",\"OSError\",\"OverflowError\",\"PendingDeprecationWarning\",\"PermissionError\",\"ProcessLookupError\",\"RecursionError\",\"ReferenceError\",\"ResourceWarning\",\"RuntimeError\",\"RuntimeWarning\",\"StopAsyncIteration\",\"StopIteration\",\"SyntaxError\",\"SyntaxWarning\",\"SystemError\",\"SystemExit\",\"TabError\",\"TimeoutError\",\"TypeError\",\"UnboundLocalError\",\"UnicodeDecodeError\",\"UnicodeEncodeError\",\"UnicodeError\",\"UnicodeTranslateError\",\"UnicodeWarning\",\"UserWarning\",\"ValueError\",\"Warning\",\"ZeroDivisionError\"].map(i=>({label:i,type:\"type\"}))).concat([\"bool\",\"bytearray\",\"bytes\",\"classmethod\",\"complex\",\"float\",\"frozenset\",\"int\",\"list\",\"map\",\"memoryview\",\"object\",\"range\",\"set\",\"staticmethod\",\"str\",\"super\",\"tuple\",\"type\"].map(i=>({label:i,type:\"class\"}))).concat([\"abs\",\"aiter\",\"all\",\"anext\",\"any\",\"ascii\",\"bin\",\"breakpoint\",\"callable\",\"chr\",\"compile\",\"delattr\",\"dict\",\"dir\",\"divmod\",\"enumerate\",\"eval\",\"exec\",\"exit\",\"filter\",\"format\",\"getattr\",\"globals\",\"hasattr\",\"hash\",\"help\",\"hex\",\"id\",\"input\",\"isinstance\",\"issubclass\",\"iter\",\"len\",\"license\",\"locals\",\"max\",\"min\",\"next\",\"oct\",\"open\",\"ord\",\"pow\",\"print\",\"property\",\"quit\",\"repr\",\"reversed\",\"round\",\"setattr\",\"slice\",\"sorted\",\"sum\",\"vars\",\"zip\"].map(i=>({label:i,type:\"function\"}))),rS=[Pe(\"def ${name}(${params}):\\n\t${}\",{label:\"def\",detail:\"function\",type:\"keyword\"}),Pe(\"for ${name} in ${collection}:\\n\t${}\",{label:\"for\",detail:\"loop\",type:\"keyword\"}),Pe(\"while ${}:\\n\t${}\",{label:\"while\",detail:\"loop\",type:\"keyword\"}),Pe(\"try:\\n\t${}\\nexcept ${error}:\\n\t${}\",{label:\"try\",detail:\"/ except block\",type:\"keyword\"}),Pe(`if \\${}:\n\t\n`,{label:\"if\",detail:\"block\",type:\"keyword\"}),Pe(\"if ${}:\\n\t${}\\nelse:\\n\t${}\",{label:\"if\",detail:\"/ else block\",type:\"keyword\"}),Pe(\"class ${name}:\\n\tdef __init__(self, ${params}):\\n\t\t\t${}\",{label:\"class\",detail:\"definition\",type:\"keyword\"}),Pe(\"import ${module}\",{label:\"import\",detail:\"statement\",type:\"keyword\"}),Pe(\"from ${module} import ${names}\",{label:\"from\",detail:\"import\",type:\"keyword\"})],nS=Ap(Im,wh(iS.concat(rS)));function Lm(i,t){let e=i.baseIndentFor(t),r=i.lineAt(i.pos,-1),n=r.from+r.text.length;return/^\\s*($|#)/.test(r.text)&&i.node.toe?null:e+i.unit}var Gh=Us.define({name:\"python\",parser:Dm.configure({props:[lh.add({Body:i=>{var t;return(t=Lm(i,i.node))!==null&&t!==void 0?t:i.continue()},IfStatement:i=>/^\\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\\s*(except |finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),\"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression\":Ks({closing:\")\"}),\"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression\":Ks({closing:\"}\"}),\"ArrayExpression ArrayComprehensionExpression\":Ks({closing:\"]\"}),\"String FormatString\":()=>null,Script:i=>{if(i.pos+/\\s*/.exec(i.textAfter)[0].length>=i.node.to){let t=null;for(let e=i.node,r=e.to;e=e.lastChild,!(!e||e.to!=r);)e.type.name==\"Body\"&&(t=e);if(t){let e=Lm(i,t);if(e!=null)return e}}return i.continue()}}),ah.add({\"ArrayExpression DictionaryExpression SetExpression TupleExpression\":ap,Body:(i,t)=>({from:i.from+1,to:i.to-(i.to==t.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:[\"(\",\"[\",\"{\",\"'\",'\"',\"'''\",'\"\"\"'],stringPrefixes:[\"f\",\"fr\",\"rf\",\"r\",\"u\",\"b\",\"br\",\"rb\",\"F\",\"FR\",\"RF\",\"R\",\"U\",\"B\",\"BR\",\"RB\"]},commentTokens:{line:\"#\"},indentOnInput:/^\\s*([\\}\\]\\)]|else:|elif |except |finally:)$/}});function Hh(){return new js(Gh,[Gh.data.of({autocomplete:eS}),Gh.data.of({autocomplete:nS})])}function z(){var i=arguments[0];typeof i==\"string\"&&(i=document.createElement(i));var t=1,e=arguments[1];if(e&&typeof e==\"object\"&&e.nodeType==null&&!Array.isArray(e)){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n==\"string\"?i.setAttribute(r,n):n!=null&&(i[r]=n)}t++}for(;tl.from==l.to||l.from==l.to-1&&r.doc.lineAt(l.from).to==l.from?R.widget({widget:new jh(l),diagnostic:l}).range(l.from):R.mark({attributes:{class:\"cm-lintRange cm-lintRange-\"+l.severity+(l.markClass?\" \"+l.markClass:\"\")},diagnostic:l,inclusive:!0}).range(l.from,l.to)),!0);return new i(o,e,tr(o))}};function tr(i,t=null,e=0){let r=null;return i.between(e,1e9,(n,s,{spec:o})=>{if(!(t&&o.diagnostic!=t))return r=new Uh(n,s,o.diagnostic),!1}),r}function sS(i,t){let e=i.startState.doc.lineAt(t.pos);return!!(i.effects.some(r=>r.is(zm))||i.changes.touchesRange(e.from,e.to))}function oS(i,t){return i.field(Yt,!1)?t:t.concat(M.appendConfig.of(pS))}var zm=M.define(),Kh=M.define(),Zm=M.define(),Yt=it.define({create(){return new bi(R.none,null,null)},update(i,t){if(t.docChanged){let e=i.diagnostics.map(t.changes),r=null;if(i.selected){let n=t.changes.mapPos(i.selected.from,1);r=tr(e,i.selected.diagnostic,n)||tr(e,null,n)}i=new bi(e,i.panel,r)}for(let e of t.effects)e.is(zm)?i=bi.init(e.value,i.panel,t.state):e.is(Kh)?i=new bi(i.diagnostics,e.value?Ro.open:null,i.selected):e.is(Zm)&&(i=new bi(i.diagnostics,i.panel,e.value));return i},provide:i=>[fi.from(i,t=>t.panel),T.decorations.from(i,t=>t.diagnostics)]});var lS=R.mark({class:\"cm-lintRange cm-lintRange-active\",inclusive:!0});function aS(i,t,e){let{diagnostics:r}=i.state.field(Yt),n=[],s=2e8,o=0;r.between(t-(e<0?1:0),t+(e>0?1:0),(a,h,{spec:f})=>{t>=a&&t<=h&&(a==h||(t>a||e>0)&&(tGm(i,e,!1)))}var fS=i=>{let t=i.state.field(Yt,!1);(!t||!t.panel)&&i.dispatch({effects:oS(i.state,[Kh.of(!0)])});let e=ci(i,Ro.open);return e&&e.dom.querySelector(\".cm-panel-lint ul\").focus(),!0},Ym=i=>{let t=i.state.field(Yt,!1);return!t||!t.panel?!1:(i.dispatch({effects:Kh.of(!1)}),!0)},cS=i=>{let t=i.state.field(Yt,!1);if(!t)return!1;let e=i.state.selection.main,r=t.diagnostics.iter(e.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==e.from&&r.to==e.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var Mo=[{key:\"Mod-Shift-m\",run:fS,preventDefault:!0},{key:\"F8\",run:cS}];var Fm=A.define({combine(i){return Object.assign({sources:i.map(t=>t.source).filter(t=>t!=null)},kt(i.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(t,e)=>t?e?r=>t(r)||e(r):t:e}))}});function _m(i){let t=[];if(i)t:for(let{name:e}of i){for(let r=0;rs.toLowerCase()==n.toLowerCase())){t.push(n);continue t}}t.push(\"\")}return t}function Gm(i,t,e){var r;let n=e?_m(t.actions):[];return z(\"li\",{class:\"cm-diagnostic cm-diagnostic-\"+t.severity},z(\"span\",{class:\"cm-diagnosticText\"},t.renderMessage?t.renderMessage():t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=u=>{if(u.preventDefault(),l)return;l=!0;let d=tr(i.state.field(Yt).diagnostics,t);d&&s.apply(i,d.from,d.to)},{name:h}=s,f=n[o]?h.indexOf(n[o]):-1,c=f<0?h:[h.slice(0,f),z(\"u\",h.slice(f,f+1)),h.slice(f+1)];return z(\"button\",{type:\"button\",class:\"cm-diagnosticAction\",onclick:a,onmousedown:a,\"aria-label\":` Action: ${h}${f<0?\"\":` (access key \"${n[o]})\"`}.`},c)}),t.source&&z(\"div\",{class:\"cm-diagnosticSource\"},t.source))}var jh=class extends Ut{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return z(\"span\",{class:\"cm-lintPoint cm-lintPoint-\"+this.diagnostic.severity})}},Qo=class{constructor(t,e){this.diagnostic=e,this.id=\"item_\"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Gm(t,e,!0),this.dom.id=this.id,this.dom.setAttribute(\"role\",\"option\")}},Ro=class i{constructor(t){this.view=t,this.items=[];let e=n=>{if(n.keyCode==27)Ym(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=_m(s.actions);for(let l=0;l{for(let s=0;sYm(this.view)},\"\\xD7\")),this.update()}get selectedIndex(){let t=this.view.state.field(Yt).selected;if(!t)return-1;for(let e=0;e{let h=-1,f;for(let c=r;cr&&(this.items.splice(r,h-r),n=!0)),e&&f.diagnostic==e.diagnostic?f.dom.hasAttribute(\"aria-selected\")||(f.dom.setAttribute(\"aria-selected\",\"true\"),s=f):f.dom.hasAttribute(\"aria-selected\")&&f.dom.removeAttribute(\"aria-selected\"),r++});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute(\"aria-activedescendant\"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)e();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Yt),r=tr(e.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Zm.of(r)})}static open(t){return new i(t)}};function uS(i,t='viewBox=\"0 0 40 40\"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function Ao(i){return uS(``,'width=\"6\" height=\"3\"')}var dS=T.baseTheme({\".cm-diagnostic\":{padding:\"3px 6px 3px 8px\",marginLeft:\"-1px\",display:\"block\",whiteSpace:\"pre-wrap\"},\".cm-diagnostic-error\":{borderLeft:\"5px solid #d11\"},\".cm-diagnostic-warning\":{borderLeft:\"5px solid orange\"},\".cm-diagnostic-info\":{borderLeft:\"5px solid #999\"},\".cm-diagnostic-hint\":{borderLeft:\"5px solid #66d\"},\".cm-diagnosticAction\":{font:\"inherit\",border:\"none\",padding:\"2px 4px\",backgroundColor:\"#444\",color:\"white\",borderRadius:\"3px\",marginLeft:\"8px\",cursor:\"pointer\"},\".cm-diagnosticSource\":{fontSize:\"70%\",opacity:.7},\".cm-lintRange\":{backgroundPosition:\"left bottom\",backgroundRepeat:\"repeat-x\",paddingBottom:\"0.7px\"},\".cm-lintRange-error\":{backgroundImage:Ao(\"#d11\")},\".cm-lintRange-warning\":{backgroundImage:Ao(\"orange\")},\".cm-lintRange-info\":{backgroundImage:Ao(\"#999\")},\".cm-lintRange-hint\":{backgroundImage:Ao(\"#66d\")},\".cm-lintRange-active\":{backgroundColor:\"#ffdd9980\"},\".cm-tooltip-lint\":{padding:0,margin:0},\".cm-lintPoint\":{position:\"relative\",\"&:after\":{content:'\"\"',position:\"absolute\",bottom:0,left:\"-2px\",borderLeft:\"3px solid transparent\",borderRight:\"3px solid transparent\",borderBottom:\"4px solid #d11\"}},\".cm-lintPoint-warning\":{\"&:after\":{borderBottomColor:\"orange\"}},\".cm-lintPoint-info\":{\"&:after\":{borderBottomColor:\"#999\"}},\".cm-lintPoint-hint\":{\"&:after\":{borderBottomColor:\"#66d\"}},\".cm-panel.cm-panel-lint\":{position:\"relative\",\"& ul\":{maxHeight:\"100px\",overflowY:\"auto\",\"& [aria-selected]\":{backgroundColor:\"#ddd\",\"& u\":{textDecoration:\"underline\"}},\"&:focus [aria-selected]\":{background_fallback:\"#bdf\",backgroundColor:\"Highlight\",color_fallback:\"white\",color:\"HighlightText\"},\"& u\":{textDecoration:\"none\"},padding:0,margin:0},\"& [name=close]\":{position:\"absolute\",top:\"0\",right:\"2px\",background:\"inherit\",border:\"none\",font:\"inherit\",padding:0,margin:0}}});var pS=[Yt,T.decorations.compute([Yt],i=>{let{selected:t,panel:e}=i.field(Yt);return!t||!e||t.from==t.to?R.none:R.set([lS.range(t.from,t.to)])}),Id(aS,{hideOn:sS}),dS];var Hm=typeof String.prototype.normalize==\"function\"?i=>i.normalize(\"NFKD\"):i=>i,ti=class{constructor(t,e,r=0,n=t.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=\"\",this.bufferPos=0,this.iter=t.iterRange(r,n),this.bufferStart=r,this.normalize=s?l=>s(Hm(l)):Hm,this.query=this.normalize(e)}peek(){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 dt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=vr(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=wt(t);let n=this.normalize(e);for(let s=0,o=r;;s++){let l=n.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==n.length-1){if(a)return this.value=a,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=\"\":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let r=this.curLineStart+e.index,n=r+e[0].length;if(this.matchPos=Xo(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||n.to<=e){let l=new i(e,t.sliceString(e,r));return Jh.set(t,l),l}if(n.from==e&&n.to==r)return n;let{text:s,from:o}=n;return o>e&&(s=t.sliceString(e,o)+s,o=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let r=this.flat.from+e.index,n=r+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this.matchPos=Xo(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Do.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<\"u\"&&(qo.prototype[Symbol.iterator]=Bo.prototype[Symbol.iterator]=function(){return this});function mS(i){try{return new RegExp(i,of),!0}catch{return!1}}function Xo(i,t){if(t>=i.length)return t;let e=i.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}function tf(i){let t=String(i.state.doc.lineAt(i.state.selection.main.head).number),e=z(\"input\",{class:\"cm-textfield\",name:\"line\",value:t}),r=z(\"form\",{class:\"cm-gotoLine\",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:Lo.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),n())},onsubmit:s=>{s.preventDefault(),n()}},z(\"label\",i.state.phrase(\"Go to line\"),\": \",e),\" \",z(\"button\",{class:\"cm-button\",type:\"submit\"},i.state.phrase(\"go\")));function n(){let s=/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:o}=i,l=o.doc.lineAt(o.selection.main.head),[,a,h,f,c]=s,u=f?+f.slice(1):0,d=h?+h:l.number;if(h&&c){let g=d/100;a&&(g=g*(a==\"-\"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a==\"-\"?-1:1)+l.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),O=b.cursor(m.from+Math.max(0,Math.min(u,m.length)));i.dispatch({effects:[Lo.of(!1),T.scrollIntoView(O.from,{y:\"center\"})],selection:O}),i.focus()}return{dom:r}}var Lo=M.define(),Um=it.define({create(){return!0},update(i,t){for(let e of t.effects)e.is(Lo)&&(i=e.value);return i},provide:i=>fi.from(i,t=>t?tf:null)}),gS=i=>{let t=ci(i,tf);if(!t){let e=[Lo.of(!0)];i.state.field(Um,!1)==null&&e.push(M.appendConfig.of([Um,OS])),i.dispatch({effects:e}),t=ci(i,tf)}return t&&t.dom.querySelector(\"input\").select(),!0},OS=T.baseTheme({\".cm-panel.cm-gotoLine\":{padding:\"2px 6px 4px\",\"& label\":{fontSize:\"80%\"}}}),xS={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tg=A.define({combine(i){return kt(i,xS,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}});function eg(i){let t=[vS,wS];return i&&t.push(tg.of(i)),t}var yS=R.mark({class:\"cm-selectionMatch\"}),bS=R.mark({class:\"cm-selectionMatch cm-selectionMatch-main\"});function jm(i,t,e,r){return(e==0||i(t.sliceDoc(e-1,e))!=F.Word)&&(r==t.doc.length||i(t.sliceDoc(r,r+1))!=F.Word)}function SS(i,t,e,r){return i(t.sliceDoc(e,e+1))==F.Word&&i(t.sliceDoc(r-1,r))==F.Word}var wS=ft.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=i.state.facet(tg),{state:e}=i,r=e.selection;if(r.ranges.length>1)return R.none;let n=r.main,s,o=null;if(n.empty){if(!t.highlightWordAroundCursor)return R.none;let a=e.wordAt(n.head);if(!a)return R.none;o=e.charCategorizer(n.head),s=e.sliceDoc(a.from,a.to)}else{let a=n.to-n.from;if(a200)return R.none;if(t.wholeWords){if(s=e.sliceDoc(n.from,n.to),o=e.charCategorizer(n.head),!(jm(o,e,n.from,n.to)&&SS(o,e,n.from,n.to)))return R.none}else if(s=e.sliceDoc(n.from,n.to),!s)return R.none}let l=[];for(let a of i.visibleRanges){let h=new ti(e.doc,s,a.from,a.to);for(;!h.next().done;){let{from:f,to:c}=h.value;if((!o||jm(o,e,f,c))&&(n.empty&&f<=n.from&&c>=n.to?l.push(bS.range(f,c)):(f>=n.to||c<=n.from)&&l.push(yS.range(f,c)),l.length>t.maxMatches))return R.none}}return R.set(l)}},{decorations:i=>i.decorations}),vS=T.baseTheme({\".cm-selectionMatch\":{backgroundColor:\"#99ff7780\"},\".cm-searchMatch .cm-selectionMatch\":{backgroundColor:\"transparent\"}}),kS=({state:i,dispatch:t})=>{let{selection:e}=i,r=b.create(e.ranges.map(n=>i.wordAt(n.head)||b.cursor(n.head)),e.mainIndex);return r.eq(e)?!1:(t(i.update({selection:r})),!0)};function TS(i,t){let{main:e,ranges:r}=i.selection,n=i.wordAt(e.head),s=n&&n.from==e.from&&n.to==e.to;for(let o=!1,l=new ti(i.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ti(i.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var PS=({state:i,dispatch:t})=>{let{ranges:e}=i.selection;if(e.some(s=>s.from===s.to))return kS({state:i,dispatch:t});let r=i.sliceDoc(e[0].from,e[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=r))return!1;let n=TS(i,r);return n?(t(i.update({selection:i.selection.addRange(b.range(n.from,n.to),!1),effects:T.scrollIntoView(n.to)})),!0):!1},rr=A.define({combine(i){return kt(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new sf(t),scrollToMatch:t=>T.scrollIntoView(t)})}});var Vo=class{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||\"\",this.valid=!!this.search&&(!this.regexp||mS(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\\\([nrt\\\\])/g,(e,r)=>r==\"n\"?`\n`:r==\"r\"?\"\\r\":r==\"t\"?\"\t\":\"\\\\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new rf(this):new ef(this)}getCursor(t,e=0,r){let n=t.doc?t:Y.create({doc:t});return r==null&&(r=n.doc.length),this.regexp?ir(this,n,e,r):er(this,n,e,r)}},Wo=class{constructor(t){this.spec=t}};function er(i,t,e,r){return new ti(t.doc,i.unquoted,e,r,i.caseSensitive?void 0:n=>n.toLowerCase(),i.wholeWord?CS(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function CS(i,t){return(e,r,n,s)=>((s>e||s+n.length=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=er(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function ir(i,t,e,r){return new qo(t.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?AS(t.charCategorizer(t.selection.main.head)):void 0},e,r)}function Io(i,t){return i.slice(at(i,t,!1),t)}function No(i,t){return i.slice(t,at(i,t))}function AS(i){return(t,e,r)=>!r[0].length||(i(Io(r.input,r.index))!=F.Word||i(No(r.input,r.index))!=F.Word)&&(i(No(r.input,r.index+r[0].length))!=F.Word||i(Io(r.input,r.index+r[0].length))!=F.Word)}var rf=class extends Wo{nextMatch(t,e,r){let n=ir(this.spec,t,r,t.doc.length).next();return n.done&&(n=ir(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,r){for(let n=1;;n++){let s=Math.max(e,r-n*1e4),o=ir(this.spec,t,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==e||l.from>s+10))return l;if(s==e)return null}}prevMatch(t,e,r){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\\$([$&\\d+])/g,(e,r)=>r==\"$\"?\"$\":r==\"&\"?t.match[0]:r!=\"0\"&&+r=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=ir(this.spec,t,Math.max(0,e-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},gn=M.define(),lf=M.define(),Je=it.define({create(i){return new mn(nf(i).create(),null)},update(i,t){for(let e of t.effects)e.is(gn)?i=new mn(e.value.create(),i.panel):e.is(lf)&&(i=new mn(i.query,e.value?af:null));return i},provide:i=>fi.from(i,t=>t.panel)});var mn=class{constructor(t,e){this.query=t,this.panel=e}},QS=R.mark({class:\"cm-searchMatch\"}),RS=R.mark({class:\"cm-searchMatch cm-searchMatch-selected\"}),MS=ft.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Je))}update(i){let t=i.state.field(Je);(t!=i.startState.field(Je)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:i,panel:t}){if(!t||!i.spec.valid)return R.none;let{view:e}=this,r=new Ee;for(let n=0,s=e.visibleRanges,o=s.length;ns[n+1].from-2*250;)a=s[++n].to;i.highlight(e.state,l,a,(h,f)=>{let c=e.state.selection.ranges.some(u=>u.from==h&&u.to==f);r.add(h,f,c?RS:QS)})}return r.finish()}},{decorations:i=>i.decorations});function On(i){return t=>{let e=t.state.field(Je,!1);return e&&e.query.spec.valid?i(t,e):ng(t)}}var Yo=On((i,{query:t})=>{let{to:e}=i.state.selection.main,r=t.nextMatch(i.state,e,e);if(!r)return!1;let n=b.single(r.from,r.to),s=i.state.facet(rr);return i.dispatch({selection:n,effects:[hf(i,r),s.scrollToMatch(n.main,i)],userEvent:\"select.search\"}),rg(i),!0}),zo=On((i,{query:t})=>{let{state:e}=i,{from:r}=e.selection.main,n=t.prevMatch(e,r,r);if(!n)return!1;let s=b.single(n.from,n.to),o=i.state.facet(rr);return i.dispatch({selection:s,effects:[hf(i,n),o.scrollToMatch(s.main,i)],userEvent:\"select.search\"}),rg(i),!0}),ES=On((i,{query:t})=>{let e=t.matchAll(i.state,1e3);return!e||!e.length?!1:(i.dispatch({selection:b.create(e.map(r=>b.range(r.from,r.to))),userEvent:\"select.search.matches\"}),!0)}),$S=({state:i,dispatch:t})=>{let e=i.selection;if(e.ranges.length>1||e.main.empty)return!1;let{from:r,to:n}=e.main,s=[],o=0;for(let l=new ti(i.doc,i.sliceDoc(r,n));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(b.range(l.value.from,l.value.to))}return t(i.update({selection:b.create(s,o),userEvent:\"select.search.matches\"})),!0},Km=On((i,{query:t})=>{let{state:e}=i,{from:r,to:n}=e.selection.main;if(e.readOnly)return!1;let s=t.nextMatch(e,r,r);if(!s)return!1;let o=[],l,a,h=[];if(s.from==r&&s.to==n&&(a=e.toText(t.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(e,s.from,s.to),h.push(T.announce.of(e.phrase(\"replaced match on line $\",e.doc.lineAt(r).number)+\".\"))),s){let f=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=b.single(s.from-f,s.to-f),h.push(hf(i,s)),h.push(e.facet(rr).scrollToMatch(l.main,i))}return i.dispatch({changes:o,selection:l,effects:h,userEvent:\"input.replace\"}),!0}),qS=On((i,{query:t})=>{if(i.state.readOnly)return!1;let e=t.matchAll(i.state,1e9).map(n=>{let{from:s,to:o}=n;return{from:s,to:o,insert:t.getReplacement(n)}});if(!e.length)return!1;let r=i.state.phrase(\"replaced $ matches\",e.length)+\".\";return i.dispatch({changes:e,effects:T.announce.of(r),userEvent:\"input.replace.all\"}),!0});function af(i){return i.state.facet(rr).createPanel(i)}function nf(i,t){var e,r,n,s,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?\"\":i.sliceDoc(l.from,l.to);if(t&&!a)return t;let h=i.facet(rr);return new Vo({search:((e=t?.literal)!==null&&e!==void 0?e:h.literal)?a:a.replace(/\\n/g,\"\\\\n\"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(n=t?.literal)!==null&&n!==void 0?n:h.literal,regexp:(s=t?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=t?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function ig(i){let t=ci(i,af);return t&&t.dom.querySelector(\"[main-field]\")}function rg(i){let t=ig(i);t&&t==i.root.activeElement&&t.select()}var ng=i=>{let t=i.state.field(Je,!1);if(t&&t.panel){let e=ig(i);if(e&&e!=i.root.activeElement){let r=nf(i.state,t.query.spec);r.valid&&i.dispatch({effects:gn.of(r)}),e.focus(),e.select()}}else i.dispatch({effects:[lf.of(!0),t?gn.of(nf(i.state,t.query.spec)):M.appendConfig.of(BS)]});return!0},sg=i=>{let t=i.state.field(Je,!1);if(!t||!t.panel)return!1;let e=ci(i,af);return e&&e.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:lf.of(!1)}),!0},Zo=[{key:\"Mod-f\",run:ng,scope:\"editor search-panel\"},{key:\"F3\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Mod-g\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Escape\",run:sg,scope:\"editor search-panel\"},{key:\"Mod-Shift-l\",run:$S},{key:\"Mod-Alt-g\",run:gS},{key:\"Mod-d\",run:PS,preventDefault:!0}],sf=class{constructor(t){this.view=t;let e=this.query=t.state.field(Je).query.spec;this.commit=this.commit.bind(this),this.searchField=z(\"input\",{value:e.search,placeholder:zt(t,\"Find\"),\"aria-label\":zt(t,\"Find\"),class:\"cm-textfield\",name:\"search\",form:\"\",\"main-field\":\"true\",onchange:this.commit,onkeyup:this.commit}),this.replaceField=z(\"input\",{value:e.replace,placeholder:zt(t,\"Replace\"),\"aria-label\":zt(t,\"Replace\"),class:\"cm-textfield\",name:\"replace\",form:\"\",onchange:this.commit,onkeyup:this.commit}),this.caseField=z(\"input\",{type:\"checkbox\",name:\"case\",form:\"\",checked:e.caseSensitive,onchange:this.commit}),this.reField=z(\"input\",{type:\"checkbox\",name:\"re\",form:\"\",checked:e.regexp,onchange:this.commit}),this.wordField=z(\"input\",{type:\"checkbox\",name:\"word\",form:\"\",checked:e.wholeWord,onchange:this.commit});function r(n,s,o){return z(\"button\",{class:\"cm-button\",name:n,onclick:s,type:\"button\"},o)}this.dom=z(\"div\",{onkeydown:n=>this.keydown(n),class:\"cm-search\"},[this.searchField,r(\"next\",()=>Yo(t),[zt(t,\"next\")]),r(\"prev\",()=>zo(t),[zt(t,\"previous\")]),r(\"select\",()=>ES(t),[zt(t,\"all\")]),z(\"label\",null,[this.caseField,zt(t,\"match case\")]),z(\"label\",null,[this.reField,zt(t,\"regexp\")]),z(\"label\",null,[this.wordField,zt(t,\"by word\")]),...t.state.readOnly?[]:[z(\"br\"),this.replaceField,r(\"replace\",()=>Km(t),[zt(t,\"replace\")]),r(\"replaceAll\",()=>qS(t),[zt(t,\"replace all\")])],z(\"button\",{name:\"close\",onclick:()=>sg(t),\"aria-label\":zt(t,\"close\"),type:\"button\"},[\"\\xD7\"])])}commit(){let t=new Vo({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:gn.of(t)}))}keydown(t){qd(this.view,t,\"search-panel\")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?zo:Yo)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Km(this.view))}update(t){for(let e of t.transactions)for(let r of e.effects)r.is(gn)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(rr).top}};function zt(i,t){return i.state.phrase(t)}var Eo=30,$o=/[\\s\\.,:;?!]/;function hf(i,{from:t,to:e}){let r=i.state.doc.lineAt(t),n=i.state.doc.lineAt(e).to,s=Math.max(r.from,t-Eo),o=Math.min(n,e+Eo),l=i.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;al.length-Eo;a--)if(!$o.test(l[a-1])&&$o.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${i.state.phrase(\"current match\")}. ${l} ${i.state.phrase(\"on line\")} ${r.number}.`)}var DS=T.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\"}}),BS=[Je,ie.low(MS),DS];var fc={};uO(fc,{VERSION:()=>Fo,after:()=>_f,all:()=>cl,allKeys:()=>he,any:()=>ul,assign:()=>ki,before:()=>qn,bind:()=>sl,bindAll:()=>Eg,chain:()=>Wf,chunk:()=>hc,clone:()=>Rf,collect:()=>Dt,compact:()=>nc,compose:()=>Ff,constant:()=>wn,contains:()=>Qt,countBy:()=>Lg,create:()=>Qf,debounce:()=>zf,default:()=>zg,defaults:()=>il,defer:()=>ll,delay:()=>ol,detect:()=>ur,difference:()=>pl,drop:()=>Ri,each:()=>xt,escape:()=>Ag,every:()=>cl,extend:()=>el,extendOwn:()=>ki,filter:()=>te,find:()=>ur,findIndex:()=>cr,findKey:()=>Dn,findLastIndex:()=>al,findWhere:()=>Gf,first:()=>zn,flatten:()=>sc,foldl:()=>fl,foldr:()=>Hf,forEach:()=>xt,functions:()=>ar,get:()=>Qn,groupBy:()=>Bg,has:()=>Ef,head:()=>zn,identity:()=>Pi,include:()=>Qt,includes:()=>Qt,indexBy:()=>Xg,indexOf:()=>hl,initial:()=>Yn,inject:()=>fl,intersection:()=>oc,invert:()=>Cn,invoke:()=>Dg,isArguments:()=>or,isArray:()=>$t,isArrayBuffer:()=>jo,isBoolean:()=>bn,isDataView:()=>Si,isDate:()=>dg,isElement:()=>xf,isEmpty:()=>wf,isEqual:()=>kf,isError:()=>mg,isFinite:()=>Sf,isFunction:()=>K,isMap:()=>kg,isMatch:()=>Pn,isNaN:()=>Sn,isNull:()=>Of,isNumber:()=>Ho,isObject:()=>At,isRegExp:()=>pg,isSet:()=>Pg,isString:()=>nr,isSymbol:()=>Uo,isTypedArray:()=>Jo,isUndefined:()=>yn,isWeakMap:()=>Tg,isWeakSet:()=>Cg,iteratee:()=>hr,keys:()=>X,last:()=>rc,lastIndexOf:()=>qg,map:()=>Dt,mapObject:()=>$f,matcher:()=>Qe,matches:()=>Qe,max:()=>Wn,memoize:()=>Nf,methods:()=>ar,min:()=>Kf,mixin:()=>Zn,negate:()=>Ai,noop:()=>Mn,now:()=>ei,object:()=>lc,omit:()=>Wg,once:()=>$g,pairs:()=>Af,partial:()=>ii,partition:()=>Vg,pick:()=>dl,pluck:()=>Qi,property:()=>Ci,propertyOf:()=>qf,random:()=>fr,range:()=>ac,reduce:()=>fl,reduceRight:()=>Hf,reject:()=>Uf,rest:()=>Ri,restArguments:()=>H,result:()=>Lf,sample:()=>Nn,select:()=>te,shuffle:()=>Jf,size:()=>ec,some:()=>ul,sortBy:()=>tc,sortedIndex:()=>Xn,tail:()=>Ri,take:()=>zn,tap:()=>Mf,template:()=>Xf,templateSettings:()=>Mg,throttle:()=>Yf,times:()=>Df,toArray:()=>In,toPath:()=>rl,transpose:()=>pr,unescape:()=>Rg,union:()=>Ng,uniq:()=>dr,unique:()=>dr,uniqueId:()=>Vf,unzip:()=>pr,values:()=>Zt,where:()=>jf,without:()=>Ig,wrap:()=>Zf,zip:()=>Yg});var Fo=\"1.13.6\",ff=typeof self==\"object\"&&self.self===self&&self||typeof global==\"object\"&&global.global===global&&global||Function(\"return this\")()||{},xn=Array.prototype,_o=Object.prototype,cf=typeof Symbol<\"u\"?Symbol.prototype:null,og=xn.push,Ae=xn.slice,Xe=_o.toString,lg=_o.hasOwnProperty,uf=typeof ArrayBuffer<\"u\",ag=typeof DataView<\"u\",hg=Array.isArray,df=Object.keys,pf=Object.create,mf=uf&&ArrayBuffer.isView,fg=isNaN,cg=isFinite,Go=!{toString:null}.propertyIsEnumerable(\"toString\"),gf=[\"valueOf\",\"isPrototypeOf\",\"toString\",\"propertyIsEnumerable\",\"hasOwnProperty\",\"toLocaleString\"],ug=Math.pow(2,53)-1;function H(i,t){return t=t==null?i.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),n=0;n=0&&e<=ug}}function kn(i){return function(t){return t?.[i]}}var wi=kn(\"byteLength\");var Og=vn(wi);var WS=/\\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\\]/;function IS(i){return mf?mf(i)&&!Si(i):Og(i)&&WS.test(Xe.call(i))}var Jo=uf?IS:wn(!1);var J=kn(\"length\");function NS(i){for(var t={},e=i.length,r=0;r\":\">\",'\"':\""\",\"'\":\"'\",\"`\":\"`\"};var Ag=En(nl);var Qg=Cn(nl);var Rg=En(Qg);var Mg=$.templateSettings={evaluate:/<%([\\s\\S]+?)%>/g,interpolate:/<%=([\\s\\S]+?)%>/g,escape:/<%-([\\s\\S]+?)%>/g};var Bf=/(.)^/,zS={\"'\":\"'\",\"\\\\\":\"\\\\\",\"\\r\":\"r\",\"\\n\":\"n\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},ZS=/\\\\|'|\\r|\\n|\\u2028|\\u2029/g;function FS(i){return\"\\\\\"+zS[i]}var _S=/^\\s*(\\w|\\$)+\\s*$/;function Xf(i,t,e){!t&&e&&(t=e),t=il({},t,$.templateSettings);var r=RegExp([(t.escape||Bf).source,(t.interpolate||Bf).source,(t.evaluate||Bf).source].join(\"|\")+\"|$\",\"g\"),n=0,s=\"__p+='\";i.replace(r,function(h,f,c,u,d){return s+=i.slice(n,d).replace(ZS,FS),n=d+h.length,f?s+=`'+\n((__t=(`+f+`))==null?'':_.escape(__t))+\n'`:c?s+=`'+\n((__t=(`+c+`))==null?'':__t)+\n'`:u&&(s+=`';\n`+u+`\n__p+='`),h}),s+=`';\n`;var o=t.variable;if(o){if(!_S.test(o))throw new Error(\"variable is not a bare identifier: \"+o)}else s=`with(obj||{}){\n`+s+`}\n`,o=\"obj\";s=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n`+s+`return __p;\n`;var l;try{l=new Function(o,\"_\",s)}catch(h){throw h.source=s,h}var a=function(h){return l.call(this,h,$)};return a.source=\"function(\"+o+`){\n`+s+\"}\",a}function Lf(i,t,e){t=fe(t);var r=t.length;if(!r)return K(e)?e.call(i):e;for(var n=0;n1)qt(l,t-1,e,r),n=r.length;else for(var a=0,h=l.length;at?(r&&(clearTimeout(r),r=null),l=f,o=i.apply(n,s),r||(n=s=null)):!r&&e.trailing!==!1&&(r=setTimeout(a,c)),o};return h.cancel=function(){clearTimeout(r),l=0,r=n=s=null},h}function zf(i,t,e){var r,n,s,o,l,a=function(){var f=ei()-n;t>f?r=setTimeout(a,t-f):(r=null,e||(o=i.apply(l,s)),r||(s=l=null))},h=H(function(f){return l=this,s=f,n=ei(),r||(r=setTimeout(a,t),e&&(o=i.apply(l,s))),o});return h.cancel=function(){clearTimeout(r),r=s=l=null},h}function Zf(i,t){return ii(t,i)}function Ai(i){return function(){return!i.apply(this,arguments)}}function Ff(){var i=arguments,t=i.length-1;return function(){for(var e=t,r=i[t].apply(this,arguments);e--;)r=i[e].call(this,r);return r}}function _f(i,t){return function(){if(--i<1)return t.apply(this,arguments)}}function qn(i,t){var e;return function(){return--i>0&&(e=t.apply(this,arguments)),i<=1&&(t=null),e}}var $g=ii(qn,2);function Dn(i,t,e){t=Z(t,e);for(var r=X(i),n,s=0,o=r.length;s0?0:n-1;s>=0&&s0?o=s>=0?s:Math.max(s+l,o):l=s>=0?Math.min(s+1,l):s+l+1;else if(e&&s&&l)return s=e(r,n),r[s]===n?s:-1;if(n!==n)return s=t(Ae.call(r,o,l),Sn),s>=0?s+o:-1;for(s=i>0?o:l-1;s>=0&&s0?0:l-1;for(s||(n=e[o?o[a]:a],a+=i);a>=0&&a=3;return t(e,ce(r,s,4),n,o)}}var fl=Vn(1);var Hf=Vn(-1);function te(i,t,e){var r=[];return t=Z(t,e),xt(i,function(n,s,o){t(n,s,o)&&r.push(n)}),r}function Uf(i,t,e){return te(i,Ai(Z(t)),e)}function cl(i,t,e){t=Z(t,e);for(var r=!tt(i)&&X(i),n=(r||i).length,s=0;s=0}var Dg=H(function(i,t,e){var r,n;return K(t)?n=t:(t=fe(t),r=t.slice(0,-1),t=t[t.length-1]),Dt(i,function(s){var o=n;if(!o){if(r&&r.length&&(s=Ti(s,r)),s==null)return;o=s[t]}return o==null?o:o.apply(s,e)})});function Qi(i,t){return Dt(i,Ci(t))}function jf(i,t){return te(i,Qe(t))}function Wn(i,t,e){var r=-1/0,n=-1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;lr&&(r=s)}else t=Z(t,e),xt(i,function(h,f,c){o=t(h,f,c),(o>n||o===-1/0&&r===-1/0)&&(r=h,n=o)});return r}function Kf(i,t,e){var r=1/0,n=1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;ll||o===void 0)return 1;if(o1&&(r=ce(r,t[1])),t=he(i)):(r=ic,t=qt(t,!1,!1),i=Object(i));for(var n=0,s=t.length;n1&&(r=t[1])):(t=Dt(qt(t,!1,!1),String),e=function(n,s){return!Qt(t,s)}),dl(i,e,r)});function Yn(i,t,e){return Ae.call(i,0,Math.max(0,i.length-(t==null||e?1:t)))}function zn(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[0]:Yn(i,i.length-t)}function Ri(i,t,e){return Ae.call(i,t==null||e?1:t)}function rc(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[i.length-1]:Ri(i,Math.max(0,i.length-t))}function nc(i){return te(i,Boolean)}function sc(i,t){return qt(i,t,!1)}var pl=H(function(i,t){return t=qt(t,!0,!0),te(i,function(e){return!Qt(t,e)})});var Ig=H(function(i,t){return pl(i,t)});function dr(i,t,e,r){bn(t)||(r=e,e=t,t=!1),e!=null&&(e=Z(e,r));for(var n=[],s=[],o=0,l=J(i);o ul > li[aria-selected]\":{backgroundColor:dc,color:gr}}},{dark:!0}),sw=ve.define([{tag:p.keyword,color:Re},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Fg},{tag:[p.variableName],color:Mi},{tag:[p.function(p.variableName)],color:Mi},{tag:[p.labelName],color:JS},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:Re},{tag:[p.definition(p.name),p.separator],color:ml},{tag:[p.brace],color:Mi},{tag:[p.annotation],color:Gg},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:uc},{tag:[p.typeName,p.className],color:cc},{tag:[p.operator,p.operatorKeyword],color:ml},{tag:[p.tagName],color:uc},{tag:[p.squareBracket],color:tw},{tag:[p.angleBracket],color:_g},{tag:[p.attributeName],color:cc},{tag:[p.regexp],color:Re},{tag:[p.quote],color:uc},{tag:[p.string],color:ml},{tag:p.link,color:ml,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Mi},{tag:[p.meta],color:Fg},{tag:[p.monospace],color:Fn,fontStyle:\"italic\"},{tag:[p.comment],color:gr,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:Re},{tag:p.emphasis,fontStyle:\"italic\",color:Re},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:Re},{tag:p.special(p.heading1),fontWeight:\"bold\",color:Re},{tag:p.heading1,fontWeight:\"bold\",color:Re},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Re},{tag:[p.heading5,p.heading6],color:Re},{tag:[p.atom,p.bool,p.special(p.variableName)],color:_g},{tag:[p.processingInstruction,p.inserted],color:Mi},{tag:[p.contentSeparator],color:cc},{tag:p.invalid,color:jg,borderBottom:`1px dotted ${Gg}`}]),Kg=[nw,Te(sw)];var Jg=\"#657b83\",wc=\"#586e75\",gc=\"#073642\",Gn=\"#002b36\",iO=\"#93a1a1\",ow=\"#fdf6e3\",gl=\"#dc322f\",lw=\"#cb4b16\",_n=\"#b58900\",Oc=\"#859900\",xc=\"#2aa198\",yc=\"#268bd2\",aw=\"#6c71c4\",Ol=\"#d33682\",tO=\"#d30102\",vc=\"#dfd9c8\",bc=vc,hw=ow,Sc=wc,fw=vc,eO=wc,cw=T.theme({\"&\":{color:Jg,backgroundColor:hw},\".cm-content\":{caretColor:eO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:eO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:fw},\".cm-panels\":{backgroundColor:vc,color:Gn},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:\"1px solid #457dff\"},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:\"#6199ff2f\"},\".cm-activeLine\":{backgroundColor:bc},\".cm-selectionMatch\":{backgroundColor:\"#aafe661a\"},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${iO}`},\".cm-gutters\":{backgroundColor:\"#00000010\",color:Jg,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:bc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Sc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Sc,borderBottomColor:Sc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:bc,color:Gn}}},{dark:!1}),uw=ve.define([{tag:p.keyword,color:Oc},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:xc},{tag:[p.variableName],color:yc},{tag:[p.function(p.variableName)],color:yc},{tag:[p.labelName],color:Ol},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:_n},{tag:[p.definition(p.name),p.separator],color:xc},{tag:[p.brace],color:Ol},{tag:[p.annotation],color:tO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:Ol},{tag:[p.typeName,p.className],color:lw},{tag:[p.operator,p.operatorKeyword],color:aw},{tag:[p.tagName],color:yc},{tag:[p.squareBracket],color:gl},{tag:[p.angleBracket],color:gc},{tag:[p.attributeName],color:iO},{tag:[p.regexp],color:tO},{tag:[p.quote],color:Oc},{tag:[p.string],color:_n},{tag:p.link,color:xc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:_n},{tag:[p.meta],color:gl},{tag:[p.comment],color:gc,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:wc},{tag:p.emphasis,fontStyle:\"italic\",color:Oc},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:_n},{tag:p.heading1,fontWeight:\"bold\",color:Gn},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Gn},{tag:[p.heading5,p.heading6],color:Gn},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Ol},{tag:[p.processingInstruction,p.inserted,p.contentSeparator],color:gl},{tag:[p.contentSeparator],color:_n},{tag:p.invalid,color:gc,borderBottom:`1px dotted ${gl}`}]),rO=[cw,Te(uw)];var nO=\"#2e3440\",Qc=\"#3b4252\",sO=\"#434c5e\",xl=\"#4c566a\",oO=\"#e5e9f0\",Ac=\"#eceff4\",kc=\"#8fbcbb\",lO=\"#88c0d0\",dw=\"#81a1c1\",ue=\"#5e81ac\",pw=\"#bf616a\",Or=\"#d08770\",Tc=\"#ebcb8b\",aO=\"#a3be8c\",mw=\"#b48ead\",hO=\"#d30102\",Rc=Ac,Pc=Rc,gw=\"#ffffff\",Cc=Qc,Ow=Rc,fO=Qc,xw=T.theme({\"&\":{color:nO,backgroundColor:gw},\".cm-content\":{caretColor:fO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:fO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:Ow},\".cm-panels\":{backgroundColor:Rc,color:xl},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:`1px solid ${xl}`},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:oO},\".cm-activeLine\":{backgroundColor:Pc},\".cm-selectionMatch\":{backgroundColor:oO},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${xl}`},\"&.cm-focused .cm-matchingBracket\":{backgroundColor:Ac},\".cm-gutters\":{backgroundColor:Ac,color:nO,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:Pc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Cc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Cc,borderBottomColor:Cc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:Pc,color:xl}}},{dark:!1}),yw=ve.define([{tag:p.keyword,color:ue},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Or},{tag:[p.variableName],color:Or},{tag:[p.function(p.variableName)],color:ue},{tag:[p.labelName],color:dw},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:ue},{tag:[p.definition(p.name),p.separator],color:aO},{tag:[p.brace],color:kc},{tag:[p.annotation],color:hO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:lO},{tag:[p.typeName,p.className],color:Tc},{tag:[p.operator,p.operatorKeyword],color:aO},{tag:[p.tagName],color:mw},{tag:[p.squareBracket],color:pw},{tag:[p.angleBracket],color:Or},{tag:[p.attributeName],color:Tc},{tag:[p.regexp],color:ue},{tag:[p.quote],color:Qc},{tag:[p.string],color:Or},{tag:p.link,color:kc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Or},{tag:[p.meta],color:lO},{tag:[p.comment],color:sO,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:ue},{tag:p.emphasis,fontStyle:\"italic\",color:ue},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:ue},{tag:p.special(p.heading1),fontWeight:\"bold\",color:ue},{tag:p.heading1,fontWeight:\"bold\",color:ue},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:ue},{tag:[p.heading5,p.heading6],color:ue},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Or},{tag:[p.processingInstruction,p.inserted],color:kc},{tag:[p.contentSeparator],color:Tc},{tag:p.invalid,color:sO,borderBottom:`1px dotted ${hO}`}]),Hn=[xw,Te(yw)];var hq={initialize({model:i}){},render({model:i,el:t}){var e=i.get(\"widget_instance_count_trait\");i.attributes={function_body_id:e};let r=\"\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "\n", - "function_body": "raise ValueError(\"Oops!\")\nreturn arr\n", - "function_name": "error", - "function_parameters": "arr", - "layout": "IPY_MODEL_891037a969c54382a0123c65b3adabe6", - "name": "", - "widget_instance_count_trait": "4" - } - }, - "effe3fb906cd470191c9a00672d7c9a0": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "height": "auto", - "width": "98%" - } - }, - "f2c6dcb313d54d8db9b39bc7b4dad23a": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-check-reset-cue-button" - ], - "description": "Check Code", - "layout": "IPY_MODEL_5fe8a519a49c416fa693ff86ee252925", - "style": "IPY_MODEL_f7d56249ca334f9aa9b0a2ba4317fc15", - "tooltip": null - } - }, - "f391d15811e44e1d9070f4a058117d85": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "f4b54904c3024b61ae89d491e5628917": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "f6f9b624ce05485aacfa38c6c69dd0d9": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_c841f0178b08416db75c78a926d433cb", - "IPY_MODEL_4e6e13dbf4e34a7e935d809814ce52eb" - ], - "layout": "IPY_MODEL_7540524adf724ddcbc40bf0e2c43fcde" - } - }, - "f7d56249ca334f9aa9b0a2ba4317fc15": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "fa01047fd83c4eef941430a987639762": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLModel", - "state": { - "_dom_classes": [ - "exercise-title" - ], - "layout": "IPY_MODEL_94e88484841a47eb908503ff0264ce2b", - "style": "IPY_MODEL_239befa2c282498884a71ff9d7f6b77d", - "value": "error" - } - }, - "fd84cedfaa694eaf8ac3b1d33a6974a7": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "fea9899ecd9b450e8027dd2c4bbe8fc7": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_99b4520ba0904061a468add1eeb34f53", - "IPY_MODEL_e88b13538696446f9c785444122ea9ae", - "IPY_MODEL_f6f9b624ce05485aacfa38c6c69dd0d9", - "IPY_MODEL_a5ec86bdafc546cbbff2dc4661ffe636" - ], - "layout": "IPY_MODEL_c5d05cb4e9df482da033b9558c420763" - } - } - }, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/src/conf.py b/docs/src/conf.py index b8c4bcb..1a122e8 100644 --- a/docs/src/conf.py +++ b/docs/src/conf.py @@ -10,19 +10,10 @@ "sphinx.ext.extlinks", "sphinx.ext.intersphinx", "sphinx.ext.viewcode", - # "sphinx.ext.inheritance_diagram", "sphinx.ext.mathjax", "nbsphinx", ] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ["_templates"] - -# nbsphinx_execute = "always" -nbsphinx_kernel_name = "python3" - - import sphinx_material html_theme = "sphinx_material" diff --git a/docs/src/exercises.ipynb b/docs/src/exercises.ipynb index d0049ab..86f6706 100644 --- a/docs/src/exercises.ipynb +++ b/docs/src/exercises.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "6fbb8ebf-4d6f-4ae3-bca5-ad26e89422fa", + "id": "0", "metadata": { "tags": [] }, @@ -12,16 +12,16 @@ }, { "cell_type": "markdown", - "id": "e42f618e-e6ca-4920-a2ec-c6df1802cff7", + "id": "1", "metadata": {}, "source": [ - "The scicode-widgets mainly offers a flexible code widget that allow" + "The scicode-widgets mainly offers a flexible code widget that allows instant feedback to evaluate the code for interactive plots." ] }, { "cell_type": "code", - "execution_count": 3, - "id": "73645116-1971-4d9f-b33b-62822ee49ac1", + "execution_count": 2, + "id": "2", "metadata": { "tags": [] }, @@ -31,6 +31,8 @@ " CodeExercise,\n", " CodeInput,\n", " CueFigure,\n", + " CueOutput,\n", + " CueObject,\n", " ExerciseRegistry,\n", " ParameterPanel,\n", " TextExercise,\n", @@ -43,7 +45,7 @@ }, { "cell_type": "markdown", - "id": "ddf8c428-e386-4670-a8fe-95575e119fcb", + "id": "3", "metadata": {}, "source": [ "## ExerciseRegistry to store and load answers to exercises" @@ -51,7 +53,7 @@ }, { "cell_type": "markdown", - "id": "6a81599c-4640-4a9d-9f88-b92a156b6210", + "id": "4", "metadata": {}, "source": [ "Due to limitations of jupyter notebooks in saving the widgets state, we store and load the widget state by ourself using the `ExerciseRegstry`. It allows you specify a filename for the json file to store all the answers to all registered exercises. The exercises are registered by passing the `ExerciseRegstry` instance as input argument." @@ -59,8 +61,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "407b5824-d02c-4170-8ac8-c4106a36fd11", + "execution_count": 5, + "id": "5", "metadata": { "tags": [] }, @@ -68,7 +70,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "129de08a7dfd438690a88788308f7ddf", + "model_id": "56f2c7c52fa8495597ef34b52dceef8f", "version_major": 2, "version_minor": 0 }, @@ -76,7 +78,7 @@ "ExerciseRegistry(children=(CssStyle(value='\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "Implements ridge regression\n\n:param x: An array of data points\n:param omega: The frequency", - "function_body": "import numpy as np\nreturn np.sin(x*omega)\n", - "function_name": "sin_", - "function_parameters": "x, omega", - "layout": "IPY_MODEL_f0f94576e78d44588a6221af5019b4f0", - "name": "", - "widget_instance_count_trait": "1" - } - }, - "e718b236a1ee45b0ac6e6c46169e4efa": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "justify_content": "flex-end" - } - }, - "e85c9a967dbd434ea823d2d6392177ef": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLMathModel", - "state": { - "_dom_classes": [ - "exercise-description" - ], - "layout": "IPY_MODEL_6d513b6c796046caa292d1f896fec951", - "style": "IPY_MODEL_22f1016395e3422a937451ec70f7eaab", - "value": "\nImplements a sinus function $\\sin(x\\omega)$.\n" - } - }, - "eaea9955608944289af0faafc0c66189": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "FloatSliderModel", - "state": { - "behavior": "drag-tap", - "description": "$\\omega$", - "layout": "IPY_MODEL_3f48d8f08f0d4672b734753f617d3f6d", - "max": 3.14, - "min": 0.5, - "step": 0.1, - "style": "IPY_MODEL_a9976e0b1b9846ffa64987562134d939", - "value": 2.2 - } - }, - "eb41f442cfbf4f4e9e2ac0cbd54d544f": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "ec1bffa999e5465ebc5e4e5879b9883b": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "ec56c3c39aad416297da49879d562a82": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "_dom_classes": [ - "scwidget-save-reset-cue-button--cue", - "scwidget-save-reset-cue-button" - ], - "description": "Save answer", - "layout": "IPY_MODEL_b0294646c50e4c4ab1a7d442ad69bc78", - "style": "IPY_MODEL_4b661ffe51224188bdd9dce7376fb99e", - "tooltip": null - } - }, - "ec9354d91011465ea6cc594f53051884": { - "model_module": "anywidget", - "model_module_version": "~0.9.*", - "model_name": "AnyModel", - "state": { - "_anywidget_id": "scwidgets.code._widget_code_input.CodeInput", - "_css": ".forced-indent{width:4em}.CodeMirror{border:1px solid #fff;height:auto}.CodeMirror.widget-code-input-signature{border-bottom:0px}.CodeMirror.widget-code-input-docstring,.CodeMirror.widget-code-input-body{border-top:0px}\n", - "_esm": "var cO=Object.defineProperty;var uO=(i,t)=>{for(var e in t)cO(i,e,{get:t[e],enumerable:!0})};var V=class i{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,r){[t,e]=Li(this,t,e);let n=[];return this.decompose(0,t,n,2),r.length&&r.decompose(0,r.length,n,3),this.decompose(e,this.length,n,1),qi.from(n,this.length-(e-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Li(this,t,e);let r=[];return this.decompose(t,e,r,0),qi.from(r,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),n=new oi(this),s=new oi(t);for(let o=e,l=e;;){if(n.next(o),s.next(o),o=0,n.lineBreak!=s.lineBreak||n.done!=s.done||n.value!=s.value)return!1;if(l+=n.value.length,n.done||l>=r)return!0}}iter(t=1){return new oi(this,t)}iterRange(t,e=this.length){return new ts(this,t,e)}iterLines(t,e){let r;if(t==null)r=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;r=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new es(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError(\"A document must have at least one line\");return t.length==1&&!t[0]?i.empty:t.length<=32?new Xt(t):qi.from(Xt.split(t,[]))}},Xt=class i extends V{constructor(t,e=dO(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.text[s],l=n+o.length;if((e?r:l)>=t)return new bl(n,l,r,o);n=l+1,r++}}decompose(t,e,r,n){let s=t<=0&&e>=this.length?this:new i(Ec(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=r.pop(),l=Jn(s.text,o.text.slice(),0,s.length);if(l.length<=32)r.push(new i(l,o.length+s.length));else{let a=l.length>>1;r.push(new i(l.slice(0,a)),new i(l.slice(a)))}}else r.push(s)}replace(t,e,r){if(!(r instanceof i))return super.replace(t,e,r);[t,e]=Li(this,t,e);let n=Jn(this.text,Jn(r.text,Ec(this.text,0,t)),e),s=this.length+r.length-(e-t);return n.length<=32?new i(n,s):qi.from(i.split(n,[]),s)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;s<=e&&ot&&o&&(n+=r),ts&&(n+=l.slice(Math.max(0,t-s),e-s)),s=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let r=[],n=-1;for(let s of t)r.push(s),n+=s.length+1,r.length==32&&(e.push(new i(r,n)),r=[],n=-1);return n>-1&&e.push(new i(r,n)),e}},qi=class i extends V{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,e,r,n){for(let s=0;;s++){let o=this.children[s],l=n+o.length,a=r+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,r,n);n=l+1,r=a+1}}decompose(t,e,r,n){for(let s=0,o=0;o<=e&&s=o){let h=n&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?r.push(l):l.decompose(t-o,e-o,r,h)}o=a+1}}replace(t,e,r){if([t,e]=Li(this,t,e),r.lines=s&&e<=l){let a=o.replace(t-s,e-s,r),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new i(f,this.length-(e-t)+r.length)}return super.replace(s,l,a)}s=l+1}return super.replace(t,e,r)}sliceString(t,e=this.length,r=`\n`){[t,e]=Li(this,t,e);let n=\"\";for(let s=0,o=0;st&&s&&(n+=r),to&&(n+=l.sliceString(t-o,e-o,r)),o=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof i))return 0;let r=0,[n,s,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,s+=e){if(n==o||s==l)return r;let a=this.children[n],h=t.children[s];if(a!=h)return r+a.scanIdentical(h,e);r+=a.length+1}}static from(t,e=t.reduce((r,n)=>r+n.length+1,-1)){let r=0;for(let d of t)r+=d.lines;if(r<32){let d=[];for(let m of t)m.flatten(d);return new Xt(d,e)}let n=Math.max(32,r>>5),s=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let m;if(d.lines>s&&d instanceof i)for(let O of d.children)c(O);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Xt&&a&&(m=f[f.length-1])instanceof Xt&&d.lines+m.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new Xt(m.text.concat(d.text),m.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:i.from(f,h)),h=-1,a=f.length=0)}for(let d of t)c(d);return u(),l.length==1?l[0]:new i(l,e)}};V.empty=new Xt([\"\"],0);function dO(i){let t=-1;for(let e of i)t+=e.length+1;return t}function Jn(i,t,e=0,r=1e9){for(let n=0,s=0,o=!0;s=e&&(a>r&&(l=l.slice(0,r-n)),n0?1:(t instanceof Xt?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,n=this.nodes[r],s=this.offsets[r],o=s>>1,l=n instanceof Xt?n.text.length:n.children.length;if(o==(e>0?l:0)){if(r==0)return this.done=!0,this.value=\"\",this;e>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(e>0?0:1)){if(this.offsets[r]+=e,t==0)return this.lineBreak=!0,this.value=`\n`,this;t--}else if(n instanceof Xt){let a=n.text[o+(e<0?-1:0)];if(this.offsets[r]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=n.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[r]+=e):(e<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof Xt?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},ts=class{constructor(t,e,r){this.value=\"\",this.done=!1,this.cursor=new oi(t,e>r?-1:1),this.pos=e>r?t.length:0,this.from=Math.min(e,r),this.to=Math.max(e,r)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value=\"\",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let r=e<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=r?n:e<0?n.slice(n.length-r):n.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=\"\"}},es=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value=\"\",this.done=!1}next(t=0){let{done:e,lineBreak:r,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value=\"\",this.afterBreak=!1):e?(this.done=!0,this.value=\"\"):r?this.afterBreak?this.value=\"\":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<\"u\"&&(V.prototype[Symbol.iterator]=function(){return this.iter()},oi.prototype[Symbol.iterator]=ts.prototype[Symbol.iterator]=es.prototype[Symbol.iterator]=function(){return this});var bl=class{constructor(t,e,r,n){this.from=t,this.to=e,this.number=r,this.text=n}get length(){return this.to-this.from}};function Li(i,t,e){return t=Math.max(0,Math.min(i.length,t)),[t,Math.max(t,Math.min(i.length,e))]}var Di=\"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(i=>i?parseInt(i,36):1);for(let i=1;ii)return Di[t-1]<=i;return!1}function $c(i){return i>=127462&&i<=127487}var qc=8205;function at(i,t,e=!0,r=!0){return(e?Wc:mO)(i,t,r)}function Wc(i,t,e){if(t==i.length)return t;t&&Ic(i.charCodeAt(t))&&Nc(i.charCodeAt(t-1))&&t--;let r=dt(i,t);for(t+=wt(r);t=0&&$c(dt(i,o));)s++,o-=2;if(s%2==0)break;t+=2}else break}return t}function mO(i,t,e){for(;t>0;){let r=Wc(i,t-2,e);if(r=56320&&i<57344}function Nc(i){return i>=55296&&i<56320}function dt(i,t){let e=i.charCodeAt(t);if(!Nc(e)||t+1==i.length)return e;let r=i.charCodeAt(t+1);return Ic(r)?(e-55296<<10)+(r-56320)+65536:e}function vr(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function wt(i){return i<65536?1:2}var Sl=/\\r\\n?|\\n/,ut=function(i){return i[i.Simple=0]=\"Simple\",i[i.TrackDel=1]=\"TrackDel\",i[i.TrackBefore=2]=\"TrackBefore\",i[i.TrackAfter=3]=\"TrackAfter\",i}(ut||(ut={})),Me=class i{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;et)return s+(t-n);s+=l}else{if(r!=ut.Simple&&h>=t&&(r==ut.TrackDel&&nt||r==ut.TrackBefore&&nt))return null;if(h>t||h==t&&e<0&&!l)return t==n||e<0?s:s+a;s+=a}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return s}touchesRange(t,e=t){for(let r=0,n=0;r=0&&n<=e&&l>=t)return ne?\"cover\":!0;n=l}return!1}toString(){let t=\"\";for(let e=0;e=0?\":\"+n:\"\")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=\"number\"))throw new RangeError(\"Invalid JSON representation of ChangeDesc\");return new i(t)}static create(t){return new i(t)}},vt=class i extends Me{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError(\"Applying change set to a document with the wrong length\");return wl(this,(e,r,n,s,o)=>t=t.replace(n,n+(r-e),o),!1),t}mapDesc(t,e=!1){return vl(this,t,e,!0)}invert(t){let e=this.sections.slice(),r=[];for(let n=0,s=0;n=0){e[n]=l,e[n+1]=o;let a=n>>1;for(;r.length0&&Ve(r,e,s.text),s.forward(f),l+=f}let h=t[o++];for(;l>1].toJSON()))}return t}static of(t,e,r){let n=[],s=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;ou||c<0||u>e)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${e})`);let m=d?typeof d==\"string\"?V.of(d.split(r||Sl)):d:V.empty,O=m.length;if(c==u&&O==0)return;co&&yt(n,c-o,-1),yt(n,u-c,O),Ve(s,n,m),o=u}}return h(t),a(!l),l}static empty(t){return new i(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError(\"Invalid JSON representation of ChangeSet\");let e=[],r=[];for(let n=0;nl&&typeof o!=\"string\"))throw new RangeError(\"Invalid JSON representation of ChangeSet\");if(s.length==1)e.push(s[0],0);else{for(;r.length=0&&e<=0&&e==i[n+1]?i[n]+=t:t==0&&i[n]==0?i[n+1]+=e:r?(i[n]+=t,i[n+1]+=e):i.push(t,e)}function Ve(i,t,e){if(e.length==0)return;let r=t.length-2>>1;if(r>1])),!(e||o==i.sections.length||i.sections[o+1]<0);)l=i.sections[o++],a=i.sections[o++];t(n,h,s,f,c),n=h,s=f}}}function vl(i,t,e,r=!1){let n=[],s=r?[]:null,o=new li(i),l=new li(t);for(let a=-1;;)if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);yt(n,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len=0&&a=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||r.length>h),s.forward2(a),o.forward(a)}}}}var li=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i>1;return e>=t.length?V.empty:t[e]}textBit(t){let{inserted:e}=this.set,r=this.i-2>>1;return r>=e.length&&!t?V.empty:e[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},$i=class i{constructor(t,e,r){this.from=t,this.to=e,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let r,n;return this.empty?r=n=t.mapPos(this.from,e):(r=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),r==this.from&&n==this.to?this:new i(r,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return b.range(t,e);let r=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return b.range(this.anchor,r)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!=\"number\"||typeof t.head!=\"number\")throw new RangeError(\"Invalid JSON representation for SelectionRange\");return b.range(t.anchor,t.head)}static create(t,e,r){return new i(t,e,r)}},b=class i{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:i.create(this.ranges.map(r=>r.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;rt.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=\"number\"||t.main>=t.ranges.length)throw new RangeError(\"Invalid JSON representation for EditorSelection\");return new i(t.ranges.map(e=>$i.fromJSON(e)),t.main)}static single(t,e=t){return new i([i.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError(\"A selection needs at least one range\");for(let r=0,n=0;nt?8:0)|s)}static normalized(t,e=0){let r=t[e];t.sort((n,s)=>n.from-s.from),e=t.indexOf(r);for(let n=1;ns.head?i.range(a,l):i.range(l,a))}}return new i(t,e)}};function zc(i,t){for(let e of i.ranges)if(e.to>t)throw new RangeError(\"Selection points outside of document\")}var $l=0,A=class i{constructor(t,e,r,n,s){this.combine=t,this.compareInput=e,this.compare=r,this.isStatic=n,this.id=$l++,this.default=t([]),this.extensions=typeof s==\"function\"?s(this):s}get reader(){return this}static define(t={}){return new i(t.combine||(e=>e),t.compareInput||((e,r)=>e===r),t.compare||(t.combine?(e,r)=>e===r:ql),!!t.static,t.enables)}of(t){return new Bi([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error(\"Can't compute a static facet\");return new Bi(t,this,2,e)}from(t,e){return e||(e=r=>r),this.compute([t],r=>e(r.field(t)))}};function ql(i,t){return i==t||i.length==t.length&&i.every((e,r)=>e===t[r])}var Bi=class{constructor(t,e,r,n){this.dependencies=t,this.facet=e,this.type=r,this.value=n,this.id=$l++}dynamicSlot(t){var e;let r=this.value,n=this.facet.compareInput,s=this.id,o=t[s]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c==\"doc\"?a=!0:c==\"selection\"?h=!0:((e=t[c.id])!==null&&e!==void 0?e:1)&1||f.push(t[c.id]);return{create(c){return c.values[o]=r(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||kl(c,f)){let d=r(c);if(l?!Dc(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,m=u.config.address[s];if(m!=null){let O=ns(u,m);if(this.dependencies.every(g=>g instanceof A?u.facet(g)===c.facet(g):g instanceof it?u.field(g,!1)==c.field(g,!1):!0)||(l?Dc(d=r(c),O,n):n(d=r(c),O)))return c.values[o]=O,0}else d=r(c);return c.values[o]=d,1}}}};function Dc(i,t,e){if(i.length!=t.length)return!1;for(let r=0;ri[a.id]),n=e.map(a=>a.type),s=r.filter(a=>!(a&1)),o=i[t.id]>>1;function l(a){let h=[];for(let f=0;fr===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Bc).find(r=>r.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:r=>(r.values[e]=this.create(r),1),update:(r,n)=>{let s=r.values[e],o=this.updateF(s,n);return this.compareF(s,o)?0:(r.values[e]=o,1)},reconfigure:(r,n)=>n.config.address[this.id]!=null?(r.values[e]=n.field(this),0):(r.values[e]=this.create(r),1)}}init(t){return[this,Bc.of({field:this,create:t})]}get extension(){return this}},ni={lowest:4,low:3,default:2,high:1,highest:0};function xr(i){return t=>new is(t,i)}var ie={highest:xr(ni.highest),high:xr(ni.high),default:xr(ni.default),low:xr(ni.low),lowest:xr(ni.lowest)},is=class{constructor(t,e){this.inner=t,this.prec=e}},pe=class i{of(t){return new br(this,t)}reconfigure(t){return i.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},br=class{constructor(t,e){this.compartment=t,this.inner=e}},rs=class i{constructor(t,e,r,n,s,o){for(this.base=t,this.compartments=e,this.dynamicSlots=r,this.address=n,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(t,e,r){let n=[],s=Object.create(null),o=new Map;for(let u of OO(t,e,o))u instanceof it?n.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=r?.config.facets;for(let u in s){let d=s[u],m=d[0].facet,O=f&&f[u]||[];if(d.every(g=>g.type==0))if(l[m.id]=a.length<<1|1,ql(O,d))a.push(r.facet(m));else{let g=m.combine(d.map(x=>x.value));a.push(r&&m.compare(g,r.facet(m))?r.facet(m):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(x=>g.dynamicSlot(x)));l[m.id]=h.length<<1,h.push(g=>gO(g,m,d))}}let c=h.map(u=>u(l));return new i(t,o,c,l,a,s)}};function OO(i,t,e){let r=[[],[],[],[],[]],n=new Map;function s(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=r[a].indexOf(o);h>-1&&r[a].splice(h,1),o instanceof br&&e.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof br){if(e.has(o.compartment))throw new RangeError(\"Duplicate use of compartment in extensions\");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),s(h,l)}else if(o instanceof is)s(o.inner,o.prec);else if(o instanceof it)r[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof Bi)r[l].push(o),o.facet.extensions&&s(o.facet.extensions,ni.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(i,ni.default),r.reduce((o,l)=>o.concat(l))}function yr(i,t){if(t&1)return 2;let e=t>>1,r=i.status[e];if(r==4)throw new Error(\"Cyclic dependency between fields and/or facets\");if(r&2)return r;i.status[e]=4;let n=i.computeSlot(i,i.config.dynamicSlots[e]);return i.status[e]=2|n}function ns(i,t){return t&1?i.config.staticValues[t>>1]:i.values[t>>1]}var Zc=A.define(),Tl=A.define({combine:i=>i.some(t=>t),static:!0}),Fc=A.define({combine:i=>i.length?i[0]:void 0,static:!0}),_c=A.define(),Gc=A.define(),Hc=A.define(),Uc=A.define({combine:i=>i.length?i[0]:!1}),Et=class{constructor(t,e){this.type=t,this.value=e}static define(){return new Pl}},Pl=class{of(t){return new Et(this,t)}},Cl=class{constructor(t){this.map=t}of(t){return new M(this,t)}},M=class i{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new i(this.type,e)}is(t){return this.type==t}static define(t={}){return new Cl(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let r=[];for(let n of t){let s=n.map(e);s&&r.push(s)}return r}};M.reconfigure=M.define();M.appendConfig=M.define();var lt=class i{constructor(t,e,r,n,s,o){this.startState=t,this.changes=e,this.selection=r,this.effects=n,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,r&&zc(r,e.newLength),s.some(l=>l.type==i.time)||(this.annotations=s.concat(i.time.of(Date.now())))}static create(t,e,r,n,s,o){return new i(t,e,r,n,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(i.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]==\".\"))}};lt.time=Et.define();lt.userEvent=Et.define();lt.addToHistory=Et.define();lt.remote=Et.define();function xO(i,t){let e=[];for(let r=0,n=0;;){let s,o;if(r=i[r]))s=i[r++],o=i[r++];else if(n=0;n--){let s=r[n](i);s instanceof lt?i=s:Array.isArray(s)&&s.length==1&&s[0]instanceof lt?i=s[0]:i=Kc(t,Xi(s),!1)}return i}function bO(i){let t=i.startState,e=t.facet(Hc),r=i;for(let n=e.length-1;n>=0;n--){let s=e[n](i);s&&Object.keys(s).length&&(r=jc(r,Al(t,s,i.changes.newLength),!0))}return r==i?i:lt.create(t,i.changes,i.selection,r.effects,r.annotations,r.scrollIntoView)}var SO=[];function Xi(i){return i==null?SO:Array.isArray(i)?i:[i]}var F=function(i){return i[i.Word=0]=\"Word\",i[i.Space=1]=\"Space\",i[i.Other=2]=\"Other\",i}(F||(F={})),wO=/[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/,Ql;try{Ql=new RegExp(\"[\\\\p{Alphabetic}\\\\p{Number}_]\",\"u\")}catch{}function vO(i){if(Ql)return Ql.test(i);for(let t=0;t\"\\x80\"&&(e.toUpperCase()!=e.toLowerCase()||wO.test(e)))return!0}return!1}function kO(i){return t=>{if(!/\\S/.test(t))return F.Space;if(vO(t))return F.Word;for(let e=0;e-1)return F.Word;return F.Other}}var Y=class i{constructor(t,e,r,n,s,o){this.config=t,this.doc=e,this.selection=r,this.values=n,this.status=t.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;ln.set(h,a)),e=null),n.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(e=null,r=l.value):l.is(M.appendConfig)&&(e=null,r=Xi(r).concat(l.value));let s;e?s=t.startState.values.slice():(e=rs.resolve(r,n,this),s=new i(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(Tl)?t.newSelection:t.newSelection.asSingle();new i(e,t.newDoc,o,s,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t==\"string\"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:b.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,r=t(e.ranges[0]),n=this.changes(r.changes),s=[r.range],o=Xi(r.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return i.create({doc:t.doc,selection:b.fromJSON(t.selection),extensions:e.extensions?n.concat([e.extensions]):n})}static create(t={}){let e=rs.resolve(t.extensions||[],new Map),r=t.doc instanceof V?t.doc:V.of((t.doc||\"\").split(e.staticFacet(i.lineSeparator)||Sl)),n=t.selection?t.selection instanceof b?t.selection:b.single(t.selection.anchor,t.selection.head):b.single(0);return zc(n,r.length),e.staticFacet(Tl)||(n=n.asSingle()),new i(e,r,n,e.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(i.tabSize)}get lineBreak(){return this.facet(i.lineSeparator)||`\n`}get readOnly(){return this.facet(Uc)}phrase(t,...e){for(let r of this.facet(i.phrases))if(Object.prototype.hasOwnProperty.call(r,t)){t=r[t];break}return e.length&&(t=t.replace(/\\$(\\$|\\d*)/g,(r,n)=>{if(n==\"$\")return\"$\";let s=+(n||1);return!s||s>e.length?r:e[s-1]})),t}languageDataAt(t,e,r=-1){let n=[];for(let s of this.facet(Zc))for(let o of s(this,e,r))Object.prototype.hasOwnProperty.call(o,t)&&n.push(o[t]);return n}charCategorizer(t){return kO(this.languageDataAt(\"wordChars\",t).join(\"\"))}wordAt(t){let{text:e,from:r,length:n}=this.doc.lineAt(t),s=this.charCategorizer(t),o=t-r,l=t-r;for(;o>0;){let a=at(e,o,!1);if(s(e.slice(a,o))!=F.Word)break;o=a}for(;li.length?i[0]:4});Y.lineSeparator=Fc;Y.readOnly=Uc;Y.phrases=A.define({compare(i,t){let e=Object.keys(i),r=Object.keys(t);return e.length==r.length&&e.every(n=>i[n]==t[n])}});Y.languageData=Zc;Y.changeFilter=_c;Y.transactionFilter=Gc;Y.transactionExtender=Hc;pe.reconfigure=M.define();function kt(i,t,e={}){let r={};for(let n of i)for(let s of Object.keys(n)){let o=n[s],l=r[s];if(l===void 0)r[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,s))r[s]=e[s](l,o);else throw new Error(\"Config merge conflict for field \"+s)}for(let n in t)r[n]===void 0&&(r[n]=t[n]);return r}var ee=class{eq(t){return this==t}range(t,e=t){return Sr.create(t,e,this)}};ee.prototype.startSide=ee.prototype.endSide=0;ee.prototype.point=!1;ee.prototype.mapMode=ut.TrackDel;var Sr=class i{constructor(t,e,r){this.from=t,this.to=e,this.value=r}static create(t,e,r){return new i(t,e,r)}};function Rl(i,t){return i.from-t.from||i.value.startSide-t.value.startSide}var Ml=class i{constructor(t,e,r,n){this.from=t,this.to=e,this.value=r,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,r,n=0){let s=r?this.to:this.from;for(let o=n,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-t||(r?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,r,n){for(let s=this.findIndex(e,-1e9,!0),o=this.findIndex(r,1e9,!1,s);sd||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),r.push(h),n.push(u-o),s.push(d-o))}return{mapped:r.length?new i(n,s,r,l):null,pos:o}}},_=class i{constructor(t,e,r,n){this.chunkPos=t,this.chunk=e,this.nextLayer=r,this.maxPoint=n}static create(t,e,r,n){return new i(t,e,r,n)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:r=!1,filterFrom:n=0,filterTo:s=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(r&&(e=e.slice().sort(Rl)),this.isEmpty)return e.length?i.of(e):this;let l=new ss(this,null,-1).goto(0),a=0,h=[],f=new Ee;for(;l.value||a=0){let c=e[a++];f.addInner(c.from,c.to,c.value)||h.push(c)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&t<=s+o.length&&o.between(s,t-s,e-s,r)===!1)return}this.nextLayer.between(t,e,r)}}iter(t=0){return wr.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return wr.from(t).goto(e)}static compare(t,e,r,n,s=-1){let o=t.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),l=e.filter(c=>c.maxPoint>0||!c.isEmpty&&c.maxPoint>=s),a=Xc(o,l,r),h=new si(o,a,s),f=new si(l,a,s);r.iterGaps((c,u,d)=>Lc(h,c,f,u,d,n)),r.empty&&r.length==0&&Lc(h,0,f,0,0,n)}static eq(t,e,r=0,n){n==null&&(n=999999999);let s=t.filter(f=>!f.isEmpty&&e.indexOf(f)<0),o=e.filter(f=>!f.isEmpty&&t.indexOf(f)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Xc(s,o),a=new si(s,l,0).goto(r),h=new si(o,l,0).goto(r);for(;;){if(a.to!=h.to||!El(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>n)return!0;a.next(),h.next()}}static spans(t,e,r,n,s=-1){let o=new si(t,null,s).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,r);if(o.point){let f=o.activeForPoint(o.to),c=o.pointFroml&&(n.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>r)return a+(o.point&&o.to>r?1:0);l=o.to,o.next()}}static of(t,e=!1){let r=new Ee;for(let n of t instanceof Sr?[t]:e?TO(t):t)r.add(n.from,n.to,n.value);return r.finish()}static join(t){if(!t.length)return i.empty;let e=t[t.length-1];for(let r=t.length-2;r>=0;r--)for(let n=t[r];n!=i.empty;n=n.nextLayer)e=new i(n.chunkPos,n.chunk,e,Math.max(n.maxPoint,e.maxPoint));return e}};_.empty=new _([],[],null,-1);function TO(i){if(i.length>1)for(let t=i[0],e=1;e0)return i.slice().sort(Rl);t=r}return i}_.empty.nextLayer=_.empty;var Ee=class i{finishChunk(t){this.chunks.push(new Ml(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,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,r){this.addInner(t,e,r)||(this.nextLayer||(this.nextLayer=new i)).add(t,e,r)}addInner(t,e,r){let n=t-this.lastTo||r.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error(\"Ranges must be added sorted by `from` position and `startSide`\");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=r,this.lastFrom=t,this.lastTo=e,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let r=e.value.length-1;return this.last=e.value[r],this.lastFrom=e.from[r]+t,this.lastTo=e.to[r]+t,!0}finish(){return this.finishInner(_.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=_.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};function Xc(i,t,e){let r=new Map;for(let s of i)for(let o=0;o=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&n.push(new ss(o,e,r,s));return n.length==1?n[0]:new i(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let r of this.heap)r.goto(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);return this.next(),this}forward(t,e){for(let r of this.heap)r.forward(t,e);for(let r=this.heap.length>>1;r>=0;r--)yl(this.heap,r);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),yl(this.heap,0)}}};function yl(i,t){for(let e=i[t];;){let r=(t<<1)+1;if(r>=i.length)break;let n=i[r];if(r+1=0&&(n=i[r+1],r++),e.compare(n)<0)break;i[r]=e,i[t]=n,t=r}}var si=class{constructor(t,e,r){this.minPoint=r,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=wr.from(t,e,r)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){jn(this.active,t),jn(this.activeTo,t),jn(this.activeRank,t),this.minActive=Vc(this.active,this.activeTo)}addActive(t){let e=0,{value:r,to:n,rank:s}=this.cursor;for(;e0;)e++;Kn(this.active,e,r),Kn(this.activeTo,e,n),Kn(this.activeRank,e,s),t&&Kn(t,e,this.cursor.from),this.minActive=Vc(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),r&&jn(r,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(r),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from=0&&r[n]=0&&!(this.activeRank[r]t||this.activeTo[r]==t&&this.active[r].endSide>=this.point.endSide)&&e.push(this.active[r]);return e.reverse()}openEnd(t){let e=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>t;r--)e++;return e}};function Lc(i,t,e,r,n,s){i.goto(t),e.goto(r);let o=r+n,l=r,a=r-t;for(;;){let h=i.to+a-e.to||i.endSide-e.endSide,f=h<0?i.to+a:e.to,c=Math.min(f,o);if(i.point||e.point?i.point&&e.point&&(i.point==e.point||i.point.eq(e.point))&&El(i.activeForPoint(i.to),e.activeForPoint(e.to))||s.comparePoint(l,c,i.point,e.point):c>l&&!El(i.active,e.active)&&s.compareRange(l,c,i.active,e.active),f>o)break;l=f,h<=0&&i.next(),h>=0&&e.next()}}function El(i,t){if(i.length!=t.length)return!1;for(let e=0;e=t;r--)i[r+1]=i[r];i[t]=e}function Vc(i,t){let e=-1,r=1e9;for(let n=0;n=t)return n;if(n==i.length)break;s+=i.charCodeAt(n)==9?e-s%e:1,n=at(i,n)}return r===!0?-1:i.length}var Dl=\"\\u037C\",Jc=typeof Symbol>\"u\"?\"__\"+Dl:Symbol.for(Dl),Bl=typeof Symbol>\"u\"?\"__styleSet\"+Math.floor(Math.random()*1e8):Symbol(\"styleSet\"),tu=typeof globalThis<\"u\"?globalThis:typeof window<\"u\"?window:{},Gt=class{constructor(t,e){this.rules=[];let{finish:r}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\\s*/)}function s(o,l,a,h){let f=[],c=/^@(\\w+)\\b/.exec(o[0]),u=c&&c[1]==\"keyframes\";if(c&&l==null)return a.push(o[0]+\";\");for(let d in l){let m=l[d];if(/&/.test(d))s(d.split(/,\\s*/).map(O=>o.map(g=>O.replace(/&/,g))).reduce((O,g)=>O.concat(g)),m,a);else if(m&&typeof m==\"object\"){if(!c)throw new RangeError(\"The value of a property (\"+d+\") should be a primitive value.\");s(n(d),m,f,u)}else m!=null&&f.push(d.replace(/_.*/,\"\").replace(/[A-Z]/g,O=>\"-\"+O.toLowerCase())+\": \"+m+\";\")}(f.length||u)&&a.push((r&&!c&&!h?o.map(r):o).join(\", \")+\" {\"+f.join(\" \")+\"}\")}for(let o in t)s(n(o),t[o],this.rules)}getRules(){return this.rules.join(`\n`)}static newName(){let t=tu[Jc]||1;return tu[Jc]=t+1,Dl+t.toString(36)}static mount(t,e,r){let n=t[Bl],s=r&&r.nonce;n?s&&n.setNonce(s):n=new Xl(t,s),n.mount(Array.isArray(e)?e:[e])}},eu=new Map,Xl=class{constructor(t,e){let r=t.ownerDocument||t,n=r.defaultView;if(!t.head&&t.adoptedStyleSheets&&n.CSSStyleSheet){let s=eu.get(r);if(s)return t.adoptedStyleSheets=[s.sheet,...t.adoptedStyleSheets],t[Bl]=s;this.sheet=new n.CSSStyleSheet,t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets],eu.set(r,this)}else{this.styleTag=r.createElement(\"style\"),e&&this.styleTag.setAttribute(\"nonce\",e);let s=t.head||t;s.insertBefore(this.styleTag,s.firstChild)}this.modules=[],t[Bl]=this}mount(t){let e=this.sheet,r=0,n=0;for(let s=0;s-1&&(this.modules.splice(l,1),n--,l=-1),l==-1){if(this.modules.splice(n++,0,o),e)for(let a=0;a\",191:\"?\",192:\"~\",219:\"{\",220:\"|\",221:\"}\",222:'\"'},PO=typeof navigator<\"u\"&&/Mac/.test(navigator.platform),CO=typeof navigator<\"u\"&&/MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);for(ht=0;ht<10;ht++)$e[48+ht]=$e[96+ht]=String(ht);var ht;for(ht=1;ht<=24;ht++)$e[ht+111]=\"F\"+ht;var ht;for(ht=65;ht<=90;ht++)$e[ht]=String.fromCharCode(ht+32),Vi[ht]=String.fromCharCode(ht);var ht;for(ls in $e)Vi.hasOwnProperty(ls)||(Vi[ls]=$e[ls]);var ls;function iu(i){var t=PO&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||CO&&i.shiftKey&&i.key&&i.key.length==1||i.key==\"Unidentified\",e=!t&&i.key||(i.shiftKey?Vi:$e)[i.keyCode]||i.key||\"Unidentified\";return e==\"Esc\"&&(e=\"Escape\"),e==\"Del\"&&(e=\"Delete\"),e==\"Left\"&&(e=\"ArrowLeft\"),e==\"Up\"&&(e=\"ArrowUp\"),e==\"Right\"&&(e=\"ArrowRight\"),e==\"Down\"&&(e=\"ArrowDown\"),e}function Ss(i){let t;return i.nodeType==11?t=i.getSelection?i:i.ownerDocument:t=i,t.getSelection()}function Zl(i,t){return t?i==t||i.contains(t.nodeType!=1?t.parentNode:t):!1}function AO(i){let t=i.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function Os(i,t){if(!t.anchorNode)return!1;try{return Zl(i,t.anchorNode)}catch{return!1}}function Xr(i){return i.nodeType==3?ai(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Rr(i,t,e,r){return e?ru(i,t,e,r,-1)||ru(i,t,e,r,1):!1}function Lr(i){for(var t=0;;t++)if(i=i.previousSibling,!i)return t}function ru(i,t,e,r,n){for(;;){if(i==e&&t==r)return!0;if(t==(n<0?0:qe(i))){if(i.nodeName==\"DIV\")return!1;let s=i.parentNode;if(!s||s.nodeType!=1)return!1;t=Lr(i)+(n<0?0:1),i=s}else if(i.nodeType==1){if(i=i.childNodes[t+(n<0?-1:0)],i.nodeType==1&&i.contentEditable==\"false\")return!1;t=n<0?qe(i):0}else return!1}}function qe(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function Aa(i,t){let e=t?i.left:i.right;return{left:e,right:e,top:i.top,bottom:i.bottom}}function QO(i){return{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Iu(i,t){let e=t.width/i.offsetWidth,r=t.height/i.offsetHeight;return(e>.995&&e<1.005||!isFinite(e)||Math.abs(t.width-i.offsetWidth)<1)&&(e=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-i.offsetHeight)<1)&&(r=1),{scaleX:e,scaleY:r}}function RO(i,t,e,r,n,s,o,l){let a=i.ownerDocument,h=a.defaultView||window;for(let f=i,c=!1;f&&!c;)if(f.nodeType==1){let u,d=f==a.body,m=1,O=1;if(d)u=QO(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(c=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let S=f.getBoundingClientRect();({scaleX:m,scaleY:O}=Iu(f,S)),u={left:S.left,right:S.left+f.clientWidth*m,top:S.top,bottom:S.top+f.clientHeight*O}}let g=0,x=0;if(n==\"nearest\")t.top0&&t.bottom>u.bottom+x&&(x=t.bottom-u.bottom+x+o)):t.bottom>u.bottom&&(x=t.bottom-u.bottom+o,e<0&&t.top-x0&&t.right>u.right+g&&(g=t.right-u.right+g+s)):t.right>u.right&&(g=t.right-u.right+s,e<0&&t.lefte.clientHeight||e.scrollWidth>e.clientWidth)return e;e=e.assignedSlot||e.parentNode}else if(e.nodeType==11)e=e.host;else break;return null}var Fl=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(t){return this.anchorNode==t.anchorNode&&this.anchorOffset==t.anchorOffset&&this.focusNode==t.focusNode&&this.focusOffset==t.focusOffset}setRange(t){let{anchorNode:e,focusNode:r}=t;this.set(e,Math.min(t.anchorOffset,e?qe(e):0),r,Math.min(t.focusOffset,r?qe(r):0))}set(t,e,r,n){this.anchorNode=t,this.anchorOffset=e,this.focusNode=r,this.focusOffset=n}},Wi=null;function Nu(i){if(i.setActive)return i.setActive();if(Wi)return i.focus(Wi);let t=[];for(let e=i;e&&(t.push(e,e.scrollTop,e.scrollLeft),e!=e.ownerDocument);e=e.parentNode);if(i.focus(Wi==null?{get preventScroll(){return Wi={preventScroll:!0},!0}}:void 0),!Wi){Wi=!1;for(let e=0;eMath.max(1,i.scrollHeight-i.clientHeight-4)}var Tt=class i{constructor(t,e,r=!0){this.node=t,this.offset=e,this.precise=r}static before(t,e){return new i(t.parentNode,Lr(t),e)}static after(t,e){return new i(t.parentNode,Lr(t)+1,e)}},Qa=[],rt=class i{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(t){let e=this.posAtStart;for(let r of this.children){if(r==t)return e;e+=r.length+r.breakAfter}throw new RangeError(\"Invalid child in posBefore\")}posAfter(t){return this.posBefore(t)+t.length}sync(t,e){if(this.flags&2){let r=this.dom,n=null,s;for(let o of this.children){if(o.flags&7){if(!o.dom&&(s=n?n.nextSibling:r.firstChild)){let l=i.get(s);(!l||!l.parent&&l.canReuseDOM(o))&&o.reuseDOM(s)}o.sync(t,e),o.flags&=-8}if(s=n?n.nextSibling:r.firstChild,e&&!e.written&&e.node==r&&s!=o.dom&&(e.written=!0),o.dom.parentNode==r)for(;s&&s!=o.dom;)s=su(s);else r.insertBefore(o.dom,s);n=o.dom}for(s=n?n.nextSibling:r.firstChild,s&&e&&e.node==r&&(e.written=!0);s;)s=su(s)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(t,e),r.flags&=-8)}reuseDOM(t){}localPosFromDOM(t,e){let r;if(t==this.dom)r=this.dom.childNodes[e];else{let n=qe(t)==0?0:e==0?-1:1;for(;;){let s=t.parentNode;if(s==this.dom)break;n==0&&s.firstChild!=s.lastChild&&(t==s.firstChild?n=-1:n=1),t=s}n<0?r=t:r=t.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!i.get(r);)r=r.nextSibling;if(!r)return this.length;for(let n=0,s=0;;n++){let o=this.children[n];if(o.dom==r)return s;s+=o.length+o.breakAfter}}domBoundsAround(t,e,r=0){let n=-1,s=-1,o=-1,l=-1;for(let a=0,h=r,f=r;ae)return c.domBoundsAround(t,e,h);if(u>=t&&n==-1&&(n=a,s=h),h>e&&c.dom.parentNode==this.dom){o=a,l=f;break}f=u,h=u+c.breakAfter}return{from:s,to:l<0?r+this.length:l,startDOM:(n?this.children[n-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:o=0?this.children[o].dom:null}}markDirty(t=!1){this.flags|=2,this.markParentsDirty(t)}markParentsDirty(t){for(let e=this.parent;e;e=e.parent){if(t&&(e.flags|=2),e.flags&1)return;e.flags|=1,t=!1}}setParent(t){this.parent!=t&&(this.parent=t,this.flags&7&&this.markParentsDirty(!0))}setDOM(t){this.dom!=t&&(this.dom&&(this.dom.cmView=null),this.dom=t,t.cmView=this)}get rootView(){for(let t=this;;){let e=t.parent;if(!e)return t;t=e}}replaceChildren(t,e,r=Qa){this.markDirty();for(let n=t;nthis.pos||t==this.pos&&(e>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=t-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function Zu(i,t,e,r,n,s,o,l,a){let{children:h}=i,f=h.length?h[t]:null,c=s.length?s[s.length-1]:null,u=c?c.breakAfter:o;if(!(t==r&&f&&!o&&!u&&s.length<2&&f.merge(e,n,s.length?c:null,e==0,l,a))){if(r0&&(!o&&s.length&&f.merge(e,f.length,s[0],!1,l,0)?f.breakAfter=s.shift().breakAfter:(e2),Q={mac:au||/Mac/.test(Lt.platform),windows:/Win/.test(Lt.platform),linux:/Linux|X11/.test(Lt.platform),ie:Bs,ie_version:_u?_l.documentMode||6:Hl?+Hl[1]:Gl?+Gl[1]:0,gecko:ou,gecko_version:ou?+(/Firefox\\/(\\d+)/.exec(Lt.userAgent)||[0,0])[1]:0,chrome:!!Ll,chrome_version:Ll?+Ll[1]:0,ios:au,android:/Android\\b/.test(Lt.userAgent),webkit:lu,safari:Gu,webkit_version:lu?+(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:_l.documentElement.style.tabSize!=null?\"tab-size\":\"-moz-tab-size\"},qO=256,Ye=class i extends rt{constructor(t){super(),this.text=t}get length(){return this.text.length}createDOM(t){this.setDOM(t||document.createTextNode(this.text))}sync(t,e){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text)}reuseDOM(t){t.nodeType==3&&this.createDOM(t)}merge(t,e,r){return this.flags&8||r&&(!(r instanceof i)||this.length-(e-t)+r.length>qO||r.flags&8)?!1:(this.text=this.text.slice(0,t)+(r?r.text:\"\")+this.text.slice(e),this.markDirty(),!0)}split(t){let e=new i(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),e.flags|=this.flags&8,e}localPosFromDOM(t,e){return t==this.dom?e:e?this.text.length:0}domAtPos(t){return new Tt(this.dom,t)}domBoundsAround(t,e,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(t,e){return DO(this.dom,t,e)}},ze=class i extends rt{constructor(t,e=[],r=0){super(),this.mark=t,this.children=e,this.length=r;for(let n of e)n.setParent(this)}setAttrs(t){if(Yu(t),this.mark.class&&(t.className=this.mark.class),this.mark.attrs)for(let e in this.mark.attrs)t.setAttribute(e,this.mark.attrs[e]);return t}canReuseDOM(t){return super.canReuseDOM(t)&&!((this.flags|t.flags)&8)}reuseDOM(t){t.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(t),this.flags|=6)}sync(t,e){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(t,e)}merge(t,e,r,n,s,o){return r&&(!(r instanceof i&&r.mark.eq(this.mark))||t&&s<=0||et&&e.push(r=t&&(n=s),r=a,s++}let o=this.length-t;return this.length=t,n>-1&&(this.children.length=n,this.markDirty()),new i(this.mark,e,o)}domAtPos(t){return Hu(this,t)}coordsAt(t,e){return ju(this,t,e)}};function DO(i,t,e){let r=i.nodeValue.length;t>r&&(t=r);let n=t,s=t,o=0;t==0&&e<0||t==r&&e>=0?Q.chrome||Q.gecko||(t?(n--,o=1):s=0)?0:l.length-1];return Q.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?Aa(a,o<0):a||null}var Vr=class i extends rt{static create(t,e,r){return new i(t,e,r)}constructor(t,e,r){super(),this.widget=t,this.length=e,this.side=r,this.prevWidget=null}split(t){let e=i.create(this.widget,this.length-t,this.side);return this.length-=t,e}sync(t){(!this.dom||!this.widget.updateDOM(this.dom,t))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(t)),this.widget.editable||(this.dom.contentEditable=\"false\"))}getSide(){return this.side}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0)?Tt.before(this.dom):Tt.after(this.dom,t==this.length)}domBoundsAround(){return null}coordsAt(t,e){let r=this.widget.coordsAt(this.dom,t,e);if(r)return r;let n=this.dom.getClientRects(),s=null;if(!n.length)return null;let o=this.side?this.side<0:t>0;for(let l=o?n.length-1:0;s=n[l],!(t>0?l==0:l==n.length-1||s.top0?Tt.before(this.dom):Tt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(t){return this.dom.getBoundingClientRect()}get overrideDOMText(){return V.empty}get isHidden(){return!0}};Ye.prototype.children=Vr.prototype.children=Wr.prototype.children=Qa;function Hu(i,t){let e=i.dom,{children:r}=i,n=0;for(let s=0;ns&&t0;s--){let o=r[s-1];if(o.dom.parentNode==e)return o.domAtPos(o.length)}for(let s=n;s0&&t instanceof ze&&n.length&&(r=n[n.length-1])instanceof ze&&r.mark.eq(t.mark)?Uu(r,t.children[0],e-1):(n.push(t),t.setParent(i)),i.length+=t.length}function ju(i,t,e){let r=null,n=-1,s=null,o=-1;function l(h,f){for(let c=0,u=0;c=f&&(d.children.length?l(d,f-u):(!s||s.isHidden&&e>0)&&(m>f||u==m&&d.getSide()>0)?(s=d,o=f-u):(u-1?1:0)!=n.length-(e&&n.indexOf(e)>-1?1:0))return!1;for(let s of r)if(s!=e&&(n.indexOf(s)==-1||i[s]!==t[s]))return!1;return!0}function jl(i,t,e){let r=!1;if(t)for(let n in t)e&&n in e||(r=!0,n==\"style\"?i.style.cssText=\"\":i.removeAttribute(n));if(e)for(let n in e)t&&t[n]==e[n]||(r=!0,n==\"style\"?i.style.cssText=e[n]:i.setAttribute(n,e[n]));return r}function XO(i){let t=Object.create(null);for(let e=0;e0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,e}transferDOM(t){this.dom&&(this.markDirty(),t.setDOM(this.dom),t.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(t){Ra(this.attrs,t)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=t)}append(t,e){Uu(this,t,e)}addLineDeco(t){let e=t.spec.attributes,r=t.spec.class;e&&(this.attrs=Ul(e,this.attrs||{})),r&&(this.attrs=Ul({class:r},this.attrs||{}))}domAtPos(t){return Hu(this,t)}reuseDOM(t){t.nodeName==\"DIV\"&&(this.setDOM(t),this.flags|=6)}sync(t,e){var r;this.dom?this.flags&4&&(Yu(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),this.prevAttrs!==void 0&&(jl(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add(\"cm-line\"),this.prevAttrs=void 0),super.sync(t,e);let n=this.dom.lastChild;for(;n&&rt.get(n)instanceof ze;)n=n.lastChild;if(!n||!this.length||n.nodeName!=\"BR\"&&((r=rt.get(n))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(s=>s instanceof Ye))){let s=document.createElement(\"BR\");s.cmIgnore=!0,this.dom.appendChild(s)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let t=0,e;for(let r of this.children){if(!(r instanceof Ye)||/[^ -~]/.test(r.text))return null;let n=Xr(r.dom);if(n.length!=1)return null;t+=n[0].width,e=n[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(t,e){let r=ju(this,t,e);if(!this.children.length&&r&&this.parent){let{heightOracle:n}=this.parent.view.viewState,s=r.bottom-r.top;if(Math.abs(s-n.lineHeight)<2&&n.textHeight=e){if(s instanceof i)return s;if(o>e)break}n=o+s.breakAfter}return null}},Zi=class i extends rt{constructor(t,e,r){super(),this.widget=t,this.length=e,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(t,e,r,n,s,o){return r&&(!(r instanceof i)||!this.widget.compare(r.widget)||t>0&&s<=0||e0}},Ut=class{eq(t){return!1}updateDOM(t,e){return!1}compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(t){return!0}coordsAt(t,e,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(t){}},Pt=function(i){return i[i.Text=0]=\"Text\",i[i.WidgetBefore=1]=\"WidgetBefore\",i[i.WidgetAfter=2]=\"WidgetAfter\",i[i.WidgetRange=3]=\"WidgetRange\",i}(Pt||(Pt={})),R=class extends ee{constructor(t,e,r,n){super(),this.startSide=t,this.endSide=e,this.widget=r,this.spec=n}get heightRelevant(){return!1}static mark(t){return new Ir(t)}static widget(t){let e=Math.max(-1e4,Math.min(1e4,t.side||0)),r=!!t.block;return e+=r&&!t.inlineOrder?e>0?3e8:-4e8:e>0?1e8:-1e8,new Ze(t,e,e,r,t.widget||null,!1)}static replace(t){let e=!!t.block,r,n;if(t.isBlockGap)r=-5e8,n=4e8;else{let{start:s,end:o}=Ku(t,e);r=(s?e?-3e8:-1:5e8)-1,n=(o?e?2e8:1:-6e8)+1}return new Ze(t,r,n,e,t.widget||null,!0)}static line(t){return new Nr(t)}static set(t,e=!1){return _.of(t,e)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};R.none=_.empty;var Ir=class i extends R{constructor(t){let{start:e,end:r}=Ku(t);super(e?-1:5e8,r?1:-6e8,null,t),this.tagName=t.tagName||\"span\",this.class=t.class||\"\",this.attrs=t.attributes||null}eq(t){var e,r;return this==t||t instanceof i&&this.tagName==t.tagName&&(this.class||((e=this.attrs)===null||e===void 0?void 0:e.class))==(t.class||((r=t.attrs)===null||r===void 0?void 0:r.class))&&Ra(this.attrs,t.attrs,\"class\")}range(t,e=t){if(t>=e)throw new RangeError(\"Mark decorations may not be empty\");return super.range(t,e)}};Ir.prototype.point=!1;var Nr=class i extends R{constructor(t){super(-2e8,-2e8,null,t)}eq(t){return t instanceof i&&this.spec.class==t.spec.class&&Ra(this.spec.attributes,t.spec.attributes)}range(t,e=t){if(e!=t)throw new RangeError(\"Line decoration ranges must be zero-length\");return super.range(t,e)}};Nr.prototype.mapMode=ut.TrackBefore;Nr.prototype.point=!0;var Ze=class i extends R{constructor(t,e,r,n,s,o){super(e,r,s,t),this.block=n,this.isReplace=o,this.mapMode=n?e<=0?ut.TrackBefore:ut.TrackAfter:ut.TrackDel}get type(){return this.startSide!=this.endSide?Pt.WidgetRange:this.startSide<=0?Pt.WidgetBefore:Pt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof i&&LO(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(t,e=t){if(this.isReplace&&(t>e||t==e&&this.startSide>0&&this.endSide<=0))throw new RangeError(\"Invalid range for replacement decoration\");if(!this.isReplace&&e!=t)throw new RangeError(\"Widget decorations can only have zero-length ranges\");return super.range(t,e)}};Ze.prototype.point=!0;function Ku(i,t=!1){let{inclusiveStart:e,inclusiveEnd:r}=i;return e==null&&(e=i.inclusive),r==null&&(r=i.inclusive),{start:e??t,end:r??t}}function LO(i,t){return i==t||!!(i&&t&&i.compare(t))}function Kl(i,t,e,r=0){let n=e.length-1;n>=0&&e[n]+r>=i?e[n]=Math.max(e[n],t):e.push(i,t)}var Mr=class i{constructor(t,e,r,n){this.doc=t,this.pos=e,this.end=r,this.disallowBlockEffectsFor=n,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=t.iter(),this.skip=e}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let t=this.content[this.content.length-1];return!(t.breakAfter||t instanceof Zi&&t.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new mt),this.atCursorPos=!0),this.curLine}flushBuffer(t=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(as(new Wr(-1),t),t.length),this.pendingBuffer=0)}addBlockWidget(t){this.flushBuffer(),this.curLine=null,this.content.push(t)}finish(t){this.pendingBuffer&&t<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(t&&this.content.length&&this.content[this.content.length-1]instanceof Zi)&&this.getLine()}buildText(t,e,r){for(;t>0;){if(this.textOff==this.text.length){let{value:s,lineBreak:o,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)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,t--;continue}else this.text=s,this.textOff=0}let n=Math.min(this.text.length-this.textOff,t,512);this.flushBuffer(e.slice(e.length-r)),this.getLine().append(as(new Ye(this.text.slice(this.textOff,this.textOff+n)),e),r),this.atCursorPos=!0,this.textOff+=n,t-=n,r=0}}span(t,e,r,n){this.buildText(e-t,r,n),this.pos=e,this.openStart<0&&(this.openStart=n)}point(t,e,r,n,s,o){if(this.disallowBlockEffectsFor[o]&&r instanceof Ze){if(r.block)throw new RangeError(\"Block decorations may not be specified via plugins\");if(e>this.doc.lineAt(this.pos).to)throw new RangeError(\"Decorations that replace line breaks may not be specified via plugins\")}let l=e-t;if(r instanceof Ze)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Zi(r.widget||new vs(\"div\"),l,r));else{let a=Vr.create(r.widget||new vs(\"span\"),l,l?0:r.startSide),h=this.atCursorPos&&!a.isEditable&&s<=n.length&&(t0),f=!a.isEditable&&(tn.length||r.startSide<=0),c=this.getLine();this.pendingBuffer==2&&!h&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(n),h&&(c.append(as(new Wr(1),n),s),s=n.length+Math.max(0,s-n.length)),c.append(as(a,n),s),this.atCursorPos=f,this.pendingBuffer=f?tn.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=n.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text=\"\",this.textOff=0),this.pos=e),this.openStart<0&&(this.openStart=s)}static build(t,e,r,n,s){let o=new i(t,e,r,s);return o.openEnd=_.spans(n,e,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function as(i,t){for(let e of t)i=new ze(e,[i],i.length);return i}var vs=class extends Ut{constructor(t){super(),this.tag=t}eq(t){return t.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(t){return t.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},G=function(i){return i[i.LTR=0]=\"LTR\",i[i.RTL=1]=\"RTL\",i}(G||(G={})),hi=G.LTR,Ma=G.RTL;function Ju(i){let t=[];for(let e=0;e=e){if(l.level==r)return o;(s<0||(n!=0?n<0?l.frome:t[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError(\"Index out of range\");return s}};function ed(i,t){if(i.length!=t.length)return!1;for(let e=0;e=0;O-=3)if(me[O+1]==-d){let g=me[O+2],x=g&2?n:g&4?g&1?s:n:0;x&&(j[c]=j[me[O]]=x),l=O;break}}else{if(me.length==189)break;me[l++]=c,me[l++]=u,me[l++]=a}else if((m=j[c])==2||m==1){let O=m==n;a=O?0:1;for(let g=l-3;g>=0;g-=3){let x=me[g+2];if(x&2)break;if(O)me[g+2]|=2;else{if(x&4)break;me[g+2]|=4}}}}}function zO(i,t,e,r){for(let n=0,s=r;n<=e.length;n++){let o=n?e[n-1].to:i,l=na;)m==g&&(m=e[--O].from,g=O?e[O-1].to:i),j[--m]=d;a=f}else s=h,a++}}}function ta(i,t,e,r,n,s,o){let l=r%2?2:1;if(r%2==n%2)for(let a=t,h=0;aa&&o.push(new Oe(a,O.from,d));let g=O.direction==hi!=!(d%2);ea(i,g?r+1:r,n,O.inner,O.from,O.to,o),a=O.to}m=O.to}else{if(m==e||(f?j[m]!=l:j[m]==l))break;m++}u?ta(i,a,m,r+1,n,u,o):at;){let f=!0,c=!1;if(!h||a>s[h-1].to){let O=j[a-1];O!=l&&(f=!1,c=O==16)}let u=!f&&l==1?[]:null,d=f?r:r+1,m=a;t:for(;;)if(h&&m==s[h-1].to){if(c)break t;let O=s[--h];if(!f)for(let g=O.from,x=h;;){if(g==t)break t;if(x&&s[x-1].to==g)g=s[--x].from;else{if(j[g-1]==l)break t;break}}if(u)u.push(O);else{O.toj.length;)j[j.length]=256;let r=[],n=t==hi?0:1;return ea(i,n,n,e,0,i.length,r),r}function id(i){return[new Oe(0,i,0)]}var rd=\"\";function FO(i,t,e,r,n){var s;let o=r.head-i.from,l=Oe.find(t,o,(s=r.bidiLevel)!==null&&s!==void 0?s:-1,r.assoc),a=t[l],h=a.side(n,e);if(o==h){let u=l+=n?1:-1;if(u<0||u>=t.length)return null;a=t[l=u],o=a.side(!n,e),h=a.side(n,e)}let f=at(i.text,o,a.forward(n,e));(fa.to)&&(f=h),rd=i.text.slice(Math.min(o,f),Math.max(o,f));let c=l==(n?t.length-1:0)?null:t[l+(n?1:-1)];return c&&f==h&&c.level+(n?0:1)i.some(t=>t)}),cd=A.define({combine:i=>i.some(t=>t)}),Er=class i{constructor(t,e=\"nearest\",r=\"nearest\",n=5,s=5,o=!1){this.range=t,this.y=e,this.x=r,this.yMargin=n,this.xMargin=s,this.isSnapshot=o}map(t){return t.empty?this:new i(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new i(b.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},hs=M.define({map:(i,t)=>i.map(t)});function Ct(i,t,e){let r=i.facet(ld);r.length?r[0](t):window.onerror?window.onerror(String(t),e,void 0,void 0,t):e?console.error(e+\":\",t):console.error(t)}var Xs=A.define({combine:i=>i.length?i[0]:!0}),GO=0,Tr=A.define(),ft=class i{constructor(t,e,r,n,s){this.id=t,this.create=e,this.domEventHandlers=r,this.domEventObservers=n,this.extension=s(this)}static define(t,e){let{eventHandlers:r,eventObservers:n,provide:s,decorations:o}=e||{};return new i(GO++,t,r,n,l=>{let a=[Tr.of(l)];return o&&a.push(Yr.of(h=>{let f=h.plugin(l);return f?o(f):R.none})),s&&a.push(s(l)),a})}static fromClass(t,e){return i.define(r=>new t(r),e)}},$r=class{constructor(t){this.spec=t,this.mustUpdate=null,this.value=null}update(t){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(r){if(Ct(e.state,r,\"CodeMirror plugin crashed\"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(t)}catch(e){Ct(t.state,e,\"CodeMirror plugin crashed\"),this.deactivate()}return this}destroy(t){var e;if(!((e=this.value)===null||e===void 0)&&e.destroy)try{this.value.destroy()}catch(r){Ct(t.state,r,\"CodeMirror plugin crashed\")}}deactivate(){this.spec=this.value=null}},ud=A.define(),Ea=A.define(),Yr=A.define(),dd=A.define(),$a=A.define(),pd=A.define();function fu(i,t){let e=i.state.facet(pd);if(!e.length)return e;let r=e.map(s=>s instanceof Function?s(i):s),n=[];return _.spans(r,t.from,t.to,{point(){},span(s,o,l,a){let h=s-t.from,f=o-t.from,c=n;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,m;if(d==null&&(d=_O(t.text,h,f)),a>0&&c.length&&(m=c[c.length-1]).to==h&&m.direction==d)m.to=f,c=m.inner;else{let O={from:h,to:f,direction:d,inner:[]};c.push(O),c=O.inner}}}}),n}var md=A.define();function gd(i){let t=0,e=0,r=0,n=0;for(let s of i.state.facet(md)){let o=s(i);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(e=Math.max(e,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(n=Math.max(n,o.bottom)))}return{left:t,right:e,top:r,bottom:n}}var Pr=A.define(),xe=class i{constructor(t,e,r,n){this.fromA=t,this.toA=e,this.fromB=r,this.toB=n}join(t){return new i(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(t){let e=t.length,r=this;for(;e>0;e--){let n=t[e-1];if(!(n.fromA>r.toA)){if(n.toAf)break;s+=2}if(!a)return r;new i(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),o=a.toA,l=a.toB}}},ks=class i{constructor(t,e,r){this.view=t,this.state=e,this.transactions=r,this.flags=0,this.startState=t.state,this.changes=vt.empty(this.startState.doc.length);for(let s of r)this.changes=this.changes.compose(s.changes);let n=[];this.changes.iterChangedRanges((s,o,l,a)=>n.push(new xe(s,o,l,a))),this.changedRanges=n}static create(t,e,r){return new i(t,e,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(t=>t.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Ts=class extends rt{get length(){return this.view.state.doc.length}constructor(t){super(),this.view=t,this.decorations=[],this.dynamicDecorationMap=[],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(t.contentDOM),this.children=[new mt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new xe(0,0,0,t.state.doc.length)],0,null)}update(t){var e;let r=t.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=t.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=t.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let n=-1;this.view.inputState.composing>=0&&(!((e=this.domChanged)===null||e===void 0)&&e.newSel?n=this.domChanged.newSel.head:!e0(t.changes,this.hasComposition)&&!t.selectionSet&&(n=t.state.selection.main.head));let s=n>-1?UO(this.view,t.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new xe(h,f,t.changes.mapPos(h,-1),t.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(Q.ie||Q.chrome)&&!s&&t&&t.state.doc.lines!=t.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.updateDeco(),a=JO(o,l,t.changes);return r=xe.extendWithRanges(r,a),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,t.startState.doc.length,s),t.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(t,e,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(t,e,r);let{observer:n}=this.view;n.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+\"px\",this.dom.style.flexBasis=this.minWidth?this.minWidth+\"px\":\"\";let o=Q.chrome||Q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,o),this.flags&=-8,o&&(o.written||n.selectionRange.focusNode!=o.node)&&(this.forceSelection=!0),this.dom.style.height=\"\"}),this.markedForComposition.forEach(o=>o.flags&=-9);let s=[];if(this.view.viewport.from||this.view.viewport.to=0?n[o]:null;if(!l)break;let{fromA:a,toA:h,fromB:f,toB:c}=l,u,d,m,O;if(r&&r.range.fromBf){let v=Mr.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),y=Mr.build(this.view.state.doc,r.range.toB,c,this.decorations,this.dynamicDecorationMap);d=v.breakAtStart,m=v.openStart,O=y.openEnd;let k=this.compositionView(r);y.breakAtStart?k.breakAfter=1:y.content.length&&k.merge(k.length,k.length,y.content[0],!1,y.openStart,0)&&(k.breakAfter=y.content[0].breakAfter,y.content.shift()),v.content.length&&k.merge(0,0,v.content[v.content.length-1],!0,0,v.openEnd)&&v.content.pop(),u=v.content.concat(k).concat(y.content)}else({content:u,breakAtStart:d,openStart:m,openEnd:O}=Mr.build(this.view.state.doc,f,c,this.decorations,this.dynamicDecorationMap));let{i:g,off:x}=s.findPos(h,1),{i:S,off:C}=s.findPos(a,-1);Zu(this,S,C,g,x,u,d,m,O)}r&&this.fixCompositionDOM(r)}compositionView(t){let e=new Ye(t.text.nodeValue);e.flags|=8;for(let{deco:n}of t.marks)e=new ze(n,[e],e.length);let r=new mt;return r.append(e,0),r}fixCompositionDOM(t){let e=(s,o)=>{o.flags|=8|(o.children.some(a=>a.flags&7)?1:0),this.markedForComposition.add(o);let l=rt.get(s);l&&l!=o&&(l.dom=null),o.setDOM(s)},r=this.childPos(t.range.fromB,1),n=this.children[r.i];e(t.line,n);for(let s=t.marks.length-1;s>=-1;s--)r=n.childPos(r.off,1),n=n.children[r.i],e(s>=0?t.marks[s].node:t.text,n)}updateSelection(t=!1,e=!1){(t||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,n=r==this.dom,s=!n&&Os(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(n||e||s))return;let o=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?a:this.moveToLine(this.domAtPos(l.head));if(Q.gecko&&l.empty&&!this.hasComposition&&HO(a)){let c=document.createTextNode(\"\");this.view.observer.ignore(()=>a.node.insertBefore(c,a.node.childNodes[a.offset]||null)),a=h=new Tt(c,0),o=!0}let f=this.view.observer.selectionRange;(o||!f.focusNode||(!Rr(a.node,a.offset,f.anchorNode,f.anchorOffset)||!Rr(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(f.focusNode)&&t0(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let c=Ss(this.view.root);if(c)if(l.empty){if(Q.gecko){let u=jO(a.node,a.offset);if(u&&u!=3){let d=xd(a.node,a.offset,u==1?1:-1);d&&(a=new Tt(d.node,d.offset))}}c.collapse(a.node,a.offset),l.bidiLevel!=null&&c.caretBidiLevel!==void 0&&(c.caretBidiLevel=l.bidiLevel)}else if(c.extend){c.collapse(a.node,a.offset);try{c.extend(h.node,h.offset)}catch{}}else{let u=document.createRange();l.anchor>l.head&&([a,h]=[h,a]),u.setEnd(h.node,h.offset),u.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(u)}s&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,h)),this.impreciseAnchor=a.precise?null:new Tt(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Tt(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(t,e){return this.hasComposition&&e.empty&&Rr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)&&this.posFromDOM(t.focusNode,t.focusOffset)==e.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:t}=this,e=t.state.selection.main,r=Ss(t.root),{anchorNode:n,anchorOffset:s}=t.observer.selectionRange;if(!r||!e.empty||!e.assoc||!r.modify)return;let o=mt.find(this,e.head);if(!o)return;let l=o.posAtStart;if(e.head==l||e.head==l+o.length)return;let a=this.coordsAt(e.head,-1),h=this.coordsAt(e.head,1);if(!a||!h||a.bottom>h.top)return;let f=this.domAtPos(e.head+e.assoc);r.collapse(f.node,f.offset),r.modify(\"move\",e.assoc<0?\"forward\":\"backward\",\"lineboundary\"),t.observer.readSelectionRange();let c=t.observer.selectionRange;t.docView.posFromDOM(c.anchorNode,c.anchorOffset)!=e.from&&r.collapse(n,s)}moveToLine(t){let e=this.dom,r;if(t.node!=e)return t;for(let n=t.offset;!r&&n=0;n--){let s=rt.get(e.childNodes[n]);s instanceof mt&&(r=s.domAtPos(s.length))}return r?new Tt(r.node,r.offset,!0):t}nearest(t){for(let e=t;e;){let r=rt.get(e);if(r&&r.rootView==this)return r;e=e.parentNode}return null}posFromDOM(t,e){let r=this.nearest(t);if(!r)throw new RangeError(\"Trying to find position for a DOM position outside of the document\");return r.localPosFromDOM(t,e)+r.posAtStart}domAtPos(t){let{i:e,off:r}=this.childCursor().findPos(t,-1);for(;e=0;o--){let l=this.children[o],a=s-l.breakAfter,h=a-l.length;if(at||l.covers(1))&&(!r||l instanceof mt&&!(r instanceof mt&&e>=0))&&(r=l,n=h),s=h}return r?r.coordsAt(t-n,e):null}coordsForChar(t){let{i:e,off:r}=this.childPos(t,1),n=this.children[e];if(!(n instanceof mt))return null;for(;n.children.length;){let{i:l,off:a}=n.childPos(r,1);for(;;l++){if(l==n.children.length)return null;if((n=n.children[l]).length)break}r=a}if(!(n instanceof Ye))return null;let s=at(n.text,r);if(s==r)return null;let o=ai(n.dom,r,s).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==G.LTR;for(let h=0,f=0;fn)break;if(h>=r){let d=c.dom.getBoundingClientRect();if(e.push(d.height),o){let m=c.dom.lastChild,O=m?Xr(m):[];if(O.length){let g=O[O.length-1],x=a?g.right-d.left:d.right-g.left;x>l&&(l=x,this.minWidth=s,this.minWidthFrom=h,this.minWidthTo=u)}}}h=u+c.breakAfter}return e}textDirectionAt(t){let{i:e}=this.childPos(t,1);return getComputedStyle(this.children[e].dom).direction==\"rtl\"?G.RTL:G.LTR}measureTextSize(){for(let s of this.children)if(s instanceof mt){let o=s.measureTextSize();if(o)return o}let t=document.createElement(\"div\"),e,r,n;return t.className=\"cm-line\",t.style.width=\"99999px\",t.style.position=\"absolute\",t.textContent=\"abc def ghi jkl mno pqr stu\",this.view.observer.ignore(()=>{this.dom.appendChild(t);let s=Xr(t.firstChild)[0];e=t.getBoundingClientRect().height,r=s?s.width/27:7,n=s?s.height:e,t.remove()}),{lineHeight:e,charWidth:r,textHeight:n}}childCursor(t=this.length){let e=this.children.length;return e&&(t-=this.children[--e].length),new ws(this.children,t,e)}computeBlockGapDeco(){let t=[],e=this.view.viewState;for(let r=0,n=0;;n++){let s=n==e.viewports.length?null:e.viewports[n],o=s?s.from-1:this.length;if(o>r){let l=(e.lineBlockAt(o).bottom-e.lineBlockAt(r).top)/this.view.scaleY;t.push(R.replace({widget:new Ps(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,o))}if(!s)break;r=s.to+1}return R.set(t)}updateDeco(){let t=this.view.state.facet(Yr).map((n,s)=>(this.dynamicDecorationMap[s]=typeof n==\"function\")?n(this.view):n),e=!1,r=this.view.state.facet(dd).map((n,s)=>{let o=typeof n==\"function\";return o&&(e=!0),o?n(this.view):n});r.length&&(this.dynamicDecorationMap[t.length]=e,t.push(_.join(r)));for(let n=t.length;ne.anchor?-1:1),n;if(!r)return;!e.empty&&(n=this.coordsAt(e.anchor,e.anchor>e.head?-1:1))&&(r={left:Math.min(r.left,n.left),top:Math.min(r.top,n.top),right:Math.max(r.right,n.right),bottom:Math.max(r.bottom,n.bottom)});let s=gd(this.view),o={left:r.left-s.left,top:r.top-s.top,right:r.right+s.right,bottom:r.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;RO(this.view.scrollDOM,o,e.head0)r=r.childNodes[n-1],n=qe(r);else break}if(e>=0)for(let r=i,n=t;;){if(r.nodeType==3)return{node:r,offset:n};if(r.nodeType==1&&n=0)r=r.childNodes[n],n=0;else break}return null}function jO(i,t){return i.nodeType!=1?0:(t&&i.childNodes[t-1].contentEditable==\"false\"?1:0)|(t{rt.from&&(e=!0)}),e}function i0(i,t,e=1){let r=i.charCategorizer(t),n=i.doc.lineAt(t),s=t-n.from;if(n.length==0)return b.cursor(t);s==0?e=1:s==n.length&&(e=-1);let o=s,l=s;e<0?o=at(n.text,s,!1):l=at(n.text,s);let a=r(n.text.slice(o,l));for(;o>0;){let h=at(n.text,o,!1);if(r(n.text.slice(h,o))!=a)break;o=h}for(;li?t.left-i:Math.max(0,i-t.right)}function n0(i,t){return t.top>i?t.top-i:Math.max(0,i-t.bottom)}function Vl(i,t){return i.topt.top+1}function cu(i,t){return ti.bottom?{top:i.top,left:i.left,right:i.right,bottom:t}:i}function ra(i,t,e){let r,n,s,o,l=!1,a,h,f,c;for(let m=i.firstChild;m;m=m.nextSibling){let O=Xr(m);for(let g=0;gC||o==C&&s>S){r=m,n=x,s=S,o=C;let v=C?e0?g0)}S==0?e>x.bottom&&(!f||f.bottomx.top)&&(h=m,c=x):f&&Vl(f,x)?f=uu(f,x.bottom):c&&Vl(c,x)&&(c=cu(c,x.top))}}if(f&&f.bottom>=e?(r=a,n=f):c&&c.top<=e&&(r=h,n=c),!r)return{node:i,offset:0};let u=Math.max(n.left,Math.min(n.right,t));if(r.nodeType==3)return du(r,u,e);if(l&&r.contentEditable!=\"false\")return ra(r,u,e);let d=Array.prototype.indexOf.call(i.childNodes,r)+(t>=(n.left+n.right)/2?1:0);return{node:i,offset:d}}function du(i,t,e){let r=i.nodeValue.length,n=-1,s=1e9,o=0;for(let l=0;le?f.top-e:e-f.bottom)-1;if(f.left-1<=t&&f.right+1>=t&&c=(f.left+f.right)/2,d=u;if((Q.chrome||Q.gecko)&&ai(i,l).getBoundingClientRect().left==f.right&&(d=!u),c<=0)return{node:i,offset:l+(d?1:0)};n=l+(d?1:0),s=c}}}return{node:i,offset:n>-1?n:o>0?i.nodeValue.length:0}}function yd(i,t,e,r=-1){var n,s;let o=i.contentDOM.getBoundingClientRect(),l=o.top+i.viewState.paddingTop,a,{docHeight:h}=i.viewState,{x:f,y:c}=t,u=c-l;if(u<0)return 0;if(u>h)return i.state.doc.length;for(let v=i.viewState.heightOracle.textHeight/2,y=!1;a=i.elementAtHeight(u),a.type!=Pt.Text;)for(;u=r>0?a.bottom+v:a.top-v,!(u>=0&&u<=h);){if(y)return e?null:0;y=!0,r=-r}c=l+u;let d=a.from;if(di.viewport.to)return i.viewport.to==i.state.doc.length?i.state.doc.length:e?null:pu(i,o,a,f,c);let m=i.dom.ownerDocument,O=i.root.elementFromPoint?i.root:m,g=O.elementFromPoint(f,c);g&&!i.contentDOM.contains(g)&&(g=null),g||(f=Math.max(o.left+1,Math.min(o.right-1,f)),g=O.elementFromPoint(f,c),g&&!i.contentDOM.contains(g)&&(g=null));let x,S=-1;if(g&&((n=i.docView.nearest(g))===null||n===void 0?void 0:n.isEditable)!=!1){if(m.caretPositionFromPoint){let v=m.caretPositionFromPoint(f,c);v&&({offsetNode:x,offset:S}=v)}else if(m.caretRangeFromPoint){let v=m.caretRangeFromPoint(f,c);v&&({startContainer:x,startOffset:S}=v,(!i.contentDOM.contains(x)||Q.safari&&s0(x,S,f)||Q.chrome&&o0(x,S,f))&&(x=void 0))}}if(!x||!i.docView.dom.contains(x)){let v=mt.find(i.docView,d);if(!v)return u>a.top+a.height/2?a.to:a.from;({node:x,offset:S}=ra(v.dom,f,c))}let C=i.docView.nearest(x);if(!C)return null;if(C.isWidget&&((s=C.dom)===null||s===void 0?void 0:s.nodeType)==1){let v=C.dom.getBoundingClientRect();return t.yi.defaultLineHeight*1.5){let l=i.viewState.heightOracle.textHeight,a=Math.floor((n-e.top-(i.defaultLineHeight-l)*.5)/l);s+=a*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(e.from,e.to);return e.from+os(o,s,i.state.tabSize)}function s0(i,t,e){let r;if(i.nodeType!=3||t!=(r=i.nodeValue.length))return!1;for(let n=i.nextSibling;n;n=n.nextSibling)if(n.nodeType!=1||n.nodeName!=\"BR\")return!1;return ai(i,r-1,r).getBoundingClientRect().left>e}function o0(i,t,e){if(t!=0)return!1;for(let n=i;;){let s=n.parentNode;if(!s||s.nodeType!=1||s.firstChild!=n)return!1;if(s.classList.contains(\"cm-line\"))break;n=s}let r=i.nodeType==1?i.getBoundingClientRect():ai(i,0,Math.max(i.nodeValue.length,1)).getBoundingClientRect();return e-r.left>5}function na(i,t){let e=i.lineBlockAt(t);if(Array.isArray(e.type)){for(let r of e.type)if(r.to>t||r.to==t&&(r.to==e.to||r.type==Pt.Text))return r}return e}function l0(i,t,e,r){let n=na(i,t.head),s=!r||n.type!=Pt.Text||!(i.lineWrapping||n.widgetLineBreaks)?null:i.coordsAtPos(t.assoc<0&&t.head>n.from?t.head-1:t.head);if(s){let o=i.dom.getBoundingClientRect(),l=i.textDirectionAt(n.from),a=i.posAtCoords({x:e==(l==G.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return b.cursor(a,e?-1:1)}return b.cursor(e?n.to:n.from,e?-1:1)}function mu(i,t,e,r){let n=i.state.doc.lineAt(t.head),s=i.bidiSpans(n),o=i.textDirectionAt(n.from);for(let l=t,a=null;;){let h=FO(n,s,o,l,e),f=rd;if(!h){if(n.number==(e?i.state.doc.lines:1))return l;f=`\n`,n=i.state.doc.line(n.number+(e?1:-1)),s=i.bidiSpans(n),h=i.visualLineSide(n,!e)}if(a){if(!a(f))return l}else{if(!r)return h;a=r(f)}l=h}}function a0(i,t,e){let r=i.state.charCategorizer(t),n=r(e);return s=>{let o=r(s);return n==F.Space&&(n=o),n==o}}function h0(i,t,e,r){let n=t.head,s=e?1:-1;if(n==(e?i.state.doc.length:0))return b.cursor(n,t.assoc);let o=t.goalColumn,l,a=i.contentDOM.getBoundingClientRect(),h=i.coordsAtPos(n,t.assoc||-1),f=i.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let d=i.viewState.lineBlockAt(n);o==null&&(o=Math.min(a.right-a.left,i.defaultCharacterWidth*(n-d.from))),l=(s<0?d.top:d.bottom)+f}let c=a.left+o,u=r??i.viewState.heightOracle.textHeight>>1;for(let d=0;;d+=10){let m=l+(u+d)*s,O=yd(i,{x:c,y:m},!1,s);if(ma.bottom||(s<0?On)){let g=i.docView.coordsForChar(O),x=!g||m{if(t>s&&tn(i)),e.from,t.head>e.from?-1:1);return r==e.from?e:b.cursor(r,rnull),Q.gecko&&k0(t.contentDOM.ownerDocument)}handleEvent(t){!g0(this.view,t)||this.ignoreDuringComposition(t)||t.type==\"keydown\"&&this.keydown(t)||this.runHandlers(t.type,t)}runHandlers(t,e){let r=this.handlers[t];if(r){for(let n of r.observers)n(this.view,e);for(let n of r.handlers){if(e.defaultPrevented)break;if(n(this.view,e)){e.preventDefault();break}}}}ensureHandlers(t){let e=f0(t),r=this.handlers,n=this.view.contentDOM;for(let s in e)if(s!=\"scroll\"){let o=!e[s].handlers.length,l=r[s];l&&o!=!l.handlers.length&&(n.removeEventListener(s,this.handleEvent),l=null),l||n.addEventListener(s,this.handleEvent,{passive:o})}for(let s in r)s!=\"scroll\"&&!e[s]&&n.removeEventListener(s,this.handleEvent);this.handlers=e}keydown(t){if(this.lastKeyCode=t.keyCode,this.lastKeyTime=Date.now(),t.keyCode==9&&Date.now()r.keyCode==t.keyCode))&&!t.ctrlKey||c0.indexOf(t.key)>-1&&t.ctrlKey&&!t.shiftKey)?(this.pendingIOSKey=e||t,setTimeout(()=>this.flushIOSKey(),250),!0):(t.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(){let t=this.pendingIOSKey;return t?(this.pendingIOSKey=void 0,zi(this.view.contentDOM,t.key,t.keyCode)):!1}ignoreDuringComposition(t){return/^key/.test(t.type)?this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}startMouseSelection(t){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=t}update(t){this.mouseSelection&&this.mouseSelection.update(t),this.draggedContent&&t.docChanged&&(this.draggedContent=this.draggedContent.map(t.changes)),t.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}};function gu(i,t){return(e,r)=>{try{return t.call(i,r,e)}catch(n){Ct(e.state,n)}}}function f0(i){let t=Object.create(null);function e(r){return t[r]||(t[r]={observers:[],handlers:[]})}for(let r of i){let n=r.spec;if(n&&n.domEventHandlers)for(let s in n.domEventHandlers){let o=n.domEventHandlers[s];o&&e(s).handlers.push(gu(r.value,o))}if(n&&n.domEventObservers)for(let s in n.domEventObservers){let o=n.domEventObservers[s];o&&e(s).observers.push(gu(r.value,o))}}for(let r in re)e(r).handlers.push(re[r]);for(let r in ne)e(r).observers.push(ne[r]);return t}var bd=[{key:\"Backspace\",keyCode:8,inputType:\"deleteContentBackward\"},{key:\"Enter\",keyCode:13,inputType:\"insertParagraph\"},{key:\"Enter\",keyCode:13,inputType:\"insertLineBreak\"},{key:\"Delete\",keyCode:46,inputType:\"deleteContentForward\"}],c0=\"dthko\",Sd=[16,17,18,20,91,92,224,225],fs=6;function cs(i){return Math.max(0,i)*.7+8}function u0(i,t){return Math.max(Math.abs(i.clientX-t.clientX),Math.abs(i.clientY-t.clientY))}var oa=class{constructor(t,e,r,n){this.view=t,this.startEvent=e,this.style=r,this.mustSelect=n,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=e,this.scrollParent=MO(t.contentDOM),this.atoms=t.state.facet($a).map(o=>o(t));let s=t.contentDOM.ownerDocument;s.addEventListener(\"mousemove\",this.move=this.move.bind(this)),s.addEventListener(\"mouseup\",this.up=this.up.bind(this)),this.extend=e.shiftKey,this.multiple=t.state.facet(Y.allowMultipleSelections)&&d0(t,e),this.dragging=m0(t,e)&&Td(e)==1?null:!1}start(t){this.dragging===!1&&this.select(t)}move(t){var e;if(t.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&u0(this.startEvent,t)<10)return;this.select(this.lastEvent=t);let r=0,n=0,s=((e=this.scrollParent)===null||e===void 0?void 0:e.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},o=gd(this.view);t.clientX-o.left<=s.left+fs?r=-cs(s.left-t.clientX):t.clientX+o.right>=s.right-fs&&(r=cs(t.clientX-s.right)),t.clientY-o.top<=s.top+fs?n=-cs(s.top-t.clientY):t.clientY+o.bottom>=s.bottom-fs&&(n=cs(t.clientY-s.bottom)),this.setScrollSpeed(r,n)}up(t){this.dragging==null&&this.select(this.lastEvent),this.dragging||t.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let t=this.view.contentDOM.ownerDocument;t.removeEventListener(\"mousemove\",this.move),t.removeEventListener(\"mouseup\",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(t,e){this.scrollSpeed={x:t,y:e},t||e?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(t){let e=null;for(let r=0;rthis.select(this.lastEvent),20)}};function d0(i,t){let e=i.state.facet(nd);return e.length?e[0](t):Q.mac?t.metaKey:t.ctrlKey}function p0(i,t){let e=i.state.facet(sd);return e.length?e[0](t):Q.mac?!t.altKey:!t.ctrlKey}function m0(i,t){let{main:e}=i.state.selection;if(e.empty)return!1;let r=Ss(i.root);if(!r||r.rangeCount==0)return!0;let n=r.getRangeAt(0).getClientRects();for(let s=0;s=t.clientX&&o.top<=t.clientY&&o.bottom>=t.clientY)return!0}return!1}function g0(i,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target,r;e!=i.contentDOM;e=e.parentNode)if(!e||e.nodeType==11||(r=rt.get(e))&&r.ignoreEvent(t))return!1;return!0}var re=Object.create(null),ne=Object.create(null),wd=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function O0(i){let t=i.dom.parentNode;if(!t)return;let e=t.appendChild(document.createElement(\"textarea\"));e.style.cssText=\"position: fixed; left: -10000px; top: 10px\",e.focus(),setTimeout(()=>{i.focus(),e.remove(),vd(i,e.value)},50)}function vd(i,t){let{state:e}=i,r,n=1,s=e.toText(t),o=s.lines==e.selection.ranges.length;if(la!=null&&e.selection.ranges.every(a=>a.empty)&&la==s.toString()){let a=-1;r=e.changeByRange(h=>{let f=e.doc.lineAt(h.from);if(f.from==a)return{range:h};a=f.from;let c=e.toText((o?s.line(n++).text:t)+e.lineBreak);return{changes:{from:f.from,insert:c},range:b.cursor(h.from+c.length)}})}else o?r=e.changeByRange(a=>{let h=s.line(n++);return{changes:{from:a.from,to:a.to,insert:h.text},range:b.cursor(a.from+h.length)}}):r=e.replaceSelection(s);i.dispatch(r,{userEvent:\"input.paste\",scrollIntoView:!0})}ne.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};re.keydown=(i,t)=>(i.inputState.setSelectionOrigin(\"select\"),t.keyCode==27&&(i.inputState.lastEscPress=Date.now()),!1);ne.touchstart=(i,t)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin(\"select.pointer\")};ne.touchmove=i=>{i.inputState.setSelectionOrigin(\"select.pointer\")};re.mousedown=(i,t)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let e=null;for(let r of i.state.facet(od))if(e=r(i,t),e)break;if(!e&&t.button==0&&(e=b0(i,t)),e){let r=!i.hasFocus;i.inputState.startMouseSelection(new oa(i,t,e,r)),r&&i.observer.ignore(()=>Nu(i.contentDOM));let n=i.inputState.mouseSelection;if(n)return n.start(t),n.dragging===!1}return!1};function Ou(i,t,e,r){if(r==1)return b.cursor(t,e);if(r==2)return i0(i.state,t,e);{let n=mt.find(i.docView,t),s=i.state.doc.lineAt(n?n.posAtEnd:t),o=n?n.posAtStart:s.from,l=n?n.posAtEnd:s.to;return li>=t.top&&i<=t.bottom,xu=(i,t,e)=>kd(t,e)&&i>=e.left&&i<=e.right;function x0(i,t,e,r){let n=mt.find(i.docView,t);if(!n)return 1;let s=t-n.posAtStart;if(s==0)return 1;if(s==n.length)return-1;let o=n.coordsAt(s,-1);if(o&&xu(e,r,o))return-1;let l=n.coordsAt(s,1);return l&&xu(e,r,l)?1:o&&kd(r,o)?-1:1}function yu(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:e,bias:x0(i,e,t.clientX,t.clientY)}}var y0=Q.ie&&Q.ie_version<=11,bu=null,Su=0,wu=0;function Td(i){if(!y0)return i.detail;let t=bu,e=wu;return bu=i,wu=Date.now(),Su=!t||e>Date.now()-400&&Math.abs(t.clientX-i.clientX)<2&&Math.abs(t.clientY-i.clientY)<2?(Su+1)%3:1}function b0(i,t){let e=yu(i,t),r=Td(t),n=i.state.selection;return{update(s){s.docChanged&&(e.pos=s.changes.mapPos(e.pos),n=n.map(s.changes))},get(s,o,l){let a=yu(i,s),h,f=Ou(i,a.pos,a.bias,r);if(e.pos!=a.pos&&!o){let c=Ou(i,e.pos,e.bias,r),u=Math.min(c.from,f.from),d=Math.max(c.to,f.to);f=u1&&(h=S0(n,a.pos))?h:l?n.addRange(f):b.create([f])}}}function S0(i,t){for(let e=0;e=t)return b.create(i.ranges.slice(0,e).concat(i.ranges.slice(e+1)),i.mainIndex==e?0:i.mainIndex-(i.mainIndex>e?1:0))}return null}re.dragstart=(i,t)=>{let{selection:{main:e}}=i.state;if(t.target.draggable){let n=i.docView.nearest(t.target);if(n&&n.isWidget){let s=n.posAtStart,o=s+n.length;(s>=e.to||o<=e.from)&&(e=b.range(s,o))}}let{inputState:r}=i;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=e,t.dataTransfer&&(t.dataTransfer.setData(\"Text\",i.state.sliceDoc(e.from,e.to)),t.dataTransfer.effectAllowed=\"copyMove\"),!1};re.dragend=i=>(i.inputState.draggedContent=null,!1);function vu(i,t,e,r){if(!e)return;let n=i.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:s}=i.inputState,o=r&&s&&p0(i,t)?{from:s.from,to:s.to}:null,l={from:n,insert:e},a=i.state.changes(o?[o,l]:l);i.focus(),i.dispatch({changes:a,selection:{anchor:a.mapPos(n,-1),head:a.mapPos(n,1)},userEvent:o?\"move.drop\":\"input.drop\"}),i.inputState.draggedContent=null}re.drop=(i,t)=>{if(!t.dataTransfer)return!1;if(i.state.readOnly)return!0;let e=t.dataTransfer.files;if(e&&e.length){let r=Array(e.length),n=0,s=()=>{++n==e.length&&vu(i,t,r.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o{/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(l.result)||(r[o]=l.result),s()},l.readAsText(e[o])}return!0}else{let r=t.dataTransfer.getData(\"Text\");if(r)return vu(i,t,r,!0),!0}return!1};re.paste=(i,t)=>{if(i.state.readOnly)return!0;i.observer.flush();let e=wd?null:t.clipboardData;return e?(vd(i,e.getData(\"text/plain\")||e.getData(\"text/uri-text\")),!0):(O0(i),!1)};function w0(i,t){let e=i.dom.parentNode;if(!e)return;let r=e.appendChild(document.createElement(\"textarea\"));r.style.cssText=\"position: fixed; left: -10000px; top: 10px\",r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),i.focus()},50)}function v0(i){let t=[],e=[],r=!1;for(let n of i.selection.ranges)n.empty||(t.push(i.sliceDoc(n.from,n.to)),e.push(n));if(!t.length){let n=-1;for(let{from:s}of i.selection.ranges){let o=i.doc.lineAt(s);o.number>n&&(t.push(o.text),e.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),n=o.number}r=!0}return{text:t.join(i.lineBreak),ranges:e,linewise:r}}var la=null;re.copy=re.cut=(i,t)=>{let{text:e,ranges:r,linewise:n}=v0(i.state);if(!e&&!n)return!1;la=n?e:null,t.type==\"cut\"&&!i.state.readOnly&&i.dispatch({changes:r,scrollIntoView:!0,userEvent:\"delete.cut\"});let s=wd?null:t.clipboardData;return s?(s.clearData(),s.setData(\"text/plain\",e),!0):(w0(i,e),!1)};var Pd=Et.define();function Cd(i,t){let e=[];for(let r of i.facet(hd)){let n=r(i,t);n&&e.push(n)}return e?i.update({effects:e,annotations:Pd.of(!0)}):null}function Ad(i){setTimeout(()=>{let t=i.hasFocus;if(t!=i.inputState.notifiedFocused){let e=Cd(i.state,t);e?i.dispatch(e):i.update([])}},10)}ne.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),Ad(i)};ne.blur=i=>{i.observer.clearSelectionRange(),Ad(i)};ne.compositionstart=ne.compositionupdate=i=>{i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0)};ne.compositionend=i=>{i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,Q.chrome&&Q.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50)};ne.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};re.beforeinput=(i,t)=>{var e;let r;if(Q.chrome&&Q.android&&(r=bd.find(n=>n.inputType==t.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key==\"Backspace\"||r.key==\"Delete\")){let n=((e=window.visualViewport)===null||e===void 0?void 0:e.height)||0;setTimeout(()=>{var s;(((s=window.visualViewport)===null||s===void 0?void 0:s.height)||0)>n+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return!1};var ku=new Set;function k0(i){ku.has(i)||(ku.add(i),i.addEventListener(\"copy\",()=>{}),i.addEventListener(\"cut\",()=>{}))}var Tu=[\"pre-wrap\",\"normal\",\"pre-line\",\"break-spaces\"],aa=class{constructor(t){this.lineWrapping=t,this.doc=V.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(t,e){let r=this.doc.lineAt(e).number-this.doc.lineAt(t).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((e-t-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(t){return this.lineWrapping?(1+Math.max(0,Math.ceil((t-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(t){return this.doc=t,this}mustRefreshForWrapping(t){return Tu.indexOf(t)>-1!=this.lineWrapping}mustRefreshForHeights(t){let e=!1;for(let r=0;r-1,a=Math.round(e)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=e,this.charWidth=r,this.textHeight=n,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(t){this.flags=(t?2:0)|this.flags&-3}setHeight(t,e){this.height!=e&&(Math.abs(this.height-e)>ys&&(t.heightChanged=!0),this.height=e)}replace(t,e,r){return i.of(r)}decomposeLeft(t,e){e.push(this)}decomposeRight(t,e){e.push(this)}applyChanges(t,e,r,n){let s=this,o=r.doc;for(let l=n.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:f,toB:c}=n[l],u=s.lineAt(a,et.ByPosNoHeight,r.setDoc(e),0,0),d=u.to>=h?u:s.lineAt(h,et.ByPosNoHeight,r,0,0);for(c+=d.to-h,h=d.to;l>0&&u.from<=n[l-1].toA;)a=n[l-1].fromA,f=n[l-1].fromB,l--,as*2){let l=t[e-1];l.break?t.splice(--e,1,l.left,null,l.right):t.splice(--e,1,l.left,l.right),r+=1+l.break,n-=l.size}else if(s>n*2){let l=t[r];l.break?t.splice(r,1,l.left,null,l.right):t.splice(r,1,l.left,l.right),r+=2+l.break,s-=l.size}else break;else if(n=s&&o(this.blockAt(0,r,n,s))}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more&&this.setHeight(t,n.heights[n.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Ht=class i extends Cs{constructor(t,e){super(t,e,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(t,e,r,n){return new ge(n,this.length,r,this.height,this.breaks)}replace(t,e,r){let n=r[0];return r.length==1&&(n instanceof i||n instanceof Ne&&n.flags&4)&&Math.abs(this.length-n.length)<10?(n instanceof Ne?n=new i(n.length,this.height):n.height=this.height,this.outdated||(n.outdated=!1),n):Vt.of(r)}updateHeight(t,e=0,r=!1,n){return n&&n.from<=e&&n.more?this.setHeight(t,n.heights[n.index++]):(r||this.outdated)&&this.setHeight(t,Math.max(this.widgetHeight,t.heightForLine(this.length-this.collapsed))+this.breaks*t.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:\"\"}${this.widgetHeight?\":\"+this.widgetHeight:\"\"})`}},Ne=class i extends Vt{constructor(t){super(t,0)}heightMetrics(t,e){let r=t.doc.lineAt(e).number,n=t.doc.lineAt(e+this.length).number,s=n-r+1,o,l=0;if(t.lineWrapping){let a=Math.min(this.height,t.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:r,lastLine:n,perLine:o,perChar:l}}blockAt(t,e,r,n){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(e,n);if(e.lineWrapping){let h=n+Math.round(Math.max(0,Math.min(1,(t-r)/this.height))*this.length),f=e.doc.lineAt(h),c=l+f.length*a,u=Math.max(r,t-c/2);return new ge(f.from,f.length,u,c,0)}else{let h=Math.max(0,Math.min(o-s,Math.floor((t-r)/l))),{from:f,length:c}=e.doc.line(s+h);return new ge(f,c,r+l*h,l,0)}}lineAt(t,e,r,n,s){if(e==et.ByHeight)return this.blockAt(t,r,n,s);if(e==et.ByPosNoHeight){let{from:d,to:m}=r.doc.lineAt(t);return new ge(d,m-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(r,s),h=r.doc.lineAt(t),f=l+h.length*a,c=h.number-o,u=n+l*c+a*(h.from-s-c);return new ge(h.from,h.length,Math.max(n,Math.min(u,n+this.height-f)),f,0)}forEachLine(t,e,r,n,s,o){t=Math.max(t,s),e=Math.min(e,s+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(r,s);for(let f=t,c=n;f<=e;){let u=r.doc.lineAt(f);if(f==t){let m=u.number-l;c+=a*m+h*(t-s-m)}let d=a+h*u.length;o(new ge(u.from,u.length,c,d,0)),c+=d,f=u.to+1}}replace(t,e,r){let n=this.length-e;if(n>0){let s=r[r.length-1];s instanceof i?r[r.length-1]=new i(s.length+n):r.push(null,new i(n-1))}if(t>0){let s=r[0];s instanceof i?r[0]=new i(t+s.length):r.unshift(new i(t-1),null)}return Vt.of(r)}decomposeLeft(t,e){e.push(new i(t-1),null)}decomposeRight(t,e){e.push(null,new i(this.length-t-1))}updateHeight(t,e=0,r=!1,n){let s=e+this.length;if(n&&n.from<=e+this.length&&n.more){let o=[],l=Math.max(e,n.from),a=-1;for(n.from>e&&o.push(new i(n.from-e-1).updateHeight(t,e));l<=s&&n.more;){let f=t.doc.lineAt(l).length;o.length&&o.push(null);let c=n.heights[n.index++];a==-1?a=c:Math.abs(c-a)>=ys&&(a=-2);let u=new Ht(f,c);u.outdated=!1,o.push(u),l+=f+1}l<=s&&o.push(null,new i(s-l).updateHeight(t,l));let h=Vt.of(o);return(a<0||Math.abs(h.height-this.height)>=ys||Math.abs(a-this.heightMetrics(t,e).perLine)>=ys)&&(t.heightChanged=!0),h}else(r||this.outdated)&&(this.setHeight(t,t.heightForGap(e,e+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},fa=class extends Vt{constructor(t,e,r){super(t.length+e+r.length,t.height+r.height,e|(t.outdated||r.outdated?2:0)),this.left=t,this.right=r,this.size=t.size+r.size}get break(){return this.flags&1}blockAt(t,e,r,n){let s=r+this.left.height;return tl))return h;let f=e==et.ByPosNoHeight?et.ByPosNoHeight:et.ByPos;return a?h.join(this.right.lineAt(l,f,r,o,l)):this.left.lineAt(l,f,r,n,s).join(h)}forEachLine(t,e,r,n,s,o){let l=n+this.left.height,a=s+this.left.length+this.break;if(this.break)t=a&&this.right.forEachLine(t,e,r,l,a,o);else{let h=this.lineAt(a,et.ByPos,r,n,s);t=t&&h.from<=e&&o(h),e>h.to&&this.right.forEachLine(h.to+1,e,r,l,a,o)}}replace(t,e,r){let n=this.left.length+this.break;if(ethis.left.length)return this.balanced(this.left,this.right.replace(t-n,e-n,r));let s=[];t>0&&this.decomposeLeft(t,s);let o=s.length;for(let l of r)s.push(l);if(t>0&&Pu(s,o-1),e=r&&e.push(null)),t>r&&this.right.decomposeLeft(t-r,e)}decomposeRight(t,e){let r=this.left.length,n=r+this.break;if(t>=n)return this.right.decomposeRight(t-n,e);t2*e.size||e.size>2*t.size?Vt.of(this.break?[t,null,e]:[t,e]):(this.left=t,this.right=e,this.height=t.height+e.height,this.outdated=t.outdated||e.outdated,this.size=t.size+e.size,this.length=t.length+this.break+e.length,this)}updateHeight(t,e=0,r=!1,n){let{left:s,right:o}=this,l=e+s.length+this.break,a=null;return n&&n.from<=e+s.length&&n.more?a=s=s.updateHeight(t,e,r,n):s.updateHeight(t,e,r),n&&n.from<=l+o.length&&n.more?a=o=o.updateHeight(t,l,r,n):o.updateHeight(t,l,r),a?this.balanced(s,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?\" \":\"-\")+this.right}};function Pu(i,t){let e,r;i[t]==null&&(e=i[t-1])instanceof Ne&&(r=i[t+1])instanceof Ne&&i.splice(t-1,3,new Ne(e.length+1+r.length))}var T0=5,ca=class i{constructor(t,e){this.pos=t,this.oracle=e,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=t}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(t,e){if(this.lineStart>-1){let r=Math.min(e,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Ht?n.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Ht(r-this.pos,-1)),this.writtenTo=r,e>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=e}point(t,e,r){if(t=T0)&&this.addLineDeco(n,s,o)}else e>t&&this.span(t,e);this.lineEnd>-1&&this.lineEnd-1)return;let{from:t,to:e}=this.oracle.doc.lineAt(this.pos);this.lineStart=t,this.lineEnd=e,this.writtenTot&&this.nodes.push(new Ht(this.pos-t,-1)),this.writtenTo=this.pos}blankContent(t,e){let r=new Ne(e-t);return this.oracle.doc.lineAt(t).to==e&&(r.flags|=4),r}ensureLine(){this.enterLine();let t=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(t instanceof Ht)return t;let e=new Ht(0,-1);return this.nodes.push(e),e}addBlock(t){this.enterLine();let e=t.deco;e&&e.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(t),this.writtenTo=this.pos=this.pos+t.length,e&&e.endSide>0&&(this.covering=t)}addLineDeco(t,e,r){let n=this.ensureLine();n.length+=r,n.collapsed+=r,n.widgetHeight=Math.max(n.widgetHeight,t),n.breaks+=e,this.writtenTo=this.pos=this.pos+r}finish(t){let e=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(e instanceof Ht)&&!this.isCovered?this.nodes.push(new Ht(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&c.overflow!=\"visible\"){let u=f.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=h==i.parentNode?u.bottom:Math.min(a,u.bottom)}h=c.position==\"absolute\"||c.position==\"fixed\"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-e.left,right:Math.max(s,o)-e.left,top:l-(e.top+t),bottom:Math.max(l,a)-(e.top+t)}}function A0(i,t){let e=i.getBoundingClientRect();return{left:0,right:e.right-e.left,top:t,bottom:e.bottom-(e.top+t)}}var qr=class{constructor(t,e,r){this.from=t,this.to=e,this.size=r}static same(t,e){if(t.length!=e.length)return!1;for(let r=0;rtypeof r!=\"function\"&&r.class==\"cm-lineWrapping\");this.heightOracle=new aa(e),this.stateDeco=t.facet(Yr).filter(r=>typeof r!=\"function\"),this.heightMap=Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle.setDoc(t.doc),[new xe(0,0,0,t.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=R.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let t=[this.viewport],{main:e}=this.state.selection;for(let r=0;r<=1;r++){let n=r?e.head:e.anchor;if(!t.some(({from:s,to:o})=>n>=s&&n<=o)){let{from:s,to:o}=this.lineBlockAt(n);t.push(new Ii(s,o))}}this.viewports=t.sort((r,n)=>r.from-n.from),this.scaler=this.heightMap.height<=7e6?Cu:new pa(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,t=>{this.viewportLines.push(this.scaler.scale==1?t:Cr(t,this.scaler))})}update(t,e=null){this.state=t.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Yr).filter(f=>typeof f!=\"function\");let n=t.changedRanges,s=xe.extendWithRanges(n,P0(r,this.stateDeco,t?t.changes:vt.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,t.startState.doc,this.heightOracle.setDoc(this.state.doc),s),this.heightMap.height!=o&&(t.flags|=2),l?(this.scrollAnchorPos=t.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=s.length?this.mapViewport(this.viewport,t.changes):this.viewport;(e&&(e.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,e));let h=!t.changes.empty||t.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),h&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,t.changes))),t.flags|=this.computeVisibleRanges(),e&&(this.scrollTarget=e),!this.mustEnforceCursorAssoc&&t.selectionSet&&t.view.lineWrapping&&t.state.selection.main.empty&&t.state.selection.main.assoc&&!t.state.facet(cd)&&(this.mustEnforceCursorAssoc=!0)}measure(t){let e=t.contentDOM,r=window.getComputedStyle(e),n=this.heightOracle,s=r.whiteSpace;this.defaultTextDirection=r.direction==\"rtl\"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(s),l=e.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:v,scaleY:y}=Iu(e,l);(this.scaleX!=v||this.scaleY!=y)&&(this.scaleX=v,this.scaleY=y,h|=8,o=a=!0)}let c=(parseInt(r.paddingTop)||0)*this.scaleY,u=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=c||this.paddingBottom!=u)&&(this.paddingTop=c,this.paddingBottom=u,h|=10),this.editorWidth!=t.scrollDOM.clientWidth&&(n.lineWrapping&&(a=!0),this.editorWidth=t.scrollDOM.clientWidth,h|=8);let d=t.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=zu(t.scrollDOM);let m=(this.printing?A0:C0)(e,this.paddingTop),O=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let x=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(x!=this.inView&&(this.inView=x,x&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let S=l.width;if((this.contentDOMWidth!=S||this.editorHeight!=t.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=t.scrollDOM.clientHeight,h|=8),a){let v=t.docView.measureVisibleLineHeights(this.viewport);if(n.mustRefreshForHeights(v)&&(o=!0),o||n.lineWrapping&&Math.abs(S-this.contentDOMWidth)>n.charWidth){let{lineHeight:y,charWidth:k,textHeight:w}=t.docView.measureTextSize();o=y>0&&n.refresh(s,y,k,w,S/k,v),o&&(t.docView.minWidth=0,h|=8)}O>0&&g>0?f=Math.max(O,g):O<0&&g<0&&(f=Math.min(O,g)),n.heightChanged=!1;for(let y of this.viewports){let k=y.from==this.viewport.from?v:t.docView.measureVisibleLineHeights(y);this.heightMap=(o?Vt.empty().applyChanges(this.stateDeco,V.empty,this.heightOracle,[new xe(0,0,0,t.state.doc.length)]):this.heightMap).updateHeight(n,0,o,new ha(y.from,k))}n.heightChanged&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(this.viewport=this.getViewport(f,this.scrollTarget)),this.updateForViewport(),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,t)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,t.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(t,e){let r=.5-Math.max(-.5,Math.min(.5,t/1e3/2)),n=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Ii(n.lineAt(o-r*1e3,et.ByHeight,s,0,0).from,n.lineAt(l+(1-r)*1e3,et.ByHeight,s,0,0).to);if(e){let{head:h}=e.range;if(ha.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),c=n.lineAt(h,et.ByPos,s,0,0),u;e.y==\"center\"?u=(c.top+c.bottom)/2-f/2:e.y==\"start\"||e.y==\"nearest\"&&h=l+Math.max(10,Math.min(r,250)))&&n>o-2*1e3&&s>1,o=n<<1;if(this.defaultTextDirection!=G.LTR&&!r)return[];let l=[],a=(h,f,c,u)=>{if(f-hh&&gg.from>=c.from&&g.to<=c.to&&Math.abs(g.from-h)g.fromx));if(!O){if(fg.from<=f&&g.to>=f)){let g=e.moveToLineBoundary(b.cursor(f),!1,!0).head;g>h&&(f=g)}O=new qr(h,f,this.gapSize(c,h,f,u))}l.push(O)};for(let h of this.viewportLines){if(h.lengthh.from&&a(h.from,u,h,f),de.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let e=[];_.spans(t,this.viewport.from,this.viewport.to,{span(n,s){e.push({from:n,to:s})},point(){}},20);let r=e.length!=this.visibleRanges.length||this.visibleRanges.some((n,s)=>n.from!=e[s].from||n.to!=e[s].to);return this.visibleRanges=e,r?4:0}lineBlockAt(t){return t>=this.viewport.from&&t<=this.viewport.to&&this.viewportLines.find(e=>e.from<=t&&e.to>=t)||Cr(this.heightMap.lineAt(t,et.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(t){return Cr(this.heightMap.lineAt(this.scaler.fromDOM(t),et.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(t){let e=this.lineBlockAtHeight(t+8);return e.from>=this.viewport.from||this.viewportLines[0].top-t>200?e:this.viewportLines[0]}elementAtHeight(t){return Cr(this.heightMap.blockAt(this.scaler.fromDOM(t),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Ii=class{constructor(t,e){this.from=t,this.to=e}};function Q0(i,t,e){let r=[],n=i,s=0;return _.spans(e,i,t,{span(){},point(o,l){o>n&&(r.push({from:n,to:o}),s+=o-n),n=l}},20),n=1)return t[t.length-1].to;let r=Math.floor(i*e);for(let n=0;;n++){let{from:s,to:o}=t[n],l=o-s;if(r<=l)return s+r;r-=l}}function ds(i,t){let e=0;for(let{from:r,to:n}of i.ranges){if(t<=n){e+=t-r;break}e+=n-r}return e/i.total}function R0(i,t){for(let e of i)if(t(e))return e}var Cu={toDOM(i){return i},fromDOM(i){return i},scale:1},pa=class{constructor(t,e,r){let n=0,s=0,o=0;this.viewports=r.map(({from:l,to:a})=>{let h=e.lineAt(l,et.ByPos,t,0,0).top,f=e.lineAt(a,et.ByPos,t,0,0).bottom;return n+=f-h,{from:l,to:a,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-n)/(e.height-n);for(let l of this.viewports)l.domTop=o+(l.top-s)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),s=l.bottom}toDOM(t){for(let e=0,r=0,n=0;;e++){let s=eCr(n,t)):i._content)}var ps=A.define({combine:i=>i.join(\" \")}),ma=A.define({combine:i=>i.indexOf(!0)>-1}),ga=Gt.newName(),Qd=Gt.newName(),Rd=Gt.newName(),Md={\"&light\":\".\"+Qd,\"&dark\":\".\"+Rd};function Oa(i,t,e){return new Gt(t,{finish(r){return/&/.test(r)?r.replace(/&\\w*/,n=>{if(n==\"&\")return i;if(!e||!e[n])throw new RangeError(`Unsupported selector: ${n}`);return e[n]}):i+\" \"+r}})}var M0=Oa(\".\"+ga,{\"&\":{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\",minHeight:\"100%\",padding:\"4px 0\",outline:\"none\",\"&[contenteditable=true]\":{WebkitUserModify:\"read-write-plaintext-only\"}},\".cm-lineWrapping\":{whiteSpace_fallback:\"pre-wrap\",whiteSpace:\"break-spaces\",wordBreak:\"break-word\",overflowWrap:\"anywhere\",flexShrink:1},\"&light .cm-content\":{caretColor:\"black\"},\"&dark .cm-content\":{caretColor:\"white\"},\".cm-line\":{display:\"block\",padding:\"0 2px 0 6px\"},\".cm-layer\":{position:\"absolute\",left:0,top:0,contain:\"size style\",\"& > *\":{position:\"absolute\"}},\"&light .cm-selectionBackground\":{background:\"#d9d9d9\"},\"&dark .cm-selectionBackground\":{background:\"#222\"},\"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#d7d4f0\"},\"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground\":{background:\"#233\"},\".cm-cursorLayer\":{pointerEvents:\"none\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer\":{animation:\"steps(1) cm-blink 1.2s infinite\"},\"@keyframes cm-blink\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\"@keyframes cm-blink2\":{\"0%\":{},\"50%\":{opacity:0},\"100%\":{}},\".cm-cursor, .cm-dropCursor\":{borderLeft:\"1.2px solid black\",marginLeft:\"-0.6px\",pointerEvents:\"none\"},\".cm-cursor\":{display:\"none\"},\"&dark .cm-cursor\":{borderLeftColor:\"#444\"},\".cm-dropCursor\":{position:\"absolute\"},\"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor\":{display:\"block\"},\".cm-iso\":{unicodeBidi:\"isolate\"},\".cm-announced\":{position:\"fixed\",top:\"-10000px\"},\"@media print\":{\".cm-announced\":{display:\"none\"}},\"&light .cm-activeLine\":{backgroundColor:\"#cceeff44\"},\"&dark .cm-activeLine\":{backgroundColor:\"#99eeff33\"},\"&light .cm-specialChar\":{color:\"red\"},\"&dark .cm-specialChar\":{color:\"#f78\"},\".cm-gutters\":{flexShrink:0,display:\"flex\",height:\"100%\",boxSizing:\"border-box\",insetInlineStart: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,')`,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\"}},Md),Ar=\"\\uFFFF\",xa=class{constructor(t,e){this.points=t,this.text=\"\",this.lineSeparator=e.facet(Y.lineSeparator)}append(t){this.text+=t}lineBreak(){this.text+=Ar}readRange(t,e){if(!t)return this;let r=t.parentNode;for(let n=t;;){this.findPointBefore(r,n);let s=this.text.length;this.readNode(n);let o=n.nextSibling;if(o==e)break;let l=rt.get(n),a=rt.get(o);(l&&a?l.breakAfter:(l?l.breakAfter:Au(n))||Au(o)&&(n.nodeName!=\"BR\"||n.cmIgnore)&&this.text.length>s)&&this.lineBreak(),n=o}return this.findPointBefore(r,e),this}readTextNode(t){let e=t.nodeValue;for(let r of this.points)r.node==t&&(r.pos=this.text.length+Math.min(r.offset,e.length));for(let r=0,n=this.lineSeparator?null:/\\r\\n?|\\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=e.indexOf(this.lineSeparator,r),o=this.lineSeparator.length):(l=n.exec(e))&&(s=l.index,o=l[0].length),this.append(e.slice(r,s<0?e.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==t&&a.pos>this.text.length&&(a.pos-=o-1);r=s+o}}readNode(t){if(t.cmIgnore)return;let e=rt.get(t),r=e&&e.overrideDOMText;if(r!=null){this.findPointInside(t,r.length);for(let n=r.iter();!n.next().done;)n.lineBreak?this.lineBreak():this.append(n.value)}else t.nodeType==3?this.readTextNode(t):t.nodeName==\"BR\"?t.nextSibling&&this.lineBreak():t.nodeType==1&&this.readRange(t.firstChild,null)}findPointBefore(t,e){for(let r of this.points)r.node==t&&t.childNodes[r.offset]==e&&(r.pos=this.text.length)}findPointInside(t,e){for(let r of this.points)(t.nodeType==3?r.node==t:t.contains(r.node))&&(r.pos=this.text.length+(E0(t,r.node,r.offset)?e:0))}};function E0(i,t,e){for(;;){if(!t||e-1)this.newSel=null;else if(e>-1&&(this.bounds=t.docView.domBoundsAround(e,r,0))){let l=s||o?[]:D0(t),a=new xa(l,t.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=B0(l,this.bounds.from)}else{let l=t.observer.selectionRange,a=s&&s.node==l.focusNode&&s.offset==l.focusOffset||!Zl(t.contentDOM,l.focusNode)?t.state.selection.main.head:t.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!Zl(t.contentDOM,l.anchorNode)?t.state.selection.main.anchor:t.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=t.viewport;if((Q.ios||Q.chrome)&&t.state.selection.main.empty&&a!=h&&(f.from>0||f.toDate.now()-100?i.inputState.lastKeyCode:-1;if(t.bounds){let{from:o,to:l}=t.bounds,a=n.from,h=null;(s===8||Q.android&&t.text.length=n.from&&e.to<=n.to&&(e.from!=n.from||e.to!=n.to)&&n.to-n.from-(e.to-e.from)<=4?e={from:n.from,to:n.to,insert:i.state.doc.slice(n.from,e.from).append(e.insert).append(i.state.doc.slice(e.to,n.to))}:(Q.mac||Q.android)&&e&&e.from==e.to&&e.from==n.head-1&&/^\\. ?$/.test(e.insert.toString())&&i.contentDOM.getAttribute(\"autocorrect\")==\"off\"?(r&&e.insert.length==2&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}):Q.chrome&&e&&e.from==e.to&&e.from==n.head&&e.insert.toString()==`\n `&&i.lineWrapping&&(r&&(r=b.single(r.main.anchor-1,r.main.head-1)),e={from:n.from,to:n.to,insert:V.of([\" \"])}),e){if(Q.ios&&i.inputState.flushIOSKey()||Q.android&&(e.from==n.from&&e.to==n.to&&e.insert.length==1&&e.insert.lines==2&&zi(i.contentDOM,\"Enter\",13)||(e.from==n.from-1&&e.to==n.to&&e.insert.length==0||s==8&&e.insert.lengthn.head)&&zi(i.contentDOM,\"Backspace\",8)||e.from==n.from&&e.to==n.to+1&&e.insert.length==0&&zi(i.contentDOM,\"Delete\",46)))return!0;let o=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let l,a=()=>l||(l=$0(i,e,r));return i.state.facet(ad).some(h=>h(i,e.from,e.to,o,a))||i.dispatch(a()),!0}else if(r&&!r.main.eq(n)){let o=!1,l=\"select\";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin==\"select\"&&(o=!0),l=i.inputState.lastSelectionOrigin),i.dispatch({selection:r,scrollIntoView:o,userEvent:l}),!0}else return!1}function $0(i,t,e){let r,n=i.state,s=n.selection.main;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!e||e.main.empty&&e.main.from==t.from+t.insert.length)&&i.inputState.composing<0){let l=s.fromt.to?n.sliceDoc(t.to,s.to):\"\";r=n.replaceSelection(i.state.toText(l+t.insert.sliceString(0,void 0,i.state.lineBreak)+a))}else{let l=n.changes(t),a=e&&e.main.to<=l.newLength?e.main:void 0;if(n.selection.ranges.length>1&&i.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let h=i.state.sliceDoc(t.from,t.to),f,c=e&&Od(i,e.main.head);if(c){let m=t.insert.length-(t.to-t.from);f={from:c.from,to:c.to-m}}else f=i.state.doc.lineAt(s.head);let u=s.to-t.to,d=s.to-s.from;r=n.changeByRange(m=>{if(m.from==s.from&&m.to==s.to)return{changes:l,range:a||m.map(l)};let O=m.to-u,g=O-h.length;if(m.to-m.from!=d||i.state.sliceDoc(g,O)!=h||m.to>=f.from&&m.from<=f.to)return{range:m};let x=n.changes({from:g,to:O,insert:t.insert}),S=m.to-s.to;return{changes:x,range:a?b.range(Math.max(0,a.anchor+S),Math.max(0,a.head+S)):m.map(x)}})}else r={changes:l,selection:a&&n.selection.replaceRange(a)}}let o=\"input.type\";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,o+=\".compose\",i.inputState.compositionFirstChange&&(o+=\".start\",i.inputState.compositionFirstChange=!1)),n.update(r,{userEvent:o,scrollIntoView:!0})}function q0(i,t,e,r){let n=Math.min(i.length,t.length),s=0;for(;s0&&l>0&&i.charCodeAt(o-1)==t.charCodeAt(l-1);)o--,l--;if(r==\"end\"){let a=Math.max(0,s-Math.min(o,l));e-=o+a-s}if(o=o?s-e:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-e:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function D0(i){let t=[];if(i.root.activeElement!=i.contentDOM)return t;let{anchorNode:e,anchorOffset:r,focusNode:n,focusOffset:s}=i.observer.selectionRange;return e&&(t.push(new Qs(e,r)),(n!=e||s!=r)&&t.push(new Qs(n,s))),t}function B0(i,t){if(i.length==0)return null;let e=i[0].pos,r=i.length==2?i[1].pos:e;return e>-1&&r>-1?b.single(e+t,r+t):null}var X0={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Il=Q.ie&&Q.ie_version<=11,ba=class{constructor(t){this.view=t,this.active=!1,this.selectionRange=new Fl,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=t.contentDOM,this.observer=new MutationObserver(e=>{for(let r of e)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&t.composing)&&e.some(r=>r.type==\"childList\"&&r.removedNodes.length||r.type==\"characterData\"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),Il&&(this.onCharData=e=>{this.queue.push({target:e.target,type:\"characterData\",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver==\"function\"&&(this.resizeScroll=new ResizeObserver(()=>{var e;((e=this.view.docView)===null||e===void 0?void 0:e.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(\"Event\")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(\"Event\"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(t){this.view.inputState.runHandlers(\"scroll\",t),this.intersecting&&this.view.measure()}onScroll(t){this.intersecting&&this.flush(!1),this.onScrollChanged(t)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(t){if(this.gapIntersection&&(t.length!=this.gaps.length||this.gaps.some((e,r)=>e!=t[r]))){this.gapIntersection.disconnect();for(let e of t)this.gapIntersection.observe(e);this.gaps=t}}onSelectionChange(t){let e=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,n=this.selectionRange;if(r.state.facet(Xs)?r.root.activeElement!=this.dom:!Os(r.dom,n))return;let s=n.anchorNode&&r.docView.nearest(n.anchorNode);if(s&&s.ignoreEvent(t)){e||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&n.focusNode&&Rr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:t}=this,e=Q.safari&&t.root.nodeType==11&&AO(this.dom.ownerDocument)==this.dom&&L0(this.view)||Ss(t.root);if(!e||this.selectionRange.eq(e))return!1;let r=Os(this.dom,e);return r&&!this.selectionChanged&&t.inputState.lastFocusTime>Date.now()-200&&t.inputState.lastTouchTime{let s=this.delayedAndroidKey;s&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=s.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&s.force&&zi(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(n)}(!this.delayedAndroidKey||t==\"Enter\")&&(this.delayedAndroidKey={key:t,keyCode:e,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}processRecords(){let t=this.pendingRecords();t.length&&(this.queue=[]);let e=-1,r=-1,n=!1;for(let s of t){let o=this.readMutation(s);o&&(o.typeOver&&(n=!0),e==-1?{from:e,to:r}=o:(e=Math.min(o.from,e),r=Math.max(o.to,r)))}return{from:e,to:r,typeOver:n}}readChange(){let{from:t,to:e,typeOver:r}=this.processRecords(),n=this.selectionChanged&&Os(this.dom,this.selectionRange);if(t<0&&!n)return null;t>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new ya(this.view,t,e,r);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(t=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;t&&this.readSelectionRange();let e=this.readChange();if(!e)return this.view.requestMeasure(),!1;let r=this.view.state,n=Ed(this.view,e);return this.view.state==r&&this.view.update([]),n}readMutation(t){let e=this.view.docView.nearest(t.target);if(!e||e.ignoreMutation(t))return null;if(e.markDirty(t.type==\"attributes\"),t.type==\"attributes\"&&(e.flags|=4),t.type==\"childList\"){let r=Qu(e,t.previousSibling||t.target.previousSibling,-1),n=Qu(e,t.nextSibling||t.target.nextSibling,1);return{from:r?e.posAfter(r):e.posAtStart,to:n?e.posBefore(n):e.posAtEnd,typeOver:!1}}else return t.type==\"characterData\"?{from:e.posAtStart,to:e.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}:null}setWindow(t){t!=this.win&&(this.removeWindowListeners(this.win),this.win=t,this.addWindowListeners(this.win))}addWindowListeners(t){t.addEventListener(\"resize\",this.onResize),t.addEventListener(\"beforeprint\",this.onPrint),t.addEventListener(\"scroll\",this.onScroll),t.document.addEventListener(\"selectionchange\",this.onSelectionChange)}removeWindowListeners(t){t.removeEventListener(\"scroll\",this.onScroll),t.removeEventListener(\"resize\",this.onResize),t.removeEventListener(\"beforeprint\",this.onPrint),t.document.removeEventListener(\"selectionchange\",this.onSelectionChange)}destroy(){var t,e,r;this.stop(),(t=this.intersection)===null||t===void 0||t.disconnect(),(e=this.gapIntersection)===null||e===void 0||e.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let n of this.scrollTargets)n.removeEventListener(\"scroll\",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function Qu(i,t,e){for(;t;){let r=rt.get(t);if(r&&r.parent==i)return r;let n=t.parentNode;t=n!=i.dom?n:e>0?t.nextSibling:t.previousSibling}return null}function L0(i){let t=null;function e(a){a.preventDefault(),a.stopImmediatePropagation(),t=a.getTargetRanges()[0]}if(i.contentDOM.addEventListener(\"beforeinput\",e,!0),i.dom.ownerDocument.execCommand(\"indent\"),i.contentDOM.removeEventListener(\"beforeinput\",e,!0),!t)return null;let r=t.startContainer,n=t.startOffset,s=t.endContainer,o=t.endOffset,l=i.docView.domAtPos(i.state.selection.main.anchor);return Rr(l.node,l.offset,s,o)&&([r,n,s,o]=[s,o,r,n]),{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:o}}var T=class i{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement(\"div\"),this.scrollDOM=document.createElement(\"div\"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className=\"cm-scroller\",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement(\"div\"),this.announceDOM.className=\"cm-announced\",this.announceDOM.setAttribute(\"aria-live\",\"polite\"),this.dom=document.createElement(\"div\"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:e}=t;this.dispatchTransactions=t.dispatchTransactions||e&&(r=>r.forEach(n=>e(n,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=t.root||EO(t.parent)||document,this.viewState=new As(t.state||Y.create(t)),t.scrollTo&&t.scrollTo.is(hs)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Tr).map(r=>new $r(r));for(let r of this.plugins)r.update(this);this.observer=new ba(this),this.inputState=new sa(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ts(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure()}dispatch(...t){let e=t.length==1&&t[0]instanceof lt?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(e,this)}update(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.update are not allowed while an update is in progress\");let e=!1,r=!1,n,s=this.state;for(let u of t){if(u.startState!=s)throw new RangeError(\"Trying to update state with a transaction that doesn't start from the previous state.\");s=u.state}if(this.destroyed){this.viewState.state=s;return}let o=this.hasFocus,l=0,a=null;t.some(u=>u.annotation(Pd))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Cd(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(f=null)):this.observer.clear(),s.facet(Y.phrases)!=this.state.facet(Y.phrases))return this.setState(s);n=ks.create(this,s,t),n.flags|=l;let c=this.viewState.scrollTarget;try{this.updateState=2;for(let u of t){if(c&&(c=c.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;c=new Er(d.empty?d:b.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(hs)&&(c=d.value.clip(this.state))}this.viewState.update(n,c),this.bidiCache=Rs.update(this.bidiCache,n.changes),n.empty||(this.updatePlugins(n),this.inputState.update(n)),e=this.docView.update(n),this.state.facet(Pr)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(e,t.some(u=>u.isUserEvent(\"select.pointer\")))}finally{this.updateState=0}if(n.startState.facet(ps)!=n.state.facet(ps)&&(this.viewState.mustMeasureContent=!0),(e||r||c||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!n.empty)for(let u of this.state.facet(ia))try{u(n)}catch(d){Ct(this.state,d,\"update listener\")}(a||f)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),f&&!Ed(this,f)&&h.force&&zi(this.contentDOM,h.key,h.keyCode)})}setState(t){if(this.updateState!=0)throw new Error(\"Calls to EditorView.setState are not allowed while an update is in progress\");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let e=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new As(t),this.plugins=t.facet(Tr).map(r=>new $r(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Ts(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}e&&this.focus(),this.requestMeasure()}updatePlugins(t){let e=t.startState.facet(Tr),r=t.state.facet(Tr);if(e!=r){let n=[];for(let s of r){let o=e.indexOf(s);if(o<0)n.push(new $r(s));else{let l=this.plugins[o];l.mustUpdate=t,n.push(l)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=n,this.pluginMap.clear()}else for(let n of this.plugins)n.mustUpdate=t;for(let n=0;n-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let e=null,r=this.scrollDOM,n=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(n-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(zu(r))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(n);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?\"Measure loop restarted more than 5 times\":\"Viewport failed to stabilize\");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(d=>{try{return d.read(this)}catch(m){return Ct(this.state,m),Ru}}),c=ks.create(this,this.state,[]),u=!1;c.flags|=a,e?e.flags|=a:e=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),u=this.docView.update(c));for(let d=0;d1||m<-1){n=n+m,r.scrollTop=n/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(e&&!e.empty)for(let l of this.state.facet(ia))l(e)}get themeClasses(){return ga+\" \"+(this.state.facet(ma)?Rd:Qd)+\" \"+this.state.facet(ps)}updateAttrs(){let t=Mu(this,ud,{class:\"cm-editor\"+(this.hasFocus?\" cm-focused \":\" \")+this.themeClasses}),e={spellcheck:\"false\",autocorrect:\"off\",autocapitalize:\"off\",translate:\"no\",contenteditable:this.state.facet(Xs)?\"true\":\"false\",class:\"cm-content\",style:`${Q.tabSize}: ${this.state.tabSize}`,role:\"textbox\",\"aria-multiline\":\"true\"};this.state.readOnly&&(e[\"aria-readonly\"]=\"true\"),Mu(this,Ea,e);let r=this.observer.ignore(()=>{let n=jl(this.contentDOM,this.contentAttrs,e),s=jl(this.dom,this.editorAttrs,t);return n||s});return this.editorAttrs=t,this.contentAttrs=e,r}showAnnouncements(t){let e=!0;for(let r of t)for(let n of r.effects)if(n.is(i.announce)){e&&(this.announceDOM.textContent=\"\"),e=!1;let s=this.announceDOM.appendChild(document.createElement(\"div\"));s.textContent=n.value}}mountStyles(){this.styleModules=this.state.facet(Pr);let t=this.state.facet(i.cspNonce);Gt.mount(this.root,this.styleModules.concat(M0).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error(\"Reading the editor layout isn't allowed during an update\");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let e=0;er.spec==t)||null),e&&e.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,e,r){return Wl(this,t,mu(this,t,e,r))}moveByGroup(t,e){return Wl(this,t,mu(this,t,e,r=>a0(this,t.head,r)))}visualLineSide(t,e){let r=this.bidiSpans(t),n=this.textDirectionAt(t.from),s=r[e?r.length-1:0];return b.cursor(s.side(e,n)+t.from,s.forward(!e,n)?1:-1)}moveToLineBoundary(t,e,r=!0){return l0(this,t,e,r)}moveVertically(t,e,r){return Wl(this,t,h0(this,t,e,r))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,e=0){return this.docView.posFromDOM(t,e)}posAtCoords(t,e=!0){return this.readMeasured(),yd(this,t,e)}coordsAtPos(t,e=1){this.readMeasured();let r=this.docView.coordsAt(t,e);if(!r||r.left==r.right)return r;let n=this.state.doc.lineAt(t),s=this.bidiSpans(n),o=s[Oe.find(s,t-n.from,-1,e)];return Aa(r,o.dir==G.LTR==e>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(fd)||tthis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>V0)return id(t.length);let e=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==e&&(s.fresh||ed(s.isolates,r=fu(this,t))))return s.order;r||(r=fu(this,t));let n=ZO(t.text,e,r);return this.bidiCache.push(new Rs(t.from,t.to,e,r,!0,n)),n}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Nu(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,e={}){return hs.of(new Er(typeof t==\"number\"?b.cursor(t):t,e.y,e.x,e.yMargin,e.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:e}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return hs.of(new Er(b.cursor(r.from),\"start\",\"start\",r.top-t,e,!0))}static domEventHandlers(t){return ft.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return ft.define(()=>({}),{eventObservers:t})}static theme(t,e){let r=Gt.newName(),n=[ps.of(r),Pr.of(Oa(`.${r}`,t))];return e&&e.dark&&n.push(ma.of(!0)),n}static baseTheme(t){return ie.lowest(Pr.of(Oa(\".\"+ga,t,Md)))}static findFromDOM(t){var e;let r=t.querySelector(\".cm-content\"),n=r&&rt.get(r)||rt.get(t);return((e=n?.rootView)===null||e===void 0?void 0:e.view)||null}};T.styleModule=Pr;T.inputHandler=ad;T.focusChangeEffect=hd;T.perLineTextDirection=fd;T.exceptionSink=ld;T.updateListener=ia;T.editable=Xs;T.mouseSelectionStyle=od;T.dragMovesSelection=sd;T.clickAddsSelectionRange=nd;T.decorations=Yr;T.outerDecorations=dd;T.atomicRanges=$a;T.bidiIsolatedRanges=pd;T.scrollMargins=md;T.darkTheme=ma;T.cspNonce=A.define({combine:i=>i.length?i[0]:\"\"});T.contentAttributes=Ea;T.editorAttributes=ud;T.lineWrapping=T.contentAttributes.of({class:\"cm-lineWrapping\"});T.announce=M.define();var V0=4096,Ru={},Rs=class i{constructor(t,e,r,n,s,o){this.from=t,this.to=e,this.dir=r,this.isolates=n,this.fresh=s,this.order=o}static update(t,e){if(e.empty&&!t.some(s=>s.fresh))return t;let r=[],n=t.length?t[t.length-1].dir:G.LTR;for(let s=Math.max(0,t.length-10);s=0;n--){let s=r[n],o=typeof s==\"function\"?s(i):s;o&&Ul(o,e)}return e}var W0=Q.mac?\"mac\":Q.windows?\"win\":Q.linux?\"linux\":\"key\";function I0(i,t){let e=i.split(/-(?!$)/),r=e[e.length-1];r==\"Space\"&&(r=\" \");let n,s,o,l;for(let a=0;ar.concat(n),[]))),e}function qd(i,t,e){return Dd($d(i.state),t,i,e)}var Ie=null,Y0=4e3;function z0(i,t=W0){let e=Object.create(null),r=Object.create(null),n=(o,l)=>{let a=r[o];if(a==null)r[o]=l;else if(a!=l)throw new Error(\"Key binding \"+o+\" is used both as a regular binding and as a multi-stroke prefix\")},s=(o,l,a,h,f)=>{var c,u;let d=e[o]||(e[o]=Object.create(null)),m=l.split(/ (?!$)/).map(x=>I0(x,t));for(let x=1;x{let v=Ie={view:C,prefix:S,scope:o};return setTimeout(()=>{Ie==v&&(Ie=null)},Y0),!0}]})}let O=m.join(\" \");n(O,!1);let g=d[O]||(d[O]={preventDefault:!1,stopPropagation:!1,run:((u=(c=d._any)===null||c===void 0?void 0:c.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),f&&(g.stopPropagation=!0)};for(let o of i){let l=o.scope?o.scope.split(\" \"):[\"editor\"];if(o.any)for(let h of l){let f=e[h]||(e[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let c in f)f[c].run.push(o.any)}let a=o[t]||o.key;if(a)for(let h of l)s(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&s(h,\"Shift-\"+a,o.shift,o.preventDefault,o.stopPropagation)}return e}function Dd(i,t,e,r){let n=iu(t),s=dt(n,0),o=wt(s)==n.length&&n!=\" \",l=\"\",a=!1,h=!1,f=!1;Ie&&Ie.view==e&&Ie.scope==r&&(l=Ie.prefix+\" \",Sd.indexOf(t.keyCode)<0&&(h=!0,Ie=null));let c=new Set,u=g=>{if(g){for(let x of g.run)if(!c.has(x)&&(c.add(x),x(e,t)))return g.stopPropagation&&(f=!0),!0;g.preventDefault&&(g.stopPropagation&&(f=!0),h=!0)}return!1},d=i[r],m,O;return d&&(u(d[l+ms(n,t,!o)])?a=!0:o&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Q.windows&&t.ctrlKey&&t.altKey)&&(m=$e[t.keyCode])&&m!=n?(u(d[l+ms(m,t,!0)])||t.shiftKey&&(O=Vi[t.keyCode])!=n&&O!=m&&u(d[l+ms(O,t,!1)]))&&(a=!0):o&&t.shiftKey&&u(d[l+ms(n,t,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&f&&t.stopPropagation(),a}var zr=class i{constructor(t,e,r,n,s){this.className=t,this.left=e,this.top=r,this.width=n,this.height=s}draw(){let t=document.createElement(\"div\");return t.className=this.className,this.adjust(t),t}update(t,e){return e.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+\"px\",t.style.top=this.top+\"px\",this.width!=null&&(t.style.width=this.width+\"px\"),t.style.height=this.height+\"px\"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,e,r){if(r.empty){let n=t.coordsAtPos(r.head,r.assoc||1);if(!n)return[];let s=Bd(t);return[new i(e,n.left-s.left,n.top-s.top,null,n.bottom-n.top)]}else return Z0(t,e,r)}};function Bd(i){let t=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==G.LTR?t.left:t.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:t.top-i.scrollDOM.scrollTop*i.scaleY}}function $u(i,t,e){let r=b.cursor(t);return{from:Math.max(e.from,i.moveToLineBoundary(r,!1,!0).from),to:Math.min(e.to,i.moveToLineBoundary(r,!0,!0).from),type:Pt.Text}}function Z0(i,t,e){if(e.to<=i.viewport.from||e.from>=i.viewport.to)return[];let r=Math.max(e.from,i.viewport.from),n=Math.min(e.to,i.viewport.to),s=i.textDirection==G.LTR,o=i.contentDOM,l=o.getBoundingClientRect(),a=Bd(i),h=o.querySelector(\".cm-line\"),f=h&&window.getComputedStyle(h),c=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),u=l.right-(f?parseInt(f.paddingRight):0),d=na(i,r),m=na(i,n),O=d.type==Pt.Text?d:null,g=m.type==Pt.Text?m:null;if(O&&(i.lineWrapping||d.widgetLineBreaks)&&(O=$u(i,r,O)),g&&(i.lineWrapping||m.widgetLineBreaks)&&(g=$u(i,n,g)),O&&g&&O.from==g.from)return S(C(e.from,e.to,O));{let y=O?C(e.from,null,O):v(d,!1),k=g?C(null,e.to,g):v(m,!0),w=[];return(O||d).to<(g||m).from-(O&&g?1:0)||d.widgetLineBreaks>1&&y.bottom+i.defaultLineHeight/2D&&N.from=Rt)break;ct>nt&&B(Math.max(Ft,nt),y==null&&Ft<=D,Math.min(ct,Rt),k==null&&ct>=U,Bt.dir)}if(nt=Mt.to+1,nt>=Rt)break}return W.length==0&&B(D,y==null,U,k==null,i.textDirection),{top:q,bottom:L,horizontal:W}}function v(y,k){let w=l.top+(k?y.top:y.bottom);return{top:w,bottom:w,horizontal:[]}}}function F0(i,t){return i.constructor==t.constructor&&i.eq(t)}var Sa=class{constructor(t,e){this.view=t,this.layer=e,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement(\"div\")),this.dom.classList.add(\"cm-layer\"),e.above&&this.dom.classList.add(\"cm-layer-above\"),e.class&&this.dom.classList.add(e.class),this.scale(),this.dom.setAttribute(\"aria-hidden\",\"true\"),this.setOrder(t.state),t.requestMeasure(this.measureReq),e.mount&&e.mount(this.dom,t)}update(t){t.startState.facet(bs)!=t.state.facet(bs)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}setOrder(t){let e=0,r=t.facet(bs);for(;e!F0(e,this.drawn[r]))){let e=this.dom.firstChild,r=0;for(let n of t)n.update&&e&&n.constructor&&this.drawn[r].constructor&&n.update(e,this.drawn[r])?(e=e.nextSibling,r++):this.dom.insertBefore(n.draw(),e);for(;e;){let n=e.nextSibling;e.remove(),e=n}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},bs=A.define();function Xd(i){return[ft.define(t=>new Sa(t,i)),bs.of(i)]}var Ld=!Q.ios,Zr=A.define({combine(i){return kt(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,e)=>Math.min(t,e),drawRangeCursor:(t,e)=>t||e})}});function Ls(i={}){return[Zr.of(i),_0,G0,H0,cd.of(!0)]}function Vd(i){return i.startState.facet(Zr)!=i.state.facet(Zr)}var _0=Xd({above:!0,markers(i){let{state:t}=i,e=t.facet(Zr),r=[];for(let n of t.selection.ranges){let s=n==t.selection.main;if(n.empty?!s||Ld:e.drawRangeCursor){let o=s?\"cm-cursor cm-cursor-primary\":\"cm-cursor cm-cursor-secondary\",l=n.empty?n:b.cursor(n.head,n.head>n.anchor?-1:1);for(let a of zr.forRange(i,o,l))r.push(a)}}return r},update(i,t){i.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName==\"cm-blink\"?\"cm-blink2\":\"cm-blink\");let e=Vd(i);return e&&qu(i.state,t),i.docChanged||i.selectionSet||e},mount(i,t){qu(t.state,i)},class:\"cm-cursorLayer\"});function qu(i,t){t.style.animationDuration=i.facet(Zr).cursorBlinkRate+\"ms\"}var G0=Xd({above:!1,markers(i){return i.state.selection.ranges.map(t=>t.empty?[]:zr.forRange(i,\"cm-selectionBackground\",t)).reduce((t,e)=>t.concat(e))},update(i,t){return i.docChanged||i.selectionSet||i.viewportChanged||Vd(i)},class:\"cm-selectionLayer\"}),wa={\".cm-line\":{\"& ::selection\":{backgroundColor:\"transparent !important\"},\"&::selection\":{backgroundColor:\"transparent !important\"}}};Ld&&(wa[\".cm-line\"].caretColor=\"transparent !important\",wa[\".cm-content\"]={caretColor:\"transparent !important\"});var H0=ie.highest(T.theme(wa)),Wd=M.define({map(i,t){return i==null?null:t.mapPos(i)}}),Qr=it.define({create(){return null},update(i,t){return i!=null&&(i=t.changes.mapPos(i)),t.effects.reduce((e,r)=>r.is(Wd)?r.value:e,i)}}),U0=ft.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var t;let e=i.state.field(Qr);e==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement(\"div\")),this.cursor.className=\"cm-dropCursor\"),(i.startState.field(Qr)!=e||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,t=i.state.field(Qr),e=t!=null&&i.coordsAtPos(t);if(!e)return null;let r=i.scrollDOM.getBoundingClientRect();return{left:e.left-r.left+i.scrollDOM.scrollLeft*i.scaleX,top:e.top-r.top+i.scrollDOM.scrollTop*i.scaleY,height:e.bottom-e.top}}drawCursor(i){if(this.cursor){let{scaleX:t,scaleY:e}=this.view;i?(this.cursor.style.left=i.left/t+\"px\",this.cursor.style.top=i.top/e+\"px\",this.cursor.style.height=i.height/e+\"px\"):this.cursor.style.left=\"-100000px\"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Qr)!=i&&this.view.dispatch({effects:Wd.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Vs(){return[Qr,U0]}var Aw=/x/.unicode!=null?\"gu\":\"g\";var va=2e3;function j0(i,t,e){let r=Math.min(t.line,e.line),n=Math.max(t.line,e.line),s=[];if(t.off>va||e.off>va||t.col<0||e.col<0){let o=Math.min(t.off,e.off),l=Math.max(t.off,e.off);for(let a=r;a<=n;a++){let h=i.doc.line(a);h.length<=l&&s.push(b.range(h.from+o,h.to+l))}}else{let o=Math.min(t.col,e.col),l=Math.max(t.col,e.col);for(let a=r;a<=n;a++){let h=i.doc.line(a),f=os(h.text,o,i.tabSize,!0);if(f<0)s.push(b.cursor(h.to));else{let c=os(h.text,l,i.tabSize);s.push(b.range(h.from+f,h.from+c))}}}return s}function K0(i,t){let e=i.coordsAtPos(i.viewport.from);return e?Math.round(Math.abs((e.left-t)/i.defaultCharacterWidth)):-1}function Du(i,t){let e=i.posAtCoords({x:t.clientX,y:t.clientY},!1),r=i.state.doc.lineAt(e),n=e-r.from,s=n>va?-1:n==r.length?K0(i,t.clientX):We(r.text,i.state.tabSize,e-r.from);return{line:r.number,col:s,off:n}}function J0(i,t){let e=Du(i,t),r=i.state.selection;return e?{update(n){if(n.docChanged){let s=n.changes.mapPos(n.startState.doc.line(e.line).from),o=n.state.doc.lineAt(s);e={line:o.number,col:e.col,off:Math.min(e.off,o.length)},r=r.map(n.changes)}},get(n,s,o){let l=Du(i,n);if(!l)return r;let a=j0(i.state,e,l);return a.length?o?b.create(a.concat(r.ranges)):b.create(a):r}}:null}function qa(i){let t=i?.eventFilter||(e=>e.altKey&&e.button==0);return T.mouseSelectionStyle.of((e,r)=>t(r)?J0(e,r):null)}var tx={Alt:[18,i=>!!i.altKey],Control:[17,i=>!!i.ctrlKey],Shift:[16,i=>!!i.shiftKey],Meta:[91,i=>!!i.metaKey]},ex={style:\"cursor: crosshair\"};function Ws(i={}){let[t,e]=tx[i.key||\"Alt\"],r=ft.fromClass(class{constructor(n){this.view=n,this.isDown=!1}set(n){this.isDown!=n&&(this.isDown=n,this.view.update([]))}},{eventObservers:{keydown(n){this.set(n.keyCode==t||e(n))},keyup(n){(n.keyCode==t||!e(n))&&this.set(!1)},mousemove(n){this.set(e(n))}}});return[r,T.contentAttributes.of(n=>{var s;return!((s=n.plugin(r))===null||s===void 0)&&s.isDown?ex:null})]}var kr=\"-10000px\",Ms=class{constructor(t,e,r,n){this.facet=e,this.createTooltipView=r,this.removeTooltipView=n,this.input=t.state.facet(e),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=r(o,s))}update(t,e){var r;let n=t.state.facet(this.facet),s=n.filter(a=>a);if(n===this.input){for(let a of this.tooltipViews)a.update&&a.update(t);return!1}let o=[],l=e?[]:null;for(let a=0;ae[h]=a),e.length=l.length),this.input=n,this.tooltips=s,this.tooltipViews=o,!0}};function ix(i){let{win:t}=i;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}var Nl=A.define({combine:i=>{var t,e,r;return{position:Q.ios?\"absolute\":((t=i.find(n=>n.position))===null||t===void 0?void 0:t.position)||\"fixed\",parent:((e=i.find(n=>n.parent))===null||e===void 0?void 0:e.parent)||null,tooltipSpace:((r=i.find(n=>n.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||ix}}}),Bu=new WeakMap,Da=ft.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=i.state.facet(Nl);this.position=t.position,this.parent=t.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==\"function\"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Ms(i,Fr,(e,r)=>this.createTooltip(e,r),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==\"function\"?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener(\"resize\",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(\"div\"),this.container.style.position=\"relative\",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(i,this.above);t&&this.observeIntersection();let e=t||i.geometryChanged,r=i.state.facet(Nl);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let n of this.manager.tooltipViews)n.dom.style.position=this.position;e=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let n of this.manager.tooltipViews)this.container.appendChild(n.dom);e=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);e&&this.maybeMeasure()}createTooltip(i,t){let e=i.create(this.view),r=t?t.dom:null;if(e.dom.classList.add(\"cm-tooltip\"),i.arrow&&!e.dom.querySelector(\".cm-tooltip > .cm-tooltip-arrow\")){let n=document.createElement(\"div\");n.className=\"cm-tooltip-arrow\",e.dom.insertBefore(n,r)}return e.dom.style.position=this.position,e.dom.style.top=kr,e.dom.style.left=\"0px\",this.container.insertBefore(e.dom,r),e.mount&&e.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(e.dom),e}destroy(){var i,t,e;this.view.win.removeEventListener(\"resize\",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(i=r.destroy)===null||i===void 0||i.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(e=this.intersectionObserver)===null||e===void 0||e.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=this.view.dom.getBoundingClientRect(),t=1,e=1,r=!1;if(this.position==\"fixed\"&&this.manager.tooltipViews.length){let{dom:n}=this.manager.tooltipViews[0];if(Q.gecko)r=n.offsetParent!=this.container.ownerDocument.body;else if(n.style.top==kr&&n.style.left==\"0px\"){let s=n.getBoundingClientRect();r=Math.abs(s.top+1e4)>1||Math.abs(s.left)>1}}if(r||this.position==\"absolute\")if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(t=n.width/this.parent.offsetWidth,e=n.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);return{editor:i,parent:this.parent?this.container.getBoundingClientRect():i,pos:this.manager.tooltips.map((n,s)=>{let o=this.manager.tooltipViews[s];return o.getCoords?o.getCoords(n.pos):this.view.coordsAtPos(n.pos)}),size:this.manager.tooltipViews.map(({dom:n})=>n.getBoundingClientRect()),space:this.view.state.facet(Nl).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:r}}writeMeasure(i){var t;if(i.makeAbsolute){this.madeAbsolute=!0,this.position=\"absolute\";for(let l of this.manager.tooltipViews)l.dom.style.position=\"absolute\"}let{editor:e,space:r,scaleX:n,scaleY:s}=i,o=[];for(let l=0;l=Math.min(e.bottom,r.bottom)||c.rightMath.min(e.right,r.right)+.1){f.style.top=kr;continue}let d=a.arrow?h.dom.querySelector(\".cm-tooltip-arrow\"):null,m=d?7:0,O=u.right-u.left,g=(t=Bu.get(h))!==null&&t!==void 0?t:u.bottom-u.top,x=h.offset||nx,S=this.view.textDirection==G.LTR,C=u.width>r.right-r.left?S?r.left:r.right-u.width:S?Math.min(c.left-(d?14:0)+x.x,r.right-O):Math.max(r.left,c.left-O+(d?14:0)-x.x),v=this.above[l];!a.strictSide&&(v?c.top-(u.bottom-u.top)-x.yr.bottom)&&v==r.bottom-c.bottom>c.top-r.top&&(v=this.above[l]=!v);let y=(v?c.top-r.top:r.bottom-c.bottom)-m;if(yC&&q.topk&&(k=v?q.top-g-2-m:q.bottom+m+2);if(this.position==\"absolute\"?(f.style.top=(k-i.parent.top)/s+\"px\",f.style.left=(C-i.parent.left)/n+\"px\"):(f.style.top=k/s+\"px\",f.style.left=C/n+\"px\"),d){let q=c.left+(S?x.x:-x.x)-(C+14-7);d.style.left=q/n+\"px\"}h.overlap!==!0&&o.push({left:C,top:k,right:w,bottom:k+g}),f.classList.toggle(\"cm-tooltip-above\",v),f.classList.toggle(\"cm-tooltip-below\",!v),h.positioned&&h.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=kr}},{eventObservers:{scroll(){this.maybeMeasure()}}}),rx=T.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:\"7px\",width:`${7*2}px`,position:\"absolute\",zIndex:-1,overflow:\"hidden\",\"&:before, &:after\":{content:\"''\",position:\"absolute\",width:0,height:0,borderLeft:\"7px solid transparent\",borderRight:\"7px solid transparent\"},\".cm-tooltip-above &\":{bottom:\"-7px\",\"&:before\":{borderTop:\"7px solid #bbb\"},\"&:after\":{borderTop:\"7px solid #f5f5f5\",bottom:\"1px\"}},\".cm-tooltip-below &\":{top:\"-7px\",\"&:before\":{borderBottom:\"7px solid #bbb\"},\"&:after\":{borderBottom:\"7px solid #f5f5f5\",top:\"1px\"}}},\"&dark .cm-tooltip .cm-tooltip-arrow\":{\"&:before\":{borderTopColor:\"#333338\",borderBottomColor:\"#333338\"},\"&:after\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"}}}),nx={x:0,y:0},Fr=A.define({enables:[Da,rx]}),Es=A.define({combine:i=>i.reduce((t,e)=>t.concat(e),[])}),$s=class i{static create(t){return new i(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement(\"div\"),this.dom.classList.add(\"cm-tooltip-hover\"),this.manager=new Ms(t,Es,(e,r)=>this.createHostedView(e,r),e=>e.dom.remove())}createHostedView(t,e){let r=t.create(this.view);return r.dom.classList.add(\"cm-tooltip-section\"),this.dom.insertBefore(r.dom,e?e.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let e of this.manager.tooltipViews)e.mount&&e.mount(t);this.mounted=!0}positioned(t){for(let e of this.manager.tooltipViews)e.positioned&&e.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let e of this.manager.tooltipViews)(t=e.destroy)===null||t===void 0||t.call(e)}passProp(t){let e;for(let r of this.manager.tooltipViews){let n=r[t];if(n!==void 0){if(e===void 0)e=n;else if(e!==n)return}}return e}get offset(){return this.passProp(\"offset\")}get getCoords(){return this.passProp(\"getCoords\")}get overlap(){return this.passProp(\"overlap\")}get resize(){return this.passProp(\"resize\")}},sx=Fr.compute([Es],i=>{let t=i.facet(Es);return t.length===0?null:{pos:Math.min(...t.map(e=>e.pos)),end:Math.max(...t.map(e=>{var r;return(r=e.end)!==null&&r!==void 0?r:e.pos})),create:$s.create,above:t[0].above,arrow:t.some(e=>e.arrow)}}),ka=class{constructor(t,e,r,n,s){this.view=t,this.source=e,this.field=r,this.setHover=n,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener(\"mouseleave\",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener(\"mousemove\",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;tl.bottom||e.xl.right+t.defaultCharacterWidth)return;let a=t.bidiSpans(t.state.doc.lineAt(n)).find(f=>f.from<=n&&f.to>=n),h=a&&a.dir==G.RTL?-1:1;s=e.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>Ct(t.state,a,\"hover tooltip\"))}else o&&!(Array.isArray(o)&&!o.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let t=this.view.plugin(Da),e=t?t.manager.tooltips.findIndex(r=>r.create==$s.create):-1;return e>-1?t.manager.tooltipViews[e]:null}mousemove(t){var e,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:n,tooltip:s}=this;if(n.length&&s&&!ox(s.dom,t)||this.pending){let{pos:o}=n[0]||this.pending,l=(r=(e=n[0])===null||e===void 0?void 0:e.end)!==null&&r!==void 0?r:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!lx(this.view,o,l,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:e}=this;if(e.length){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let e=r=>{t.removeEventListener(\"mouseleave\",e),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener(\"mouseleave\",e)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener(\"mouseleave\",this.mouseleave),this.view.dom.removeEventListener(\"mousemove\",this.mousemove)}},gs=4;function ox(i,t){let e=i.getBoundingClientRect();return t.clientX>=e.left-gs&&t.clientX<=e.right+gs&&t.clientY>=e.top-gs&&t.clientY<=e.bottom+gs}function lx(i,t,e,r,n,s){let o=i.scrollDOM.getBoundingClientRect(),l=i.documentTop+i.documentPadding.top+i.contentHeight;if(o.left>r||o.rightn||Math.min(o.bottom,l)=t&&a<=e}function Id(i,t={}){let e=M.define(),r=it.define({create(){return[]},update(n,s){if(n.length&&(t.hideOnChange&&(s.docChanged||s.selection)?n=[]:t.hideOn&&(n=n.filter(o=>!t.hideOn(s,o))),s.docChanged)){let o=[];for(let l of n){let a=s.changes.mapPos(l.pos,-1,ut.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=s.changes.mapPos(h.end)),o.push(h)}}n=o}for(let o of s.effects)o.is(e)&&(n=o.value),o.is(ax)&&(n=[]);return n},provide:n=>Es.from(n)});return[r,ft.define(n=>new ka(n,i,r,e,t.hoverTime||300)),sx]}function Ba(i,t){let e=i.plugin(Da);if(!e)return null;let r=e.manager.tooltips.indexOf(t);return r<0?null:e.manager.tooltipViews[r]}var ax=M.define();var Xu=A.define({combine(i){let t,e;for(let r of i)t=t||r.topContainer,e=e||r.bottomContainer;return{topContainer:t,bottomContainer:e}}});function ci(i,t){let e=i.plugin(Nd),r=e?e.specs.indexOf(t):-1;return r>-1?e.panels[r]:null}var Nd=ft.fromClass(class{constructor(i){this.input=i.state.facet(fi),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(e=>e(i));let t=i.state.facet(Xu);this.top=new Ni(i,!0,t.topContainer),this.bottom=new Ni(i,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(\"cm-panel\"),e.mount&&e.mount()}update(i){let t=i.state.facet(Xu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Ni(i.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Ni(i.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let e=i.state.facet(fi);if(e!=this.input){let r=e.filter(a=>a),n=[],s=[],o=[],l=[];for(let a of r){let h=this.specs.indexOf(a),f;h<0?(f=a(i.view),l.push(f)):(f=this.panels[h],f.update&&f.update(i)),n.push(f),(f.top?s:o).push(f)}this.specs=r,this.panels=n,this.top.sync(s),this.bottom.sync(o);for(let a of l)a.dom.classList.add(\"cm-panel\"),a.mount&&a.mount()}else for(let r of this.panels)r.update&&r.update(i)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return e&&{top:e.top.scrollMargin(),bottom:e.bottom.scrollMargin()}})}),Ni=class{constructor(t,e,r){this.view=t,this.top=e,this.container=r,this.dom=void 0,this.classes=\"\",this.panels=[],this.syncClasses()}sync(t){for(let e of this.panels)e.destroy&&t.indexOf(e)<0&&e.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement(\"div\"),this.dom.className=this.top?\"cm-panels cm-panels-top\":\"cm-panels cm-panels-bottom\",this.dom.style[this.top?\"top\":\"bottom\"]=\"0\";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let t=this.dom.firstChild;for(let e of this.panels)if(e.dom.parentNode==this.dom){for(;t!=e.dom;)t=Lu(t);t=t.nextSibling}else this.dom.insertBefore(e.dom,t);for(;t;)t=Lu(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(\" \"))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(\" \"))t&&this.container.classList.add(t)}}};function Lu(i){let t=i.nextSibling;return i.remove(),t}var fi=A.define({enables:Nd}),se=class extends ee{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}};se.prototype.elementClass=\"\";se.prototype.toDOM=void 0;se.prototype.mapMode=ut.TrackBefore;se.prototype.startSide=se.prototype.endSide=-1;se.prototype.point=!0;var Yl=A.define(),hx={class:\"\",renderEmptyElements:!1,elementStyle:\"\",markers:()=>_.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Dr=A.define();function _r(i){return[Yd(),Dr.of(Object.assign(Object.assign({},hx),i))]}var Ta=A.define({combine:i=>i.some(t=>t)});function Yd(i){let t=[fx];return i&&i.fixed===!1&&t.push(Ta.of(!0)),t}var fx=ft.fromClass(class{constructor(i){this.view=i,this.prevViewport=i.viewport,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutters\",this.dom.setAttribute(\"aria-hidden\",\"true\"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+\"px\",this.gutters=i.state.facet(Dr).map(t=>new qs(i,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!i.state.facet(Ta),this.fixed&&(this.dom.style.position=\"sticky\"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}update(i){if(this.updateGutters(i)){let t=this.prevViewport,e=i.view.viewport,r=Math.min(t.to,e.to)-Math.max(t.from,e.from);this.syncGutters(r<(e.to-e.from)*.8)}i.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+\"px\"),this.view.state.facet(Ta)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?\"sticky\":\"\"),this.prevViewport=i.view.viewport}syncGutters(i){let t=this.dom.nextSibling;i&&this.dom.remove();let e=_.iter(this.view.state.facet(Yl),this.view.viewport.from),r=[],n=this.gutters.map(s=>new Ca(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==Pt.Text&&o){Pa(e,r,l.from);for(let a of n)a.line(this.view,l,r);o=!1}else if(l.widget)for(let a of n)a.widget(this.view,l)}else if(s.type==Pt.Text){Pa(e,r,s.from);for(let o of n)o.line(this.view,s,r)}else if(s.widget)for(let o of n)o.widget(this.view,s);for(let s of n)s.finish();i&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(i){let t=i.startState.facet(Dr),e=i.state.facet(Dr),r=i.docChanged||i.heightChanged||i.viewportChanged||!_.eq(i.startState.facet(Yl),i.state.facet(Yl),i.view.viewport.from,i.view.viewport.to);if(t==e)for(let n of this.gutters)n.update(i)&&(r=!0);else{r=!0;let n=[];for(let s of e){let o=t.indexOf(s);o<0?n.push(new qs(this.view,s)):(this.gutters[o].update(i),n.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),n.indexOf(s)<0&&s.destroy();for(let s of n)this.dom.appendChild(s.dom);this.gutters=n}return r}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove()}},{provide:i=>T.scrollMargins.of(t=>{let e=t.plugin(i);return!e||e.gutters.length==0||!e.fixed?null:t.textDirection==G.LTR?{left:e.dom.offsetWidth*t.scaleX}:{right:e.dom.offsetWidth*t.scaleX}})});function Vu(i){return Array.isArray(i)?i:[i]}function Pa(i,t,e){for(;i.value&&i.from<=e;)i.from==e&&t.push(i.value),i.next()}var Ca=class{constructor(t,e,r){this.gutter=t,this.height=r,this.i=0,this.cursor=_.iter(t.markers,e.from)}addElement(t,e,r){let{gutter:n}=this,s=(e.top-this.height)/t.scaleY,o=e.height/t.scaleY;if(this.i==n.elements.length){let l=new Ds(t,o,s,r);n.elements.push(l),n.dom.appendChild(l.dom)}else n.elements[this.i].update(t,o,s,r);this.height=e.bottom,this.i++}line(t,e,r){let n=[];Pa(this.cursor,n,e.from),r.length&&(n=n.concat(r));let s=this.gutter.config.lineMarker(t,e,n);s&&n.unshift(s);let o=this.gutter;n.length==0&&!o.config.renderEmptyElements||this.addElement(t,e,n)}widget(t,e){let r=this.gutter.config.widgetMarker(t,e.widget,e);r&&this.addElement(t,e,[r])}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let e=t.elements.pop();t.dom.removeChild(e.dom),e.destroy()}}},qs=class{constructor(t,e){this.view=t,this.config=e,this.elements=[],this.spacer=null,this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutter\"+(this.config.class?\" \"+this.config.class:\"\");for(let r in e.domEventHandlers)this.dom.addEventListener(r,n=>{let s=n.target,o;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let a=s.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=n.clientY;let l=t.lineBlockAtHeight(o-t.documentTop);e.domEventHandlers[r](t,l,n)&&n.preventDefault()});this.markers=Vu(e.markers(t)),e.initialSpacer&&(this.spacer=new Ds(t,0,0,[e.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+=\"visibility: hidden; pointer-events: none\")}update(t){let e=this.markers;if(this.markers=Vu(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let n=this.config.updateSpacer(this.spacer.markers[0],t);n!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[n])}let r=t.view.viewport;return!_.eq(this.markers,e,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}},Ds=class{constructor(t,e,r,n){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement(\"div\"),this.dom.className=\"cm-gutterElement\",this.update(t,e,r,n)}update(t,e,r,n){this.height!=e&&(this.height=e,this.dom.style.height=e+\"px\"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+\"px\":\"\"),cx(this.markers,n)||this.setMarkers(t,n)}setMarkers(t,e){let r=\"cm-gutterElement\",n=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,h)||o(l,a,h):o}return r}})}}),Br=class extends se{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}};function zl(i,t){return i.state.facet(Yi).formatNumber(t,i.state)}var dx=Dr.compute([Yi],i=>({class:\"cm-lineNumbers\",renderEmptyElements:!1,markers(t){return t.state.facet(ux)},lineMarker(t,e,r){return r.some(n=>n.toDOM)?null:new Br(zl(t,t.state.doc.lineAt(e.from).number))},widgetMarker:()=>null,lineMarkerChange:t=>t.startState.facet(Yi)!=t.state.facet(Yi),initialSpacer(t){return new Br(zl(t,Wu(t.state.doc.lines)))},updateSpacer(t,e){let r=zl(e.view,Wu(e.view.state.doc.lines));return r==t.number?t:new Br(r)},domEventHandlers:i.facet(Yi).domEventHandlers}));function ui(i={}){return[Yi.of(i),Yd(),dx]}function Wu(i){let t=9;for(;t{throw new Error(\"This node type doesn't define a deserialize function\")})}add(t){if(this.perNode)throw new RangeError(\"Can't add per-node props to node types\");return typeof t!=\"function\"&&(t=bt.match(t)),e=>{let r=t(e);return r===void 0?null:[this,r]}}};E.closedBy=new E({deserialize:i=>i.split(\" \")});E.openedBy=new E({deserialize:i=>i.split(\" \")});E.group=new E({deserialize:i=>i.split(\" \")});E.isolate=new E({deserialize:i=>{if(i&&i!=\"rtl\"&&i!=\"ltr\"&&i!=\"auto\")throw new RangeError(\"Invalid value for isolate: \"+i);return i||\"auto\"}});E.contextHash=new E({perNode:!0});E.lookAhead=new E({perNode:!0});E.mounted=new E({perNode:!0});var Fi=class{constructor(t,e,r){this.tree=t,this.overlay=e,this.parser=r}static get(t){return t&&t.props&&t.props[E.mounted.id]}},mx=Object.create(null),bt=class i{constructor(t,e,r,n=0){this.name=t,this.props=e,this.id=r,this.flags=n}static define(t){let e=t.props&&t.props.length?Object.create(null):mx,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),n=new i(t.name||\"\",e,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(n)),s){if(s[0].perNode)throw new RangeError(\"Can't store a per-node prop on a node type\");e[s[0].id]=s[1]}}return n}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t==\"string\"){if(this.name==t)return!0;let e=this.prop(E.group);return e?e.indexOf(t)>-1:!1}return this.id==t}static match(t){let e=Object.create(null);for(let r in t)for(let n of r.split(\" \"))e[n]=t[r];return r=>{for(let n=r.prop(E.group),s=-1;s<(n?n.length:0);s++){let o=e[s<0?r.name:n[s]];if(o)return o}}}};bt.none=new bt(\"\",Object.create(null),0,8);var Hr=class i{constructor(t){this.types=t;for(let e=0;e0;for(let a=this.cursor(o|st.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=n&&(!l&&a.type.isAnonymous||e(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let e in this.props)t.push([+e,this.props[e]]);return t}balance(t={}){return this.children.length<=8?this:Ya(bt.none,this.children,this.positions,0,this.children.length,0,this.length,(e,r,n)=>new i(this.type,e,r,n,this.propValues),t.makeTree||((e,r,n)=>new i(bt.none,e,r,n)))}static build(t){return Ox(t)}};ot.empty=new ot(bt.none,[],[],0);var Xa=class i{constructor(t,e){this.buffer=t,this.index=e}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new i(this.buffer,this.index)}},_e=class i{constructor(t,e,r){this.buffer=t,this.length=e,this.set=r}get type(){return bt.none}toString(){let t=[];for(let e=0;e0));a=o[a+3]);return l}slice(t,e,r){let n=this.buffer,s=new Uint16Array(e-t),o=0;for(let l=t,a=0;l=t&&et;case 1:return e<=t&&r>t;case 2:return r>t;case 4:return!0}}function Ur(i,t,e,r){for(var n;i.from==i.to||(e<1?i.from>=t:i.from>t)||(e>-1?i.to<=t:i.to0?l.length:-1;t!=h;t+=e){let f=l[t],c=a[t]+o.from;if(_d(n,r,c,c+f.length)){if(f instanceof _e){if(s&st.ExcludeBuffers)continue;let u=f.findChild(0,f.buffer.length,e,r-c,n);if(u>-1)return new di(new Va(o,f,t,c),null,u)}else if(s&st.IncludeAnonymous||!f.type.isAnonymous||Na(f)){let u;if(!(s&st.IgnoreMounts)&&(u=Fi.get(f))&&!u.overlay)return new i(u.tree,c,t,o);let d=new i(f,c,t,o);return s&st.IncludeAnonymous||!d.type.isAnonymous?d:d.nextChild(e<0?f.children.length-1:0,e,r,n)}}}if(s&st.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?t=o.index+e:t=e<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,e,r=0){let n;if(!(r&st.IgnoreOverlays)&&(n=Fi.get(this._tree))&&n.overlay){let s=t-this.from;for(let{from:o,to:l}of n.overlay)if((e>0?o<=s:o=s:l>s))return new i(n.tree,n.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,e,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function Zd(i,t,e,r){let n=i.cursor(),s=[];if(!n.firstChild())return s;if(e!=null){for(let o=!1;!o;)if(o=n.type.is(e),!n.nextSibling())return s}for(;;){if(r!=null&&n.type.is(r))return s;if(n.type.is(t)&&s.push(n.node),!n.nextSibling())return r==null?s:[]}}function La(i,t,e=t.length-1){for(let r=i.parent;e>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[e]&&t[e]!=r.name)return!1;e--}}return!0}var Va=class{constructor(t,e,r,n){this.parent=t,this.buffer=e,this.index=r,this.start=n}},di=class i extends Ys{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,e,r){super(),this.context=t,this._parent=e,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,e,r){let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.context.start,r);return s<0?null:new i(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,e,r=0){if(r&st.ExcludeBuffers)return null;let{buffer:n}=this.context,s=n.findChild(this.index+4,n.buffer[this.index+3],e>0?1:-1,t-this.context.start,e);return s<0?null:new i(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,e=t.buffer[this.index+3];return e<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new i(this.context,this._parent,e):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,e=this._parent?this._parent.index+4:0;return this.index==e?this.externalSibling(-1):new i(this.context,this._parent,t.findChild(e,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],e=[],{buffer:r}=this.context,n=this.index+4,s=r.buffer[this.index+3];if(s>n){let o=r.buffer[this.index+1];t.push(r.slice(n,s,o)),e.push(0)}return new ot(this.type,t,e,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Gd(i){if(!i.length)return null;let t=0,e=i[0];for(let s=1;se.from||o.to=t){let l=new jt(o.tree,o.overlay[0].from+s.from,-1,s);(n||(n=[r])).push(Ur(l,t,e,!1))}}return n?Gd(n):r}var jr=class{get name(){return this.type.name}constructor(t,e=0){if(this.mode=e,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof jt)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,e){this.index=t;let{start:r,buffer:n}=this.buffer;return this.type=e||n.set.types[n.buffer[t]],this.from=r+n.buffer[t+1],this.to=r+n.buffer[t+2],!0}yield(t){return t?t instanceof jt?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,e,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,e,r,this.mode));let{buffer:n}=this.buffer,s=n.findChild(this.index+4,n.buffer[this.index+3],t,e-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,e,r=this.mode){return this.buffer?r&st.ExcludeBuffers?!1:this.enterChild(1,t,e):this.yield(this._tree.enter(t,e,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&st.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&st.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:e}=this.buffer,r=this.stack.length-1;if(t<0){let n=r<0?0:this.stack[r]+4;if(this.index!=n)return this.yieldBuf(e.findChild(n,this.index,-1,0,4))}else{let n=e.buffer[this.index+3];if(n<(r<0?e.buffer.length:e.buffer[this.stack[r]+3]))return this.yieldBuf(n)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let e,r,{buffer:n}=this;if(n){if(t>0){if(this.index-1)for(let s=e+t,o=t<0?-1:r._tree.children.length;s!=o;s+=t){let l=r._tree.children[s];if(this.mode&st.IncludeAnonymous||l instanceof _e||!l.type.isAnonymous||Na(l))return!1}return!0}move(t,e){if(e&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,e=0){for(;(this.from==this.to||(e<1?this.from>=t:this.from>t)||(e>-1?this.to<=t:this.to=0;){for(let o=t;o;o=o._parent)if(o.index==n){if(n==this.index)return o;e=o,r=s+1;break t}n=this.stack[--s]}for(let n=r;n=0;s--){if(s<0)return La(this.node,t,n);let o=r[e.buffer[this.stack[s]]];if(!o.isAnonymous){if(t[n]&&t[n]!=o.name)return!1;n--}}return!0}};function Na(i){return i.children.some(t=>t instanceof _e||!t.type.isAnonymous||Na(t))}function Ox(i){var t;let{buffer:e,nodeSet:r,maxBufferLength:n=1024,reused:s=[],minRepeatType:o=r.types.length}=i,l=Array.isArray(e)?new Xa(e,e.length):e,a=r.types,h=0,f=0;function c(y,k,w,q,L,W){let{id:B,start:D,end:U,size:N}=l,nt=f;for(;N<0;)if(l.next(),N==-1){let ct=s[B];w.push(ct),q.push(D-y);return}else if(N==-3){h=B;return}else if(N==-4){f=B;return}else throw new RangeError(`Unrecognized record size: ${N}`);let Rt=a[B],Mt,Bt,Ft=D-y;if(U-D<=n&&(Bt=g(l.pos-k,L))){let ct=new Uint16Array(Bt.size-Bt.skip),_t=l.pos-Bt.size,de=ct.length;for(;l.pos>_t;)de=x(Bt.start,ct,de);Mt=new _e(ct,U-Bt.start,r),Ft=Bt.start-y}else{let ct=l.pos-N;l.next();let _t=[],de=[],ri=B>=o?B:-1,Ei=0,Un=U;for(;l.pos>ct;)ri>=0&&l.id==ri&&l.size>=0?(l.end<=Un-n&&(m(_t,de,D,Ei,l.end,Un,ri,nt),Ei=_t.length,Un=l.end),l.next()):W>2500?u(D,ct,_t,de):c(D,ct,_t,de,ri,W+1);if(ri>=0&&Ei>0&&Ei<_t.length&&m(_t,de,D,Ei,D,Un,ri,nt),_t.reverse(),de.reverse(),ri>-1&&Ei>0){let Mc=d(Rt);Mt=Ya(Rt,_t,de,0,_t.length,0,U-D,Mc,Mc)}else Mt=O(Rt,_t,de,U-D,nt-U)}w.push(Mt),q.push(Ft)}function u(y,k,w,q){let L=[],W=0,B=-1;for(;l.pos>k;){let{id:D,start:U,end:N,size:nt}=l;if(nt>4)l.next();else{if(B>-1&&U=0;N-=3)D[nt++]=L[N],D[nt++]=L[N+1]-U,D[nt++]=L[N+2]-U,D[nt++]=nt;w.push(new _e(D,L[2]-U,r)),q.push(U-y)}}function d(y){return(k,w,q)=>{let L=0,W=k.length-1,B,D;if(W>=0&&(B=k[W])instanceof ot){if(!W&&B.type==y&&B.length==q)return B;(D=B.prop(E.lookAhead))&&(L=w[W]+B.length+D)}return O(y,k,w,q,L)}}function m(y,k,w,q,L,W,B,D){let U=[],N=[];for(;y.length>q;)U.push(y.pop()),N.push(k.pop()+w-L);y.push(O(r.types[B],U,N,W-L,D-W)),k.push(L-w)}function O(y,k,w,q,L=0,W){if(h){let B=[E.contextHash,h];W=W?[B].concat(W):[B]}if(L>25){let B=[E.lookAhead,L];W=W?[B].concat(W):[B]}return new ot(y,k,w,q,W)}function g(y,k){let w=l.fork(),q=0,L=0,W=0,B=w.end-n,D={size:0,start:0,skip:0};t:for(let U=w.pos-y;w.pos>U;){let N=w.size;if(w.id==k&&N>=0){D.size=q,D.start=L,D.skip=W,W+=4,q+=4,w.next();continue}let nt=w.pos-N;if(N<0||nt=o?4:0,Mt=w.start;for(w.next();w.pos>nt;){if(w.size<0)if(w.size==-3)Rt+=4;else break t;else w.id>=o&&(Rt+=4);w.next()}L=Mt,q+=N,W+=Rt}return(k<0||q==y)&&(D.size=q,D.start=L,D.skip=W),D.size>4?D:void 0}function x(y,k,w){let{id:q,start:L,end:W,size:B}=l;if(l.next(),B>=0&&q4){let U=l.pos-(B-4);for(;l.pos>U;)w=x(y,k,w)}k[--w]=D,k[--w]=W-y,k[--w]=L-y,k[--w]=q}else B==-3?h=q:B==-4&&(f=q);return w}let S=[],C=[];for(;l.pos>0;)c(i.start||0,i.bufferStart||0,S,C,-1,0);let v=(t=i.length)!==null&&t!==void 0?t:S.length?C[0]+S[0].length:0;return new ot(a[i.topID],S.reverse(),C.reverse(),v)}var Fd=new WeakMap;function Ns(i,t){if(!i.isAnonymous||t instanceof _e||t.type!=i)return 1;let e=Fd.get(t);if(e==null){e=1;for(let r of t.children){if(r.type!=i||!(r instanceof ot)){e=1;break}e+=Ns(i,r)}Fd.set(t,e)}return e}function Ya(i,t,e,r,n,s,o,l,a){let h=0;for(let m=r;m=f)break;k+=w}if(C==v+1){if(k>f){let w=m[v];d(w.children,w.positions,0,w.children.length,O[v]+S);continue}c.push(m[v])}else{let w=O[C-1]+m[C-1].length-y;c.push(Ya(i,m,O,v,C,y,w,null,a))}u.push(y+S-s)}}return d(t,e,r,n,0),(l||a)(c,u,o)}var zs=class{constructor(){this.map=new WeakMap}setBuffer(t,e,r){let n=this.map.get(t);n||this.map.set(t,n=new Map),n.set(e,r)}getBuffer(t,e){let r=this.map.get(t);return r&&r.get(e)}set(t,e){t instanceof di?this.setBuffer(t.context.buffer,t.index,e):t instanceof jt&&this.map.set(t.tree,e)}get(t){return t instanceof di?this.getBuffer(t.context.buffer,t.index):t instanceof jt?this.map.get(t.tree):void 0}cursorSet(t,e){t.buffer?this.setBuffer(t.buffer.buffer,t.index,e):this.map.set(t.tree,e)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}},pi=class i{constructor(t,e,r,n,s=!1,o=!1){this.from=t,this.to=e,this.tree=r,this.offset=n,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,e=[],r=!1){let n=[new i(0,t.length,t,0,!1,r)];for(let s of e)s.to>t.length&&n.push(s);return n}static applyChanges(t,e,r=128){if(!e.length)return t;let n=[],s=1,o=t.length?t[0]:null;for(let l=0,a=0,h=0;;l++){let f=l=r)for(;o&&o.from=u.from||c<=u.to||h){let d=Math.max(u.from,a)-h,m=Math.min(u.to,c)-h;u=d>=m?null:new i(d,m,u.tree,u.offset+h,l>0,!!f)}if(u&&n.push(u),o.to>c)break;o=snew Gr(n.from,n.to)):[new Gr(0,0)]:[new Gr(0,t.length)],this.createParse(t,e||[],r)}parse(t,e,r){let n=this.startParse(t,e,r);for(;;){let s=n.advance();if(s)return s}}},Ia=class{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,e){return this.string.slice(t,e)}};var Dw=new E({perNode:!0});var xx=0,we=class i{constructor(t,e,r){this.set=t,this.base=e,this.modified=r,this.id=xx++}static define(t){if(t?.base)throw new Error(\"Can not derive from a modified tag\");let e=new i([],null,[]);if(e.set.push(e),t)for(let r of t.set)e.set.push(r);return e}static defineModifier(){let t=new Gs;return e=>e.modified.indexOf(t)>-1?e:Gs.get(e.base||e,e.modified.concat(t).sort((r,n)=>r.id-n.id))}},yx=0,Gs=class i{constructor(){this.instances=[],this.id=yx++}static get(t,e){if(!e.length)return t;let r=e[0].instances.find(l=>l.base==t&&bx(e,l.modified));if(r)return r;let n=[],s=new we(n,t,e);for(let l of e)l.instances.push(s);let o=Sx(e);for(let l of t.set)if(!l.modified.length)for(let a of o)n.push(i.get(l,a));return s}};function bx(i,t){return i.length==t.length&&i.every((e,r)=>e==t[r])}function Sx(i){let t=[[]];for(let e=0;er.length-e.length)}function Hs(i){let t=Object.create(null);for(let e in i){let r=i[e];Array.isArray(r)||(r=[r]);for(let n of e.split(\" \"))if(n){let s=[],o=2,l=n;for(let c=0;;){if(l==\"...\"&&c>0&&c+3==n.length){o=1;break}let u=/^\"(?:[^\"\\\\]|\\\\.)*?\"|[^\\/!]+/.exec(l);if(!u)throw new RangeError(\"Invalid path: \"+n);if(s.push(u[0]==\"*\"?\"\":u[0][0]=='\"'?JSON.parse(u[0]):u[0]),c+=u[0].length,c==n.length)break;let d=n[c++];if(c==n.length&&d==\"!\"){o=0;break}if(d!=\"/\")throw new RangeError(\"Invalid path: \"+n);l=n.slice(c)}let a=s.length-1,h=s[a];if(!h)throw new RangeError(\"Invalid path: \"+n);let f=new Gi(r,o,a>0?s.slice(0,a):null);t[h]=f.sort(t[h])}}return jd.add(t)}var jd=new E,Gi=class{constructor(t,e,r,n){this.tags=t,this.mode=e,this.context=r,this.next=n}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth{let o=n;for(let l of s)for(let a of l.set){let h=e[a.id];if(h){o=o?o+\" \"+h:h;break}}return o},scope:r}}function wx(i,t){let e=null;for(let r of i){let n=r.style(t);n&&(e=e?e+\" \"+n:n)}return e}function Kd(i,t,e,r=0,n=i.length){let s=new Za(r,Array.isArray(t)?t:[t],e);s.highlightRange(i.cursor(),r,n,\"\",s.highlighters),s.flush(n)}var Za=class{constructor(t,e,r){this.at=t,this.highlighters=e,this.span=r,this.class=\"\"}startSpan(t,e){e!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=e)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,e,r,n,s){let{type:o,from:l,to:a}=t;if(l>=r||a<=e)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=n,f=vx(t)||Gi.empty,c=wx(s,f.tags);if(c&&(h&&(h+=\" \"),h+=c,f.mode==1&&(n+=(n?\" \":\"\")+c)),this.startSpan(Math.max(e,l),h),f.opaque)return;let u=t.tree&&t.tree.prop(E.mounted);if(u&&u.overlay){let d=t.node.enter(u.overlay[0].from+l,1),m=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),O=t.firstChild();for(let g=0,x=l;;g++){let S=g=C||!t.nextSibling())););if(!S||C>r)break;x=S.to+l,x>e&&(this.highlightRange(d.cursor(),Math.max(e,S.from+l),Math.min(r,x),\"\",m),this.startSpan(Math.min(r,x),h))}O&&t.parent()}else if(t.firstChild()){u&&(n=\"\");do if(!(t.to<=e)){if(t.from>=r)break;this.highlightRange(t,e,r,n,s),this.startSpan(Math.min(r,t.to),h)}while(t.nextSibling());t.parent()}}};function vx(i){let t=i.type.prop(jd);for(;t&&t.context&&!i.matchContext(t.context);)t=t.next;return t||null}var P=we.define,Zs=P(),Ge=P(),Hd=P(Ge),Ud=P(Ge),He=P(),Fs=P(He),za=P(He),Se=P(),mi=P(Se),ye=P(),be=P(),Fa=P(),Kr=P(Fa),_s=P(),p={comment:Zs,lineComment:P(Zs),blockComment:P(Zs),docComment:P(Zs),name:Ge,variableName:P(Ge),typeName:Hd,tagName:P(Hd),propertyName:Ud,attributeName:P(Ud),className:P(Ge),labelName:P(Ge),namespace:P(Ge),macroName:P(Ge),literal:He,string:Fs,docString:P(Fs),character:P(Fs),attributeValue:P(Fs),number:za,integer:P(za),float:P(za),bool:P(He),regexp:P(He),escape:P(He),color:P(He),url:P(He),keyword:ye,self:P(ye),null:P(ye),atom:P(ye),unit:P(ye),modifier:P(ye),operatorKeyword:P(ye),controlKeyword:P(ye),definitionKeyword:P(ye),moduleKeyword:P(ye),operator:be,derefOperator:P(be),arithmeticOperator:P(be),logicOperator:P(be),bitwiseOperator:P(be),compareOperator:P(be),updateOperator:P(be),definitionOperator:P(be),typeOperator:P(be),controlOperator:P(be),punctuation:Fa,separator:P(Fa),bracket:Kr,angleBracket:P(Kr),squareBracket:P(Kr),paren:P(Kr),brace:P(Kr),content:Se,heading:mi,heading1:P(mi),heading2:P(mi),heading3:P(mi),heading4:P(mi),heading5:P(mi),heading6:P(mi),contentSeparator:P(Se),list:P(Se),quote:P(Se),emphasis:P(Se),strong:P(Se),link:P(Se),monospace:P(Se),strikethrough:P(Se),inserted:P(),deleted:P(),changed:P(),invalid:P(),meta:_s,documentMeta:P(_s),annotation:P(_s),processingInstruction:P(_s),definition:we.defineModifier(),constant:we.defineModifier(),function:we.defineModifier(),standard:we.defineModifier(),local:we.defineModifier(),special:we.defineModifier()},Lw=_a([{tag:p.link,class:\"tok-link\"},{tag:p.heading,class:\"tok-heading\"},{tag:p.emphasis,class:\"tok-emphasis\"},{tag:p.strong,class:\"tok-strong\"},{tag:p.keyword,class:\"tok-keyword\"},{tag:p.atom,class:\"tok-atom\"},{tag:p.bool,class:\"tok-bool\"},{tag:p.url,class:\"tok-url\"},{tag:p.labelName,class:\"tok-labelName\"},{tag:p.inserted,class:\"tok-inserted\"},{tag:p.deleted,class:\"tok-deleted\"},{tag:p.literal,class:\"tok-literal\"},{tag:p.string,class:\"tok-string\"},{tag:p.number,class:\"tok-number\"},{tag:[p.regexp,p.escape,p.special(p.string)],class:\"tok-string2\"},{tag:p.variableName,class:\"tok-variableName\"},{tag:p.local(p.variableName),class:\"tok-variableName tok-local\"},{tag:p.definition(p.variableName),class:\"tok-variableName tok-definition\"},{tag:p.special(p.variableName),class:\"tok-variableName2\"},{tag:p.definition(p.propertyName),class:\"tok-propertyName tok-definition\"},{tag:p.typeName,class:\"tok-typeName\"},{tag:p.namespace,class:\"tok-namespace\"},{tag:p.className,class:\"tok-className\"},{tag:p.macroName,class:\"tok-macroName\"},{tag:p.propertyName,class:\"tok-propertyName\"},{tag:p.operator,class:\"tok-operator\"},{tag:p.comment,class:\"tok-comment\"},{tag:p.meta,class:\"tok-meta\"},{tag:p.invalid,class:\"tok-invalid\"},{tag:p.punctuation,class:\"tok-punctuation\"}]);var Ga,Hi=new E;function kx(i){return A.define({combine:i?t=>t.concat(i):void 0})}var Tx=new E,Wt=class{constructor(t,e,r=[],n=\"\"){this.data=t,this.name=n,Y.prototype.hasOwnProperty(\"tree\")||Object.defineProperty(Y.prototype,\"tree\",{get(){return pt(this)}}),this.parser=e,this.extension=[Ui.of(this),Y.languageData.of((s,o,l)=>{let a=Jd(s,o,l),h=a.type.prop(Hi);if(!h)return[];let f=s.facet(h),c=a.type.prop(Tx);if(c){let u=a.resolve(o-a.from,l);for(let d of c)if(d.test(u,s)){let m=s.facet(d.facet);return d.type==\"replace\"?m:m.concat(f)}}return f})].concat(r)}isActiveAt(t,e,r=-1){return Jd(t,e,r).type.prop(Hi)==this.data}findRegions(t){let e=t.facet(Ui);if(e?.data==this.data)return[{from:0,to:t.doc.length}];if(!e||!e.allowsNesting)return[];let r=[],n=(s,o)=>{if(s.prop(Hi)==this.data){r.push({from:o,to:o+s.length});return}let l=s.prop(E.mounted);if(l){if(l.tree.prop(Hi)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+o,to:a.to+o});else r.push({from:o,to:o+s.length});return}else if(l.overlay){let a=r.length;if(n(l.tree,l.overlay[0].from+o),r.length>a)return}}for(let a=0;ar.isTop?e:void 0)]}),t.name)}configure(t,e){return new i(this.data,this.parser.configure(t),e||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function pt(i){let t=i.field(Wt.state,!1);return t?t.tree:ot.empty}var Ka=class{constructor(t){this.doc=t,this.cursorPos=0,this.string=\"\",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,e){let r=this.cursorPos-this.string.length;return t=this.cursorPos?this.doc.sliceString(t,e):this.string.slice(t-r,e-r)}},Jr=null,Ja=class i{constructor(t,e,r=[],n,s,o,l,a){this.parser=t,this.state=e,this.fragments=r,this.tree=n,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(t,e,r){return new i(t,e,[],ot.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Ka(this.state.doc),this.fragments)}work(t,e){return e!=null&&e>=this.state.doc.length&&(e=void 0),this.tree!=ot.empty&&this.isDone(e??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t==\"number\"){let n=Date.now()+t;t=()=>Date.now()>n}for(this.parse||(this.parse=this.startParse()),e!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&e=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(e=this.parse.advance()););}),this.treeLen=t,this.tree=e,this.fragments=this.withoutTempSkipped(pi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let e=Jr;Jr=this;try{return t()}finally{Jr=e}}withoutTempSkipped(t){for(let e;e=this.tempSkipped.pop();)t=tp(t,e.from,e.to);return t}changes(t,e){let{fragments:r,tree:n,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!t.empty){let a=[];if(t.iterChangedRanges((h,f,c,u)=>a.push({fromA:h,toA:f,fromB:c,toB:u})),r=pi.applyChanges(r,a),n=ot.empty,s=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=t.mapPos(h.from,1),c=t.mapPos(h.to,-1);ft.from&&(this.fragments=tp(this.fragments,n,s),this.skipped.splice(r--,1))}return this.skipped.length>=e?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,e){this.skipped.push({from:t,to:e})}static getSkippingParser(t){return new class extends _i{createParse(e,r,n){let s=n[0].from,o=n[n.length-1].to;return{parsedPos:s,advance(){let a=Jr;if(a){for(let h of n)a.tempSkipped.push(h);t&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,t]):t)}return this.parsedPos=o,new ot(bt.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let e=this.fragments;return this.treeLen>=t&&e.length&&e[0].from==0&&e[0].to>=t}static get(){return Jr}};function tp(i,t,e){return pi.applyChanges(i,[{fromA:t,toA:e,fromB:t,toB:e}])}var tn=class i{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let e=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),e.viewport.to);return e.work(20,r)||e.takeTree(),new i(e)}static init(t){let e=Math.min(3e3,t.doc.length),r=Ja.create(t.facet(Ui).parser,t,{from:0,to:e});return r.work(20,e)||r.takeTree(),new i(r)}};Wt.state=it.define({create:tn.init,update(i,t){for(let e of t.effects)if(e.is(Wt.setState))return e.value;return t.startState.facet(Ui)!=t.state.facet(Ui)?tn.init(t.state):i.apply(t)}});var sp=i=>{let t=setTimeout(()=>i(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<\"u\"&&(sp=i=>{let t=-1,e=setTimeout(()=>{t=requestIdleCallback(i,{timeout:400})},100);return()=>t<0?clearTimeout(e):cancelIdleCallback(t)});var Ha=typeof navigator<\"u\"&&(!((Ga=navigator.scheduling)===null||Ga===void 0)&&Ga.isInputPending)?()=>navigator.scheduling.isInputPending():null,Px=ft.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let e=this.view.state.field(Wt.state).context;(e.updateViewport(t.view.viewport)||this.view.viewport.to>e.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(e)}scheduleWork(){if(this.working)return;let{state:t}=this.view,e=t.field(Wt.state);(e.tree!=e.context.tree||!e.context.isDone(t.doc.length))&&(this.working=sp(this.work))}work(t){this.working=null;let e=Date.now();if(this.chunkEndn+1e3,a=s.context.work(()=>Ha&&Ha()||Date.now()>o,n+(l?0:1e5));this.chunkBudget-=Date.now()-e,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Wt.setState.of(new tn(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(e=>Ct(this.view.state,e)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Ui=A.define({combine(i){return i.length?i[0]:null},enables:i=>[Wt.state,Px,T.contentAttributes.compute([i],t=>{let e=t.facet(i);return e&&e.name?{\"data-language\":e.name}:{}})]}),js=class{constructor(t,e=[]){this.language=t,this.support=e,this.extension=[t,e]}};var Cx=A.define(),ke=A.define({combine:i=>{if(!i.length)return\" \";let t=i[0];if(!t||/\\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw new Error(\"Invalid indent unit: \"+JSON.stringify(i[0]));return t}});function en(i){let t=i.facet(ke);return t.charCodeAt(0)==9?i.tabSize*t.length:t.length}function rn(i,t){let e=\"\",r=i.tabSize,n=i.facet(ke)[0];if(n==\"\t\"){for(;t>=r;)e+=\"\t\",t-=r;n=\" \"}for(let s=0;s=t?Ax(i,e,t):null}var gi=class{constructor(t,e={}){this.state=t,this.options=e,this.unit=en(t)}lineAt(t,e=1){let r=this.state.doc.lineAt(t),{simulateBreak:n,simulateDoubleBreak:s}=this.options;return n!=null&&n>=r.from&&n<=r.to?s&&n==t?{text:\"\",from:t}:(e<0?n-1&&(s+=o-this.countColumn(r,r.search(/\\S|$/))),s}countColumn(t,e=t.length){return We(t,this.state.tabSize,e)}lineIndent(t,e=1){let{text:r,from:n}=this.lineAt(t,e),s=this.options.overrideIndentation;if(s){let o=s(n);if(o>-1)return o}return this.countColumn(r,r.search(/\\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},lh=new E;function Ax(i,t,e){let r=t.resolveStack(e),n=r.node.enterUnfinishedNodesBefore(e);if(n!=r.node){let s=[];for(let o=n;o!=r.node;o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)r={node:s[o],next:r}}return op(r,i,e)}function op(i,t,e){for(let r=i;r;r=r.next){let n=Rx(r.node);if(n)return n(th.create(t,e,r))}return 0}function Qx(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function Rx(i){let t=i.type.prop(lh);if(t)return t;let e=i.firstChild,r;if(e&&(r=e.type.prop(E.closedBy))){let n=i.lastChild,s=n&&r.indexOf(n.name)>-1;return o=>lp(o,!0,1,void 0,s&&!Qx(o)?n.from:void 0)}return i.parent==null?Mx:null}function Mx(){return 0}var th=class i extends gi{constructor(t,e,r){super(t.state,t.options),this.base=t,this.pos=e,this.context=r}get node(){return this.context.node}static create(t,e,r){return new i(t,e,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let e=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(e.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Ex(r,t))break;e=this.state.doc.lineAt(r.from)}return this.lineIndent(e.from)}continue(){return op(this.context.next,this.base,this.pos)}};function Ex(i,t){for(let e=t;e;e=e.parent)if(i==e)return!0;return!1}function $x(i){let t=i.node,e=t.childAfter(t.from),r=t.lastChild;if(!e)return null;let n=i.options.simulateBreak,s=i.state.doc.lineAt(e.from),o=n==null||n<=s.from?s.to:Math.min(s.to,n);for(let l=e.to;;){let a=t.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.fromlp(r,t,e,i)}function lp(i,t,e,r,n){let s=i.textAfter,o=s.match(/^\\s*/)[0].length,l=r&&s.slice(o,o+r.length)==r||n==i.pos+o,a=t?$x(i):null;return a?l?i.column(a.from):i.column(a.to):i.baseIndent+(l?0:i.unit*e)}var qx=A.define(),ah=new E;function ap(i){let t=i.firstChild,e=i.lastChild;return t&&t.toe)continue;if(s&&l.from=t&&h.to>e&&(s=h)}}return s}function Bx(i){let t=i.lastChild;return t&&t.to==i.to&&t.type.isError}function hp(i,t,e){for(let r of i.facet(qx)){let n=r(i,t,e);if(n)return n}return Dx(i,t,e)}function fp(i,t){let e=t.mapPos(i.from,1),r=t.mapPos(i.to,-1);return e>=r?void 0:{from:e,to:r}}var hh=M.define({map:fp}),Js=M.define({map:fp});function cp(i){let t=[];for(let{head:e}of i.state.selection.ranges)t.some(r=>r.from<=e&&r.to>=e)||t.push(i.lineBlockAt(e));return t}var nn=it.define({create(){return R.none},update(i,t){i=i.map(t.changes);for(let e of t.effects)if(e.is(hh)&&!Xx(i,e.value.from,e.value.to)){let{preparePlaceholder:r}=t.state.facet(fh),n=r?R.replace({widget:new eh(r(t.state,e.value))}):ep;i=i.update({add:[n.range(e.value.from,e.value.to)]})}else e.is(Js)&&(i=i.update({filter:(r,n)=>e.value.from!=r||e.value.to!=n,filterFrom:e.value.from,filterTo:e.value.to}));if(t.selection){let e=!1,{head:r}=t.selection.main;i.between(r,r,(n,s)=>{nr&&(e=!0)}),e&&(i=i.update({filterFrom:r,filterTo:r,filter:(n,s)=>s<=r||n>=r}))}return i},provide:i=>T.decorations.from(i),toJSON(i,t){let e=[];return i.between(0,t.doc.length,(r,n)=>{e.push(r,n)}),e},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError(\"Invalid JSON for fold state\");let t=[];for(let e=0;e{(!n||n.from>s)&&(n={from:s,to:o})}),n}function Xx(i,t,e){let r=!1;return i.between(t,t,(n,s)=>{n==t&&s==e&&(r=!0)}),r}function dp(i,t){return i.field(nn,!1)?t:t.concat(M.appendConfig.of(Yx()))}var Lx=i=>{for(let t of cp(i)){let e=hp(i.state,t.from,t.to);if(e)return i.dispatch({effects:dp(i.state,[hh.of(e),pp(i,e)])}),!0}return!1},Vx=i=>{if(!i.state.field(nn,!1))return!1;let t=[];for(let e of cp(i)){let r=up(i.state,e.from,e.to);r&&t.push(Js.of(r),pp(i,r,!1))}return t.length&&i.dispatch({effects:t}),t.length>0};function pp(i,t,e=!0){let r=i.state.doc.lineAt(t.from).number,n=i.state.doc.lineAt(t.to).number;return T.announce.of(`${i.state.phrase(e?\"Folded lines\":\"Unfolded lines\")} ${r} ${i.state.phrase(\"to\")} ${n}.`)}var Wx=i=>{let{state:t}=i,e=[];for(let r=0;r{let t=i.state.field(nn,!1);if(!t||!t.size)return!1;let e=[];return t.between(0,i.state.doc.length,(r,n)=>{e.push(Js.of({from:r,to:n}))}),i.dispatch({effects:e}),!0};var to=[{key:\"Ctrl-Shift-[\",mac:\"Cmd-Alt-[\",run:Lx},{key:\"Ctrl-Shift-]\",mac:\"Cmd-Alt-]\",run:Vx},{key:\"Ctrl-Alt-[\",run:Wx},{key:\"Ctrl-Alt-]\",run:Ix}],Nx={placeholderDOM:null,preparePlaceholder:null,placeholderText:\"\\u2026\"},fh=A.define({combine(i){return kt(i,Nx)}});function Yx(i){let t=[nn,zx];return i&&t.push(fh.of(i)),t}function mp(i,t){let{state:e}=i,r=e.facet(fh),n=o=>{let l=i.lineBlockAt(i.posAtDOM(o.target)),a=up(i.state,l.from,l.to);a&&i.dispatch({effects:Js.of(a)}),o.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(i,n,t);let s=document.createElement(\"span\");return s.textContent=r.placeholderText,s.setAttribute(\"aria-label\",e.phrase(\"folded code\")),s.title=e.phrase(\"unfold\"),s.className=\"cm-foldPlaceholder\",s.onclick=n,s}var ep=R.replace({widget:new class extends Ut{toDOM(i){return mp(i,null)}}}),eh=class extends Ut{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return mp(t,this.value)}};var zx=T.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\"}}),ve=class i{constructor(t,e){this.specs=t;let r;function n(l){let a=Gt.newName();return(r||(r=Object.create(null)))[\".\"+a]=l,a}let s=typeof e.all==\"string\"?e.all:e.all?n(e.all):void 0,o=e.scope;this.scope=o instanceof Wt?l=>l.prop(Hi)==o.data:o?l=>l==o:void 0,this.style=_a(t.map(l=>({tag:l.tag,class:l.class||n(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=r?new Gt(r):null,this.themeType=e.themeType}static define(t,e){return new i(t,e||{})}},ih=A.define(),gp=A.define({combine(i){return i.length?[i[0]]:null}});function Ua(i){let t=i.facet(ih);return t.length?t:i.facet(gp)}function Te(i,t){let e=[Zx],r;return i instanceof ve&&(i.module&&e.push(T.styleModule.of(i.module)),r=i.themeType),t?.fallback?e.push(gp.of(i)):r?e.push(ih.computeN([T.darkTheme],n=>n.facet(T.darkTheme)==(r==\"dark\")?[i]:[])):e.push(ih.of(i)),e}var rh=class{constructor(t){this.markCache=Object.create(null),this.tree=pt(t.state),this.decorations=this.buildDeco(t,Ua(t.state)),this.decoratedTo=t.viewport.to}update(t){let e=pt(t.state),r=Ua(t.state),n=r!=Ua(t.startState),{viewport:s}=t.view,o=t.changes.mapPos(this.decoratedTo,1);e.length=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=o):(e!=this.tree||t.viewportChanged||n)&&(this.tree=e,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,e){if(!e||!this.tree.length)return R.none;let r=new Ee;for(let{from:n,to:s}of t.visibleRanges)Kd(this.tree,e,(o,l,a)=>{r.add(o,l,this.markCache[a]||(this.markCache[a]=R.mark({class:a})))},n,s);return r.finish()}},Zx=ie.high(ft.fromClass(rh,{decorations:i=>i.decorations})),eo=ve.define([{tag:p.meta,color:\"#404740\"},{tag:p.link,textDecoration:\"underline\"},{tag:p.heading,textDecoration:\"underline\",fontWeight:\"bold\"},{tag:p.emphasis,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\"},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.keyword,color:\"#708\"},{tag:[p.atom,p.bool,p.url,p.contentSeparator,p.labelName],color:\"#219\"},{tag:[p.literal,p.inserted],color:\"#164\"},{tag:[p.string,p.deleted],color:\"#a11\"},{tag:[p.regexp,p.escape,p.special(p.string)],color:\"#e40\"},{tag:p.definition(p.variableName),color:\"#00f\"},{tag:p.local(p.variableName),color:\"#30a\"},{tag:[p.typeName,p.namespace],color:\"#085\"},{tag:p.className,color:\"#167\"},{tag:[p.special(p.variableName),p.macroName],color:\"#256\"},{tag:p.definition(p.propertyName),color:\"#00c\"},{tag:p.comment,color:\"#940\"},{tag:p.invalid,color:\"#f00\"}]),Fx=T.baseTheme({\"&.cm-focused .cm-matchingBracket\":{backgroundColor:\"#328c8252\"},\"&.cm-focused .cm-nonmatchingBracket\":{backgroundColor:\"#bb555544\"}}),Op=1e4,xp=\"()[]{}\",yp=A.define({combine(i){return kt(i,{afterCursor:!0,brackets:xp,maxScanDistance:Op,renderMatch:Hx})}}),_x=R.mark({class:\"cm-matchingBracket\"}),Gx=R.mark({class:\"cm-nonmatchingBracket\"});function Hx(i){let t=[],e=i.matched?_x:Gx;return t.push(e.range(i.start.from,i.start.to)),i.end&&t.push(e.range(i.end.from,i.end.to)),t}var Ux=it.define({create(){return R.none},update(i,t){if(!t.docChanged&&!t.selection)return i;let e=[],r=t.state.facet(yp);for(let n of t.state.selection.ranges){if(!n.empty)continue;let s=oe(t.state,n.head,-1,r)||n.head>0&&oe(t.state,n.head-1,1,r)||r.afterCursor&&(oe(t.state,n.head,1,r)||n.headT.decorations.from(i)}),jx=[Ux,Fx];function io(i={}){return[yp.of(i),jx]}var Kx=new E;function nh(i,t,e){let r=i.prop(t<0?E.openedBy:E.closedBy);if(r)return r;if(i.name.length==1){let n=e.indexOf(i.name);if(n>-1&&n%2==(t<0?1:0))return[e[n+t]]}return null}function sh(i){let t=i.type.prop(Kx);return t?t(i.node):i}function oe(i,t,e,r={}){let n=r.maxScanDistance||Op,s=r.brackets||xp,o=pt(i),l=o.resolveInner(t,e);for(let a=l;a;a=a.parent){let h=nh(a.type,e,s);if(h&&a.from0?t>=f.from&&tf.from&&t<=f.to))return Jx(i,t,e,a,f,h,s)}}return t1(i,t,e,o,l.type,n,s)}function Jx(i,t,e,r,n,s,o){let l=r.parent,a={from:n.from,to:n.to},h=0,f=l?.cursor();if(f&&(e<0?f.childBefore(r.from):f.childAfter(r.to)))do if(e<0?f.to<=r.from:f.from>=r.to){if(h==0&&s.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:e<0?t-1:t,to:e>0?t+1:t},f=i.doc.iterRange(t,e>0?i.doc.length:0),c=0;for(let u=0;!f.next().done&&u<=s;){let d=f.value;e<0&&(u+=d.length);let m=t+u*e;for(let O=e>0?0:d.length-1,g=e>0?d.length:-1;O!=g;O+=e){let x=o.indexOf(d[O]);if(!(x<0||r.resolveInner(m+O,1).type!=n))if(x%2==0==e>0)c++;else{if(c==1)return{start:h,end:{from:m+O,to:m+O+1},matched:x>>1==a>>1};c--}}e>0&&(u+=d.length)}return f.done?{start:h,matched:!1}:null}var e1=Object.create(null),ip=[bt.none];var rp=[],np=Object.create(null),i1=Object.create(null);for(let[i,t]of[[\"variable\",\"variableName\"],[\"variable-2\",\"variableName.special\"],[\"string-2\",\"string.special\"],[\"def\",\"variableName.definition\"],[\"tag\",\"tagName\"],[\"attribute\",\"attributeName\"],[\"type\",\"typeName\"],[\"builtin\",\"variableName.standard\"],[\"qualifier\",\"modifier\"],[\"error\",\"invalid\"],[\"header\",\"heading\"],[\"property\",\"propertyName\"]])i1[i]=r1(e1,t);function ja(i,t){rp.indexOf(i)>-1||(rp.push(i),console.warn(t))}function r1(i,t){let e=[];for(let l of t.split(\" \")){let a=[];for(let h of l.split(\".\")){let f=i[h]||p[h];f?typeof f==\"function\"?a.length?a=a.map(f):ja(h,`Modifier ${h} used at start of tag`):a.length?ja(h,`Tag ${h} used as modifier`):a=Array.isArray(f)?f:[f]:ja(h,`Unknown highlighting tag ${h}`)}for(let h of a)e.push(h)}if(!e.length)return 0;let r=t.replace(/ /g,\"_\"),n=r+\" \"+e.map(l=>l.id),s=np[n];if(s)return s.id;let o=np[n]=bt.define({id:ip.length,name:r,props:[Hs({[r]:e})]});return ip.push(o),o.id}var Fw={rtl:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"rtl\"},bidiIsolate:G.RTL}),ltr:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"ltr\"},bidiIsolate:G.LTR}),auto:R.mark({class:\"cm-iso\",inclusive:!0,attributes:{dir:\"auto\"},bidiIsolate:null})};var no=class{constructor(t,e,r){this.state=t,this.pos=e,this.explicit=r,this.abortListeners=[]}tokenBefore(t){let e=pt(this.state).resolveInner(this.pos,-1);for(;e&&t.indexOf(e.name)<0;)e=e.parent;return e?{from:e.from,to:this.pos,text:this.state.sliceDoc(e.from,this.pos),type:e.type}:null}matchBefore(t){let e=this.state.doc.lineAt(this.pos),r=Math.max(e.from,this.pos-250),n=e.text.slice(r-e.from,this.pos-e.from),s=n.search(Qp(t,!1));return s<0?null:{from:r+s,to:this.pos,text:n.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,e){t==\"abort\"&&this.abortListeners&&this.abortListeners.push(e)}};function bp(i){let t=Object.keys(i).join(\"\"),e=/\\w/.test(t);return e&&(t=t.replace(/\\w/g,\"\")),`[${e?\"\\\\w\":\"\"}${t.replace(/[^\\w\\s]/g,\"\\\\$&\")}]`}function n1(i){let t=Object.create(null),e=Object.create(null);for(let{label:n}of i){t[n[0]]=!0;for(let s=1;stypeof n==\"string\"?{label:n}:n),[e,r]=t.every(n=>/^\\w+$/.test(n.label))?[/\\w*$/,/\\w+$/]:n1(t);return n=>{let s=n.matchBefore(r);return s||n.explicit?{from:s?s.from:n.pos,options:t,validFor:e}:null}}function Ap(i,t){return e=>{for(let r=pt(e.state).resolveInner(e.pos,-1);r;r=r.parent){if(i.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(e)}}var so=class{constructor(t,e,r,n){this.completion=t,this.source=e,this.match=r,this.score=n}};function Ue(i){return i.selection.main.from}function Qp(i,t){var e;let{source:r}=i,n=t&&r[0]!=\"^\",s=r[r.length-1]!=\"$\";return!n&&!s?i:new RegExp(`${n?\"^\":\"\"}(?:${r})${s?\"$\":\"\"}`,(e=i.flags)!==null&&e!==void 0?e:i.ignoreCase?\"i\":\"\")}var Rp=Et.define();function s1(i,t,e,r){let{main:n}=i.selection,s=e-n.from,o=r-n.from;return Object.assign(Object.assign({},i.changeByRange(l=>l!=n&&e!=r&&i.sliceDoc(l.from+s,l.from+o)!=i.sliceDoc(e,r)?{range:l}:{changes:{from:l.from+s,to:r==n.from?l.to:l.from+o,insert:t},range:b.cursor(l.from+s+t.length)})),{scrollIntoView:!0,userEvent:\"input.complete\"})}var Sp=new WeakMap;function o1(i){if(!Array.isArray(i))return i;let t=Sp.get(i);return t||Sp.set(i,t=wh(i)),t}var oo=M.define(),sn=M.define(),dh=class{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let e=0;e=48&&y<=57||y>=97&&y<=122?2:y>=65&&y<=90?1:0:(k=vr(y))!=k.toLowerCase()?1:k!=k.toUpperCase()?2:0;(!S||w==1&&g||v==0&&w!=0)&&(e[c]==y||r[c]==y&&(u=!0)?o[c++]=S:o.length&&(x=!1)),v=w,S+=wt(y)}return c==a&&o[0]==0&&x?this.result(-100+(u?-200:0),o,t):d==a&&m==0?this.ret(-200-t.length+(O==t.length?0:-100),[0,O]):l>-1?this.ret(-700-t.length,[l,l+this.pattern.length]):d==a?this.ret(-900-t.length,[m,O]):c==a?this.result(-100+(u?-200:0)+-700+(x?0:-1100),o,t):e.length==2?!1:this.result((n[0]?-700:0)+-200+-1100,n,t)}result(t,e,r){let n=[],s=0;for(let o of e){let l=o+(this.astral?wt(dt(r,o)):1);s&&n[s-1]==o?n[s-1]=l:(n[s++]=o,n[s++]=l)}return this.ret(t-r.length,n)}},gt=A.define({combine(i){return kt(i,{activateOnTyping:!0,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>\"\",optionClass:()=>\"\",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:l1,compareCompletions:(t,e)=>t.label.localeCompare(e.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,e)=>t&&e,closeOnBlur:(t,e)=>t&&e,icons:(t,e)=>t&&e,tooltipClass:(t,e)=>r=>wp(t(r),e(r)),optionClass:(t,e)=>r=>wp(t(r),e(r)),addToOptions:(t,e)=>t.concat(e)})}});function wp(i,t){return i?t?i+\" \"+t:i:t}function l1(i,t,e,r,n,s){let o=i.textDirection==G.RTL,l=o,a=!1,h=\"top\",f,c,u=t.left-n.left,d=n.right-t.right,m=r.right-r.left,O=r.bottom-r.top;if(l&&u=O||S>t.top?f=e.bottom-t.top:(h=\"bottom\",f=t.bottom-e.top)}let g=(t.bottom-t.top)/s.offsetHeight,x=(t.right-t.left)/s.offsetWidth;return{style:`${h}: ${f/g}px; max-width: ${c/x}px`,class:\"cm-completionInfo-\"+(a?o?\"left-narrow\":\"right-narrow\":l?\"left\":\"right\")}}function a1(i){let t=i.addToOptions.slice();return i.icons&&t.push({render(e){let r=document.createElement(\"div\");return r.classList.add(\"cm-completionIcon\"),e.type&&r.classList.add(...e.type.split(/\\s+/g).map(n=>\"cm-completionIcon-\"+n)),r.setAttribute(\"aria-hidden\",\"true\"),r},position:20}),t.push({render(e,r,n,s){let o=document.createElement(\"span\");o.className=\"cm-completionLabel\";let l=e.displayLabel||e.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,f)));let u=o.appendChild(document.createElement(\"span\"));u.appendChild(document.createTextNode(l.slice(f,c))),u.className=\"cm-completionMatchedText\",a=c}return ae.position-r.position).map(e=>e.render)}function ch(i,t,e){if(i<=e)return{from:0,to:i};if(t<0&&(t=0),t<=i>>1){let n=Math.floor(t/e);return{from:n*e,to:(n+1)*e}}let r=Math.floor((i-t)/e);return{from:i-(r+1)*e,to:i-r*e}}var ph=class{constructor(t,e,r){this.view=t,this.stateField=e,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass=\"\";let n=t.state.field(e),{options:s,selected:o}=n.open,l=t.state.facet(gt);this.optionContent=a1(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=ch(s.length,o,l.maxRenderedOptions),this.dom=document.createElement(\"div\"),this.dom.className=\"cm-tooltip-autocomplete\",this.updateTooltipClass(t.state),this.dom.addEventListener(\"mousedown\",a=>{let{options:h}=t.state.field(e).open;for(let f=a.target,c;f&&f!=this.dom;f=f.parentNode)if(f.nodeName==\"LI\"&&(c=/-(\\d+)$/.exec(f.id))&&+c[1]{let h=t.state.field(this.stateField,!1);h&&h.tooltip&&t.state.facet(gt).closeOnBlur&&a.relatedTarget!=t.contentDOM&&t.dispatch({effects:sn.of(null)})}),this.showOptions(s,n.id)}mount(){this.updateSel()}showOptions(t,e){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,e,this.range)),this.list.addEventListener(\"scroll\",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var e;let r=t.state.field(this.stateField),n=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=n){let{options:s,selected:o,disabled:l}=r.open;(!n.open||n.open.options!=s)&&(this.range=ch(s.length,o,t.state.facet(gt).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),l!=((e=n.open)===null||e===void 0?void 0:e.disabled)&&this.dom.classList.toggle(\"cm-tooltip-autocomplete-disabled\",!!l)}}updateTooltipClass(t){let e=this.tooltipClass(t);if(e!=this.currentClass){for(let r of this.currentClass.split(\" \"))r&&this.dom.classList.remove(r);for(let r of e.split(\" \"))r&&this.dom.classList.add(r);this.currentClass=e}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),e=t.open;if((e.selected>-1&&e.selected=this.range.to)&&(this.range=ch(e.options.length,e.selected,this.view.state.facet(gt).maxRenderedOptions),this.showOptions(e.options,t.id)),this.updateSelectedOption(e.selected)){this.destroyInfo();let{completion:r}=e.options[e.selected],{info:n}=r;if(!n)return;let s=typeof n==\"string\"?document.createTextNode(n):n(r);if(!s)return;\"then\"in s?s.then(o=>{o&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(o,r)}).catch(o=>Ct(this.view.state,o,\"completion info\")):this.addInfoPane(s,r)}}addInfoPane(t,e){this.destroyInfo();let r=this.info=document.createElement(\"div\");if(r.className=\"cm-tooltip cm-completionInfo\",t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:n,destroy:s}=t;r.appendChild(n),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let e=null;for(let r=this.list.firstChild,n=this.range.from;r;r=r.nextSibling,n++)r.nodeName!=\"LI\"||!r.id?n--:n==t?r.hasAttribute(\"aria-selected\")||(r.setAttribute(\"aria-selected\",\"true\"),e=r):r.hasAttribute(\"aria-selected\")&&r.removeAttribute(\"aria-selected\");return e&&f1(this.list,e),e}measureInfo(){let t=this.dom.querySelector(\"[aria-selected]\");if(!t||!this.info)return null;let e=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),n=t.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.defaultView||window;s={left:0,top:0,right:o.innerWidth,bottom:o.innerHeight}}return n.top>Math.min(s.bottom,e.bottom)-10||n.bottomr.from||r.from==0))if(s=u,typeof h!=\"string\"&&h.header)n.appendChild(h.header(h));else{let d=n.appendChild(document.createElement(\"completion-section\"));d.textContent=u}}let f=n.appendChild(document.createElement(\"li\"));f.id=e+\"-\"+o,f.setAttribute(\"role\",\"option\");let c=this.optionClass(l);c&&(f.className=c);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&f.appendChild(d)}}return r.from&&n.classList.add(\"cm-completionListIncompleteTop\"),r.tonew ph(e,i,t)}function f1(i,t){let e=i.getBoundingClientRect(),r=t.getBoundingClientRect(),n=e.height/i.offsetHeight;r.tope.bottom&&(i.scrollTop+=(r.bottom-e.bottom)/n)}function vp(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function c1(i,t){let e=[],r=null,n=a=>{e.push(a);let{section:h}=a.completion;if(h){r||(r=[]);let f=typeof h==\"string\"?h:h.name;r.some(c=>c.name==f)||r.push(typeof h==\"string\"?{name:f}:h)}};for(let a of i)if(a.hasResult()){let h=a.result.getMatch;if(a.result.filter===!1)for(let f of a.result.options)n(new so(f,a.source,h?h(f):[],1e9-e.length));else{let f=new dh(t.sliceDoc(a.from,a.to));for(let c of a.result.options)if(f.match(c.label)){let u=c.displayLabel?h?h(c,f.matched):[]:f.matched;n(new so(c,a.source,u,f.score+(c.boost||0)))}}}if(r){let a=Object.create(null),h=0,f=(c,u)=>{var d,m;return((d=c.rank)!==null&&d!==void 0?d:1e9)-((m=u.rank)!==null&&m!==void 0?m:1e9)||(c.namef.score-h.score||l(h.completion,f.completion))){let h=a.completion;!o||o.label!=h.label||o.detail!=h.detail||o.type!=null&&h.type!=null&&o.type!=h.type||o.apply!=h.apply||o.boost!=h.boost?s.push(a):vp(a.completion)>vp(o)&&(s[s.length-1]=a),o=a.completion}return s}var mh=class i{constructor(t,e,r,n,s,o){this.options=t,this.attrs=e,this.tooltip=r,this.timestamp=n,this.selected=s,this.disabled=o}setSelected(t,e){return t==this.selected||t>=this.options.length?this:new i(this.options,kp(e,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,e,r,n,s){let o=c1(t,e);if(!o.length)return n&&t.some(a=>a.state==1)?new i(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,!0):null;let l=e.facet(gt).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let a=n.options[n.selected].completion;for(let h=0;hh.hasResult()?Math.min(a,h.from):a,1e8),create:g1,above:s.aboveCursor},n?n.timestamp:Date.now(),l,!1)}map(t){return new i(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}},gh=class i{constructor(t,e,r){this.active=t,this.id=e,this.open=r}static start(){return new i(p1,\"cm-ac-\"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:e}=t,r=e.facet(gt),s=(r.override||e.languageDataAt(\"autocomplete\",Ue(e)).map(o1)).map(l=>(this.active.find(h=>h.source==l)||new De(l,this.active.some(h=>h.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((l,a)=>l==this.active[a])&&(s=this.active);let o=this.open;o&&t.docChanged&&(o=o.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!u1(s,this.active)?o=mh.build(s,e,this.id,o,r):o&&o.disabled&&!s.some(l=>l.state==1)&&(o=null),!o&&s.every(l=>l.state!=1)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new De(l.source,0):l));for(let l of t.effects)l.is(Ep)&&(o=o&&o.setSelected(l.value,this.id));return s==this.active&&o==this.open?this:new i(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:d1}};function u1(i,t){if(i==t)return!0;for(let e=0,r=0;;){for(;e-1&&(e[\"aria-activedescendant\"]=i+\"-\"+t),e}var p1=[];function Oh(i){return i.isUserEvent(\"input.type\")?\"input\":i.isUserEvent(\"delete.backward\")?\"delete\":null}var De=class i{constructor(t,e,r=-1){this.source=t,this.state=e,this.explicitPos=r}hasResult(){return!1}update(t,e){let r=Oh(t),n=this;r?n=n.handleUserEvent(t,r,e):t.docChanged?n=n.handleChange(t):t.selection&&n.state!=0&&(n=new i(n.source,0));for(let s of t.effects)if(s.is(oo))n=new i(n.source,1,s.value?Ue(t.state):-1);else if(s.is(sn))n=new i(n.source,0);else if(s.is(Mp))for(let o of s.value)o.source==n.source&&(n=o);return n}handleUserEvent(t,e,r){return e==\"delete\"||!r.activateOnTyping?this.map(t.changes):new i(this.source,1)}handleChange(t){return t.changes.touchesRange(Ue(t.startState))?new i(this.source,0):this.map(t.changes)}map(t){return t.empty||this.explicitPos<0?this:new i(this.source,this.state,t.mapPos(this.explicitPos))}},lo=class i extends De{constructor(t,e,r,n,s){super(t,2,e),this.result=r,this.from=n,this.to=s}hasResult(){return!0}handleUserEvent(t,e,r){var n;let s=t.changes.mapPos(this.from),o=t.changes.mapPos(this.to,1),l=Ue(t.state);if((this.explicitPos<0?l<=s:lo||e==\"delete\"&&Ue(t.startState)==this.from)return new De(this.source,e==\"input\"&&r.activateOnTyping?1:0);let a=this.explicitPos<0?-1:t.changes.mapPos(this.explicitPos),h;return m1(this.result.validFor,t.state,s,o)?new i(this.source,a,this.result,s,o):this.result.update&&(h=this.result.update(this.result,s,o,new no(t.state,l,a>=0)))?new i(this.source,a,h,h.from,(n=h.to)!==null&&n!==void 0?n:Ue(t.state)):new De(this.source,1,a)}handleChange(t){return t.changes.touchesRange(this.from,this.to)?new De(this.source,0):this.map(t.changes)}map(t){return t.empty?this:new i(this.source,this.explicitPos<0?-1:t.mapPos(this.explicitPos),this.result,t.mapPos(this.from),t.mapPos(this.to,1))}};function m1(i,t,e,r){if(!i)return!1;let n=t.sliceDoc(e,r);return typeof i==\"function\"?i(n,e,r,t):Qp(i,!0).test(n)}var Mp=M.define({map(i,t){return i.map(e=>e.map(t))}}),Ep=M.define(),It=it.define({create(){return gh.start()},update(i,t){return i.update(t)},provide:i=>[Fr.from(i,t=>t.tooltip),T.contentAttributes.from(i,t=>t.attrs)]});function $p(i,t){let e=t.completion.apply||t.completion.label,r=i.state.field(It).active.find(n=>n.source==t.source);return r instanceof lo?(typeof e==\"string\"?i.dispatch(Object.assign(Object.assign({},s1(i.state,e,r.from,r.to)),{annotations:Rp.of(t.completion)})):e(i,t.completion,r.from,r.to),!0):!1}var g1=h1(It,$p);function ro(i,t=\"option\"){return e=>{let r=e.state.field(It,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+n*(i?1:-1):i?0:o-1;return l<0?l=t==\"page\"?0:o-1:l>=o&&(l=t==\"page\"?o-1:0),e.dispatch({effects:Ep.of(l)}),!0}}var O1=i=>{let t=i.state.field(It,!1);return i.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestampi.state.field(It,!1)?(i.dispatch({effects:oo.of(!0)}),!0):!1,y1=i=>{let t=i.state.field(It,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(i.dispatch({effects:sn.of(null)}),!0)},xh=class{constructor(t,e){this.active=t,this.context=e,this.time=Date.now(),this.updates=[],this.done=void 0}},b1=50,S1=1e3,w1=ft.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of i.state.field(It).active)t.state==1&&this.startQuery(t)}update(i){let t=i.state.field(It);if(!i.selectionSet&&!i.docChanged&&i.startState.field(It)==t)return;let e=i.transactions.some(n=>(n.selection||n.docChanged)&&!Oh(n));for(let n=0;nb1&&Date.now()-s.time>S1){for(let o of s.context.abortListeners)try{o()}catch(l){Ct(this.view.state,l)}s.context.abortListeners=null,this.running.splice(n--,1)}else s.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(n=>n.effects.some(s=>s.is(oo)))&&(this.pendingStart=!0);let r=this.pendingStart?50:i.state.facet(gt).activateOnTypingDelay;if(this.debounceUpdate=t.active.some(n=>n.state==1&&!this.running.some(s=>s.active.source==n.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let n of i.transactions)Oh(n)==\"input\"?this.composing=2:this.composing==2&&n.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,t=i.field(It);for(let e of t.active)e.state==1&&!this.running.some(r=>r.active.source==e.source)&&this.startQuery(e)}startQuery(i){let{state:t}=this.view,e=Ue(t),r=new no(t,e,i.explicitPos==e),n=new xh(i,r);this.running.push(n),Promise.resolve(i.source(r)).then(s=>{n.context.aborted||(n.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:sn.of(null)}),Ct(this.view.state,s)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(gt).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],e=this.view.state.facet(gt);for(let r=0;ro.source==n.active.source);if(s&&s.state==1)if(n.done==null){let o=new De(n.active.source,0);for(let l of n.updates)o=o.update(l,e);o.state!=1&&t.push(o)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:Mp.of(t)})}},{eventHandlers:{blur(i){let t=this.view.state.field(It,!1);if(t&&t.tooltip&&this.view.state.facet(gt).closeOnBlur){let e=t.open&&Ba(this.view,t.open.tooltip);(!e||!e.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:sn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:oo.of(!1)}),20),this.composing=0}}}),qp=T.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:\"400px\",boxSizing:\"border-box\"},\".cm-completionInfo.cm-completionInfo-left\":{right:\"100%\"},\".cm-completionInfo.cm-completionInfo-right\":{left:\"100%\"},\".cm-completionInfo.cm-completionInfo-left-narrow\":{right:\"30px\"},\".cm-completionInfo.cm-completionInfo-right-narrow\":{left:\"30px\"},\"&light .cm-snippetField\":{backgroundColor:\"#00000022\"},\"&dark .cm-snippetField\":{backgroundColor:\"#ffffff22\"},\".cm-snippetFieldPosition\":{verticalAlign:\"text-top\",width:0,height:\"1.15em\",display:\"inline-block\",margin:\"0 -0.7px -.7em\",borderLeft:\"1.4px dotted #888\"},\".cm-completionMatchedText\":{textDecoration:\"underline\"},\".cm-completionDetail\":{marginLeft:\"0.5em\",fontStyle:\"italic\"},\".cm-completionIcon\":{fontSize:\"90%\",width:\".8em\",display:\"inline-block\",textAlign:\"center\",paddingRight:\".6em\",opacity:\"0.6\",boxSizing:\"content-box\"},\".cm-completionIcon-function, .cm-completionIcon-method\":{\"&:after\":{content:\"'\\u0192'\"}},\".cm-completionIcon-class\":{\"&:after\":{content:\"'\\u25CB'\"}},\".cm-completionIcon-interface\":{\"&:after\":{content:\"'\\u25CC'\"}},\".cm-completionIcon-variable\":{\"&:after\":{content:\"'\\u{1D465}'\"}},\".cm-completionIcon-constant\":{\"&:after\":{content:\"'\\u{1D436}'\"}},\".cm-completionIcon-type\":{\"&:after\":{content:\"'\\u{1D461}'\"}},\".cm-completionIcon-enum\":{\"&:after\":{content:\"'\\u222A'\"}},\".cm-completionIcon-property\":{\"&:after\":{content:\"'\\u25A1'\"}},\".cm-completionIcon-keyword\":{\"&:after\":{content:\"'\\u{1F511}\\uFE0E'\"}},\".cm-completionIcon-namespace\":{\"&:after\":{content:\"'\\u25A2'\"}},\".cm-completionIcon-text\":{\"&:after\":{content:\"'abc'\",fontSize:\"50%\",verticalAlign:\"middle\"}}}),yh=class{constructor(t,e,r,n){this.field=t,this.line=e,this.from=r,this.to=n}},bh=class i{constructor(t,e,r){this.field=t,this.from=e,this.to=r}map(t){let e=t.mapPos(this.from,-1,ut.TrackDel),r=t.mapPos(this.to,1,ut.TrackDel);return e==null||r==null?null:new i(this.field,e,r)}},Sh=class i{constructor(t,e){this.lines=t,this.fieldPositions=e}instantiate(t,e){let r=[],n=[e],s=t.doc.lineAt(e),o=/^\\s*/.exec(s.text)[0];for(let a of this.lines){if(r.length){let h=o,f=/^\\t*/.exec(a)[0].length;for(let c=0;cnew bh(a.field,n[a.line]+a.from,n[a.line]+a.to));return{text:r,ranges:l}}static parse(t){let e=[],r=[],n=[],s;for(let o of t.split(/\\r\\n?|\\n/)){for(;s=/[#$]\\{(?:(\\d+)(?::([^}]*))?|([^}]*))\\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||\"\",h=-1;for(let f=0;f=h&&c.field++}n.push(new yh(h,r.length,s.index,s.index+a.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}for(let l;l=/\\\\([{}])/.exec(o);){o=o.slice(0,l.index)+l[1]+o.slice(l.index+l[0].length);for(let a of n)a.line==r.length&&a.from>l.index&&(a.from--,a.to--)}r.push(o)}return new i(r,n)}},v1=R.widget({widget:new class extends Ut{toDOM(){let i=document.createElement(\"span\");return i.className=\"cm-snippetFieldPosition\",i}ignoreEvent(){return!1}}}),k1=R.mark({class:\"cm-snippetField\"}),ji=class i{constructor(t,e){this.ranges=t,this.active=e,this.deco=R.set(t.map(r=>(r.from==r.to?v1:k1).range(r.from,r.to)))}map(t){let e=[];for(let r of this.ranges){let n=r.map(t);if(!n)return null;e.push(n)}return new i(e,this.active)}selectionInsideField(t){return t.ranges.every(e=>this.ranges.some(r=>r.field==this.active&&r.from<=e.from&&r.to>=e.to))}},an=M.define({map(i,t){return i&&i.map(t)}}),T1=M.define(),on=it.define({create(){return null},update(i,t){for(let e of t.effects){if(e.is(an))return e.value;if(e.is(T1)&&i)return new ji(i.ranges,e.value)}return i&&t.docChanged&&(i=i.map(t.changes)),i&&t.selection&&!i.selectionInsideField(t.selection)&&(i=null),i},provide:i=>T.decorations.from(i,t=>t?t.deco:R.none)});function vh(i,t){return b.create(i.filter(e=>e.field==t).map(e=>b.range(e.from,e.to)))}function P1(i){let t=Sh.parse(i);return(e,r,n,s)=>{let{text:o,ranges:l}=t.instantiate(e.state,n),a={changes:{from:n,to:s,insert:V.of(o)},scrollIntoView:!0,annotations:r?[Rp.of(r),lt.userEvent.of(\"input.complete\")]:void 0};if(l.length&&(a.selection=vh(l,0)),l.some(h=>h.field>0)){let h=new ji(l,0),f=a.effects=[an.of(h)];e.state.field(on,!1)===void 0&&f.push(M.appendConfig.of([on,M1,E1,qp]))}e.dispatch(e.state.update(a))}}function Dp(i){return({state:t,dispatch:e})=>{let r=t.field(on,!1);if(!r||i<0&&r.active==0)return!1;let n=r.active+i,s=i>0&&!r.ranges.some(o=>o.field==n+i);return e(t.update({selection:vh(r.ranges,n),effects:an.of(s?null:new ji(r.ranges,n)),scrollIntoView:!0})),!0}}var C1=({state:i,dispatch:t})=>i.field(on,!1)?(t(i.update({effects:an.of(null)})),!0):!1,A1=Dp(1),Q1=Dp(-1);var R1=[{key:\"Tab\",run:A1,shift:Q1},{key:\"Escape\",run:C1}],Tp=A.define({combine(i){return i.length?i[0]:R1}}),M1=ie.highest(Fe.compute([Tp],i=>i.facet(Tp)));function Pe(i,t){return Object.assign(Object.assign({},t),{apply:P1(i)})}var E1=T.domEventHandlers({mousedown(i,t){let e=t.state.field(on,!1),r;if(!e||(r=t.posAtCoords({x:i.clientX,y:i.clientY}))==null)return!1;let n=e.ranges.find(s=>s.from<=r&&s.to>=r);return!n||n.field==e.active?!1:(t.dispatch({selection:vh(e.ranges,n.field),effects:an.of(e.ranges.some(s=>s.field>n.field)?new ji(e.ranges,n.field):null),scrollIntoView:!0}),!0)}});var ln={brackets:[\"(\",\"[\",\"{\",\"'\",'\"'],before:\")]}:;>\",stringPrefixes:[]},Oi=M.define({map(i,t){let e=t.mapPos(i,-1,ut.TrackAfter);return e??void 0}}),kh=new class extends ee{};kh.startSide=1;kh.endSide=-1;var Bp=it.define({create(){return _.empty},update(i,t){if(i=i.map(t.changes),t.selection){let e=t.state.doc.lineAt(t.selection.main.head);i=i.update({filter:r=>r>=e.from&&r<=e.to})}for(let e of t.effects)e.is(Oi)&&(i=i.update({add:[kh.range(e.value,e.value+1)]}));return i}});function ao(){return[q1,Bp]}var uh=\"()[]{}<>\";function Xp(i){for(let t=0;t{if(($1?i.composing:i.compositionStarted)||i.state.readOnly)return!1;let n=i.state.selection.main;if(r.length>2||r.length==2&&wt(dt(r,0))==1||t!=n.from||e!=n.to)return!1;let s=B1(i.state,r);return s?(i.dispatch(s),!0):!1}),D1=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let r=Lp(i,i.selection.main.head).brackets||ln.brackets,n=null,s=i.changeByRange(o=>{if(o.empty){let l=X1(i.doc,o.head);for(let a of r)if(a==l&&fo(i.doc,o.head)==Xp(dt(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:b.cursor(o.head-a.length)}}return{range:n=o}});return n||t(i.update(s,{scrollIntoView:!0,userEvent:\"delete.backward\"})),!n},ho=[{key:\"Backspace\",run:D1}];function B1(i,t){let e=Lp(i,i.selection.main.head),r=e.brackets||ln.brackets;for(let n of r){let s=Xp(dt(n,0));if(t==n)return s==n?W1(i,n,r.indexOf(n+n+n)>-1,e):L1(i,n,s,e.before||ln.before);if(t==s&&Vp(i,i.selection.main.from))return V1(i,n,s)}return null}function Vp(i,t){let e=!1;return i.field(Bp).between(0,i.doc.length,r=>{r==t&&(e=!0)}),e}function fo(i,t){let e=i.sliceString(t,t+2);return e.slice(0,wt(dt(e,0)))}function X1(i,t){let e=i.sliceString(t-2,t);return wt(dt(e,0))==e.length?e:e.slice(1)}function L1(i,t,e,r){let n=null,s=i.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:e,from:o.to}],effects:Oi.of(o.to+t.length),range:b.range(o.anchor+t.length,o.head+t.length)};let l=fo(i.doc,o.head);return!l||/\\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:t+e,from:o.head},effects:Oi.of(o.head+t.length),range:b.cursor(o.head+t.length)}:{range:n=o}});return n?null:i.update(s,{scrollIntoView:!0,userEvent:\"input.type\"})}function V1(i,t,e){let r=null,n=i.changeByRange(s=>s.empty&&fo(i.doc,s.head)==e?{changes:{from:s.head,to:s.head+e.length,insert:e},range:b.cursor(s.head+e.length)}:r={range:s});return r?null:i.update(n,{scrollIntoView:!0,userEvent:\"input.type\"})}function W1(i,t,e,r){let n=r.stringPrefixes||ln.stringPrefixes,s=null,o=i.changeByRange(l=>{if(!l.empty)return{changes:[{insert:t,from:l.from},{insert:t,from:l.to}],effects:Oi.of(l.to+t.length),range:b.range(l.anchor+t.length,l.head+t.length)};let a=l.head,h=fo(i.doc,a),f;if(h==t){if(Pp(i,a))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(Vp(i,a)){let u=e&&i.sliceDoc(a,a+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:a,to:a+u.length,insert:u},range:b.cursor(a+u.length)}}}else{if(e&&i.sliceDoc(a-2*t.length,a)==t+t&&(f=Cp(i,a-2*t.length,n))>-1&&Pp(i,f))return{changes:{insert:t+t+t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)};if(i.charCategorizer(a)(h)!=F.Word&&Cp(i,a,n)>-1&&!I1(i,a,t,n))return{changes:{insert:t+t,from:a},effects:Oi.of(a+t.length),range:b.cursor(a+t.length)}}return{range:s=l}});return s?null:i.update(o,{scrollIntoView:!0,userEvent:\"input.type\"})}function Pp(i,t){let e=pt(i).resolveInner(t+1);return e.parent&&e.from==t}function I1(i,t,e,r){let n=pt(i).resolveInner(t,-1),s=r.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=i.sliceDoc(n.from,Math.min(n.to,n.from+e.length+s)),a=l.indexOf(e);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let f=n.firstChild;for(;f&&f.from==n.from&&f.to-f.from>e.length+a;){if(i.sliceDoc(f.to-e.length,f.to)==e)return!1;f=f.firstChild}return!0}let h=n.to==t&&n.parent;if(!h)break;n=h}return!1}function Cp(i,t,e){let r=i.charCategorizer(t);if(r(i.sliceDoc(t-1,t))!=F.Word)return t;for(let n of e){let s=t-n.length;if(i.sliceDoc(s,t)==n&&r(i.sliceDoc(s-1,s))!=F.Word)return s}return-1}function co(i={}){return[It,gt.of(i),w1,N1,qp]}var hn=[{key:\"Ctrl-Space\",run:x1},{key:\"Escape\",run:y1},{key:\"ArrowDown\",run:ro(!0)},{key:\"ArrowUp\",run:ro(!1)},{key:\"PageDown\",run:ro(!0,\"page\")},{key:\"PageUp\",run:ro(!1,\"page\")},{key:\"Enter\",run:O1}],N1=ie.highest(Fe.computeN([gt],i=>i.facet(gt).defaultKeymap?[hn]:[]));var Y1=i=>{let{state:t}=i,e=t.doc.lineAt(t.selection.main.from),r=Mh(i.state,e.from);return r.line?z1(i):r.block?F1(i):!1};function Rh(i,t){return({state:e,dispatch:r})=>{if(e.readOnly)return!1;let n=i(t,e);return n?(r(e.update(n)),!0):!1}}var z1=Rh(H1,0);var Z1=Rh(_p,0);var F1=Rh((i,t)=>_p(i,t,G1(t)),0);function Mh(i,t){let e=i.languageDataAt(\"commentTokens\",t);return e.length?e[0]:{}}var fn=50;function _1(i,{open:t,close:e},r,n){let s=i.sliceDoc(r-fn,r),o=i.sliceDoc(n,n+fn),l=/\\s*$/.exec(s)[0].length,a=/^\\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-t.length,h)==t&&o.slice(a,a+e.length)==e)return{open:{pos:r-l,margin:l&&1},close:{pos:n+a,margin:a&&1}};let f,c;n-r<=2*fn?f=c=i.sliceDoc(r,n):(f=i.sliceDoc(r,r+fn),c=i.sliceDoc(n-fn,n));let u=/^\\s*/.exec(f)[0].length,d=/\\s*$/.exec(c)[0].length,m=c.length-d-e.length;return f.slice(u,u+t.length)==t&&c.slice(m,m+e.length)==e?{open:{pos:r+u+t.length,margin:/\\s/.test(f.charAt(u+t.length))?1:0},close:{pos:n-d-e.length,margin:/\\s/.test(c.charAt(m-1))?1:0}}:null}function G1(i){let t=[];for(let e of i.selection.ranges){let r=i.doc.lineAt(e.from),n=e.to<=r.to?r:i.doc.lineAt(e.to),s=t.length-1;s>=0&&t[s].to>r.from?t[s].to=n.to:t.push({from:r.from+/^\\s*/.exec(r.text)[0].length,to:n.to})}return t}function _p(i,t,e=t.selection.ranges){let r=e.map(s=>Mh(t,s.from).block);if(!r.every(s=>s))return null;let n=e.map((s,o)=>_1(t,r[o],s.from,s.to));if(i!=2&&!n.every(s=>s))return{changes:t.changes(e.map((s,o)=>n[o]?[]:[{from:s.from,insert:r[o].open+\" \"},{from:s.to,insert:\" \"+r[o].close}]))};if(i!=1&&n.some(s=>s)){let s=[];for(let o=0,l;on&&(s==o||o>c.from)){n=c.from;let u=/^\\s*/.exec(c.text)[0].length,d=u==c.length,m=c.text.slice(u,u+h.length)==h?u:-1;us.comment<0&&(!s.empty||s.single))){let s=[];for(let{line:l,token:a,indent:h,empty:f,single:c}of r)(c||!f)&&s.push({from:l.from+h,insert:a+\" \"});let o=t.changes(s);return{changes:o,selection:t.selection.map(o,1)}}else if(i!=1&&r.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of r)if(l>=0){let h=o.from+l,f=h+a.length;o.text[f-o.from]==\" \"&&f++,s.push({from:h,to:f})}return{changes:s}}return null}var Ph=Et.define(),U1=Et.define(),j1=A.define(),Gp=A.define({combine(i){return kt(i,{minDepth:100,newGroupDelay:500,joinToEvent:(t,e)=>e},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(t,e)=>(r,n)=>t(r,n)||e(r,n)})}}),Hp=it.define({create(){return xi.empty},update(i,t){let e=t.state.facet(Gp),r=t.annotation(Ph);if(r){let a=le.fromTransaction(t,r.selection),h=r.side,f=h==0?i.undone:i.done;return a?f=po(f,f.length,e.minDepth,a):f=Kp(f,t.startState.selection),new xi(h==0?r.rest:f,h==0?f:r.rest)}let n=t.annotation(U1);if((n==\"full\"||n==\"before\")&&(i=i.isolate()),t.annotation(lt.addToHistory)===!1)return t.changes.empty?i:i.addMapping(t.changes.desc);let s=le.fromTransaction(t),o=t.annotation(lt.time),l=t.annotation(lt.userEvent);return s?i=i.addChanges(s,o,l,e,t):t.selection&&(i=i.addSelection(t.startState.selection,o,l,e.newGroupDelay)),(n==\"full\"||n==\"after\")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(t=>t.toJSON()),undone:i.undone.map(t=>t.toJSON())}},fromJSON(i){return new xi(i.done.map(le.fromJSON),i.undone.map(le.fromJSON))}});function mo(i={}){return[Hp,Gp.of(i),T.domEventHandlers({beforeinput(t,e){let r=t.inputType==\"historyUndo\"?Up:t.inputType==\"historyRedo\"?Ch:null;return r?(t.preventDefault(),r(e)):!1}})]}function go(i,t){return function({state:e,dispatch:r}){if(!t&&e.readOnly)return!1;let n=e.field(Hp,!1);if(!n)return!1;let s=n.pop(i,e,t);return s?(r(s),!0):!1}}var Up=go(0,!1),Ch=go(1,!1),K1=go(0,!0),J1=go(1,!0);var le=class i{constructor(t,e,r,n,s){this.changes=t,this.effects=e,this.mapped=r,this.startSelection=n,this.selectionsAfter=s}setSelAfter(t){return new i(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){var t,e,r;return{changes:(t=this.changes)===null||t===void 0?void 0:t.toJSON(),mapped:(e=this.mapped)===null||e===void 0?void 0:e.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(n=>n.toJSON())}}static fromJSON(t){return new i(t.changes&&vt.fromJSON(t.changes),[],t.mapped&&Me.fromJSON(t.mapped),t.startSelection&&b.fromJSON(t.startSelection),t.selectionsAfter.map(b.fromJSON))}static fromTransaction(t,e){let r=Kt;for(let n of t.startState.facet(j1)){let s=n(t);s.length&&(r=r.concat(s))}return!r.length&&t.changes.empty?null:new i(t.changes.invert(t.startState.doc),r,void 0,e||t.startState.selection,Kt)}static selection(t){return new i(void 0,Kt,void 0,void 0,t)}};function po(i,t,e,r){let n=t+1>e+20?t-e-1:0,s=i.slice(n,t);return s.push(r),s}function ty(i,t){let e=[],r=!1;return i.iterChangedRanges((n,s)=>e.push(n,s)),t.iterChangedRanges((n,s,o,l)=>{for(let a=0;a=h&&o<=f&&(r=!0)}}),r}function ey(i,t){return i.ranges.length==t.ranges.length&&i.ranges.filter((e,r)=>e.empty!=t.ranges[r].empty).length===0}function jp(i,t){return i.length?t.length?i.concat(t):i:t}var Kt=[],iy=200;function Kp(i,t){if(i.length){let e=i[i.length-1],r=e.selectionsAfter.slice(Math.max(0,e.selectionsAfter.length-iy));return r.length&&r[r.length-1].eq(t)?i:(r.push(t),po(i,i.length-1,1e9,e.setSelAfter(r)))}else return[le.selection([t])]}function ry(i){let t=i[i.length-1],e=i.slice();return e[i.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),e}function Th(i,t){if(!i.length)return i;let e=i.length,r=Kt;for(;e;){let n=ny(i[e-1],t,r);if(n.changes&&!n.changes.empty||n.effects.length){let s=i.slice(0,e);return s[e-1]=n,s}else t=n.mapped,e--,r=n.selectionsAfter}return r.length?[le.selection(r)]:Kt}function ny(i,t,e){let r=jp(i.selectionsAfter.length?i.selectionsAfter.map(l=>l.map(t)):Kt,e);if(!i.changes)return le.selection(r);let n=i.changes.map(t),s=t.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(s):s;return new le(n,M.mapEffects(i.effects,t),o,i.startSelection.map(s),r)}var sy=/^(input\\.type|delete)($|\\.)/,xi=class i{constructor(t,e,r=0,n=void 0){this.done=t,this.undone=e,this.prevTime=r,this.prevUserEvent=n}isolate(){return this.prevTime?new i(this.done,this.undone):this}addChanges(t,e,r,n,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&t.changes&&(!r||sy.test(r))&&(!l.selectionsAfter.length&&e-this.prevTime0&&e-this.prevTimee.empty?i.moveByChar(e,t):xo(e,t))}function St(i){return i.textDirectionAt(i.state.selection.main.head)==G.LTR}var tm=i=>Jp(i,!St(i)),em=i=>Jp(i,St(i));function im(i,t){return ae(i,e=>e.empty?i.moveByGroup(e,t):xo(e,t))}var oy=i=>im(i,!St(i)),ly=i=>im(i,St(i));var lv=typeof Intl<\"u\"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:\"word\"}):null;function ay(i,t,e){if(t.type.prop(e))return!0;let r=t.to-t.from;return r&&(r>2||/[^\\s,.;:]/.test(i.sliceDoc(t.from,t.to)))||t.firstChild}function yo(i,t,e){let r=pt(i).resolveInner(t.head),n=e?E.closedBy:E.openedBy;for(let a=t.head;;){let h=e?r.childAfter(a):r.childBefore(a);if(!h)break;ay(i,h,n)?r=h:a=e?h.to:h.from}let s=r.type.prop(n),o,l;return s&&(o=e?oe(i,r.from,1):oe(i,r.to,-1))&&o.matched?l=e?o.end.to:o.end.from:l=e?r.to:r.from,b.cursor(l,e?-1:1)}var hy=i=>ae(i,t=>yo(i.state,t,!St(i))),fy=i=>ae(i,t=>yo(i.state,t,St(i)));function rm(i,t){return ae(i,e=>{if(!e.empty)return xo(e,t);let r=i.moveVertically(e,t);return r.head!=e.head?r:i.moveToLineBoundary(e,t)})}var nm=i=>rm(i,!1),sm=i=>rm(i,!0);function om(i){let t=i.scrollDOM.clientHeighto.empty?i.moveVertically(o,t,e.height):xo(o,t));if(n.eq(r.selection))return!1;let s;if(e.selfScroll){let o=i.coordsAtPos(r.selection.main.head),l=i.scrollDOM.getBoundingClientRect(),a=l.top+e.marginTop,h=l.bottom-e.marginBottom;o&&o.top>a&&o.bottomlm(i,!1),Ah=i=>lm(i,!0);function je(i,t,e){let r=i.lineBlockAt(t.head),n=i.moveToLineBoundary(t,e);if(n.head==t.head&&n.head!=(e?r.to:r.from)&&(n=i.moveToLineBoundary(t,e,!1)),!e&&n.head==r.from&&r.length){let s=/^\\s*/.exec(i.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;s&&t.head!=r.from+s&&(n=b.cursor(r.from+s))}return n}var cy=i=>ae(i,t=>je(i,t,!0)),uy=i=>ae(i,t=>je(i,t,!1)),dy=i=>ae(i,t=>je(i,t,!St(i))),py=i=>ae(i,t=>je(i,t,St(i))),my=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).from,1)),gy=i=>ae(i,t=>b.cursor(i.lineBlockAt(t.head).to,-1));function Oy(i,t,e){let r=!1,n=Ki(i.selection,s=>{let o=oe(i,s.head,-1)||oe(i,s.head,1)||s.head>0&&oe(i,s.head-1,1)||s.headOy(i,t,!1);function Jt(i,t){let e=Ki(i.state.selection,r=>{let n=t(r);return b.range(r.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return e.eq(i.state.selection)?!1:(i.dispatch(Ce(i.state,e)),!0)}function am(i,t){return Jt(i,e=>i.moveByChar(e,t))}var hm=i=>am(i,!St(i)),fm=i=>am(i,St(i));function cm(i,t){return Jt(i,e=>i.moveByGroup(e,t))}var yy=i=>cm(i,!St(i)),by=i=>cm(i,St(i));var Sy=i=>Jt(i,t=>yo(i.state,t,!St(i))),wy=i=>Jt(i,t=>yo(i.state,t,St(i)));function um(i,t){return Jt(i,e=>i.moveVertically(e,t))}var dm=i=>um(i,!1),pm=i=>um(i,!0);function mm(i,t){return Jt(i,e=>i.moveVertically(e,t,om(i).height))}var Ip=i=>mm(i,!1),Np=i=>mm(i,!0),vy=i=>Jt(i,t=>je(i,t,!0)),ky=i=>Jt(i,t=>je(i,t,!1)),Ty=i=>Jt(i,t=>je(i,t,!St(i))),Py=i=>Jt(i,t=>je(i,t,St(i))),Cy=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).from)),Ay=i=>Jt(i,t=>b.cursor(i.lineBlockAt(t.head).to)),Yp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:0})),!0),zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.doc.length})),!0),Zp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:0})),!0),Fp=({state:i,dispatch:t})=>(t(Ce(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),Qy=({state:i,dispatch:t})=>(t(i.update({selection:{anchor:0,head:i.doc.length},userEvent:\"select\"})),!0),Ry=({state:i,dispatch:t})=>{let e=bo(i).map(({from:r,to:n})=>b.range(r,Math.min(n+1,i.doc.length)));return t(i.update({selection:b.create(e),userEvent:\"select\"})),!0},My=({state:i,dispatch:t})=>{let e=Ki(i.selection,r=>{var n;let s=pt(i).resolveStack(r.from,1);for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&(!((n=l.parent)===null||n===void 0)&&n.parent))return b.range(l.to,l.from)}return r});return t(Ce(i,e)),!0},Ey=({state:i,dispatch:t})=>{let e=i.selection,r=null;return e.ranges.length>1?r=b.create([e.main]):e.main.empty||(r=b.create([b.cursor(e.main.head)])),r?(t(Ce(i,r)),!0):!1};function cn(i,t){if(i.state.readOnly)return!1;let e=\"delete.selection\",{state:r}=i,n=r.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=t(s);ao&&(e=\"delete.forward\",a=uo(i,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=uo(i,o,!1),l=uo(i,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:b.cursor(o,on(i)))r.between(t,t,(n,s)=>{nt&&(t=e?s:n)});return t}var gm=(i,t)=>cn(i,e=>{let r=e.from,{state:n}=i,s=n.doc.lineAt(r),o,l;if(!t&&r>s.from&&rgm(i,!1),Om=i=>gm(i,!0),xm=(i,t)=>cn(i,e=>{let r=e.head,{state:n}=i,s=n.doc.lineAt(r),o=n.charCategorizer(r);for(let l=null;;){if(r==(t?s.to:s.from)){r==e.head&&s.number!=(t?n.doc.lines:1)&&(r+=t?1:-1);break}let a=at(s.text,r-s.from,t)+s.from,h=s.text.slice(Math.min(r,a)-s.from,Math.max(r,a)-s.from),f=o(h);if(l!=null&&f!=l)break;(h!=\" \"||r!=e.head)&&(l=f),r=a}return r}),ym=i=>xm(i,!1),$y=i=>xm(i,!0),qy=i=>cn(i,t=>{let e=i.lineBlockAt(t.head).to;return t.headcn(i,t=>{let e=i.moveToLineBoundary(t,!1).head;return t.head>e?e:Math.max(0,t.head-1)}),By=i=>cn(i,t=>{let e=i.moveToLineBoundary(t,!0).head;return t.head{if(i.readOnly)return!1;let e=i.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:V.of([\"\",\"\"])},range:b.cursor(r.from)}));return t(i.update(e,{scrollIntoView:!0,userEvent:\"input\"})),!0},Ly=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=i.changeByRange(r=>{if(!r.empty||r.from==0||r.from==i.doc.length)return{range:r};let n=r.from,s=i.doc.lineAt(n),o=n==s.from?n-1:at(s.text,n-s.from,!1)+s.from,l=n==s.to?n+1:at(s.text,n-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:i.doc.slice(n,l).append(i.doc.slice(o,n))},range:b.cursor(l)}});return e.changes.empty?!1:(t(i.update(e,{scrollIntoView:!0,userEvent:\"move.character\"})),!0)};function bo(i){let t=[],e=-1;for(let r of i.selection.ranges){let n=i.doc.lineAt(r.from),s=i.doc.lineAt(r.to);if(!r.empty&&r.to==s.from&&(s=i.doc.lineAt(r.to-1)),e>=n.number){let o=t[t.length-1];o.to=s.to,o.ranges.push(r)}else t.push({from:n.from,to:s.to,ranges:[r]});e=s.number+1}return t}function bm(i,t,e){if(i.readOnly)return!1;let r=[],n=[];for(let s of bo(i)){if(e?s.to==i.doc.length:s.from==0)continue;let o=i.doc.lineAt(e?s.to+1:s.from-1),l=o.length+1;if(e){r.push({from:s.to,to:o.to},{from:s.from,insert:o.text+i.lineBreak});for(let a of s.ranges)n.push(b.range(Math.min(i.doc.length,a.anchor+l),Math.min(i.doc.length,a.head+l)))}else{r.push({from:o.from,to:s.from},{from:s.to,insert:i.lineBreak+o.text});for(let a of s.ranges)n.push(b.range(a.anchor-l,a.head-l))}}return r.length?(t(i.update({changes:r,scrollIntoView:!0,selection:b.create(n,i.selection.mainIndex),userEvent:\"move.line\"})),!0):!1}var Vy=({state:i,dispatch:t})=>bm(i,t,!1),Wy=({state:i,dispatch:t})=>bm(i,t,!0);function Sm(i,t,e){if(i.readOnly)return!1;let r=[];for(let n of bo(i))e?r.push({from:n.from,insert:i.doc.slice(n.from,n.to)+i.lineBreak}):r.push({from:n.to,insert:i.lineBreak+i.doc.slice(n.from,n.to)});return t(i.update({changes:r,scrollIntoView:!0,userEvent:\"input.copyline\"})),!0}var Iy=({state:i,dispatch:t})=>Sm(i,t,!1),Ny=({state:i,dispatch:t})=>Sm(i,t,!0),Yy=i=>{if(i.state.readOnly)return!1;let{state:t}=i,e=t.changes(bo(t).map(({from:n,to:s})=>(n>0?n--:si.moveVertically(n,!0)).map(e);return i.dispatch({changes:e,selection:r,scrollIntoView:!0,userEvent:\"delete.line\"}),!0};function zy(i,t){if(/\\(\\)|\\[\\]|\\{\\}/.test(i.sliceDoc(t-1,t+1)))return{from:t,to:t};let e=pt(i).resolveInner(t),r=e.childBefore(t),n=e.childAfter(t),s;return r&&n&&r.to<=t&&n.from>=t&&(s=r.type.prop(E.closedBy))&&s.indexOf(n.name)>-1&&i.doc.lineAt(r.to).from==i.doc.lineAt(n.from).from&&!/\\S/.test(i.sliceDoc(r.to,n.from))?{from:r.to,to:n.from}:null}var Zy=wm(!1),Fy=wm(!0);function wm(i){return({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:s,to:o}=n,l=t.doc.lineAt(s),a=!i&&s==o&&zy(t,s);i&&(s=o=(o<=l.to?l:t.doc.lineAt(o)).to);let h=new gi(t,{simulateBreak:s,simulateDoubleBreak:!!a}),f=oh(h,s);for(f==null&&(f=We(/^\\s*/.exec(t.doc.lineAt(s).text)[0],t.tabSize));ol.from&&s{let n=[];for(let o=r.from;o<=r.to;){let l=i.doc.lineAt(o);l.number>e&&(r.empty||r.to>l.from)&&(t(l,n,r),e=l.number),o=l.to+1}let s=i.changes(n);return{changes:n,range:b.range(s.mapPos(r.anchor,1),s.mapPos(r.head,1))}})}var _y=({state:i,dispatch:t})=>{if(i.readOnly)return!1;let e=Object.create(null),r=new gi(i,{overrideIndentation:s=>{let o=e[s];return o??-1}}),n=Eh(i,(s,o,l)=>{let a=oh(r,s.from);if(a==null)return;/\\S/.test(s.text)||(a=0);let h=/^\\s*/.exec(s.text)[0],f=rn(i,a);(h!=f||l.fromi.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{r.push({from:e.from,insert:i.facet(ke)})}),{userEvent:\"input.indent\"})),!0),Hy=({state:i,dispatch:t})=>i.readOnly?!1:(t(i.update(Eh(i,(e,r)=>{let n=/^\\s*/.exec(e.text)[0];if(!n)return;let s=We(n,i.tabSize),o=0,l=rn(i,Math.max(0,s-en(i)));for(;o({mac:i.key,run:i.run,shift:i.shift}))),So=[{key:\"Alt-ArrowLeft\",mac:\"Ctrl-ArrowLeft\",run:hy,shift:Sy},{key:\"Alt-ArrowRight\",mac:\"Ctrl-ArrowRight\",run:fy,shift:wy},{key:\"Alt-ArrowUp\",run:Vy},{key:\"Shift-Alt-ArrowUp\",run:Iy},{key:\"Alt-ArrowDown\",run:Wy},{key:\"Shift-Alt-ArrowDown\",run:Ny},{key:\"Escape\",run:Ey},{key:\"Mod-Enter\",run:Fy},{key:\"Alt-l\",mac:\"Ctrl-l\",run:Ry},{key:\"Mod-i\",run:My,preventDefault:!0},{key:\"Mod-[\",run:Hy},{key:\"Mod-]\",run:Gy},{key:\"Mod-Alt-\\\\\",run:_y},{key:\"Shift-Mod-k\",run:Yy},{key:\"Shift-Mod-\\\\\",run:xy},{key:\"Mod-/\",run:Y1},{key:\"Alt-A\",run:Z1}].concat(jy);var Dh=class i{constructor(t,e,r,n,s,o,l,a,h,f=0,c){this.p=t,this.stack=e,this.state=r,this.reducePos=n,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=f,this.parent=c}toString(){return`[${this.stack.filter((t,e)=>e%3==0).concat(this.state)}]@${this.pos}${this.score?\"!\"+this.score:\"\"}`}static start(t,e,r=0){let n=t.parser.context;return new i(t,[],e,r,r,0,[],0,n?new wo(n,n.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(t,e){this.stack.push(this.state,e,this.bufferBase+this.buffer.length),this.state=t}reduce(t){var e;let r=t>>19,n=t&65535,{parser:s}=this.p,o=s.dynamicPrecedence(n);if(o&&(this.score+=o),r==0){this.pushState(s.getGoto(this.state,n,!0),this.reducePos),n=2e3&&!(!((e=this.p.parser.nodeSet.types[n])===null||e===void 0)&&e.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=h):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(n,a)}storeNode(t,e,r,n=4,s=!1){if(t==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(e==r)return;if(o.buffer[l-2]>=e){o.buffer[l-2]=r;return}}}if(!s||this.pos==r)this.buffer.push(t,e,r,n);else{let o=this.buffer.length;if(o>0&&this.buffer[o-4]!=0)for(;o>0&&this.buffer[o-2]>r;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,n>4&&(n-=4);this.buffer[o]=t,this.buffer[o+1]=e,this.buffer[o+2]=r,this.buffer[o+3]=n}}shift(t,e,r,n){if(t&131072)this.pushState(t&65535,this.pos);else if(t&262144)this.pos=n,this.shiftContext(e,r),e<=this.p.parser.maxNode&&this.buffer.push(e,r,n,4);else{let s=t,{parser:o}=this.p;(n>this.pos||e<=o.maxNode)&&(this.pos=n,o.stateFlag(s,1)||(this.reducePos=n)),this.pushState(s,r),this.shiftContext(e,r),e<=o.maxNode&&this.buffer.push(e,r,n,4)}}apply(t,e,r,n){t&65536?this.reduce(t):this.shift(t,e,r,n)}useNode(t,e){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=t)&&(this.p.reused.push(t),r++);let n=this.pos;this.reducePos=this.pos=n+t.length,this.pushState(e,n),this.buffer.push(r,n,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,t,this,this.p.stream.reset(this.pos-t.length)))}split(){let t=this,e=t.buffer.length;for(;e>0&&t.buffer[e-2]>t.reducePos;)e-=4;let r=t.buffer.slice(e),n=t.bufferBase+e;for(;t&&n==t.bufferBase;)t=t.parent;return new i(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,n,this.curContext,this.lookAhead,t)}recoverByDelete(t,e){let r=t<=this.p.parser.maxNode;r&&this.storeNode(t,this.pos,e,4),this.storeNode(0,this.pos,e,r?8:4),this.pos=this.reducePos=e,this.score-=190}canShift(t){for(let e=new Bh(this);;){let r=this.p.parser.stateSlot(e.state,4)||this.p.parser.hasAction(e.state,t);if(r==0)return!1;if(!(r&65536))return!0;e.reduce(r)}}recoverByInsert(t){if(this.stack.length>=300)return[];let e=this.p.parser.nextStates(this.state);if(e.length>8||this.stack.length>=120){let n=[];for(let s=0,o;sa&1&&l==o)||n.push(e[s],o)}e=n}let r=[];for(let n=0;n>19,n=e&65535,s=this.stack.length-r*3;if(s<0||t.getGoto(this.stack[s],n,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;e=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(e),!0}findForcedReduction(){let{parser:t}=this.p,e=[],r=(n,s)=>{if(!e.includes(n))return e.push(n),t.allActions(n,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-s;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&t.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=r(o,s+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:t}=this.p;return t.data[t.stateSlot(this.state,1)]==65535&&!t.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(t){if(this.state!=t.state||this.stack.length!=t.stack.length)return!1;for(let e=0;ethis.lookAhead&&(this.emitLookAhead(),this.lookAhead=t)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}},wo=class{constructor(t,e){this.tracker=t,this.context=e,this.hash=t.strict?t.hash(e):0}},Bh=class{constructor(t){this.start=t,this.state=t.state,this.stack=t.stack,this.base=this.stack.length}reduce(t){let e=t&65535,r=t>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let n=this.start.p.parser.getGoto(this.stack[this.base-3],e,!0);this.state=n}},Xh=class i{constructor(t,e,r){this.stack=t,this.pos=e,this.index=r,this.buffer=t.buffer,this.index==0&&this.maybeNext()}static create(t,e=t.bufferBase+t.buffer.length){return new i(t,e,e-t.bufferBase)}maybeNext(){let t=this.stack.parent;t!=null&&(this.index=this.stack.bufferBase-t.bufferBase,this.stack=t,this.buffer=t.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new i(this.stack,this.pos,this.index)}};function un(i,t=Uint16Array){if(typeof i!=\"string\")return i;let e=null;for(let r=0,n=0;r=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}e?e[n++]=s:e=new t(s)}return e}var Ji=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},vm=new Ji,Lh=class{constructor(t,e){this.input=t,this.ranges=e,this.chunk=\"\",this.chunkOff=0,this.chunk2=\"\",this.chunk2Pos=0,this.next=-1,this.token=vm,this.rangeIndex=0,this.pos=this.chunkPos=e[0].from,this.range=e[0],this.end=e[e.length-1].to,this.readNext()}resolveOffset(t,e){let r=this.range,n=this.rangeIndex,s=this.pos+t;for(;sr.to:s>=r.to;){if(n==this.ranges.length-1)return null;let o=this.ranges[++n];s+=o.from-r.to,r=o}return s}clipPos(t){if(t>=this.range.from&&tt)return Math.max(t,e.from);return this.end}peek(t){let e=this.chunkOff+t,r,n;if(e>=0&&e=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),n=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),n}acceptToken(t,e=0){let r=e?this.resolveOffset(e,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?t.slice(0,this.range.to-this.pos):t,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(t=1){for(this.chunkOff+=t;this.pos+t>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();t-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=t,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=\"\",this.next=-1}reset(t,e){if(e?(this.token=e,e.start=t,e.lookAhead=t+1,e.value=e.extended=-1):this.token=vm,this.pos!=t){if(this.pos=t,t==this.end)return this.setDone(),this;for(;t=this.range.to;)this.range=this.ranges[++this.rangeIndex];t>=this.chunkPos&&t=this.chunkPos&&e<=this.chunkPos+this.chunk.length)return this.chunk.slice(t-this.chunkPos,e-this.chunkPos);if(t>=this.chunk2Pos&&e<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(t-this.chunk2Pos,e-this.chunk2Pos);if(t>=this.range.from&&e<=this.range.to)return this.input.read(t,e);let r=\"\";for(let n of this.ranges){if(n.from>=e)break;n.to>t&&(r+=this.input.read(Math.max(n.from,t),Math.min(n.to,e)))}return r}},Ke=class{constructor(t,e){this.data=t,this.id=e}token(t,e){let{parser:r}=e.p;Am(this.data,t,e,this.id,r.data,r.tokenPrecTable)}};Ke.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var Vh=class{constructor(t,e,r){this.precTable=e,this.elseToken=r,this.data=typeof t==\"string\"?un(t):t}token(t,e){let r=t.pos,n=0;for(;;){let s=t.next<0,o=t.resolveOffset(1,1);if(Am(this.data,t,e,0,this.data,this.precTable),t.token.value>-1)break;if(this.elseToken==null)return;if(s||n++,o==null)break;t.reset(o,t.token)}n&&(t.reset(r,t.token),t.acceptToken(this.elseToken,n))}};Vh.prototype.contextual=Ke.prototype.fallback=Ke.prototype.extend=!1;var yi=class{constructor(t,e={}){this.token=t,this.contextual=!!e.contextual,this.fallback=!!e.fallback,this.extend=!!e.extend}};function Am(i,t,e,r,n,s){let o=0,l=1<0){let m=i[d];if(a.allows(m)&&(t.token.value==-1||t.token.value==m||Jy(m,t.token.value,n,s))){t.acceptToken(m);break}}let f=t.next,c=0,u=i[o+2];if(t.next<0&&u>c&&i[h+u*3-3]==65535){o=i[h+u*3-1];continue t}for(;c>1,m=h+d+(d<<1),O=i[m],g=i[m+1]||65536;if(f=g)c=d+1;else{o=i[m+2],t.advance();continue t}}break}}function km(i,t,e){for(let r=t,n;(n=i[r])!=65535;r++)if(n==e)return r-t;return-1}function Jy(i,t,e,r){let n=km(e,r,t);return n<0||km(e,r,i)t)&&!r.type.isError)return e<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(i.length,Math.max(r.from+1,t+25));if(e<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return e<0?0:i.length}}var Wh=class{constructor(t,e){this.fragments=t,this.nodeSet=e,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let t=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(t){for(this.safeFrom=t.openStart?Tm(t.tree,t.from+t.offset,1)-t.offset:t.from,this.safeTo=t.openEnd?Tm(t.tree,t.to+t.offset,-1)-t.offset:t.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(t.tree),this.start.push(-t.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(t){if(tt)return this.nextStart=o,null;if(s instanceof ot){if(o==t){if(o=Math.max(this.safeFrom,t)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[e]++,this.nextStart=o+s.length}}},Ih=class{constructor(t,e){this.stream=e,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=t.tokenizers.map(r=>new Ji)}getActions(t){let e=0,r=null,{parser:n}=t.p,{tokenizers:s}=n,o=n.stateSlot(t.state,3),l=t.curContext?t.curContext.hash:0,a=0;for(let h=0;hc.end+25&&(a=Math.max(c.lookAhead,a)),c.value!=0)){let u=e;if(c.extended>-1&&(e=this.addActions(t,c.extended,c.end,e)),e=this.addActions(t,c.value,c.end,e),!f.extend&&(r=c,e>u))break}}for(;this.actions.length>e;)this.actions.pop();return a&&t.setLookAhead(a),!r&&t.pos==this.stream.end&&(r=new Ji,r.value=t.p.parser.eofTerm,r.start=r.end=t.pos,e=this.addActions(t,r.value,r.end,e)),this.mainToken=r,this.actions}getMainToken(t){if(this.mainToken)return this.mainToken;let e=new Ji,{pos:r,p:n}=t;return e.start=r,e.end=Math.min(r+1,n.stream.end),e.value=r==n.stream.end?n.parser.eofTerm:0,e}updateCachedToken(t,e,r){let n=this.stream.clipPos(r.pos);if(e.token(this.stream.reset(n,t),r),t.value>-1){let{parser:s}=r.p;for(let o=0;o=0&&r.p.parser.dialect.allows(l>>1)){l&1?t.extended=l>>1:t.value=l>>1;break}}}else t.value=0,t.end=this.stream.clipPos(n+1)}putAction(t,e,r,n){for(let s=0;st.bufferLength*4?new Wh(r,t.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let t=this.stacks,e=this.minStackPos,r=this.stacks=[],n,s;if(this.bigReductionCount>300&&t.length==1){let[o]=t;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;oe)r.push(l);else{if(this.advanceStack(l,r,t))continue;{n||(n=[],s=[]),n.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!r.length){let o=n&&tb(n);if(o)return Nt&&console.log(\"Finish with \"+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Nt&&n&&console.log(\"Stuck with token \"+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):\"none\")),new SyntaxError(\"No parse at \"+e);this.recovering||(this.recovering=5)}if(this.recovering&&n){let o=this.stoppedAt!=null&&n[0].pos>this.stoppedAt?n[0]:this.runRecovery(n,s,r);if(o)return Nt&&console.log(\"Force-finish \"+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(r.length>o)for(r.sort((l,a)=>a.score-l.score);r.length>o;)r.pop();r.some(l=>l.reducePos>e)&&this.recovering--}else if(r.length>1){t:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)r.splice(a--,1);else{r.splice(o--,1);continue t}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let o=1;o \":\"\";if(this.stoppedAt!=null&&n>this.stoppedAt)return t.forceReduce()?t:null;if(this.fragments){let h=t.curContext&&t.curContext.tracker.strict,f=h?t.curContext.hash:0;for(let c=this.fragments.nodeAt(n);c;){let u=this.parser.nodeSet.types[c.type.id]==c.type?s.getGoto(t.state,c.type.id):-1;if(u>-1&&c.length&&(!h||(c.prop(E.contextHash)||0)==f))return t.useNode(c,u),Nt&&console.log(o+this.stackID(t)+` (via reuse of ${s.getName(c.type.id)})`),!0;if(!(c instanceof ot)||c.children.length==0||c.positions[0]>0)break;let d=c.children[0];if(d instanceof ot&&c.positions[0]==0)c=d;else break}}let l=s.stateSlot(t.state,4);if(l>0)return t.reduce(l),Nt&&console.log(o+this.stackID(t)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(t.stack.length>=8400)for(;t.stack.length>6e3&&t.forceReduce(););let a=this.tokens.getActions(t);for(let h=0;hn?e.push(m):r.push(m)}return!1}advanceFully(t,e){let r=t.pos;for(;;){if(!this.advanceStack(t,null,null))return!1;if(t.pos>r)return Pm(t,e),!0}}runRecovery(t,e,r){let n=null,s=!1;for(let o=0;o \":\"\";if(l.deadEnd&&(s||(s=!0,l.restart(),Nt&&console.log(f+this.stackID(l)+\" (restarted)\"),this.advanceFully(l,r))))continue;let c=l.split(),u=f;for(let d=0;c.forceReduce()&&d<10&&(Nt&&console.log(u+this.stackID(c)+\" (via force-reduce)\"),!this.advanceFully(c,r));d++)Nt&&(u=this.stackID(c)+\" -> \");for(let d of l.recoverByInsert(a))Nt&&console.log(f+this.stackID(d)+\" (via recover-insert)\"),this.advanceFully(d,r);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Nt&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Pm(l,r)):(!n||n.scorei,vo=class{constructor(t){this.start=t.start,this.shift=t.shift||qh,this.reduce=t.reduce||qh,this.reuse=t.reuse||qh,this.hash=t.hash||(()=>0),this.strict=t.strict!==!1}},ko=class i extends _i{constructor(t){if(super(),this.wrappers=[],t.version!=14)throw new RangeError(`Parser version (${t.version}) doesn't match runtime version (14)`);let e=t.nodeNames.split(\" \");this.minRepeatTerm=e.length;for(let l=0;lt.topRules[l][1]),n=[];for(let l=0;l=0)s(f,a,l[h++]);else{let c=l[h+-f];for(let u=-f;u>0;u--)s(l[h++],a,c);h++}}}this.nodeSet=new Hr(e.map((l,a)=>bt.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:n[a],top:r.indexOf(a)>-1,error:a==0,skipped:t.skippedNodes&&t.skippedNodes.indexOf(a)>-1}))),t.propSources&&(this.nodeSet=this.nodeSet.extend(...t.propSources)),this.strict=!1,this.bufferLength=1024;let o=un(t.tokenData);this.context=t.context,this.specializerSpecs=t.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l==\"number\"?new Ke(o,l):l),this.topRules=t.topRules,this.dialects=t.dialects||{},this.dynamicPrecedences=t.dynamicPrecedences||null,this.tokenPrecTable=t.tokenPrec,this.termNames=t.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(t,e,r){let n=new Nh(this,t,e,r);for(let s of this.wrappers)n=s(n,t,e,r);return n}getGoto(t,e,r=!1){let n=this.goto;if(e>=n[0])return-1;for(let s=n[e+1];;){let o=n[s++],l=o&1,a=n[s++];if(l&&r)return a;for(let h=s+(o>>1);s0}validAction(t,e){return!!this.allActions(t,r=>r==e?!0:null)}allActions(t,e){let r=this.stateSlot(t,4),n=r?e(r):void 0;for(let s=this.stateSlot(t,1);n==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=Be(this.data,s+2);else break;n=e(Be(this.data,s+1))}return n}nextStates(t){let e=[];for(let r=this.stateSlot(t,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Be(this.data,r+2);else break;if(!(this.data[r+2]&1)){let n=this.data[r+1];e.some((s,o)=>o&1&&s==n)||e.push(this.data[r],n)}}return e}configure(t){let e=Object.assign(Object.create(i.prototype),this);if(t.props&&(e.nodeSet=this.nodeSet.extend(...t.props)),t.top){let r=this.topRules[t.top];if(!r)throw new RangeError(`Invalid top rule name ${t.top}`);e.top=r}return t.tokenizers&&(e.tokenizers=this.tokenizers.map(r=>{let n=t.tokenizers.find(s=>s.from==r);return n?n.to:r})),t.specializers&&(e.specializers=this.specializers.slice(),e.specializerSpecs=this.specializerSpecs.map((r,n)=>{let s=t.specializers.find(l=>l.from==r.external);if(!s)return r;let o=Object.assign(Object.assign({},r),{external:s.to});return e.specializers[n]=Cm(o),o})),t.contextTracker&&(e.context=t.contextTracker),t.dialect&&(e.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(e.strict=t.strict),t.wrap&&(e.wrappers=e.wrappers.concat(t.wrap)),t.bufferLength!=null&&(e.bufferLength=t.bufferLength),e}hasWrappers(){return this.wrappers.length>0}getName(t){return this.termNames?this.termNames[t]:String(t<=this.maxNode&&this.nodeSet.types[t].name||t)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(t){let e=this.dynamicPrecedences;return e==null?0:e[t]||0}parseDialect(t){let e=Object.keys(this.dialects),r=e.map(()=>!1);if(t)for(let s of t.split(\" \")){let o=e.indexOf(s);o>=0&&(r[o]=!0)}let n=null;for(let s=0;sr)&&e.p.parser.stateFlag(e.state,2)&&(!t||t.scorei.external(e,r)<<1|t}return i.get}var eb=1,Mm=206,Em=207,ib=208,Qm=209,rb=210,nb=211,sb=212,ob=2,lb=213,ab=214,hb=3,fb=215,cb=216,ub=4,db=217,pb=218,mb=5,gb=219,Ob=26,xb=27,yb=51,bb=52,Sb=57,wb=58,vb=59,kb=61,Tb=62,Pb=63,Cb=64,Ab=65,Qb=67,Rb=256,Mb=74,Eb=275,$b=120,qb=138,Db=159,Bb=160,Xb=163,dn=10,pn=13,Fh=32,To=9,_h=35,Lb=40,Vb=46,Rm=123,$m=39,qm=34,Wb=92,Ib=new Set([xb,yb,bb,Eb,Qb,qb,wb,vb,Rb,Cb,Ab,Mb,Tb,Pb,Db,Bb,Xb,$b]);function zh(i){return i==dn||i==pn}var Nb=new yi((i,t)=>{let e;if(i.next<0)i.acceptToken(nb);else if(t.context.depth<0)zh(i.next)&&i.acceptToken(rb,1);else if(((e=i.peek(-1))<0||zh(e))&&t.canShift(Qm)){let r=0;for(;i.next==Fh||i.next==To;)i.advance(),r++;(i.next==dn||i.next==pn||i.next==_h)&&i.acceptToken(Qm,-r)}else zh(i.next)&&i.acceptToken(ib,1)},{contextual:!0}),Yb=new yi((i,t)=>{let e=t.context.depth;if(e<0)return;let r=i.peek(-1);if(r==dn||r==pn){let n=0,s=0;for(;;){if(i.next==Fh)n++;else if(i.next==To)n+=8-n%8;else break;i.advance(),s++}n!=e&&i.next!=dn&&i.next!=pn&&i.next!=_h&&(n{for(let t=0;t<5;t++){if(i.next!=\"print\".charCodeAt(t))return;i.advance()}if(!/\\w/.test(String.fromCharCode(i.next)))for(let t=0;;t++){let e=i.peek(t);if(!(e==Fh||e==To)){e!=Lb&&e!=Vb&&e!=dn&&e!=pn&&e!=_h&&i.acceptToken(eb);return}}});function Po(i,t,e,r,n){return new yi(s=>{let o=s.pos;for(;!(s.next<0);)if(s.next==Rm)if(s.peek(1)==Rm)s.advance(2);else{if(s.pos==o){s.acceptToken(r,1);return}break}else if(s.next==Wb)s.advance(),s.next>=0&&s.advance();else if(s.next==i&&(t==1||s.peek(1)==i&&s.peek(2)==i)){if(s.pos==o){s.acceptToken(n,t);return}break}else s.advance();s.pos>o&&s.acceptToken(e)})}var Gb=Po($m,1,sb,ob,lb),Hb=Po(qm,1,ab,hb,fb),Ub=Po($m,3,cb,ub,db),jb=Po(qm,3,pb,mb,gb),Kb=Hs({'async \"*\" \"**\" FormatConversion FormatSpec':p.modifier,\"for while if elif else try except finally return raise break continue with pass assert await yield match case\":p.controlKeyword,\"in not and or is del\":p.operatorKeyword,\"from def class global nonlocal lambda\":p.definitionKeyword,import:p.moduleKeyword,\"with as print\":p.keyword,Boolean:p.bool,None:p.null,VariableName:p.variableName,\"CallExpression/VariableName\":p.function(p.variableName),\"FunctionDefinition/VariableName\":p.function(p.definition(p.variableName)),\"ClassDefinition/VariableName\":p.definition(p.className),PropertyName:p.propertyName,\"CallExpression/MemberExpression/PropertyName\":p.function(p.propertyName),Comment:p.lineComment,Number:p.number,String:p.string,FormatString:p.special(p.string),UpdateOp:p.updateOperator,\"ArithOp!\":p.arithmeticOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,AssignOp:p.definitionOperator,Ellipsis:p.punctuation,At:p.meta,\"( )\":p.paren,\"[ ]\":p.squareBracket,\"{ }\":p.brace,\".\":p.derefOperator,\", ;\":p.separator}),Jb={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:178,True:180,False:180,del:194,pass:198,break:202,continue:206,return:210,raise:218,import:222,as:224,global:228,nonlocal:230,assert:234,type:239,elif:252,while:256,try:262,except:264,finally:266,with:270,def:274,class:284,match:295,case:301},Dm=ko.deserialize({version:14,states:\"#)WO`Q#yOOP$bOSOOO%kQ&nO'#HhOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HgOOQS'#Hh'#HhOOQS'#DW'#DWOOQS'#Hg'#HgO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HXOOQS'#HX'#HXO'ZQ#xO'#HWO/ZQ&nO'#HWOOQS'#Ej'#EjO/rQ#xO'#EkOOQS'#HV'#HVO/|Q#xO'#HUOOQV'#HU'#HUO0XQ#xO'#FbOOQS'#Gj'#GjO0^Q#xO'#FaOOQV'#I_'#I_OOQV'#HT'#HTOOQV'#Fy'#FyQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HlO1cQ&nO'#E_O'ZQ#xO'#E`OOQS'#Eb'#EbOOQS'#Ed'#EdOOQS'#Ef'#EfO1wQ#xO'#EhO2_Q#xO'#ElO0XQ#xO'#EnO2rQ&nO'#EnO0XQ#xO'#EqO/rQ#xO'#EtO0XQ#xO'#EvO/rQ#xO'#E|O/rQ#xO'#FPO2}Q#xO'#FRO3UQ#xO'#FWO3aQ#xO'#FSO/rQ#xO'#FWO0XQ#xO'#FYO0XQ#xO'#F_O3fQ#xO'#FdP3mO#xO'#HSPOOO)CBv)CBvOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Ck'#CkOOQS'#Cl'#ClOOQS'#Cn'#CnO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO'ZQ#xO,59QO3xQ#xO'#DqOOQS,5:[,5:[O4]Q#xO'#HvOOQS,5:_,5:_O4jQMlO,5:_O4oQ&nO,59[O0lQ#xO,59dO0lQ#xO,59dO0lQ#xO,59dO7_Q#xO,59dO7dQ#xO,59dO7kQ#xO,59lO7rQ#xO'#HgO8xQ#xO'#HfOOQS'#Hf'#HfOOQS'#D^'#D^O9aQ#xO,59cO'ZQ#xO,59cO9oQ#xO,59cOOQS,59{,59{O9tQ#xO,5:TO'ZQ#xO,5:TOOQS,5:S,5:SO:SQ#xO,5:SO:XQ#xO,5:ZO'ZQ#xO,5:ZO'ZQ#xO,5:XOOQS,5:W,5:WO:jQ#xO,5:WO:oQ#xO,5:YOOOO'#GR'#GRO:tO,UO,5:cOOQS,5:c,5:cOOOO'#GS'#GSO:|O7[O,5:cO;UQ#xO'#DyOOOW'#GT'#GTO;fOWO,5:dOOQS,5:d,5:dO;UQ#xO'#EPOOO`'#GW'#GWO;qO`O,5:dO;UQ#xO'#EROOOp'#GX'#GXO;|OpO,5:dO;UQ#xO'#ETOOO!b'#GY'#GYOWOOQS,5>W,5>WO/rQ#xO'#EZOOQS'#E['#E[OGZQ#xO'#G]OGkQ#xO,59OOGkQ#xO,59OO)pQ#xO,5:wOGyQ&nO'#HoOOQS,5:z,5:zOOQS,5;S,5;SOH^Q#xO,5;WOHoQ#xO,5;YOOQS'#G`'#G`OH}Q&nO,5;YOI]Q#xO,5;YOIbQ#xO'#I]OOQS,5;],5;]OIpQ#xO'#IXOOQS,5;`,5;`OJRQ#xO,5;bO3aQ#xO,5;hO3aQ#xO,5;kOJZQ&nO'#I`O'ZQ#xO'#I`OJeQ#xO,5;mO2}Q#xO,5;mO/rQ#xO,5;rO0XQ#xO,5;tOJjQ#yO'#E}OKvQ#{O,5;nO! [Q#xO'#IaO3aQ#xO,5;rO! gQ#xO,5;tO! oQ#xO,5;yO! zQ&nO,5bOOQS'#Du'#DuOOQS1G/y1G/yOOQS1G/O1G/OO!-uQ&nO1G/OO!-|Q&nO1G/OO0lQ#xO1G/OO!.iQ#xO1G/WOOQS'#D]'#D]O/rQ#xO,59vOOQS1G.}1G.}O!.pQ#xO1G/gO!/QQ#xO1G/gO!/YQ#xO1G/hO'ZQ#xO'#HnO!/_Q#xO'#HnO!/dQ&nO1G.}O!/tQ#xO,59kO!0zQ#xO,5>^O!1[Q#xO,5>^O!1dQ#xO1G/oO!1iQ&nO1G/oOOQS1G/n1G/nO!1yQ#xO,5>XO!2pQ#xO,5>XO/rQ#xO1G/sO!3_Q#xO1G/uO!3dQ&nO1G/uO!3tQ&nO1G/sOOQS1G/r1G/rOOQS1G/t1G/tOOOO-E:P-E:POOQS1G/}1G/}OOOO-E:Q-E:QO!4UQ#xO'#IRO/rQ#xO'#IRO!4gQ#xO,5:eOOOW-E:R-E:ROOQS1G0O1G0OO!4uQ#xO,5:kOOO`-E:U-E:UO!5TQ#xO,5:mOOOp-E:V-E:VO!5cQ#xO,5:oOOO!b-E:W-E:WOOQS-E:X-E:XO!5qQ!LUO1G3^O!6bQ&nO1G3^O'ZQ#xO,5tOOQS1G1h1G1hO!7bQ#xO1G1hOOQS'#DX'#DXO/rQ#xO,5>TOOQS,5>T,5>TO!7gQ#xO'#FzO!7rQ#xO,59qO!7zQ#xO1G/ZO!8UQ&nO,5>XOOQS1G3r1G3rOOQS,5:u,5:uO!8uQ#xO'#HWOOQS,5ZO!9vQ#xO,5>ZO/rQ#xO1G0rO/rQ#xO1G0rO0XQ#xO1G0tOOQS-E:^-E:^O!:XQ#xO1G0tO!:dQ#xO1G0tO!:iQ#xO,5>wO!:wQ#xO,5>wO!;VQ#xO,5>sO!;mQ#xO,5>sO!zO!CZQ#xO,5>zO!CcQ&nO,5>zO/rQ#xO1G1XO!CmQ#xO1G1XO3aQ#xO1G1^O! gQ#xO1G1`OOQV,5;i,5;iO!CrQ#zO,5;iO!CwQ#{O1G1YO!G]Q#xO'#GgO3aQ#xO1G1YO3aQ#xO1G1YO!GmQ#xO,5>{O!GzQ#xO,5>{O0XQ#xO,5>{OOQV1G1^1G1^O!HSQ#xO'#F[O!HeQMlO1G1`O!HmQ#xO1G1`OOQV1G1e1G1eO3aQ#xO1G1eO!HrQ#xO1G1eO!HzQ#xO'#FfOOQV1G1j1G1jO! zQ&nO1G1jPOOO1G3Y1G3YP!IPOSO1G3YOOQS,5>a,5>aOOQS'#Dr'#DrO/rQ#xO,5>aO!IUQ#xO,5>`O!IiQ#xO,5>`OOQS1G/w1G/wO!IqQ#xO,5>cO!JRQ#xO,5>cO!JZQ#xO,5>cO!JnQ#xO,5>cO!KOQ#xO,5>cOOQS1G3|1G3|OOQS7+$j7+$jO!7zQ#xO7+$rO!LqQ#xO1G/OO!LxQ#xO1G/OOOQS1G/b1G/bOOQS,5YO'ZQ#xO,5>YOOQS7+$i7+$iO!MfQ#xO7+%RO!MnQ#xO7+%SO!MsQ#xO1G3xOOQS7+%Z7+%ZO!NTQ#xO1G3xO!N]Q#xO7+%ZOOQS,5mO##cQ#xO,5>mO##cQ#xO,5>mOOQS'#Dz'#DzO##tO$ISO'#D|O#$PO#tO'#ISOOOW1G0P1G0PO#$UQ#xO1G0PO#$^Q#xO1G0POOQS'#EQ'#EQOOO`1G0V1G0VO#$iQ#xO1G0VO#$qQ#xO1G0VOOQS'#ES'#ESOOOp1G0X1G0XO#$|Q#xO1G0XO#%UQ#xO1G0XOOQS'#EU'#EUOOO!b1G0Z1G0ZO#%aQ#xO1G0ZO#%iQ#xO1G0ZO#%tQ!LUO7+(xO#&eQ&nO1G2bP#'OQ#xO'#G[OOQS,5n,5>nOOOW7+%k7+%kO#;yQ#xO7+%kOOO`7+%q7+%qO#vO#=xQ#xO,5>vO0XQ#xO,5>vO#>ZQ#xO,5>uOOQS<`Q#xO,5>xO#>nQ#xO,5>xOOQS1G1O1G1OOOQS<vQ&nO1G2lP#?QQ#xO'#GfO#?XQ#xO7+*QO#?cQ#{O<}O#F{Q#xO,5>}OOQS,5>},5>}O#GWQ#xO,5>|O#GiQ#xO,5>|OOQS1G1b1G1bOOQS,5;x,5;xOOQV<XAN>XO#JxQ#xO<eAN>eO/rQ#xO1G2UO#KYQ&nO1G2UP#KdQ#xO'#GOOOQS1G2[1G2[P#KqQ#xO'#GUO#LOQ#xO7+)sO#LiQ#xO,5:iOOOO-E:T-E:TOOOW<[OOQSANBfANBfOOOO7+%o7+%oO$.WQ#xO7+%oOOQS7+(R7+(RO$.`Q#xO<kPP>n?`?cPP'f'fPP?{PP'f'fPP'f'f'f'f'f@P@y'fP@|PASE^H}IRPIUIlIpIsIwIzJOJRJV'fPPPJYJc'^P'^'^P'^P'^P'^P'^P'^'^'^P'^PP'^PP'^P'^PJiJuJ}PKUK[PKUPKUKUPPPKUPMjPMsM}NTMjPKUN^PKUPNeNkPNo! T! r!!]NoNo!!c!!pNoNoNoNo!#U!#[!#_!#d!#g!#q!#w!$T!$g!$m!$w!$}!%k!%q!%w!%}!&X!&_!&e!&k!&q!&w!'Z!'e!'k!'q!'w!(R!(X!(_!(e!(k!(u!({!)V!)]!)f!)l!){!*T!*_!*fPPPPPPPPPPPPPPPPP!*l!*o!*u!+O!+Y!+ePPPPPPPPPPPP!0[!1p!5s!9WPP!9`!9r!9{!:t!:k!:}!;T!;W!;Z!;^!;f!V!>]!>f!>i!>l!>r!>x!?O!?RP!?Z!?d!@`!@c]jOs#v$w*`,p(TeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o}!hQ#r$P$b$q$}%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!P!iQ#r$P$b$q$}%S%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!R!jQ#r$P$b$q$}%S%T%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!T!kQ#r$P$b$q$}%S%T%U%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!V!lQ#r$P$b$q$}%S%T%U%V%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!X!mQ#r$P$b$q$}%S%T%U%V%W%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d!]!mQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1d(TTOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1o&iVOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1o%sXOYZ[isw}!O!S!U!V!Z!n!p#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$VvQ0X/fR1l1n'zeOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oW#ym!P!Q$hW$Rv&q/f1nQ$j!RQ$n!TQ${![Q$|!]W%Z!n(O+O-WS&p$S$TQ'e$vQ)b&jQ)p'QU)q'S)r)sU)t'U)u,ZW){'Y,^-z.vQ*l'nW*m'p-P._/OQ,])zS-O*n*oY-t,U-u.s.t/lQ-w,WQ.U,tQ.Y,wQ.|.Wl/R.c/X/Y/[/w/y0O0g0l0q0v1R1W1ZQ/k.rQ0P/ZQ0^/qQ0i/{U0|0r1P1XX1S0w1T1[1]R&o$R!_!|YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WR%k!{Q#QYQ&W#cQ&Z#gQ&]#jQ&_#mQ&x$^Q&{$aR-l+tT/e.j0p![!oQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dQ&m#zQ't$|R*x'uR'}%ZQ%d!rR0[/o(SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oS#pd#q!P/V.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1](SdOTYZ[fistuwy}!O!S!U!V!W!Z!^!h!i!j!k!l!m!n!p!t!u!v!x!y#P#T#X#Y#c#g#j#m#s#v$X$Y$[$^$a$r$t$u$w%O%[%a%h%k%m%p%t%y%{&V&b&d&o&s&|'O'P'W'Z'_'b'i'l'}(O(R(T(U(Y(_(a(e(i(n(o(u(x)_)a)i)l)x*P*R*V*W*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+l+p+q+t,Q,S,T,[,i,j,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0S0W0p1`1a1b1c1e1f1g1h1i1k1oT#pd#qT#d`#eR)Q&Wy(}&W&Z&]&_)P)Q)T)U)X)Y)])^+y+{+},P-l.p.q/jT+u(|+vR.q-lT#ha#iR)U&ZT#kb#lR)Y&]T#nc#oR)^&_Q$`xQ,]){R,}*mX$^x$_$`&zQ'[$nQ'r${Q'u$|R*_'eQ)|'YV-y,^-z.vZlOs$w*`,pXpOs*`,pQ$x!YQ']$oQ'^$pQ'o$zQ's$|Q*]'dQ*d'iQ*g'jQ*h'kQ*u'qS*w't'uQ,d*RQ,f*SQ,g*TQ,k*ZS,m*^*vQ,q*bQ,r*cS,s*e*fQ-T*xQ-|,cQ-},eQ.P,lS.Q,n,oQ.V,uQ.X,vQ.w.OQ.y.RQ.z.TQ.{.UQ/m.xQ/n.|Q0T/_R0o0UWpOs*`,pR#|oQ'q${S*^'e'rR,o*_Q,|*mR.],}Q*v'qQ,n*^R.R,oZnOos*`,pQ'w$}R*z'xT.a-U.bu/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1Zt/^.c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZQ0P/ZX1S0w1T1[1]!P/U.c/X/Y/Z/[/q/w/y0O0g0l0q0r0v0w1P1R1T1W1X1Z1[1]Q/t/TR0c/ug/w/W/x0_0f0k0y0{0}1Y1^1_u/].c/X/Y/[/q/w/y0O0g0l0q0r0v1P1R1W1X1ZX/r/R/]0^0|R0`/qV1O0r1P1XR0U/_QsOS$Os,pR,p*`Q&r$UR)g&rS%z#W$WS(p%z(sT(s%}&tQ%n#OQ%u#SW(b%n%u(g(kQ(g%rR(k%wQ&}$bR)m&}Q(v&OQ+g(qT+m(v+gQ(P%]R+P(PS(S%`%aY+T(S+U-^.h/cU+U(T(U(VU-^+V+W+XS.h-_-`R/c.iQ#_^R&R#_Q#b_R&T#bQ#e`R&X#eQ(y&US+r(y+sR+s(zQ+v(|R-m+vQ#iaR&[#iQ#lbR&^#lQ#ocR&`#oQ#qdR&a#qQ#tgQ&c#rW&f#t&c)j,RQ)j&wR,R1dQ$_xS&y$_&zR&z$`Q'X$lR)y'XQ&k#yR)c&kQ$h!QR'R$hQ,V)qS-v,V.uR.u-wQ'V$jR)v'VQ,_)|R-{,_Q#wkR&h#wQ*Q']R,b*QQ'`$qS*X'`*YR*Y'aQ'h$xR*a'hQ'm$yS*k'm,zR,z*lQ-Q*qR.`-QWoOs*`,pR#{oQ.b-UR/P.bd/x/W0_0f0k0y0{0}1Y1^1_R0e/xU/p/R0^0|R0]/pQ0x0kS1U0x1VR1V0yS0s0_0`R1Q0sQ/z/WR0h/zR!`PXrOs*`,pWqOs*`,pR'f$wYkOs$w*`,pR&g#v[xOs#v$w*`,pR&x$^&hQOYZ[isuw}!O!S!U!V!Z!n!p!t!u!v!x!y#c#g#j#m#s#v$Y$[$^$a$u$w%[%a%h%k%m%t%y%{&V&b&o&s'O'P'W'Z'b'i'l'}(O(R(T(U(Y(a(i(o(u(x)_)a)i)x*P*R*[*`*f*j*t+O+R+S+V+]+^+`+b+e+f+i+p+q+t,Q,T,[,p,x,y,|-W-X-Y-[-]-`-b-d-f-h-j-k-r.Z.].d.g.j/a/b0W0p1`1a1b1c1e1f1g1h1k1oQ!sTQ#rfQ$PtU$by%p(eS$q!W$tQ$}!^Q%S!hQ%T!iQ%U!jQ%V!kQ%W!lQ%X!mQ%r#PQ%w#TQ%}#XQ&O#YQ&t$XQ'a$rQ'x%OQ)`&dU)k&|)l,SW*U'_*W,i,jQ+Z(_Q+d(nQ,h*VQ-g+lQ0n0SR1d1iQ#OYQ#SZQ$o!UQ$p!VQ%`!pQ(V%a^(^%m%t(a(i+]+`+b^+Q(R+S-[-].g/b0WQ+W(TQ+X(UQ,e*RQ-Z+RQ-_+VQ.e-XQ.f-YQ.i-`Q/`.dR0V/a[gOs#v$w*`,p!^!{YZ!U!V!p%a%m%t(R(T(U(a(i*R+R+S+V+]+`+b-X-Y-[-]-`.d.g/a/b0WQ#W[Q#uiS$Ww}Q$e!OW$l!S$a'b*[S$y!Z$uW%Y!n(O+O-WY&U#c#g#j#m+t`&e#s&b)_)a)i,Q-r1hQ&u$YQ&v$[Q&w$^Q'{%[Q(]%kW(m%y(o+e+iQ(q%{Q(z&VQ)e&oS)h&s1fQ)n'OQ)o'PU)w'W)x,[Q*O'ZQ*e'iY*i'l*j,x,y.ZQ*|'}S+Y(Y1gW+k(u+f-d-hW+o(x+q-j-kQ,a*PQ,u*fQ-S*tQ-i+pQ-s,TQ.[,|Q.m-fR.}.]hUOs#s#v$w&b&s(Y)_)a*`,p%Y!zYZ[iw}!O!S!U!V!Z!n!p#c#g#j#m$Y$[$^$a$u%[%a%k%m%t%y%{&V&o'O'P'W'Z'b'i'l'}(O(R(T(U(a(i(o(u(x)i)x*P*R*[*f*j*t+O+R+S+V+]+`+b+e+f+i+p+q+t,Q,T,[,x,y,|-W-X-Y-[-]-`-d-f-h-j-k-r.Z.].d.g/a/b0W1f1g1hQ$QuW%e!t!x1a1kQ%f!uQ%g!vQ%i!yQ%s1`S(X%h1eQ(Z1bQ([1cQ-a+^Q.l-bS/d.j0pR1m1oU$Uv/f1nR)f&q[hOs#v$w*`,pa!}Y#c#g#j#m$^$a+tQ#][Q$ZwR$d}Q%o#OQ%v#SQ%|#WQ'{%YQ(h%rQ(l%wQ(t%}Q(w&OQ+h(qQ-V*|Q.k-aQ/h.lR0Y/gQ$cyQ(d%pR+_(eQ/g.jR0z0pR#VZR#[[R%_!nQ%]!nV*}(O+O-W!]!qQ!s#r$P$b$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)`)k*U+Z+d,h-g0n1dR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-l+tQ)O&WQ)S&ZQ)W&]Q)[&_S+x)P)QS+z)T)US+|)X)YS,O)])^Q-n+yQ-o+{Q-p+}Q-q,PQ.o-lS/i.p.qR0Z/jQ$m!SQ&{$aQ*Z'bR,l*[Q#zmQ$f!PQ$i!QR'T$hQ)p'SR,Y)sQ)p'SQ,X)rR,Y)sR$k!RR)}'YXqOs*`,pQ$s!WR'c$tQ$z!ZR'd$uR*s'pQ*q'pV.^-P._/OQ/_.cQ/|/XR/}/YU/W.c/X/YQ0R/[Q0_/qQ0d/wU0f/y0g0vQ0k0OQ0y0lQ0{0qU0}0r1P1XQ1Y1RQ1^1WR1_1ZR0Q/ZR0a/q\",nodeNames:\"\\u26A0 print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatSelfDoc FormatConversion FormatSpec FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc FormatReplacement FormatSelfDoc ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard\",maxTerm:288,context:Fb,nodeProps:[[\"isolate\",-8,6,73,74,75,79,81,83,85,\"\"],[\"group\",-15,8,93,95,96,98,100,102,104,106,107,108,110,113,116,118,\"Statement Statement\",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,87,88,89,90,\"Expression\",-10,122,124,127,129,130,134,136,141,143,146,\"Statement\",-9,151,152,155,156,158,159,160,161,162,\"Pattern\"],[\"openedBy\",25,\"(\",56,\"[\",60,\"{\"],[\"closedBy\",26,\")\",57,\"]\",61,\"}\"]],propSources:[Kb],skippedNodes:[0,6],repeatNodeCount:38,tokenData:\"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&w!b&oS&rW%u!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&w!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&w!b&oS&rWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!oR&w!b&oS&rWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cDXa&w!b&oS&msOYE^YZ%TZ]E^]^%T^rE^rs!)|swE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cEia&w!b&oS&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxGpx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cFw]&w!b&oS&msOr%Trs'Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#cGya&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxIOx#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#cIXa&w!b&rW&msOYE^YZ%TZ]E^]^%T^rE^rsFnswE^wxJ^x#OE^#O#P!!u#P#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!)v<%lOE^#_Jg_&w!b&rW&msOYJ^YZ1XZ]J^]^1X^rJ^rsKfs#OJ^#O#PL`#P#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`!!o<%lOJ^#_KmZ&w!b&msOr1Xrs2ys#O1X#O#P3q#P#o1X#o#p4`#p#q1X#q#r4`#r;'S1X;'S;=`7i<%lO1X#_LeW&w!bO#oJ^#o#pL}#p#qJ^#q#rL}#r;'SJ^;'S;=`! r;=`<%lL}<%lOJ^{MUZ&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l<%lOL}{M|V&msOr4`rs5ds#O4`#O#P5y#P;'S4`;'S;=`6t<%lO4`{NfRO;'SL};'S;=`No;=`OL}{Nv[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lL}<%lOL}{! oP;=`<%lL}#_! y[&rW&msOYL}YZ4`Z]L}]^4`^rL}rsMws#OL}#O#PNc#P;'SL};'S;=`! l;=`<%lJ^<%lOL}#_!!rP;=`<%lJ^#c!!zW&w!bO#oE^#o#p!#d#p#qE^#q#r!#d#r;'SE^;'S;=`!(q;=`<%l!#d<%lOE^!P!#m]&oS&rW&msOY!#dYZ8^Z]!#d]^8^^r!#drs!$fsw!#dwx!%Yx#O!#d#O#P!'Y#P;'S!#d;'S;=`!(k<%lO!#d!P!$mX&oS&msOr8^rs9rsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`^s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!>e_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!?ds#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!?k_U!T&w!bOY!=UYZ1XZ]!=U]^1X^r!=Urs!3`s#O!=U#O#P!@j#P#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!FQ<%lO!=U#o!@q[U!T&w!bOY!=UYZ1XZ]!=U]^1X^#o!=U#o#p!Ag#p#q!=U#q#r!Ag#r;'S!=U;'S;=`!Ec;=`<%l4`<%lO!=U!]!AnZU!T&rWOY!AgYZ4`Z]!Ag]^4`^r!Agrs!Bas#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!BfZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!CXs#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!C^ZU!TOY!AgYZ4`Z]!Ag]^4`^r!Agrs!4Ys#O!Ag#O#P!DP#P;'S!Ag;'S;=`!E]<%lO!Ag!]!DUWU!TOY!AgYZ4`Z]!Ag]^4`^;'S!Ag;'S;=`!Dn;=`<%l4`<%lO!Ag!]!DsW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&rWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&w!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&oS&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&oSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&rWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&oS&rWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&w!b&oS&rW&l`&XsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Jb[i]||-1}],tokenPrec:7500});var Bm=new zs,Vm=new Set([\"Script\",\"Body\",\"FunctionDefinition\",\"ClassDefinition\",\"LambdaExpression\",\"ForStatement\",\"MatchClause\"]);function Co(i){return(t,e,r)=>{if(r)return!1;let n=t.node.getChild(\"VariableName\");return n&&e(n,i),!0}}var tS={FunctionDefinition:Co(\"function\"),ClassDefinition:Co(\"class\"),ForStatement(i,t,e){if(e){for(let r=i.node.firstChild;r;r=r.nextSibling)if(r.name==\"VariableName\")t(r,\"variable\");else if(r.name==\"in\")break}},ImportStatement(i,t){var e,r;let{node:n}=i,s=((e=n.firstChild)===null||e===void 0?void 0:e.name)==\"from\";for(let o=n.getChild(\"import\");o;o=o.nextSibling)o.name==\"VariableName\"&&((r=o.nextSibling)===null||r===void 0?void 0:r.name)!=\"as\"&&t(o,s?\"variable\":\"namespace\")},AssignStatement(i,t){for(let e=i.node.firstChild;e;e=e.nextSibling)if(e.name==\"VariableName\")t(e,\"variable\");else if(e.name==\":\"||e.name==\"AssignOp\")break},ParamList(i,t){for(let e=null,r=i.node.firstChild;r;r=r.nextSibling)r.name==\"VariableName\"&&(!e||!/\\*|AssignOp/.test(e.name))&&t(r,\"variable\"),e=r},CapturePattern:Co(\"variable\"),AsPattern:Co(\"variable\"),__proto__:null};function Wm(i,t){let e=Bm.get(t);if(e)return e;let r=[],n=!0;function s(o,l){let a=i.sliceString(o.from,o.to);r.push({label:a,type:l})}return t.cursor(st.IncludeAnonymous).iterate(o=>{if(o.name){let l=tS[o.name];if(l&&l(o,s,n)||!n&&Vm.has(o.name))return!1;n=!1}else if(o.to-o.from>8192){for(let l of Wm(i,o.node))r.push(l);return!1}}),Bm.set(t,r),r}var Xm=/^[\\w\\xa1-\\uffff][\\w\\d\\xa1-\\uffff]*$/,Im=[\"String\",\"FormatString\",\"Comment\",\"PropertyName\"];function eS(i){let t=pt(i.state).resolveInner(i.pos,-1);if(Im.indexOf(t.name)>-1)return null;let e=t.name==\"VariableName\"||t.to-t.from<20&&Xm.test(i.state.sliceDoc(t.from,t.to));if(!e&&!i.explicit)return null;let r=[];for(let n=t;n;n=n.parent)Vm.has(n.name)&&(r=r.concat(Wm(i.state.doc,n)));return{options:r,from:e?t.from:i.pos,validFor:Xm}}var iS=[\"__annotations__\",\"__builtins__\",\"__debug__\",\"__doc__\",\"__import__\",\"__name__\",\"__loader__\",\"__package__\",\"__spec__\",\"False\",\"None\",\"True\"].map(i=>({label:i,type:\"constant\"})).concat([\"ArithmeticError\",\"AssertionError\",\"AttributeError\",\"BaseException\",\"BlockingIOError\",\"BrokenPipeError\",\"BufferError\",\"BytesWarning\",\"ChildProcessError\",\"ConnectionAbortedError\",\"ConnectionError\",\"ConnectionRefusedError\",\"ConnectionResetError\",\"DeprecationWarning\",\"EOFError\",\"Ellipsis\",\"EncodingWarning\",\"EnvironmentError\",\"Exception\",\"FileExistsError\",\"FileNotFoundError\",\"FloatingPointError\",\"FutureWarning\",\"GeneratorExit\",\"IOError\",\"ImportError\",\"ImportWarning\",\"IndentationError\",\"IndexError\",\"InterruptedError\",\"IsADirectoryError\",\"KeyError\",\"KeyboardInterrupt\",\"LookupError\",\"MemoryError\",\"ModuleNotFoundError\",\"NameError\",\"NotADirectoryError\",\"NotImplemented\",\"NotImplementedError\",\"OSError\",\"OverflowError\",\"PendingDeprecationWarning\",\"PermissionError\",\"ProcessLookupError\",\"RecursionError\",\"ReferenceError\",\"ResourceWarning\",\"RuntimeError\",\"RuntimeWarning\",\"StopAsyncIteration\",\"StopIteration\",\"SyntaxError\",\"SyntaxWarning\",\"SystemError\",\"SystemExit\",\"TabError\",\"TimeoutError\",\"TypeError\",\"UnboundLocalError\",\"UnicodeDecodeError\",\"UnicodeEncodeError\",\"UnicodeError\",\"UnicodeTranslateError\",\"UnicodeWarning\",\"UserWarning\",\"ValueError\",\"Warning\",\"ZeroDivisionError\"].map(i=>({label:i,type:\"type\"}))).concat([\"bool\",\"bytearray\",\"bytes\",\"classmethod\",\"complex\",\"float\",\"frozenset\",\"int\",\"list\",\"map\",\"memoryview\",\"object\",\"range\",\"set\",\"staticmethod\",\"str\",\"super\",\"tuple\",\"type\"].map(i=>({label:i,type:\"class\"}))).concat([\"abs\",\"aiter\",\"all\",\"anext\",\"any\",\"ascii\",\"bin\",\"breakpoint\",\"callable\",\"chr\",\"compile\",\"delattr\",\"dict\",\"dir\",\"divmod\",\"enumerate\",\"eval\",\"exec\",\"exit\",\"filter\",\"format\",\"getattr\",\"globals\",\"hasattr\",\"hash\",\"help\",\"hex\",\"id\",\"input\",\"isinstance\",\"issubclass\",\"iter\",\"len\",\"license\",\"locals\",\"max\",\"min\",\"next\",\"oct\",\"open\",\"ord\",\"pow\",\"print\",\"property\",\"quit\",\"repr\",\"reversed\",\"round\",\"setattr\",\"slice\",\"sorted\",\"sum\",\"vars\",\"zip\"].map(i=>({label:i,type:\"function\"}))),rS=[Pe(\"def ${name}(${params}):\\n\t${}\",{label:\"def\",detail:\"function\",type:\"keyword\"}),Pe(\"for ${name} in ${collection}:\\n\t${}\",{label:\"for\",detail:\"loop\",type:\"keyword\"}),Pe(\"while ${}:\\n\t${}\",{label:\"while\",detail:\"loop\",type:\"keyword\"}),Pe(\"try:\\n\t${}\\nexcept ${error}:\\n\t${}\",{label:\"try\",detail:\"/ except block\",type:\"keyword\"}),Pe(`if \\${}:\n\t\n`,{label:\"if\",detail:\"block\",type:\"keyword\"}),Pe(\"if ${}:\\n\t${}\\nelse:\\n\t${}\",{label:\"if\",detail:\"/ else block\",type:\"keyword\"}),Pe(\"class ${name}:\\n\tdef __init__(self, ${params}):\\n\t\t\t${}\",{label:\"class\",detail:\"definition\",type:\"keyword\"}),Pe(\"import ${module}\",{label:\"import\",detail:\"statement\",type:\"keyword\"}),Pe(\"from ${module} import ${names}\",{label:\"from\",detail:\"import\",type:\"keyword\"})],nS=Ap(Im,wh(iS.concat(rS)));function Lm(i,t){let e=i.baseIndentFor(t),r=i.lineAt(i.pos,-1),n=r.from+r.text.length;return/^\\s*($|#)/.test(r.text)&&i.node.toe?null:e+i.unit}var Gh=Us.define({name:\"python\",parser:Dm.configure({props:[lh.add({Body:i=>{var t;return(t=Lm(i,i.node))!==null&&t!==void 0?t:i.continue()},IfStatement:i=>/^\\s*(else:|elif )/.test(i.textAfter)?i.baseIndent:i.continue(),TryStatement:i=>/^\\s*(except |finally:|else:)/.test(i.textAfter)?i.baseIndent:i.continue(),\"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression\":Ks({closing:\")\"}),\"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression\":Ks({closing:\"}\"}),\"ArrayExpression ArrayComprehensionExpression\":Ks({closing:\"]\"}),\"String FormatString\":()=>null,Script:i=>{if(i.pos+/\\s*/.exec(i.textAfter)[0].length>=i.node.to){let t=null;for(let e=i.node,r=e.to;e=e.lastChild,!(!e||e.to!=r);)e.type.name==\"Body\"&&(t=e);if(t){let e=Lm(i,t);if(e!=null)return e}}return i.continue()}}),ah.add({\"ArrayExpression DictionaryExpression SetExpression TupleExpression\":ap,Body:(i,t)=>({from:i.from+1,to:i.to-(i.to==t.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:[\"(\",\"[\",\"{\",\"'\",'\"',\"'''\",'\"\"\"'],stringPrefixes:[\"f\",\"fr\",\"rf\",\"r\",\"u\",\"b\",\"br\",\"rb\",\"F\",\"FR\",\"RF\",\"R\",\"U\",\"B\",\"BR\",\"RB\"]},commentTokens:{line:\"#\"},indentOnInput:/^\\s*([\\}\\]\\)]|else:|elif |except |finally:)$/}});function Hh(){return new js(Gh,[Gh.data.of({autocomplete:eS}),Gh.data.of({autocomplete:nS})])}function z(){var i=arguments[0];typeof i==\"string\"&&(i=document.createElement(i));var t=1,e=arguments[1];if(e&&typeof e==\"object\"&&e.nodeType==null&&!Array.isArray(e)){for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];typeof n==\"string\"?i.setAttribute(r,n):n!=null&&(i[r]=n)}t++}for(;tl.from==l.to||l.from==l.to-1&&r.doc.lineAt(l.from).to==l.from?R.widget({widget:new jh(l),diagnostic:l}).range(l.from):R.mark({attributes:{class:\"cm-lintRange cm-lintRange-\"+l.severity+(l.markClass?\" \"+l.markClass:\"\")},diagnostic:l,inclusive:!0}).range(l.from,l.to)),!0);return new i(o,e,tr(o))}};function tr(i,t=null,e=0){let r=null;return i.between(e,1e9,(n,s,{spec:o})=>{if(!(t&&o.diagnostic!=t))return r=new Uh(n,s,o.diagnostic),!1}),r}function sS(i,t){let e=i.startState.doc.lineAt(t.pos);return!!(i.effects.some(r=>r.is(zm))||i.changes.touchesRange(e.from,e.to))}function oS(i,t){return i.field(Yt,!1)?t:t.concat(M.appendConfig.of(pS))}var zm=M.define(),Kh=M.define(),Zm=M.define(),Yt=it.define({create(){return new bi(R.none,null,null)},update(i,t){if(t.docChanged){let e=i.diagnostics.map(t.changes),r=null;if(i.selected){let n=t.changes.mapPos(i.selected.from,1);r=tr(e,i.selected.diagnostic,n)||tr(e,null,n)}i=new bi(e,i.panel,r)}for(let e of t.effects)e.is(zm)?i=bi.init(e.value,i.panel,t.state):e.is(Kh)?i=new bi(i.diagnostics,e.value?Ro.open:null,i.selected):e.is(Zm)&&(i=new bi(i.diagnostics,i.panel,e.value));return i},provide:i=>[fi.from(i,t=>t.panel),T.decorations.from(i,t=>t.diagnostics)]});var lS=R.mark({class:\"cm-lintRange cm-lintRange-active\",inclusive:!0});function aS(i,t,e){let{diagnostics:r}=i.state.field(Yt),n=[],s=2e8,o=0;r.between(t-(e<0?1:0),t+(e>0?1:0),(a,h,{spec:f})=>{t>=a&&t<=h&&(a==h||(t>a||e>0)&&(tGm(i,e,!1)))}var fS=i=>{let t=i.state.field(Yt,!1);(!t||!t.panel)&&i.dispatch({effects:oS(i.state,[Kh.of(!0)])});let e=ci(i,Ro.open);return e&&e.dom.querySelector(\".cm-panel-lint ul\").focus(),!0},Ym=i=>{let t=i.state.field(Yt,!1);return!t||!t.panel?!1:(i.dispatch({effects:Kh.of(!1)}),!0)},cS=i=>{let t=i.state.field(Yt,!1);if(!t)return!1;let e=i.state.selection.main,r=t.diagnostics.iter(e.to+1);return!r.value&&(r=t.diagnostics.iter(0),!r.value||r.from==e.from&&r.to==e.to)?!1:(i.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)};var Mo=[{key:\"Mod-Shift-m\",run:fS,preventDefault:!0},{key:\"F8\",run:cS}];var Fm=A.define({combine(i){return Object.assign({sources:i.map(t=>t.source).filter(t=>t!=null)},kt(i.map(t=>t.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null},{needsRefresh:(t,e)=>t?e?r=>t(r)||e(r):t:e}))}});function _m(i){let t=[];if(i)t:for(let{name:e}of i){for(let r=0;rs.toLowerCase()==n.toLowerCase())){t.push(n);continue t}}t.push(\"\")}return t}function Gm(i,t,e){var r;let n=e?_m(t.actions):[];return z(\"li\",{class:\"cm-diagnostic cm-diagnostic-\"+t.severity},z(\"span\",{class:\"cm-diagnosticText\"},t.renderMessage?t.renderMessage():t.message),(r=t.actions)===null||r===void 0?void 0:r.map((s,o)=>{let l=!1,a=u=>{if(u.preventDefault(),l)return;l=!0;let d=tr(i.state.field(Yt).diagnostics,t);d&&s.apply(i,d.from,d.to)},{name:h}=s,f=n[o]?h.indexOf(n[o]):-1,c=f<0?h:[h.slice(0,f),z(\"u\",h.slice(f,f+1)),h.slice(f+1)];return z(\"button\",{type:\"button\",class:\"cm-diagnosticAction\",onclick:a,onmousedown:a,\"aria-label\":` Action: ${h}${f<0?\"\":` (access key \"${n[o]})\"`}.`},c)}),t.source&&z(\"div\",{class:\"cm-diagnosticSource\"},t.source))}var jh=class extends Ut{constructor(t){super(),this.diagnostic=t}eq(t){return t.diagnostic==this.diagnostic}toDOM(){return z(\"span\",{class:\"cm-lintPoint cm-lintPoint-\"+this.diagnostic.severity})}},Qo=class{constructor(t,e){this.diagnostic=e,this.id=\"item_\"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Gm(t,e,!0),this.dom.id=this.id,this.dom.setAttribute(\"role\",\"option\")}},Ro=class i{constructor(t){this.view=t,this.items=[];let e=n=>{if(n.keyCode==27)Ym(this.view),this.view.focus();else if(n.keyCode==38||n.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(n.keyCode==40||n.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(n.keyCode==36)this.moveSelection(0);else if(n.keyCode==35)this.moveSelection(this.items.length-1);else if(n.keyCode==13)this.view.focus();else if(n.keyCode>=65&&n.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=_m(s.actions);for(let l=0;l{for(let s=0;sYm(this.view)},\"\\xD7\")),this.update()}get selectedIndex(){let t=this.view.state.field(Yt).selected;if(!t)return-1;for(let e=0;e{let h=-1,f;for(let c=r;cr&&(this.items.splice(r,h-r),n=!0)),e&&f.diagnostic==e.diagnostic?f.dom.hasAttribute(\"aria-selected\")||(f.dom.setAttribute(\"aria-selected\",\"true\"),s=f):f.dom.hasAttribute(\"aria-selected\")&&f.dom.removeAttribute(\"aria-selected\"),r++});r({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:l})=>{let a=l.height/this.list.offsetHeight;o.topl.bottom&&(this.list.scrollTop+=(o.bottom-l.bottom)/a)}})):this.selectedIndex<0&&this.list.removeAttribute(\"aria-activedescendant\"),n&&this.sync()}sync(){let t=this.list.firstChild;function e(){let r=t;t=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;t!=r.dom;)e();t=r.dom.nextSibling}else this.list.insertBefore(r.dom,t);for(;t;)e()}moveSelection(t){if(this.selectedIndex<0)return;let e=this.view.state.field(Yt),r=tr(e.diagnostics,this.items[t].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Zm.of(r)})}static open(t){return new i(t)}};function uS(i,t='viewBox=\"0 0 40 40\"'){return`url('data:image/svg+xml,${encodeURIComponent(i)}')`}function Ao(i){return uS(``,'width=\"6\" height=\"3\"')}var dS=T.baseTheme({\".cm-diagnostic\":{padding:\"3px 6px 3px 8px\",marginLeft:\"-1px\",display:\"block\",whiteSpace:\"pre-wrap\"},\".cm-diagnostic-error\":{borderLeft:\"5px solid #d11\"},\".cm-diagnostic-warning\":{borderLeft:\"5px solid orange\"},\".cm-diagnostic-info\":{borderLeft:\"5px solid #999\"},\".cm-diagnostic-hint\":{borderLeft:\"5px solid #66d\"},\".cm-diagnosticAction\":{font:\"inherit\",border:\"none\",padding:\"2px 4px\",backgroundColor:\"#444\",color:\"white\",borderRadius:\"3px\",marginLeft:\"8px\",cursor:\"pointer\"},\".cm-diagnosticSource\":{fontSize:\"70%\",opacity:.7},\".cm-lintRange\":{backgroundPosition:\"left bottom\",backgroundRepeat:\"repeat-x\",paddingBottom:\"0.7px\"},\".cm-lintRange-error\":{backgroundImage:Ao(\"#d11\")},\".cm-lintRange-warning\":{backgroundImage:Ao(\"orange\")},\".cm-lintRange-info\":{backgroundImage:Ao(\"#999\")},\".cm-lintRange-hint\":{backgroundImage:Ao(\"#66d\")},\".cm-lintRange-active\":{backgroundColor:\"#ffdd9980\"},\".cm-tooltip-lint\":{padding:0,margin:0},\".cm-lintPoint\":{position:\"relative\",\"&:after\":{content:'\"\"',position:\"absolute\",bottom:0,left:\"-2px\",borderLeft:\"3px solid transparent\",borderRight:\"3px solid transparent\",borderBottom:\"4px solid #d11\"}},\".cm-lintPoint-warning\":{\"&:after\":{borderBottomColor:\"orange\"}},\".cm-lintPoint-info\":{\"&:after\":{borderBottomColor:\"#999\"}},\".cm-lintPoint-hint\":{\"&:after\":{borderBottomColor:\"#66d\"}},\".cm-panel.cm-panel-lint\":{position:\"relative\",\"& ul\":{maxHeight:\"100px\",overflowY:\"auto\",\"& [aria-selected]\":{backgroundColor:\"#ddd\",\"& u\":{textDecoration:\"underline\"}},\"&:focus [aria-selected]\":{background_fallback:\"#bdf\",backgroundColor:\"Highlight\",color_fallback:\"white\",color:\"HighlightText\"},\"& u\":{textDecoration:\"none\"},padding:0,margin:0},\"& [name=close]\":{position:\"absolute\",top:\"0\",right:\"2px\",background:\"inherit\",border:\"none\",font:\"inherit\",padding:0,margin:0}}});var pS=[Yt,T.decorations.compute([Yt],i=>{let{selected:t,panel:e}=i.field(Yt);return!t||!e||t.from==t.to?R.none:R.set([lS.range(t.from,t.to)])}),Id(aS,{hideOn:sS}),dS];var Hm=typeof String.prototype.normalize==\"function\"?i=>i.normalize(\"NFKD\"):i=>i,ti=class{constructor(t,e,r=0,n=t.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=\"\",this.bufferPos=0,this.iter=t.iterRange(r,n),this.bufferStart=r,this.normalize=s?l=>s(Hm(l)):Hm,this.query=this.normalize(e)}peek(){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 dt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let e=vr(t),r=this.bufferStart+this.bufferPos;this.bufferPos+=wt(t);let n=this.normalize(e);for(let s=0,o=r;;s++){let l=n.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==n.length-1){if(a)return this.value=a,this;break}o==r&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=\"\":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let e=this.matchPos<=this.to&&this.re.exec(this.curLine);if(e){let r=this.curLineStart+e.index,n=r+e[0].length;if(this.matchPos=Xo(this.text,n+(r==n?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||n.to<=e){let l=new i(e,t.sliceString(e,r));return Jh.set(t,l),l}if(n.from==e&&n.to==r)return n;let{text:s,from:o}=n;return o>e&&(s=t.sliceString(e,o)+s,o=e),n.to=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,e=this.re.exec(this.flat.text);if(e&&!e[0]&&e.index==t&&(this.re.lastIndex=t+1,e=this.re.exec(this.flat.text)),e){let r=this.flat.from+e.index,n=r+e[0].length;if((this.flat.to>=this.to||e.index+e[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,n,e)))return this.value={from:r,to:n,match:e},this.matchPos=Xo(this.text,n+(r==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Do.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<\"u\"&&(qo.prototype[Symbol.iterator]=Bo.prototype[Symbol.iterator]=function(){return this});function mS(i){try{return new RegExp(i,of),!0}catch{return!1}}function Xo(i,t){if(t>=i.length)return t;let e=i.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}function tf(i){let t=String(i.state.doc.lineAt(i.state.selection.main.head).number),e=z(\"input\",{class:\"cm-textfield\",name:\"line\",value:t}),r=z(\"form\",{class:\"cm-gotoLine\",onkeydown:s=>{s.keyCode==27?(s.preventDefault(),i.dispatch({effects:Lo.of(!1)}),i.focus()):s.keyCode==13&&(s.preventDefault(),n())},onsubmit:s=>{s.preventDefault(),n()}},z(\"label\",i.state.phrase(\"Go to line\"),\": \",e),\" \",z(\"button\",{class:\"cm-button\",type:\"submit\"},i.state.phrase(\"go\")));function n(){let s=/^([+-])?(\\d+)?(:\\d+)?(%)?$/.exec(e.value);if(!s)return;let{state:o}=i,l=o.doc.lineAt(o.selection.main.head),[,a,h,f,c]=s,u=f?+f.slice(1):0,d=h?+h:l.number;if(h&&c){let g=d/100;a&&(g=g*(a==\"-\"?-1:1)+l.number/o.doc.lines),d=Math.round(o.doc.lines*g)}else h&&a&&(d=d*(a==\"-\"?-1:1)+l.number);let m=o.doc.line(Math.max(1,Math.min(o.doc.lines,d))),O=b.cursor(m.from+Math.max(0,Math.min(u,m.length)));i.dispatch({effects:[Lo.of(!1),T.scrollIntoView(O.from,{y:\"center\"})],selection:O}),i.focus()}return{dom:r}}var Lo=M.define(),Um=it.define({create(){return!0},update(i,t){for(let e of t.effects)e.is(Lo)&&(i=e.value);return i},provide:i=>fi.from(i,t=>t?tf:null)}),gS=i=>{let t=ci(i,tf);if(!t){let e=[Lo.of(!0)];i.state.field(Um,!1)==null&&e.push(M.appendConfig.of([Um,OS])),i.dispatch({effects:e}),t=ci(i,tf)}return t&&t.dom.querySelector(\"input\").select(),!0},OS=T.baseTheme({\".cm-panel.cm-gotoLine\":{padding:\"2px 6px 4px\",\"& label\":{fontSize:\"80%\"}}}),xS={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},tg=A.define({combine(i){return kt(i,xS,{highlightWordAroundCursor:(t,e)=>t||e,minSelectionLength:Math.min,maxMatches:Math.min})}});function eg(i){let t=[vS,wS];return i&&t.push(tg.of(i)),t}var yS=R.mark({class:\"cm-selectionMatch\"}),bS=R.mark({class:\"cm-selectionMatch cm-selectionMatch-main\"});function jm(i,t,e,r){return(e==0||i(t.sliceDoc(e-1,e))!=F.Word)&&(r==t.doc.length||i(t.sliceDoc(r,r+1))!=F.Word)}function SS(i,t,e,r){return i(t.sliceDoc(e,e+1))==F.Word&&i(t.sliceDoc(r-1,r))==F.Word}var wS=ft.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.selectionSet||i.docChanged||i.viewportChanged)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let t=i.state.facet(tg),{state:e}=i,r=e.selection;if(r.ranges.length>1)return R.none;let n=r.main,s,o=null;if(n.empty){if(!t.highlightWordAroundCursor)return R.none;let a=e.wordAt(n.head);if(!a)return R.none;o=e.charCategorizer(n.head),s=e.sliceDoc(a.from,a.to)}else{let a=n.to-n.from;if(a200)return R.none;if(t.wholeWords){if(s=e.sliceDoc(n.from,n.to),o=e.charCategorizer(n.head),!(jm(o,e,n.from,n.to)&&SS(o,e,n.from,n.to)))return R.none}else if(s=e.sliceDoc(n.from,n.to),!s)return R.none}let l=[];for(let a of i.visibleRanges){let h=new ti(e.doc,s,a.from,a.to);for(;!h.next().done;){let{from:f,to:c}=h.value;if((!o||jm(o,e,f,c))&&(n.empty&&f<=n.from&&c>=n.to?l.push(bS.range(f,c)):(f>=n.to||c<=n.from)&&l.push(yS.range(f,c)),l.length>t.maxMatches))return R.none}}return R.set(l)}},{decorations:i=>i.decorations}),vS=T.baseTheme({\".cm-selectionMatch\":{backgroundColor:\"#99ff7780\"},\".cm-searchMatch .cm-selectionMatch\":{backgroundColor:\"transparent\"}}),kS=({state:i,dispatch:t})=>{let{selection:e}=i,r=b.create(e.ranges.map(n=>i.wordAt(n.head)||b.cursor(n.head)),e.mainIndex);return r.eq(e)?!1:(t(i.update({selection:r})),!0)};function TS(i,t){let{main:e,ranges:r}=i.selection,n=i.wordAt(e.head),s=n&&n.from==e.from&&n.to==e.to;for(let o=!1,l=new ti(i.doc,t,r[r.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new ti(i.doc,t,0,Math.max(0,r[r.length-1].from-1)),o=!0}else{if(o&&r.some(a=>a.from==l.value.from))continue;if(s){let a=i.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}var PS=({state:i,dispatch:t})=>{let{ranges:e}=i.selection;if(e.some(s=>s.from===s.to))return kS({state:i,dispatch:t});let r=i.sliceDoc(e[0].from,e[0].to);if(i.selection.ranges.some(s=>i.sliceDoc(s.from,s.to)!=r))return!1;let n=TS(i,r);return n?(t(i.update({selection:i.selection.addRange(b.range(n.from,n.to),!1),effects:T.scrollIntoView(n.to)})),!0):!1},rr=A.define({combine(i){return kt(i,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new sf(t),scrollToMatch:t=>T.scrollIntoView(t)})}});var Vo=class{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||\"\",this.valid=!!this.search&&(!this.regexp||mS(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\\\([nrt\\\\])/g,(e,r)=>r==\"n\"?`\n`:r==\"r\"?\"\\r\":r==\"t\"?\"\t\":\"\\\\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new rf(this):new ef(this)}getCursor(t,e=0,r){let n=t.doc?t:Y.create({doc:t});return r==null&&(r=n.doc.length),this.regexp?ir(this,n,e,r):er(this,n,e,r)}},Wo=class{constructor(t){this.spec=t}};function er(i,t,e,r){return new ti(t.doc,i.unquoted,e,r,i.caseSensitive?void 0:n=>n.toLowerCase(),i.wholeWord?CS(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function CS(i,t){return(e,r,n,s)=>((s>e||s+n.length=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=er(this.spec,t,Math.max(0,e-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}};function ir(i,t,e,r){return new qo(t.doc,i.search,{ignoreCase:!i.caseSensitive,test:i.wholeWord?AS(t.charCategorizer(t.selection.main.head)):void 0},e,r)}function Io(i,t){return i.slice(at(i,t,!1),t)}function No(i,t){return i.slice(t,at(i,t))}function AS(i){return(t,e,r)=>!r[0].length||(i(Io(r.input,r.index))!=F.Word||i(No(r.input,r.index))!=F.Word)&&(i(No(r.input,r.index+r[0].length))!=F.Word||i(Io(r.input,r.index+r[0].length))!=F.Word)}var rf=class extends Wo{nextMatch(t,e,r){let n=ir(this.spec,t,r,t.doc.length).next();return n.done&&(n=ir(this.spec,t,0,e).next()),n.done?null:n.value}prevMatchInRange(t,e,r){for(let n=1;;n++){let s=Math.max(e,r-n*1e4),o=ir(this.spec,t,s,r),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==e||l.from>s+10))return l;if(s==e)return null}}prevMatch(t,e,r){return this.prevMatchInRange(t,0,e)||this.prevMatchInRange(t,r,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\\$([$&\\d+])/g,(e,r)=>r==\"$\"?\"$\":r==\"&\"?t.match[0]:r!=\"0\"&&+r=e)return null;n.push(r.value)}return n}highlight(t,e,r,n){let s=ir(this.spec,t,Math.max(0,e-250),Math.min(r+250,t.doc.length));for(;!s.next().done;)n(s.value.from,s.value.to)}},gn=M.define(),lf=M.define(),Je=it.define({create(i){return new mn(nf(i).create(),null)},update(i,t){for(let e of t.effects)e.is(gn)?i=new mn(e.value.create(),i.panel):e.is(lf)&&(i=new mn(i.query,e.value?af:null));return i},provide:i=>fi.from(i,t=>t.panel)});var mn=class{constructor(t,e){this.query=t,this.panel=e}},QS=R.mark({class:\"cm-searchMatch\"}),RS=R.mark({class:\"cm-searchMatch cm-searchMatch-selected\"}),MS=ft.fromClass(class{constructor(i){this.view=i,this.decorations=this.highlight(i.state.field(Je))}update(i){let t=i.state.field(Je);(t!=i.startState.field(Je)||i.docChanged||i.selectionSet||i.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:i,panel:t}){if(!t||!i.spec.valid)return R.none;let{view:e}=this,r=new Ee;for(let n=0,s=e.visibleRanges,o=s.length;ns[n+1].from-2*250;)a=s[++n].to;i.highlight(e.state,l,a,(h,f)=>{let c=e.state.selection.ranges.some(u=>u.from==h&&u.to==f);r.add(h,f,c?RS:QS)})}return r.finish()}},{decorations:i=>i.decorations});function On(i){return t=>{let e=t.state.field(Je,!1);return e&&e.query.spec.valid?i(t,e):ng(t)}}var Yo=On((i,{query:t})=>{let{to:e}=i.state.selection.main,r=t.nextMatch(i.state,e,e);if(!r)return!1;let n=b.single(r.from,r.to),s=i.state.facet(rr);return i.dispatch({selection:n,effects:[hf(i,r),s.scrollToMatch(n.main,i)],userEvent:\"select.search\"}),rg(i),!0}),zo=On((i,{query:t})=>{let{state:e}=i,{from:r}=e.selection.main,n=t.prevMatch(e,r,r);if(!n)return!1;let s=b.single(n.from,n.to),o=i.state.facet(rr);return i.dispatch({selection:s,effects:[hf(i,n),o.scrollToMatch(s.main,i)],userEvent:\"select.search\"}),rg(i),!0}),ES=On((i,{query:t})=>{let e=t.matchAll(i.state,1e3);return!e||!e.length?!1:(i.dispatch({selection:b.create(e.map(r=>b.range(r.from,r.to))),userEvent:\"select.search.matches\"}),!0)}),$S=({state:i,dispatch:t})=>{let e=i.selection;if(e.ranges.length>1||e.main.empty)return!1;let{from:r,to:n}=e.main,s=[],o=0;for(let l=new ti(i.doc,i.sliceDoc(r,n));!l.next().done;){if(s.length>1e3)return!1;l.value.from==r&&(o=s.length),s.push(b.range(l.value.from,l.value.to))}return t(i.update({selection:b.create(s,o),userEvent:\"select.search.matches\"})),!0},Km=On((i,{query:t})=>{let{state:e}=i,{from:r,to:n}=e.selection.main;if(e.readOnly)return!1;let s=t.nextMatch(e,r,r);if(!s)return!1;let o=[],l,a,h=[];if(s.from==r&&s.to==n&&(a=e.toText(t.getReplacement(s)),o.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(e,s.from,s.to),h.push(T.announce.of(e.phrase(\"replaced match on line $\",e.doc.lineAt(r).number)+\".\"))),s){let f=o.length==0||o[0].from>=s.to?0:s.to-s.from-a.length;l=b.single(s.from-f,s.to-f),h.push(hf(i,s)),h.push(e.facet(rr).scrollToMatch(l.main,i))}return i.dispatch({changes:o,selection:l,effects:h,userEvent:\"input.replace\"}),!0}),qS=On((i,{query:t})=>{if(i.state.readOnly)return!1;let e=t.matchAll(i.state,1e9).map(n=>{let{from:s,to:o}=n;return{from:s,to:o,insert:t.getReplacement(n)}});if(!e.length)return!1;let r=i.state.phrase(\"replaced $ matches\",e.length)+\".\";return i.dispatch({changes:e,effects:T.announce.of(r),userEvent:\"input.replace.all\"}),!0});function af(i){return i.state.facet(rr).createPanel(i)}function nf(i,t){var e,r,n,s,o;let l=i.selection.main,a=l.empty||l.to>l.from+100?\"\":i.sliceDoc(l.from,l.to);if(t&&!a)return t;let h=i.facet(rr);return new Vo({search:((e=t?.literal)!==null&&e!==void 0?e:h.literal)?a:a.replace(/\\n/g,\"\\\\n\"),caseSensitive:(r=t?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(n=t?.literal)!==null&&n!==void 0?n:h.literal,regexp:(s=t?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=t?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function ig(i){let t=ci(i,af);return t&&t.dom.querySelector(\"[main-field]\")}function rg(i){let t=ig(i);t&&t==i.root.activeElement&&t.select()}var ng=i=>{let t=i.state.field(Je,!1);if(t&&t.panel){let e=ig(i);if(e&&e!=i.root.activeElement){let r=nf(i.state,t.query.spec);r.valid&&i.dispatch({effects:gn.of(r)}),e.focus(),e.select()}}else i.dispatch({effects:[lf.of(!0),t?gn.of(nf(i.state,t.query.spec)):M.appendConfig.of(BS)]});return!0},sg=i=>{let t=i.state.field(Je,!1);if(!t||!t.panel)return!1;let e=ci(i,af);return e&&e.dom.contains(i.root.activeElement)&&i.focus(),i.dispatch({effects:lf.of(!1)}),!0},Zo=[{key:\"Mod-f\",run:ng,scope:\"editor search-panel\"},{key:\"F3\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Mod-g\",run:Yo,shift:zo,scope:\"editor search-panel\",preventDefault:!0},{key:\"Escape\",run:sg,scope:\"editor search-panel\"},{key:\"Mod-Shift-l\",run:$S},{key:\"Mod-Alt-g\",run:gS},{key:\"Mod-d\",run:PS,preventDefault:!0}],sf=class{constructor(t){this.view=t;let e=this.query=t.state.field(Je).query.spec;this.commit=this.commit.bind(this),this.searchField=z(\"input\",{value:e.search,placeholder:zt(t,\"Find\"),\"aria-label\":zt(t,\"Find\"),class:\"cm-textfield\",name:\"search\",form:\"\",\"main-field\":\"true\",onchange:this.commit,onkeyup:this.commit}),this.replaceField=z(\"input\",{value:e.replace,placeholder:zt(t,\"Replace\"),\"aria-label\":zt(t,\"Replace\"),class:\"cm-textfield\",name:\"replace\",form:\"\",onchange:this.commit,onkeyup:this.commit}),this.caseField=z(\"input\",{type:\"checkbox\",name:\"case\",form:\"\",checked:e.caseSensitive,onchange:this.commit}),this.reField=z(\"input\",{type:\"checkbox\",name:\"re\",form:\"\",checked:e.regexp,onchange:this.commit}),this.wordField=z(\"input\",{type:\"checkbox\",name:\"word\",form:\"\",checked:e.wholeWord,onchange:this.commit});function r(n,s,o){return z(\"button\",{class:\"cm-button\",name:n,onclick:s,type:\"button\"},o)}this.dom=z(\"div\",{onkeydown:n=>this.keydown(n),class:\"cm-search\"},[this.searchField,r(\"next\",()=>Yo(t),[zt(t,\"next\")]),r(\"prev\",()=>zo(t),[zt(t,\"previous\")]),r(\"select\",()=>ES(t),[zt(t,\"all\")]),z(\"label\",null,[this.caseField,zt(t,\"match case\")]),z(\"label\",null,[this.reField,zt(t,\"regexp\")]),z(\"label\",null,[this.wordField,zt(t,\"by word\")]),...t.state.readOnly?[]:[z(\"br\"),this.replaceField,r(\"replace\",()=>Km(t),[zt(t,\"replace\")]),r(\"replaceAll\",()=>qS(t),[zt(t,\"replace all\")])],z(\"button\",{name:\"close\",onclick:()=>sg(t),\"aria-label\":zt(t,\"close\"),type:\"button\"},[\"\\xD7\"])])}commit(){let t=new Vo({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:gn.of(t)}))}keydown(t){qd(this.view,t,\"search-panel\")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?zo:Yo)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Km(this.view))}update(t){for(let e of t.transactions)for(let r of e.effects)r.is(gn)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(rr).top}};function zt(i,t){return i.state.phrase(t)}var Eo=30,$o=/[\\s\\.,:;?!]/;function hf(i,{from:t,to:e}){let r=i.state.doc.lineAt(t),n=i.state.doc.lineAt(e).to,s=Math.max(r.from,t-Eo),o=Math.min(n,e+Eo),l=i.state.sliceDoc(s,o);if(s!=r.from){for(let a=0;al.length-Eo;a--)if(!$o.test(l[a-1])&&$o.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${i.state.phrase(\"current match\")}. ${l} ${i.state.phrase(\"on line\")} ${r.number}.`)}var DS=T.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\"}}),BS=[Je,ie.low(MS),DS];var fc={};uO(fc,{VERSION:()=>Fo,after:()=>_f,all:()=>cl,allKeys:()=>he,any:()=>ul,assign:()=>ki,before:()=>qn,bind:()=>sl,bindAll:()=>Eg,chain:()=>Wf,chunk:()=>hc,clone:()=>Rf,collect:()=>Dt,compact:()=>nc,compose:()=>Ff,constant:()=>wn,contains:()=>Qt,countBy:()=>Lg,create:()=>Qf,debounce:()=>zf,default:()=>zg,defaults:()=>il,defer:()=>ll,delay:()=>ol,detect:()=>ur,difference:()=>pl,drop:()=>Ri,each:()=>xt,escape:()=>Ag,every:()=>cl,extend:()=>el,extendOwn:()=>ki,filter:()=>te,find:()=>ur,findIndex:()=>cr,findKey:()=>Dn,findLastIndex:()=>al,findWhere:()=>Gf,first:()=>zn,flatten:()=>sc,foldl:()=>fl,foldr:()=>Hf,forEach:()=>xt,functions:()=>ar,get:()=>Qn,groupBy:()=>Bg,has:()=>Ef,head:()=>zn,identity:()=>Pi,include:()=>Qt,includes:()=>Qt,indexBy:()=>Xg,indexOf:()=>hl,initial:()=>Yn,inject:()=>fl,intersection:()=>oc,invert:()=>Cn,invoke:()=>Dg,isArguments:()=>or,isArray:()=>$t,isArrayBuffer:()=>jo,isBoolean:()=>bn,isDataView:()=>Si,isDate:()=>dg,isElement:()=>xf,isEmpty:()=>wf,isEqual:()=>kf,isError:()=>mg,isFinite:()=>Sf,isFunction:()=>K,isMap:()=>kg,isMatch:()=>Pn,isNaN:()=>Sn,isNull:()=>Of,isNumber:()=>Ho,isObject:()=>At,isRegExp:()=>pg,isSet:()=>Pg,isString:()=>nr,isSymbol:()=>Uo,isTypedArray:()=>Jo,isUndefined:()=>yn,isWeakMap:()=>Tg,isWeakSet:()=>Cg,iteratee:()=>hr,keys:()=>X,last:()=>rc,lastIndexOf:()=>qg,map:()=>Dt,mapObject:()=>$f,matcher:()=>Qe,matches:()=>Qe,max:()=>Wn,memoize:()=>Nf,methods:()=>ar,min:()=>Kf,mixin:()=>Zn,negate:()=>Ai,noop:()=>Mn,now:()=>ei,object:()=>lc,omit:()=>Wg,once:()=>$g,pairs:()=>Af,partial:()=>ii,partition:()=>Vg,pick:()=>dl,pluck:()=>Qi,property:()=>Ci,propertyOf:()=>qf,random:()=>fr,range:()=>ac,reduce:()=>fl,reduceRight:()=>Hf,reject:()=>Uf,rest:()=>Ri,restArguments:()=>H,result:()=>Lf,sample:()=>Nn,select:()=>te,shuffle:()=>Jf,size:()=>ec,some:()=>ul,sortBy:()=>tc,sortedIndex:()=>Xn,tail:()=>Ri,take:()=>zn,tap:()=>Mf,template:()=>Xf,templateSettings:()=>Mg,throttle:()=>Yf,times:()=>Df,toArray:()=>In,toPath:()=>rl,transpose:()=>pr,unescape:()=>Rg,union:()=>Ng,uniq:()=>dr,unique:()=>dr,uniqueId:()=>Vf,unzip:()=>pr,values:()=>Zt,where:()=>jf,without:()=>Ig,wrap:()=>Zf,zip:()=>Yg});var Fo=\"1.13.6\",ff=typeof self==\"object\"&&self.self===self&&self||typeof global==\"object\"&&global.global===global&&global||Function(\"return this\")()||{},xn=Array.prototype,_o=Object.prototype,cf=typeof Symbol<\"u\"?Symbol.prototype:null,og=xn.push,Ae=xn.slice,Xe=_o.toString,lg=_o.hasOwnProperty,uf=typeof ArrayBuffer<\"u\",ag=typeof DataView<\"u\",hg=Array.isArray,df=Object.keys,pf=Object.create,mf=uf&&ArrayBuffer.isView,fg=isNaN,cg=isFinite,Go=!{toString:null}.propertyIsEnumerable(\"toString\"),gf=[\"valueOf\",\"isPrototypeOf\",\"toString\",\"propertyIsEnumerable\",\"hasOwnProperty\",\"toLocaleString\"],ug=Math.pow(2,53)-1;function H(i,t){return t=t==null?i.length-1:+t,function(){for(var e=Math.max(arguments.length-t,0),r=Array(e),n=0;n=0&&e<=ug}}function kn(i){return function(t){return t?.[i]}}var wi=kn(\"byteLength\");var Og=vn(wi);var WS=/\\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\\]/;function IS(i){return mf?mf(i)&&!Si(i):Og(i)&&WS.test(Xe.call(i))}var Jo=uf?IS:wn(!1);var J=kn(\"length\");function NS(i){for(var t={},e=i.length,r=0;r\":\">\",'\"':\""\",\"'\":\"'\",\"`\":\"`\"};var Ag=En(nl);var Qg=Cn(nl);var Rg=En(Qg);var Mg=$.templateSettings={evaluate:/<%([\\s\\S]+?)%>/g,interpolate:/<%=([\\s\\S]+?)%>/g,escape:/<%-([\\s\\S]+?)%>/g};var Bf=/(.)^/,zS={\"'\":\"'\",\"\\\\\":\"\\\\\",\"\\r\":\"r\",\"\\n\":\"n\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},ZS=/\\\\|'|\\r|\\n|\\u2028|\\u2029/g;function FS(i){return\"\\\\\"+zS[i]}var _S=/^\\s*(\\w|\\$)+\\s*$/;function Xf(i,t,e){!t&&e&&(t=e),t=il({},t,$.templateSettings);var r=RegExp([(t.escape||Bf).source,(t.interpolate||Bf).source,(t.evaluate||Bf).source].join(\"|\")+\"|$\",\"g\"),n=0,s=\"__p+='\";i.replace(r,function(h,f,c,u,d){return s+=i.slice(n,d).replace(ZS,FS),n=d+h.length,f?s+=`'+\n((__t=(`+f+`))==null?'':_.escape(__t))+\n'`:c?s+=`'+\n((__t=(`+c+`))==null?'':__t)+\n'`:u&&(s+=`';\n`+u+`\n__p+='`),h}),s+=`';\n`;var o=t.variable;if(o){if(!_S.test(o))throw new Error(\"variable is not a bare identifier: \"+o)}else s=`with(obj||{}){\n`+s+`}\n`,o=\"obj\";s=`var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n`+s+`return __p;\n`;var l;try{l=new Function(o,\"_\",s)}catch(h){throw h.source=s,h}var a=function(h){return l.call(this,h,$)};return a.source=\"function(\"+o+`){\n`+s+\"}\",a}function Lf(i,t,e){t=fe(t);var r=t.length;if(!r)return K(e)?e.call(i):e;for(var n=0;n1)qt(l,t-1,e,r),n=r.length;else for(var a=0,h=l.length;at?(r&&(clearTimeout(r),r=null),l=f,o=i.apply(n,s),r||(n=s=null)):!r&&e.trailing!==!1&&(r=setTimeout(a,c)),o};return h.cancel=function(){clearTimeout(r),l=0,r=n=s=null},h}function zf(i,t,e){var r,n,s,o,l,a=function(){var f=ei()-n;t>f?r=setTimeout(a,t-f):(r=null,e||(o=i.apply(l,s)),r||(s=l=null))},h=H(function(f){return l=this,s=f,n=ei(),r||(r=setTimeout(a,t),e&&(o=i.apply(l,s))),o});return h.cancel=function(){clearTimeout(r),r=s=l=null},h}function Zf(i,t){return ii(t,i)}function Ai(i){return function(){return!i.apply(this,arguments)}}function Ff(){var i=arguments,t=i.length-1;return function(){for(var e=t,r=i[t].apply(this,arguments);e--;)r=i[e].call(this,r);return r}}function _f(i,t){return function(){if(--i<1)return t.apply(this,arguments)}}function qn(i,t){var e;return function(){return--i>0&&(e=t.apply(this,arguments)),i<=1&&(t=null),e}}var $g=ii(qn,2);function Dn(i,t,e){t=Z(t,e);for(var r=X(i),n,s=0,o=r.length;s0?0:n-1;s>=0&&s0?o=s>=0?s:Math.max(s+l,o):l=s>=0?Math.min(s+1,l):s+l+1;else if(e&&s&&l)return s=e(r,n),r[s]===n?s:-1;if(n!==n)return s=t(Ae.call(r,o,l),Sn),s>=0?s+o:-1;for(s=i>0?o:l-1;s>=0&&s0?0:l-1;for(s||(n=e[o?o[a]:a],a+=i);a>=0&&a=3;return t(e,ce(r,s,4),n,o)}}var fl=Vn(1);var Hf=Vn(-1);function te(i,t,e){var r=[];return t=Z(t,e),xt(i,function(n,s,o){t(n,s,o)&&r.push(n)}),r}function Uf(i,t,e){return te(i,Ai(Z(t)),e)}function cl(i,t,e){t=Z(t,e);for(var r=!tt(i)&&X(i),n=(r||i).length,s=0;s=0}var Dg=H(function(i,t,e){var r,n;return K(t)?n=t:(t=fe(t),r=t.slice(0,-1),t=t[t.length-1]),Dt(i,function(s){var o=n;if(!o){if(r&&r.length&&(s=Ti(s,r)),s==null)return;o=s[t]}return o==null?o:o.apply(s,e)})});function Qi(i,t){return Dt(i,Ci(t))}function jf(i,t){return te(i,Qe(t))}function Wn(i,t,e){var r=-1/0,n=-1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;lr&&(r=s)}else t=Z(t,e),xt(i,function(h,f,c){o=t(h,f,c),(o>n||o===-1/0&&r===-1/0)&&(r=h,n=o)});return r}function Kf(i,t,e){var r=1/0,n=1/0,s,o;if(t==null||typeof t==\"number\"&&typeof i[0]!=\"object\"&&i!=null){i=tt(i)?i:Zt(i);for(var l=0,a=i.length;ll||o===void 0)return 1;if(o1&&(r=ce(r,t[1])),t=he(i)):(r=ic,t=qt(t,!1,!1),i=Object(i));for(var n=0,s=t.length;n1&&(r=t[1])):(t=Dt(qt(t,!1,!1),String),e=function(n,s){return!Qt(t,s)}),dl(i,e,r)});function Yn(i,t,e){return Ae.call(i,0,Math.max(0,i.length-(t==null||e?1:t)))}function zn(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[0]:Yn(i,i.length-t)}function Ri(i,t,e){return Ae.call(i,t==null||e?1:t)}function rc(i,t,e){return i==null||i.length<1?t==null||e?void 0:[]:t==null||e?i[i.length-1]:Ri(i,Math.max(0,i.length-t))}function nc(i){return te(i,Boolean)}function sc(i,t){return qt(i,t,!1)}var pl=H(function(i,t){return t=qt(t,!0,!0),te(i,function(e){return!Qt(t,e)})});var Ig=H(function(i,t){return pl(i,t)});function dr(i,t,e,r){bn(t)||(r=e,e=t,t=!1),e!=null&&(e=Z(e,r));for(var n=[],s=[],o=0,l=J(i);o ul > li[aria-selected]\":{backgroundColor:dc,color:gr}}},{dark:!0}),sw=ve.define([{tag:p.keyword,color:Re},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Fg},{tag:[p.variableName],color:Mi},{tag:[p.function(p.variableName)],color:Mi},{tag:[p.labelName],color:JS},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:Re},{tag:[p.definition(p.name),p.separator],color:ml},{tag:[p.brace],color:Mi},{tag:[p.annotation],color:Gg},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:uc},{tag:[p.typeName,p.className],color:cc},{tag:[p.operator,p.operatorKeyword],color:ml},{tag:[p.tagName],color:uc},{tag:[p.squareBracket],color:tw},{tag:[p.angleBracket],color:_g},{tag:[p.attributeName],color:cc},{tag:[p.regexp],color:Re},{tag:[p.quote],color:uc},{tag:[p.string],color:ml},{tag:p.link,color:ml,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Mi},{tag:[p.meta],color:Fg},{tag:[p.monospace],color:Fn,fontStyle:\"italic\"},{tag:[p.comment],color:gr,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:Re},{tag:p.emphasis,fontStyle:\"italic\",color:Re},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:Re},{tag:p.special(p.heading1),fontWeight:\"bold\",color:Re},{tag:p.heading1,fontWeight:\"bold\",color:Re},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Re},{tag:[p.heading5,p.heading6],color:Re},{tag:[p.atom,p.bool,p.special(p.variableName)],color:_g},{tag:[p.processingInstruction,p.inserted],color:Mi},{tag:[p.contentSeparator],color:cc},{tag:p.invalid,color:jg,borderBottom:`1px dotted ${Gg}`}]),Kg=[nw,Te(sw)];var Jg=\"#657b83\",wc=\"#586e75\",gc=\"#073642\",Gn=\"#002b36\",iO=\"#93a1a1\",ow=\"#fdf6e3\",gl=\"#dc322f\",lw=\"#cb4b16\",_n=\"#b58900\",Oc=\"#859900\",xc=\"#2aa198\",yc=\"#268bd2\",aw=\"#6c71c4\",Ol=\"#d33682\",tO=\"#d30102\",vc=\"#dfd9c8\",bc=vc,hw=ow,Sc=wc,fw=vc,eO=wc,cw=T.theme({\"&\":{color:Jg,backgroundColor:hw},\".cm-content\":{caretColor:eO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:eO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:fw},\".cm-panels\":{backgroundColor:vc,color:Gn},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:\"1px solid #457dff\"},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:\"#6199ff2f\"},\".cm-activeLine\":{backgroundColor:bc},\".cm-selectionMatch\":{backgroundColor:\"#aafe661a\"},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${iO}`},\".cm-gutters\":{backgroundColor:\"#00000010\",color:Jg,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:bc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Sc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Sc,borderBottomColor:Sc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:bc,color:Gn}}},{dark:!1}),uw=ve.define([{tag:p.keyword,color:Oc},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:xc},{tag:[p.variableName],color:yc},{tag:[p.function(p.variableName)],color:yc},{tag:[p.labelName],color:Ol},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:_n},{tag:[p.definition(p.name),p.separator],color:xc},{tag:[p.brace],color:Ol},{tag:[p.annotation],color:tO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:Ol},{tag:[p.typeName,p.className],color:lw},{tag:[p.operator,p.operatorKeyword],color:aw},{tag:[p.tagName],color:yc},{tag:[p.squareBracket],color:gl},{tag:[p.angleBracket],color:gc},{tag:[p.attributeName],color:iO},{tag:[p.regexp],color:tO},{tag:[p.quote],color:Oc},{tag:[p.string],color:_n},{tag:p.link,color:xc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:_n},{tag:[p.meta],color:gl},{tag:[p.comment],color:gc,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:wc},{tag:p.emphasis,fontStyle:\"italic\",color:Oc},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:_n},{tag:p.heading1,fontWeight:\"bold\",color:Gn},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:Gn},{tag:[p.heading5,p.heading6],color:Gn},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Ol},{tag:[p.processingInstruction,p.inserted,p.contentSeparator],color:gl},{tag:[p.contentSeparator],color:_n},{tag:p.invalid,color:gc,borderBottom:`1px dotted ${gl}`}]),rO=[cw,Te(uw)];var nO=\"#2e3440\",Qc=\"#3b4252\",sO=\"#434c5e\",xl=\"#4c566a\",oO=\"#e5e9f0\",Ac=\"#eceff4\",kc=\"#8fbcbb\",lO=\"#88c0d0\",dw=\"#81a1c1\",ue=\"#5e81ac\",pw=\"#bf616a\",Or=\"#d08770\",Tc=\"#ebcb8b\",aO=\"#a3be8c\",mw=\"#b48ead\",hO=\"#d30102\",Rc=Ac,Pc=Rc,gw=\"#ffffff\",Cc=Qc,Ow=Rc,fO=Qc,xw=T.theme({\"&\":{color:nO,backgroundColor:gw},\".cm-content\":{caretColor:fO},\".cm-cursor, .cm-dropCursor\":{borderLeftColor:fO},\"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection\":{backgroundColor:Ow},\".cm-panels\":{backgroundColor:Rc,color:xl},\".cm-panels.cm-panels-top\":{borderBottom:\"2px solid black\"},\".cm-panels.cm-panels-bottom\":{borderTop:\"2px solid black\"},\".cm-searchMatch\":{backgroundColor:\"#72a1ff59\",outline:`1px solid ${xl}`},\".cm-searchMatch.cm-searchMatch-selected\":{backgroundColor:oO},\".cm-activeLine\":{backgroundColor:Pc},\".cm-selectionMatch\":{backgroundColor:oO},\"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket\":{outline:`1px solid ${xl}`},\"&.cm-focused .cm-matchingBracket\":{backgroundColor:Ac},\".cm-gutters\":{backgroundColor:Ac,color:nO,border:\"none\"},\".cm-activeLineGutter\":{backgroundColor:Pc},\".cm-foldPlaceholder\":{backgroundColor:\"transparent\",border:\"none\",color:\"#ddd\"},\".cm-tooltip\":{border:\"none\",backgroundColor:Cc},\".cm-tooltip .cm-tooltip-arrow:before\":{borderTopColor:\"transparent\",borderBottomColor:\"transparent\"},\".cm-tooltip .cm-tooltip-arrow:after\":{borderTopColor:Cc,borderBottomColor:Cc},\".cm-tooltip-autocomplete\":{\"& > ul > li[aria-selected]\":{backgroundColor:Pc,color:xl}}},{dark:!1}),yw=ve.define([{tag:p.keyword,color:ue},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Or},{tag:[p.variableName],color:Or},{tag:[p.function(p.variableName)],color:ue},{tag:[p.labelName],color:dw},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:ue},{tag:[p.definition(p.name),p.separator],color:aO},{tag:[p.brace],color:kc},{tag:[p.annotation],color:hO},{tag:[p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:lO},{tag:[p.typeName,p.className],color:Tc},{tag:[p.operator,p.operatorKeyword],color:aO},{tag:[p.tagName],color:mw},{tag:[p.squareBracket],color:pw},{tag:[p.angleBracket],color:Or},{tag:[p.attributeName],color:Tc},{tag:[p.regexp],color:ue},{tag:[p.quote],color:Qc},{tag:[p.string],color:Or},{tag:p.link,color:kc,textDecoration:\"underline\",textUnderlinePosition:\"under\"},{tag:[p.url,p.escape,p.special(p.string)],color:Or},{tag:[p.meta],color:lO},{tag:[p.comment],color:sO,fontStyle:\"italic\"},{tag:p.strong,fontWeight:\"bold\",color:ue},{tag:p.emphasis,fontStyle:\"italic\",color:ue},{tag:p.strikethrough,textDecoration:\"line-through\"},{tag:p.heading,fontWeight:\"bold\",color:ue},{tag:p.special(p.heading1),fontWeight:\"bold\",color:ue},{tag:p.heading1,fontWeight:\"bold\",color:ue},{tag:[p.heading2,p.heading3,p.heading4],fontWeight:\"bold\",color:ue},{tag:[p.heading5,p.heading6],color:ue},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Or},{tag:[p.processingInstruction,p.inserted],color:kc},{tag:[p.contentSeparator],color:Tc},{tag:p.invalid,color:sO,borderBottom:`1px dotted ${hO}`}]),Hn=[xw,Te(yw)];var hq={initialize({model:i}){},render({model:i,el:t}){var e=i.get(\"widget_instance_count_trait\");i.attributes={function_body_id:e};let r=\"\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "Implements ridge regression\n\n:param x: An array of data points\n:param omega: The frequency", - "function_body": "import numpy as np\nreturn np.sin(x*omega)\n", - "function_name": "sin", - "function_parameters": "x, omega", - "layout": "IPY_MODEL_ee695d0c1dfa42ea82dde071304d0eb5", - "name": "", - "widget_instance_count_trait": "0" - } - }, - "ee695d0c1dfa42ea82dde071304d0eb5": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "ef6392a99b75491b901d9e21e4cd2889": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_a9dcec753a7e46bc90698646d6cca5ac", - "IPY_MODEL_5d9a86e0c9f0462799ccda9b8ffac82b" - ], - "layout": "IPY_MODEL_46703caed51d44b9b691229afd3602b1" - } - }, - "f0f94576e78d44588a6221af5019b4f0": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "f7af36b0d51549edbc32c32abe6c1dd9": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "f807e3973f484d0bad4ee6b78a95d6d7": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "f81da702f8d94581ad90cd2a64f0b880": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "fbb5152802b148f6b098634b6614f6f3": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "layout": "IPY_MODEL_595258396dc642f49462de13f0a2d4dc" - } - }, - "fbda26206f1e4b41bca7c35c7697888b": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "fc49d7118ebe450fa90197d947dfbc90": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_8008154b4db64aadb209886ea097f46b", - "IPY_MODEL_e85c9a967dbd434ea823d2d6392177ef", - "IPY_MODEL_40cd8d2bcd134d43a13e417a8f8a5e2f", - "IPY_MODEL_8fc6f0751cd149ff93258350fa6e448b", - "IPY_MODEL_4a179c4a144442c7a29348181860ec65", - "IPY_MODEL_696ead9eaf964addb176494a3de40440", - "IPY_MODEL_72dde821c0414805a0a775a6193a776f" - ], - "layout": "IPY_MODEL_ec1bffa999e5465ebc5e4e5879b9883b" - } - }, - "fc73fc55edbe4fef9a4cd3e12eb20924": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "description": "Create file", - "layout": "IPY_MODEL_bd1f4cc2c9a04650a878f365f851ad9e", - "style": "IPY_MODEL_29d3a61e96a0454ba7611a156d36e901", - "tooltip": null - } - }, - "fcc10f01f409453683f5312be5fa70af": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_ca3b73abc45f45b8bb17a53f9335b2bf", - "IPY_MODEL_1462eded8f8b4910bc6961b12f9ebe12" - ], - "layout": "IPY_MODEL_4b6b0011629147e5b217dc9063051b5f" - } - }, - "fce47161f75448a595dc435abff3d108": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_4d24abfc6c694a3296e1d8b1e75c6569", - "IPY_MODEL_18acbb5da7a5449bb365f2631b2d1682", - "IPY_MODEL_3c88be059b2547d081c45a8bb9e53906", - "IPY_MODEL_fc73fc55edbe4fef9a4cd3e12eb20924" - ], - "layout": "IPY_MODEL_5dd2140cd5e64e409a8eceb1802bfe91" - } - }, - "ff485cc3069045578e8d4e83143b166d": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonModel", - "state": { - "description": "Save all answers", - "disabled": true, - "layout": "IPY_MODEL_050319d2e7c341c9bd0c2c018a3f545f", - "style": "IPY_MODEL_501fed9a86f74f8ca525c2fcc63939f7", - "tooltip": "Save all answers saved into a .json file." - } - } - }, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/src/getting_started.ipynb b/docs/src/getting_started.ipynb index 39759bf..7d5d38e 100644 --- a/docs/src/getting_started.ipynb +++ b/docs/src/getting_started.ipynb @@ -2,28 +2,10 @@ "cells": [ { "cell_type": "markdown", - "id": "742ebaef-4e82-4e60-a63f-dd60f6f313ca", - "metadata": { - "lines_to_next_cell": 2 - }, - "source": [ - "# Getting started\n", - "\n", - "_scicode-widgets_ is a widget library for the purpose of creating\n", - "computational experiments for educational content. It is targeted to teach\n", - "students how to code and interpret computational experiments while hiding\n", - "technical details and boiler plate code that are not essential for the\n", - "learning experience. It is purely written in Python to simplify the\n", - "development process for scientific researchers as they usually are more\n", - "capable in writing Python code than JavaScript." - ] - }, - { - "cell_type": "markdown", - "id": "bb78fff1-9a3d-4d23-b689-aae5c99d049e", + "id": "0", "metadata": {}, "source": [ - "## Installation\n", + "## Getting started\n", "\n", "scicode-widgets can be installed with:\n", "\n", @@ -34,27 +16,19 @@ }, { "cell_type": "raw", - "id": "100c379d-00cf-4a09-a4fe-71f27bb74ab2", + "id": "1", "metadata": { "raw_mimetype": "text/restructuredtext", "tags": [] }, "source": [ ".. important::\n", - " Jupyter widgets cannot be run within in documentation. To be able to interact with the widget you must run a mybinder instance.\n" + " Jupyter widgets cannot be run within in documentation. To be able to interact with the widget you must run a mybinder instance. To run a mybinder instance of this notebook please use __[this link](https://mybinder.org)__.\n" ] }, { "cell_type": "markdown", - "id": "9f59267c-e676-4777-acea-27afd812a2f8", - "metadata": {}, - "source": [ - "To run a mybinder instance of this notebook please use __[this link](https://mybinder.org)__." - ] - }, - { - "cell_type": "markdown", - "id": "96292de4-545b-478d-80a9-3896f8d5dfd3", + "id": "5", "metadata": {}, "source": [ "## Creating a code execrcise\n", @@ -63,17 +37,16 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "31ad0ffd-3a0f-4c06-be6c-871be61b4040", + "execution_count": 1, + "id": "6", "metadata": { - "scrolled": false, "tags": [] }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "48fc12ef3a2c49d0a6e2240fd9f19c0f", + "model_id": "8723f4680795465a870f1280b07642f9", "version_major": 2, "version_minor": 0 }, @@ -86,7 +59,6 @@ } ], "source": [ - "%matplotlib widget\n", "from scwidgets import CodeExercise\n", "\n", "import matplotlib.pyplot as plt\n", @@ -104,17 +76,17 @@ " y = code_ex.code(x, code_ex.params[\"omega\"])\n", " ax = code_ex.figure.gca()\n", " ax.plot(x, y)\n", - " \n", - " \n", + "\n", "code_ex = CodeExercise(\n", " code=sin,\n", - " params={\"omega\": (0.5, 3.14, 0.1)},\n", " outputs=plt.figure(),\n", + " params={\"omega\": (0.5, 3.14, 0.1)},\n", " update=update_func,\n", " update_mode=\"continuous\",\n", " exercise_title=\"Sinus function\",\n", " exercise_description=\"Implements $\\sin(x\\omega)$\",\n", ")\n", + "code_ex.outputs[0].draw_display()\n", "\n", "\n", "code_ex.run_update() # For the demonstration we run the widget one time\n", @@ -123,7 +95,7 @@ }, { "cell_type": "markdown", - "id": "e6f509fe-1533-4742-994a-00441e450207", + "id": "7", "metadata": {}, "source": [ "Please look at __[section exercises](./exercises.html)__ for more information about the execrises that can be created and their customization options." @@ -131,7 +103,7 @@ }, { "cell_type": "markdown", - "id": "5a6ed9bf-9fcb-4af6-a23f-8ae9164c7028", + "id": "8", "metadata": {}, "source": [ "## Check students solution\n", @@ -141,29 +113,13 @@ }, { "cell_type": "code", - "execution_count": 6, - "id": "69a0b256", + "execution_count": null, + "id": "9", "metadata": { "lines_to_next_cell": 2, "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "011197f0130f486d89a970d302210437", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "CodeExercise(children=(CssStyle(value='\",n=i.attributes.function_body_id;console.log(\"theTextareaId = %s\",n);let s=document.createElement(\"textArea\");t.appendChild(s),s.outerHTML=r+'';function o(l,a){let h=new T({state:Y.create({doc:l.value,extensions:a})});return l.parentNode.insertBefore(h.dom,l),l.style.display=\"none\",l.form&&l.form.addEventListener(\"submit\",()=>{l.value=h.state.doc.toString()}),h}ll(()=>{var l=new pe,a=new pe,h=new pe,f=new pe;let c=o(document.getElementById(n+\"-signature\"),[Y.readOnly.of(!0),ui(),ke.of(\" \"),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),eg(),a.of(Hn),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo])]);c.dom.classList.add(\"widget-code-input-signature\");var u=o(document.getElementById(n+\"-docstring\"),[ui(),Y.readOnly.of(!0),T.editorAttributes.of({class:\"widget-code-input-docstring\"}),_r({class:\"forced-indent\"}),l.of(ui()),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),qa(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),h.of(Hn)]);c.dom.classList.add(\"widget-code-input-signature\");var d=new pe,m=o(document.getElementById(n+\"-body\"),[l.of(ui()),_r({class:\"forced-indent\"}),d.of([]),mo(),Ls(),Vs(),Y.allowMultipleSelections.of(!0),Te(eo,{fallback:!0}),io(),ao(),co(),Ws(),Fe.of([...ho,...So,...Zo,...Oo,...to,...hn,...Mo]),Hh(),ke.of(\" \"),f.of(Hn)]);m.dom.classList.add(\"widget-code-input-body\");let O=T.updateListener.of(y=>{y.docChanged&&(i.set(\"function_body\",m.state.doc.toString()),i.save_changes(),console.log(\"BodyChange event registered.\"))});m.dispatch({effects:d.reconfigure(O)});function g(){let y=\"def \"+i.get(\"function_name\")+\"(\"+i.get(\"function_parameters\")+\"):\";y!==c.state.doc.toString()&&c.dispatch({changes:{from:0,to:c.state.doc.length,insert:y}})}function x(){let y=c.state.doc.toString().split(`\n`).length,k=u.state.doc.toString().split(`\n`).length;u.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+w}))}),m.dispatch({effects:l.reconfigure(ui({formatNumber:w=>y+k+w}))})}function S(){console.log(\"updating docstring\");let y='\"\"\"'+i.get(\"docstring\")+'\"\"\"';y!==u.state.doc.toString()&&u.dispatch({changes:{from:0,to:u.state.doc.length,insert:y}}),x()}function C(){i.get(\"function_body\")!==m.state.doc.toString()&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:i.get(\"function_body\")}})}function v(){var y,k=i.get(\"code_theme\"),w={nord:Kg,solarizedLight:rO,basicLight:Hn};if(k in w)y=w[k];else throw new Error(\"Specified code theme is not supported.\");console.log(\"theme changed, theme= %s\",k),c.dispatch({effects:a.reconfigure(y)}),u.dispatch({effects:h.reconfigure(y)}),m.dispatch({effects:f.reconfigure(y)}),c.dom.classList.add(\"widget-code-input-signature\"),m.dom.classList.add(\"widget-code-input-body\")}g(),S(),C(),v(),i.on(\"change:docstring\",()=>{console.log(\"docstring changed\"),S()}),i.on(\"change:function_body\",()=>{C()}),i.on(\"change:code_theme\",()=>{console.log(\"theme change event\"),v()})})}};export{hq as default};\n", - "_model_module": "anywidget", - "_model_module_version": "~0.9.*", - "_model_name": "AnyModel", - "_view_module": "anywidget", - "_view_module_version": "~0.9.*", - "_view_name": "AnyView", - "code_theme": "basicLight", - "docstring": "Implements ridge regression\n\n:param x: An array of data points\n:param omega: The frequency", - "function_body": "import numpy as np\n# We provide already the solution for the demo\nreturn np.sin(x*omega)\n", - "function_name": "sin", - "function_parameters": "x, omega", - "layout": "IPY_MODEL_53afe92f92794ce7a739ff858fce75cb", - "name": "", - "widget_instance_count_trait": "0" - } - }, - "1d8967665a914934ac2833f937754d11": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "_dom_classes": [ - "scwidget-cue-output" - ], - "layout": "IPY_MODEL_af93edfca40740d2b7ac6c27c4ea0990", - "outputs": [ - { - "data": { - "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjgAAAGdCAYAAAAfTAk2AAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjkuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8hTgPZAAAACXBIWXMAAA9hAAAPYQGoP6dpAABpM0lEQVR4nO3de3xT9f0/8NdJmia9JW3pvRRKuZVrWwpULt5mR1E35ftzTDYckyFMJ25+8TuVfR1sOmU65/yqfHVTmbrp18sUL+hQBBGFSqGlXMv90mt6T9J72iS/P5KTUimlpT05Jyev5+ORx0Y4OXknmOR9Pp/35/0RXC6XC0REREQqopE7ACIiIqKhxgSHiIiIVIcJDhEREakOExwiIiJSHSY4REREpDpMcIiIiEh1mOAQERGR6jDBISIiItUJkjsAOTidTlRWViIiIgKCIMgdDhEREfWDy+VCU1MTkpKSoNH0PUYTkAlOZWUlUlJS5A6DiIiILkNZWRmGDx/e5zEBmeBEREQAcL9BRqNR5miIiIioP2w2G1JSUry/430JyARHnJYyGo1McIiIiPxMf8pLWGRMREREqsMEh4iIiFSHCQ4RERGpDhMcIiIiUh0mOERERKQ6THCIiIhIdZjgEBERkeowwSEiIiLVYYJDREREqiNpgrNjxw58//vfR1JSEgRBwPvvv3/Jx2zfvh3Tpk2DXq/HmDFj8Morr1xwzPr165GamgqDwYCcnBwUFBQMffBERETktyRNcFpaWpCRkYH169f36/gzZ87gxhtvxLXXXovi4mLce++9uOOOO/Dpp596j3nrrbewatUqrF27FkVFRcjIyEBeXh5qamqkehlERETkZwSXy+XyyRMJAjZu3IgFCxZc9JgHHngAH3/8MQ4dOuS9b9GiRbBYLNi8eTMAICcnBzNmzMBzzz0HAHA6nUhJScE999yDBx98sF+x2Gw2mEwmWK1W7kVFRETkJwby+62ozTbz8/ORm5vb4768vDzce++9AAC73Y7CwkKsXr3a+/cajQa5ubnIz8+/6Hk7OjrQ0dHh/bPNZhvawANAWUMr9pxtQJg+CFGhwYgK1SEyNBgx4cH92vSMiAavpaML+8stKC6zQB+kxfemJiLeaJA7LCJFUlSCYzabER8f3+O++Ph42Gw2tLW1obGxEQ6Ho9djjh49etHzrlu3Dr///e8liVntqqxteGbrSbyztwxdzgsH+yYmGvHED6ZicrJJhuiI1K+soRUvfXUae8814qi5CY7zPoePfnwEc8fG4pZpyciblACDTitjpETKoqgERyqrV6/GqlWrvH+22WxISUmRMSLlq2vuwP9+cQr/3H0O9i4nACAjJRICAEurHY2tnbC1d+JIlQ0L1u/EL64dg5XXjkFwEBfmEQ2VnSfrcPcbRbC0dnrvSzQZMG1EFKpt7dh7rhE7jtdix/FaROiD8ND3JuDWGSNkjJhIORSV4CQkJKC6urrHfdXV1TAajQgJCYFWq4VWq+31mISEhIueV6/XQ6/XSxKzGhWcacDPXtmD5o4uAMDMUdH4dd54zEiN7nFcXXMH1nxwCJ8cNOOZrSfw2WEznlyYwdEcokFyuVzYsPMsHvukBA6nCxnDTVhx1WhMGxmJRFOI97izdS14r6gc7xZVoMLShgfePYim9i7ccWWajNETKYOiLrdnzZqFrVu39rhvy5YtmDVrFgAgODgY2dnZPY5xOp3YunWr9xganKNmG5a96k5uJicb8drPZuKtFVdckNwAQEy4Hv+7OBvP/TgL0WHBOGpuwoL1O7H5UJUMkROpQ3unA//1zgE8sukIHE4Xbpk2HG/9fBZunJrYI7kBgNSYMKyaNx5f3X8tfn61O6n5w8cleG7bCTlCJ1IUSUdwmpubcfLkSe+fz5w5g+LiYkRHR2PEiBFYvXo1Kioq8NprrwEA7rzzTjz33HO4//778bOf/Qzbtm3D22+/jY8//th7jlWrVuGnP/0ppk+fjpkzZ+Lpp59GS0sLli5dKuVLCQhlDa1Y8nIBmtq7MCM1Cv9YltOvOf3vTU3CFWnD8Jv3DuKzI9VY9fZ+pMaEIT2BK9SIBqLN7sDil75BUakFGgH47xsn4mdzUi9ZyK/RCHhwfjrCgoPw1JbjePKz42i1O/DrvPFcBEABS9IRnL179yIrKwtZWVkA3MlJVlYW1qxZAwCoqqpCaWmp9/hRo0bh448/xpYtW5CRkYE///nPeOmll5CXl+c95tZbb8WTTz6JNWvWIDMzE8XFxdi8efMFhcc0MA0tdvx0QwFqmjowLj4cLy2ZMaCCRfdozjTMHRODVrsDK14rhKXVLmHEROrz6CdHUFRqgSlEh9d+loNlc0f1O0ERBAG/vG4s/vuGCQCA/91+Cg9vOgIfdQIhUhyf9cFREvbB6amlows/fmk39pdZkBwZgnfvmo0E0+UtPW1sseOm9V+jrKENV46NwStLZ0Kr4RUk0aV8dtiMFf8oBAD8Y9lMXDk29rLP9Y/8s/jtB4cBAE/9MAP/b9rwIYmRSG4D+f1WVA0O+Z7L5cKqt4uxv8yCyFAdXv3ZzMtObgAgKiwYf71tOgw6Db46UYc/fXpsCKMlUieztR33v3sAALDiqrRBJTcA8JNZqbjvu+MAAA9vOoLapo5LPIJIfZjgBLjPS2rw6eFq6LQCNtw+A2Piwgd9zolJRjzxgwwAwAtfnsJH+ysHfU4itXI4XfjPt4phae3E5GQj/mve+CE5753XjMbERCMsrZ1Y++GhSz+ASGWY4ASw9k4Hfv+Rexh7+ZVpmDYiasjOfVNGkndVx4PvHkBNU/uQnZtITf624zTyT9cjRKfFM4uyhqyXlE6rwZ8WTkWQRsAnB83490GubqTAwgQngP3v9lMob2xDksmAld8ZM+Tnvz8vHRnDTWixO/D051y2SvRt+8ss+PNn7mnc3980CWmxgx9BPd+kJBPuvHo0AOC3Hxxm4T8FFCY4AepcfQte+PIUAOCh701EaPDQdwzQagT8940TAQBvFpTiRHXTkD8Hkb9yuVx46P1D6HK6cOOURCycLk0h8D3XjcGYuHDUNXfg4U1HJHkOIiVighOgHv7oCOxdTswdE4PrJ1+8C/RgzRwVjXkT4+F0Aev+ffH9wogCzWdHqnGwworQYC1+f/MkyfrV6IO0eOIHUyEIwHtFFfjiWI0kz0OkNExwAtDnR6qx9WgNdFoBv7tJui9W0YPXpyNII2Db0RrsOlkn6XMR+QOn04W/bDkOAFg6JxUx4dJuJTNtRBR+NmcUAHg7JBOpHROcANPe6cDvN7kLi5fNTRuSVVOXkhYbjsU57g0AH/2kBE5+uVKA+/hgFY6amxBhCMKKK0f75DnvzR0LoyEIp2tb8Olhs0+ek0hOTHACzD/yz6GsoQ2JJgPukaCw+GJ+ed1YROiDcLjShveLK3z2vERK0+Vw4i+fu0dvll+ZBlOozifPG2HQ4XbPKM6z206ywzGpHhOcANLpcGLDzjMAgF9dNxZhet9tJj8sXI+7rnVfqT756TG0dzp89txESvJBcSVO17YgKlSHpXNSffrcS2enIjRYi5IqG2txSPWY4ASQjw9UocrajphwPRZkJfv8+X82ZxSSTAZUWtvxWv5Znz8/kdw6HU48vdU9evPzq0cjwuCb0RtRVFgwbrtiJADgOY7ikMoxwQkQLpcLL351GgBw++yRA9pIc6gYdFr8KncsAOCVnWfR5XD6PAYiOb2ztxxlDW2ICddjyayRssRwx5WjEBykQVGpBfmn62WJgcgXmOAEiPxT9ThcaUOITovFOfJ8sQLAzZnJiA4LRqW1HZ+XVMsWB5GvdXQ58Nw2d8PLu68dLUnvqf6IizBg0YwUAO5RHCK1YoITIP7mGb1ZOH04osKCZYvDoNN6v1xf2XVWtjiIfO3jA1WotLYjwWjAj2aOkDWWn189GkEaAbtO1aOotFHWWIikwgQnAByvbsL2Y7UQBGDZ3FFyh4PbrhgJrUbAN6cbUFJlkzscIp94fXcpAOAns+SZIj5fcmQI/sNTh7eeozikUkxwAsBLntGb+ZMSMHJYmMzRAEmRIcibFA8ALDamgHDUbEPhuUYEaQTJtmQYqLuuGQ2NAGw9WoOjZl5okPowwVG5Gls73t9XCQBYflWazNF0u322eyRp474KbgBIqveGZ/Rm3qR4xEUYZI7GLS02HHmT3Nu0vFlQJnM0REOPCY7KvZp/FnaHE9NHRmHaiCi5w/GakRqFCYlGtHc68dYefrmSerV0dOG9IndzSzkL/Htzq6cebuO+CvamItVhgqNiHV0O77y/kkZvAEAQBCydnQoAeC3/HPfGIdX6aH8lmju6MComDLPShskdTg9Xjo1FkskAa1snPjvCVY2kLkxwVGxbSQ0srZ1INBmQOyFe7nAucFNmEqJCdaiwtHHJOKmWeJHxo5kp0Gik3dh2oLQaAT/IdtcEvc2RVFIZJjgq9q5nWHxBVjK0CvtiBdxLxm+d4V4u+yqXjJMKHSi34GCFFcFaDX6QnSJ3OL1aON0d185TdShraJU5GqKhwwRHpeqbO7Dds9fMLdN8vy1Df/1k1khoBGDXqXqcrm2WOxyiISUWF98wJQHRMvaf6ktKdChmjx4Glwv4V2G53OEQDRkmOCr14f5KdDldyBhuwpi4CLnDuajkyBBcOTYWgDtmIrWwtXfig2L3f9OLr1BWcfG3icXG/yosZz0cqQYTHJUSV238v2nK6LnRlwVZSQCAD4srufkfqcb7+yrQ1unA2LhwTB+pnBWMvcmblACjIQgVljbsPFkndzhEQ4IJjgodr27CwQordFoB389IkjucS/ruxAQYdBqcrmvBwQqr3OEQDQmx/cGPc0ZAEJRXA3c+g06LBZ7Oxm/vZbExqQMTHBV6t8g9j37t+DjFzvufL1wf5F3lJQ7pE/mz07XNOFxpg1YjYEGmcmvgzvdDT7HxZ4er0djC5pvk/5jgqIzD6cL7+/xnekok/gh8tL+SNQDk9z4+UAUAmDMmRtbNbQdicrIJExONsDuceL+4Qu5wiAaNCY7K7DxZh2pbByJDdbg2PVbucPrtqnGxMIXoUNPUgW9O18sdDtGgbPIkON+bmihzJAMjFhu/s5erqcj/McFRmfc801Pfn5oEfZC8OxYPRHCQBjdMcf8YfMCrR/JjJ6qbcKy6CTqtgLyJCXKHMyA3ZSRBqxFwpMqGc/UtcodDNChMcFSkqb0Tmw+bAQC3ZPvP9JRoQaa7IPrfB83cF4f8ljh6c9XYWJhCdTJHMzBRYcHe7ST+fcgsczREg8MER0X+fciM9k4n0mLDkDHcJHc4AzYjNRqJJgOaOrq8TQqJ/InL5cKmA+5C+Rv9bHpKNH+ye9Tp3werZI6EaHB8kuCsX78eqampMBgMyMnJQUFBwUWPveaaayAIwgW3G2+80XvM7bfffsHfz58/3xcvRdHEL6QFmcmKX5baG41GwE2eZe1cTUX+6Ki5CadqWxAcpMF3Jypv/7f+yJuUAEEA9pdbUd7IrRvIf0me4Lz11ltYtWoV1q5di6KiImRkZCAvLw81Nb1fob/33nuoqqry3g4dOgStVouFCxf2OG7+/Pk9jvu///s/qV+KojV3dGHnSXdxrngF5o9u9qym2nq0Brb2TpmjIRoYcfTmmnGxiDD41/SUKDZCjxmp0QCAzZymIj8meYLz1FNPYfny5Vi6dCkmTpyIF154AaGhodiwYUOvx0dHRyMhIcF727JlC0JDQy9IcPR6fY/joqKU3SlUatuP1cDucGJUTBjGxoXLHc5lm5AYgbFx4bB3OfnlSn7F5XJ5l4d/zw8abPblBnGaip9B8mOSJjh2ux2FhYXIzc3tfkKNBrm5ucjPz+/XOV5++WUsWrQIYWFhPe7fvn074uLiMH78eNx1112or7/40uKOjg7YbLYeN7X59HA1AGDepHi/nJ4SCYKAmz3FxmKxJpE/OFxpw9n6Vhh0GlyXHid3OIMyf7K7fqjwXCPM1naZoyG6PJImOHV1dXA4HIiP7zkXHR8fD7P50lcGBQUFOHToEO64444e98+fPx+vvfYatm7discffxxffvklrr/+ejgcva+8WbduHUwmk/eWkpJy+S9KgTq6HPjiqHvKb56fLUvtjTjF9s2pejR3dMkcDVH/fOSZnvpOehzC9EEyRzM4CSYDpo2IBAB8epijOOSfFL2K6uWXX8aUKVMwc+bMHvcvWrQIN910E6ZMmYIFCxZg06ZN2LNnD7Zv397reVavXg2r1eq9lZWpa6+VfE8iEBehR1ZKpNzhDNro2HCkDguF3eHEV8dr5Q6H6JJ6TE9N9e/pKZHYl+rfhziSSv5J0gQnJiYGWq0W1dXVPe6vrq5GQkLfIw0tLS148803sWzZsks+T1paGmJiYnDy5Mle/16v18NoNPa4qclnR9zv73cnxkOj8d/pKZEgCN69qbaUVF/iaCL5uVcctSE0WItrx/v39JQob5L7O7rgTAPqmjtkjoZo4CRNcIKDg5GdnY2tW7d673M6ndi6dStmzZrV52PfeecddHR04Lbbbrvk85SXl6O+vh6Jif7Zd2IwnE4XthwR62/8f3pKlOtZYvvF0Rp0OZwyR0PUty1H3NM416bHISTYfzqI9yUlOhRTh5vgdLk34CTyN5JPUa1atQovvvgiXn31VZSUlOCuu+5CS0sLli5dCgBYsmQJVq9efcHjXn75ZSxYsADDhg3rcX9zczN+/etf45tvvsHZs2exdetW3HzzzRgzZgzy8vKkfjmKs6+sEbVNHYgwBHk7kKrB9JFRMIXo0NjaiaJSi9zhEPVp21H3VGruBHWM3oi8Tf84TUV+SPIE59Zbb8WTTz6JNWvWIDMzE8XFxdi8ebO38Li0tBRVVT0/PMeOHcPXX3/d6/SUVqvFgQMHcNNNN2HcuHFYtmwZsrOz8dVXX0Gv10v9chRHvLL6TnocgoMUXVI1IEFaDb7jWYnyOaepSMEqLW0oqbJBEICrx6krwbnes5pq16l6NLbYZY6GaGB8Uuq/cuVKrFy5ste/660wePz48XC5XL0eHxISgk8//XQow/NbLpfLu8JBDaunvi13Qjw27qvA50eq8ZsbJsgdDlGvvvBsKzJtRBSiw4JljmZojYoJw4REI0qqbPi8pBoLp6trBSqpm3ou+QPQiZpmnK1vRXCQBlePj5U7nCF31bgY6LQCTte14FRts9zhEPVqW4k7wfmOn/e+uZjveqbdth/jikbyL0xw/Ninni6jc8fEINzP+270JsKgwxWeuqLPj3CaipSnvdOBnafqAKg3wbnG87q+OlHLgn/yK0xw/NinnpUbeZP8c1O//hA3LGQdDilR/ql6tHc6kWQyID0hQu5wJJExPBJRoTrY2ruwr8widzhE/cYEx0+Zre04VOEubLxugnoTHPG1FZ5rRD17cZDCbD3qTryvTY/z6y1S+qLVCLhyrHsKXOyYTuQPmOD4qR2eDr8ZwyMRE67e1WPJkSGYmGiE0wV8wRoAUhCXy4UvPMvDr1PZ8vBvuzbdneCwDof8CRMcP/WlJ8G5epz6iou/TWz6xzocUpJj1U2osLRBH6TBrLQYucOR1FVjYyEIwJEqG6pt3HyT/AMTHD/kcLrw9Ul3YeNVAZDgfNczTbXjRC3aO3vfUJXI17Z6Vk/NGROjmu7FFzMsXI+pySYAwJccxSE/wQTHD+0vt8Da1gmjIQgZw01yhyO5yclGJBgNaLU7sPtMg9zhEAHorkdR6+qpb7vGs8fW9uOswyH/wATHD4lXUFeOjUWQVv3/hIIg4Kpx7imAr0/w6pHk19BiR1FpIwB3gXEguMbTa+ur43Xo5HJx8gPq/3VUoR2eH3nxRz8QzPWs4vjqRJ3MkRABXx6vgdMFpCdEIDkyRO5wfGLq8EhEhwWjqaMLReca5Q6H6JKY4PgZS6sd+z29KAKh/kY0d0wMBAE4am5CDYscSWbi5pqBMj0FuJeLXzXWfVHFFY3kD5jg+JmvT9bB6QLGxYcj0RQYV44AEB0WjElJRgDwFlgTycHhdHnbNARSggOcV4dzjHU4pHxMcPzMjgBaHv5tYrOxrzlNRTI6XGmFta0TEfogZKZEyh2OT101LtY7kmq2ciSVlI0Jjh9xuVze/jeBND0lutIzPP7VybqL7jZPJDVxBPGK0cMCosj/fNFhwcgYHgmAozikfIH16fRzx6ubUW3rgEGnwYzUaLnD8bnskVEI0WlR29SBY9VNcodDAWqnJ8GZOyZwivzPJ66mYldjUjomOH7kS0//iSvShsGgU3djsd7og7TISXMndl8d5zQV+V57pwN7zrpXEM0J0ATnWk8dztcn67i7OCkaExw/ssPzo37V2MCbnhKJV8072A+HZLD3bCPsXU4kGA0YHRsmdziymJxsgilEh+aOLhyosModDtFFMcHxE632LhR4uvhePT5wExyx9qjgTAO3bSCfE+tv5oyJUe3u4Zei1Qi4wjOSmn+qXuZoiC6OCY6f2H26AXaHE8mRIUiLCcwrRwAYGxeOeKMeHV1O7D3LZmPkW976m7HDZI5EXuL03K5TnCom5WKC4ye8u4ePjw3YK0fAvW3D3DGersYnOU1FvtPYYsehSveUzJzRgVl/I5o92p3g7T3byJFUUiwmOH5CHAoO1JUb5xO3qGChMflS/ul6uDxNNuOMBrnDkdXo2HDERbhHUsU9uYiUhgmOH6hv7l4WfUVaYA+NA93D40eqbKhr7pA5GgoU59ffBDpBELyjOLtOsg6HlIkJjh/45rS7uDg9IQLRYcEyRyO/mHA9Jia6t23YyW0byEcCvf/Nt81mHQ4pHBMcP5B/2v0FMms0R29EYlfjHZymIh8oa2jFufpWaDUCcjiKCqC7Dmd/uRXNHV0yR0N0ISY4fkCsv5nFL1avuZ4E55vT9dy2gSQnjt5kpUQiXB8kczTKMDwqFCOHhcLhdKHgDKepSHmY4Chcta0dp2pbIAhAzigmOKLskVHQaQVUWNpQ3tgmdzikcqy/6R3rcEjJmOAo3Den3V8ck5KMMIXqZI5GOUKDgzDVs+lf/ml+uZJ0nE4XdomrGMcywTnfLM9y+Z1s+EcKxARH4Tg9dXFiN9VvmOCQhErMNjS02BEWrEVmSqTc4SiK+L1UUuV+j4iUhAmOwomjEywwvpC4ZH63Z5UZkRTE6ZeZo6Kh0/Ir83yxEXqMj48AwAsNUh5+WhWs0tLmXbkxIzVa7nAUJ3tkFII07jqcsoZWucMhldp9hhcZfZk9xv2+sGUDKQ0THAUTp6cmJ5sQYWD9zbe563BMAHj1SNJwOl3eTW5Z5N+72Z46HG68SUrjkwRn/fr1SE1NhcFgQE5ODgoKCi567CuvvAJBEHrcDIaebdFdLhfWrFmDxMREhISEIDc3FydOnJD6Zficd3qK9TcXJU5TfcNpKpLAUXMTbO1dCAvWYlKSUe5wFCknLRoaAThd14IqK1c0knJInuC89dZbWLVqFdauXYuioiJkZGQgLy8PNTU1F32M0WhEVVWV93bu3Lkef//EE0/gmWeewQsvvIDdu3cjLCwMeXl5aG9vl/rl+JS3wJhD4xfVneDw6pGGnjg9lZ0ajSDW3/TKaNBhimdF404uFycFkfwT+9RTT2H58uVYunQpJk6ciBdeeAGhoaHYsGHDRR8jCAISEhK8t/j4eO/fuVwuPP3003jooYdw8803Y+rUqXjttddQWVmJ999/X+qX4zNlDa2osLQhSCNg+sgoucNRLNbhkJS6p6dYA9cXsR/Obl5okIJImuDY7XYUFhYiNze3+wk1GuTm5iI/P/+ij2tubsbIkSORkpKCm2++GYcPH/b+3ZkzZ2A2m3uc02QyIScn56Ln7OjogM1m63FTOnH0JiMlEmHsnHpRYfruOpzdZzhNRUPH5XIxwemnmZ73Z89ZfgZJOSRNcOrq6uBwOHqMwABAfHw8zGZzr48ZP348NmzYgA8++AD//Oc/4XQ6MXv2bJSXlwOA93EDOee6detgMpm8t5SUlMG+NMmx/qb/cjhNRRI4VduM+hY79EEab1NJ6l32yCgIAnC2vhU1NnWVCpD/Utyk8qxZs7BkyRJkZmbi6quvxnvvvYfY2Fj89a9/vexzrl69Glar1XsrKysbwoiHnsvlYv3NALAOh6QgFq5PGxGF4CDFfVUqitGgw8REdxF2AUdxSCEk/dTGxMRAq9Wiurq6x/3V1dVISEjo1zl0Oh2ysrJw8uRJAPA+biDn1Ov1MBqNPW5Kdra+FWZbO4K1GmSz/uaSpo+MglYjoLyxDeWNrMOhoSFOeeakcXqqP8ReXQWcKiaFkDTBCQ4ORnZ2NrZu3eq9z+l0YuvWrZg1a1a/zuFwOHDw4EEkJiYCAEaNGoWEhIQe57TZbNi9e3e/z6l0ezxfEBkpJhh0WpmjUb4edThcLk5DwF1/4x4RZP+b/hHrlJjgkFJIPu66atUqvPjii3j11VdRUlKCu+66Cy0tLVi6dCkAYMmSJVi9erX3+IcffhifffYZTp8+jaKiItx22204d+4c7rjjDgDuFVb33nsv/vCHP+DDDz/EwYMHsWTJEiQlJWHBggVSvxyfEId42b24/8QfIU5T0VA4V9+KalsHgrUaZI2IlDscvzDd8311rLoJ1tZOmaMhAiRfnnPrrbeitrYWa9asgdlsRmZmJjZv3uwtEi4tLYVG051nNTY2Yvny5TCbzYiKikJ2djZ27dqFiRMneo+5//770dLSghUrVsBisWDu3LnYvHnzBQ0B/dVeMcHhyo1+uyItGi98eQrfnGGCQ4NXwFHUAYuN0CMtNgyna1uw91wDrpsQf+kHEUlIcLlcLrmD8DWbzQaTyQSr1aq4epyapnbMfHQrBAEoXjMPphBu0dAfzR1dyPj9Z3A4Xdj54HeQHBkid0jkx1a9XYz3iipw97Wj8eu8dLnD8RsPvnsAb+4pw8+vSsPqGybIHQ6p0EB+v7k0QGH2nm0EAKQnGJncDEC4PgiTk8U6HI7i0OCItVysvxkYsR8Oe1KREjDBURhxaHxGKldPDdRMz3u291yjzJGQPytvdHcR12oErmIcIDHBOVRhRau9S+ZoKNAxwVGYvedYYHy5xCLHwrNMcOjyiRcZk5NN7CI+QMOjQpFkMqDL6cK+Uovc4VCAY4KjIE3tnThS6d5GggnOwIl7dnEVBw2GmOBcwSL/yzKTy8VJIZjgKMi+UgucLiAlOgQJJnWsCPOlYeF6pMWEAQAKS/nlSpdHrB+ZyQTnssxggkMKwQRHQfaw/82gTffU4ezhNBVdhtqmDpypa4EgdE950sCIDf/2lTXC3uWUORoKZExwFIQJzuCxDocGo9BTAzc+PoKrGC/T6NhwRIcFo73TiYMVVrnDoQDGBEch7F1Ob1EeE5zLJ753xeUWdHQ5ZI6G/I3YpoGrpy6fIAjeVaCcpiI5McFRiIMVVnR0OREdFozRsWFyh+O3UoeFYlhYMOxdThzi1SMNkNhiYDrbNAyKeKGxhzuLk4yY4CiEuD3D9JFREARB5mj8lyAIrMOhy9Le6cDhSndSnD2Co6iDITZI3HO2AQ5nwDXLJ4VggqMQ4pUOV24Mnnj1uJcJDg3A/jILOh0uxEbokRLNrT4GY0JiBMKCtWhq78KJmia5w6EAxQRHAZxO13lD40xwBkusnyg81wAnrx6pnwpLPZ9BjqIOWpBWg0zPLuyF7CxOMmGCowAna5thae1EiE6LSUnK2vzTH01KMsGg06CxtROn65rlDof8RCELjIdU9gjxQoMJDsmDCY4CiNNTWSMiodPyn2SwgoM0yEyJBMBpKuofp9PVPYLDUdQhkS22bGCCQzLhr6kC7DnD/jdDrXsVB79c6dJO17lHUQ06DUdRh0hmSiQEAThX34rapg65w6EAxARHAbqvHDk0PlTEaQZx81KivogjfRnDOYo6VEwhOoyLiwAAFJXyQoN8j59kmdU0taOsoQ2CAO+0Cg3etJFR3qvHmqZ2ucMhhWP/G2lM81xoFHGaimTABEdmRecsANyt4SMMbA0/VIwGHdIT3FMN3LaBLkWsE5k+ktPEQ6l7JJWfQfI9JjgyE4dup3HlxpCbPpIN/+jS6prdG2wCwLQR/BwOJfEzeLDcyq1TyOeY4MhMvHLM5hfrkBOnG1iHQ30RP4Pj4sNhCuUo6lAaKW6d4nDiUIVN7nAowDDBkVFHl8O72y57bww9cbnvkUob2uy8eqTeifUh2ZyeGnKCILAOh2TDBEdGhyttsHs22Bw5LFTucFQnyWRAvFGPLqcLB8otcodDCrX3HBv8SYkrGkkuTHBkJF7RTBvB1vBSEATBW1NRVGqRNxhSpPZOBw6Wu0dRpzPBkUT31ikWuFzcOoV8hwmOjLoLjCPlDUTFuhMcDo/ThQ5VWGF3OBETzlFUqUxJNkGnFVDX3IGyhja5w6EAwgRHJi6XiwXGPiAmj/tKG3n1SBc4f3qKo6jSMOi0mJxsAgAUlnKainyHCY5MKq3tqLZ1IEgjYOrwSLnDUa1JSeLVo51Xj3SBItbf+IR4Ece94ciXmODIRBy9mZhkREiwVuZo1Mug02JSkvvqkdNUdD6Xy+WtzWL/G2l11+HwM0i+wwRHJucXGJO0WIdDvSlvbENdcwd0WsE7hULSEBOcY9VNaGrvlDkaChRMcGTCDsa+I9bhMMGh84n/PUxMNMKg4yiqlOKMBqREh8DlAorLLHKHQwGCCY4M2uwOHKl0d/Xk3L/0xBGckqomtNq7ZI6GlGKfZ3oqi6OoPsE6HPI1JjgyOFBuQZfThXijHkkmg9zhqF5SZAgSjAY4nC4c8PQ8IdrnGcHJGhEpbyABQryY28cRHPIRnyQ469evR2pqKgwGA3JyclBQUHDRY1988UVceeWViIqKQlRUFHJzcy84/vbbb4cgCD1u8+fPl/plDJnCUi5N9TVOU9H52jsdOOwZRWUdnG+II2XFpY1wOtmygaQneYLz1ltvYdWqVVi7di2KioqQkZGBvLw81NTU9Hr89u3b8aMf/QhffPEF8vPzkZKSgnnz5qGioqLHcfPnz0dVVZX39n//939Sv5QhwwJj3/MWGnMVB8Hd4K/L6UJshB7Do0LkDicgjE+IgEGnga29C6frmuUOhwKA5AnOU089heXLl2Pp0qWYOHEiXnjhBYSGhmLDhg29Hv/666/jF7/4BTIzM5Geno6XXnoJTqcTW7du7XGcXq9HQkKC9xYV5R/JQo+lqay/8Zms87ZsYMM/EkfyslIiOYrqIzqtBlOTIwFw6xTyDUkTHLvdjsLCQuTm5nY/oUaD3Nxc5Ofn9+scra2t6OzsRHR0z51+t2/fjri4OIwfPx533XUX6uvrL3qOjo4O2Gy2Hje5nK1vRUOLHcFaDSYlGWWLI9BMTjYiWKtBQ4sd5+pb5Q6HZLaPFxmyEOud9jHBIR+QNMGpq6uDw+FAfHx8j/vj4+NhNpv7dY4HHngASUlJPZKk+fPn47XXXsPWrVvx+OOP48svv8T1118Ph8PR6znWrVsHk8nkvaWkpFz+ixoksbBxcrIR+iAuTfUVfZAWk5LdCSXrcAKbexS1ewSHfKc7weFnkKSn6FVUf/zjH/Hmm29i48aNMBi6VxstWrQIN910E6ZMmYIFCxZg06ZN2LNnD7Zv397reVavXg2r1eq9lZWV+egVXGgfO6fKhg3/CACqPNukaLlNis+JU8XHq5vQ3MGWDSQtSROcmJgYaLVaVFdX97i/uroaCQkJfT72ySefxB//+Ed89tlnmDp1ap/HpqWlISYmBidPnuz17/V6PYxGY4+bXPaViUtTmeD4WnehsUXeQEhWYoI7ITGC26T4WLzRgOTIEDhd7nYZRFKSNMEJDg5GdnZ2jwJhsWB41qxZF33cE088gUceeQSbN2/G9OnTL/k85eXlqK+vR2Ji4pDELZU2uwMlVU0AgEz23vA5can4UbMNLbx6DFgcRZVXJutwyEckn6JatWoVXnzxRbz66qsoKSnBXXfdhZaWFixduhQAsGTJEqxevdp7/OOPP47f/va32LBhA1JTU2E2m2E2m9Hc7F5W2NzcjF//+tf45ptvcPbsWWzduhU333wzxowZg7y8PKlfzqAcqrTC4XQhLoIN/uSQaApBkskApwvYz6vHgFXEBn+yEuuemOCQ1IKkfoJbb70VtbW1WLNmDcxmMzIzM7F582Zv4XFpaSk0mu486/nnn4fdbscPfvCDHudZu3Ytfve730Gr1eLAgQN49dVXYbFYkJSUhHnz5uGRRx6BXq+X+uUMyvmdU7k0VR5ZI6NQeaAK+0otmD06Ru5wyMc6uhw4XMEGf3LyNvwra4TL5eJ3IUlG8gQHAFauXImVK1f2+nffLgw+e/Zsn+cKCQnBp59+OkSR+Rb3vpFfVkokPvYkOBR4DlfaYHc4ER0WjBHRoXKHE5AmJRmh0wqoa7ajvLENKfx3IIkoehWV2oi76GZyaapsxGmJ4jI2/AtE3V3EOYoqF4NOi4lJJgBc0UjSYoLjI1XWNlRZ26ERgKnDTXKHE7AmJZkQpBFQ19yBCkub3OGQj4kbPXIUVV6swyFfYILjI8WeD3J6ghGhwT6ZGaReuK8e3W0C+OUaePadY4GxEngb/nFncZIQExwf8U5P8YtVduIUYTG/XANKta0dld5R1Ei5wwloYoH3kUor2jt770BPNFhMcHzEW2DM+hvZZXqHxzn/H0jEz+C4+AiE6zmKKqfhUSGICQ9Gp8OFw5Xy7Q1I6sYExwc6HU4cqLAA4Ny/Eoj/BocqbbB3OWWOhnylu4t4pLyBEARB8H4OeaFBUmGC4wPHzE1o73TCaAhCWkyY3OEEvNRhoYgM1cHe5cRRM68eA4VYB8dVjMrAncVJakxwfEAspMtIiYRGw6WpchME4bxpKoussZBvOJwuHKywAgAyUziKqgRZKRzBIWkxwfGB7g7G/GJVChYaB5bj1U1otTsQFqzFmLhwucMhuNtlaASg0tqOalu73OGQCjHB8YFibwfjSFnjoG6c/w8sxeeNomo5iqoIYfogjIuPAMCRVJIGExyJWVrtOF3XAgDI5NJUxRD/Lc7Wt6KxxS5vMCQ51t8o0/mdxYmGGhMciYkf3FExYYgKC5Y3GPIyheq8Bd/F3Flc9bhNijJ1TxVzJJWGHhMcibH/jXJlchVHQGhq78TxmiYAbLSpNGLB98FyKxxO7g1HQ4sJjsSKvXvfRMoaB10oi4XGAeFguRUuF5AcGYK4CIPc4dB5xsSFIyxYixa7Ayc8SSjRUGGCIyGXy3Xe0DhXUCmNWGhcXNoIJ68eVWsfp6cUS6sRvNtmFHMklYYYExwJnalrgbWtE/ogDdITI+QOh75lfEIE9EEa2Nq7cKa+Re5wSCKsv1G2TBYak0SY4EhI/MBOTjZBp+VbrTQ6rQZTkk0AePWoVj1GUTlNrEjsSUVS4a+uhPbzylHxvO3iuYpDlSqt7aht6kCQRsDkJJPc4VAvxFq449VNaOnokjcYUhUmOBI6v7kYKZNYG8WrR3USR+bSEyMQEqyVNxjqVZzRgCSTAU4XcKDcKnc4pCJMcCTS3unAkSr3Ro5cIq5c4ghOSVUT2uwOeYOhISd2quYoqrKxDoekwARHIkeqbOh0uDAsLBjDo0LkDocuItFkQGyEHg6nC4crefWoNlzF6B/Y8I+kwARHIue3hhcE7n2jVOfvLM6rR3XpdDjP20E8Ut5gqE+cKiYpMMGRCJem+g/x32gfv1xV5Zi5CR1dTkQYgrzbcpAyTUk2QasRUG3rQJW1Te5wSCWY4Ehkv2d/Iy5NVT6xRmo/ExxVOb/Bn4Y7iCtaSLAW4z07i7NlAw0VJjgSaGix41x9KwB4u3SSck0ZboIgAOWNbahr7pA7HBoi3EHcv7DQmIYaExwJiCMBabFhMIXo5A2GLinCoMOY2HAAvHpUE7FglQmOf+BUMQ01JjgS4N43/oeFxupibevEqVr39hv8HPoHcar4YLkVXQ6nvMGQKjDBkYB3B3F+sfoNsRmjWDtF/u2gp2FcSnQIhoXrZY6G+mN0bDgi9EFo63TgRE2z3OGQCjDBGWIul+u8LRrYe8NfnD+Cw53F/Z84PZXBGji/odEImJri2RuOI6k0BJjgDLGz9a2wtnUimDuI+5XxCREw6DRoau/C6TruLO7v2KbBP3kvNFgLR0OACc4QE68cJycZuYO4H9FpNd7NGHn16N/O30E8i20a/Aob/tFQ8skv8Pr165GamgqDwYCcnBwUFBT0efw777yD9PR0GAwGTJkyBZ988kmPv3e5XFizZg0SExMREhKC3NxcnDhxQsqX0G/dS1M5PeVvMtkPRxUqLG2oa7YjSCNgEncQ9ysZnimq4zVNaObO4jRIkic4b731FlatWoW1a9eiqKgIGRkZyMvLQ01NTa/H79q1Cz/60Y+wbNky7Nu3DwsWLMCCBQtw6NAh7zFPPPEEnnnmGbzwwgvYvXs3wsLCkJeXh/b2dqlfziV5h8Z55eh32IdDHcR/v/TECBh03EHcn8RFGJAcGQKXCzjAgn8aJMkTnKeeegrLly/H0qVLMXHiRLzwwgsIDQ3Fhg0bej3+f/7nfzB//nz8+te/xoQJE/DII49g2rRpeO655wC4R2+efvppPPTQQ7j55psxdepUvPbaa6isrMT7778v9cvpE3cQ929iQWpJlQ3tndxZ3F+xwZ9/6x5J5ea3NDiSJjh2ux2FhYXIzc3tfkKNBrm5ucjPz+/1Mfn5+T2OB4C8vDzv8WfOnIHZbO5xjMlkQk5OzkXP2dHRAZvN1uMmhRLuIO7XhkeFICY8GF3cWdyvebdJ4TSxX+LO4v7vm9P1WP3eAXx62CxrHJImOHV1dXA4HIiPj+9xf3x8PMzm3l+42Wzu83jxfwdyznXr1sFkMnlvKSkpl/V6LkUcGs/gDuJ+qefO4kxw/FHPHcRZf+OPMth00+/tOF6L/ysow9aSalnjCIhlPqtXr4bVavXeysrKJHmeGanRuOc7Y3BzZpIk5yfpsaOxfztmbkJ7p7iDeLjc4dBl4M7i/q9YIb3ggqQ8eUxMDLRaLaqre2Zx1dXVSEhI6PUxCQkJfR4v/m91dTUSExN7HJOZmdnrOfV6PfR66buZTk42YXIyrxr9WQaHx/2adxR1OHcQ91fizuJHqmzYX2ZBoonT/f7E6XThQLk4ihopayySjuAEBwcjOzsbW7du9d7ndDqxdetWzJo1q9fHzJo1q8fxALBlyxbv8aNGjUJCQkKPY2w2G3bv3n3RcxL1l7j7e1lDG+q5s7jf2c8Gf6qQwY03/dap2mY0d3QhRKfFuHh5R1Eln6JatWoVXnzxRbz66qsoKSnBXXfdhZaWFixduhQAsGTJEqxevdp7/K9+9Sts3rwZf/7zn3H06FH87ne/w969e7Fy5UoA7jqJe++9F3/4wx/w4Ycf4uDBg1iyZAmSkpKwYMECqV8OqZwpRIfRsWEAuC+VPzq/Do78VxY7GvstMSmdMtyEIJmb3Uo6RQUAt956K2pra7FmzRqYzWZkZmZi8+bN3iLh0tJSaDTdb8Ls2bPxxhtv4KGHHsJvfvMbjB07Fu+//z4mT57sPeb+++9HS0sLVqxYAYvFgrlz52Lz5s0wGAxSvxwKABkpkThV24LiUgu+kx5/6QeQIjS1d+JkrXuTRo7g+DexJ9XBCiscThe0nG70G0raJkXyBAcAVq5c6R2B+bbt27dfcN/ChQuxcOHCi55PEAQ8/PDDePjhh4cqRCKvrJRIvFdUweFxP3Ow3AqXC0iODEFsBHcQ92ejY8MRrg9Cc0cXTtQ0IT3BKHdI1E9K6kMVEKuoiAZCrPzfz53F/co+BV050uBoNQKmeBZscJrKf7TZHThW3QRAGZ9DJjhE35KeGAF9kAa29i6cqefO4v5CSUPjNHjcOsX/HKp0TynGReiRaJK/ZIQJDtG36LQa73J/Xj36h/N3EOc+cOrAnlT+5/zpKSU0u2WCQ9QLfrn6lyprO2qbOqDVCJjMHcRVQVxJdby6CS3cWdwvKG0VIxMcol4wwfEv4r/T+PgIhARzB3E1iDMakGgywOmCd/sNUjbxc6iUzaaZ4BD1QkxwuLO4f+D0lDrxQsN/1DZ1oMLSBkFw98BRAiY4RL3gzuL+ZV+pe2sNpVw50tAQE5z9THAUT0xCx8aFI8KgkzcYDyY4RL04f2fxfSw0VrTzdxDP4giOqnBncf8h7t+npFWMTHCILoLD4/6BO4ir15RkEzSCu4i82tYudzjUB6XsIH4+JjhEFyF+UJngKBt3EFevMH0QxsVHAOBIqpI5nS4cKHOPomakKKP+BmCCQ3RRU1NMEASgvLENddxZXLHY4E/dstjwT/FO1zWjybOD+HhPQqoETHCILsJo0GF0rHvKgw3/lMu7NJX1N6qU5RlJFQvJSXnE0bUpyfLvIH4+5URCpECsw1E2a1snTtZwB3E1+/bO4qQ8Sm3TwASHqA/eZarlFlnjoN4d8Py7pESHYFg4dxBXI3Fn8Va7A8c9GzmSsih1mpgJDlEfzh/B4c7iytO9941yVm7Q0NJqBG/hKguNlae904GjZnfiqZQtGkRMcIj6kJ4QAYNOg6b2Lpyu487iSqPUK0caWt0XGqzDURpx6jAuQo8kBewgfj4mOER9CNJqMEXcWZx1OIpy/g7iLDBWt+5CY4u8gdAFvF3ERyhjB/HzMcEhugRePSpTeWMb6lvs0GkFTEw0yh0OSUgsXj1Z2wxbe6e8wVAPSmzwJ2KCQ3QJbPinTPs8/x4TE40w6LiDuJrFhOsxPCoELhe8DeVIGcRRNSWOojLBIboE8erxaFUT2uzcWVwpxKFx1t8EhqwR4oUGR1KVwmxtR5W1HRoBmKqQHcTPxwSH6BKSTAbERejR5XThEHcWVwyl9t4gabAnlfKIyeb4BCNCg4NkjuZCTHCILkEQBO/wK7upKoO9y4nDlTYA3QWopG7dn0ELXC62bFACJU9PAUxwiPpFHB7nKg5lKKmywd7lRFSoDiOHhcodDvnAxEQjdFoB9S12lDe2yR0O4bwER6HTxExwiPpB/AAzwVEG7w7iKcpbmkrSMOi03tVyRRxJlV2nw4kDFRYA3ReASsMEh6gfpgw3QasRYLa1o8rKq0e5scFfYOouNLbIGwjhmLkJ7Z1ORBiCkBYTJnc4vWKCQ9QPocFBSE+IAMBRHCXgCqrAxEJj5dh33kWGRqPMUVQmOET9xEJjZWhoseNsfSsAFhgHGvEzeLjCho4utmyQU3cHY+V+BpngEPUT28Urg/jFOjo2DKZQnczRkC+NiA5FdFgw7A4nSqq4s7icihVeYAwwwSHqN/Hq8WCFFfYup7zBBDAxwZym4CtHkoYgCMgYLu4szpFUuVha7d7Nh5U8TcwEh6ifRsWEwRSiQ0eXE0fNNrnDCVhFfjA0TtJhobH8xPd+VEwYosKC5Q2mD0xwiPqpZ8M/i6yxBCqH04X9ni/XaSMjZY2F5JHJlg2yE997JY/eABInOA0NDVi8eDGMRiMiIyOxbNkyNDc393n8Pffcg/HjxyMkJAQjRozAL3/5S1itPdvjC4Jwwe3NN9+U8qUQATi/DofD43I4Xt2EFrsD4fogjI2LkDsckkHmiEgIAlDa0Iq65g65wwlI4goqpXYwFkma4CxevBiHDx/Gli1bsGnTJuzYsQMrVqy46PGVlZWorKzEk08+iUOHDuGVV17B5s2bsWzZsguO/fvf/46qqirvbcGCBRK+EiI37wgOh8dlIV45ZqS4+xJR4DEadBgbFw4AKDrHCw1fc543iqr0VYyS7Y5VUlKCzZs3Y8+ePZg+fToA4Nlnn8UNN9yAJ598EklJSRc8ZvLkyXj33Xe9fx49ejQeffRR3Hbbbejq6kJQUHe4kZGRSEhIkCp8ol6JV4/n6ltR39yBYeF6uUMKKN76G4V/sZK0po2IwvHqZhSVWjBvEn8HfOlMfQusbZ3QB2mQnqjsUVTJRnDy8/MRGRnpTW4AIDc3FxqNBrt37+73eaxWK4xGY4/kBgDuvvtuxMTEYObMmdiwYUOfm691dHTAZrP1uBFdDqNBhzGx7qtHFjn6njg1yPqbwCauoOOWDb4njqJOSTZBp1V2Ga9k0ZnNZsTFxfW4LygoCNHR0TCbzf06R11dHR555JELprUefvhhvP3229iyZQtuueUW/OIXv8Czzz570fOsW7cOJpPJe0tJSRn4CyLyYKGxPCytdpyqFZemcgQnkIkJ7oFyCzodbNngS/7URXzACc6DDz7Ya5Hv+bejR48OOjCbzYYbb7wREydOxO9+97sef/fb3/4Wc+bMQVZWFh544AHcf//9+NOf/nTRc61evRpWq9V7KysrG3R8FLi8O4uX8erRl85fmhqt4KWpJL20mHAYDUFo73TiKBv++VSR58Iue6TyLzIGXINz33334fbbb+/zmLS0NCQkJKCmpqbH/V1dXWhoaLhk7UxTUxPmz5+PiIgIbNy4ETpd391Kc3Jy8Mgjj6CjowN6/YU1EXq9vtf7iS6HOIJTXGqBw+lisauPFPlB51TyDY1GQNaIKHx5vBZFpY2Y4mn+R9Jq7ujCMU8PsGlqTHBiY2MRGxt7yeNmzZoFi8WCwsJCZGdnAwC2bdsGp9OJnJyciz7OZrMhLy8Per0eH374IQwGwyWfq7i4GFFRUUxiyCfGxkUgLFiLFrsDJ2qakJ5glDukgODd+8YPvlhJetPOS3B+OjtV7nACwv4yC5wuIDkyBPHGS/82y02yGpwJEyZg/vz5WL58OQoKCrBz506sXLkSixYt8q6gqqioQHp6OgoKCgC4k5t58+ahpaUFL7/8Mmw2G8xmM8xmMxwO98ZqH330EV566SUcOnQIJ0+exPPPP4/HHnsM99xzj1QvhagHrUZABpuN+ZTT6fJOUXEEh4DuOhwWGvtOoWdZvj9MTwESLhMHgNdffx0rV67EddddB41Gg1tuuQXPPPOM9+87Oztx7NgxtLa6dwYuKiryrrAaM2ZMj3OdOXMGqamp0Ol0WL9+Pf7zP/8TLpcLY8aMwVNPPYXly5dL+VKIesgaEYldp+pRdK4RP5o5Qu5wVO9UbTOa2rsQotMiPUHZS1PJNzJT3C0byhraUNPUjrgI5Y8o+DsxwZmm8AZ/IkkTnOjoaLzxxhsX/fvU1NQey7uvueaaPpd7A8D8+fMxf/78IYuR6HJwmapvie/z1OEmBCl8aSr5RoRBh3FxEThW3YSicxbMn8x+OFJyOl3eaeLskdEyR9M//KYgugziSqpTtS1obLHLHI36eXcQ95OhcfINcZqKW6dI71RtM2ztXTDolN/gT8QEh+gyRIcFIy02DACXi/tCdwfjSHkDIUXJ4kiqz4jvccbwSMU3+BP5R5RECjTdM5qw9yy/XKVka+/EiRr3Jr3iDxoR0D1VfKDcCnsXG/5Jyd8KjAEmOESXTfygF3LDP0ntL7PA5QJSokMQG8FWENQtLSYMphAdOrqcKKniFjxS6i4wZoJDpHpigrOf7eIlJY6Q+dMXK/mGu+FfJABOU0np/G1S/KkOjgkO0WVKiwmHKUSH9k5ePUpJvHKc7kdfrOQ73SsaLfIGomJikb+/bZPCBIfoMmk0gncUh3U40nD44dJU8i1vgsOpYsmIo2P+NorKBIdoELx1OBwel8RRsw0tdgci9EEYzwZ/1IuMFBMEAaiwtKHG1i53OKrkjwXGABMcokHh1aO0xC/WzBGR3NSUehVh0GF8vDv5ZR3O0OtyOL3bpIh9h/wFExyiQchIMUGrEVBlbUelpU3ucFRHnPqbzukp6gOniqVzrLoJrZ5R1LFx/jWKygSHaBBCg4MwKcm9m/hejuIMOW+Bcap/DY2Tb4n/ffAzOPSK/HgUlQkO0SBxmkoaVdY2VFjaoNUIyGQHY+qDOMJ3qMKKNrtD5mjURVyd5m8FxgATHKJBY8M/aYjTDRMSIxCml3RfYPJzw6NCkGA0oMvp8taL0NDw1wJjgAkO0aCJH/wjVTa02rtkjkY9uvvfsP6G+iYIArLFaaqzDTJHox61TR0obWiFILinqPwNExyiQUqKDEGSyQAHrx6H1N5z7h8qf7xyJN+bMZJ1OENNTBbHxUXAaNDJHM3AMcEhGgJi+3LW4QyNlo4ulFQ1AWCBMfXP9FT3SF/RuUY4nC6Zo1GHPZ5p4hmj/PMzyASHaAiwDmdoFZdZ4HC6kBwZgkRTiNzhkB9IT4hAWLAWTR1dOGZukjscVdjjGcGZkeqf08RMcIiGgJjgFJVa4OTV46CJBcacnqL+CtJqvCOphedYhzNYzR1dOFxpBQDMHMUEhyhgTUg0IkSnhbWtE6dqm+UOx++J9TecnqKBEAvS97Dh36DtK22E0wW/HkVlgkM0BHRajbdXSwFXcQyKe4NNCwCO4NDATOdKqiGz54z7PfTX0RuACQ7RkBG/CMQvBro8x8xNaO7oQrg+COkJRrnDIT+SmeLutltpbUcFt04ZFHEUzJ9HUZngEA0RMcEpYIIzKGL9RJYftoYneYXpz9s6haM4l83e5cS+MneCM9NPC4wBJjhEQyZrRCSCPFeP5Y2tcofjt/b6cedUkh833hy8w5VWtHc6ERWqw5i4cLnDuWxMcIiGSGhwECYnmwBwFGcwuIKKBkNc0syGf5dPXB6ePTIaguC/o6hMcIiGUI5Yh8Ph8ctS3tjq3WDTHzf3I/lN9yTGR8022No7ZY7GPxWc8UxP+WmDPxETHKIhJF497uYIzmURR74mJ5u4wSZdljijASOiQ+FysbP45XA6Xd46uOl+XH8DMMEhGlIzUqMhCMDp2hbUNnXIHY7fEROcK/x4aSrJr3u5OBOcgTpV24zG1k4YdBpMTjLJHc6gMMEhGkKmUB3Gx0cA4CqOy7FbBb03SH7ddTj8DA6UuDw8KyUKwUH+nSL4d/RECiT+OHOaamBqbO04U9cCQfD/oXGS1wzPCM6+Ugs6uhwyR+Nfuvef8u/6G4AJDtGQE68eWWg8MGJCODHRCFOITuZoyJ+Njg3HsLBgdHQ5caDcKnc4fsWb4KhgFJUJDtEQE0dwjlRxFcdA7D5TD4DTUzR4giAgJ83939E3p+pljsZ/VFnbUN7YBo0AZKlgFaOkCU5DQwMWL14Mo9GIyMhILFu2DM3NfW9EeM0110AQhB63O++8s8cxpaWluPHGGxEaGoq4uDj8+te/RldXl5Qvhajf4o0GjBzmXsVRyFUc/SYWGOeMGiZzJKQGV6S5/zviVHH/iZ/BSUkmhKtgFaOkr2Dx4sWoqqrCli1b0NnZiaVLl2LFihV44403+nzc8uXL8fDDD3v/HBoa6v3/DocDN954IxISErBr1y5UVVVhyZIl0Ol0eOyxxyR7LUQDMTM1GufqW1FwpgHXjo+TOxzFa2ix43i1++KHIzg0FMQEZ++5Bti7nH5fMOsL4qqzGSqpgZPsX7ykpASbN2/GSy+9hJycHMydOxfPPvss3nzzTVRWVvb52NDQUCQkJHhvRmP3hnufffYZjhw5gn/+85/IzMzE9ddfj0ceeQTr16+H3W6X6uUQDcgMbrw5IOKV47j4cESHBcscDanB2Dj3f0vtnU4cKLfIHY5f+Oa0ezpPDQXGgIQJTn5+PiIjIzF9+nTvfbm5udBoNNi9e3efj3399dcRExODyZMnY/Xq1Wht7d7XJz8/H1OmTEF8fLz3vry8PNhsNhw+fLjX83V0dMBms/W4EUlJ7Gi8v9yC9k6u4rgUsf6G01M0VARB8H4OxR9uurjapg6cqHGPouakqeNzKFmCYzabERfXc2g+KCgI0dHRMJvNF33cj3/8Y/zzn//EF198gdWrV+Mf//gHbrvtth7nPT+5AeD988XOu27dOphMJu8tJSXlcl8WUb+MiA5FXIQenQ4XissscoejeAXsf0MSEKepvjnNkdRLEZPA9IQI1YyiDjjBefDBBy8oAv727ejRo5cd0IoVK5CXl4cpU6Zg8eLFeO2117Bx40acOnXqss+5evVqWK1W762srOyyz0XUH4IgeH+sufFm36xtnThS5R5VFVe+EA0FMcEpPNcIe5dT5miULd+T4MwarY7RG+Ayiozvu+8+3H777X0ek5aWhoSEBNTU1PS4v6urCw0NDUhISOj38+Xk5AAATp48idGjRyMhIQEFBQU9jqmurgaAi55Xr9dDr9f3+zmJhsLMUdHYdKDKM/0yVu5wFGvv2Qa4XEBaTBjiIgxyh0MqMjYuHFGhOjS2duJghQXZI5lAX4y4nH6WSqangMtIcGJjYxEbG3vJ42bNmgWLxYLCwkJkZ2cDALZt2wan0+lNWvqjuLgYAJCYmOg976OPPoqamhrvFNiWLVtgNBoxceLEAb4aIumcf/XY0eWAPkgrc0TKxOkpkopGIyBn1DBsPmzGN6cbmOBcRLWtHac9XcTVVAcnWQ3OhAkTMH/+fCxfvhwFBQXYuXMnVq5ciUWLFiEpKQkAUFFRgfT0dO+IzKlTp/DII4+gsLAQZ8+exYcffoglS5bgqquuwtSpUwEA8+bNw8SJE/GTn/wE+/fvx6effoqHHnoId999N0dpSFHGxoUjJlyP9k4n9pVa5A5Hsb4R+99weookcEUaC40vJd8zejMpyQhTqHq6iEvaGOD1119Heno6rrvuOtxwww2YO3cu/va3v3n/vrOzE8eOHfOukgoODsbnn3+OefPmIT09Hffddx9uueUWfPTRR97HaLVabNq0CVqtFrNmzcJtt92GJUuW9OibQ6QEgiBgtmc+e9fJOpmjUaaWji4cqnC30p+poitHUo4rPJ/BvWcb0elgHU5v8lU4PQVI3OgvOjq6z6Z+qampcLlc3j+npKTgyy+/vOR5R44ciU8++WRIYiSS0uzRw/Dh/krsOlWPVXIHo0CF5xrhcLowPCoEyZEhcodDKjQuLgKRoTpYWjtxoNyK7JHq6PEylL45o74CY4B7URFJas6YGABAcZkFLR3cTuTbxJUbapr3J2Vx1+FwmupiKi1tOFffCq1GUE0HYxETHCIJpUSHYnhUCLqcLhRwd/ELiFN3c8YwwSHpdPfDYYLzbeL01JRkEyIM6qm/AZjgEEluzmj3KE4+dzXuwdraiQOe+htxpItICuevaGQdTk9q7H8jYoJDJLHZntGJnSw07iH/dB1cLvdqs3gj+9+QdMbHu+twWu0OHPQk1eSm1gJjgAkOkeTEL44jVTY0tnBDWNHX3ukpjt6QtDQaATM99SUcSe1W1tCKCksbdFoB01Wyweb5mOAQSSzOaMDYuHC4XN2bShKw86T7vZjLBId8QEykvz7BkVSRmOxlDI9EaLCki6plwQSHyAfEfjjij3qgK29sxZm6Fmg1Ahv8kU/MHetOcArPNaLVzhWNgLrrbwAmOEQ+Mdtz9bjrFK8eAWCXJ9HLTIlU3coNUqa0mDAkR4bA7nBiNzfAhcvlUnX9DcAEh8gnrhg1DBoBOFXbArO1Xe5wZMf6G/I1QRBwpWcU56vjvNA4W98Ks60dwVoNpqm0+SETHCIfMIXqMDnZBMC9eiiQOZ0u74qyOSodGidlEqepvj5ZK3Mk8vv6hPs9mDYyEgadOjcCZoJD5COzvPtSBXYdzrHqJtS32BGi0yJrhDqvHEmZ5oyOgSAAx6ubA34k9cvj7gTnqnGxMkciHSY4RD4iNvzbdaq+xx5sgUYcvclJi0ZwEL+CyHeiwoIxxTOS+nUA96Wydzmxy1N/czUTHCIarOmpUdBpBVRY2lDa0Cp3OLIRf1i4PJzk4K3DORG401R7zzWg1e5ATLgeExKMcocjGSY4RD4SGhzknZLZEaC9OOxdTuw+7V7BwgJjksOVY90jFl+fqIPTGZgjqTs8RdZXjY2BRiPIHI10mOAQ+ZA4HPzlsRqZI5HHvtJGtHU6EBMejPHxEXKHQwFo2ogohAZrUd9iR4nZJnc4shDrb64er97pKYAJDpFPXeP5Qtl5sh4dXQ6Zo/E9sf5m9mh1XzmScgUHabybb34VgCOpNU3tKKmyQRDUP03MBIfIhyYmGhEXoUdbpwMFAdhsjPU3pARiHU4gbtsg9gCakmzCsHC9zNFIiwkOkQ8JguAdxdl+LLCKHK2tndhf7t7JWdxhnUgOYoJTcLYBbfbAGkn1Lg8fq+7pKYAJDpHPXTs+DgDwRYDV4Xx5ohYOpwtj48IxPCpU7nAogI2ODUeiyQB7lxMFZwNnJNXhdHlXj6m5/42ICQ6Rj80ZG4MgjYDTtS0orQ+c5eLbSqoBAN+ZECdzJBToBEHwTpN+HUDLxQ9VWNHY2okIfRCyRkTKHY7kmOAQ+ZjRoPPu/bL9eGCM4jicLmz3DI1/ZzwTHJLflZ4RjEAqNN7h+QzOHjMMOq36f/7V/wqJFEicpgqUOpx9pY2wtHbCaAhCtko39iP/MneMe9uGo+amgNm2wbs8fFxgXGQwwSGSgVhovOtUHdo71V/kuO2oe6TqmvFxCAqAK0dSvuiwYGSmRAIAth6tljcYH7C1d2JfmQUAcNW4wFjFyG8aIhmkJ0QgwWhAe6cTuwNgubiY4HwnPTCuHMk/5E6IBwB8fkT9Cc6uk3VwOF1Iiw0LmCJ/JjhEMui5XFzddTgVljYcNTdBI6h7Yz/yP9+d6E5wdp6qR0tHl8zRSKt7eipwPoNMcIhkEij9cMTRm+yRUYgKC5Y5GqJuY+PCMSI6FPYup6qLjZ1OF744GjjLw0VMcIhkMmeMe7n4mboWnKtvkTscyYjLw6/l9BQpjCAI3dNUJeqdpjpYYYXZ1o6wYC1mpQVOk00mOEQyiTDoMD3Vs1xcpaM4bXYHdp2qBwBclx4vczREF8qd6E68tx2tgUOlu4t/etgMwF3kb9BpZY7Gd5jgEMlI7V2Nd52qQ0eXE8mRIRgXHy53OEQXmJEaDaMhCA0tduwrbZQ7HEmICc68SYF1kcEEh0hG4rTNrlP1aGrvlDmaoXf+6ilB4O7hpDw6rcb7OdyiwmmqkzXNOFXbAp1WCLhpYiY4RDIaGxeOtJgw2Luc3mRALVwuV3eCw+0ZSMHUvFz8syPu0ZtZo2NgNOhkjsa3JE1wGhoasHjxYhiNRkRGRmLZsmVobm6+6PFnz56FIAi93t555x3vcb39/ZtvvinlSyGShCAIuH5KAgBg8yGzzNEMraPmJlRZ22HQaQKqsJH8z9XjYxGkEXCqtgWnay/+G+WPPj3sTtryAmx6CpA4wVm8eDEOHz6MLVu2YNOmTdixYwdWrFhx0eNTUlJQVVXV4/b73/8e4eHhuP7663sc+/e//73HcQsWLJDypRBJ5vrJiQDcdTitdvX04tjqGe6fOyYmoAobyf8YDTpc4UnCt5aoZyTVbG3H/jILBKG7508gkSzBKSkpwebNm/HSSy8hJycHc+fOxbPPPos333wTlZWVvT5Gq9UiISGhx23jxo344Q9/iPDwngWKkZGRPY4zGAxSvRQiSU1KMiIlOgTtnU58qaLVVB8fdI9IicP/REqWO0F9dThbPNNTWSmRiIsIvN9IyRKc/Px8REZGYvr06d77cnNzodFosHv37n6do7CwEMXFxVi2bNkFf3f33XcjJiYGM2fOxIYNG+ByXXx5X0dHB2w2W48bkVIIgoAbPKM4n6hkmupUbTNKqmwI0giYPzlB7nCILuk6TyK+92wDGlvsMkczNLqnpwLzMyhZgmM2mxEX17OwMCgoCNHR0TCb+/cl/vLLL2PChAmYPXt2j/sffvhhvP3229iyZQtuueUW/OIXv8Czzz570fOsW7cOJpPJe0tJSRn4CyKSkJgEbCupVsXmmx8fqAIAzB0bg8hQdi8m5UuJDkV6QgScLnW0bbC2duKb0+4eVPOY4PTPgw8+eNFCYPF29OjRQQfW1taGN954o9fRm9/+9reYM2cOsrKy8MADD+D+++/Hn/70p4uea/Xq1bBard5bWVnZoOMjGkqZKZFIMhnQYneoomX8pgPuaejvTU2SORKi/hPrVD456P8jqduOVaPL6cK4+HCMigmTOxxZDDjBue+++1BSUtLnLS0tDQkJCaip6ZkFd3V1oaGhAQkJl84m//Wvf6G1tRVLliy55LE5OTkoLy9HR0dHr3+v1+thNBp73IiURBAE5HlGcf59qErmaAbneHUTjlc3I1irCcjCRvJfYkL+5fEaWFv9uy/VZwE+PQUAQQN9QGxsLGJjL71Z16xZs2CxWFBYWIjs7GwAwLZt2+B0OpGTk3PJx7/88su46aab+vVcxcXFiIqKgl6vv/QLIFKoG6Yk4u87z2LLkWrYu5wIDvLPNlWb9rtHb64aFwNTSGD13SD/Nj4hAukJEThqbsK/D1Vh0cwRcod0Wdo7Hd7tX+ZNDNwER7Jv0AkTJmD+/PlYvnw5CgoKsHPnTqxcuRKLFi1CUpI7S66oqEB6ejoKCgp6PPbkyZPYsWMH7rjjjgvO+9FHH+Gll17CoUOHcPLkSTz//PN47LHHcM8990j1Uoh8IntEFGIj9Ghq78KuU/45TeVyubDJU3/D6SnyRzdnJgMA3i+ukDmSy7fjeC3aOh1IjgzB5OTAnbGQ9BLx9ddfR3p6Oq677jrccMMNmDt3Lv72t795/76zsxPHjh1Da2trj8dt2LABw4cPx7x58y44p06nw/r16zFr1ixkZmbir3/9K5566imsXbtWypdCJDmNRsB8z3Dyv/20BqCkqgmn61oQHKRBLqenyA99P8O9onH3mQZUWdtkjubyiMnZ/MkJAb1FiuDqa321StlsNphMJlitVtbjkKLsOlWHH7+4G1GhOuz571wEaf1rmuqJzUfxv9tPIW9SPP76k+mXfgCRAi18YRf2nG3Ef98wAcuvSpM7nAGxtNox89GtsDuc+OSXV2Jikrp+4wby++1f355EKjczNRrRYcFobO3EN6cb5A5nQDg9RWrhz9NUmw5Uwe5wIj0hQnXJzUAxwSFSkCCtxrvq4b195TJHMzAHK6wobWhFiE6L67i5JvmxG6YkIkgj4HClDSdrmuQOZ0DeK3J/b/wge7jMkciPCQ6Rwiyc7v5i+uRgFWzt/rNUVWzu950JcQgNHvACTSLFiA4LxlXj3Ct4PyzufWshJTpd24yiUgs0AnBTJkdRmeAQKUxWSiTGxoWjvdOJTfv9oydOj+mpKYkyR0M0eDd7EoT3iyv73ApISTbuc0+pXTUuNiD3nvo2JjhECiMIAn443b2dyFt7/aPrdv7pelRY2hAWrMW16ZyeIv/33YnxCNFpUdrQiuIyi9zhXJLT6cJ7Re4E55ZpnJ4CmOAQKdJ/TEtGkEbA/jILjpmVXwPwxu5SAMCCrGQYdFqZoyEavNDgIMyb5G518IEfTFPtPtOACksbIvRB7CDuwQSHSIFiwvXI9exu/NYeZY/i1DZ14NPD7r49P87xz86vRL1Z4FlNtelAJbocTpmj6ZtYXHzj1EReZHgwwSFSqB/OcA8zb9xXjo4u5e4w/k5hGTodLmSmRGJSkknucIiGzNyxMYgOC0Zdsx1bjyp3h/E2uwOfHHTXwN3C1VNeTHCIFOqqsbGIN+rR2NqJrSXK/HJ1Ol3e6anFHL0hldFpNbh1hrse7tVdZ+UNpg+fHjajxe5ASnQIpo+MkjscxWCCQ6RQQVqNt5eFUqepdpyoRXljG4yGIDb3I1W67YqR0AjArlP1iq2He9czPfX/soYH9NYM38YEh0jBFma7rx53nKhFpUV5++KIoze3ZA9HSDDn/Ul9kiNDvDtyv5p/Vt5genGqthlfnaiDIHD11LcxwSFSsNSYMOSMiobLBfyrUFmdjausbd66BE5PkZrdPicVALCxqALWVmU133zpqzMAgOvS4zFiWKjM0SgLExwihRNrAN7eW6aolRxv7SmDw+nCzFHRGBMXIXc4RJLJGRWN9IQItHU68LaCelPVNXd4p6dW+NmmoL7ABIdI4a6fnIioUB3KG9vw8UFldDbucjjxZoH7i56jN6R2giDg9tmpAIDXvjkLh1MZnY1fyz8He5cTGSmRmJHK4uJvY4JDpHAhwVosnTMKAPC/X5yCUwFfrtuO1sBsa0d0WDDmT06QOxwiyd2cmQxTiA5lDW34QgFLxtvsDvzzm3MAgBVXprG4uBdMcIj8wE9npyJCH4Rj1U34vKRa1lhcLhde+to9778wezj0QSwuJvULCdZikWe6+BUFLBl/t6gcDS12pESHIG8SOxf3hgkOkR8whejwk1kjAQDPfXFS1s3/dp6sR8GZBgRrNfipZ9ieKBCIS8a/PlmHE9XyLRl3OF142XORsWzOKARp+VPeG74rRH5i2dxRMOg0OFBuxVcn6mSJweVy4cnPjgFwb8uQFBkiSxxEckiJDvVuobJh51nZ4vi8pBpn6lpgNARhoWdjXroQExwiPzEsXI8fzXQX9D73xUlZYvjiWA2Kyyww6DT4xbWjZYmBSE53XOlerfTO3jKcqm2WJYaXvjoNwD2iFKYPkiUGf8AEh8iPrLgqDTqtgIIzDdhztsGnz+1yufDnz44DcNcExUUYfPr8REowc1Q0rkuPQ5fThcf/fdTnz19U2og9Zxuh03av7KLeMcEh8iOJphD8wNPd+Lltvh3F+fSwGYcrbQgL1uLnV3H0hgLX6hvSodUI+OxINQrO+O5Cw+Vy4bGPSwC4dzqPM/Iioy9McIj8zF1Xj4ZWI+DL47U4UG7xyXM6nC48tcU9erNs7ihEhwX75HmJlGhMXIS3AeejHx/xWeuG94oqsPdcI0KDtVg1b5xPntOfMcEh8jMjhoXipgz3xpa//+iIT5qObTpQiePVzTAagrDsSnZMJbo3dyzCgrXYX27FJh804LS1d2KdZ0rsnu+MRaKJBf6XwgSHyA/9V954hAVrUXiuEa9JvAFgl8OJpz8/AQD4+dWjYQrRSfp8RP4gLsKAn1/tnqp9YvNRdHQ5JH2+v2w5jrrmDqTFhmHZ3FGSPpdaMMEh8kPJkSF48IYJAIAnNh9DWUOrZM/1zLaTOFPXguiwYBY1Ep3njitHId6oR3ljG17bdU6y5ympsuFVT3PB3980CcFB/OnuD75LRH5q8cwRyBkVjbZOBx5874Akzf8KzjTguW3u0Zvf3TSJS1KJzhMaHIT75o0HADy77QTqmjuG/DlcLhfWfHAIThdww5QEXDk2dsifQ62Y4BD5KY1GwOO3TIVBp8HOk/V4a8/Q7nJsbe3EvW/ug9MF/CB7uLfuh4i63TJtOCYkGmFr78LKN4rQ6XAO6fk37qvAnrONCNFp8dCNE4f03GrHBIfIj6XGhOG+77qvIB/9uARma/uQnNflcmH1xgOotLYjdVgofnfTpCE5L5HaaDUCnlmUibBgLb453YDHPikZsnOXNbTiUc+y8JXfGcPO4QPEBIfIz/1s7ihkpESiqaMLv9l4cEiWrL6ztxyfHDQjSCPgfxZlIZxTU0QXNTY+An/+YSYA4O87z+LdwvJBn7O+uQNLNhSgvsWO9IQI3HElC4sHigkOkZ/TagT86QdTodMK2Ha0Bv/1r/3oGsQw+anaZqz98DAA92qtjJTIIYqUSL3mT07AL78zBgCweuPBQfWoaunows9e2YMzdS1IjgzBK0tnQh+kHaJIAwcTHCIVGOe5gtRqBLxXVIFfvVkMe9fAk5zDlVYsebkAbZ0OzB49DCvY84ao3+7NHYfr0uNg73Li5/8oRG3TwIuO7V1O3PnPQuwvtyIqVIfXls1Egokdiy+HZAnOo48+itmzZyM0NBSRkZH9eozL5cKaNWuQmJiIkJAQ5Obm4sSJEz2OaWhowOLFi2E0GhEZGYlly5ahuVmeDc+IlOSmjCT87+JpCNZq8PHBKtz5z0K0d/a/N8fHB6rwg+fzUWFpQ+qwUPzl1kxoNIKEEROpi0Yj4C+LMpEWE4YqazsWv/QNDlVY+/14p9OF+/+1H1+dqEOITou/L52J0bHhEkasbpIlOHa7HQsXLsRdd93V78c88cQTeOaZZ/DCCy9g9+7dCAsLQ15eHtrbuwsnFy9ejMOHD2PLli3YtGkTduzYgRUrVkjxEoj8Tt6kBLz40+nQB2mw7WgNlr26B03tnX0+xul04clPj+HuN4rQ1unAVeNi8cHdcxHPfW6IBsxo0OFvS7IREx6M49XNuHn9Tjz12bFLjqgWlTZi8Uu78X5xJYI0Ap6/bRoyOT08KIJLiuYZ53nllVdw7733wmKx9Hmcy+VCUlIS7rvvPvzXf/0XAMBqtSI+Ph6vvPIKFi1ahJKSEkycOBF79uzB9OnTAQCbN2/GDTfcgPLyciQl9W8Zq81mg8lkgtVqhdFoHNTrI1Ki/FP1WPbqHrTaHQgN1uL6yYm4JTsZV4wa5h2VqbS0oai0Ee/sLceXx2sBAD+/Kg33z3dvJEhEl6++uQNrPjiMjz3bOKQnRODxW6ZiSrKpx8jo4Uor/vzZcWw7WgMA0GkFPLkwAzdnJssSt9IN5PdbMUsjzpw5A7PZjNzcXO99JpMJOTk5yM/Px6JFi5Cfn4/IyEhvcgMAubm50Gg02L17N/7jP/6j13N3dHSgo6N7LtRms0n3QogUYNboYfjnHTm47+39OFPXgneLyvFuUTmSI0MwKcmIA+VWmG3dI6PBQRo8fssU/EfWcBmjJlKPYeF6rF88DTccqMKaDw7hqLkJN6/fCa1GgClEh8hQHUKDtThU4f490moE3DItGb+8biyGR4XKHL06KCbBMZvNAID4+Pge98fHx3v/zmw2Iy4ursffBwUFITo62ntMb9atW4ff//73QxwxkbJNGxGFbfddjcJzjXi3qByb9lehwtKGCksbAPcX6oTECEwbEYVFM0ZgYhJHM4mG2o1TE3FFWjR+99ERbDpQCYfThYYWOxpa7AAAQQC+PzUJ9+aORRrrbYbUgBKcBx98EI8//nifx5SUlCA9PX1QQQ211atXY9WqVd4/22w2pKSkyBgRkW8IgoDpqdGYnhqNtd+fhM9LqlFlacfkZBMyUkwIDVbMNQ6Rag0L1+PZH2XhyYVTYWntRGOrHY0tnbC22TEmLgJj4pjYSGFA32733Xcfbr/99j6PSUu7vGWlCQkJAIDq6mokJiZ676+urkZmZqb3mJqamh6P6+rqQkNDg/fxvdHr9dDr9ZcVF5FaGHRafG8qt1sgkos+SIt4o5YF/D4yoAQnNjYWsbHSbPQ1atQoJCQkYOvWrd6ExmazYffu3d6VWLNmzYLFYkFhYSGys7MBANu2bYPT6UROTo4kcREREZH/kWyZeGlpKYqLi1FaWgqHw4Hi4mIUFxf36FmTnp6OjRs3AnAPpd977734wx/+gA8//BAHDx7EkiVLkJSUhAULFgAAJkyYgPnz52P58uUoKCjAzp07sXLlSixatKjfK6iIiIhI/SSbgF+zZg1effVV75+zsrIAAF988QWuueYaAMCxY8dgtXY3Qbr//vvR0tKCFStWwGKxYO7cudi8eTMMhu7hvNdffx0rV67EddddB41Gg1tuuQXPPPOMVC+DiIiI/JDkfXCUiH1wiIiI/M9Afr+5FxURERGpDhMcIiIiUh0mOERERKQ6THCIiIhIdZjgEBERkeowwSEiIiLVYYJDREREqsMEh4iIiFSHCQ4RERGpjmRbNSiZ2LzZZrPJHAkRERH1l/i73Z9NGAIywWlqagIApKSkyBwJERERDVRTUxNMJlOfxwTkXlROpxOVlZWIiIiAIAiyxGCz2ZCSkoKysjLuh9ULvj8Xx/emb3x/+sb3p298fy5OCe+Ny+VCU1MTkpKSoNH0XWUTkCM4Go0Gw4cPlzsMAIDRaOSHqA98fy6O703f+P70je9P3/j+XJzc782lRm5ELDImIiIi1WGCQ0RERKrDBEcmer0ea9euhV6vlzsUReL7c3F8b/rG96dvfH/6xvfn4vztvQnIImMiIiJSN47gEBERkeowwSEiIiLVYYJDREREqsMEh4iIiFSHCY5CfPzxx8jJyUFISAiioqKwYMECuUNSnI6ODmRmZkIQBBQXF8sdjiKcPXsWy5Ytw6hRoxASEoLRo0dj7dq1sNvtcocmm/Xr1yM1NRUGgwE5OTkoKCiQOyTZrVu3DjNmzEBERATi4uKwYMECHDt2TO6wFOuPf/wjBEHAvffeK3coilFRUYHbbrsNw4YNQ0hICKZMmYK9e/fKHVafmOAowLvvvouf/OQnWLp0Kfbv34+dO3fixz/+sdxhKc7999+PpKQkucNQlKNHj8LpdOKvf/0rDh8+jL/85S944YUX8Jvf/Ebu0GTx1ltvYdWqVVi7di2KioqQkZGBvLw81NTUyB2arL788kvcfffd+Oabb7BlyxZ0dnZi3rx5aGlpkTs0xdmzZw/++te/YurUqXKHohiNjY2YM2cOdDod/v3vf+PIkSP485//jKioKLlD65uLZNXZ2elKTk52vfTSS3KHomiffPKJKz093XX48GEXANe+ffvkDkmxnnjiCdeoUaPkDkMWM2fOdN19993ePzscDldSUpJr3bp1MkalPDU1NS4Ari+//FLuUBSlqanJNXbsWNeWLVtcV199tetXv/qV3CEpwgMPPOCaO3eu3GEMGEdwZFZUVISKigpoNBpkZWUhMTER119/PQ4dOiR3aIpRXV2N5cuX4x//+AdCQ0PlDkfxrFYroqOj5Q7D5+x2OwoLC5Gbm+u9T6PRIDc3F/n5+TJGpjxWqxUAAvK/k77cfffduPHGG3v8N0TAhx9+iOnTp2PhwoWIi4tDVlYWXnzxRbnDuiQmODI7ffo0AOB3v/sdHnroIWzatAlRUVG45ppr0NDQIHN08nO5XLj99ttx5513Yvr06XKHo3gnT57Es88+i5///Odyh+JzdXV1cDgciI+P73F/fHw8zGazTFEpj9PpxL333os5c+Zg8uTJcoejGG+++SaKioqwbt06uUNRnNOnT+P555/H2LFj8emnn+Kuu+7CL3/5S7z66qtyh9YnJjgSefDBByEIQp83sX4CAP77v/8bt9xyC7Kzs/H3v/8dgiDgnXfekflVSKe/78+zzz6LpqYmrF69Wu6Qfaq/78/5KioqMH/+fCxcuBDLly+XKXJSurvvvhuHDh3Cm2++KXcoilFWVoZf/epXeP3112EwGOQOR3GcTiemTZuGxx57DFlZWVixYgWWL1+OF154Qe7Q+hQkdwBqdd999+H222/v85i0tDRUVVUBACZOnOi9X6/XIy0tDaWlpVKGKKv+vj/btm1Dfn7+BXufTJ8+HYsXL1b8FcTl6u/7I6qsrMS1116L2bNn429/+5vE0SlTTEwMtFotqqure9xfXV2NhIQEmaJSlpUrV2LTpk3YsWMHhg8fLnc4ilFYWIiamhpMmzbNe5/D4cCOHTvw3HPPoaOjA1qtVsYI5ZWYmNjjNwoAJkyYgHfffVemiPqHCY5EYmNjERsbe8njsrOzodfrcezYMcydOxcA0NnZibNnz2LkyJFShymb/r4/zzzzDP7whz94/1xZWYm8vDy89dZbyMnJkTJEWfX3/QHcIzfXXnutd/RPownMgdng4GBkZ2dj69at3jYLTqcTW7duxcqVK+UNTmYulwv33HMPNm7ciO3bt2PUqFFyh6Qo1113HQ4ePNjjvqVLlyI9PR0PPPBAQCc3ADBnzpwL2gocP35c8b9RTHBkZjQaceedd2Lt2rVISUnByJEj8ac//QkAsHDhQpmjk9+IESN6/Dk8PBwAMHr0aF6Bwp3cXHPNNRg5ciSefPJJ1NbWev8uEEctVq1ahZ/+9KeYPn06Zs6ciaeffhotLS1YunSp3KHJ6u6778Ybb7yBDz74ABEREd6aJJPJhJCQEJmjk19ERMQF9UhhYWEYNmwY65QA/Od//idmz56Nxx57DD/84Q9RUFCAv/3tb4ofLWaCowB/+tOfEBQUhJ/85Cdoa2tDTk4Otm3bpvweAyS7LVu24OTJkzh58uQFCZ/L5ZIpKvnceuutqK2txZo1a2A2m5GZmYnNmzdfUHgcaJ5//nkAwDXXXNPj/r///e+XnAolmjFjBjZu3IjVq1fj4YcfxqhRo/D0009j8eLFcofWJ8EViN+CREREpGqBOVlPREREqsYEh4iIiFSHCQ4RERGpDhMcIiIiUh0mOERERKQ6THCIiIhIdZjgEBERkeowwSEiIiLVYYJDREREqsMEh4iIiFSHCQ4RERGpDhMcIiIiUp3/D5Xdw2a+CJ8IAAAAAElFTkSuQmCC", - "text/plain": "
" - }, - "metadata": {}, - "output_type": "display_data" - } - ] - } - }, - "1fb0b48cb5b54cde8bad1a6d31f84549": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-update-cue-box" - ], - "children": [ - "IPY_MODEL_1ca66eae16024d5a9a9d6558eb929ec1" - ], - "layout": "IPY_MODEL_3ab1a9f39cd94e838daf94ad38326b7f" - } - }, - "279df2367dbd4f25a677764753cafa61": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "294d91c88b8c442dafddf264f8f1ea26": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "ButtonStyleModel", - "state": { - "font_family": null, - "font_size": null, - "font_style": null, - "font_variant": null, - "font_weight": null, - "text_color": null, - "text_decoration": null - } - }, - "3ab1a9f39cd94e838daf94ad38326b7f": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "45397eb39f5b421f9b4296714f986619": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLMathStyleModel", - "state": { - "description_width": "", - "font_size": null, - "text_color": null - } - }, - "50c42b8be33e4c8b944d744572c8dcd8": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "layout": "IPY_MODEL_e679f8d54af44dc7a092406ff96e92bc" - } - }, - "53afe92f92794ce7a739ff858fce75cb": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "59dd2c6c899841e19cdb2a70ec00a690": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLModel", - "state": { - "_dom_classes": [ - "exercise-title" - ], - "layout": "IPY_MODEL_279df2367dbd4f25a677764753cafa61", - "style": "IPY_MODEL_68302b1298c543e98f1cd00fcbbf89ab", - "value": "Sinus function" - } - }, - "65ac4e963b804fcaab15af85f6c87039": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "68302b1298c543e98f1cd00fcbbf89ab": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLStyleModel", - "state": { - "description_width": "", - "font_size": null, - "text_color": null - } - }, - "6a1af84478db4bfab8912a136711825a": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "747868e31e5d4780b2b55048c01fe546": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "7c1735f399bf4872b01b52350c77fb0a": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "7e31cfe8723c4a819466b0edd286843a": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_59dd2c6c899841e19cdb2a70ec00a690", - "IPY_MODEL_d1e88ebf0f594e44a02fd1af9c2d0a1f", - "IPY_MODEL_1fb0b48cb5b54cde8bad1a6d31f84549", - "IPY_MODEL_854b5d90c43a4dee9ba5063b302fe40b", - "IPY_MODEL_b1e118dbc3ed4ccba69dcaed9636f265", - "IPY_MODEL_f49927e0f8db47a4b5ef1071808be113", - "IPY_MODEL_1d8967665a914934ac2833f937754d11" - ], - "layout": "IPY_MODEL_b6e5367fc7e148eca425e194283fbd0e" - } - }, - "854b5d90c43a4dee9ba5063b302fe40b": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "scwidget-update-cue-box" - ], - "children": [ - "IPY_MODEL_e8a656cbbf9d4dc7a09de6f2c3e07617" - ], - "layout": "IPY_MODEL_ab2f5e6784794e7fba6eaab012e0ba86" - } - }, - "8ff9770ecfe448ec88acc8a9037a90a9": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "_dom_classes": [ - "widget-interact" - ], - "children": [ - "IPY_MODEL_bfad22c034bd4cc3be8654a961666c5c", - "IPY_MODEL_50c42b8be33e4c8b944d744572c8dcd8" - ], - "layout": "IPY_MODEL_ee0d9674a2e0497cb607a22a15a66a3d" - } - }, - "99441db1e62645bb92c89e656bf87dcc": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "9a30ded6ec8840049d6aa9d487e12e7f": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "SliderStyleModel", - "state": { - "description_width": "" - } - }, - "ab2f5e6784794e7fba6eaab012e0ba86": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "af93edfca40740d2b7ac6c27c4ea0990": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "b1e118dbc3ed4ccba69dcaed9636f265": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_d865ae8d1939480b89c808b1d8f55120", - "IPY_MODEL_e1855a552e434174be0da566866d5a00" - ], - "layout": "IPY_MODEL_c00d8f4249f341e5a6dd2658d266d60f" - } - }, - "b6e5367fc7e148eca425e194283fbd0e": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "bfad22c034bd4cc3be8654a961666c5c": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "FloatSliderModel", - "state": { - "behavior": "drag-tap", - "description": "$\\omega$", - "layout": "IPY_MODEL_99441db1e62645bb92c89e656bf87dcc", - "max": 3.14, - "min": 0.5, - "step": 0.1, - "style": "IPY_MODEL_9a30ded6ec8840049d6aa9d487e12e7f", - "value": 1 - } - }, - "c00d8f4249f341e5a6dd2658d266d60f": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "justify_content": "space-between" - } - }, - "cec5e55237ff4f74a932f5755b953754": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "d1e88ebf0f594e44a02fd1af9c2d0a1f": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HTMLMathModel", - "state": { - "_dom_classes": [ - "exercise-description" - ], - "layout": "IPY_MODEL_6a1af84478db4bfab8912a136711825a", - "style": "IPY_MODEL_45397eb39f5b421f9b4296714f986619", - "value": "\nImplements a sinus function $\\sin(x\\omega)$.\n" - } - }, - "d865ae8d1939480b89c808b1d8f55120": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_07b231665ce2420b9ab88eb98088fe9a" - ], - "layout": "IPY_MODEL_cec5e55237ff4f74a932f5755b953754" - } - }, - "e1855a552e434174be0da566866d5a00": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "BoxModel", - "state": { - "layout": "IPY_MODEL_7c1735f399bf4872b01b52350c77fb0a" - } - }, - "e5a6403d5aac4803a56e48ea611c5d5c": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "e679f8d54af44dc7a092406ff96e92bc": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "e8a656cbbf9d4dc7a09de6f2c3e07617": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "2.0.0", - "model_name": "VBoxModel", - "state": { - "children": [ - "IPY_MODEL_bfad22c034bd4cc3be8654a961666c5c" - ], - "layout": "IPY_MODEL_65ac4e963b804fcaab15af85f6c87039" - } - }, - "ee0d9674a2e0497cb607a22a15a66a3d": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "f2949cb3eeb442f385b775f1fc57c745": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": { - "height": "auto", - "width": "98%" - } - }, - "f49927e0f8db47a4b5ef1071808be113": { - "model_module": "@jupyter-widgets/output", - "model_module_version": "1.0.0", - "model_name": "OutputModel", - "state": { - "_dom_classes": [ - "scwidget-cue-output" - ], - "layout": "IPY_MODEL_e5a6403d5aac4803a56e48ea611c5d5c" - } - } - }, - "version_major": 2, - "version_minor": 0 - } - } + "tags": [] }, "nbformat": 4, "nbformat_minor": 5 diff --git a/docs/src/nbgrader.ipynb b/docs/src/nbgrader.ipynb index fa151b4..07af326 100644 --- a/docs/src/nbgrader.ipynb +++ b/docs/src/nbgrader.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "bb4e091a-cd3e-4646-bffe-6605afdb90a8", + "id": "0", "metadata": {}, "source": [ "# Integrating with nbgrader" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7f107e70-8da7-4a6f-858a-a7abc41ebad3", + "id": "1", "metadata": {}, "outputs": [], "source": [] @@ -34,13 +34,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.10" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/pyproject.toml b/pyproject.toml index 0ebe408..5adcc72 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ classifiers = [ dependencies = [ "ipywidgets>=8.0.0", "numpy<2.0.0", - "widget_code_input>=4.0.13", + "widget_code_input @ git+https://github.com/agoscinski/widget-code-input@remove-docstring", "matplotlib", "termcolor" ] diff --git a/src/scwidgets/code/_widget_code_input.py b/src/scwidgets/code/_widget_code_input.py index d0a6572..4a83d4c 100644 --- a/src/scwidgets/code/_widget_code_input.py +++ b/src/scwidgets/code/_widget_code_input.py @@ -7,7 +7,7 @@ import types import warnings from functools import wraps -from typing import List, Optional, Tuple +from typing import List, Optional, Tuple, Union, Any from widget_code_input import WidgetCodeInput from widget_code_input.utils import ( @@ -67,7 +67,6 @@ def __init__( if function_name is None: raise ValueError("function_name must be given if no function is given.") function_parameters = "" if function_parameters is None else function_parameters - docstring = "\n" if docstring is None else docstring function_body = "" if function_body is None else function_body super().__init__( function_name, function_parameters, docstring, function_body, code_theme @@ -81,8 +80,7 @@ def __init__( f"the values {CodeInput.valid_code_themes}" ) - @property - def function(self) -> types.FunctionType: + def get_function(self, builtins: Union[dict[str, Any], None] = None) -> types.FunctionType: """ Return the compiled function object. @@ -91,14 +89,16 @@ def function(self) -> types.FunctionType: func = widget.wrapped_function # This can raise a SyntaxError retval = func(parameters) + :param builtins: A dict of variable name and value that is added to the + globals __builtins__ and thus avaialable on initialization :raise SyntaxError: if the function code has syntax errors (or if the function name is not a valid identifier) """ - return inspect.unwrap(self.wrapped_function) + return inspect.unwrap(self.get_wrapped_function(builtins)) def __call__(self, *args, **kwargs) -> Check.FunOutParamsT: """Calls the wrapped function""" - return self.wrapped_function(*args, **kwargs) + return self.get_wrapped_function()(*args, **kwargs) def compatible_with_signature(self, parameters: List[str]) -> str: """ @@ -121,9 +121,9 @@ def function_parameters_name(self) -> List[str]: return self.function_parameters.replace(",", "").split(" ") @staticmethod - def get_docstring(function: types.FunctionType) -> str: + def get_docstring(function: types.FunctionType) -> str | None: docstring = function.__doc__ - return "" if docstring is None else textwrap.dedent(docstring) + return None if docstring is None else textwrap.dedent(docstring) @staticmethod def _get_function_source_and_def( @@ -220,10 +220,9 @@ def get_function_body(function: types.FunctionType) -> str: line[leading_indent:] if line.strip() else "" for line in lines ) - return source + return source.strip() - @property - def wrapped_function(self) -> types.FunctionType: + def get_wrapped_function(self, builtins: Union[dict[str, Any], None] = None) -> types.FunctionType: """ Return the compiled function object wrapped by an try-catch block raising a `CodeValidationError`. @@ -233,6 +232,8 @@ def wrapped_function(self) -> types.FunctionType: func = widget.wrapped_function # This can raise a SyntaxError retval = func(parameters) + :param builtins: A dict of variable name and value that is added to the + globals __builtins__ and thus avaialable on initialization :raise SyntaxError: if the function code has syntax errors (or if the function name is not a valid identifier) """ @@ -243,6 +244,9 @@ def wrapped_function(self) -> types.FunctionType: "__package__": None, } + if builtins is not None: + globals_dict["__builtins__"].update(builtins) + if not is_valid_variable_name(self.function_name): raise SyntaxError("Invalid function name '{}'".format(self.function_name)) diff --git a/src/scwidgets/cue/_widget_cue_figure.py b/src/scwidgets/cue/_widget_cue_figure.py index 80a3f47..987f1c3 100644 --- a/src/scwidgets/cue/_widget_cue_figure.py +++ b/src/scwidgets/cue/_widget_cue_figure.py @@ -50,7 +50,7 @@ def __init__( None, str, List[str], List[List[str]], Sentinel ] = None, cued: bool = True, - no_toolbars: bool = True, + show_toolbar: bool = False, css_style: Optional[dict] = None, **kwargs, ): @@ -87,7 +87,7 @@ def __init__( "that should be supported on all systems." ) - if no_toolbars: + if show_toolbar: # hides unnecessary elements shown with %matplotlib widget self.figure.canvas.header_visible = False self.figure.canvas.footer_visible = False diff --git a/src/scwidgets/cue/_widget_cue_object.py b/src/scwidgets/cue/_widget_cue_object.py index 35f8022..5174290 100644 --- a/src/scwidgets/cue/_widget_cue_object.py +++ b/src/scwidgets/cue/_widget_cue_object.py @@ -16,7 +16,7 @@ class CueObject(CueOutput): A cued displayable ipywidget.Output for any Python object. Provides utilities to clear and redraw the object, for example after an update. - :param display_object: + :param object: The object to display :param widgets_to_observe: The widget to observe if the :param traits_to_observe: has changed. @@ -35,7 +35,7 @@ class CueObject(CueOutput): def __init__( self, - display_object: Any = None, + object: Any = None, widgets_to_observe: Union[None, List[Widget], Widget] = None, traits_to_observe: Union[ None, str, List[str], List[List[str]], Sentinel @@ -54,23 +54,23 @@ def __init__( **kwargs, ) - self._display_object = display_object + self._object = object self.draw_display() @property - def display_object(self): - return self._display_object + def object(self): + return self._object - @display_object.setter - def display_object(self, display_object: Any): - self._display_object = display_object + @object.setter + def object(self, object: Any): + self._object = object def clear_display(self, wait=False): self.clear_output(wait=wait) def draw_display(self): with self: - if isinstance(self._display_object, str): - print(self._display_object) - elif self._display_object is not None: - display(self._display_object) + if isinstance(self._object, str): + print(self._object) + elif self._object is not None: + display(self._object) diff --git a/src/scwidgets/exercise/_widget_code_exercise.py b/src/scwidgets/exercise/_widget_code_exercise.py index f211080..5671900 100644 --- a/src/scwidgets/exercise/_widget_code_exercise.py +++ b/src/scwidgets/exercise/_widget_code_exercise.py @@ -187,16 +187,6 @@ def __init__( self._code = code self._output = CueOutput() - self._parameter_panel: Union[ParameterPanel, None] - if isinstance(params, dict): - self._parameter_panel = ParameterPanel(**params) - elif isinstance(params, ParameterPanel): - self._parameter_panel = params - else: - self._parameter_panel = None - - self._cue_code = self._code - if outputs is None: outputs = [] elif not (isinstance(outputs, list)): @@ -205,12 +195,24 @@ def __init__( self._cue_outputs: List[CueOutput] = [] for output in outputs: if isinstance(output, Figure): + # This needs to happen before the creation of the + # ParameterPanel otherwise the figure is not properly closed. I + # am not sure why, I guess it is something related to interact self._cue_outputs.append(CueFigure(output)) elif isinstance(output, CueOutput): self._cue_outputs.append(output) else: self._cue_outputs.append(CueObject(output)) + if isinstance(params, dict): + self._parameter_panel = ParameterPanel(**params) + elif isinstance(params, ParameterPanel): + self._parameter_panel = params + else: + self._parameter_panel = None + + self._cue_code = self._code + if self._check_registry is None or self._code is None: self._check_button = None else: diff --git a/tox.ini b/tox.ini index 1ffb510..656a3f5 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,12 @@ lint_folders = "{toxinidir}/src" \ "{toxinidir}/tests" \ "{toxinidir}/docs/src/" + +notebooks = + {toxinidir}/docs/src/check.ipynb \ + {toxinidir}/docs/src/exercises.ipynb \ + {toxinidir}/docs/src/getting_started.ipynb \ + {toxinidir}/docs/src/nbgrader.ipynb envlist = lint @@ -101,7 +107,9 @@ exclude_also = [testenv:docs] deps = -r docs/requirements.txt -commands = sphinx-build {posargs:-E} -b html docs/src docs/build/html +commands = + ipython kernel install --sys-prefix --name "python" + sphinx-build {posargs:-E} -b html docs/src docs/build/html [testenv:format] # formats project source code files @@ -110,10 +118,13 @@ deps = black blackdoc isort + nbstripout commands = + nbstripout {[tox]notebooks} black {[tox]lint_folders} blackdoc {[tox]lint_folders} isort {[tox]lint_folders} + nbstripout {[tox]|docs_folder}docs/src/*ipynb [testenv:lint] # this environement lints the Python code with flake8 (code linter), @@ -131,8 +142,9 @@ deps = blackdoc isort mypy - + nbstripout commands = + nbstripout --verify {[tox]notebooks} flake8 {[tox]lint_folders} black --check --diff {[tox]lint_folders} blackdoc --check --diff {[tox]lint_folders}