diff --git a/.gitignore b/.gitignore index 6443ad1b7b..ecec3b18e7 100644 --- a/.gitignore +++ b/.gitignore @@ -99,6 +99,8 @@ app/src/main/res/raw/readme.* app/src/main/res/raw/contributors.* app/flavor* +cm-editor/node_modules/ + # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) !gradle-wrapper.jar diff --git a/app/build.gradle b/app/build.gradle index 0425a484e5..9d951fb520 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -125,7 +125,10 @@ dependencies { implementation "com.vladsch.flexmark:flexmark-ext-typographic:${version_library_flexmark}" implementation "com.vladsch.flexmark:flexmark-ext-admonition:${version_library_flexmark}" - // csv support + // Source: https://mvnrepository.com/artifact/org.apache.commons/commons-text + implementation 'org.apache.commons:commons-text:1.15.0' + + // CSV support // https://opencsv.sourceforge.net/licenses.html License: Apache2 // opencsv 3.10 was the last java-6 version // opencsv 5.7.1' for java-8 may have dependencies that are not backward compatibility with android-4.1 diff --git a/app/src/main/java/net/gsantner/markor/activity/ActionButtonSettingsActivity.java b/app/src/main/java/net/gsantner/markor/activity/ActionButtonSettingsActivity.java index 00617d06ee..da22d8baf9 100644 --- a/app/src/main/java/net/gsantner/markor/activity/ActionButtonSettingsActivity.java +++ b/app/src/main/java/net/gsantner/markor/activity/ActionButtonSettingsActivity.java @@ -117,7 +117,7 @@ protected void onPause() { private void onActionDataExtracted(@NonNull final ActionButtonBase textActions) { final Switch showActionBarSwitch = findViewById(R.id.showActionBarSwitch); - showActionBarSwitch.setChecked(textActions.loadActionBarVisible()); + showActionBarSwitch.setChecked(textActions.isActionBarVisible()); showActionBarSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> textActions.saveActionBarVisible(isChecked)); } diff --git a/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java b/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java index 9493fc35b5..27f97dc31f 100644 --- a/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java +++ b/app/src/main/java/net/gsantner/markor/activity/DocumentEditAndViewFragment.java @@ -720,7 +720,7 @@ public void onFsViewerConfig(GsFileBrowserOptions.Options dopt) { } case R.id.action_info: { if (saveDocument(false)) { // In order to have the correct info displayed - FileInfoDialog.show(_document.file, getParentFragmentManager()); + FileInfoDialog.show(_document.file, getParentFragmentManager(), null); } return true; } @@ -793,15 +793,26 @@ private void setActionBarVisibility() { return; } - final View parent = view.findViewById(R.id.document__fragment__edit__text_actions_bar__scrolling_parent); - if (parent == null) { + final View actionsBarScrollView = view.findViewById(R.id.document__fragment__edit__text_actions_bar__scrolling_parent); + if (actionsBarScrollView == null) { return; } - final View bar = view.findViewById(R.id.document__fragment__edit__text_actions_bar); - if (bar != null && _verticalScrollView != null) { - final boolean visible = _format.getActions().loadActionBarVisible() && _textActionsBar.getChildCount() > 0; - parent.setVisibility(visible ? View.VISIBLE : View.GONE); + final boolean visible = _format.getActions().isActionBarVisible() && _textActionsBar.getChildCount() > 0; + if (visible && actionsBarScrollView.getVisibility() == View.VISIBLE) { + return; + } + + final ViewGroup contentLayout = view.findViewById(R.id.content_layout); + if (contentLayout != null) { + actionsBarScrollView.setVisibility(visible ? View.VISIBLE : View.GONE); + final int marginBottom = visible ? (int) getResources().getDimension(R.dimen.text_actions_bar_height) : 0; + + setMarginBottom(contentLayout, marginBottom); + final View webView = view.findViewById(R.id.document__fragment_view_webview); + if (webView != null) { + setMarginBottom(webView, marginBottom); + } } } @@ -996,6 +1007,14 @@ public boolean isSearchViewIconified() { } } + private void setMarginBottom(final View view, final int marginBottom) { + final ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) view.getLayoutParams(); + if (params != null) { + params.setMargins(params.leftMargin, params.topMargin, params.rightMargin, marginBottom); + view.setLayoutParams(params); + } + } + private void updateMenuToggleStates(final int selectedFormatActionId) { MenuItem mi; if ((mi = _fragmentMenu.findItem(R.id.action_wrap_words)) != null) { diff --git a/app/src/main/java/net/gsantner/markor/activity/MainActivity.java b/app/src/main/java/net/gsantner/markor/activity/MainActivity.java index 1df6964b26..421b2bd339 100644 --- a/app/src/main/java/net/gsantner/markor/activity/MainActivity.java +++ b/app/src/main/java/net/gsantner/markor/activity/MainActivity.java @@ -59,6 +59,7 @@ public class MainActivity extends MarkorBaseActivity implements GsFileBrowserFragment.FilesystemFragmentOptionsListener { + public static final int REQUEST_CODE_SETTINGS = 124; public static boolean IS_DEBUG_ENABLED = false; private BottomNavigationView _bottomNav; @@ -267,7 +268,7 @@ private void optShowRate() { public boolean onOptionsItemSelected(@NonNull MenuItem item) { super.onOptionsItemSelected(item); if (item.getItemId() == R.id.action_settings) { - _cu.animateToActivity(this, SettingsActivity.class, false, null); + _cu.animateToActivity(this, SettingsActivity.class, false, REQUEST_CODE_SETTINGS); return true; } return false; @@ -396,6 +397,10 @@ private void showLargeFileOpenToastIfNeeded(final File file) { @Override public void onBackPressed() { + if (getNotebook().clearSelection()) { + return; + } + // Check if fragment handled back press final GsFragmentBase frag = getPosFragment(getCurrentPos()); if (frag == null || !frag.onBackPressed()) { @@ -612,6 +617,14 @@ protected void onStop() { protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); _cu.extractResultFromActivityResult(this, requestCode, resultCode, data); + + if (requestCode == REQUEST_CODE_SETTINGS) { + if (resultCode == SettingsActivity.RESULT.CHANGED) { + if (data != null && data.hasExtra(SettingsActivity.INTENT_NAME_THEME_CHANGED)) { + recreate(); + } + } + } } @Override diff --git a/app/src/main/java/net/gsantner/markor/activity/MoreInfoFragment.java b/app/src/main/java/net/gsantner/markor/activity/MoreInfoFragment.java index 21da769002..e19617355f 100644 --- a/app/src/main/java/net/gsantner/markor/activity/MoreInfoFragment.java +++ b/app/src/main/java/net/gsantner/markor/activity/MoreInfoFragment.java @@ -14,6 +14,7 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.widget.Toast; import androidx.preference.Preference; import androidx.preference.PreferenceGroup; @@ -54,7 +55,7 @@ public boolean isDividerVisible() { } @Override - @SuppressWarnings({"ConstantConditions", "ConstantIfStatement", "StatementWithEmptyBody"}) + @SuppressWarnings({"ConstantConditions", "ConstantIfStatement"}) public Boolean onPreferenceClicked(Preference preference, String key, int keyResId) { Activity activity = getActivity(); if (isAdded() && preference.hasKey()) { @@ -64,7 +65,7 @@ public Boolean onPreferenceClicked(Preference preference, String key, int keyRes return true; } case R.string.pref_key__more_info__settings: { - _cu.animateToActivity(activity, SettingsActivity.class, false, 124); + _cu.animateToActivity(activity, SettingsActivity.class, false, MainActivity.REQUEST_CODE_SETTINGS); return true; } case R.string.pref_key__more_info__rate_app: { @@ -119,12 +120,12 @@ public Boolean onPreferenceClicked(Preference preference, String key, int keyRes } case R.string.pref_key__more_info__copy_build_information: { _cu.setClipboard(getContext(), preference.getSummary()); + Toast.makeText(activity, R.string.copied, Toast.LENGTH_SHORT).show(); GsSimpleMarkdownParser smp = new GsSimpleMarkdownParser(); try { String html = smp.parse(getResources().openRawResource(R.raw.changelog), "", GsSimpleMarkdownParser.FILTER_ANDROID_TEXTVIEW).getHtml(); _cu.showDialogWithHtmlTextView(getActivity(), R.string.changelog, html); - } catch (Exception ex) { - + } catch (Exception ignored) { } return true; } diff --git a/app/src/main/java/net/gsantner/markor/activity/SettingsActivity.java b/app/src/main/java/net/gsantner/markor/activity/SettingsActivity.java index 47b798248f..8b92bc44f6 100644 --- a/app/src/main/java/net/gsantner/markor/activity/SettingsActivity.java +++ b/app/src/main/java/net/gsantner/markor/activity/SettingsActivity.java @@ -12,7 +12,6 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.graphics.Color; import android.os.Build; import android.os.Bundle; import android.text.TextUtils; @@ -20,6 +19,8 @@ import androidx.annotation.StringRes; import androidx.appcompat.widget.Toolbar; +import androidx.core.content.res.ResourcesCompat; +import androidx.fragment.app.FragmentActivity; import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentTransaction; import androidx.preference.Preference; @@ -29,6 +30,7 @@ import com.rarepebble.colorpicker.ColorPreference; import net.gsantner.markor.R; +import net.gsantner.markor.frontend.AdvancedEditTextPreference; import net.gsantner.markor.frontend.MarkorDialogFactory; import net.gsantner.markor.frontend.filebrowser.MarkorFileBrowserFactory; import net.gsantner.markor.model.AppSettings; @@ -51,13 +53,16 @@ public class SettingsActivity extends MarkorBaseActivity { @SuppressWarnings("WeakerAccess") public static class RESULT { - public static final int NOCHANGE = -1; + public static final int NO_CHANGE = -1; public static final int CHANGED = 1; public static final int RESTART_REQ = 2; } - public static int activityRetVal = RESULT.NOCHANGE; - private static int iconColor = Color.WHITE; + public static int activityRetVal = RESULT.NO_CHANGE; + + // To fix cannot go back previous screen when theme is changed + private boolean themeChanged = false; + public static final String INTENT_NAME_THEME_CHANGED = "theme_changed"; protected Toolbar toolbar; @@ -72,10 +77,9 @@ public void onCreate(Bundle b) { // Custom code GsFontPreferenceCompat.additionalyCheckedFolder = new File(_appSettings.getNotebookDirectory(), ".app/fonts"); - iconColor = _cu.rcolor(this, R.color.primary_text); toolbar.setTitle(R.string.settings); setSupportActionBar(findViewById(R.id.toolbar)); - toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp)); + toolbar.setNavigationIcon(ResourcesCompat.getDrawable(getResources(), R.drawable.ic_arrow_back_white_24dp, getTheme())); toolbar.setNavigationOnClickListener(view -> SettingsActivity.this.onBackPressed()); showFragment(SettingsFragmentMaster.TAG, false); } @@ -119,7 +123,6 @@ protected void onPreferenceChanged(SharedPreferences prefs, String key) { } @Override - @SuppressWarnings("rawtypes") protected void onPreferenceScreenChanged(PreferenceFragmentCompat preferenceFragmentCompat, PreferenceScreen preferenceScreen) { super.onPreferenceScreenChanged(preferenceFragmentCompat, preferenceScreen); final CharSequence title = preferenceScreen.getTitle(); @@ -137,12 +140,30 @@ public void onBackPressed() { prefFrag.goBack(); return; } - super.onBackPressed(); + + if (themeChanged) { + Intent resultIntent = new Intent(); + resultIntent.putExtra(INTENT_NAME_THEME_CHANGED, true); + setResult(RESULT.CHANGED, resultIntent); + finish(); + } else { + super.onBackPressed(); + } } public static class SettingsFragmentMaster extends MarkorSettingsFragment { public static final String TAG = "SettingsFragmentMaster"; + @Override + public void onDisplayPreferenceDialog(Preference preference) { + FragmentActivity activity = getActivity(); + if (preference instanceof AdvancedEditTextPreference && activity != null) { + ((AdvancedEditTextPreference) preference).createDialog(activity).show(); + } else { + super.onDisplayPreferenceDialog(preference); + } + } + @Override public int getPreferenceResourceForInflation() { return R.xml.preferences_master; @@ -174,7 +195,7 @@ public void doUpdatePreferences() { updateSummary(R.string.pref_key__snippet_directory_path, _appSettings.getSnippetsDirectory().getAbsolutePath()); final String fileDescFormat = _appSettings.getString(R.string.pref_key__file_description_format, ""); - if (fileDescFormat.equals("")) { + if (fileDescFormat.isEmpty()) { updateSummary(R.string.pref_key__file_description_format, getString(R.string.default_)); } else { updateSummary(R.string.pref_key__file_description_format, fileDescFormat); @@ -216,9 +237,8 @@ protected void onPreferenceChanged(final SharedPreferences prefs, final String k _appSettings.setRecreateMainRequired(true); } else if (eq(key, R.string.pref_key__app_theme)) { _appSettings.applyAppTheme(); - _appSettings.setRecreateMainRequired(true); - if (getActivity() != null) { - getActivity().recreate(); + if (getActivity() instanceof SettingsActivity) { + ((SettingsActivity) getActivity()).themeChanged = true; } } else if (eq(key, R.string.pref_key__theming_hide_system_statusbar)) { activityRetVal = RESULT.RESTART_REQ; @@ -246,7 +266,7 @@ protected void onPreferenceChanged(final SharedPreferences prefs, final String k } @Override - @SuppressWarnings({"ConstantConditions", "ConstantIfStatement", "StatementWithEmptyBody"}) + @SuppressWarnings({"ConstantConditions", "ConstantIfStatement"}) public Boolean onPreferenceClicked(Preference preference, String key, int keyResId) { final FragmentManager fragManager = getActivity().getSupportFragmentManager(); switch (keyResId) { @@ -380,11 +400,11 @@ public void onFsViewerConfig(GsFileBrowserOptions.Options dopt) { break; } case R.string.pref_key__backup_settings: { - BackupUtils.showBackupWriteToDialog(getContext(), getFragmentManager()); + BackupUtils.showBackupWriteToDialog(getContext(), getParentFragmentManager()); break; } case R.string.pref_key__restore_settings: { - BackupUtils.showBackupSelectFromDialog(getContext(), getFragmentManager()); + BackupUtils.showBackupSelectFromDialog(getContext(), getParentFragmentManager()); break; } } diff --git a/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java b/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java index 409d431ef4..c2ebf51b31 100644 --- a/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java +++ b/app/src/main/java/net/gsantner/markor/format/ActionButtonBase.java @@ -108,7 +108,7 @@ public boolean onActionLongClick(final @StringRes int action) { private TextSearchViewHolder _textSearchViewHolder; public ActionButtonBase initTextSearch(DocumentEditAndViewFragment fragment) { - _textSearchViewHolder = new TextSearchViewHolder(fragment, R.id.topViewContainer); + _textSearchViewHolder = new TextSearchViewHolder(fragment, R.id.top_view_container); return this; } @@ -278,7 +278,7 @@ public void saveActionBarVisible(final boolean visible) { settings.edit().putBoolean(formatKey, visible).apply(); } - public boolean loadActionBarVisible() { + public boolean isActionBarVisible() { final SharedPreferences settings = getContext().getSharedPreferences(ACTION_ORDER_PREF_NAME, Context.MODE_PRIVATE); final String formatKey = getResString(getFormatActionsKey()) + VISIBLE_SUFFIX; return settings.getBoolean(formatKey, true); @@ -330,7 +330,7 @@ public List getActionOrder() { @SuppressWarnings("ConstantConditions") public void recreateActionButtons(final ViewGroup barLayout, final ActionItem.DisplayMode displayMode) { - if (!loadActionBarVisible()) { + if (!isActionBarVisible()) { return; } diff --git a/app/src/main/java/net/gsantner/markor/frontend/AdvancedEditTextPreference.java b/app/src/main/java/net/gsantner/markor/frontend/AdvancedEditTextPreference.java new file mode 100644 index 0000000000..bfe6202abd --- /dev/null +++ b/app/src/main/java/net/gsantner/markor/frontend/AdvancedEditTextPreference.java @@ -0,0 +1,96 @@ +package net.gsantner.markor.frontend; + +import android.content.Context; +import android.content.res.TypedArray; +import android.graphics.Point; +import android.util.AttributeSet; +import android.util.DisplayMetrics; +import android.view.View; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.appcompat.app.AlertDialog; +import androidx.fragment.app.FragmentActivity; +import androidx.preference.DialogPreference; + +import net.gsantner.markor.R; +import net.gsantner.markor.frontend.textview.CodeMirrorEditor; +import net.gsantner.opoc.util.GsContextUtils; + +public class AdvancedEditTextPreference extends DialogPreference { + + private String defaultValue; + private CodeMirrorEditor editText; + private boolean initialized; + + public AdvancedEditTextPreference(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + init(); + } + + public AdvancedEditTextPreference(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + public AdvancedEditTextPreference(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + init(); + } + + public AdvancedEditTextPreference(@NonNull Context context) { + super(context); + init(); + } + + private void init() { + if (!initialized) { + setDialogLayoutResource(R.layout.edit_text_preference); + initialized = true; + } + } + + @Nullable + @Override + protected Object onGetDefaultValue(@NonNull TypedArray a, int index) { + defaultValue = a.getString(index); + if (defaultValue == null) { + defaultValue = ""; + } else { + // Prettify indentation with 2 spaces + defaultValue = defaultValue.replaceAll("\n ", "\n ").replaceAll("\t", " "); + } + return defaultValue; + } + + public AlertDialog createDialog(FragmentActivity activity) { + View view = activity.getLayoutInflater().inflate(R.layout.edit_text_preference, null); + DisplayMetrics displayMetrics = new DisplayMetrics(); + activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + Point size = GsContextUtils.calculateDialogSize(displayMetrics, 0.95f, 1040, 0.52f, 1900); + view.setMinimumWidth(size.x); + view.setMinimumHeight(size.y); + + editText = view.findViewById(R.id.editor); + editText.setOnPreparedListener(() -> { + editText.resetText(getPersistedString(defaultValue)); + editText.requestFocusFromTouch(); + editText.focus(); + }); + + TextView textView = view.findViewById(R.id.title); + textView.setText(getTitle()); + view.findViewById(R.id.undo).setOnClickListener(v -> editText.undo()); + view.findViewById(R.id.redo).setOnClickListener(v -> editText.redo()); + view.findViewById(R.id.reset).setOnClickListener(v -> editText.setText(defaultValue)); + + AlertDialog.Builder builder = new AlertDialog.Builder(activity); + builder.setView(view); + builder.setPositiveButton(activity.getString(R.string.save), + (dialog, which) -> editText.getText(this::persistString)); + builder.setNegativeButton(activity.getString(R.string.cancel), null); + + return builder.create(); + } +} diff --git a/app/src/main/java/net/gsantner/markor/frontend/FileInfoDialog.java b/app/src/main/java/net/gsantner/markor/frontend/FileInfoDialog.java index 69e5b96dd8..3f2c636a95 100644 --- a/app/src/main/java/net/gsantner/markor/frontend/FileInfoDialog.java +++ b/app/src/main/java/net/gsantner/markor/frontend/FileInfoDialog.java @@ -29,6 +29,7 @@ import net.gsantner.markor.model.AppSettings; import net.gsantner.opoc.util.GsContextUtils; import net.gsantner.opoc.util.GsFileUtils; +import net.gsantner.opoc.wrapper.GsCallback; import java.io.File; import java.util.Locale; @@ -37,6 +38,11 @@ public class FileInfoDialog extends DialogFragment { public static final String EXTRA_FILEPATH = "EXTRA_FILEPATH"; public static final String FRAGMENT_TAG = "fileInfoDialog"; + private GsCallback.a0 refreshCallback; + + public void setRefreshCallback(GsCallback.a0 refreshCallback) { + this.refreshCallback = refreshCallback; + } public static FileInfoDialog newInstance(File sourceFile) { FileInfoDialog dialog = new FileInfoDialog(); @@ -46,8 +52,17 @@ public static FileInfoDialog newInstance(File sourceFile) { return dialog; } - public static FileInfoDialog show(File sourceFile, FragmentManager fragmentManager) { + /** + * Show the file information dialog. + * + * @param sourceFile the source file + * @param fragmentManager the fragment manager + * @param refreshCallback the callback to refresh the file item view if favorite state is changed + * @return the file information dialog + */ + public static FileInfoDialog show(File sourceFile, FragmentManager fragmentManager, GsCallback.a0 refreshCallback) { FileInfoDialog dialog = FileInfoDialog.newInstance(sourceFile); + dialog.setRefreshCallback(refreshCallback); dialog.show(fragmentManager, FileInfoDialog.FRAGMENT_TAG); return dialog; } @@ -79,56 +94,55 @@ private AlertDialog.Builder setUpDialog(final File file, LayoutInflater inflater dialogBuilder.setView(root); - tv(root, R.id.ui__fileinfodialog__name).setText(file.getName()); - tv(root, R.id.ui__fileinfodialog__location).setText(file.getParentFile().getAbsolutePath()); - tv(root, R.id.ui__fileinfodialog__last_modified).setText(DateUtils.formatDateTime(root.getContext(), file.lastModified(), (DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_NUMERIC_DATE))); - tv(root, R.id.ui__fileinfodialog__last_modified_caption).setText(getString(R.string.last_modified_witharg, "").replace(":", "").trim()); - tv(root, R.id.ui__fileinfodialog__size_description).setText(GsFileUtils.getReadableFileSize(file.length(), false)); - tv(root, R.id.ui__fileinfodialog__mimetype_description).setText(GsFileUtils.getMimeType(file)); - tv(root, R.id.ui__fileinfodialog__sha_256).setText(GsFileUtils.sha256(file)); - tv(root, R.id.ui__fileinfodialog__location).setOnLongClickListener(v -> { - GsContextUtils.instance.setClipboard(v.getContext(), file.getAbsolutePath()); - Toast.makeText(v.getContext(), R.string.clipboard, Toast.LENGTH_SHORT).show(); - return true; - } - ); - tv(root, R.id.ui__fileinfodialog__sha_256).setOnLongClickListener(v -> { - GsContextUtils.instance.setClipboard(v.getContext(), GsFileUtils.sha256(file)); - Toast.makeText(v.getContext(), R.string.clipboard, Toast.LENGTH_SHORT).show(); - return true; - } - ); - - - // Number of lines and character count only apply for files. - root.findViewById(R.id.ui__fileinfodialog__textinfo).setVisibility(View.GONE); - root.findViewById(R.id.ui__fileinfodialog__fileinfo).setVisibility(file.isFile() ? View.VISIBLE : View.GONE); - root.findViewById(R.id.ui__fileinfodialog__filesettings).setVisibility(file.isFile() ? View.VISIBLE : View.GONE); + tv(root, R.id.ui__file_info_dialog__name).setText(file.getName()); + tv(root, R.id.ui__file_info_dialog__location).setText(file.getParentFile().getAbsolutePath()); + tv(root, R.id.ui__file_info_dialog__last_modified).setText(DateUtils.formatDateTime(root.getContext(), file.lastModified(), (DateUtils.FORMAT_SHOW_TIME | DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR | DateUtils.FORMAT_NUMERIC_DATE))); + tv(root, R.id.ui__file_info_dialog__last_modified_caption).setText(getString(R.string.last_modified_with_arg, "").replace(":", "").trim()); + tv(root, R.id.ui__file_info_dialog__size_description).setText(GsFileUtils.getReadableFileSize(file.length(), false)); + tv(root, R.id.ui__file_info_dialog__mimetype_description).setText(GsFileUtils.getMimeType(file)); + tv(root, R.id.ui__file_info_dialog__sha_256).setText(GsFileUtils.sha256(file)); + tv(root, R.id.ui__file_info_dialog__location).setOnLongClickListener(v -> { + GsContextUtils.instance.setClipboard(v.getContext(), file.getAbsolutePath()); + Toast.makeText(v.getContext(), R.string.copied, Toast.LENGTH_SHORT).show(); + return true; + }); + tv(root, R.id.ui__file_info_dialog__sha_256).setOnLongClickListener(v -> { + GsContextUtils.instance.setClipboard(v.getContext(), GsFileUtils.sha256(file)); + Toast.makeText(v.getContext(), R.string.copied, Toast.LENGTH_SHORT).show(); + return true; + }); + + // Number of lines and character count only apply for files + root.findViewById(R.id.ui__file_info_dialog__text_info).setVisibility(View.GONE); + root.findViewById(R.id.ui__file_info_dialog__file_info).setVisibility(file.isFile() ? View.VISIBLE : View.GONE); + root.findViewById(R.id.ui__file_info_dialog__file_settings).setVisibility(file.isFile() ? View.VISIBLE : View.GONE); if (GsFileUtils.isTextFile(file)) { - root.findViewById(R.id.ui__fileinfodialog__textinfo).setVisibility(View.VISIBLE); + root.findViewById(R.id.ui__file_info_dialog__text_info).setVisibility(View.VISIBLE); AtomicInteger valLines = new AtomicInteger(0); AtomicInteger valChars = new AtomicInteger(0); AtomicInteger valWords = new AtomicInteger(0); GsFileUtils.retrieveTextFileSummary(file, valChars, valLines, valWords); - tv(root, R.id.ui__fileinfodialog__textinfo_caption).setText(getString(R.string.text_lines) + String.format(" / %s / %s", getString(R.string.text_words), getString(R.string.text_characters)).replace("Text ", "")); - tv(root, R.id.ui__fileinfodialog__textinfo_description).setText(String.format(Locale.ENGLISH, "%d / %d / %d", valLines.intValue(), valWords.intValue(), valChars.intValue())); + tv(root, R.id.ui__file_info_dialog__text_info_caption).setText(getString(R.string.text_lines) + String.format(" / %s / %s", getString(R.string.text_words), getString(R.string.text_characters)).replace("Text ", "")); + tv(root, R.id.ui__file_info_dialog__text_info_description).setText(String.format(Locale.ENGLISH, "%d / %d / %d", valLines.intValue(), valWords.intValue(), valChars.intValue())); } - dialogBuilder.setPositiveButton(getString(android.R.string.ok), (dialogInterface, i) -> { - dialogInterface.dismiss(); - }); + dialogBuilder.setPositiveButton(getString(android.R.string.ok), (dialogInterface, i) -> dialogInterface.dismiss()); // Hide checkbox final AppSettings appSettings = AppSettings.get(getContext()); - CheckBox checkHideInRecents = root.findViewById(R.id.ui__fileinfodialog__recents); + CheckBox checkHideInRecents = root.findViewById(R.id.ui__file_info_dialog__recents); checkHideInRecents.setChecked(appSettings.listFileInRecents(file)); checkHideInRecents.setOnCheckedChangeListener((buttonView, isChecked) -> appSettings.setListFileInRecents(file, isChecked)); - - CheckBox checkFavorite = root.findViewById(R.id.ui__fileinfodialog__favorite); + CheckBox checkFavorite = root.findViewById(R.id.ui__file_info_dialog__favorite); checkFavorite.setChecked(appSettings.getFavouriteFiles().contains(file)); - checkFavorite.setOnCheckedChangeListener((buttonView, isChecked) -> appSettings.toggleFavouriteFile(file)); + checkFavorite.setOnCheckedChangeListener((buttonView, isChecked) -> { + appSettings.toggleFavouriteFile(file); + if (refreshCallback != null) { + refreshCallback.callback(); + } + }); return dialogBuilder; } diff --git a/app/src/main/java/net/gsantner/markor/frontend/MarkorDialogFactory.java b/app/src/main/java/net/gsantner/markor/frontend/MarkorDialogFactory.java index ee4ad5eef9..7ff2382457 100644 --- a/app/src/main/java/net/gsantner/markor/frontend/MarkorDialogFactory.java +++ b/app/src/main/java/net/gsantner/markor/frontend/MarkorDialogFactory.java @@ -1128,8 +1128,7 @@ public static void showFolderSortDialog( final Activity activity, final GsFileUtils.SortOrder currentOrder, final GsFileUtils.SortOrder globalOrder, - final GsCallback.a1 callback - ) { + final GsCallback.a1 callback) { final DialogOptions dopt = new DialogOptions(); baseConf(activity, dopt); @@ -1161,6 +1160,10 @@ public static void showFolderSortDialog( icons.add(R.drawable.ic_baseline_rule_folder_24); layouts.add(android.R.layout.simple_list_item_multiple_choice); + data.add(activity.getString(R.string.favorite_first)); + icons.add(R.drawable.ic_favorite_black_24dp); + layouts.add(android.R.layout.simple_list_item_multiple_choice); + data.add(activity.getString(R.string.reverse_order)); icons.add(R.drawable.ic_baseline_arrow_upward_24); layouts.add(android.R.layout.simple_list_item_multiple_choice); @@ -1176,8 +1179,9 @@ public static void showFolderSortDialog( dopt.preSelected = new HashSet<>(); if (currentOrder.isFolderLocal) dopt.preSelected.add(0); if (currentOrder.folderFirst) dopt.preSelected.add(5); - if (currentOrder.reverse) dopt.preSelected.add(6); - if (currentOrder.showDotFiles) dopt.preSelected.add(7); + if (currentOrder.favoriteFirst) dopt.preSelected.add(6); + if (currentOrder.reverse) dopt.preSelected.add(7); + if (currentOrder.showDotFiles) dopt.preSelected.add(8); final Map typeToPos = new HashMap<>(); typeToPos.put(GsFileUtils.SORT_BY_NAME, 1); @@ -1203,8 +1207,9 @@ public static void showFolderSortDialog( // resetGlobal[0] = true; selection.clear(); if (globalOrder.folderFirst) selection.add(5); - if (globalOrder.reverse) selection.add(6); - if (globalOrder.showDotFiles) selection.add(7); + if (globalOrder.favoriteFirst) selection.add(6); + if (globalOrder.reverse) selection.add(7); + if (globalOrder.showDotFiles) selection.add(8); selection.add(GsCollectionUtils.getOrDefault(typeToPos, globalOrder.sortByType, 1)); } else if (!Collections.disjoint(removed, radioSet)) { // If a radio button is unchecked add it back @@ -1221,8 +1226,9 @@ public static void showFolderSortDialog( final GsFileUtils.SortOrder order = new GsFileUtils.SortOrder(); order.isFolderLocal = selection.contains(0); order.folderFirst = selection.contains(5); - order.reverse = selection.contains(6); - order.showDotFiles = selection.contains(7); + order.favoriteFirst = selection.contains(6); + order.reverse = selection.contains(7); + order.showDotFiles = selection.contains(8); if (selection.contains(2)) order.sortByType = GsFileUtils.SORT_BY_MTIME; else if (selection.contains(3)) order.sortByType = GsFileUtils.SORT_BY_FILESIZE; else if (selection.contains(4)) order.sortByType = GsFileUtils.SORT_BY_MIMETYPE; diff --git a/app/src/main/java/net/gsantner/markor/frontend/textview/CodeMirrorEditor.java b/app/src/main/java/net/gsantner/markor/frontend/textview/CodeMirrorEditor.java new file mode 100644 index 0000000000..ee86feb6d5 --- /dev/null +++ b/app/src/main/java/net/gsantner/markor/frontend/textview/CodeMirrorEditor.java @@ -0,0 +1,158 @@ +package net.gsantner.markor.frontend.textview; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.os.Build; +import android.util.AttributeSet; +import android.view.View; +import android.webkit.JavascriptInterface; +import android.webkit.WebView; +import android.webkit.WebViewClient; + +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; + +import net.gsantner.opoc.util.GsContextUtils; +import net.gsantner.opoc.util.GsFileUtils; +import net.gsantner.opoc.wrapper.GsCallback; + +import org.apache.commons.text.StringEscapeUtils; + +import java.io.File; +import java.io.IOException; + +public class CodeMirrorEditor extends WebView { + + private static final String BASE_DIR_URL = "file:///android_asset/cm-editor/"; + private static final String BASE_HTML_PATH = "cm-editor/index.html"; + private boolean initialized; + + private final WebViewClient webViewClient = new WebViewClient() { + @Override + public void onPageFinished(WebView view, String url) { + super.onPageFinished(view, url); + setVisibility(VISIBLE); + if (onPreparedListener != null) { + onPreparedListener.callback(); + } + } + }; + + private GsCallback.a0 onPreparedListener; + + public void setOnPreparedListener(GsCallback.a0 listener) { + this.onPreparedListener = listener; + } + + private class CallbackInterface { + @JavascriptInterface + public void focus() { + CodeMirrorEditor.this.requestFocusFromTouch(); + } + + @JavascriptInterface + public String readText(String path) { + return GsFileUtils.readTextFile(new File(path)); + } + } + + public CodeMirrorEditor(@NonNull Context context) { + super(context); + init(); + } + + public CodeMirrorEditor(@NonNull Context context, @Nullable AttributeSet attrs) { + super(context, attrs); + init(); + } + + public CodeMirrorEditor(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); + } + + private void init() { + if (!initialized) { + setFocusable(true); + setFocusableInTouchMode(true); + requestFocus(View.FOCUS_DOWN); + load(); + initialized = true; + } + } + + @SuppressLint("SetJavaScriptEnabled") + private void load() { + setVisibility(INVISIBLE); + setWebViewClient(webViewClient); + addJavascriptInterface(new CallbackInterface(), "callbackInterface"); + getSettings().setJavaScriptEnabled(true); + getSettings().setAllowFileAccessFromFileURLs(true); + + try { + String index = GsFileUtils.readText(getContext().getAssets().open(BASE_HTML_PATH)); + if (GsContextUtils.instance.isDarkModeEnabled(getContext())) { + index = index.replace("content=\"light\"", "content=\"dark\""); + } + loadDataWithBaseURL(BASE_DIR_URL, index, "text/html", "utf-8", null); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void focus() { + loadUrl("javascript: editorBridge.focus()"); + } + + public interface OnTextReadListener { + void onTextRead(String value); + } + + public void getText(OnTextReadListener listener) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + evaluateJavascript("javascript: editorBridge.getText()", value -> + listener.onTextRead(StringEscapeUtils.unescapeJava(value.substring(1, value.length() - 1))) + ); + } + } + + /** + * Set text but not reset state. + * This method is suitable for loading text with file size less than 500 KB. + * Load large text, please use {@link net.gsantner.markor.frontend.textview.CodeMirrorEditor#loadText(java.lang.String path)}. + * + * @param text the text + */ + public void setText(String text) { + loadUrl("javascript: editorBridge.setText(\"" + StringEscapeUtils.escapeJava(text) + "\")"); + } + + /** + * Load text from file path and reset state. + * This method supports loading large text with file size greater than 1 MB. + * + * @param path the text file path + */ + public void loadText(String path) { + loadUrl("javascript: editorBridge.loadText(\"" + StringEscapeUtils.escapeJava(path) + "\")"); + } + + /** + * Set text and reset state. + * This method is suitable for loading text with file size less than 500 KB. + * Load large text, please use {@link net.gsantner.markor.frontend.textview.CodeMirrorEditor#loadText(java.lang.String path)}. + * + * @param text the text + */ + public void resetText(String text) { + loadUrl("javascript: editorBridge.resetText(\"" + StringEscapeUtils.escapeJava(text) + "\")"); + } + + public void undo() { + loadUrl("javascript: editorBridge.undo()"); + } + + public void redo() { + loadUrl("javascript: editorBridge.redo()"); + } +} diff --git a/app/src/main/java/net/gsantner/markor/model/AppSettings.java b/app/src/main/java/net/gsantner/markor/model/AppSettings.java index 007f888b5d..3944c7db3e 100644 --- a/app/src/main/java/net/gsantner/markor/model/AppSettings.java +++ b/app/src/main/java/net/gsantner/markor/model/AppSettings.java @@ -410,7 +410,6 @@ public void setFavouriteFiles(final Collection files) { } public void toggleFavouriteFile(File file) { - final List list = new ArrayList<>(); final Set favourites = getFavouriteFiles(); if (favourites.contains(file)) { favourites.remove(file); diff --git a/app/src/main/java/net/gsantner/opoc/frontend/GsSearchOrCustomTextDialog.java b/app/src/main/java/net/gsantner/opoc/frontend/GsSearchOrCustomTextDialog.java index 8a39cd047f..5d1d57f9e7 100644 --- a/app/src/main/java/net/gsantner/opoc/frontend/GsSearchOrCustomTextDialog.java +++ b/app/src/main/java/net/gsantner/opoc/frontend/GsSearchOrCustomTextDialog.java @@ -511,7 +511,6 @@ public static void showMultiChoiceDialogWithSearchFilterUI(final Activity activi // Item click action if (dopt.selectionMode != DialogOptions.SelectionMode.NONE) { - // Helper function to trigger callback with single item final GsCallback.b2 directActivate = (position, isLong) -> { final int index = listAdapter._filteredItems.get(position); diff --git a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserFragment.java b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserFragment.java index 63182205e0..f52cd338aa 100644 --- a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserFragment.java +++ b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserFragment.java @@ -300,6 +300,7 @@ public boolean onBackPressed() { if (_filesystemViewerAdapter != null && _filesystemViewerAdapter.goBack()) { return true; } + return super.onBackPressed(); } @@ -443,7 +444,13 @@ public boolean onOptionsItemSelected(final MenuItem item) { case R.id.action_info_selected_item: { if (_filesystemViewerAdapter.areItemsSelected()) { File file = new ArrayList<>(currentSelection).get(0); - FileInfoDialog.show(file, getChildFragmentManager()); + FileInfoDialog.show(file, getChildFragmentManager(), () -> { + int position = _filesystemViewerAdapter.getPosition(file); + if (position >= 0) { + _dopt.favouriteFiles = _appSettings.getFavouriteFiles(); + _filesystemViewerAdapter.notifyItemChanged(position); + } + }); } return true; } @@ -567,15 +574,20 @@ private void executeFilterNotebookAction() { }); } - public void clearSelection() { - if (_filesystemViewerAdapter != null) { // Happens when restoring after rotation etc + /** + * Clear file selection. + * + * @return true if it has selection and clear + */ + public boolean clearSelection() { + if (_filesystemViewerAdapter != null && _filesystemViewerAdapter.getCurrentSelectionSize() > 0) { + // Happens when restoring after rotation etc _filesystemViewerAdapter.unselectAll(); + return true; } + return false; } - - /// //////////// - private void askForMoveOrCopy(final boolean isMove) { final List files = new ArrayList<>(_filesystemViewerAdapter.getCurrentSelection()); MarkorFileBrowserFactory.showFolderDialog(new GsFileBrowserOptions.SelectionListenerAdapter() { diff --git a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java index 66aa304c1c..b2237338a4 100644 --- a/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java +++ b/app/src/main/java/net/gsantner/opoc/frontend/filebrowser/GsFileBrowserListAdapter.java @@ -177,7 +177,6 @@ public void updateVirtualFolders() { _virtualMapping.put(VIRTUAL_STORAGE_FAVOURITE, VIRTUAL_STORAGE_FAVOURITE); _virtualMapping.putAll(_dopt.storageMaps); - } @NonNull @@ -195,6 +194,10 @@ public boolean isFileWriteable(File file, boolean isGoUp) { return file != null && (canWrite(file) || isGoUp || _virtualMapping.containsKey(file)); } + public int getPosition(File file) { + return file == null ? -1 : _adapterDataFiltered.indexOf(file); + } + @Override @SuppressWarnings("ConstantConditions") public void onBindViewHolder(@NonNull FilesystemViewerViewHolder holder, int position) { @@ -441,7 +444,7 @@ public void onClick(View view) { switch (view.getId()) { case R.id.opoc_filesystem_item__root: { - // A own item was clicked + // An own item was clicked if (data.file != null) { if (areItemsSelected()) { // There are 1 or more items selected yet @@ -506,6 +509,10 @@ public void unselectAll() { _dopt.listener.onFsViewerDoUiUpdate(this); } + public int getCurrentSelectionSize() { + return _currentSelection.size(); + } + public boolean areItemsSelected() { return !_currentSelection.isEmpty(); } @@ -718,7 +725,6 @@ private void loadFolder(final File folder, final File show) { // This function is not called on the main thread private synchronized void _loadFolder(final boolean folderChanged, final @Nullable File toShow) { - final List newData = new ArrayList<>(); // Make sure /storage/emulated/0 is browsable, even though filesystem says it's not accessible @@ -754,10 +760,10 @@ private synchronized void _loadFolder(final boolean folderChanged, final @Nullab // Don't sort recent or virtual root items - use the default order if (isCurrentFolderSortable()) { - GsFileUtils.sortFiles(newData, _dopt.sortOrder); + GsFileUtils.sortFiles(newData, _dopt.sortOrder, _dopt.favouriteFiles); } - // Testing if modtimes have changed (modtimes generally only increase) + // Testing if mod-time have changed (mod-time generally only increase) final long modSum = GsCollectionUtils.accumulate(newData, (f, s) -> s + f.lastModified(), 0L); final boolean modSumChanged = modSum != _prevModSum; diff --git a/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java b/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java index 6f071636eb..9c1741afb6 100644 --- a/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java +++ b/app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java @@ -45,6 +45,7 @@ import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; +import android.graphics.Point; import android.graphics.Rect; import android.graphics.drawable.AdaptiveIconDrawable; import android.graphics.drawable.BitmapDrawable; @@ -123,6 +124,7 @@ import androidx.core.view.WindowInsetsCompat; import androidx.core.view.WindowInsetsControllerCompat; import androidx.documentfile.provider.DocumentFile; +import androidx.fragment.app.FragmentActivity; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.preference.PreferenceManager; import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat; @@ -616,7 +618,6 @@ public static int argb(final int a, final int r, final int g, final int b) { return (Math.max(0, Math.min(255, a)) << 24) | (Math.max(0, Math.min(255, r)) << 16) | (Math.max(0, Math.min(255, g)) << 8) | Math.max(0, Math.min(255, b)); } - /** * Convert a html string to an android {@link Spanned} object */ @@ -644,6 +645,46 @@ public int convertDpToPx(final Context context, final float dp) { return (int) (dp * context.getResources().getDisplayMetrics().density); } + public static DisplayMetrics getDisplayMetrics(final FragmentActivity activity) { + DisplayMetrics displayMetrics = new DisplayMetrics(); + activity.getWindowManager().getDefaultDisplay().getMetrics(displayMetrics); + return displayMetrics; + } + + public static int calculateWidth(DisplayMetrics displayMetrics, float ratio, int maxWidth) { + int width = (int) (displayMetrics.widthPixels * ratio); + return width > maxWidth ? maxWidth : width; + } + + public static int calculateHeight(DisplayMetrics displayMetrics, float ratio, int maxHeight) { + int height = (int) (displayMetrics.heightPixels * ratio); + return height > maxHeight ? maxHeight : height; + } + + /** + * Calculate size for dialogs. + * It can automatically adapt to landscape and portrait screens. + * + * @param displayMetrics the display metrics + * @param horizontalRatio the horizontal ratio + * @param horizontalMax the max horizontal size + * @param verticalRatio the vertical ratio + * @param verticalMax the max vertical size + * @return the dialog size + */ + public static Point calculateDialogSize(DisplayMetrics displayMetrics, + float horizontalRatio, int horizontalMax, + float verticalRatio, int verticalMax) { + int horizontalSize = GsContextUtils.calculateWidth(displayMetrics, horizontalRatio, horizontalMax); + int verticalSize = GsContextUtils.calculateHeight(displayMetrics, verticalRatio, verticalMax); + + if (horizontalSize < verticalSize) { // Portrait + return new Point(horizontalSize, verticalSize); + } else { // Landscape + return new Point(verticalSize, horizontalSize); + } + } + /** * Get the private directory for the current package (usually /data/data/package.name/) */ diff --git a/app/src/main/java/net/gsantner/opoc/util/GsFileUtils.java b/app/src/main/java/net/gsantner/opoc/util/GsFileUtils.java index 83a7f934a2..a420a898f7 100644 --- a/app/src/main/java/net/gsantner/opoc/util/GsFileUtils.java +++ b/app/src/main/java/net/gsantner/opoc/util/GsFileUtils.java @@ -27,6 +27,7 @@ import java.io.BufferedInputStream; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; +import java.io.CharArrayWriter; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; @@ -38,6 +39,7 @@ import java.io.InputStreamReader; import java.io.OutputStream; import java.io.Serializable; +import java.io.UnsupportedEncodingException; import java.net.URLConnection; import java.nio.charset.Charset; import java.nio.file.FileSystems; @@ -70,6 +72,8 @@ @SuppressWarnings({"WeakerAccess", "unused", "SameParameterValue", "SpellCheckingInspection"}) public class GsFileUtils { + public static final String DEFAULT_CHARSET = "UTF-8"; + @SuppressLint("ConstantLocale") public final static Locale INITIAL_LOCALE = Locale.getDefault(); public final static SimpleDateFormat DATEFORMAT_IMG = new SimpleDateFormat("yyyyMMdd-HHmmss", INITIAL_LOCALE); //20190511-230845 @@ -154,6 +158,57 @@ public static String readTextFile(final File file) { return ""; } + /** + * Byte input stream -> Character array. + * + * @param inputStream Byte input stream + * @param charset Character code + * @return Character array + */ + public static char[] readChars(InputStream inputStream, String charset) { + char[] chars = null; + try { + InputStreamReader inputStreamReader; + if (charset == null) { + inputStreamReader = new InputStreamReader(inputStream); + } else { + inputStreamReader = new InputStreamReader(inputStream, charset); + } + BufferedReader bufferedReader = new BufferedReader(inputStreamReader); + char[] buffer = new char[BUFFER_SIZE]; + int length; + CharArrayWriter charArrayWriter = new CharArrayWriter(); + while ((length = bufferedReader.read(buffer)) != -1) { + charArrayWriter.write(buffer, 0, length); + } + charArrayWriter.flush(); + bufferedReader.close(); + inputStreamReader.close(); + inputStream.close(); + + chars = charArrayWriter.toCharArray(); + charArrayWriter.close(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return chars; + } + + /** + * Byte input stream -> Character array. + * + * @return Character array + */ + public static char[] readChars(InputStream inputStream) { + return readChars(inputStream, DEFAULT_CHARSET); + } + + public static String readText(InputStream inputStream) { + return String.valueOf(readChars(inputStream)); + } + public static String readCloseTextStream(final InputStream stream) { return readCloseTextStream(stream, true).get(0); } @@ -575,7 +630,7 @@ public static void retrieveTextFileSummary(File file, AtomicInteger numCharacter while ((line = br.readLine()) != null) { numLines.getAndIncrement(); numCharacters.getAndSet(numCharacters.get() + line.length()); - if (!line.equals("")) { + if (!line.isEmpty()) { numWords.getAndSet(numWords.get() + line.split("\\s+").length); } } @@ -595,7 +650,7 @@ public static void retrieveTextFileSummary(File file, AtomicInteger numCharacter } /** - * Format filesize to human readable format + * Format filesize to human-readable format * Get size in bytes e.g. from {@link File} using {@code File#length()} */ public static String getReadableFileSize(long size, boolean abbreviation) { @@ -604,7 +659,7 @@ public static String getReadableFileSize(long size, boolean abbreviation) { } String[] units = abbreviation ? new String[]{"B", "kB", "MB", "GB", "TB"} : new String[]{"Bytes", "Kilobytes", "Megabytes", "Gigabytes", "Terabytes"}; int unit = (int) (Math.log10(size) / Math.log10(1024)); - return new DecimalFormat("#,##0.#", DecimalFormatSymbols.getInstance(Locale.ENGLISH)).format(size / Math.pow(1024, unit)) + " " + units[unit]; + return new DecimalFormat("#,##0.##", DecimalFormatSymbols.getInstance(Locale.ENGLISH)).format(size / Math.pow(1024, unit)) + " " + units[unit]; } public static int[] getTimeDiffHMS(long now, long past) { @@ -706,7 +761,7 @@ public static long crc32(final byte[] data) { return alg.getValue(); } - // Return true if the target file exists, false if there is an issue with the file or it's parent directories + // Return true if the target file exists, false if there is an issue with the file, or it's parent directories public static boolean fileExists(final File checkFile, boolean... caseInsensitive) { boolean isAndroid = System.getProperty("java.specification.vendor").contains("Android"); boolean sensitive = !isAndroid && (caseInsensitive == null || caseInsensitive.length == 0 || !caseInsensitive[0]); @@ -782,7 +837,7 @@ public static String getPrefix(final String name) { public static final String SORT_BY_NAME = "NAME", SORT_BY_FILESIZE = "FILESIZE", SORT_BY_MTIME = "MTIME", SORT_BY_MIMETYPE = "MIMETYPE"; /** - * Get a key which can be use to sort File objects + * Get a key which can be used to sort File objects * This is highly performant as each file is processed exactly once. * Inspired by python's sort * @@ -814,12 +869,14 @@ public static class SortOrder { public boolean reverse = false; public boolean showDotFiles = false; public boolean folderFirst = true; + public boolean favoriteFirst = false; public boolean isFolderLocal = false; private final static String SORT_BY_KEY = "SORT_BY"; private final static String REVERSE_KEY = "REVERSE"; private final static String SHOW_DOT_FILES_KEY = "SHOW_DOT_FILES"; private final static String FOLDER_FIRST_KEY = "FOLDER_FIRST"; + private final static String FAVORITE_FIRST_KEY = "FAVORITE_FIRST"; @NonNull @Override @@ -829,6 +886,7 @@ public String toString() { map.put(REVERSE_KEY, String.valueOf(reverse)); map.put(SHOW_DOT_FILES_KEY, String.valueOf(showDotFiles)); map.put(FOLDER_FIRST_KEY, String.valueOf(folderFirst)); + map.put(FAVORITE_FIRST_KEY, String.valueOf(favoriteFirst)); return GsTextUtils.mapToJsonString(map); } @@ -839,11 +897,12 @@ public static SortOrder fromString(final String json) { fso.reverse = Boolean.parseBoolean(GsCollectionUtils.getOrDefault(map, REVERSE_KEY, "false")); fso.showDotFiles = Boolean.parseBoolean(GsCollectionUtils.getOrDefault(map, SHOW_DOT_FILES_KEY, "false")); fso.folderFirst = Boolean.parseBoolean(GsCollectionUtils.getOrDefault(map, FOLDER_FIRST_KEY, "true")); + fso.favoriteFirst = Boolean.parseBoolean(GsCollectionUtils.getOrDefault(map, FAVORITE_FIRST_KEY, "false")); return fso; } } - public static void sortFiles(final Collection filesToSort, final SortOrder order) { + public static void sortFiles(final Collection filesToSort, final SortOrder order, Collection favouriteFiles) { if (filesToSort != null && !filesToSort.isEmpty()) { try { final boolean copy = !(filesToSort instanceof List); @@ -856,6 +915,18 @@ public static void sortFiles(final Collection filesToSort, final SortOrder if (order.folderFirst) { GsCollectionUtils.keySort(sortable, (f) -> !f.isDirectory()); } + if (order.favoriteFirst && favouriteFiles != null) { + List pinnedFiles = new ArrayList<>(); // Files should be pinned to top + for (File file : sortable) { + if (favouriteFiles.contains(file)) { + pinnedFiles.add(file); + } + } + if (pinnedFiles.size() > 0) { + sortable.removeAll(pinnedFiles); + sortable.addAll(0, pinnedFiles); + } + } if (copy) { filesToSort.clear(); diff --git a/app/src/main/res/layout/document__fragment__edit.xml b/app/src/main/res/layout/document__fragment__edit.xml index 301bceb3dc..ff9cfd177b 100644 --- a/app/src/main/res/layout/document__fragment__edit.xml +++ b/app/src/main/res/layout/document__fragment__edit.xml @@ -17,13 +17,14 @@ tools:showIn="@layout/document__activity"> diff --git a/app/src/main/res/layout/edit_text_preference.xml b/app/src/main/res/layout/edit_text_preference.xml new file mode 100644 index 0000000000..429e44919b --- /dev/null +++ b/app/src/main/res/layout/edit_text_preference.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/file_info_dialog.xml b/app/src/main/res/layout/file_info_dialog.xml index 49f714a0a1..99893adda8 100644 --- a/app/src/main/res/layout/file_info_dialog.xml +++ b/app/src/main/res/layout/file_info_dialog.xml @@ -41,12 +41,12 @@ android:textStyle="bold" /> @@ -62,7 +62,7 @@ android:textStyle="bold" /> + tools:text="@string/last_modified_with_arg" /> @@ -191,28 +191,28 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" - android:layout_marginTop="24dp" + android:layout_marginTop="16dp" android:text="@string/settings" android:textAppearance="@style/TextAppearance.AppCompat.Title" /> diff --git a/app/src/main/res/layout/rename__dialog.xml b/app/src/main/res/layout/rename__dialog.xml index 6839560336..c59489dd36 100644 --- a/app/src/main/res/layout/rename__dialog.xml +++ b/app/src/main/res/layout/rename__dialog.xml @@ -11,7 +11,7 @@ --> #808080 #FF9800 - #388E3C + #388E3C #EEEEEE #DE000000 diff --git a/app/src/main/res/values/string-not_translatable.xml b/app/src/main/res/values/string-not_translatable.xml index 6198fc758c..8668d9d6eb 100644 --- a/app/src/main/res/values/string-not_translatable.xml +++ b/app/src/main/res/values/string-not_translatable.xml @@ -69,29 +69,24 @@ work. If not, see . [Project page](https://github.com/gsantner/markor#readme) | [Source code](https://github.com/gsantner/markor) | [F-Droid](https://f-droid.org/repository/browse/?fdid=net.gsantner.markor) ]]> - Inject -> head - Inject -> body - CSS, JavaScript]]> - - \nhtml, body { - \n/* - \nfont-family: sans-serif-condensed; - \nfont-size: 80%; - \n*/ - \n} - \n - \n - \n - ]]> + Inject → head + Inject → body + CSS, JavaScript]]> + \n + html, body {\n + \t/*\n + \tfont-family: sans-serif-condensed;\n + \tfont-size: 80%;\n + \t*/\n + }\n\n\n]]> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a6f467faa1..004e3b8caa 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -22,7 +22,6 @@ work. If not, see . Browse filesystem Title Empty directory - Enter the name of your folder Create Folder Create new document Move @@ -58,10 +57,11 @@ work. If not, see . File Image Font Size + -1: Follow the font size of editor Render for right-to-left languages Error: Cannot create notebook directory - Last modified: %s + Last modified: %s Last modified Select this folder Select @@ -104,6 +104,7 @@ work. If not, see . Exit Undo Redo + Reset More Notebook Help @@ -235,6 +236,7 @@ work. If not, see . Center text Edit text in the center of the screen Clipboard + Copied! Link copied! Select existing document Select or create document @@ -251,6 +253,7 @@ work. If not, see . Give feedback, report bugs or suggest improvements Translate this app into other languages Source Code + Copy build information Project License Contribute code to the project. Everybody is welcome to do so, including newcomers Project Team @@ -316,6 +319,7 @@ work. If not, see . Swipe to change mode Swipe to change to edit or view mode (opposite of the current mode) Folder first + Favorite first Go to Go to a specific line Select lines @@ -399,7 +403,7 @@ work. If not, see . Inline code Horizontal line Toggle done - Link color + Link text color Add context Add project Archive completed tasks diff --git a/app/src/main/res/xml/prefactions__more_information.xml b/app/src/main/res/xml/prefactions__more_information.xml index 54e2cf71a5..54dec0387d 100644 --- a/app/src/main/res/xml/prefactions__more_information.xml +++ b/app/src/main/res/xml/prefactions__more_information.xml @@ -16,7 +16,6 @@ android:layout_height="match_parent" android:title="@string/more"> - - + android:title="@string/copy_build_information" /> - - + diff --git a/app/src/main/res/xml/preferences_master.xml b/app/src/main/res/xml/preferences_master.xml index 5c13d3e4a4..baa78060fe 100644 --- a/app/src/main/res/xml/preferences_master.xml +++ b/app/src/main/res/xml/preferences_master.xml @@ -414,13 +414,13 @@ android:title="@string/swipe_to_change_mode" /> - - + android:title="@string/link_text_color" /> diff --git a/app/thirdparty/assets/cm-editor/assets/index-BtMETET9.js b/app/thirdparty/assets/cm-editor/assets/index-BtMETET9.js new file mode 100644 index 0000000000..8b0f87448a --- /dev/null +++ b/app/thirdparty/assets/cm-editor/assets/index-BtMETET9.js @@ -0,0 +1,24 @@ +(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();let Rs=[],Nh=[];(()=>{let n="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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,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=Nh[i])e=i+1;else return!0;if(e==t)return!1}}function Tl(n){return n>=127462&&n<=127487}const Cl=8205;function vd(n,e,t=!0,i=!0){return(t?Uh:Pd)(n,e,i)}function Uh(n,e,t){if(e==n.length)return e;e&&Fh(n.charCodeAt(e))&&Hh(n.charCodeAt(e-1))&&e--;let i=Ur(n,e);for(e+=Zl(i);e=0&&Tl(Ur(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function Pd(n,e,t){for(;e>0;){let i=Uh(n,e-2,t);if(i=56320&&n<57344}function Hh(n){return n>=55296&&n<56320}function Zl(n){return n<65536?1:2}class D{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=ci(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),Je.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=ci(this,e,t);let i=[];return this.decompose(e,t,i,0),Je.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Yi(this),s=new Yi(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new Yi(this,e)}iterRange(e,t=this.length){return new Kh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Jh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?D.empty:e.length<=32?new ee(e):Je.from(ee.split(e,[]))}}class ee extends D{constructor(e,t=Td(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Cd(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new ee(Xl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=En(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ee(l,o.length+s.length));else{let a=l.length>>1;i.push(new ee(l.slice(0,a)),new ee(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ee))return super.replace(e,t,i);[e,t]=ci(this,e,t);let r=En(this.text,En(i.text,Xl(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new ee(r,s):Je.from(ee.split(r,[]),s)}sliceString(e,t=this.length,i=` +`){[e,t]=ci(this,e,t);let r="";for(let s=0,o=0;s<=t&&oe&&o&&(r+=i),es&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new ee(i,r)),i=[],r=-1);return r>-1&&t.push(new ee(i,r)),t}}class Je extends D{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=ci(this,e,t),i.lines=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new Je(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` +`){[e,t]=ci(this,e,t);let r="";for(let s=0,o=0;se&&s&&(r+=i),eo&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Je))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new ee(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let O;if(d.lines>s&&d instanceof Je)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof ee&&a&&(O=c[c.length-1])instanceof ee&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new ee(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Je.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new Je(l,t)}}D.empty=new ee([""],0);function Td(n){let e=-1;for(let t of n)e+=t.length+1;return e}function En(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s=t&&(a>i&&(l=l.slice(0,i-r)),r0?1:(e instanceof ee?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof ee?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(r instanceof ee){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ee?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Kh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Yi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Jh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(D.prototype[Symbol.iterator]=function(){return this.iter()},Yi.prototype[Symbol.iterator]=Kh.prototype[Symbol.iterator]=Jh.prototype[Symbol.iterator]=function(){return this});class Cd{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function ci(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function se(n,e,t=!0,i=!0){return vd(n,e,t,i)}function Zd(n){return n>=56320&&n<57344}function Xd(n){return n>=55296&&n<56320}function be(n,e){let t=n.charCodeAt(e);if(!Xd(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Zd(i)?(t-55296<<10)+(i-56320)+65536:t}function Xo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function et(n){return n<65536?1:2}const zs=/\r\n?|\n/;var he=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(he||(he={}));class ot{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return s+(e-r);s+=l}else{if(i!=he.Simple&&h>=e&&(i==he.TrackDel&&re||i==he.TrackBefore&&re))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i=0&&r<=t&&l>=e)return rt?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ot(e)}static create(e){return new ot(e)}}class ne extends ot{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ys(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Vs(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length0&&wt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;ou||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let O=d?typeof d=="string"?D.of(d.split(i||zs)):d:D.empty,m=O.length;if(f==u&&m==0)return;fo&&ue(r,f-o,-1),ue(r,u-f,m),wt(s,r,O),o=u}}return h(e),a(!l),l}static empty(e){return new ne(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;rl&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function wt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function Vs(n,e,t,i=!1){let r=[],s=i?[]:null,o=new Wi(n),l=new Wi(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ue(r,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,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.lena||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class Wi{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?D.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?D.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class _t{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}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 e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new _t(i,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return S.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return S.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return S.range(e.anchor,e.head)}static create(e,t,i){return new _t(e,t,i)}}class S{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:S.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new S(e.ranges.map(t=>_t.fromJSON(t)),e.main)}static single(e,t=e){return new S([S.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;re?8:0)|s)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;rs.head?S.range(a,l):S.range(l,a))}}return new S(e,t)}}function tc(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ao=0;class T{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Ao++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new T(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Mo),!!e.static,e.enables)}of(e){return new _n([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _n(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _n(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Mo(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class _n{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Ao++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Es(f,c)){let d=i(f);if(l?!Al(d,f.values[o],r):!r(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,O=u.config.address[s];if(O!=null){let m=Kn(u,O);if(this.dependencies.every(g=>g instanceof T?u.facet(g)===f.facet(g):g instanceof fe?u.field(g,!1)==f.field(g,!1):!0)||(l?Al(d=i(f),m,r):r(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function Al(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;ci===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(pn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(pn),o=r.facet(pn),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,pn.of({field:this,create:e})]}get extension(){return this}}const Vt={lowest:4,low:3,default:2,high:1,highest:0};function $i(n){return e=>new ic(e,n)}const At={highest:$i(Vt.highest),high:$i(Vt.high),default:$i(Vt.default),low:$i(Vt.low),lowest:$i(Vt.lowest)};class ic{constructor(e,t){this.inner=e,this.prec=t}}class Zr{of(e){return new _s(this,e)}reconfigure(e){return Zr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class _s{constructor(e,t){this.compartment=e,this.inner=t}}class Hn{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let u of Md(e,t,o))u instanceof fe?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i?.config.facets;for(let u in s){let d=s[u],O=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[O.id]=a.length<<1|1,Mo(m,d))a.push(i.facet(O));else{let g=O.combine(d.map(Q=>Q.value));a.push(i&&O.compare(g,i.facet(O))?i.facet(O):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(Q=>g.dynamicSlot(Q)));l[O.id]=h.length<<1,h.push(g=>Ad(g,O,d))}}let f=h.map(u=>u(l));return new Hn(e,o,f,l,a,s)}}function Md(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof _s&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof _s){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof ic)s(o.inner,o.prec);else if(o instanceof fe)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof _n)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Vt.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(n,Vt.default),i.reduce((o,l)=>o.concat(l))}function Vi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function Kn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const nc=T.define(),Ds=T.define({combine:n=>n.some(e=>e),static:!0}),rc=T.define({combine:n=>n.length?n[0]:void 0,static:!0}),sc=T.define(),oc=T.define(),lc=T.define(),ac=T.define({combine:n=>n.length?n[0]:!1});class St{constructor(e,t){this.type=e,this.value=t}static define(){return new Rd}}class Rd{of(e){return new St(this,e)}}class zd{constructor(e){this.map=e}of(e){return new M(this,e)}}class M{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new M(this.type,t)}is(e){return this.type==e}static define(e={}){return new zd(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}M.reconfigure=M.define();M.appendConfig=M.define();class ie{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&tc(i,t.newLength),s.some(l=>l.type==ie.time)||(this.annotations=s.concat(ie.time.of(Date.now())))}static create(e,t,i,r,s,o){return new ie(e,t,i,r,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(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(ie.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}ie.time=St.define();ie.userEvent=St.define();ie.addToHistory=St.define();ie.remote=St.define();function Yd(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i=n[i]))s=n[i++],o=n[i++];else if(r=0;r--){let s=i[r](n);s instanceof ie?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof ie?n=s[0]:n=cc(e,ii(s),!1)}return n}function Ed(n){let e=n.startState,t=e.facet(lc),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=hc(i,qs(e,s,n.changes.newLength),!0))}return i==n?n:ie.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const _d=[];function ii(n){return n==null?_d:Array.isArray(n)?n:[n]}var F=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(F||(F={}));const Dd=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Ws;try{Ws=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function qd(n){if(Ws)return Ws.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||Dd.test(t)))return!0}return!1}function Wd(n){return e=>{if(!/\S/.test(e))return F.Space;if(qd(e))return F.Word;for(let t=0;t-1)return F.Word;return F.Other}}class _{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;lr.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(M.reconfigure)?(t=null,i=l.value):l.is(M.appendConfig)&&(t=null,i=ii(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=Hn.resolve(i,r,this),s=new _(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Ds)?e.newSelection:e.newSelection.asSingle();new _(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:S.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=ii(i.effects);for(let l=1;lo.spec.fromJSON(l,a)))}}return _.create({doc:e.doc,selection:S.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Hn.resolve(e.extensions||[],new Map),i=e.doc instanceof D?e.doc:D.of((e.doc||"").split(t.staticFacet(_.lineSeparator)||zs)),r=e.selection?e.selection instanceof S?e.selection:S.single(e.selection.anchor,e.selection.head):S.single(0);return tc(r,i.length),t.staticFacet(Ds)||(r=r.asSingle()),new _(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(_.tabSize)}get lineBreak(){return this.facet(_.lineSeparator)||` +`}get readOnly(){return this.facet(ac)}phrase(e,...t){for(let i of this.facet(_.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let s of this.facet(nc))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return Wd(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=se(t,o,!1);if(s(t.slice(a,o))!=F.Word)break;o=a}for(;ln.length?n[0]:4});_.lineSeparator=rc;_.readOnly=ac;_.phrases=T.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(r=>n[r]==e[r])}});_.languageData=nc;_.changeFilter=sc;_.transactionFilter=oc;_.transactionExtender=lc;Zr.reconfigure=M.define();function at(n,e,t={}){let i={};for(let r of n)for(let s of Object.keys(r)){let o=r[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))i[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}class $t{eq(e){return this==e}range(e,t=e){return Ls.create(e,t,this)}}$t.prototype.startSide=$t.prototype.endSide=0;$t.prototype.point=!1;$t.prototype.mapMode=he.TrackDel;function Ro(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let Ls=class fc{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new fc(e,t,i)}};function Bs(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class zo{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,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)),i.push(h),r.push(u-o),s.push(d-o))}return{mapped:i.length?new zo(r,s,i,l):null,pos:o}}}class V{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new V(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(Bs)),this.isEmpty)return t.length?V.of(t):this;let l=new uc(this,null,-1).goto(0),a=0,h=[],c=new mt;for(;l.value||a=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||sl.to||s=s&&e<=s+o.length&&o.between(s,e-s,t-s,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Li.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Li.from(e).goto(t)}static compare(e,t,i,r,s=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=s),a=Ml(o,l,i),h=new vi(o,a,s),c=new vi(l,a,s);i.iterGaps((f,u,d)=>Rl(h,f,c,u,d,r)),i.empty&&i.length==0&&Rl(h,0,c,0,0,r)}static eq(e,t,i=0,r){r==null&&(r=999999999);let s=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(s.length!=o.length)return!1;if(!s.length)return!0;let l=Ml(s,o),a=new vi(s,l,0).goto(i),h=new vi(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Is(a.active,h.active)||a.point&&(!h.point||!Ro(a.point,h.point)))return!1;if(a.to>r)return!0;a.next(),h.next()}}static spans(e,t,i,r,s=-1){let o=new vi(e,null,s).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFroml&&(r.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(e,t=!1){let i=new mt;for(let r of e instanceof Ls?[e]:t?Ld(e):e)i.add(r.from,r.to,r.value);return i.finish()}static join(e){if(!e.length)return V.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let r=e[i];r!=V.empty;r=r.nextLayer)t=new V(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}V.empty=new V([],[],null,-1);function Ld(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(Bs);e=i}return n}V.empty.nextLayer=V.empty;class mt{finishChunk(e){this.chunks.push(new zo(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new mt)).add(e,t,i)}addInner(e,t,i){let r=e-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(V.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=V.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Ml(n,e,t){let i=new Map;for(let s of n)for(let o=0;o=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&r.push(new uc(o,t,i,s));return r.length==1?r[0]:new Li(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Fr(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Fr(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Fr(this.heap,0)}}}function Fr(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let r=n[i];if(i+1=0&&(r=n[i+1],i++),t.compare(r)<0)break;n[i]=t,n[e]=r,e=i}}class vi{constructor(e,t,i){this.minPoint=i,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=Li.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){mn(this.active,e),mn(this.activeTo,e),mn(this.activeRank,e),this.minActive=zl(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:r,rank:s}=this.cursor;for(;t0;)t++;gn(this.active,t,i),gn(this.activeTo,t,r),gn(this.activeRank,t,s),e&&gn(e,t,this.cursor.from),this.minActive=zl(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&mn(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let s=this.cursor.value;if(!s.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[r]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Rl(n,e,t,i,r,s){n.goto(e),t.goto(i);let o=i+r,l=i,a=i-e,h=!!s.boundChange;for(let c=!1;;){let f=n.to+a-t.to,u=f||n.endSide-t.endSide,d=u<0?n.to+a:t.to,O=Math.min(d,o);if(n.point||t.point?(n.point&&t.point&&Ro(n.point,t.point)&&Is(n.activeForPoint(n.to),t.activeForPoint(t.to))||s.comparePoint(l,O,n.point,t.point),c=!1):(c&&s.boundChange(l),O>l&&!Is(n.active,t.active)&&s.compareRange(l,O,n.active,t.active),h&&Oo)break;l=d,u<=0&&n.next(),u>=0&&t.next()}}function Is(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function zl(n,e){let t=-1,i=1e9;for(let r=0;r=e)return r;if(r==n.length)break;s+=n.charCodeAt(r)==9?t-s%t:1,r=se(n,r)}return i===!0?-1:n.length}const Gs="ͼ",Yl=typeof Symbol>"u"?"__"+Gs:Symbol.for(Gs),Ns=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Vl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class vt{constructor(e,t){this.rules=[];let{finish:i}=t||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function s(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let O=l[d];if(/&/.test(d))s(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),O,a);else if(O&&typeof O=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");s(r(d),O,c,u)}else O!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+O+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in e)s(r(o),e[o],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=Vl[Yl]||1;return Vl[Yl]=e+1,Gs+e.toString(36)}static mount(e,t,i){let r=e[Ns],s=i&&i.nonce;r?s&&r.setNonce(s):r=new Bd(e,s),r.mount(Array.isArray(t)?t:[t],e)}}let El=new Map;class Bd{constructor(e,t){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=El.get(i);if(s)return e[Ns]=s;this.sheet=new r.CSSStyleSheet,El.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[Ns]=this}mount(e,t){let i=this.sheet,r=0,s=0;for(let o=0;o-1&&(this.modules.splice(a,1),s--,a=-1),a==-1){if(this.modules.splice(s++,0,l),i)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Id=typeof navigator<"u"&&/Mac/.test(navigator.platform),jd=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var ae=0;ae<10;ae++)Pt[48+ae]=Pt[96+ae]=String(ae);for(var ae=1;ae<=24;ae++)Pt[ae+111]="F"+ae;for(var ae=65;ae<=90;ae++)Pt[ae]=String.fromCharCode(ae+32),Bi[ae]=String.fromCharCode(ae);for(var Hr in Pt)Bi.hasOwnProperty(Hr)||(Bi[Hr]=Pt[Hr]);function Gd(n){var e=Id&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||jd&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Bi:Pt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function B(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var r=t[i];typeof r=="string"?n.setAttribute(i,r):r!=null&&(n[i]=r)}e++}for(;e2);var P={mac:Dl||/Mac/.test(me.platform),windows:/Win/.test(me.platform),linux:/Linux|X11/.test(me.platform),ie:Xr,ie_version:Oc?Us.documentMode||6:Hs?+Hs[1]:Fs?+Fs[1]:0,gecko:_l,gecko_version:_l?+(/Firefox\/(\d+)/.exec(me.userAgent)||[0,0])[1]:0,chrome:!!Kr,chrome_version:Kr?+Kr[1]:0,ios:Dl,android:/Android\b/.test(me.userAgent),webkit_version:Nd?+(/\bAppleWebKit\/(\d+)/.exec(me.userAgent)||[0,0])[1]:0,safari:Ks,safari_version:Ks?+(/\bVersion\/(\d+(\.\d+)?)/.exec(me.userAgent)||[0,0])[1]:0,tabSize:Us.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Yo(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const Jn=Object.create(null);function Vo(n,e,t){if(n==e)return!0;n||(n=Jn),e||(e=Jn);let i=Object.keys(n),r=Object.keys(e);if(i.length-0!=r.length-0)return!1;for(let s of i)if(s!=t&&(r.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function Ud(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function ql(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function Fd(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new Bt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=pc(e,t);i=(s?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new Bt(e,i,r,t,e.widget||null,!0)}static line(e){return new ln(e)}static set(e,t=!1){return V.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}X.none=V.empty;class on extends X{constructor(e){let{start:t,end:i}=pc(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Yo(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Jn}eq(e){return this==e||e instanceof on&&this.tagName==e.tagName&&Vo(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}on.prototype.point=!1;class ln extends X{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof ln&&this.spec.class==e.spec.class&&Vo(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}ln.prototype.mapMode=he.TrackBefore;ln.prototype.point=!0;class Bt extends X{constructor(e,t,i,r,s,o){super(t,i,s,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?he.TrackBefore:he.TrackAfter:he.TrackDel}get type(){return this.startSide!=this.endSide?ce.WidgetRange:this.startSide<=0?ce.WidgetBefore:ce.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Bt&&Hd(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Bt.prototype.point=!0;function pc(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function Hd(n,e){return n==e||!!(n&&e&&n.compare(e))}function ni(n,e,t,i=0){let r=t.length-1;r>=0&&t[r]+i>=n?t[r]=Math.max(t[r],e):t.push(n,e)}class Ii extends $t{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Ii&&this.tagName==e.tagName&&Vo(this.attributes,e.attributes)}static create(e){return new Ii(e.tagName,e.attributes||Jn)}static set(e,t=!1){return V.of(e,t)}}Ii.prototype.startSide=Ii.prototype.endSide=-1;function ji(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function Js(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Ei(n,e){if(!e.anchorNode)return!1;try{return Js(n,e.anchorNode)}catch{return!1}}function Dn(n){return n.nodeType==3?Gi(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function _i(n,e,t,i){return t?Wl(n,e,t,i,-1)||Wl(n,e,t,i,1):!1}function Tt(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function er(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function Wl(n,e,t,i,r){for(;;){if(n==t&&e==i)return!0;if(e==(r<0?0:gt(n))){if(n.nodeName=="DIV")return!1;let s=n.parentNode;if(!s||s.nodeType!=1)return!1;e=Tt(n)+(r<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(r<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=r<0?gt(n):0}else return!1}}function gt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function tr(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function Kd(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function mc(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function Jd(n,e,t,i,r,s,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,O=1,m=1;if(d)u=Kd(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let b=c.getBoundingClientRect();({scaleX:O,scaleY:m}=mc(c,b)),u={left:b.left,right:b.left+c.clientWidth*O,top:b.top,bottom:b.top+c.clientHeight*m}}let g=0,Q=0;if(r=="nearest")e.top0&&e.bottom>u.bottom+Q&&(Q=e.bottom-u.bottom+o)):e.bottom>u.bottom&&(Q=e.bottom-u.bottom+o,t<0&&e.top-Q0&&e.right>u.right+g&&(g=e.right-u.right+s)):e.right>u.right&&(g=e.right-u.right+s,t<0&&e.leftu.bottom||e.leftu.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function gc(n,e=!0){let t=n.ownerDocument,i=null,r=null;for(let s=n.parentNode;s&&!(s==t.body||(!e||i)&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),e&&!i&&s.scrollWidth>s.clientWidth&&(i=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:i,y:r}}class eO{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?gt(t):0),i,Math.min(e.focusOffset,i?gt(i):0))}set(e,t,i,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=r}}let Yt=null;P.safari&&P.safari_version>=26&&(Yt=!1);function Qc(n){if(n.setActive)return n.setActive();if(Yt)return n.focus(Yt);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Yt==null?{get preventScroll(){return Yt={preventScroll:!0},!0}}:void 0),!Yt){Yt=!1;for(let t=0;tMath.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function bc(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=gt(t)}else if(t.parentNode&&!er(t))i=Tt(t),t=t.parentNode;else return null}}function yc(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i=t){if(l.level==i)return o;(s<0||(r!=0?r<0?l.fromt:e[s].level>l.level))&&(s=o)}}if(s<0)throw new RangeError("Index out of range");return s}}function kc(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;m-=3)if(Ue[m+1]==-d){let g=Ue[m+2],Q=g&2?r:g&4?g&1?s:r:0;Q&&(j[f]=j[Ue[m]]=Q),l=m;break}}else{if(Ue.length==189)break;Ue[l++]=f,Ue[l++]=u,Ue[l++]=a}else if((O=j[f])==2||O==1){let m=O==r;a=m?0:1;for(let g=l-3;g>=0;g-=3){let Q=Ue[g+2];if(Q&2)break;if(m)Ue[g+2]|=2;else{if(Q&4)break;Ue[g+2]|=4}}}}}function aO(n,e,t,i){for(let r=0,s=i;r<=t.length;r++){let o=r?t[r-1].to:n,l=ra;)O==g&&(O=t[--m].from,g=m?t[m-1].to:n),j[--O]=d;a=c}else s=h,a++}}}function to(n,e,t,i,r,s,o){let l=i%2?2:1;if(i%2==r%2)for(let a=e,h=0;aa&&o.push(new it(a,m.from,d));let g=m.direction==It!=!(d%2);io(n,g?i+1:i,r,m.inner,m.from,m.to,o),a=m.to}O=m.to}else{if(O==t||(c?j[O]!=l:j[O]==l))break;O++}u?to(n,a,O,i+1,r,u,o):ae;){let c=!0,f=!1;if(!h||a>s[h-1].to){let m=j[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,O=a;e:for(;;)if(h&&O==s[h-1].to){if(f)break e;let m=s[--h];if(!c)for(let g=m.from,Q=h;;){if(g==e)break e;if(Q&&s[Q-1].to==g)g=s[--Q].from;else{if(j[g-1]==l)break e;break}}if(u)u.push(m);else{m.toj.length;)j[j.length]=256;let i=[],r=e==It?0:1;return io(n,r,r,t,0,n.length,i),i}function $c(n){return[new it(0,n,0)]}let vc="";function cO(n,e,t,i,r){var s;let o=i.head-n.from,l=it.find(e,o,(s=i.bidiLevel)!==null&&s!==void 0?s:-1,i.assoc),a=e[l],h=a.side(r,t);if(o==h){let u=l+=r?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!r,t),h=a.side(r,t)}let c=se(n.text,o,a.forward(r,t));(ca.to)&&(c=h),vc=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(r?e.length-1:0)?null:e[l+(r?1:-1)];return f&&c==h&&f.level+(r?0:1)n.some(e=>e)}),Rc=T.define({combine:n=>n.some(e=>e)}),zc=T.define();class si{constructor(e,t="nearest",i="nearest",r=5,s=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=r,this.xMargin=s,this.isSnapshot=o}map(e){return e.empty?this:new si(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new si(S.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Qn=M.define({map:(n,e)=>n.map(e)}),Yc=M.define();function we(n,e,t){let i=n.facet(Zc);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const dt=T.define({combine:n=>n.length?n[0]:!0});let uO=0;const Kt=T.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let a=[];return o&&a.push(Ar.of(h=>{let c=h.plugin(l);return c?o(c):X.none})),s&&a.push(s(l)),a})}static fromClass(e,t){return te.define((i,r)=>new e(i,r),t)}}class Jr{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(we(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){we(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){we(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Vc=T.define(),qo=T.define(),Ar=T.define(),Ec=T.define(),Wo=T.define(),an=T.define(),_c=T.define();function Bl(n,e){let t=n.state.facet(_c);if(!t.length)return t;let i=t.map(s=>s instanceof Function?s(n):s),r=[];return V.spans(i,e.from,e.to,{point(){},span(s,o,l,a){let h=s-e.from,c=o-e.from,f=r;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,O;if(d==null&&(d=fO(e.text,h,c)),a>0&&f.length&&(O=f[f.length-1]).to==h&&O.direction==d)O.to=c,f=O.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),r}const Dc=T.define();function Lo(n){let e=0,t=0,i=0,r=0;for(let s of n.state.facet(Dc)){let o=s(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:t,top:i,bottom:r}}const Ai=T.define();class Ye{constructor(e,t,i,r){this.fromA=e,this.toA=t,this.fromB=i,this.toB=r}join(e){return new Ye(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>i.toA)){if(r.toAr.push(new Ye(s,o,l,a))),this.changedRanges=r}static create(e,t,i){return new ir(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const dO=[];class K{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return dO}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&Ud(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let r of this.children){if(r==e)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=Tt(this.dom),r=this.length?e>0:t>0;return new We(this.parent.dom,i+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Rr)return e;return null}static get(e){return e.cmTile}}class Mr extends K{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,r,s=e?.node==t?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,r=i?i.nextSibling:t.firstChild,s&&r!=l.dom&&(s.written=!0),l.dom.parentNode==t)for(;r&&r!=l.dom;)r=Il(r);else t.insertBefore(l.dom,r);i=l.dom}for(r=i?i.nextSibling:t.firstChild,s&&r&&(s.written=!0);r;)r=Il(r);this.length=o}}function Il(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Rr extends Mr{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=K.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,r=0,s=0;;)if(r==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&s++,r=t.pop()}else{let o=i.children[r++];if(o instanceof Ot)t.push(r),i=o,r=0;else{let l=s+o.length,a=e(o,s);if(a!==void 0)return a;s=l+o.breakAfter}}}resolveBlock(e,t){let i,r=-1,s,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(e>=a&&e<=h){if(l.isWidget()&&t>=-1&&t<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(ae||e==a&&(t>1?l.length:l.covers(-1)))&&(!s||!l.isWidget()&&s.isWidget())&&(s=l,o=e-a)}}),!i&&!s)throw new Error("No tile at position "+e);return i&&t<0||!s?{tile:i,offset:r}:{tile:s,offset:o}}}class Ot extends Mr{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new Ot(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class fi extends Mr{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let r=new fi(t||document.createElement("div"),e);return(!t||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,i){let r=null,s=-1,o=null,l=-1;function a(c,f){for(let u=0,d=0;u=f&&(O.isComposite()?a(O,f-d):(!o||o.isHidden&&(t>0||i&&pO(o,O)))&&(m>f||O.flags&32)?(o=O,l=f-d):(di&&(e=i);let r=e,s=e,o=0;e==0&&t<0||e==i&&t>=0?P.chrome||P.gecko||(e?(r--,o=1):s=0)?0:l.length-1];return P.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?tr(a,o<0):a||null}static of(e,t){let i=new Dt(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class jt extends K{constructor(e,t,i,r){super(e,t,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(i)return tr(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let s=this.dom.getClientRects(),o=null;if(!s.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?s.length-1:0;o=s[a],!(e>0?a==0:a==s.length-1||o.top0;)if(r.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(s==r.children.length){if(!e&&!l.length)break;i&&i.leave(r),o=!!r.breakAfter,{tile:r,index:s}=l.pop(),s++}else{let a=r.children[s],h=a.breakAfter;(t>0?a.length<=e:a.length=0;l--){let a=t.marks[l],h=r.lastChild;if(h instanceof xe&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(es(a.dom)),r=h;else{if(this.cache.reused.get(a)){let f=K.get(a.dom);f&&f.setDOM(es(a.dom))}let c=xe.of(a.mark,a.dom);r.append(c),r=c}this.cache.reused.set(a,2)}let s=K.get(e.text);s&&this.cache.reused.set(s,2);let o=new Dt(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,t,i){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let s=this.ensureMarks(t,i);!r&&!(e.flags&16)&&s.append(this.getBuffer(1)),s.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=qc);let r=fi.start(e,t||((i=this.cache.find(fi))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let r=this.curLine;for(let s=e.length-1;s>=0;s--){let o=e[s],l;if(t>0&&(l=r.lastChild)&&l instanceof xe&&l.mark.eq(o))r=l,t--;else{let a=xe.of(o,(i=this.cache.find(xe,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);r.append(a),r=a,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!jl(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(P.ios&&jl(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(ts,0,32)||new jt(ts.toDOM(),0,ts,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=new gO(e.from,e.to,e.value,e.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-t.rank||this.wrappers[i-1].to-t.to)<0;)i--;this.wrappers.splice(i,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let r=t.lastChild;if(i.fromo.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(s),t=s}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(nr,void 0,1);return i&&(i.flags=t),i||new nr(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class SO{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:s,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let l=this.textOff=Math.min(e,r.length);return s?null:r.slice(0,l)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const rr=[jt,fi,Dt,xe,nr,Ot,Rr];for(let n=0;n[]),this.index=rr.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let r=e.bucket,s=this.buckets[r],o=this.index[r];for(let l=s.length-1;l>=0;l--){let a=(l+o)%s.length,h=s[a];if((!t||t(h))&&!this.reused.has(h))return s.splice(a,1),a{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let r=0,s=0,o=0;;){let l=or){let h=a-r;this.preserve(h,!o,!l),r=a,s+=h}if(!l)break;t&&l.fromA<=t.range.fromA&&l.toA>=t.range.toA?(this.forward(l.fromA,t.range.fromA,t.range.fromA{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof xe&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=s=0):o instanceof xe&&(r.shift(),s=Math.min(s,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,r=this.builder,s=0,o=V.spans(this.decorations,e,t,{point:(l,a,h,c,f,u)=>{if(h instanceof Bt){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(s=c.length,f>c.length)r.continueWidget(a-l);else{let d=h.widget||(h.block?ui.block:ui.inline),O=xO(h),m=this.cache.findWidget(d,a-l,O)||jt.of(d,this.view,a-l,O);h.block?(h.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(m)):(r.ensureLine(i),r.addInlineWidget(m,c,f))}i=null}else i=wO(i,h);a>l&&this.text.skip(a-l)},span:(l,a,h,c)=>{for(let f=l;fs,this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let r=e.parentNode;;r=r.parentNode){let s=K.get(r);if(r==this.view.contentDOM)break;s instanceof xe?t.push(s):s?.isLine()?i=s:s instanceof Ot||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new fi(r,qc):i||t.push(xe.of(new on({tagName:r.nodeName.toLowerCase(),attributes:Fd(r)}),r)))}return{line:i,marks:t}}}function jl(n,e){let t=i=>{for(let r of i.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(n)}function xO(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const qc={class:"cm-line"};function wO(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Yo(t,n),i&&(n.class+=" "+i)),n}function kO(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof xe&&e.push(i.mark)}return e}function es(n){let e=K.get(n);return e&&e.setDOM(n.cloneNode()),n}class ui extends ht{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ui.inline=new ui("span");ui.block=new ui("div");const ts=new class extends ht{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Gl{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=X.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Rr(e,e.contentDOM),this.updateInner([new Ye(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!MO(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let s=r>-1?vO(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;i=new Ye(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=s?{from:s.range.fromB,to:s.range.toB}:null,(P.ie||P.chrome)&&!s&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=CO(o,this.decorations,e.changes);a.length&&(i=Ye.extendWithRanges(i,a));let h=XO(l,this.blockWrappers,e.changes);return h.length&&(i=Ye.extendWithRanges(i,h)),s&&!i.some(c=>c.fromA<=s.range.fromA&&c.toA>=s.range.toA)&&(i=s.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,s),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,l=new yO(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&K.get(t.text)&&l.cache.reused.set(K.get(t.text),2),this.tile=l.run(e,t),ro(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=P.chrome||P.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(s),s&&(s.written||i.selectionRange.focusNode!=s.node||!this.tile.dom.contains(s.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Ei(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(s||t||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,c;if(a.empty?c=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),P.gecko&&a.empty&&!this.hasComposition&&$O(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null)),h=c=new We(u,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!_i(h.node,h.offset,f.anchorNode,f.anchorOffset)||!_i(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{P.android&&P.chrome&&i.contains(f.focusNode)&&AO(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let u=ji(this.view.root);if(u)if(a.empty){if(P.gecko){let d=PO(h.node,h.offset);if(d&&d!=3){let O=(d==1?bc:yc)(h.node,h.offset);O&&(h=new We(O.node,O.offset))}}u.collapse(h.node,h.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([h,c]=[c,h]),d.setEnd(c.node,c.offset),d.setStart(h.node,h.offset),u.removeAllRanges(),u.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new We(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new We(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&_i(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=ji(e.root),{anchorNode:r,anchorOffset:s}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(r,s)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let s;if(e==i.dom)s=i.dom.childNodes[t];else{let o=gt(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?s=e:s=e.nextSibling}if(s==i.dom.firstChild)return r;for(;s&&!K.get(s);)s=s.nextSibling;if(!s)return r+i.length;for(let o=0,l=r;;o++){let a=i.children[o];if(a.dom==s)return l;l+=a.length+a.breakAfter}}else return i.isText()?e==i.dom?r+t:r+(t?i.length:0):r}domAtPos(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(r,t)}inlineDOMNearPos(e,t){let i,r=-1,s=!1,o,l=-1,a=!1;return this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return!0;h.flags&16&&(s=!0)}else{let f=c+h.length;if(c<=e&&(i=h,r=e-c,s=f=e&&!o&&(o=h,l=e-c,a=c>e),c>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(s&&o?i=null:a&&i&&(o=null),i&&t<0||!o?i.domIn(r,t):o.domIn(l,t))}coordsAt(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof is?null:i.coordsInWidget(r,t,!0):i.coordsIn(r,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(s,o){if(s.isComposite())for(let l of s.children){if(l.length>=o){let a=r(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(s.isText()&&oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==G.LTR,h=0,c=(f,u,d)=>{for(let O=0;Or);O++){let m=f.children[O],g=u+m.length,Q=m.dom.getBoundingClientRect(),{height:b}=Q;if(d&&!O&&(h+=Q.top-d.top),m instanceof Ot)g>i&&c(m,u,Q);else if(u>=i&&(h>0&&t.push(-h),t.push(b+h),h=0,o)){let y=m.dom.lastChild,C=y?Dn(y):[];if(C.length){let x=C[C.length-1],w=a?x.right-Q.left:Q.right-x.left;w>l&&(l=w,this.minWidth=s,this.minWidthFrom=u,this.minWidthTo=g)}}d&&O==f.children.length-1&&(h+=d.bottom-Q.bottom),u=g+m.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?G.RTL:G.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let c=Dn(h.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),i,r,s;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.tile.dom.appendChild(t);let o=Dn(t.firstChild)[0];i=t.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,s=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:r,textHeight:s}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,r=0;;r++){let s=r==t.viewports.length?null:t.viewports[r],o=s?s.from-1:this.view.state.doc.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(X.replace({widget:new is(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!s)break;i=s.to+1}return X.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Ar).map(s=>(this.dynamicDecorationMap[e++]=typeof s=="function")?s(this.view):s),i=!1,r=this.view.state.facet(Wo).map((s,o)=>{let l=typeof s=="function";return l&&(i=!0),l?s(this.view):s});for(r.length&&(this.dynamicDecorationMap[e++]=i,t.push(V.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof s=="function"?s(this.view):s)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(zc))try{if(h(this.view,e.range,e))return!0}catch(c){we(this.view.state,c,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),r;if(!i)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let s=Lo(this.view),o={left:i.left-s.left,top:i.top-s.top,right:i.right+s.right,bottom:i.bottom+s.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(Jd(this.view.scrollDOM,o,t.head1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){ro(this.tile)}}function ro(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)ro(i,e)}}function $O(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function Wc(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=bc(t.focusNode,t.focusOffset),r=yc(t.focusNode,t.focusOffset),s=i||r;if(r&&i&&r.node!=i.node){let l=K.get(r.node);if(!l||l.isText()&&l.text!=r.node.nodeValue)s=r;else if(n.docView.lastCompositionAfterCursor){let a=K.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(s=r)}}if(n.docView.lastCompositionAfterCursor=s!=i,!s)return null;let o=e-s.offset;return{from:o,to:o+s.node.nodeValue.length,node:s.node}}function vO(n,e,t){let i=Wc(n,t);if(!i)return null;let{node:r,from:s,to:o}=i,l=r.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc;return{range:new Ye(a.mapPos(s),a.mapPos(o),s,o),text:r}}function PO(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}class is extends ht{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function RO(n,e,t=1){let i=n.charCategorizer(e),r=n.doc.lineAt(e),s=e-r.from;if(r.length==0)return S.cursor(e);s==0?t=1:s==r.length&&(t=-1);let o=s,l=s;t<0?o=se(r.text,s,!1):l=se(r.text,s);let a=i(r.text.slice(o,l));for(;o>0;){let h=se(r.text,o,!1);if(i(r.text.slice(h,o))!=a)break;o=h}for(;ln.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((r-t.top-(n.defaultLineHeight-l)*.5)/l);s+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+js(o,s,n.state.tabSize)}function so(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let r;for(let s of i.type){if(s.from>e)break;if(!(s.toe)return s;(!r||s.type==ce.Text&&(r.type!=s.type||(t<0?s.frome)))&&(r=s)}}return r||i}return i}function YO(n,e,t,i){let r=so(n,e.head,e.assoc||-1),s=!i||r.type!=ce.Text||!(n.lineWrapping||r.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(s){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(r.from),a=n.posAtCoords({x:t==(l==G.LTR)?o.right-1:o.left+1,y:(s.top+s.bottom)/2});if(a!=null)return S.cursor(a,t?-1:1)}return S.cursor(t?r.to:r.from,t?-1:1)}function Nl(n,e,t,i){let r=n.state.doc.lineAt(e.head),s=n.bidiSpans(r),o=n.textDirectionAt(r.from);for(let l=e,a=null;;){let h=cO(r,s,o,l,t),c=vc;if(!h){if(r.number==(t?n.state.doc.lines:1))return l;c=` +`,r=n.state.doc.line(r.number+(t?1:-1)),s=n.bidiSpans(r),h=n.visualLineSide(r,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function VO(n,e,t){let i=n.state.charCategorizer(e),r=i(t);return s=>{let o=i(s);return r==F.Space&&(r=o),r==o}}function EO(n,e,t,i){let r=e.head,s=t?1:-1;if(r==(t?n.state.doc.length:0))return S.cursor(r,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(r,(e.empty?e.assoc:0)||(t?1:-1)),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let O=n.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(r-O.from))),l=(s<0?O.top:O.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1,d=oo(n,{x:f,y:l+u*s},!1,s);return S.cursor(d.pos,d.assoc,void 0,o)}function Di(n,e,t){for(;;){let i=0;for(let r of n)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&er(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:S.cursor(i,in.viewState.docHeight)return new tt(n.state.doc.length,-1);if(h=n.elementAtHeight(a),i==null)break;if(h.type==ce.Text){if(i<0?h.ton.viewport.to)break;let u=n.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+s:u.bottom>=a+s))break}let f=n.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+f:h.top-f}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==ce.Text){let f=zO(n,r,h,o,l);return new tt(f,f==h.from?1:-1)}}if(h.type!=ce.Text)return a<(h.top+h.bottom)/2?new tt(h.from,1):new tt(h.to,-1);let c=n.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=n.docView.lineAt(h.from,-2)),new _O(n,o,l,n.textDirectionAt(h.from)).scanTile(c,h.from)}class _O{constructor(e,t,i,r){this.view=e,this.x=t,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from>1;t:if(s.has(O)){let g=i+Math.floor(Math.random()*d);for(let Q=0;Q1)){if(Q.bottomthis.y)(!a||a.top>Q.top)&&(a=Q),b=-1;else{let y=Q.left>this.x?this.x-Q.left:Q.right(f.left+f.right)/2==u}}scanText(e,t){let i=[];for(let s=0;s{let o=i[s]-t,l=i[s+1]-t;return Gi(e.dom,o,l).getClientRects()});return r.after?new tt(i[r.i+1],-1):new tt(i[r.i],1)}scanTile(e,t){if(!e.length)return new tt(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let i=[t];for(let l=0,a=t;l{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:Gi(a.dom,0,a.length)).getClientRects()}),s=e.children[r.i],o=i[r.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):r.after?new tt(i[r.i+1],-1):new tt(o,1)}}const Ut="￿";class DO{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(_.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ut}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r);let s=this.text.length;this.readNode(r);let o=K.get(r),l=r.nextSibling;if(l==t){o?.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=K.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:er(r))||er(l)&&(r.nodeName!="BR"||o?.isWidget())&&this.text.length>s)&&!WO(l,t)&&this.lineBreak(),r=l}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let s=-1,o=1,l;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=r.exec(t))&&(s=l.index,o=l[0].length),this.append(t.slice(i,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=s+o}}readNode(e){let t=K.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(qO(e,i.node,i.offset)?t:0))}}function qO(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:s,impreciseAnchor:o}=e.docView,l=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Bc(e.docView.tile,t,i,0))){let a=s||o?[]:IO(e),h=new DO(a,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=jO(a,this.bounds.from)}else{let a=e.observer.selectionRange,h=s&&s.node==a.focusNode&&s.offset==a.focusOffset||!Js(e.contentDOM,a.focusNode)?l.main.head:e.docView.posFromDOM(a.focusNode,a.focusOffset),c=o&&o.node==a.anchorNode&&o.offset==a.anchorOffset||!Js(e.contentDOM,a.anchorNode)?l.main.anchor:e.docView.posFromDOM(a.anchorNode,a.anchorOffset),f=e.viewport;if((P.ios||P.chrome)&&l.main.empty&&h!=c&&(f.from>0||f.to-1&&l.ranges.length>1)this.newSel=l.replaceRange(S.range(c,h));else if(e.lineWrapping&&c==h&&!(l.main.empty&&l.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let u=e.coordsAtPos(h,-1),d=0;u&&(d=e.inputState.lastTouchY<=u.bottom?-1:1),this.newSel=S.create([S.cursor(h,d)])}else this.newSel=S.single(c,h)}}}function Bc(n,e,t,i){if(n.isComposite()){let r=-1,s=-1,o=-1,l=-1;for(let a=0,h=i,c=i;at)return Bc(f,e,t,h);if(u>=e&&r==-1&&(r=a,s=h),h>t&&f.dom.parentNode==n.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:s,to:l<0?i+n.length:l,startDOM:(r?n.children[r-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function Ic(n,e){let t,{newSel:i}=e,{state:r}=n,s=r.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,h=s.from,c=null;(o===8||P.android&&e.text.length=l&&s.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,s.from-l)==e.text.slice(0,s.from-l)&&f.slice(s.to-l)==e.text.slice(u=e.text.length-(f.length-(s.to-l)))?t={from:s.from,to:s.to,insert:D.of(e.text.slice(s.from-l,u).split(Ut))}:(d=jc(f,e.text,h-l,c))&&(P.chrome&&o==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==Ut+Ut&&d.toB--,t={from:l+d.from,to:l+d.toA,insert:D.of(e.text.slice(d.from,d.toB).split(Ut))})}else i&&(!n.hasFocus&&r.facet(dt)||sr(i,s))&&(i=null);if(!t&&!i)return!1;if((P.mac||P.android)&&t&&t.from==t.to&&t.from==s.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=S.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:D.of([t.insert.toString().replace("."," ")])}):r.doc.lineAt(s.from).toDate.now()-50?t={from:s.from,to:s.to,insert:r.toText(n.inputState.insertingText)}:P.chrome&&t&&t.from==t.to&&t.from==s.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=S.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:D.of([" "])}),t)return Bo(n,t,i,o);if(i&&!sr(i,s)){let l=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=Lc(r.facet(an).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function Bo(n,e,t,i=-1){if(P.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(P.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ri(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.lengthr.head)&&ri(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&ri(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=BO(n,e,t));return n.state.facet(Xc).some(a=>a(n,e.from,e.to,s,l))||n.dispatch(l()),!0}function BO(n,e,t){let i,r=n.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.froms.to){let a=e.fromf(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:S.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=s.frome.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=r.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&Wc(n,t.main.head);if(u){let O=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-O}}else f=n.state.doc.lineAt(s.head);let d=s.to-e.to;i=r.changeByRange(O=>{if(O.from==s.from&&O.to==s.to)return{changes:a,range:h||O.map(a)};let m=O.to-d,g=m-c.length;if(n.state.sliceDoc(g,m)!=c||m>=f.from&&g<=f.to)return{range:O};let Q=r.changes({from:g,to:m,insert:e.insert}),b=O.to-s.to;return{changes:Q,range:h?S.range(Math.max(0,h.anchor+b),Math.max(0,h.head+b)):O.map(Q)}})}else i={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function jc(n,e,t,i){let r=Math.min(n.length,e.length),s=0;for(;s0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function IO(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new Ul(t,i)),(r!=t||s!=i)&&e.push(new Ul(r,s))),e}function jO(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?S.single(t+e,i+e):null}function sr(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class GO{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,P.safari&&e.contentDOM.addEventListener("input",()=>null),P.gecko&&ap(e.contentDOM.ownerDocument)}handleEvent(e){!tp(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=NO(e),i=this.handlers,r=this.view.contentDOM;for(let s in t)if(s!="scroll"){let o=!t[s].handlers.length,l=i[s];l&&o!=!l.handlers.length&&(r.removeEventListener(s,this.handleEvent),l=null),l||r.addEventListener(s,this.handleEvent,{passive:o})}for(let s in i)s!="scroll"&&!t[s]&&r.removeEventListener(s,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Nc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),P.android&&P.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return P.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Gc.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||UO.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from0?!0:P.safari&&!P.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Fl(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(r){we(t.state,r)}}}function NO(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let r=i.spec,s=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(s)for(let l in s){let a=s[l];a&&t(l).handlers.push(Fl(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(Fl(i.value,a))}}for(let i in Be)t(i).handlers.push(Be[i]);for(let i in $e)t(i).observers.push($e[i]);return e}const Gc=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],UO="dthko",Nc=[16,17,18,20,91,92,224,225],Sn=6;function bn(n){return Math.max(0,n)*.7+8}function FO(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class HO{constructor(e,t,i,r){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=gc(e.contentDOM),this.atoms=e.state.facet(an).map(o=>o(e));let s=e.contentDOM.ownerDocument;s.addEventListener("mousemove",this.move=this.move.bind(this)),s.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(_.allowMultipleSelections)&&KO(e,t),this.dragging=ep(e,t)&&Hc(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&FO(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,r=0,s=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:s,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Lo(this.view);e.clientX-a.left<=r+Sn?t=-bn(r-e.clientX):e.clientX+a.right>=o-Sn&&(t=bn(e.clientX-o)),e.clientY-a.top<=s+Sn?i=-bn(s-e.clientY):e.clientY+a.bottom>=l-Sn&&(i=bn(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=Lc(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function KO(n,e){let t=n.state.facet(Pc);return t.length?t[0](e):P.mac?e.metaKey:e.ctrlKey}function JO(n,e){let t=n.state.facet(Tc);return t.length?t[0](e):P.mac?!e.altKey:!e.ctrlKey}function ep(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=ji(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let s=0;s=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function tp(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=K.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const Be=Object.create(null),$e=Object.create(null),Uc=P.ie&&P.ie_version<15||P.ios&&P.webkit_version<604;function ip(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Fc(n,t.value)},50)}function zr(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function Fc(n,e){e=zr(n.state,_o,e);let{state:t}=n,i,r=1,s=t.toText(e),o=s.lines==t.selection.ranges.length;if(lo!=null&&t.selection.ranges.every(a=>a.empty)&&lo==s.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?s.line(r++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:S.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=s.line(r++);return{changes:{from:a.from,to:a.to,insert:h.text},range:S.cursor(a.from+h.length)}}):i=t.replaceSelection(s);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}$e.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};$e.wheel=$e.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};Be.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);$e.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};$e.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};Be.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(Cc))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=rp(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new HO(n,e,t,i)),i&&n.observer.ignore(()=>{Qc(n.contentDOM);let s=n.root.activeElement;s&&!s.contains(n.contentDOM)&&s.blur()});let r=n.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function Hl(n,e,t,i){if(i==1)return S.cursor(e,t);if(i==2)return RO(n.state,e,t);{let r=n.docView.lineAt(e,t),s=n.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:s.from,l=r?r.posAtEnd:s.to;return lDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Jl+1)%3:1}function rp(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=Hc(e),r=n.state.selection;return{update(s){s.docChanged&&(t.pos=s.changes.mapPos(t.pos),r=r.map(s.changes))},get(s,o,l){let a=n.posAndSideAtCoords({x:s.clientX,y:s.clientY},!1),h,c=Hl(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let f=Hl(n,t.pos,t.assoc,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u1&&(h=sp(r,a.pos))?h:l?r.addRange(c):S.create([c])}}}function sp(n,e){for(let t=0;t=e)return S.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}Be.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let r=n.docView.tile.nearest(e.target);if(r&&r.isWidget()){let s=r.posAtStart,o=s+r.length;(s>=t.to||o<=t.from)&&(t=S.range(s,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",zr(n.state,Do,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Be.dragend=n=>(n.inputState.draggedContent=null,!1);function ta(n,e,t,i){if(t=zr(n.state,_o,t),!t)return;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:s}=n.inputState,o=i&&s&&JO(n,e)?{from:s.from,to:s.to}:null,l={from:r,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(r,-1),head:a.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}Be.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),r=0,s=()=>{++r==t.length&&ta(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),s()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return ta(n,e,i,!0),!0}return!1};Be.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Uc?null:e.clipboardData;return t?(Fc(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(ip(n),!1)};function op(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function lp(n){let e=[],t=[],i=!1;for(let r of n.selection.ranges)r.empty||(e.push(n.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:s}of n.selection.ranges){let o=n.doc.lineAt(s);o.number>r&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),r=o.number}i=!0}return{text:zr(n,Do,e.join(n.lineBreak)),ranges:t,linewise:i}}let lo=null;Be.copy=Be.cut=(n,e)=>{if(!Ei(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:r}=lp(n.state);if(!t&&!r)return!1;lo=r?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Uc?null:e.clipboardData;return s?(s.clearData(),s.setData("text/plain",t),!0):(op(n,t),!1)};const Kc=St.define();function Jc(n,e){let t=[];for(let i of n.facet(Ac)){let r=i(n,e);r&&t.push(r)}return t.length?n.update({effects:t,annotations:Kc.of(!0)}):null}function ef(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Jc(n.state,e);t?n.dispatch(t):n.update([])}},10)}$e.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),ef(n)};$e.blur=n=>{n.observer.clearSelectionRange(),ef(n)};$e.compositionstart=$e.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};$e.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,P.chrome&&P.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};$e.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};Be.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let s=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(s&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Bo(n,{from:a,to:h,insert:n.state.toText(s)},null),!0}}let r;if(P.chrome&&P.android&&(r=Gc.find(s=>s.inputType==e.inputType))&&(n.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let s=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>s+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return P.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),P.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>$e.compositionend(n,e),20),!1};const ia=new Set;function ap(n){ia.has(n)||(ia.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const na=["pre-wrap","normal","pre-line","break-spaces"];let di=!1;function ra(){di=!1}class hp{constructor(e){this.lineWrapping=e,this.doc=D.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return na.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=r,this.lineLength=s,a){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>qn&&(di=!0),this.height=e)}replace(e,t,i){return ge.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,r){let s=this,o=i.doc;for(let l=r.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=r[l],u=s.lineAt(a,U.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:s.lineAt(h,U.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=r[l-1].toA;)a=r[l-1].fromA,c=r[l-1].fromB,l--,as*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,r-=l.size}else if(s>r*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,s-=l.size}else break;else if(r=s&&o(this.lineAt(0,U.ByPos,i,r,s))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Ze extends tf{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new qe(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let r=i[0];return i.length==1&&(r instanceof Ze||r instanceof le&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof le?r=new Ze(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):ge.of(i)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class le extends ge{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*s);o=a/s,this.length>s+1&&(l=(this.height-a)/(this.length-s-1))}else o=this.height/s;return{firstLine:i,lastLine:r,perLine:o,perChar:l}}blockAt(e,t,i,r){let{firstLine:s,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,r);if(t.lineWrapping){let h=r+(e0){let s=i[i.length-1];s instanceof le?i[i.length-1]=new le(s.length+r):i.push(null,new le(r-1))}if(e>0){let s=i[0];s instanceof le?i[0]=new le(e+s.length):i.unshift(new le(e-1),null)}return ge.of(i)}decomposeLeft(e,t){t.push(new le(e-1),null)}decomposeRight(e,t){t.push(null,new le(this.length-e-1))}updateHeight(e,t=0,i=!1,r){let s=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],l=Math.max(t,r.from),a=-1;for(r.from>t&&o.push(new le(r.from-t-1).updateHeight(e,t));l<=s&&r.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=r.heights[r.index++],u=0;f<0&&(u=-f,f=r.heights[r.index++]),a==-1?a=f:Math.abs(f-a)>=qn&&(a=-2);let d=new Ze(c,f,u);d.outdated=!1,o.push(d),l+=c+1}l<=s&&o.push(null,new le(s-l).updateHeight(e,l));let h=ge.of(o);return(a<0||Math.abs(h.height-this.height)>=qn||Math.abs(a-this.heightMetrics(e,t).perLine)>=qn)&&(di=!0),or(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class up extends ge{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,r){let s=i+this.left.height;return el))return h;let c=t==U.ByPosNoHeight?U.ByPosNoHeight:U.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,r,s).join(h)}forEachLine(e,t,i,r,s,o){let l=r+this.left.height,a=s+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,U.ByPos,i,r,s);e=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let r=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,i));let s=[];e>0&&this.decomposeLeft(e,s);let o=s.length;for(let l of i)s.push(l);if(e>0&&sa(s,o-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,r=i+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e2*t.size||t.size>2*e.size?ge.of(this.break?[e,null,t]:[e,t]):(this.left=or(this.left,e),this.right=or(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,r){let{left:s,right:o}=this,l=t+s.length+this.break,a=null;return r&&r.from<=t+s.length&&r.more?a=s=s.updateHeight(e,t,i,r):s.updateHeight(e,t,i),r&&r.from<=l+o.length&&r.more?a=o=o.updateHeight(e,l,i,r):o.updateHeight(e,l,i),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 sa(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof le&&(i=n[e+1])instanceof le&&n.splice(e-1,3,new le(t.length+1+i.length))}const dp=5;class Io{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Ze?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Ze(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=dp)&&this.addLineDeco(r,s,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Ze(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new le(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Ze)return e;let t=new Ze(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Ze)&&!this.isCovered?this.nodes.push(new Ze(0,-1,0)):(this.writtenToc.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();s=Math.max(s,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?r.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:s-t.left,right:Math.max(s,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function gp(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Qp(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class rs{constructor(e,t,i,r){this.from=e,this.to=t,this.size=i,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new hp(i),this.stateDeco=aa(t),this.heightMap=ge.empty().applyChanges(this.stateDeco,D.empty,this.heightOracle.setDoc(t.doc),[new Ye(0,0,0,t.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=X.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let r=i?t.head:t.anchor;if(!e.some(({from:s,to:o})=>r>=s&&r<=o)){let{from:s,to:o}=this.lineBlockAt(r);e.push(new yn(s,o))}}return this.viewports=e.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?la:new jo(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Mi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=aa(this.state);let r=e.changedRanges,s=Ye.extendWithRanges(r,Op(i,this.stateDeco,e?e.changes:ne.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);ra(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),s),(this.heightMap.height!=o||di)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=s.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Rc)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),r=this.heightOracle,s=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?G.RTL:G.LTR;let o=this.heightOracle.mustRefreshForWrapping(s)||this.mustMeasureContent==="refresh",l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:x,scaleY:w}=mc(t,l);(x>.005&&Math.abs(this.scaleX-x)>.005||w>.005&&Math.abs(this.scaleY-w)>.005)&&(this.scaleX=x,this.scaleY=w,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=gc(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let O=this.getScrollOffset();this.scrollOffset!=O&&(this.scrollAnchorHeight=-1,this.scrollOffset=O),this.scrolledToBottom=Sc(this.scrollParent||e.win);let m=(this.printing?Qp:mp)(t,this.paddingTop),g=m.top-this.pixelViewport.top,Q=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let b=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(b!=this.inView&&(this.inView=b,b&&(a=!0)),!this.inView&&!this.scrollTarget&&!gp(e.dom))return 0;let y=l.width;if((this.contentDOMWidth!=y||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let x=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(x)&&(o=!0),o||r.lineWrapping&&Math.abs(y-this.contentDOMWidth)>r.charWidth){let{lineHeight:w,charWidth:k,textHeight:R}=e.docView.measureTextSize();o=w>0&&r.refresh(s,w,k,R,Math.max(5,y/k),x),o&&(e.docView.minWidth=0,h|=16)}g>0&&Q>0?c=Math.max(g,Q):g<0&&Q<0&&(c=Math.min(g,Q)),ra();for(let w of this.viewports){let k=w.from==this.viewport.from?x:e.docView.measureVisibleLineHeights(w);this.heightMap=(o?ge.empty().applyChanges(this.stateDeco,D.empty,this.heightOracle,[new Ye(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new cp(w.from,k))}di&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,s=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new yn(r.lineAt(o-i*1e3,U.ByHeight,s,0,0).from,r.lineAt(l+(1-i)*1e3,U.ByHeight,s,0,0).to);if(t){let{head:h}=t.range;if(ha.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=r.lineAt(h,U.ByPos,s,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h=l+Math.max(10,Math.min(i,250)))&&r>o-2*1e3&&s>1,o=r<<1;if(this.defaultTextDirection!=G.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-cc&&QQ.from>=u.from&&Q.to<=u.to&&Math.abs(Q.from-c)Q.fromb));if(!g){if(fy.from<=f&&y.to>=f)){let y=t.moveToLineBoundary(S.cursor(f),!1,!0).head;y>c&&(f=y)}let Q=this.gapSize(u,c,f,d),b=i||Q<2e6?Q:2e6;g=new rs(c,f,Q,b)}l.push(g)},h=c=>{if(c.length2e6)for(let w of e)w.from>=c.from&&w.fromc.from&&a(c.from,d,c,f),Ot.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];V.spans(t,this.viewport.from,this.viewport.to,{span(s,o){i.push({from:s,to:o})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let s=0;s=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Mi(this.heightMap.lineAt(e,U.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Mi(this.heightMap.lineAt(this.scaler.fromDOM(e),U.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Mi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class yn{constructor(e,t){this.from=e,this.to=t}}function bp(n,e,t){let i=[],r=n,s=0;return V.spans(t,n,e,{span(){},point(o,l){o>r&&(i.push({from:r,to:o}),s+=o-r),r=l}},20),r=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let r=0;;r++){let{from:s,to:o}=e[r],l=o-s;if(i<=l)return s+i;i-=l}}function wn(n,e){let t=0;for(let{from:i,to:r}of n.ranges){if(e<=r){t+=e-i;break}t+=r-i}return t/n.total}function yp(n,e){for(let t of n)if(e(t))return t}const la={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function aa(n){let e=n.facet(Ar).filter(i=>typeof i!="function"),t=n.facet(Wo).filter(i=>typeof i!="function");return t.length&&e.push(V.join(t)),e}class jo{constructor(e,t,i){let r=0,s=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,U.ByPos,e,0,0).top,c=t.lineAt(a,U.ByPos,e,0,0).bottom;return r+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);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(e){for(let t=0,i=0,r=0;;t++){let s=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Mi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new qe(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(r=>Mi(r,e)):n._content)}const kn=T.define({combine:n=>n.join(" ")}),ao=T.define({combine:n=>n.indexOf(!0)>-1}),ho=vt.newName(),nf=vt.newName(),rf=vt.newName(),sf={"&light":"."+nf,"&dark":"."+rf};function co(n,e,t){return new vt(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return n;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):n+" "+i}})}const xp=co("."+ho,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,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"}},sf),wp={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ss=P.ie&&P.ie_version<=11;class kp{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new eO,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(P.ie&&P.ie_version<=11||P.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&P.android&&e.constructor.EDIT_CONTEXT!==!1&&!(P.chrome&&P.chrome_version<126)&&(this.editContext=new vp(e),e.state.facet(dt)&&(e.contentDOM.editContext=this.editContext.editContext)),ss&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(dt)?i.root.activeElement!=this.dom:!Ei(this.dom,r))return;let s=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(s&&s.isWidget()&&s.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(P.ie&&P.ie_version<=11||P.android&&P.chrome)&&!i.state.selection.main.empty&&r.focusNode&&_i(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ji(e.root);if(!t)return!1;let i=P.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&$p(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let r=Ei(this.dom,i);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.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&&ri(this.dom,s.key,s.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,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 e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,r=!1;for(let s of e){let o=this.readMutation(s);o&&(o.typeOver&&(r=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:r}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),r=this.selectionChanged&&Ei(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let s=new LO(this.view,e,t,i);return this.view.docView.domChanged={newSel:s.newSel?s.newSel.main:null},s}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,r=Ic(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!sr(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=ha(t,e.previousSibling||e.target.previousSibling,-1),r=ha(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(dt)!=e.state.facet(dt)&&(e.view.contentDOM.editContext=e.state.facet(dt)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ha(n,e,t){for(;e;){let i=K.get(e);if(i&&i.parent==n)return i;let r=e.parentNode;e=r!=n.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function ca(n,e){let t=e.startContainer,i=e.startOffset,r=e.endContainer,s=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return _i(o.node,o.offset,r,s)&&([t,i,r,s]=[r,s,t,i]),{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}}function $p(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return ca(n,r)}let t=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?ca(n,t):null}class vp{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let r=e.state.selection.main,{anchor:s,head:o}=r,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&sthis.to&&(a=s);let c=jc(e.state.sliceDoc(l,a),i.text,(h?r.from:r.to)-l,h?"end":null);if(!c){let u=S.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));sr(u,r)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:D.of(i.text.slice(c.from,c.toB).split(` +`))};if((P.mac||P.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:D.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Bo(e,f,S.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let r=ji(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(i)return;let c=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,t+=c,this.to+=c;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(sthis.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class v{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(s=>i(s,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||tO(e.parent)||document,this.viewState=new oa(this,e.state||_.create(e)),e.scrollTo&&e.scrollTo.is(Qn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Kt).map(r=>new Jr(r));for(let r of this.plugins)r.update(this);this.observer=new kp(this),this.inputState=new GO(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Gl(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof ie?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,r,s=this.state;for(let u of e){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;e.some(u=>u.annotation(Kc))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Jc(s,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(c=null)):this.observer.clear(),s.facet(_.phrases)!=this.state.facet(_.phrases))return this.setState(s);r=ir.create(this,s,e),r.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new si(d.empty?d:S.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(Qn)&&(f=d.value.clip(this.state))}this.viewState.update(r,f),this.bidiCache=lr.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(Ai)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(kn)!=r.state.facet(kn)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let u of this.state.facet(no))try{u(r)}catch(d){we(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Ic(this,c)&&h.force&&ri(this.contentDOM,h.key,h.keyCode)})}setState(e){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=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new oa(this,e),this.plugins=e.facet(Kt).map(i=>new Jr(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Gl(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Kt),i=e.state.facet(Kt);if(t!=i){let r=[];for(let s of i){let o=t.indexOf(s);if(o<0)r.push(new Jr(s));else{let l=this.plugins[o];l.mustUpdate=e,r.push(l)}}for(let s of this.plugins)s.mustUpdate!=e&&s.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:s,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Sc(i||this.win))s=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(r);s=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();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 c=h.map(d=>{try{return d.read(this)}catch(O){return we(this.state,O),fa}}),f=ir.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d1||O<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+O,i?i.scrollTop+=O:this.win.scrollBy(0,O),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(no))l(t)}get themeClasses(){return ho+" "+(this.state.facet(ao)?rf:nf)+" "+this.state.facet(kn)}updateAttrs(){let e=ua(this,Vc,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(dt)?"true":"false",class:"cm-content",style:`${P.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),ua(this,qo,t);let i=this.observer.ignore(()=>{let r=ql(this.contentDOM,this.contentAttrs,t),s=ql(this.dom,this.editorAttrs,e);return r||s});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let r of i.effects)if(r.is(v.announce)){t&&(this.announceDOM.textContent=""),t=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Ai);let e=this.state.facet(v.cspNonce);vt.mount(this.root,this.styleModules.concat(xp).reverse(),e?{nonce:e}: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(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;ti.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return ns(this,e,Nl(this,e,t,i))}moveByGroup(e,t){return ns(this,e,Nl(this,e,t,i=>VO(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),r=this.textDirectionAt(e.from),s=i[t?i.length-1:0];return S.cursor(s.side(t,r)+e.from,s.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,i=!0){return YO(this,e,t,i)}moveVertically(e,t,i){return ns(this,e,EO(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=oo(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),oo(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let r=this.state.doc.lineAt(e),s=this.bidiSpans(r),o=s[it.find(s,e-r.from,-1,t)];return tr(i,o.dir==G.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Mc)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Pp)return $c(e.length);let t=this.textDirectionAt(e.from),i;for(let s of this.bidiCache)if(s.from==e.from&&s.dir==t&&(s.fresh||kc(s.isolates,i=Bl(this,e))))return s.order;i||(i=Bl(this,e));let r=hO(e.text,t,i);return this.bidiCache.push(new lr(e.from,e.to,t,i,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||P.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Qc(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Qn.of(new si(typeof e=="number"?S.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Qn.of(new si(S.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return te.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return te.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=vt.newName(),r=[kn.of(i),Ai.of(co(`.${i}`,e))];return t&&t.dark&&r.push(ao.of(!0)),r}static baseTheme(e){return At.lowest(Ai.of(co("."+ho,e,sf)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),r=i&&K.get(i)||K.get(e);return((t=r?.root)===null||t===void 0?void 0:t.view)||null}}v.styleModule=Ai;v.inputHandler=Xc;v.clipboardInputFilter=_o;v.clipboardOutputFilter=Do;v.scrollHandler=zc;v.focusChangeEffect=Ac;v.perLineTextDirection=Mc;v.exceptionSink=Zc;v.updateListener=no;v.editable=dt;v.mouseSelectionStyle=Cc;v.dragMovesSelection=Tc;v.clickAddsSelectionRange=Pc;v.decorations=Ar;v.blockWrappers=Ec;v.outerDecorations=Wo;v.atomicRanges=an;v.bidiIsolatedRanges=_c;v.scrollMargins=Dc;v.darkTheme=ao;v.cspNonce=T.define({combine:n=>n.length?n[0]:""});v.contentAttributes=qo;v.editorAttributes=Vc;v.lineWrapping=v.contentAttributes.of({class:"cm-lineWrapping"});v.announce=M.define();const Pp=4096,fa={};class lr{constructor(e,t,i,r,s,o){this.from=e,this.to=t,this.dir=i,this.isolates=r,this.fresh=s,this.order=o}static update(e,t){if(t.empty&&!e.some(s=>s.fresh))return e;let i=[],r=e.length?e[e.length-1].dir:G.LTR;for(let s=Math.max(0,e.length-10);s=0;r--){let s=i[r],o=typeof s=="function"?s(n):s;o&&Yo(o,t)}return t}const Tp=P.mac?"mac":P.windows?"win":P.linux?"linux":"key";function Cp(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let r,s,o,l;for(let a=0;ai.concat(r),[]))),t}function Xp(n,e,t){return lf(of(n.state),e,n,t)}let xt=null;const Ap=4e3;function Mp(n,e=Tp){let t=Object.create(null),i=Object.create(null),r=(o,l)=>{let a=i[o];if(a==null)i[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,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),O=l.split(/ (?!$)/).map(Q=>Cp(Q,e));for(let Q=1;Q{let C=xt={view:y,prefix:b,scope:o};return setTimeout(()=>{xt==C&&(xt=null)},Ap),!0}]})}let m=O.join(" ");r(m,!1);let g=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&g.run.push(a),h&&(g.preventDefault=!0),c&&(g.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,fo))}let a=o[e]||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 t}let fo=null;function lf(n,e,t,i){fo=e;let r=Gd(e),s=be(r,0),o=et(s)==r.length&&r!=" ",l="",a=!1,h=!1,c=!1;xt&&xt.view==t&&xt.scope==i&&(l=xt.prefix+" ",Nc.indexOf(e.keyCode)<0&&(h=!0,xt=null));let f=new Set,u=g=>{if(g){for(let Q of g.run)if(!f.has(Q)&&(f.add(Q),Q(t)))return g.stopPropagation&&(c=!0),!0;g.preventDefault&&(g.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],O,m;return d&&(u(d[l+$n(r,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(P.windows&&e.ctrlKey&&e.altKey)&&!(P.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(O=Pt[e.keyCode])&&O!=r?(u(d[l+$n(O,e,!0)])||e.shiftKey&&(m=Bi[e.keyCode])!=r&&m!=O&&u(d[l+$n(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+$n(r,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),fo=null,a}class Wt{constructor(e,t,i,r,s){this.className=e,this.left=t,this.top=i,this.width=r,this.height=s}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let r=e.coordsAtPos(i.head,i.assoc||1);if(!r)return[];let s=af(e);return[new Wt(t,r.left-s.left,r.top-s.top,null,r.bottom-r.top)]}else return Rp(e,t,i)}}function af(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==G.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function Oa(n,e,t,i){let r=n.coordsAtPos(e,t*2);if(!r)return i;let s=n.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,l=n.posAtCoords({x:s.left+1,y:o}),a=n.posAtCoords({x:s.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function Rp(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),r=Math.min(t.to,n.viewport.to),s=n.textDirection==G.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=af(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=so(n,i,1),O=so(n,r,-1),m=d.type==ce.Text?d:null,g=O.type==ce.Text?O:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=Oa(n,i,1,m)),g&&(n.lineWrapping||O.widgetLineBreaks)&&(g=Oa(n,r,-1,g)),m&&g&&m.from==g.from&&m.to==g.to)return b(y(t.from,t.to,m));{let x=m?y(t.from,null,m):C(d,!1),w=g?y(null,t.to,g):C(O,!0),k=[];return(m||d).to<(g||O).from-(m&&g?1:0)||d.widgetLineBreaks>1&&x.bottom+n.defaultLineHeight/2A&&q.from=pe)break;Me>N&&Y(Math.max(oe,N),x==null&&oe<=A,Math.min(Me,pe),w==null&&Me>=L,Ge.dir)}if(N=ve.to+1,N>=pe)break}return I.length==0&&Y(A,x==null,L,w==null,n.textDirection),{top:R,bottom:E,horizontal:I}}function C(x,w){let k=l.top+(w?x.top:x.bottom);return{top:k,bottom:k,horizontal:[]}}}function zp(n,e){return n.constructor==e.constructor&&n.eq(e)}class Yp{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Wn)!=e.state.facet(Wn)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(Wn);for(;t!zp(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[i].constructor&&r.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(r.draw(),t);for(;t;){let r=t.nextSibling;t.remove(),t=r}this.drawn=e,P.safari&&P.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Wn=T.define();function hf(n){return[te.define(e=>new Yp(e,n)),Wn.of(n)]}const Oi=T.define({combine(n){return at(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Vp(n={}){return[Oi.of(n),Ep,_p,Dp,Rc.of(!0)]}function cf(n){return n.startState.facet(Oi)!=n.state.facet(Oi)}const Ep=hf({above:!0,markers(n){let{state:e}=n,t=e.facet(Oi),i=[];for(let r of e.selection.ranges){let s=r==e.selection.main;if(r.empty||t.drawRangeCursor&&!(s&&P.ios&&t.iosSelectionHandles)){let o=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=r.empty?r:S.cursor(r.head,r.head>r.anchor?-1:1);for(let a of Wt.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=cf(n);return t&&pa(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){pa(e.state,n)},class:"cm-cursorLayer"});function pa(n,e){e.style.animationDuration=n.facet(Oi).cursorBlinkRate+"ms"}const _p=hf({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let r of i)if(!r.empty)for(let s of Wt.forRange(n,"cm-selectionBackground",r))e.push(s);if(P.ios&&!t.empty&&n.state.facet(Oi).iosSelectionHandles){for(let r of Wt.forRange(n,"cm-selectionHandle cm-selectionHandle-start",S.cursor(t.from,1)))e.push(r);for(let r of Wt.forRange(n,"cm-selectionHandle cm-selectionHandle-end",S.cursor(t.to,1)))e.push(r)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||cf(n)},class:"cm-selectionLayer"}),Dp=At.highest(v.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),ff=M.define({map(n,e){return n==null?null:e.mapPos(n)}}),Ri=fe.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(ff)?i.value:t,n)}}),qp=te.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Ri);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Ri)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Ri),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Ri)!=n&&this.view.dispatch({effects:ff.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Wp(){return[Ri,qp]}function ma(n,e,t,i,r){e.lastIndex=0;for(let s=n.iterRange(t,i),o=t,l;!s.next().done;o+=s.value.length)if(!s.lineBreak)for(;l=e.exec(s.value);)r(o+l.index,l)}function Lp(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:r,to:s}of t)r=Math.max(n.state.doc.lineAt(r).from,r-e),s=Math.min(n.state.doc.lineAt(s).to,s+e),i.length&&i[i.length-1].to>=r?i[i.length-1].to=s:i.push({from:r,to:s});return i}class Bp{constructor(e){const{regexp:t,decoration:i,decorate:r,boundary:s,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,r)this.addMatch=(l,a,h,c)=>r(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=o}createDeco(e){let t=new mt,i=t.add.bind(t);for(let{from:r,to:s}of Lp(e,this.maxLength))ma(e.state.doc,this.regexp,r,s,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,r=-1;return e.docChanged&&e.changes.iterChanges((s,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),r=Math.max(a,r))}),e.viewportMoved||r-i>1e3?this.createDeco(e.view):r>-1?this.updateRange(e.view,t.map(e.changes),i,r):t}updateRange(e,t,i,r){for(let s of e.visibleRanges){let o=Math.max(s.from,i),l=Math.min(s.to,r);if(l>=o){let a=e.state.doc.lineAt(o),h=a.toa.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;lu.push(Q.range(m,g));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.indexthis.addMatch(g,e,m,O));t=t.update({filterFrom:c,filterTo:f,filter:(m,g)=>mf,add:u})}}return t}}const uo=/x/.unicode!=null?"gu":"g",Ip=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,uo),jp={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let os=null;function Gp(){var n;if(os==null&&typeof document<"u"&&document.body){let e=document.body.style;os=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return os||!1}const Ln=T.define({combine(n){let e=at(n,{render:null,specialChars:Ip,addSpecialChars:null});return(e.replaceTabs=!Gp())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,uo)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,uo)),e}});function Np(n={}){return[Ln.of(n),Up()]}let ga=null;function Up(){return ga||(ga=te.fromClass(class{constructor(n){this.view=n,this.decorations=X.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(Ln)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Bp({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:r}=t.state,s=be(e[0],0);if(s==9){let o=r.lineAt(i),l=t.state.tabSize,a=yi(o.text,l,i-o.from);return X.replace({widget:new Jp((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=X.replace({widget:new Kp(n,s)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(Ln);n.startState.facet(Ln)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Fp="•";function Hp(n){return n>=32?Fp:n==10?"␤":String.fromCharCode(9216+n)}class Kp extends ht{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=Hp(this.code),i=e.state.phrase("Control character")+" "+(jp[this.code]||"0x"+this.code.toString(16)),r=this.options.render&&this.options.render(this.code,i,t);if(r)return r;let s=document.createElement("span");return s.textContent=t,s.title=i,s.setAttribute("aria-label",i),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class Jp extends ht{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function em(){return im}const tm=X.line({class:"cm-activeLine"}),im=te.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let r=n.lineBlockAt(i.head);r.from>e&&(t.push(tm.range(r.from)),e=r.from)}return X.set(t)}},{decorations:n=>n.decorations}),Oo=2e3;function nm(n,e,t){let i=Math.min(e.line,t.line),r=Math.max(e.line,t.line),s=[];if(e.off>Oo||t.off>Oo||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=r;a++){let h=n.doc.line(a);h.length<=l&&s.push(S.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=r;a++){let h=n.doc.line(a),c=js(h.text,o,n.tabSize,!0);if(c<0)s.push(S.cursor(h.to));else{let f=js(h.text,l,n.tabSize);s.push(S.range(h.from+c,h.from+f))}}}return s}function rm(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function Qa(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),r=t-i.from,s=r>Oo?-1:r==i.length?rm(n,e.clientX):yi(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:s,off:r}}function sm(n,e){let t=Qa(n,e),i=n.state.selection;return t?{update(r){if(r.docChanged){let s=r.changes.mapPos(r.startState.doc.line(t.line).from),o=r.state.doc.lineAt(s);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(r.changes)}},get(r,s,o){let l=Qa(n,r);if(!l)return i;let a=nm(n.state,t,l);return a.length?o?S.create(a.concat(i.ranges)):S.create(a):i}}:null}function om(n){let e=(t=>t.altKey&&t.button==0);return v.mouseSelectionStyle.of((t,i)=>e(i)?sm(t,i):null)}const lm={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},am={style:"cursor: crosshair"};function hm(n={}){let[e,t]=lm[n.key||"Alt"],i=te.fromClass(class{constructor(r){this.view=r,this.isDown=!1}set(r){this.isDown!=r&&(this.isDown=r,this.view.update([]))}},{eventObservers:{keydown(r){this.set(r.keyCode==e||t(r))},keyup(r){(r.keyCode==e||!t(r))&&this.set(!1)},mousemove(r){this.set(t(r))}}});return[i,v.contentAttributes.of(r=>{var s;return!((s=r.plugin(i))===null||s===void 0)&&s.isDown?am:null})]}const vn="-10000px";class uf{constructor(e,t,i,r){this.facet=t,this.createTooltipView=i,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let s=null;this.tooltipViews=this.tooltips.map(o=>s=i(o,s))}update(e,t){var i;let r=e.state.facet(this.facet),s=r.filter(a=>a);if(r===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;at[h]=a),t.length=l.length),this.input=r,this.tooltips=s,this.tooltipViews=o,!0}}function cm(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const ls=T.define({combine:n=>{var e,t,i;return{position:P.ios?"absolute":((e=n.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(r=>r.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(r=>r.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||cm}}}),Sa=new WeakMap,Go=te.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(ls);this.position=e.position,this.parent=e.parent,this.classes=n.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 uf(n,No,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(ls);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",t.dom.appendChild(r)}return t.dom.style.position=this.position,t.dom.style.top=vn,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(P.safari){let o=s.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!s.offsetParent&&s.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(n=s.width/this.parent.offsetWidth,e=s.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),r=Lo(this.view);return{visible:{left:i.left+r.left,top:i.top+r.top,right:i.right-r.right,bottom:i.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(ls).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:r,scaleY:s}=n,o=[];for(let l=0;l=Math.min(t.bottom,i.bottom)||f.rightMath.min(t.right,i.right)+.1)){c.style.top=vn;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,O=d?7:0,m=u.right-u.left,g=(e=Sa.get(h))!==null&&e!==void 0?e:u.bottom-u.top,Q=h.offset||um,b=this.view.textDirection==G.LTR,y=u.width>i.right-i.left?b?i.left:i.right-u.width:b?Math.max(i.left,Math.min(f.left-(d?14:0)+Q.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-Q.x),i.right-m),C=this.above[l];!a.strictSide&&(C?f.top-g-O-Q.yi.bottom)&&C==i.bottom-f.bottom>f.top-i.top&&(C=this.above[l]=!C);let x=(C?f.top-i.top:i.bottom-f.bottom)-O;if(xy&&R.topw&&(w=C?R.top-g-2-O:R.bottom+O+2);if(this.position=="absolute"?(c.style.top=(w-n.parent.top)/s+"px",ba(c,(y-n.parent.left)/r)):(c.style.top=w/s+"px",ba(c,y/r)),d){let R=f.left+(b?Q.x:-Q.x)-(y+14-7);d.style.left=R/r+"px"}h.overlap!==!0&&o.push({left:y,top:w,right:k,bottom:w+g}),c.classList.toggle("cm-tooltip-above",C),c.classList.toggle("cm-tooltip-below",!C),h.positioned&&h.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=vn}},{eventObservers:{scroll(){this.maybeMeasure()}}});function ba(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const fm=v.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),um={x:0,y:0},No=T.define({enables:[Go,fm]}),ar=T.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Vr{static create(e){return new Vr(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new uf(e,ar,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let r=i[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const dm=No.compute([ar],n=>{let e=n.facet(ar);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Vr.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class Om{constructor(e,t,i,r,s){this.view=e,this.source=t,this.field=i,this.setHover=r,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||t.xl.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(r)).find(c=>c.from<=r&&c.to>=r),h=a&&a.dir==G.RTL?-1:1;s=t.x{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>we(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(Go),t=e?e.manager.tooltips.findIndex(i=>i.create==Vr.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:s}=this;if(r.length&&s&&!pm(s.dom,e)||this.pending){let{pos:o}=r[0]||this.pending,l=(i=(t=r[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!mm(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Pn=4;function pm(n,e){let{left:t,right:i,top:r,bottom:s}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();r=Math.min(l.top,r),s=Math.max(l.bottom,s)}return e.clientX>=t-Pn&&e.clientX<=i+Pn&&e.clientY>=r-Pn&&e.clientY<=s+Pn}function mm(n,e,t,i,r,s){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.rightr||Math.min(o.bottom,l)=e&&a<=t}function gm(n,e={}){let t=M.define(),i=fe.define({create(){return[]},update(r,s){if(r.length&&(e.hideOnChange&&(s.docChanged||s.selection)?r=[]:e.hideOn&&(r=r.filter(o=>!e.hideOn(s,o))),s.docChanged)){let o=[];for(let l of r){let a=s.changes.mapPos(l.pos,-1,he.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)}}r=o}for(let o of s.effects)o.is(t)&&(r=o.value),o.is(Qm)&&(r=[]);return r},provide:r=>ar.from(r)});return{active:i,extension:[i,te.define(r=>new Om(r,n,i,t,e.hoverTime||300)),dm]}}function df(n,e){let t=n.plugin(Go);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const Qm=M.define(),ya=T.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function Uo(n,e){let t=n.plugin(Of),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const Of=te.fromClass(class{constructor(n){this.input=n.state.facet(Ni),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(ya);this.top=new Tn(n,!0,e.topContainer),this.bottom=new Tn(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(ya);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Tn(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Tn(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(Ni);if(t!=this.input){let i=t.filter(a=>a),r=[],s=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),r.push(c),(c.top?s:o).push(c)}this.specs=i,this.panels=r,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 i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>v.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Tn{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(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 t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=xa(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=xa(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function xa(n){let e=n.nextSibling;return n.remove(),e}const Ni=T.define({enables:Of});function Sm(n,e){let t,i=new Promise(o=>t=o),r=o=>bm(o,e,t);n.state.field(as,!1)?n.dispatch({effects:pf.of(r)}):n.dispatch({effects:M.appendConfig.of(as.init(()=>[r]))});let s=mf.of(r);return{close:s,result:i.then(o=>((n.win.queueMicrotask||(a=>n.win.setTimeout(a,10)))(()=>{n.state.field(as).indexOf(r)>-1&&n.dispatch({effects:s})}),o))}}const as=fe.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(pf)?n=[t.value].concat(n):t.is(mf)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>Ni.computeN([n],e=>e.field(n))}),pf=M.define(),mf=M.define();function bm(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=B("form"),e.input){let l=B("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild(B("label",(e.label||"")+": ",l))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(B("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let r=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(a))}),a.addEventListener("submit",h=>{h.preventDefault(),o(a)})}let s=B("div",i,B("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(s.className=e.class),s.classList.add("cm-dialog");function o(l){s.contains(s.ownerDocument.activeElement)&&n.focus(),t(l)}return{dom:s,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=i.querySelector(e.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class Qt extends $t{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Qt.prototype.elementClass="";Qt.prototype.toDOM=void 0;Qt.prototype.mapMode=he.TrackBefore;Qt.prototype.startSide=Qt.prototype.endSide=-1;Qt.prototype.point=!0;const Bn=T.define(),ym=T.define(),xm={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>V.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},qi=T.define();function wm(n){return[gf(),qi.of({...xm,...n})]}const wa=T.define({combine:n=>n.some(e=>e)});function gf(n){return[km]}const km=te.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(qi).map(e=>new $a(n,e)),this.fixed=!n.state.facet(wa);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(wa)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=V.iter(this.view.state.facet(Bn),this.view.viewport.from),i=[],r=this.gutters.map(s=>new $m(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(s.type)){let o=!0;for(let l of s.type)if(l.type==ce.Text&&o){po(t,i,l.from);for(let a of r)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of r)a.widget(this.view,l)}else if(s.type==ce.Text){po(t,i,s.from);for(let o of r)o.line(this.view,s,i)}else if(s.widget)for(let o of r)o.widget(this.view,s);for(let s of r)s.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(qi),t=n.state.facet(qi),i=n.docChanged||n.heightChanged||n.viewportChanged||!V.eq(n.startState.facet(Bn),n.state.facet(Bn),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(n)&&(i=!0);else{i=!0;let r=[];for(let s of t){let o=e.indexOf(s);o<0?r.push(new $a(this.view,s)):(this.gutters[o].update(n),r.push(this.gutters[o]))}for(let s of this.gutters)s.dom.remove(),r.indexOf(s)<0&&s.destroy();for(let s of r)s.config.side=="after"?this.getDOMAfter().appendChild(s.dom):this.dom.appendChild(s.dom);this.gutters=r}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>v.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==G.LTR?{left:i,right:r}:{right:i,left:r}})});function ka(n){return Array.isArray(n)?n:[n]}function po(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class $m{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=V.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:r}=this,s=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let l=new Qf(e,o,s,i);r.elements.push(l),r.dom.appendChild(l.dom)}else r.elements[this.i].update(e,o,s,i);this.height=t.bottom,this.i++}line(e,t,i){let r=[];po(this.cursor,r,t.from),i.length&&(r=r.concat(i));let s=this.gutter.config.lineMarker(e,t,r);s&&r.unshift(s);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),r=i?[i]:null;for(let s of e.state.facet(ym)){let o=s(e,t.widget,t);o&&(r||(r=[])).push(o)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class $a{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,r=>{let s=r.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=r.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,r)&&r.preventDefault()});this.markers=ka(t.markers(e)),t.initialSpacer&&(this.spacer=new Qf(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=ka(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let i=e.view.viewport;return!V.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Qf{constructor(e,t,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,r)}update(e,t,i,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),vm(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let i="cm-gutterElement",r=this.dom.firstChild;for(let s=0,o=0;;){let l=o,a=ss(l,a,h)||o(l,a,h):o}return i}})}});class hs extends Qt{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function cs(n,e){return n.state.facet(Jt).formatNumber(e,n.state)}const Cm=qi.compute([Jt],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Pm)},lineMarker(e,t,i){return i.some(r=>r.toDOM)?null:new hs(cs(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let r of e.state.facet(Tm)){let s=r(e,t,i);if(s)return s}return null},lineMarkerChange:e=>e.startState.facet(Jt)!=e.state.facet(Jt),initialSpacer(e){return new hs(cs(e,va(e.state.doc.lines)))},updateSpacer(e,t){let i=cs(t.view,va(t.view.state.doc.lines));return i==e.number?e:new hs(i)},domEventHandlers:n.facet(Jt).domEventHandlers,side:"before"}));function Zm(n={}){return[Jt.of(n),gf(),Cm]}function va(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.head).from;r>t&&(t=r,e.push(Xm.range(r)))}return V.of(e)});function Mm(){return Am}const Sf=1024;let Rm=0;class Ve{constructor(e,t){this.from=e,this.to=t}}class z{constructor(e={}){this.id=Rm++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Qe.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}z.closedBy=new z({deserialize:n=>n.split(" ")});z.openedBy=new z({deserialize:n=>n.split(" ")});z.group=new z({deserialize:n=>n.split(" ")});z.isolate=new z({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});z.contextHash=new z({perNode:!0});z.lookAhead=new z({perNode:!0});z.mounted=new z({perNode:!0});class oi{constructor(e,t,i,r=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[z.mounted.id]}}const zm=Object.create(null);class Qe{constructor(e,t,i,r=0){this.name=e,this.props=t,this.id=i,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):zm,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Qe(e.name||"",t,e.id,i);if(e.props){for(let s of e.props)if(Array.isArray(s)||(s=s(r)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[s[0].id]=s[1]}}return r}prop(e){return this.props[e.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(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(z.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let r of i.split(" "))t[r]=e[i];return i=>{for(let r=i.prop(z.group),s=-1;s<(r?r.length:0);s++){let o=t[s<0?i.name:r[s]];if(o)return o}}}}Qe.none=new Qe("",Object.create(null),0,8);class Fo{constructor(e){this.types=e;for(let t=0;t0;for(let a=this.cursor(o|W.IncludeAnonymous);;){let h=!1;if(a.from<=s&&a.to>=r&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Jo(Qe.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,r)=>new H(this.type,t,i,r,this.propValues),e.makeTree||((t,i,r)=>new H(Qe.none,t,i,r)))}static build(e){return _m(e)}}H.empty=new H(Qe.none,[],[],0);class Ho{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Ho(this.buffer,this.index)}}class Ct{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return Qe.none}toString(){let e=[];for(let t=0;t0));a=o[a+3]);return l}slice(e,t,i){let r=this.buffer,s=new Uint16Array(t-e),o=0;for(let l=e,a=0;l=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function Ui(n,e,t,i){for(var r;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from,u;if(!(!(s&W.EnterBracketed&&c instanceof H&&(u=oi.get(c))&&!u.overlay&&u.bracketed&&i>=f&&i<=f+c.length)&&!bf(r,i,f,f+c.length))){if(c instanceof Ct){if(s&W.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,t,i-f,r);if(d>-1)return new nt(new Ym(o,c,e,f),null,d)}else if(s&W.IncludeAnonymous||!c.type.isAnonymous||Ko(c)){let d;if(!(s&W.IgnoreMounts)&&(d=oi.get(c))&&!d.overlay)return new de(d.tree,f,e,o);let O=new de(c,f,e,o);return s&W.IncludeAnonymous||!O.type.isAnonymous?O:O.nextChild(t<0?c.children.length-1:0,t,i,r,s)}}}if(s&W.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<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(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let r;if(!(i&W.IgnoreOverlays)&&(r=oi.get(this._tree))&&r.overlay){let s=e-this.from,o=i&W.EnterBracketed&&r.bracketed;for(let{from:l,to:a}of r.overlay)if((t>0||o?l<=s:l=s:a>s))return new de(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Ta(n,e,t,i){let r=n.cursor(),s=[];if(!r.firstChild())return s;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return s}for(;;){if(i!=null&&r.type.is(i))return s;if(r.type.is(e)&&s.push(r.node),!r.nextSibling())return i==null?s:[]}}function mo(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Ym{constructor(e,t,i,r){this.parent=e,this.buffer=t,this.index=i,this.start=r}}class nt extends yf{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,i);return s<0?null:new nt(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&W.ExcludeBuffers)return null;let{buffer:r}=this.context,s=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return s<0?null:new nt(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new nt(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new nt(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,r=this.index+4,s=i.buffer[this.index+3];if(s>r){let o=i.buffer[this.index+1];e.push(i.slice(r,s,o)),t.push(0)}return new H(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function xf(n){if(!n.length)return null;let e=0,t=n[0];for(let s=1;st.from||o.to=e){let l=new de(o.tree,o.overlay[0].from+s.from,-1,s);(r||(r=[i])).push(Ui(l,e,t,!1))}}return r?xf(r):i}class hr{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~W.EnterBracketed,e instanceof de)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof de?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:r}=this.buffer,s=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,i);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(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&W.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&W.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&W.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:r}=this;if(r){if(e>0){if(this.index-1)for(let s=t+e,o=e<0?-1:i._tree.children.length;s!=o;s+=e){let l=i._tree.children[s];if(this.mode&W.IncludeAnonymous||l instanceof Ct||!l.type.isAnonymous||Ko(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,i=s+1;break e}r=this.stack[--s]}for(let r=i;r=0;s--){if(s<0)return mo(this._tree,e,r);let o=i[t.buffer[this.stack[s]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function Ko(n){return n.children.some(e=>e instanceof Ct||!e.type.isAnonymous||Ko(e))}function _m(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:r=Sf,reused:s=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new Ho(t,t.length):t,a=i.types,h=0,c=0;function f(x,w,k,R,E,I){let{id:Y,start:A,end:L,size:q}=l,N=c,pe=h;if(q<0)if(l.next(),q==-1){let ct=s[Y];k.push(ct),R.push(A-x);return}else if(q==-3){h=Y;return}else if(q==-4){c=Y;return}else throw new RangeError(`Unrecognized record size: ${q}`);let ve=a[Y],Ge,oe,Me=A-x;if(L-A<=r&&(oe=g(l.pos-w,E))){let ct=new Uint16Array(oe.size-oe.skip),Re=l.pos-oe.size,Ne=ct.length;for(;l.pos>Re;)Ne=Q(oe.start,ct,Ne);Ge=new Ct(ct,L-oe.start,i),Me=oe.start-x}else{let ct=l.pos-q;l.next();let Re=[],Ne=[],Rt=Y>=o?Y:-1,Nt=0,On=L;for(;l.pos>ct;)Rt>=0&&l.id==Rt&&l.size>=0?(l.end<=On-r&&(O(Re,Ne,A,Nt,l.end,On,Rt,N,pe),Nt=Re.length,On=l.end),l.next()):I>2500?u(A,ct,Re,Ne):f(A,ct,Re,Ne,Rt,I+1);if(Rt>=0&&Nt>0&&Nt-1&&Nt>0){let Pl=d(ve,pe);Ge=Jo(ve,Re,Ne,0,Re.length,0,L-A,Pl,Pl)}else Ge=m(ve,Re,Ne,L-A,N-L,pe)}k.push(Ge),R.push(Me)}function u(x,w,k,R){let E=[],I=0,Y=-1;for(;l.pos>w;){let{id:A,start:L,end:q,size:N}=l;if(N>4)l.next();else{if(Y>-1&&L=0;q-=3)A[N++]=E[q],A[N++]=E[q+1]-L,A[N++]=E[q+2]-L,A[N++]=N;k.push(new Ct(A,E[2]-L,i)),R.push(L-x)}}function d(x,w){return(k,R,E)=>{let I=0,Y=k.length-1,A,L;if(Y>=0&&(A=k[Y])instanceof H){if(!Y&&A.type==x&&A.length==E)return A;(L=A.prop(z.lookAhead))&&(I=R[Y]+A.length+L)}return m(x,k,R,E,I,w)}}function O(x,w,k,R,E,I,Y,A,L){let q=[],N=[];for(;x.length>R;)q.push(x.pop()),N.push(w.pop()+k-E);x.push(m(i.types[Y],q,N,I-E,A-I,L)),w.push(E-k)}function m(x,w,k,R,E,I,Y){if(I){let A=[z.contextHash,I];Y=Y?[A].concat(Y):[A]}if(E>25){let A=[z.lookAhead,E];Y=Y?[A].concat(Y):[A]}return new H(x,w,k,R,Y)}function g(x,w){let k=l.fork(),R=0,E=0,I=0,Y=k.end-r,A={size:0,start:0,skip:0};e:for(let L=k.pos-x;k.pos>L;){let q=k.size;if(k.id==w&&q>=0){A.size=R,A.start=E,A.skip=I,I+=4,R+=4,k.next();continue}let N=k.pos-q;if(q<0||N=o?4:0,ve=k.start;for(k.next();k.pos>N;){if(k.size<0)if(k.size==-3||k.size==-4)pe+=4;else break e;else k.id>=o&&(pe+=4);k.next()}E=ve,R+=q,I+=pe}return(w<0||R==x)&&(A.size=R,A.start=E,A.skip=I),A.size>4?A:void 0}function Q(x,w,k){let{id:R,start:E,end:I,size:Y}=l;if(l.next(),Y>=0&&R4){let L=l.pos-(Y-4);for(;l.pos>L;)k=Q(x,w,k)}w[--k]=A,w[--k]=I-x,w[--k]=E-x,w[--k]=R}else Y==-3?h=R:Y==-4&&(c=R);return k}let b=[],y=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,b,y,-1,0);let C=(e=n.length)!==null&&e!==void 0?e:b.length?y[0]+b[0].length:0;return new H(a[n.topID],b.reverse(),y.reverse(),C)}const Ca=new WeakMap;function In(n,e){if(!n.isAnonymous||e instanceof Ct||e.type!=n)return 1;let t=Ca.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof H)){t=1;break}t+=In(n,i)}Ca.set(e,t)}return t}function Jo(n,e,t,i,r,s,o,l,a){let h=0;for(let O=i;O=c)break;w+=k}if(y==C+1){if(w>c){let k=O[C];d(k.children,k.positions,0,k.children.length,m[C]+b);continue}f.push(O[C])}else{let k=m[y-1]+O[y-1].length-x;f.push(Jo(n,O,m,C,y,x,k,null,a))}u.push(x+b-s)}}return d(e,t,i,r,0),(l||a)(f,u,o)}class wf{constructor(){this.map=new WeakMap}setBuffer(e,t,i){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,i)}getBuffer(e,t){let i=this.map.get(e);return i&&i.get(t)}set(e,t){e instanceof nt?this.setBuffer(e.context.buffer,e.index,t):e instanceof de&&this.map.set(e.tree,t)}get(e){return e instanceof nt?this.getBuffer(e.context.buffer,e.index):e instanceof de?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class pt{constructor(e,t,i,r,s=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=r,this.open=(s?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let r=[new pt(0,e.length,e,0,!1,i)];for(let s of t)s.to>e.length&&r.push(s);return r}static applyChanges(e,t,i=128){if(!t.length)return e;let r=[],s=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l=i)for(;o&&o.from=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,O=Math.min(u.to,f)-h;u=d>=O?null:new pt(d,O,u.tree,u.offset+h,l>0,!!c)}if(u&&r.push(u),o.to>f)break;o=snew Ve(r.from,r.to)):[new Ve(0,0)]:[new Ve(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let r=this.startParse(e,t,i);for(;;){let s=r.advance();if(s)return s}}}class Dm{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}function qm(n){return(e,t,i,r)=>new Lm(e,n,t,i,r)}class Za{constructor(e,t,i,r,s,o){this.parser=e,this.parse=t,this.overlay=i,this.bracketed=r,this.target=s,this.from=o}}function Xa(n){if(!n.length||n.some(e=>e.from>=e.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(n))}class Wm{constructor(e,t,i,r,s,o,l,a){this.parser=e,this.predicate=t,this.mounts=i,this.index=r,this.start=s,this.bracketed=o,this.target=l,this.prev=a,this.depth=0,this.ranges=[]}}const go=new z({perNode:!0});class Lm{constructor(e,t,i,r,s){this.nest=t,this.input=i,this.fragments=r,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let i=this.baseParse.advance();if(!i)return null;if(this.baseParse=null,this.baseTree=i,this.startInner(),this.stoppedAt!=null)for(let r of this.inner)r.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let i=this.baseTree;return this.stoppedAt!=null&&(i=new H(i.type,i.children,i.positions,i.length,i.propValues.concat([[go,this.stoppedAt]]))),i}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let i=Object.assign(Object.create(null),e.target.props);i[z.mounted.id]=new oi(t,e.overlay,e.parser,e.bracketed),e.target.props=i}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t=this.stoppedAt)l=!1;else if(e.hasNode(r)){if(t){let h=t.mounts.find(c=>c.frag.from<=r.from&&c.frag.to>=r.to&&c.mount.overlay);if(h)for(let c of h.mount.overlay){let f=c.from+h.pos,u=c.to+h.pos;f>=r.from&&u<=r.to&&!t.ranges.some(d=>d.fromf)&&t.ranges.push({from:f,to:u})}}l=!1}else if(i&&(o=Bm(i.ranges,r.from,r.to)))l=o!=2;else if(!r.type.isAnonymous&&(s=this.nest(r,this.input))&&(r.fromnew Ve(f.from-r.from,f.to-r.from)):null,!!s.bracketed,r.tree,c.length?c[0].from:r.from)),s.overlay?c.length&&(i={ranges:c,depth:0,prev:i}):l=!1}}else if(t&&(a=t.predicate(r))&&(a===!0&&(a=new Ve(r.from,r.to)),a.from=0&&t.ranges[h].to==a.from?t.ranges[h]={from:t.ranges[h].from,to:a.to}:t.ranges.push(a)}if(l&&r.firstChild())t&&t.depth++,i&&i.depth++;else for(;!r.nextSibling();){if(!r.parent())break e;if(t&&!--t.depth){let h=Ra(this.ranges,t.ranges);h.length&&(Xa(h),this.inner.splice(t.index,0,new Za(t.parser,t.parser.startParse(this.input,za(t.mounts,h),h),t.ranges.map(c=>new Ve(c.from-t.start,c.to-t.start)),t.bracketed,t.target,h[0].from))),t=t.prev}i&&!--i.depth&&(i=i.prev)}}}}function Bm(n,e,t){for(let i of n){if(i.from>=t)break;if(i.to>e)return i.from<=e&&i.to>=t?2:1}return 0}function Aa(n,e,t,i,r,s){if(e=e&&t.enter(i,1,W.IgnoreOverlays|W.ExcludeBuffers)||t.next(!1)||(this.done=!0)}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof H)t=t.children[0];else break}return!1}}let jm=class{constructor(e){var t;if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let i=this.curFrag=e[0];this.curTo=(t=i.tree.prop(go))!==null&&t!==void 0?t:i.to,this.inner=new Ma(i.tree,-i.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){var e;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let t=this.curFrag=this.fragments[this.fragI];this.curTo=(e=t.tree.prop(go))!==null&&e!==void 0?e:t.to,this.inner=new Ma(t.tree,-t.offset)}}findMounts(e,t){var i;let r=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let s=this.inner.cursor.node;s;s=s.parent){let o=(i=s.tree)===null||i===void 0?void 0:i.prop(z.mounted);if(o&&o.parser==t)for(let l=this.fragI;l=s.to)break;a.tree==this.curFrag.tree&&r.push({frag:a,pos:s.from-a.offset,mount:o})}}}return r}};function Ra(n,e){let t=null,i=e;for(let r=1,s=0;r=l)break;a.to<=o||(t||(i=t=e.slice()),a.froml&&t.splice(s+1,0,new Ve(l,a.to))):a.to>l?t[s--]=new Ve(l,a.to):t.splice(s--,1))}}return i}function Gm(n,e,t,i){let r=0,s=0,o=!1,l=!1,a=-1e9,h=[];for(;;){let c=r==n.length?1e9:o?n[r].to:n[r].from,f=s==e.length?1e9:l?e[s].to:e[s].from;if(o!=l){let u=Math.max(a,t),d=Math.min(c,f,i);unew Ve(u.from+i,u.to+i)),f=Gm(e,c,a,h);for(let u=0,d=a;;u++){let O=u==f.length,m=O?h:f[u].from;if(m>d&&t.push(new pt(d,m,r.tree,-o,s.from>=d||s.openStart,s.to<=m||s.openEnd)),O)break;d=f[u].to}}else t.push(new pt(a,h,r.tree,-o,s.from>=o||s.openStart,s.to<=l||s.openEnd))}return t}let Nm=0;class ze{constructor(e,t,i,r){this.name=e,this.set=t,this.base=i,this.modified=r,this.id=Nm++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof ze&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let r=new ze(i,[],null,[]);if(r.set.push(r),t)for(let s of t.set)r.set.push(s);return r}static defineModifier(e){let t=new cr(e);return i=>i.modified.indexOf(t)>-1?i:cr.get(i.base||i,i.modified.concat(t).sort((r,s)=>r.id-s.id))}}let Um=0;class cr{constructor(e){this.name=e,this.instances=[],this.id=Um++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Fm(t,l.modified));if(i)return i;let r=[],s=new ze(e.name,r,e,t);for(let l of t)l.instances.push(s);let o=Hm(t);for(let l of e.set)if(!l.modified.length)for(let a of o)r.push(cr.get(l,a));return s}}function Fm(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Hm(n){let e=[[]];for(let t=0;ti.length-t.length)}function Er(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let r of t.split(" "))if(r){let s=[],o=2,l=r;for(let f=0;;){if(l=="..."&&f>0&&f+3==r.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+r);if(s.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==r.length)break;let d=r[f++];if(f==r.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+r);l=r.slice(f)}let a=s.length-1,h=s[a];if(!h)throw new RangeError("Invalid path: "+r);let c=new Fi(i,o,a>0?s.slice(0,a):null);e[h]=c.sort(e[h])}}return $f.add(e)}const $f=new z({combine(n,e){let t,i,r;for(;n||e;){if(!n||e&&n.depth>=e.depth?(r=e,e=e.next):(r=n,n=n.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let s=new Fi(r.tags,r.mode,r.context);t?t.next=s:i=s,t=s}return i}});class Fi{constructor(e,t,i,r){this.tags=e,this.mode=t,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let o=r;for(let l of s)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function Km(n,e){let t=null;for(let i of n){let r=i.style(e);r&&(t=t?t+" "+r:r)}return t}function Jm(n,e,t,i=0,r=n.length){let s=new eg(i,Array.isArray(e)?e:[e],t);s.highlightRange(n.cursor(),i,r,"",s.highlighters),s.flush(r)}class eg{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,r,s){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(s=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=r,c=tg(e)||Fi.empty,f=Km(s,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(r+=(r?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(z.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),O=this.highlighters.filter(g=>!g.scope||g.scope(u.tree.type)),m=e.firstChild();for(let g=0,Q=l;;g++){let b=g=y||!e.nextSibling())););if(!b||y>i)break;Q=b.to+l,Q>t&&(this.highlightRange(d.cursor(),Math.max(t,b.from+l),Math.min(i,Q),"",O),this.startSpan(Math.min(i,Q),h))}m&&e.parent()}else if(e.firstChild()){u&&(r="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,r,s),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function tg(n){let e=n.type.prop($f);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const $=ze.define,Zn=$(),bt=$(),Ya=$(bt),Va=$(bt),yt=$(),Xn=$(yt),fs=$(yt),Ke=$(),zt=$(Ke),Fe=$(),He=$(),Qo=$(),Pi=$(Qo),An=$(),p={comment:Zn,lineComment:$(Zn),blockComment:$(Zn),docComment:$(Zn),name:bt,variableName:$(bt),typeName:Ya,tagName:$(Ya),propertyName:Va,attributeName:$(Va),className:$(bt),labelName:$(bt),namespace:$(bt),macroName:$(bt),literal:yt,string:Xn,docString:$(Xn),character:$(Xn),attributeValue:$(Xn),number:fs,integer:$(fs),float:$(fs),bool:$(yt),regexp:$(yt),escape:$(yt),color:$(yt),url:$(yt),keyword:Fe,self:$(Fe),null:$(Fe),atom:$(Fe),unit:$(Fe),modifier:$(Fe),operatorKeyword:$(Fe),controlKeyword:$(Fe),definitionKeyword:$(Fe),moduleKeyword:$(Fe),operator:He,derefOperator:$(He),arithmeticOperator:$(He),logicOperator:$(He),bitwiseOperator:$(He),compareOperator:$(He),updateOperator:$(He),definitionOperator:$(He),typeOperator:$(He),controlOperator:$(He),punctuation:Qo,separator:$(Qo),bracket:Pi,angleBracket:$(Pi),squareBracket:$(Pi),paren:$(Pi),brace:$(Pi),content:Ke,heading:zt,heading1:$(zt),heading2:$(zt),heading3:$(zt),heading4:$(zt),heading5:$(zt),heading6:$(zt),contentSeparator:$(Ke),list:$(Ke),quote:$(Ke),emphasis:$(Ke),strong:$(Ke),link:$(Ke),monospace:$(Ke),strikethrough:$(Ke),inserted:$(),deleted:$(),changed:$(),invalid:$(),meta:An,documentMeta:$(An),annotation:$(An),processingInstruction:$(An),definition:ze.defineModifier("definition"),constant:ze.defineModifier("constant"),function:ze.defineModifier("function"),standard:ze.defineModifier("standard"),local:ze.defineModifier("local"),special:ze.defineModifier("special")};for(let n in p){let e=p[n];e instanceof ze&&(e.name=n)}vf([{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 us;const ei=new z;function Pf(n){return T.define({combine:n?e=>e.concat(n):void 0})}const el=new z;class Le{constructor(e,t,i=[],r=""){this.data=e,this.name=r,_.prototype.hasOwnProperty("tree")||Object.defineProperty(_.prototype,"tree",{get(){return J(this)}}),this.parser=t,this.extension=[Zt.of(this),_.languageData.of((s,o,l)=>{let a=Ea(s,o,l),h=a.type.prop(ei);if(!h)return[];let c=s.facet(h),f=a.type.prop(el);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,s)){let O=s.facet(d.facet);return d.type=="replace"?O:O.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Ea(e,t,i).type.prop(ei)==this.data}findRegions(e){let t=e.facet(Zt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],r=(s,o)=>{if(s.prop(ei)==this.data){i.push({from:o,to:o+s.length});return}let l=s.prop(z.mounted);if(l){if(l.tree.prop(ei)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+s.length});return}else if(l.overlay){let a=i.length;if(r(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;ai.isTop?t:void 0)]}),e.name)}configure(e,t){return new pi(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function J(n){let e=n.field(Le.state,!1);return e?e.tree:H.empty}class ig{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Ti=null;class fr{constructor(e,t,i=[],r,s,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=r,this.treeLen=s,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new fr(e,t,[],H.empty,0,i,[],null)}startParse(){return this.parser.startParse(new ig(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=H.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(pt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ti;Ti=this;try{return e()}finally{Ti=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=_a(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:r,treeLen:s,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=pt.applyChanges(i,a),r=H.empty,s=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);ce.from&&(this.fragments=_a(this.fragments,r,s),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends kf{createParse(t,i,r){let s=r[0].from,o=r[r.length-1].to;return{parsedPos:s,advance(){let a=Ti;if(a){for(let h of r)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new H(Qe.none,[],[],o-s)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Ti}}function _a(n,e,t){return pt.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class mi{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new mi(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=fr.create(e.facet(Zt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new mi(i)}}Le.state=fe.define({create:mi.init,update(n,e){for(let t of e.effects)if(t.is(Le.setState))return t.value;return e.startState.facet(Zt)!=e.state.facet(Zt)?mi.init(e.state):n.apply(e)}});let Tf=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Tf=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const ds=typeof navigator<"u"&&(!((us=navigator.scheduling)===null||us===void 0)&&us.isInputPending)?()=>navigator.scheduling.isInputPending():null,ng=te.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Le.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Le.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=Tf(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3,a=s.context.work(()=>ds&&ds()||Date.now()>o,r+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:Le.setState.of(new mi(s.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>we(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Zt=T.define({combine(n){return n.length?n[0]:null},enables:n=>[Le.state,ng,v.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class tl{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const rg=T.define(),_r=T.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function ur(n){let e=n.facet(_r);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Hi(n,e){let t="",i=n.tabSize,r=n.facet(_r)[0];if(r==" "){for(;e>=i;)t+=" ",e-=i;r=" "}for(let s=0;s=e?sg(n,t,e):null}class Dr{constructor(e,t={}){this.state=e,this.options=t,this.unit=ur(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:s}=this.options;return r!=null&&r>=i.from&&r<=i.to?s&&r==e?{text:"",from:e}:(t<0?r-1&&(s+=o-this.countColumn(i,i.search(/\S|$/))),s}countColumn(e,t=e.length){return yi(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:r}=this.lineAt(e,t),s=this.options.overrideIndentation;if(s){let o=s(r);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const qr=new z;function sg(n,e,t){let i=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=i.node){let s=[];for(let o=r;o&&!(o.fromi.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)s.push(o);for(let o=s.length-1;o>=0;o--)i={node:s[o],next:i}}return Cf(i,n,t)}function Cf(n,e,t){for(let i=n;i;i=i.next){let r=lg(i.node);if(r)return r(nl.create(e,t,i))}return 0}function og(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function lg(n){let e=n.type.prop(qr);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(z.closedBy))){let r=n.lastChild,s=r&&i.indexOf(r.name)>-1;return o=>Zf(o,!0,1,void 0,s&&!og(o)?r.from:void 0)}return n.parent==null?ag:null}function ag(){return 0}class nl extends Dr{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new nl(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(hg(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return Cf(this.context.next,this.base,this.pos)}}function hg(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function cg(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let r=n.options.simulateBreak,s=n.state.doc.lineAt(t.from),o=r==null||r<=s.from?s.to:Math.min(s.to,r);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(s.text.slice(t.to-s.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function fg({closing:n,align:e=!0,units:t=1}){return i=>Zf(i,e,t,n)}function Zf(n,e,t,i,r){let s=n.textAfter,o=s.match(/^\s*/)[0].length,l=i&&s.slice(o,o+i.length)==i||r==n.pos+o,a=e?cg(n):null;return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}const ug=n=>n.baseIndent;function jn({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const dg=200;function Og(){return _.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,r=t.lineAt(i);if(i>r.from+dg)return n;let s=t.sliceString(r.from,i);if(!e.some(h=>h.test(s)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=il(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=Hi(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const pg=T.define(),Wr=new z;function Xf(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(s&&l.from=e&&h.to>t&&(s=h)}}return s}function gg(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function dr(n,e,t){for(let i of n.facet(pg)){let r=i(n,e,t);if(r)return r}return mg(n,e,t)}function Af(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Lr=M.define({map:Af}),hn=M.define({map:Af});function Mf(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const Gt=fe.define({create(){return X.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=Da(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Lr)&&!Qg(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(Yf),r=i?X.replace({widget:new $g(i(e.state,t.value))}):qa;n=n.update({add:[r.range(t.value.from,t.value.to)]})}else t.is(hn)&&(n=n.update({filter:(i,r)=>t.value.from!=i||t.value.to!=r,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=Da(n,e.selection.main.head)),n},provide:n=>v.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,r)=>{t.push(i,r)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{re&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(r,s)=>r>=t||s<=e}):n}function Or(n,e,t){var i;let r=null;return(i=n.field(Gt,!1))===null||i===void 0||i.between(e,t,(s,o)=>{(!r||r.from>s)&&(r={from:s,to:o})}),r}function Qg(n,e,t){let i=!1;return n.between(e,e,(r,s)=>{r==e&&s==t&&(i=!0)}),i}function Rf(n,e){return n.field(Gt,!1)?e:e.concat(M.appendConfig.of(Vf()))}const Sg=n=>{for(let e of Mf(n)){let t=dr(n.state,e.from,e.to);if(t)return n.dispatch({effects:Rf(n.state,[Lr.of(t),zf(n,t)])}),!0}return!1},bg=n=>{if(!n.state.field(Gt,!1))return!1;let e=[];for(let t of Mf(n)){let i=Or(n.state,t.from,t.to);i&&e.push(hn.of(i),zf(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function zf(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,r=n.state.doc.lineAt(e.to).number;return v.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${r}.`)}const yg=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(Gt,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,r)=>{t.push(hn.of({from:i,to:r}))}),n.dispatch({effects:t}),!0},wg=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Sg},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:bg},{key:"Ctrl-Alt-[",run:yg},{key:"Ctrl-Alt-]",run:xg}],kg={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},Yf=T.define({combine(n){return at(n,kg)}});function Vf(n){return[Gt,Tg]}function Ef(n,e){let{state:t}=n,i=t.facet(Yf),r=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=Or(n.state,l.from,l.to);a&&n.dispatch({effects:hn.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,r,e);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",t.phrase("folded code")),s.title=t.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const qa=X.replace({widget:new class extends ht{toDOM(n){return Ef(n,null)}}});class $g extends ht{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Ef(e,this.value)}}const vg={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Os extends Qt{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Pg(n={}){let e={...vg,...n},t=new Os(e,!0),i=new Os(e,!1),r=te.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Zt)!=o.state.facet(Zt)||o.startState.field(Gt,!1)!=o.state.field(Gt,!1)||J(o.startState)!=J(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new mt;for(let a of o.viewportLineBlocks){let h=Or(o.state,a.from,a.to)?i:dr(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:s}=e;return[r,wm({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(r))===null||l===void 0?void 0:l.markers)||V.empty},initialSpacer(){return new Os(e,!1)},domEventHandlers:{...s,click:(o,l,a)=>{if(s.click&&s.click(o,l,a))return!0;let h=Or(o.state,l.from,l.to);if(h)return o.dispatch({effects:hn.of(h)}),!0;let c=dr(o.state,l.from,l.to);return c?(o.dispatch({effects:Lr.of(c)}),!0):!1}}}),Vf()]}const Tg=v.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class cn{constructor(e,t){this.specs=e;let i;function r(l){let a=vt.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const s=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof Le?l=>l.prop(ei)==o.data:o?l=>l==o:void 0,this.style=vf(e.map(l=>({tag:l.tag,class:l.class||r(Object.assign({},l,{tag:null}))})),{all:s}).style,this.module=i?new vt(i):null,this.themeType=t.themeType}static define(e,t){return new cn(e,t||{})}}const So=T.define(),_f=T.define({combine(n){return n.length?[n[0]]:null}});function ps(n){let e=n.facet(So);return e.length?e:n.facet(_f)}function Df(n,e){let t=[Zg],i;return n instanceof cn&&(n.module&&t.push(v.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(_f.of(n)):i?t.push(So.computeN([v.darkTheme],r=>r.facet(v.darkTheme)==(i=="dark")?[n]:[])):t.push(So.of(n)),t}class Cg{constructor(e){this.markCache=Object.create(null),this.tree=J(e.state),this.decorations=this.buildDeco(e,ps(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=J(e.state),i=ps(e.state),r=i!=ps(e.startState),{viewport:s}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length=s.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=s.to)}buildDeco(e,t){if(!t||!this.tree.length)return X.none;let i=new mt;for(let{from:r,to:s}of e.visibleRanges)Jm(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=X.mark({class:a})))},r,s);return i.finish()}}const Zg=At.high(te.fromClass(Cg,{decorations:n=>n.decorations})),Xg=cn.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"}]),Ag=v.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),qf=1e4,Wf="()[]{}",Lf=T.define({combine(n){return at(n,{afterCursor:!0,brackets:Wf,maxScanDistance:qf,renderMatch:zg})}}),Mg=X.mark({class:"cm-matchingBracket"}),Rg=X.mark({class:"cm-nonmatchingBracket"});function zg(n){let e=[],t=n.matched?Mg:Rg;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Wa(n){let e=[],t=n.facet(Lf);for(let i of n.selection.ranges){if(!i.empty)continue;let r=rt(n,i.head,-1,t)||i.head>0&&rt(n,i.head-1,1,t)||t.afterCursor&&(rt(n,i.head,1,t)||i.headn.decorations}),Vg=[Yg,Ag];function Eg(n={}){return[Lf.of(n),Vg]}const Bf=new z;function bo(n,e,t){let i=n.prop(e<0?z.openedBy:z.closedBy);if(i)return i;if(n.name.length==1){let r=t.indexOf(n.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function yo(n){let e=n.type.prop(Bf);return e?e(n.node):n}function rt(n,e,t,i={}){let r=i.maxScanDistance||qf,s=i.brackets||Wf,o=J(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=bo(a.type,t,s);if(h&&a.from0?e>=c.from&&ec.from&&e<=c.to))return _g(n,e,t,a,c,h,s)}}return Dg(n,e,t,o,l.type,r,s)}function _g(n,e,t,i,r,s,o){let l=i.parent,a={from:r.from,to:r.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&s.indexOf(c.type.name)>-1&&c.from0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=s;){let d=c.value;t<0&&(u+=d.length);let O=e+u*t;for(let m=t>0?0:d.length-1,g=t>0?d.length:-1;m!=g;m+=t){let Q=o.indexOf(d[m]);if(!(Q<0||i.resolveInner(O+m,1).type!=r))if(Q%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:O+m,to:O+m+1},matched:Q>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}const qg=Object.create(null),La=[Qe.none],Ba=[],Ia=Object.create(null),Wg=Object.create(null);for(let[n,e]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"]])Wg[n]=Lg(qg,e);function ms(n,e){Ba.indexOf(n)>-1||(Ba.push(n),console.warn(e))}function Lg(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||p[h];c?typeof c=="function"?a.length?a=a.map(c):ms(h,`Modifier ${h} used at start of tag`):a.length?ms(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:ms(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+t.map(l=>l.id),s=Ia[r];if(s)return s.id;let o=Ia[r]=Qe.define({id:La.length,name:i,props:[Er({[i]:t})]});return La.push(o),o.id}G.RTL,G.LTR;const Bg=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=sl(n.state,t.from);return i.line?Ig(n):i.block?Gg(n):!1};function rl(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let r=n(e,t);return r?(i(t.update(r)),!0):!1}}const Ig=rl(Fg,0),jg=rl(If,0),Gg=rl((n,e)=>If(n,e,Ug(e)),0);function sl(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Ci=50;function Ng(n,{open:e,close:t},i,r){let s=n.sliceDoc(i-Ci,i),o=n.sliceDoc(r,r+Ci),l=/\s*$/.exec(s)[0].length,a=/^\s*/.exec(o)[0].length,h=s.length-l;if(s.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:r+a,margin:a&&1}};let c,f;r-i<=2*Ci?c=f=n.sliceDoc(i,r):(c=n.sliceDoc(i,i+Ci),f=n.sliceDoc(r-Ci,r));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,O=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(O,O+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:r-d-t.length,margin:/\s/.test(f.charAt(O-1))?1:0}}:null}function Ug(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),r=t.to<=i.to?i:n.doc.lineAt(t.to);r.from>i.from&&r.from==t.to&&(r=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let s=e.length-1;s>=0&&e[s].to>i.from?e[s].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function If(n,e,t=e.selection.ranges){let i=t.map(s=>sl(e,s.from).block);if(!i.every(s=>s))return null;let r=t.map((s,o)=>Ng(e,i[o],s.from,s.to));if(n!=2&&!r.every(s=>s))return{changes:e.changes(t.map((s,o)=>r[o]?[]:[{from:s.from,insert:i[o].open+" "},{from:s.to,insert:" "+i[o].close}]))};if(n!=1&&r.some(s=>s)){let s=[];for(let o=0,l;or&&(s==o||o>f.from)){r=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,O=f.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:c,single:f}of i)(f||!c)&&s.push({from:l.from+h,insert:a+" "});let o=e.changes(s);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(s=>s.comment>=0)){let s=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,s.push({from:h,to:c})}return{changes:s}}return null}const xo=St.define(),Hg=St.define(),Kg=T.define(),jf=T.define({combine(n){return at(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,r)=>e(i,r)||t(i,r)})}}),ol=fe.define({create(){return st.empty},update(n,e){let t=e.state.facet(jf),i=e.annotation(xo);if(i){let a=ke.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=mr(c,c.length,t.minDepth,a):c=Nf(c,e.startState.selection),new st(h==0?i.rest:c,h==0?c:i.rest)}let r=e.annotation(Hg);if((r=="full"||r=="before")&&(n=n.isolate()),e.annotation(ie.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let s=ke.fromTransaction(e),o=e.annotation(ie.time),l=e.annotation(ie.userEvent);return s?n=n.addChanges(s,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(r=="full"||r=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new st(n.done.map(ke.fromJSON),n.undone.map(ke.fromJSON))}});function Jg(n={}){return[ol,jf.of(n),v.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?ll:e.inputType=="historyRedo"?pr:null;return i?(e.preventDefault(),i(t)):!1}})]}function Br(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let r=t.field(ol,!1);if(!r)return!1;let s=r.pop(n,t,e);return s?(i(s),!0):!1}}const ll=Br(0,!1),pr=Br(1,!1),e0=Br(0,!0),t0=Br(1,!0);function i0(n){return function(e){let t=e.field(ol,!1);if(!t)return 0;let i=n==0?t.done:t.undone;return i.length-(i.length&&!i[0].changes?1:0)}}const n0=i0(0);class ke{constructor(e,t,i,r,s){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=r,this.selectionsAfter=s}setSelAfter(e){return new ke(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new ke(e.changes&&ne.fromJSON(e.changes),[],e.mapped&&ot.fromJSON(e.mapped),e.startSelection&&S.fromJSON(e.startSelection),e.selectionsAfter.map(S.fromJSON))}static fromTransaction(e,t){let i=Ee;for(let r of e.startState.facet(Kg)){let s=r(e);s.length&&(i=i.concat(s))}return!i.length&&e.changes.empty?null:new ke(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Ee)}static selection(e){return new ke(void 0,Ee,void 0,void 0,e)}}function mr(n,e,t,i){let r=e+1>t+20?e-t-1:0,s=n.slice(r,e);return s.push(i),s}function r0(n,e){let t=[],i=!1;return n.iterChangedRanges((r,s)=>t.push(r,s)),e.iterChangedRanges((r,s,o,l)=>{for(let a=0;a=h&&o<=c&&(i=!0)}}),i}function s0(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Gf(n,e){return n.length?e.length?n.concat(e):n:e}const Ee=[],o0=200;function Nf(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-o0));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),mr(n,n.length-1,1e9,t.setSelAfter(i)))}else return[ke.selection([e])]}function l0(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function gs(n,e){if(!n.length)return n;let t=n.length,i=Ee;for(;t;){let r=a0(n[t-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let s=n.slice(0,t);return s[t-1]=r,s}else e=r.mapped,t--,i=r.selectionsAfter}return i.length?[ke.selection(i)]:Ee}function a0(n,e,t){let i=Gf(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Ee,t);if(!n.changes)return ke.selection(i);let r=n.changes.map(e),s=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(s):s;return new ke(r,M.mapEffects(n.effects,e),o,n.startSelection.map(s),i)}const h0=/^(input\.type|delete)($|\.)/;class st{constructor(e,t,i=0,r=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new st(this.done,this.undone):this}addChanges(e,t,i,r,s){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||h0.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):Ir(t,e))}function Oe(n){return n.textDirectionAt(n.state.selection.main.head)==G.LTR}const Ff=n=>Uf(n,!Oe(n)),Hf=n=>Uf(n,Oe(n));function Kf(n,e){return je(n,t=>t.empty?n.moveByGroup(t,e):Ir(t,e))}const f0=n=>Kf(n,!Oe(n)),u0=n=>Kf(n,Oe(n));function d0(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function jr(n,e,t){let i=J(n).resolveInner(e.head),r=t?z.closedBy:z.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;d0(n,h,r)?i=h:a=t?h.to:h.from}let s=i.type.prop(r),o,l;return s&&(o=t?rt(n,i.from,1):rt(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,S.cursor(l,t?-1:1)}const O0=n=>je(n,e=>jr(n.state,e,!Oe(n))),p0=n=>je(n,e=>jr(n.state,e,Oe(n)));function Jf(n,e){return je(n,t=>{if(!t.empty)return Ir(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const eu=n=>Jf(n,!1),tu=n=>Jf(n,!0);function iu(n){let e=n.scrollDOM.clientHeighto.empty?n.moveVertically(o,e,t.height):Ir(o,e));if(r.eq(i.selection))return!1;let s;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottomnu(n,!1),wo=n=>nu(n,!0);function Mt(n,e,t){let i=n.lineBlockAt(e.head),r=n.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?i.to:i.from)&&(r=n.moveToLineBoundary(e,t,!1)),!t&&r.head==i.from&&i.length){let s=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;s&&e.head!=i.from+s&&(r=S.cursor(i.from+s))}return r}const m0=n=>je(n,e=>Mt(n,e,!0)),g0=n=>je(n,e=>Mt(n,e,!1)),Q0=n=>je(n,e=>Mt(n,e,!Oe(n))),S0=n=>je(n,e=>Mt(n,e,Oe(n))),b0=n=>je(n,e=>S.cursor(n.lineBlockAt(e.head).from,1)),y0=n=>je(n,e=>S.cursor(n.lineBlockAt(e.head).to,-1));function x0(n,e,t){let i=!1,r=xi(n.selection,s=>{let o=rt(n,s.head,-1)||rt(n,s.head,1)||s.head>0&&rt(n,s.head-1,1)||s.headx0(n,e);function De(n,e){let t=xi(n.state.selection,i=>{let r=e(i);return S.range(i.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Ie(n.state,t)),!0)}function ru(n,e){return De(n,t=>n.moveByChar(t,e))}const su=n=>ru(n,!Oe(n)),ou=n=>ru(n,Oe(n));function lu(n,e){return De(n,t=>n.moveByGroup(t,e))}const k0=n=>lu(n,!Oe(n)),$0=n=>lu(n,Oe(n)),v0=n=>De(n,e=>jr(n.state,e,!Oe(n))),P0=n=>De(n,e=>jr(n.state,e,Oe(n)));function au(n,e){return De(n,t=>n.moveVertically(t,e))}const hu=n=>au(n,!1),cu=n=>au(n,!0);function fu(n,e){return De(n,t=>n.moveVertically(t,e,iu(n).height))}const Ga=n=>fu(n,!1),Na=n=>fu(n,!0),T0=n=>De(n,e=>Mt(n,e,!0)),C0=n=>De(n,e=>Mt(n,e,!1)),Z0=n=>De(n,e=>Mt(n,e,!Oe(n))),X0=n=>De(n,e=>Mt(n,e,Oe(n))),A0=n=>De(n,e=>S.cursor(n.lineBlockAt(e.head).from)),M0=n=>De(n,e=>S.cursor(n.lineBlockAt(e.head).to)),Ua=({state:n,dispatch:e})=>(e(Ie(n,{anchor:0})),!0),Fa=({state:n,dispatch:e})=>(e(Ie(n,{anchor:n.doc.length})),!0),Ha=({state:n,dispatch:e})=>(e(Ie(n,{anchor:n.selection.main.anchor,head:0})),!0),Ka=({state:n,dispatch:e})=>(e(Ie(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),R0=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),z0=({state:n,dispatch:e})=>{let t=Gr(n).map(({from:i,to:r})=>S.range(i,Math.min(r+1,n.doc.length)));return e(n.update({selection:S.create(t),userEvent:"select"})),!0},Y0=({state:n,dispatch:e})=>{let t=xi(n.selection,i=>{let r=J(n),s=r.resolveStack(i.from,1);if(i.empty){let o=r.resolveStack(i.from,-1);o.node.from>=s.node.from&&o.node.to<=s.node.to&&(s=o)}for(let o=s;o;o=o.next){let{node:l}=o;if((l.from=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return S.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(Ie(n,t)),!0)};function uu(n,e){let{state:t}=n,i=t.selection,r=t.selection.ranges.slice();for(let s of t.selection.ranges){let o=t.doc.lineAt(s.head);if(e?o.to0)for(let l=s;;){let a=n.moveVertically(l,e);if(a.heado.to){r.some(h=>h.head==a.head)||r.push(a);break}else{if(a.head==l.head)break;l=a}}}return r.length==i.ranges.length?!1:(n.dispatch(Ie(t,S.create(r,r.length-1))),!0)}const V0=n=>uu(n,!1),E0=n=>uu(n,!0),_0=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=S.create([t.main]):t.main.empty||(i=S.create([S.cursor(t.main.head)])),i?(e(Ie(n,i)),!0):!1};function fn(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,r=i.changeByRange(s=>{let{from:o,to:l}=s;if(o==l){let a=e(s);ao&&(t="delete.forward",a=Mn(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Mn(n,o,!1),l=Mn(n,l,!0);return o==l?{range:s}:{changes:{from:o,to:l},range:S.cursor(o,or(n)))i.between(e,e,(r,s)=>{re&&(e=t?s:r)});return e}const du=(n,e,t)=>fn(n,i=>{let r=i.from,{state:s}=n,o=s.doc.lineAt(r),l,a;if(t&&!e&&r>o.from&&rdu(n,!1,!0),Ou=n=>du(n,!0,!1),pu=(n,e)=>fn(n,t=>{let i=t.head,{state:r}=n,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let l=null;;){if(i==(e?s.to:s.from)){i==t.head&&s.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let a=se(s.text,i-s.from,e)+s.from,h=s.text.slice(Math.min(i,a)-s.from,Math.max(i,a)-s.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),mu=n=>pu(n,!1),D0=n=>pu(n,!0),q0=n=>fn(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headfn(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),L0=n=>fn(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:D.of(["",""])},range:S.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},I0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let r=i.from,s=n.doc.lineAt(r),o=r==s.from?r-1:se(s.text,r-s.from,!1)+s.from,l=r==s.to?r+1:se(s.text,r-s.from,!0)+s.from;return{changes:{from:o,to:l,insert:n.doc.slice(r,l).append(n.doc.slice(o,r))},range:S.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Gr(n){let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.from),s=n.doc.lineAt(i.to);if(!i.empty&&i.to==s.from&&(s=n.doc.lineAt(i.to-1)),t>=r.number){let o=e[e.length-1];o.to=s.to,o.ranges.push(i)}else e.push({from:r.from,to:s.to,ranges:[i]});t=s.number+1}return e}function gu(n,e,t){if(n.readOnly)return!1;let i=[],r=[];for(let s of Gr(n)){if(t?s.to==n.doc.length:s.from==0)continue;let o=n.doc.lineAt(t?s.to+1:s.from-1),l=o.length+1;if(t){i.push({from:s.to,to:o.to},{from:s.from,insert:o.text+n.lineBreak});for(let a of s.ranges)r.push(S.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:s.from},{from:s.to,insert:n.lineBreak+o.text});for(let a of s.ranges)r.push(S.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:S.create(r,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const j0=({state:n,dispatch:e})=>gu(n,e,!1),G0=({state:n,dispatch:e})=>gu(n,e,!0);function Qu(n,e,t){if(n.readOnly)return!1;let i=[];for(let s of Gr(n))t?i.push({from:s.from,insert:n.doc.slice(s.from,s.to)+n.lineBreak}):i.push({from:s.to,insert:n.lineBreak+n.doc.slice(s.from,s.to)});let r=n.changes(i);return e(n.update({changes:r,selection:n.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const N0=({state:n,dispatch:e})=>Qu(n,e,!1),U0=({state:n,dispatch:e})=>Qu(n,e,!0),F0=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(Gr(e).map(({from:r,to:s})=>(r>0?r--:s{let s;if(n.lineWrapping){let o=n.lineBlockAt(r.head),l=n.coordsAtPos(r.head,r.assoc||1);l&&(s=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(r,!0,s)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function H0(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=J(n).resolveInner(e),i=t.childBefore(e),r=t.childAfter(e),s;return i&&r&&i.to<=e&&r.from>=e&&(s=i.type.prop(z.closedBy))&&s.indexOf(r.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(r.from).from&&!/\S/.test(n.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const Ja=Su(!1),K0=Su(!0);function Su(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:s,to:o}=r,l=e.doc.lineAt(s),a=!n&&s==o&&H0(e,s);n&&(s=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new Dr(e,{simulateBreak:s,simulateDoubleBreak:!!a}),c=il(h,s);for(c==null&&(c=yi(/^\s*/.exec(e.doc.lineAt(s).text)[0],e.tabSize));ol.from&&s{let r=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,r,i),t=l.number),o=l.to+1}let s=n.changes(r);return{changes:r,range:S.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}})}const J0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new Dr(n,{overrideIndentation:s=>{let o=t[s];return o??-1}}),r=al(n,(s,o,l)=>{let a=il(i,s.from);if(a==null)return;/\S/.test(s.text)||(a=0);let h=/^\s*/.exec(s.text)[0],c=Hi(n,a);(h!=c||l.fromn.readOnly?!1:(e(n.update(al(n,(t,i)=>{i.push({from:t.from,insert:n.facet(_r)})}),{userEvent:"input.indent"})),!0),tQ=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(al(n,(t,i)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let s=yi(r,n.tabSize),o=0,l=Hi(n,Math.max(0,s-ur(n)));for(;o(n.setTabFocusMode(),!0),nQ=[{key:"Ctrl-b",run:Ff,shift:su,preventDefault:!0},{key:"Ctrl-f",run:Hf,shift:ou},{key:"Ctrl-p",run:eu,shift:hu},{key:"Ctrl-n",run:tu,shift:cu},{key:"Ctrl-a",run:b0,shift:A0},{key:"Ctrl-e",run:y0,shift:M0},{key:"Ctrl-d",run:Ou},{key:"Ctrl-h",run:ko},{key:"Ctrl-k",run:q0},{key:"Ctrl-Alt-h",run:mu},{key:"Ctrl-o",run:B0},{key:"Ctrl-t",run:I0},{key:"Ctrl-v",run:wo}],rQ=[{key:"ArrowLeft",run:Ff,shift:su,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:f0,shift:k0,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Q0,shift:Z0,preventDefault:!0},{key:"ArrowRight",run:Hf,shift:ou,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:u0,shift:$0,preventDefault:!0},{mac:"Cmd-ArrowRight",run:S0,shift:X0,preventDefault:!0},{key:"ArrowUp",run:eu,shift:hu,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Ua,shift:Ha},{mac:"Ctrl-ArrowUp",run:ja,shift:Ga},{key:"ArrowDown",run:tu,shift:cu,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Fa,shift:Ka},{mac:"Ctrl-ArrowDown",run:wo,shift:Na},{key:"PageUp",run:ja,shift:Ga},{key:"PageDown",run:wo,shift:Na},{key:"Home",run:g0,shift:C0,preventDefault:!0},{key:"Mod-Home",run:Ua,shift:Ha},{key:"End",run:m0,shift:T0,preventDefault:!0},{key:"Mod-End",run:Fa,shift:Ka},{key:"Enter",run:Ja,shift:Ja},{key:"Mod-a",run:R0},{key:"Backspace",run:ko,shift:ko,preventDefault:!0},{key:"Delete",run:Ou,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:mu,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:D0,preventDefault:!0},{mac:"Mod-Backspace",run:W0,preventDefault:!0},{mac:"Mod-Delete",run:L0,preventDefault:!0}].concat(nQ.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),sQ=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:O0,shift:v0},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:p0,shift:P0},{key:"Alt-ArrowUp",run:j0},{key:"Shift-Alt-ArrowUp",run:N0},{key:"Alt-ArrowDown",run:G0},{key:"Shift-Alt-ArrowDown",run:U0},{key:"Mod-Alt-ArrowUp",run:V0},{key:"Mod-Alt-ArrowDown",run:E0},{key:"Escape",run:_0},{key:"Mod-Enter",run:K0},{key:"Alt-l",mac:"Ctrl-l",run:z0},{key:"Mod-i",run:Y0,preventDefault:!0},{key:"Mod-[",run:tQ},{key:"Mod-]",run:eQ},{key:"Mod-Alt-\\",run:J0},{key:"Shift-Mod-k",run:F0},{key:"Shift-Mod-\\",run:w0},{key:"Mod-/",run:Bg},{key:"Alt-A",run:jg},{key:"Ctrl-m",mac:"Shift-Alt-m",run:iQ}].concat(rQ),eh=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class gi{constructor(e,t,i=0,r=e.length,s,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,r),this.bufferStart=i,this.normalize=s?l=>s(eh(l)):eh,this.query=this.normalize(t)}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 be(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Xo(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=et(e);let r=this.normalize(t);if(r.length)for(let s=0,o=i;;s++){let l=r.charCodeAt(s),a=this.match(l,o,this.bufferPos+this.bufferStart);if(s==r.length-1){if(a)return this.value=a,this;break}o==i&&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 e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,r=i+t[0].length;if(this.matchPos=gr(this.text,r+(i==r?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,r,t)))return this.value={from:i,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||r.to<=t){let l=new li(t,e.sliceString(t,i));return Qs.set(e,l),l}if(r.from==t&&r.to==i)return r;let{text:s,from:o}=r;return o>t&&(s=e.sliceString(t,o)+s,o=t),r.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,r=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,r,t)))return this.value={from:i,to:r,match:t},this.matchPos=gr(this.text,r+(i==r?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=li.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(yu.prototype[Symbol.iterator]=xu.prototype[Symbol.iterator]=function(){return this});function oQ(n){try{return new RegExp(n,hl),!0}catch{return!1}}function gr(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}const lQ=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:r}=Sm(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return r.then(s=>{let o=s&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(s.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let g=d/100;a&&(g=g*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*g)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let O=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),m=S.cursor(O.from+Math.max(0,Math.min(u,O.length)));n.dispatch({effects:[i,v.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},aQ={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},hQ=T.define({combine(n){return at(n,aQ,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function cQ(n){return[pQ,OQ]}const fQ=X.mark({class:"cm-selectionMatch"}),uQ=X.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function th(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=F.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=F.Word)}function dQ(n,e,t,i){return n(e.sliceDoc(t,t+1))==F.Word&&n(e.sliceDoc(i-1,i))==F.Word}const OQ=te.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(hQ),{state:t}=n,i=t.selection;if(i.ranges.length>1)return X.none;let r=i.main,s,o=null;if(r.empty){if(!e.highlightWordAroundCursor)return X.none;let a=t.wordAt(r.head);if(!a)return X.none;o=t.charCategorizer(r.head),s=t.sliceDoc(a.from,a.to)}else{let a=r.to-r.from;if(a200)return X.none;if(e.wholeWords){if(s=t.sliceDoc(r.from,r.to),o=t.charCategorizer(r.head),!(th(o,t,r.from,r.to)&&dQ(o,t,r.from,r.to)))return X.none}else if(s=t.sliceDoc(r.from,r.to),!s)return X.none}let l=[];for(let a of n.visibleRanges){let h=new gi(t.doc,s,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||th(o,t,c,f))&&(r.empty&&c<=r.from&&f>=r.to?l.push(uQ.range(c,f)):(c>=r.to||f<=r.from)&&l.push(fQ.range(c,f)),l.length>e.maxMatches))return X.none}}return X.set(l)}},{decorations:n=>n.decorations}),pQ=v.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),mQ=({state:n,dispatch:e})=>{let{selection:t}=n,i=S.create(t.ranges.map(r=>n.wordAt(r.head)||S.cursor(r.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function gQ(n,e){let{main:t,ranges:i}=n.selection,r=n.wordAt(t.head),s=r&&r.from==t.from&&r.to==t.to;for(let o=!1,l=new gi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new gi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(s){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const QQ=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(s=>s.from===s.to))return mQ({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(s=>n.sliceDoc(s.from,s.to)!=i))return!1;let r=gQ(n,i);return r?(e(n.update({selection:n.selection.addRange(S.range(r.from,r.to),!1),effects:v.scrollIntoView(r.to)})),!0):!1},wi=T.define({combine(n){return at(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new AQ(e),scrollToMatch:e=>v.scrollIntoView(e)})}});class wu{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||oQ(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new kQ(this):new yQ(this)}getCursor(e,t=0,i){let r=e.doc?e:_.create({doc:e});return i==null&&(i=r.doc.length),this.regexp?Ht(this,r,t,i):Ft(this,r,t,i)}}class ku{constructor(e){this.spec=e}}function SQ(n,e,t){return(i,r,s,o)=>{if(t&&!t(i,r,s,o))return!1;let l=i>=o&&r<=o+s.length?s.slice(i-o,r-o):e.doc.sliceString(i,r);return n(l,e,i,r)}}function Ft(n,e,t,i){let r;return n.wholeWord&&(r=bQ(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(r=SQ(n.test,e,r)),new gi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:s=>s.toLowerCase(),r)}function bQ(n,e){return(t,i,r,s)=>((s>t||s+r.length=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Ft(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}function xQ(n,e,t){return(i,r,s)=>(!t||t(i,r,s))&&n(s[0],e,i,r)}function Ht(n,e,t,i){let r;return n.wholeWord&&(r=wQ(e.charCategorizer(e.selection.main.head))),n.test&&(r=xQ(n.test,e,r)),new yu(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:r},t,i)}function Qr(n,e){return n.slice(se(n,e,!1),e)}function Sr(n,e){return n.slice(e,se(n,e))}function wQ(n){return(e,t,i)=>!i[0].length||(n(Qr(i.input,i.index))!=F.Word||n(Sr(i.input,i.index))!=F.Word)&&(n(Sr(i.input,i.index+i[0].length))!=F.Word||n(Qr(i.input,i.index+i[0].length))!=F.Word)}class kQ extends ku{nextMatch(e,t,i){let r=Ht(this.spec,e,i,e.doc.length).next();return r.done&&(r=Ht(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,i){for(let r=1;;r++){let s=Math.max(t,i-r*1e4),o=Ht(this.spec,e,s,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(s==t||l.from>s+10))return l;if(s==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let r=i.length;r>0;r--){let s=+i.slice(0,r);if(s>0&&s=t)return null;r.push(i.value)}return r}highlight(e,t,i,r){let s=Ht(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!s.next().done;)r(s.value.from,s.value.to)}}const Ki=M.define(),cl=M.define(),kt=fe.define({create(n){return new Ss($o(n).create(),null)},update(n,e){for(let t of e.effects)t.is(Ki)?n=new Ss(t.value.create(),n.panel):t.is(cl)&&(n=new Ss(n.query,t.value?fl:null));return n},provide:n=>Ni.from(n,e=>e.panel)});class Ss{constructor(e,t){this.query=e,this.panel=t}}const $Q=X.mark({class:"cm-searchMatch"}),vQ=X.mark({class:"cm-searchMatch cm-searchMatch-selected"}),PQ=te.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(kt))}update(n){let e=n.state.field(kt);(e!=n.startState.field(kt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return X.none;let{view:t}=this,i=new mt;for(let r=0,s=t.visibleRanges,o=s.length;rs[r+1].from-500;)a=s[++r].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?vQ:$Q)})}return i.finish()}},{decorations:n=>n.decorations});function un(n){return e=>{let t=e.state.field(kt,!1);return t&&t.query.spec.valid?n(e,t):Pu(e)}}const br=un((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let r=S.single(i.from,i.to),s=n.state.facet(wi);return n.dispatch({selection:r,effects:[ul(n,i),s.scrollToMatch(r.main,n)],userEvent:"select.search"}),vu(n),!0}),yr=un((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,r=e.prevMatch(t,i,i);if(!r)return!1;let s=S.single(r.from,r.to),o=n.state.facet(wi);return n.dispatch({selection:s,effects:[ul(n,r),o.scrollToMatch(s.main,n)],userEvent:"select.search"}),vu(n),!0}),TQ=un((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:S.create(t.map(i=>S.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),CQ=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:r}=t.main,s=[],o=0;for(let l=new gi(n.doc,n.sliceDoc(i,r));!l.next().done;){if(s.length>1e3)return!1;l.value.from==i&&(o=s.length),s.push(S.range(l.value.from,l.value.to))}return e(n.update({selection:S.create(s,o),userEvent:"select.search.matches"})),!0},ih=un((n,{query:e})=>{let{state:t}=n,{from:i,to:r}=t.selection.main;if(t.readOnly)return!1;let s=e.nextMatch(t,i,i);if(!s)return!1;let o=s,l=[],a,h,c=[];o.from==i&&o.to==r&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(v.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+".")));let f=n.state.changes(l);return o&&(a=S.single(o.from,o.to).map(f),c.push(ul(n,o)),c.push(t.facet(wi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),ZQ=un((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(r=>{let{from:s,to:o}=r;return{from:s,to:o,insert:e.getReplacement(r)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:v.announce.of(i),userEvent:"input.replace.all"}),!0});function fl(n){return n.state.facet(wi).createPanel(n)}function $o(n,e){var t,i,r,s,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(wi);return new wu({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(r=e?.literal)!==null&&r!==void 0?r:h.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function $u(n){let e=Uo(n,fl);return e&&e.dom.querySelector("[main-field]")}function vu(n){let e=$u(n);e&&e==n.root.activeElement&&e.select()}const Pu=n=>{let e=n.state.field(kt,!1);if(e&&e.panel){let t=$u(n);if(t&&t!=n.root.activeElement){let i=$o(n.state,e.query.spec);i.valid&&n.dispatch({effects:Ki.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[cl.of(!0),e?Ki.of($o(n.state,e.query.spec)):M.appendConfig.of(RQ)]});return!0},Tu=n=>{let e=n.state.field(kt,!1);if(!e||!e.panel)return!1;let t=Uo(n,fl);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:cl.of(!1)}),!0},XQ=[{key:"Mod-f",run:Pu,scope:"editor search-panel"},{key:"F3",run:br,shift:yr,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:br,shift:yr,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Tu,scope:"editor search-panel"},{key:"Mod-Shift-l",run:CQ},{key:"Mod-Alt-g",run:lQ},{key:"Mod-d",run:QQ,preventDefault:!0}];class AQ{constructor(e){this.view=e;let t=this.query=e.state.field(kt).query.spec;this.commit=this.commit.bind(this),this.searchField=B("input",{value:t.search,placeholder:Pe(e,"Find"),"aria-label":Pe(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=B("input",{value:t.replace,placeholder:Pe(e,"Replace"),"aria-label":Pe(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=B("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=B("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=B("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(r,s,o){return B("button",{class:"cm-button",name:r,onclick:s,type:"button"},o)}this.dom=B("div",{onkeydown:r=>this.keydown(r),class:"cm-search"},[this.searchField,i("next",()=>br(e),[Pe(e,"next")]),i("prev",()=>yr(e),[Pe(e,"previous")]),i("select",()=>TQ(e),[Pe(e,"all")]),B("label",null,[this.caseField,Pe(e,"match case")]),B("label",null,[this.reField,Pe(e,"regexp")]),B("label",null,[this.wordField,Pe(e,"by word")]),...e.state.readOnly?[]:[B("br"),this.replaceField,i("replace",()=>ih(e),[Pe(e,"replace")]),i("replaceAll",()=>ZQ(e),[Pe(e,"replace all")])],B("button",{name:"close",onclick:()=>Tu(e),"aria-label":Pe(e,"close"),type:"button"},["×"])])}commit(){let e=new wu({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Ki.of(e)}))}keydown(e){Xp(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?yr:br)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),ih(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(Ki)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(wi).top}}function Pe(n,e){return n.state.phrase(e)}const Rn=30,zn=/[\s\.,:;?!]/;function ul(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),r=n.state.doc.lineAt(t).to,s=Math.max(i.from,e-Rn),o=Math.min(r,t+Rn),l=n.state.sliceDoc(s,o);if(s!=i.from){for(let a=0;al.length-Rn;a--)if(!zn.test(l[a-1])&&zn.test(l[a])){l=l.slice(0,a);break}}return v.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const MQ=v.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"}}),RQ=[kt,At.low(PQ),MQ];class Cu{constructor(e,t,i,r){this.state=e,this.pos=t,this.explicit=i,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=J(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),r=t.text.slice(i-t.from,this.pos-t.from),s=r.search(Xu(e,!1));return s<0?null:{from:i+s,to:this.pos,text:r.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function nh(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function zQ(n){let e=Object.create(null),t=Object.create(null);for(let{label:r}of n){e[r[0]]=!0;for(let s=1;stypeof r=="string"?{label:r}:r),[t,i]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:zQ(e);return r=>{let s=r.matchBefore(i);return s||r.explicit?{from:s?s.from:r.pos,options:e,validFor:t}:null}}function YQ(n,e){return t=>{for(let i=J(t.state).resolveInner(t.pos,-1);i;i=i.parent){if(n.indexOf(i.name)>-1)return null;if(i.type.isTop)break}return e(t)}}class rh{constructor(e,t,i,r){this.completion=e,this.source=t,this.match=i,this.score=r}}function Lt(n){return n.selection.main.from}function Xu(n,e){var t;let{source:i}=n,r=e&&i[0]!="^",s=i[i.length-1]!="$";return!r&&!s?n:new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const dl=St.define();function VQ(n,e,t,i){let{main:r}=n.selection,s=t-r.from,o=i-r.from;return{...n.changeByRange(l=>{if(l!=r&&t!=i&&n.sliceDoc(l.from+s,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+s,to:i==r.from?l.to:l.from+o,insert:a},range:S.cursor(l.from+s+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const sh=new WeakMap;function EQ(n){if(!Array.isArray(n))return n;let e=sh.get(n);return e||sh.set(n,e=Zu(n)),e}const xr=M.define(),Ji=M.define();class _Q{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(w=Xo(x))!=w.toLowerCase()?1:w!=w.toUpperCase()?2:0;(!b||k==1&&g||C==0&&k!=0)&&(t[f]==x||i[f]==x&&(u=!0)?o[f++]=b:o.length&&(Q=!1)),C=k,b+=et(x)}return f==a&&o[0]==0&&Q?this.result(-100+(u?-200:0),o,e):d==a&&O==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[O,m]):f==a?this.result(-100+(u?-200:0)+-700+(Q?0:-1100),o,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,i){let r=[],s=0;for(let o of t){let l=o+(this.astral?et(be(i,o)):1);s&&r[s-1]==o?r[s-1]=l:(r[s++]=o,r[s++]=l)}return this.ret(e-i.length,r)}}class DQ{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:qQ,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>oh(e(i),t(i)),optionClass:(e,t)=>i=>oh(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function oh(n,e){return n?e?n+" "+e:n:e}function qQ(n,e,t,i,r,s){let o=n.textDirection==G.RTL,l=o,a=!1,h="top",c,f,u=e.left-r.left,d=r.right-e.right,O=i.right-i.left,m=i.bottom-i.top;if(l&&u=m||b>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let g=(e.bottom-e.top)/s.offsetHeight,Q=(e.right-e.left)/s.offsetWidth;return{style:`${h}: ${c/g}px; max-width: ${f/Q}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}const Ol=M.define();function WQ(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,r,s){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;ha&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return at.position-i.position).map(t=>t.render)}function bs(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let r=Math.floor(e/t);return{from:r*t,to:(r+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class LQ{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:s,selected:o}=r.open,l=e.state.facet(re);this.optionContent=WQ(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=bs(s.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:Ol.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(re).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:Ji.of(null)})}),this.showOptions(s,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=r){let{options:s,selected:o,disabled:l}=i.open;(!r.open||r.open.options!=s)&&(this.range=bs(s.length,o,e.state.facet(re).maxRenderedOptions),this.showOptions(s,i.id)),this.updateSel(),l!=((t=r.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=bs(t.options.length,t.selected,this.view.state.facet(re).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:s}=r;if(!s)return;let o=typeof s=="string"?document.createTextNode(s):s(r);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,r)}).catch(l=>we(this.view.state,l,"completion info")):(this.addInfoPane(o,r),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:s}=e;i.appendChild(r),this.infoDestroy=s||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,r=this.range.from;i;i=i.nextSibling,r++)i.nodeName!="LI"||!i.id?r--:r==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&IQ(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),s=this.space;if(!s){let o=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(s.bottom,t.bottom)-10||r.bottom{o.target==r&&o.preventDefault()});let s=null;for(let o=i.from;oi.from||i.from==0))if(s=u,typeof h!="string"&&h.header)r.appendChild(h.header(h));else{let d=r.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=r.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&r.classList.add("cm-completionListIncompleteTop"),i.tonew LQ(t,n,e)}function IQ(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),r=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/r)}function lh(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function jQ(n,e){let t=[],i=null,r=null,s=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(re);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)s(new rh(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,O=o.filterStrict?new DQ(u):new _Q(u);for(let m of c.result.options)if(d=O.match(m.label)){let g=m.displayLabel?f?f(m,d.matched):[]:d.matched,Q=d.score+(m.boost||0);if(s(new rh(m,c.source,g,Q)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:b}=m.section;r||(r=Object.create(null)),r[b]=Math.max(Q,r[b]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,O)=>(d.rank==="dynamic"&&O.rank==="dynamic"?r[O.name]-r[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof O.rank=="number"?O.rank:1e9)||(d.nameu.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):lh(c.completion)>lh(a)&&(l[l.length-1]=c),a=c.completion}return l}class ti{constructor(e,t,i,r,s,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=r,this.selected=s,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ti(this.options,ah(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,r,s,o){if(r&&!o&&e.some(h=>h.isPending))return r.setDisabled();let l=jQ(e,t);if(!l.length)return r&&e.some(h=>h.isPending)?r.setDisabled():null;let a=t.facet(re).selectOnOpen?0:-1;if(r&&r.selected!=a&&r.selected!=-1){let h=r.options[r.selected].completion;for(let c=0;cc.hasResult()?Math.min(h,c.from):h,1e8),create:KQ,above:s.aboveCursor},r?r.timestamp:Date.now(),a,!1)}map(e){return new ti(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ti(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class wr{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new wr(FQ,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(re),s=(i.override||t.languageDataAt("autocomplete",Lt(t)).map(EQ)).map(a=>(this.active.find(c=>c.source==a)||new _e(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));s.length==this.active.length&&s.every((a,h)=>a==this.active[h])&&(s=this.active);let o=this.open,l=e.effects.some(a=>a.is(pl));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||s.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!GQ(s,this.active)||l?o=ti.build(s,t,this.id,o,i,l):o&&o.disabled&&!s.some(a=>a.isPending)&&(o=null),!o&&s.every(a=>!a.isPending)&&s.some(a=>a.hasResult())&&(s=s.map(a=>a.hasResult()?new _e(a.source,0):a));for(let a of e.effects)a.is(Ol)&&(o=o&&o.setSelected(a.value,this.id));return s==this.active&&o==this.open?this:new wr(s,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?NQ:UQ}}function GQ(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const FQ=[];function Au(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(dl);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class _e{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=Au(e,t),r=this;(i&8||i&16&&this.touches(e))&&(r=new _e(r.source,0)),i&4&&r.state==0&&(r=new _e(this.source,1)),r=r.updateFor(e,i);for(let s of e.effects)if(s.is(xr))r=new _e(r.source,1,s.value);else if(s.is(Ji))r=new _e(r.source,0);else if(s.is(pl))for(let o of s.value)o.source==r.source&&(r=o);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Lt(e.state))}}class ai extends _e{constructor(e,t,i,r,s,o){super(e,3,t),this.limit=i,this.result=r,this.from=s,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let s=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Lt(e.state);if(l>o||!r||t&2&&(Lt(e.startState)==this.from||lt.map(e))}}),ye=fe.define({create(){return wr.start()},update(n,e){return n.update(e)},provide:n=>[No.from(n,e=>e.tooltip),v.contentAttributes.from(n,e=>e.attrs)]});function ml(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(ye).active.find(r=>r.source==e.source);return i instanceof ai?(typeof t=="string"?n.dispatch({...VQ(n.state,t,i.from,i.to),annotations:dl.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const KQ=BQ(ye,ml);function Yn(n,e="option"){return t=>{let i=t.state.field(ye,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+r*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:Ol.of(l)}),!0}}const JQ=n=>{let e=n.state.field(ye,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(ye,!1)?(n.dispatch({effects:xr.of(!0)}),!0):!1,eS=n=>{let e=n.state.field(ye,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:Ji.of(null)}),!0)};class tS{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const iS=50,nS=1e3,rS=te.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(ye).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(ye),t=n.state.facet(re);if(!n.selectionSet&&!n.docChanged&&n.startState.field(ye)==e)return;let i=n.transactions.some(s=>{let o=Au(s,t);return o&8||(s.selection||s.docChanged)&&!(o&3)});for(let s=0;siS&&Date.now()-o.time>nS){for(let l of o.context.abortListeners)try{l()}catch(a){we(this.view.state,a)}o.context.abortListeners=null,this.running.splice(s--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(s=>s.effects.some(o=>o.is(xr)))&&(this.pendingStart=!0);let r=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(o=>o.active.source==s.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let s of n.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(ye);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(re).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Lt(e),i=new Cu(e,t,n.explicit,this.view),r=new tS(n,i);this.running.push(r),Promise.resolve(n.source(i)).then(s=>{r.context.aborted||(r.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:Ji.of(null)}),we(this.view.state,s)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(re).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(re),i=this.view.state.field(ye);for(let r=0;rl.source==s.active.source);if(o&&o.isPending)if(s.done==null){let l=new _e(s.active.source,0);for(let a of s.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:pl.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(ye,!1);if(e&&e.tooltip&&this.view.state.facet(re).closeOnBlur){let t=e.open&&df(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:Ji.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:xr.of(!1)}),20),this.composing=0}}}),sS=typeof navigator=="object"&&/Win/.test(navigator.platform),oS=At.highest(v.domEventHandlers({keydown(n,e){let t=e.state.field(ye,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(sS&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],r=t.active.find(o=>o.source==i.source),s=i.completion.commitCharacters||r.result.commitCharacters;return s&&s.indexOf(n.key)>-1&&ml(e,i),!1}})),Mu=v.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class lS{constructor(e,t,i,r){this.field=e,this.line=t,this.from=i,this.to=r}}class gl{constructor(e,t,i){this.field=e,this.from=t,this.to=i}map(e){let t=e.mapPos(this.from,-1,he.TrackDel),i=e.mapPos(this.to,1,he.TrackDel);return t==null||i==null?null:new gl(this.field,t,i)}}class Ql{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let i=[],r=[t],s=e.doc.lineAt(t),o=/^\s*/.exec(s.text)[0];for(let a of this.lines){if(i.length){let h=o,c=/^\t*/.exec(a)[0].length;for(let f=0;fnew gl(a.field,r[a.line]+a.from,r[a.line]+a.to));return{text:i,ranges:l}}static parse(e){let t=[],i=[],r=[],s;for(let o of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let l=s[1]?+s[1]:null,a=s[2]||s[3]||"",h=-1,c=a.replace(/\\[{}]/g,f=>f[1]);for(let f=0;f=h&&u.field++}for(let f of r)if(f.line==i.length&&f.from>s.index){let u=s[2]?3+(s[1]||"").length:2;f.from-=u,f.to-=u}r.push(new lS(h,i.length,s.index,s.index+c.length)),o=o.slice(0,s.index)+a+o.slice(s.index+s[0].length)}o=o.replace(/\\([{}])/g,(l,a,h)=>{for(let c of r)c.line==i.length&&c.from>h&&(c.from--,c.to--);return a}),i.push(o)}return new Ql(i,r)}}let aS=X.widget({widget:new class extends ht{toDOM(){let n=document.createElement("span");return n.className="cm-snippetFieldPosition",n}ignoreEvent(){return!1}}}),hS=X.mark({class:"cm-snippetField"});class ki{constructor(e,t){this.ranges=e,this.active=t,this.deco=X.set(e.map(i=>(i.from==i.to?aS:hS).range(i.from,i.to)),!0)}map(e){let t=[];for(let i of this.ranges){let r=i.map(e);if(!r)return null;t.push(r)}return new ki(t,this.active)}selectionInsideField(e){return e.ranges.every(t=>this.ranges.some(i=>i.field==this.active&&i.from<=t.from&&i.to>=t.to))}}const dn=M.define({map(n,e){return n&&n.map(e)}}),cS=M.define(),en=fe.define({create(){return null},update(n,e){for(let t of e.effects){if(t.is(dn))return t.value;if(t.is(cS)&&n)return new ki(n.ranges,t.value)}return n&&e.docChanged&&(n=n.map(e.changes)),n&&e.selection&&!n.selectionInsideField(e.selection)&&(n=null),n},provide:n=>v.decorations.from(n,e=>e?e.deco:X.none)});function Sl(n,e){return S.create(n.filter(t=>t.field==e).map(t=>S.range(t.from,t.to)))}function fS(n){let e=Ql.parse(n);return(t,i,r,s)=>{let{text:o,ranges:l}=e.instantiate(t.state,r),{main:a}=t.state.selection,h={changes:{from:r,to:s==a.from?a.to:s,insert:D.of(o)},scrollIntoView:!0,annotations:i?[dl.of(i),ie.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=Sl(l,0)),l.some(c=>c.field>0)){let c=new ki(l,0),f=h.effects=[dn.of(c)];t.state.field(en,!1)===void 0&&f.push(M.appendConfig.of([en,mS,gS,Mu]))}t.dispatch(t.state.update(h))}}function Ru(n){return({state:e,dispatch:t})=>{let i=e.field(en,!1);if(!i||n<0&&i.active==0)return!1;let r=i.active+n,s=n>0&&!i.ranges.some(o=>o.field==r+n);return t(e.update({selection:Sl(i.ranges,r),effects:dn.of(s?null:new ki(i.ranges,r)),scrollIntoView:!0})),!0}}const uS=({state:n,dispatch:e})=>n.field(en,!1)?(e(n.update({effects:dn.of(null)})),!0):!1,dS=Ru(1),OS=Ru(-1),pS=[{key:"Tab",run:dS,shift:OS},{key:"Escape",run:uS}],hh=T.define({combine(n){return n.length?n[0]:pS}}),mS=At.highest(Yr.compute([hh],n=>n.facet(hh)));function Se(n,e){return{...e,apply:fS(n)}}const gS=v.domEventHandlers({mousedown(n,e){let t=e.state.field(en,!1),i;if(!t||(i=e.posAtCoords({x:n.clientX,y:n.clientY}))==null)return!1;let r=t.ranges.find(s=>s.from<=i&&s.to>=i);return!r||r.field==t.active?!1:(e.dispatch({selection:Sl(t.ranges,r.field),effects:dn.of(t.ranges.some(s=>s.field>r.field)?new ki(t.ranges,r.field):null),scrollIntoView:!0}),!0)}}),tn={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},qt=M.define({map(n,e){let t=e.mapPos(n,-1,he.TrackAfter);return t??void 0}}),bl=new class extends $t{};bl.startSide=1;bl.endSide=-1;const zu=fe.define({create(){return V.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(qt)&&(n=n.update({add:[bl.range(t.value,t.value+1)]}));return n}});function QS(){return[bS,zu]}const xs="()[]{}<>«»»«[]{}";function Yu(n){for(let e=0;e{if((SS?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let r=n.state.selection.main;if(i.length>2||i.length==2&&et(be(i,0))==1||e!=r.from||t!=r.to)return!1;let s=wS(n.state,i);return s?(n.dispatch(s),!0):!1}),yS=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=Vu(n,n.selection.main.head).brackets||tn.brackets,r=null,s=n.changeByRange(o=>{if(o.empty){let l=kS(n.doc,o.head);for(let a of i)if(a==l&&Nr(n.doc,o.head)==Yu(be(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:S.cursor(o.head-a.length)}}return{range:r=o}});return r||e(n.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!r},xS=[{key:"Backspace",run:yS}];function wS(n,e){let t=Vu(n,n.selection.main.head),i=t.brackets||tn.brackets;for(let r of i){let s=Yu(be(r,0));if(e==r)return s==r?PS(n,r,i.indexOf(r+r+r)>-1,t):$S(n,r,s,t.before||tn.before);if(e==s&&Eu(n,n.selection.main.from))return vS(n,r,s)}return null}function Eu(n,e){let t=!1;return n.field(zu).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Nr(n,e){let t=n.sliceString(e,e+2);return t.slice(0,et(be(t,0)))}function kS(n,e){let t=n.sliceString(e-2,e);return et(be(t,0))==t.length?t:t.slice(1)}function $S(n,e,t,i){let r=null,s=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:qt.of(o.to+e.length),range:S.range(o.anchor+e.length,o.head+e.length)};let l=Nr(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:qt.of(o.head+e.length),range:S.cursor(o.head+e.length)}:{range:r=o}});return r?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function vS(n,e,t){let i=null,r=n.changeByRange(s=>s.empty&&Nr(n.doc,s.head)==t?{changes:{from:s.head,to:s.head+t.length,insert:t},range:S.cursor(s.head+t.length)}:i={range:s});return i?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function PS(n,e,t,i){let r=i.stringPrefixes||tn.stringPrefixes,s=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:qt.of(l.to+e.length),range:S.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Nr(n.doc,a),c;if(h==e){if(ch(n,a))return{changes:{insert:e+e,from:a},effects:qt.of(a+e.length),range:S.cursor(a+e.length)};if(Eu(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:S.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=fh(n,a-2*e.length,r))>-1&&ch(n,c))return{changes:{insert:e+e+e+e,from:a},effects:qt.of(a+e.length),range:S.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=F.Word&&fh(n,a,r)>-1&&!TS(n,a,e,r))return{changes:{insert:e+e,from:a},effects:qt.of(a+e.length),range:S.cursor(a+e.length)}}return{range:s=l}});return s?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function ch(n,e){let t=J(n).resolveInner(e+1);return t.parent&&t.from==e}function TS(n,e,t,i){let r=J(n).resolveInner(e,-1),s=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(r.from,Math.min(r.to,r.from+t.length+s)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=r.firstChild;for(;c&&c.from==r.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=r.to==e&&r.parent;if(!h)break;r=h}return!1}function fh(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=F.Word)return e;for(let r of t){let s=e-r.length;if(n.sliceDoc(s,e)==r&&i(n.sliceDoc(s-1,s))!=F.Word)return s}return-1}function CS(n={}){return[oS,ye,re.of(n),rS,ZS,Mu]}const _u=[{key:"Ctrl-Space",run:ys},{mac:"Alt-`",run:ys},{mac:"Alt-i",run:ys},{key:"Escape",run:eS},{key:"ArrowDown",run:Yn(!0)},{key:"ArrowUp",run:Yn(!1)},{key:"PageDown",run:Yn(!0,"page")},{key:"PageUp",run:Yn(!1,"page")},{key:"Enter",run:JQ}],ZS=At.highest(Yr.computeN([re],n=>n.facet(re).defaultKeymap?[_u]:[]));class uh{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Et{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let r=i.facet(nn).markerFilter;r&&(e=r(e,i));let s=e.slice().sort((d,O)=>d.from-O.from||d.to-O.to),o=new mt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let O=d==s.length?null:s[d];if(!O&&!l.length)break;let m,g;if(l.length)m=a,g=l.reduce((y,C)=>Math.min(y,C.to),O&&O.from>m?O.from:1e8);else{if(m=O.from,m>f)break;g=O.to,l.push(O),d++}for(;dy.from||y.to==m))l.push(y),d++,g=Math.min(y.to,g);else{g=Math.min(y.from,g);break}}g=Math.min(g,f);let Q=!1;if(l.some(y=>y.from==m&&(y.to==g||g==f))&&(Q=m==g,!Q&&g-m<10)){let y=m-(c+h.value.length);y>0&&(h.next(y),c=m);for(let C=m;;){if(C>=g){Q=!0;break}if(!h.lineBreak&&c+h.value.length>C)break;C=c+h.value.length,c+=h.value.length,h.next()}}let b=LS(l);if(Q)o.add(m,m,X.widget({widget:new _S(b),diagnostics:l.slice()}));else{let y=l.reduce((C,x)=>x.markClass?C+" "+x.markClass:C,"");o.add(m,g,X.mark({class:"cm-lintRange cm-lintRange-"+b+y,diagnostics:l.slice(),inclusiveEnd:l.some(C=>C.to>g)}))}if(a=g,a==f)break;for(let y=0;y{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new uh(r,s,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new uh(i.from,s,i.diagnostic)}}),i}function XS(n,e){let t=e.pos,i=e.end||t,r=n.state.facet(nn).hideOn(n,t,i);if(r!=null)return r;let s=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(Du))||n.changes.touchesRange(s.from,Math.max(s.to,i)))}function AS(n,e){return n.field(Xe,!1)?e:e.concat(M.appendConfig.of(BS))}const Du=M.define(),yl=M.define(),qu=M.define(),Xe=fe.define({create(){return new Et(X.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,r=n.panel;if(n.selected){let s=e.changes.mapPos(n.selected.from,1);i=Xt(t,n.selected.diagnostic,s)||Xt(t,null,s)}!t.size&&r&&e.state.facet(nn).autoPanel&&(r=null),n=new Et(t,r,i)}for(let t of e.effects)if(t.is(Du)){let i=e.state.facet(nn).autoPanel?t.value.length?rn.open:null:n.panel;n=Et.init(t.value,i,e.state)}else t.is(yl)?n=new Et(n.diagnostics,t.value?rn.open:null,n.selected):t.is(qu)&&(n=new Et(n.diagnostics,n.panel,t.value));return n},provide:n=>[Ni.from(n,e=>e.panel),v.decorations.from(n,e=>e.diagnostics)]}),MS=X.mark({class:"cm-lintRange cm-lintRange-active"});function RS(n,e,t){let{diagnostics:i}=n.state.field(Xe),r,s=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(eLu(n,t,!1)))}const YS=n=>{let e=n.state.field(Xe,!1);(!e||!e.panel)&&n.dispatch({effects:AS(n.state,[yl.of(!0)])});let t=Uo(n,rn.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},dh=n=>{let e=n.state.field(Xe,!1);return!e||!e.panel?!1:(n.dispatch({effects:yl.of(!1)}),!0)},VS=n=>{let e=n.state.field(Xe,!1);if(!e)return!1;let t=n.state.selection.main,i=Xt(e.diagnostics,null,t.to+1);return!i&&(i=Xt(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},ES=[{key:"Mod-Shift-m",run:YS,preventDefault:!0},{key:"F8",run:VS}],nn=T.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...at(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Oh,tooltipFilter:Oh,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,r,s)=>e(i,r,s)||t(i,r,s):e:t,autoPanel:(e,t)=>e||t})}}});function Oh(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function Wu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;is.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function Lu(n,e,t){var i;let r=t?Wu(e.actions):[];return B("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},B("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((s,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let O=Xt(n.state.field(Xe).diagnostics,e);O&&s.apply(n,O.from,O.to)},{name:h}=s,c=r[o]?h.indexOf(r[o]):-1,f=c<0?h:[h.slice(0,c),B("u",h.slice(c,c+1)),h.slice(c+1)],u=s.markClass?" "+s.markClass:"";return B("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${r[o]})"`}.`},f)}),e.source&&B("div",{class:"cm-diagnosticSource"},e.source))}class _S extends ht{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return B("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class ph{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Lu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class rn{constructor(e){this.view=e,this.items=[];let t=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)dh(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:s}=this.items[this.selectedIndex],o=Wu(s.actions);for(let l=0;l{for(let s=0;sdh(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Xe).selected;if(!e)return-1;for(let t=0;t{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;di&&(this.items.splice(i,f-i),r=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),s=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i({sel:s.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.topa.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Xe),i=Xt(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:qu.of(i)})}static open(e){return new rn(e)}}function DS(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Vn(n){return DS(``,'width="6" height="3"')}const qS=v.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:Vn("#d11")},".cm-lintRange-warning":{backgroundImage:Vn("orange")},".cm-lintRange-info":{backgroundImage:Vn("#999")},".cm-lintRange-hint":{backgroundImage:Vn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function WS(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function LS(n){let e="hint",t=1;for(let i of n){let r=WS(i.severity);r>t&&(t=r,e=i.severity)}return e}const BS=[Xe,v.decorations.compute([Xe],n=>{let{selected:e,panel:t}=n.field(Xe);return!e||!t||e.from==e.to?X.none:X.set([MS.range(e.from,e.to)])}),gm(RS,{hideOn:XS}),qS],IS=[Zm(),Mm(),Np(),Jg(),Pg(),Vp(),Wp(),_.allowMultipleSelections.of(!0),Og(),Df(Xg,{fallback:!0}),Eg(),QS(),CS(),om(),hm(),em(),cQ(),Yr.of([...xS,...sQ,...XQ,...c0,...wg,..._u,...ES])];var mh={};class kr{constructor(e,t,i,r,s,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=r,this.pos=s,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let r=e.parser.context;return new kr(e,[],t,i,i,0,[],0,r?new gh(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,r=e&65535,{parser:s}=this.p,o=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizea;)this.stack.pop();this.reduceContext(r,h)}storeNode(e,t,i,r=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==i)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=i;return}}}if(!s||this.pos==i)this.buffer.push(e,t,i,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)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,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=r}}shift(e,t,i,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:o}=this.p;this.pos=r;let l=o.stateFlag(s,1);!l&&(r>i||t<=o.maxNode)&&(this.reducePos=r),this.pushState(s,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,r,4)}else this.pos=r,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,r,4)}apply(e,t,i,r){e&65536?this.reduce(e):this.shift(e,t,i,r)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new kr(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new jS(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let s=0,o;sa&1&&l==o)||r.push(t[s],o)}t=r}let i=[];for(let r=0;r>19,r=t&65535,s=this.stack.length-i*3;if(s<0||e.getGoto(this.stack[s],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(r,s)=>{if(!t.includes(r))return t.push(r),e.allActions(r,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&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,s+1);if(l!=null)return l}})};return i(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:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class gh{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class jS{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class $r{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new $r(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new $r(this.stack,this.pos,this.index)}}function zi(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,r=0;i=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),s+=a,l)break;s*=46}t?t[r++]=s:t=new e(s)}return t}class Gn{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Qh=new Gn;class GS{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Qh,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,r=this.rangeIndex,s=this.pos+e;for(;si.to:s>=i.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];s+=o.from-i.to,i=o}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,r;if(t>=0&&t=this.chunk2Pos&&il.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Qh,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(i+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return i}}class hi{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;Bu(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}hi.prototype.contextual=hi.prototype.fallback=hi.prototype.extend=!1;class vr{constructor(e,t,i){this.precTable=t,this.elseToken=i,this.data=typeof e=="string"?zi(e):e}token(e,t){let i=e.pos,r=0;for(;;){let s=e.next<0,o=e.resolveOffset(1,1);if(Bu(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||r++,o==null)break;e.reset(o,e.token)}r&&(e.reset(i,e.token),e.acceptToken(this.elseToken,r))}}vr.prototype.contextual=hi.prototype.fallback=hi.prototype.extend=!1;class Ae{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Bu(n,e,t,i,r,s){let o=0,l=1<0){let O=n[d];if(a.allows(O)&&(e.token.value==-1||e.token.value==O||NS(O,e.token.value,r,s))){e.acceptToken(O);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f>1,O=h+d+(d<<1),m=n[O],g=n[O+1]||65536;if(c=g)f=d+1;else{o=n[O+2],e.advance();continue e}}break}}function Sh(n,e,t){for(let i=e,r;(r=n[i])!=65535;i++)if(r==t)return i-e;return-1}function NS(n,e,t,i){let r=Sh(t,i,e);return r<0||Sh(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class US{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?bh(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?bh(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(s instanceof H){if(o==e){if(o=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+s.length}}}class FS{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Gn)}getActions(e){let t=0,i=null,{parser:r}=e.p,{tokenizers:s}=r,o=r.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;hf.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new Gn,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Gn,{pos:i,p:r}=e;return t.start=i,t.end=Math.min(i+1,r.stream.end),t.value=i==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,i){let r=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(r,e),i),e.value>-1){let{parser:s}=i.p;for(let o=0;o=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,i,r){for(let s=0;se.bufferLength*4?new US(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],r,s;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;ot)i.push(l);else{if(this.advanceStack(l,i,e))continue;{r||(r=[],s=[]),r.push(l);let a=this.tokens.getMainToken(l);s.push(a.value,a.end)}}break}}if(!i.length){let o=r&&JS(r);if(o)return Te&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Te&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,s,i);if(o)return Te&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(r);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?s.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(z.contextHash)||0)==c))return e.useNode(f,u),Te&&console.log(o+this.stackID(e)+` (via reuse of ${s.getName(f.type.id)})`),!0;if(!(f instanceof H)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof H&&f.positions[0]==0)f=d;else break}}let l=s.stateSlot(e.state,4);if(l>0)return e.reduce(l),Te&&console.log(o+this.stackID(e)+` (via always-reduce ${s.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;hr?t.push(O):i.push(O)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return yh(e,t),!0}}runRecovery(e,t,i){let r=null,s=!1;for(let o=0;o ":"";if(l.deadEnd&&(s||(s=!0,l.restart(),Te&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),u=c;for(let d=0;d<10&&f.forceReduce()&&(Te&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));d++)Te&&(u=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))Te&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Te&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),yh(l,i)):(!r||r.scoren;class Iu{constructor(e){this.start=e.start,this.shift=e.shift||ks,this.reduce=e.reduce||ks,this.reuse=e.reuse||ks,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Qi extends kf{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;le.topRules[l][1]),r=[];for(let l=0;l=0)s(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)s(l[h++],a,f);h++}}}this.nodeSet=new Fo(t.map((l,a)=>Qe.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:r[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Sf;let o=zi(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new hi(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let r=new HS(this,e,t,i);for(let s of this.wrappers)r=s(r,e,t,i);return r}getGoto(e,t,i=!1){let r=this.goto;if(t>=r[0])return-1;for(let s=r[t+1];;){let o=r[s++],l=o&1,a=r[s++];if(l&&i)return a;for(let h=s+(o>>1);s0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),r=i?t(i):void 0;for(let s=this.stateSlot(e,1);r==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=ut(this.data,s+2);else break;r=t(ut(this.data,s+1))}return r}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ut(this.data,i+2);else break;if((this.data[i+2]&1)==0){let r=this.data[i+1];t.some((s,o)=>o&1&&s==r)||t.push(this.data[i],r)}}return t}configure(e){let t=Object.assign(Object.create(Qi.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let r=e.tokenizers.find(s=>s.from==i);return r?r.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,r)=>{let s=e.specializers.find(l=>l.from==i.external);if(!s)return i;let o=Object.assign(Object.assign({},i),{external:s.to});return t.specializers[r]=xh(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let s of e.split(" ")){let o=t.indexOf(s);o>=0&&(i[o]=!0)}let r=null;for(let s=0;si)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const eb=55,tb=1,ib=56,nb=2,rb=57,sb=3,wh=4,ob=5,xl=6,ju=7,Gu=8,Nu=9,Uu=10,lb=11,ab=12,hb=13,$s=58,cb=14,fb=15,kh=59,Fu=21,ub=23,Hu=24,db=25,vo=27,Ku=28,Ob=29,pb=32,mb=35,gb=37,Qb=38,Sb=0,bb=1,yb={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},xb={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},$h={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function wb(n){return n==45||n==46||n==58||n>=65&&n<=90||n==95||n>=97&&n<=122||n>=161}let vh=null,Ph=null,Th=0;function Po(n,e){let t=n.pos+e;if(Th==t&&Ph==n)return vh;let i=n.peek(e),r="";for(;wb(i);)r+=String.fromCharCode(i),i=n.peek(++e);return Ph=n,Th=t,vh=r?r.toLowerCase():i==kb||i==$b?void 0:null}const Ju=60,Pr=62,wl=47,kb=63,$b=33,vb=45;function Ch(n,e){this.name=n,this.parent=e}const Pb=[xl,Uu,ju,Gu,Nu],Tb=new Iu({start:null,shift(n,e,t,i){return Pb.indexOf(e)>-1?new Ch(Po(i,1)||"",n):n},reduce(n,e){return e==Fu&&n?n.parent:n},reuse(n,e,t,i){let r=e.type.id;return r==xl||r==gb?new Ch(Po(i,1)||"",n):n},strict:!1}),Cb=new Ae((n,e)=>{if(n.next!=Ju){n.next<0&&e.context&&n.acceptToken($s);return}n.advance();let t=n.next==wl;t&&n.advance();let i=Po(n,0);if(i===void 0)return;if(!i)return n.acceptToken(t?fb:cb);let r=e.context?e.context.name:null;if(t){if(i==r)return n.acceptToken(lb);if(r&&xb[r])return n.acceptToken($s,-2);if(e.dialectEnabled(Sb))return n.acceptToken(ab);for(let s=e.context;s;s=s.parent)if(s.name==i)return;n.acceptToken(hb)}else{if(i=="script")return n.acceptToken(ju);if(i=="style")return n.acceptToken(Gu);if(i=="textarea")return n.acceptToken(Nu);if(yb.hasOwnProperty(i))return n.acceptToken(Uu);r&&$h[r]&&$h[r][i]?n.acceptToken($s,-1):n.acceptToken(xl)}},{contextual:!0}),Zb=new Ae(n=>{for(let e=0,t=0;;t++){if(n.next<0){t&&n.acceptToken(kh);break}if(n.next==vb)e++;else if(n.next==Pr&&e>=2){t>=3&&n.acceptToken(kh,-2);break}else e=0;n.advance()}});function Xb(n){for(;n;n=n.parent)if(n.name=="svg"||n.name=="math")return!0;return!1}const Ab=new Ae((n,e)=>{if(n.next==wl&&n.peek(1)==Pr){let t=e.dialectEnabled(bb)||Xb(e.context);n.acceptToken(t?ob:wh,2)}else n.next==Pr&&n.acceptToken(wh,1)});function kl(n,e,t){let i=2+n.length;return new Ae(r=>{for(let s=0,o=0,l=0;;l++){if(r.next<0){l&&r.acceptToken(e);break}if(s==0&&r.next==Ju||s==1&&r.next==wl||s>=2&&so?r.acceptToken(e,-o):r.acceptToken(t,-(o-2));break}else if((r.next==10||r.next==13)&&l){r.acceptToken(e,1);break}else s=o=0;r.advance()}})}const Mb=kl("script",eb,tb),Rb=kl("style",ib,nb),zb=kl("textarea",rb,sb),Yb=Er({"Text RawText IncompleteTag IncompleteCloseTag":p.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":p.angleBracket,TagName:p.tagName,"MismatchedCloseTag/TagName":[p.tagName,p.invalid],AttributeName:p.attributeName,"AttributeValue UnquotedAttributeValue":p.attributeValue,Is:p.definitionOperator,"EntityReference CharacterReference":p.character,Comment:p.blockComment,ProcessingInst:p.processingInstruction,DoctypeDecl:p.documentMeta}),Vb=Qi.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!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c~O!_OS~OUSOVPOWQOXROYTO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O|_O!eZO~OgaO~OgbO~OgcO~OgdO~OgeO~O!XfOPmP![mP~O!YiOQpP![pP~O!ZlORsP![sP~OUSOVPOWQOXROYTOZqO[]O][O^^O_^Oa^Ob^Oc^Od^Oy^O!eZO~O![rO~P#gO!]sO!fuO~OgvO~OgwO~OS|OT}OiyO~OS!POT}OiyO~OS!ROT}OiyO~OS!TOT}OiyO~OS}OT}OiyO~O!XfOPmX![mX~OP!WO![!XO~O!YiOQpX![pX~OQ!ZO![!XO~O!ZlORsX![sX~OR!]O![!XO~O![!XO~P#gOg!_O~O!]sO!f!aO~OS!bO~OS!cO~Oj!dOShXThXihX~OS!fOT!gOiyO~OS!hOT!gOiyO~OS!iOT!gOiyO~OS!jOT!gOiyO~OS!gOT!gOiyO~Og!kO~Og!lO~Og!mO~OS!nO~Ol!qO!a!oO!c!pO~OS!rO~OS!sO~OS!tO~Ob!uOc!uOd!uO!a!wO!b!uO~Ob!xOc!xOd!xO!c!wO!d!xO~Ob!uOc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~",goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:Tb,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[Yb],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P^p+Pqr/^sw/^x!P/^!P!Q+P!Q!^/^!a#S/^#S#T0m#T#s/^#s$f+P$f;'S/^;'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,i);if(h==mb)return vs(l,a,r);if(h==Fu&&s.length){let c=l.node,f=c.firstChild,u=f&&Zh(f,a),d;if(u){for(let O of s)if(O.tag==u&&(!O.attrs||O.attrs(d||(d=ed(f,a))))){let m=c.lastChild,g=m.type.id==Qb?m.from:c.to;if(g>f.to)return{parser:O.parser,overlay:[{from:f.to,to:g}]}}}}if(o&&h==Hu){let c=l.node,f;if(f=c.firstChild){let u=o[a.read(f.from,f.to)];if(u)for(let d of u){if(d.tagName&&d.tagName!=Zh(c.parent,a))continue;let O=c.lastChild;if(O.type.id==vo){let m=O.from+1,g=O.lastChild,Q=O.to-(g&&g.isError?0:1);if(Q>m)return{parser:d.parser,overlay:[{from:m,to:Q}],bracketed:!0}}else if(O.type.id==Ku)return{parser:d.parser,overlay:[{from:O.from,to:O.to}]}}}}return null})}const Eb=122,Xh=1,_b=123,Db=124,id=2,qb=125,Wb=3,Lb=4,nd=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Bb=58,Ib=40,rd=95,jb=91,Nn=45,Gb=46,Nb=35,Ub=37,Fb=38,Hb=92,Kb=10,Jb=42;function sn(n){return n>=65&&n<=90||n>=97&&n<=122||n>=161}function $l(n){return n>=48&&n<=57}function Ah(n){return $l(n)||n>=97&&n<=102||n>=65&&n<=70}const sd=(n,e,t)=>(i,r)=>{for(let s=!1,o=0,l=0;;l++){let{next:a}=i;if(sn(a)||a==Nn||a==rd||s&&$l(a))!s&&(a!=Nn||l>0)&&(s=!0),o===l&&a==Nn&&o++,i.advance();else if(a==Hb&&i.peek(1)!=Kb){if(i.advance(),Ah(i.next)){do i.advance();while(Ah(i.next));i.next==32&&i.advance()}else i.next>-1&&i.advance();s=!0}else{s&&i.acceptToken(o==2&&r.canShift(id)?e:a==Ib?t:n);break}}},e1=new Ae(sd(_b,id,Db)),t1=new Ae(sd(qb,Wb,Lb)),i1=new Ae(n=>{if(nd.includes(n.peek(-1))){let{next:e}=n;(sn(e)||e==rd||e==Nb||e==Gb||e==Jb||e==jb||e==Bb&&sn(n.peek(1))||e==Nn||e==Fb)&&n.acceptToken(Eb)}}),n1=new Ae(n=>{if(!nd.includes(n.peek(-1))){let{next:e}=n;if(e==Ub&&(n.advance(),n.acceptToken(Xh)),sn(e)){do n.advance();while(sn(n.next)||$l(n.next));n.acceptToken(Xh)}}}),r1=Er({"AtKeyword import charset namespace keyframes media supports":p.definitionKeyword,"from to selector":p.keyword,NamespaceName:p.namespace,KeyframeName:p.labelName,KeyframeRangeName:p.operatorKeyword,TagName:p.tagName,ClassName:p.className,PseudoClassName:p.constant(p.className),IdName:p.labelName,"FeatureName PropertyName":p.propertyName,AttributeName:p.attributeName,NumberLiteral:p.number,KeywordQuery:p.keyword,UnaryQueryOp:p.operatorKeyword,"CallTag ValueName":p.atom,VariableName:p.variableName,Callee:p.operatorKeyword,Unit:p.unit,"UniversalSelector NestingSelector":p.definitionOperator,"MatchOp CompareOp":p.compareOperator,"ChildOp SiblingOp, LogicOp":p.logicOperator,BinOp:p.arithmeticOperator,Important:p.modifier,Comment:p.blockComment,ColorLiteral:p.color,"ParenthesizedContent StringLiteral":p.string,":":p.punctuation,"PseudoOp #":p.derefOperator,"; ,":p.separator,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace}),s1={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},o1={__proto__:null,or:98,and:98,not:106,only:106,layer:170},l1={__proto__:null,selector:112,layer:166},a1={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},h1={__proto__:null,to:207},c1=Qi.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#D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replace(/[A-Z]/g,r=>"-"+r.toLowerCase())),t.has(i)||(e.push(i),t.add(i)));Ps=e.sort().map(i=>({type:"property",label:i,apply:i+": "}))}return Ps||[]}const Mh=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(n=>({type:"class",label:n})),Rh=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(n=>({type:"keyword",label:n})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(n=>({type:"constant",label:n}))),f1=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(n=>({type:"type",label:n})),u1=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(n=>({type:"keyword",label:n})),ft=/^(\w[\w-]*|-\w[\w-]*|)$/,d1=/^-(-[\w-]*)?$/;function O1(n,e){var t;if((n.name=="("||n.type.isError)&&(n=n.parent||n),n.name!="ArgList")return!1;let i=(t=n.parent)===null||t===void 0?void 0:t.firstChild;return i?.name!="Callee"?!1:e.sliceString(i.from,i.to)=="var"}const zh=new wf,p1=["Declaration"];function m1(n){for(let e=n;;){if(e.type.isTop)return e;if(!(e=e.parent))return n}}function od(n,e,t){if(e.to-e.from>4096){let i=zh.get(e);if(i)return i;let r=[],s=new Set,o=e.cursor(W.IncludeAnonymous);if(o.firstChild())do for(let l of od(n,o.node,t))s.has(l.label)||(s.add(l.label),r.push(l));while(o.nextSibling());return zh.set(e,r),r}else{let i=[],r=new Set;return e.cursor().iterate(s=>{var o;if(t(s)&&s.matchContext(p1)&&((o=s.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let l=n.sliceString(s.from,s.to);r.has(l)||(r.add(l),i.push({label:l,type:"variable"}))}}),i}}const g1=n=>e=>{let{state:t,pos:i}=e,r=J(t).resolveInner(i,-1),s=r.type.isError&&r.from==r.to-1&&t.doc.sliceString(r.from,r.to)=="-";if(r.name=="PropertyName"||(s||r.name=="TagName")&&/^(Block|Styles)$/.test(r.resolve(r.to).name))return{from:r.from,options:Ts(),validFor:ft};if(r.name=="ValueName")return{from:r.from,options:Rh,validFor:ft};if(r.name=="PseudoClassName")return{from:r.from,options:Mh,validFor:ft};if(n(r)||(e.explicit||s)&&O1(r,t.doc))return{from:n(r)||s?r.from:i,options:od(t.doc,m1(r),n),validFor:d1};if(r.name=="TagName"){for(let{parent:a}=r;a;a=a.parent)if(a.name=="Block")return{from:r.from,options:Ts(),validFor:ft};return{from:r.from,options:f1,validFor:ft}}if(r.name=="AtKeyword")return{from:r.from,options:u1,validFor:ft};if(!e.explicit)return null;let o=r.resolve(i),l=o.childBefore(i);return l&&l.name==":"&&o.name=="PseudoClassSelector"?{from:i,options:Mh,validFor:ft}:l&&l.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:i,options:Rh,validFor:ft}:o.name=="Block"||o.name=="Styles"?{from:i,options:Ts(),validFor:ft}:null},Q1=g1(n=>n.name=="VariableName"),Tr=pi.define({name:"css",parser:c1.configure({props:[qr.add({Declaration:jn()}),Wr.add({"Block KeyframeList":Xf})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function S1(){return new tl(Tr,Tr.data.of({autocomplete:Q1}))}const b1=316,y1=317,Yh=1,x1=2,w1=3,k1=4,$1=318,v1=320,P1=321,T1=5,C1=6,Z1=0,To=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],ld=125,X1=59,Co=47,A1=42,M1=43,R1=45,z1=60,Y1=44,V1=63,E1=46,_1=91,D1=new Iu({start:!1,shift(n,e){return e==T1||e==C1||e==v1?n:e==P1},strict:!1}),q1=new Ae((n,e)=>{let{next:t}=n;(t==ld||t==-1||e.context)&&n.acceptToken($1)},{contextual:!0,fallback:!0}),W1=new Ae((n,e)=>{let{next:t}=n,i;To.indexOf(t)>-1||t==Co&&((i=n.peek(1))==Co||i==A1)||t!=ld&&t!=X1&&t!=-1&&!e.context&&n.acceptToken(b1)},{contextual:!0}),L1=new Ae((n,e)=>{n.next==_1&&!e.context&&n.acceptToken(y1)},{contextual:!0}),B1=new Ae((n,e)=>{let{next:t}=n;if(t==M1||t==R1){if(n.advance(),t==n.next){n.advance();let i=!e.context&&e.canShift(Yh);n.acceptToken(i?Yh:x1)}}else t==V1&&n.peek(1)==E1&&(n.advance(),n.advance(),(n.next<48||n.next>57)&&n.acceptToken(w1))},{contextual:!0});function Cs(n,e){return n>=65&&n<=90||n>=97&&n<=122||n==95||n>=192||!e&&n>=48&&n<=57}const I1=new Ae((n,e)=>{if(n.next!=z1||!e.dialectEnabled(Z1)||(n.advance(),n.next==Co))return;let t=0;for(;To.indexOf(n.next)>-1;)n.advance(),t++;if(Cs(n.next,!0)){for(n.advance(),t++;Cs(n.next,!1);)n.advance(),t++;for(;To.indexOf(n.next)>-1;)n.advance(),t++;if(n.next==Y1)return;for(let i=0;;i++){if(i==7){if(!Cs(n.next,!0))return;break}if(n.next!="extends".charCodeAt(i))break;n.advance(),t++}}n.acceptToken(k1,-t)}),j1=Er({"get set async static":p.modifier,"for while do if else switch try catch finally return throw break continue default case defer":p.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":p.operatorKeyword,"let var const using function class extends":p.definitionKeyword,"import export from":p.moduleKeyword,"with debugger new":p.keyword,TemplateString:p.special(p.string),super:p.atom,BooleanLiteral:p.bool,this:p.self,null:p.null,Star:p.modifier,VariableName:p.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":p.function(p.variableName),VariableDefinition:p.definition(p.variableName),Label:p.labelName,PropertyName:p.propertyName,PrivatePropertyName:p.special(p.propertyName),"CallExpression/MemberExpression/PropertyName":p.function(p.propertyName),"FunctionDeclaration/VariableDefinition":p.function(p.definition(p.variableName)),"ClassDeclaration/VariableDefinition":p.definition(p.className),"NewExpression/VariableName":p.className,PropertyDefinition:p.definition(p.propertyName),PrivatePropertyDefinition:p.definition(p.special(p.propertyName)),UpdateOp:p.updateOperator,"LineComment Hashbang":p.lineComment,BlockComment:p.blockComment,Number:p.number,String:p.string,Escape:p.escape,ArithOp:p.arithmeticOperator,LogicOp:p.logicOperator,BitOp:p.bitwiseOperator,CompareOp:p.compareOperator,RegExp:p.regexp,Equals:p.definitionOperator,Arrow:p.function(p.punctuation),": Spread":p.punctuation,"( )":p.paren,"[ ]":p.squareBracket,"{ }":p.brace,"InterpolationStart InterpolationEnd":p.special(p.brace),".":p.derefOperator,", ;":p.separator,"@":p.meta,TypeName:p.typeName,TypeDefinition:p.definition(p.typeName),"type enum interface implements namespace module declare":p.definitionKeyword,"abstract global Privacy readonly override":p.modifier,"is keyof unique infer asserts":p.operatorKeyword,JSXAttributeValue:p.attributeValue,JSXText:p.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":p.angleBracket,"JSXIdentifier JSXNameSpacedName":p.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":p.attributeName,"JSXBuiltin/JSXIdentifier":p.standard(p.tagName)}),G1={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},N1={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},U1={__proto__:null,"<":193},F1=Qi.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOO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Definition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:380,context:D1,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,"Expression",-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",160,"JSXStartCloseTag"],["closedBy",-2,24,168,">",40,"InterpolationEnd",50,"]",61,"}",74,")",165,"JSXEndTag"]],propSources:[j1],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$i&j(Wp(Z!bOY%Z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new vr("j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~",25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:n=>G1[n]||-1},{term:343,get:n=>N1[n]||-1},{term:95,get:n=>U1[n]||-1}],tokenPrec:15201}),ad=[Se("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),Se("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),Se("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),Se("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),Se("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),Se(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:"try",detail:"/ catch block",type:"keyword"}),Se("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),Se(`if (\${}) { + \${} +} else { + \${} +}`,{label:"if",detail:"/ else block",type:"keyword"}),Se(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:"class",detail:"definition",type:"keyword"}),Se('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),Se('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],H1=ad.concat([Se("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),Se("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),Se("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Vh=new wf,hd=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Zi(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}const K1=["FunctionDeclaration"],J1={FunctionDeclaration:Zi("function"),ClassDeclaration:Zi("class"),ClassExpression:()=>!0,EnumDeclaration:Zi("constant"),TypeAliasDeclaration:Zi("type"),NamespaceDeclaration:Zi("namespace"),VariableDefinition(n,e){n.matchContext(K1)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function cd(n,e){let t=Vh.get(e);if(t)return t;let i=[],r=!0;function s(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(W.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=J1[o.name];if(l&&l(o,s)||hd.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of cd(n,o.node))i.push(l);return!1}}),Vh.set(e,i),i}const Eh=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,fd=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function ey(n){let e=J(n.state).resolveInner(n.pos,-1);if(fd.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&Eh.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let r=e;r;r=r.parent)hd.has(r.name)&&(i=i.concat(cd(n.state.doc,r)));return{options:i,from:t?e.from:n.pos,validFor:Eh}}const lt=pi.define({name:"javascript",parser:F1.configure({props:[qr.add({IfStatement:jn({except:/^\s*({|else\b)/}),TryStatement:jn({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ug,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:fg({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":jn({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),Wr.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Xf,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,i=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?n.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),ud={test:n=>/^JSX/.test(n.name),facet:Pf({commentTokens:{block:{open:"{/*",close:"*/}"}}})},dd=lt.configure({dialect:"ts"},"typescript"),Od=lt.configure({dialect:"jsx",props:[el.add(n=>n.isTop?[ud]:void 0)]}),pd=lt.configure({dialect:"jsx ts",props:[el.add(n=>n.isTop?[ud]:void 0)]},"typescript");let md=n=>({label:n,type:"keyword"});const gd="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(md),ty=gd.concat(["declare","implements","private","protected","public"].map(md));function iy(n={}){let e=n.jsx?n.typescript?pd:Od:n.typescript?dd:lt,t=n.typescript?H1.concat(ty):ad.concat(gd);return new tl(e,[lt.data.of({autocomplete:YQ(fd,Zu(t))}),lt.data.of({autocomplete:ey}),n.jsx?sy:[]])}function ny(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function _h(n,e,t=n.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}const ry=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),sy=v.inputHandler.of((n,e,t,i,r)=>{if((ry?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!lt.isActiveAt(n.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:c}=a,f=J(o).resolveInner(c-1,-1),u;if(f.name=="JSXStartTag"&&(f=f.parent),!(o.doc.sliceString(c-1,c)!=i||f.name=="JSXAttributeValue"&&f.to>c)){if(i==">"&&f.name=="JSXFragmentTag")return{range:a,changes:{from:c,insert:""}};if(i=="/"&&f.name=="JSXStartCloseTag"){let d=f.parent,O=d.parent;if(O&&d.from==c-2&&((u=_h(o.doc,O.firstChild,c))||((h=O.firstChild)===null||h===void 0?void 0:h.name)=="JSXFragmentTag")){let m=`${u}>`;return{range:S.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(i==">"){let d=ny(f);if(d&&d.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(c,c+2))&&(u=_h(o.doc,d,c)))return{range:a,changes:{from:c,insert:``}}}}return{range:a}});return l.changes.empty?!1:(n.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Xi=["_blank","_self","_top","_parent"],Zs=["ascii","utf-8","utf-16","latin1","latin1"],Xs=["get","post","put","delete"],As=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Ce=["true","false"],Z={},oy={a:{attrs:{href:null,ping:null,type:null,media:null,target:Xi,hreflang:null}},abbr:Z,address:Z,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Z,aside:Z,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Z,base:{attrs:{href:null,target:Xi}},bdi:Z,bdo:Z,blockquote:{attrs:{cite:null}},body:Z,br:Z,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:As,formmethod:Xs,formnovalidate:["novalidate"],formtarget:Xi,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Z,center:Z,cite:Z,code:Z,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:Z,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Z,div:Z,dl:Z,dt:Z,em:Z,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Z,figure:Z,footer:Z,form:{attrs:{action:null,name:null,"accept-charset":Zs,autocomplete:["on","off"],enctype:As,method:Xs,novalidate:["novalidate"],target:Xi}},h1:Z,h2:Z,h3:Z,h4:Z,h5:Z,h6:Z,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Z,hgroup:Z,hr:Z,html:{attrs:{manifest:null}},i:Z,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:As,formmethod:Xs,formnovalidate:["novalidate"],formtarget:Xi,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:Z,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Z,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:Z,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Zs,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:Z,noscript:Z,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:Z,param:{attrs:{name:null,value:null}},pre:Z,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Z,rt:Z,ruby:Z,samp:Z,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Zs}},section:Z,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Z,source:{attrs:{src:null,type:null,media:null}},span:Z,strong:Z,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Z,summary:Z,sup:Z,table:Z,tbody:Z,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Z,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:Z,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Z,time:{attrs:{datetime:null}},title:Z,tr:Z,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Z,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:Z},Qd={accesskey:null,class:null,contenteditable:Ce,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Ce,autocorrect:Ce,autocapitalize:Ce,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Ce,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Ce,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Ce,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Ce,"aria-hidden":Ce,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Ce,"aria-multiselectable":Ce,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Ce,"aria-relevant":null,"aria-required":Ce,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Sd="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(n=>"on"+n);for(let n of Sd)Qd[n]=null;class Cr{constructor(e,t){this.tags={...oy,...e},this.globalAttrs={...Qd,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}Cr.default=new Cr;function Si(n,e,t=n.length){if(!e)return"";let i=e.firstChild,r=i&&i.getChild("TagName");return r?n.sliceString(r.from,Math.min(r.to,t)):""}function bi(n,e=!1){for(;n;n=n.parent)if(n.name=="Element")if(e)e=!1;else return n;return null}function bd(n,e,t){let i=t.tags[Si(n,bi(e))];return i?.children||t.allTags}function vl(n,e){let t=[];for(let i=bi(e);i&&!i.type.isTop;i=bi(i.parent)){let r=Si(n,i);if(r&&i.lastChild.name=="CloseTag")break;r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=i.firstChild.to)&&t.push(r)}return t}const yd=/^[:\-\.\w\u00b7-\uffff]*$/;function Dh(n,e,t,i,r){let s=/\s*>/.test(n.sliceDoc(r,r+5))?"":">",o=bi(t,t.name=="StartTag"||t.name=="TagName");return{from:i,to:r,options:bd(n.doc,o,e).map(l=>({label:l,type:"type"})).concat(vl(n.doc,t).map((l,a)=>({label:"/"+l,apply:"/"+l+s,type:"type",boost:99-a}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qh(n,e,t,i){let r=/\s*>/.test(n.sliceDoc(i,i+5))?"":">";return{from:t,to:i,options:vl(n.doc,e).map((s,o)=>({label:s,apply:s+r,type:"type",boost:99-o})),validFor:yd}}function ly(n,e,t,i){let r=[],s=0;for(let o of bd(n.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of vl(n.doc,t))r.push({label:"",type:"type",boost:99-s++});return{from:i,to:i,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function ay(n,e,t,i,r){let s=bi(t),o=s?e.tags[Si(n.doc,s)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],a=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:i,to:r,options:a.map(h=>({label:h,type:"property"})),validFor:yd}}function hy(n,e,t,i,r){var s;let o=(s=t.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),l=[],a;if(o){let h=n.sliceDoc(o.from,o.to),c=e.globalAttrs[h];if(!c){let f=bi(t),u=f?e.tags[Si(n.doc,f)]:null;c=u?.attrs&&u.attrs[h]}if(c){let f=n.sliceDoc(i,r).toLowerCase(),u='"',d='"';/^['"]/.test(f)?(a=f[0]=='"'?/^[^"]*$/:/^[^']*$/,u="",d=n.sliceDoc(r,r+1)==f[0]?"":f[0],f=f.slice(1),i++):a=/^[^\s<>='"]*$/;for(let O of c)l.push({label:O,apply:u+O+d,type:"constant"})}}return{from:i,to:r,options:l,validFor:a}}function cy(n,e){let{state:t,pos:i}=e,r=J(t).resolveInner(i,-1),s=r.resolve(i);for(let o=i,l;s==r&&(l=r.childBefore(o));){let a=l.lastChild;if(!a||!a.type.isError||a.fromcy(i,r)}const uy=lt.parser.configure({top:"SingleExpression"}),xd=[{tag:"script",attrs:n=>n.type=="text/typescript"||n.lang=="ts",parser:dd.parser},{tag:"script",attrs:n=>n.type=="text/babel"||n.type=="text/jsx",parser:Od.parser},{tag:"script",attrs:n=>n.type=="text/typescript-jsx",parser:pd.parser},{tag:"script",attrs(n){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(n.type)},parser:uy},{tag:"script",attrs(n){return!n.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(n.type)},parser:lt.parser},{tag:"style",attrs(n){return(!n.lang||n.lang=="css")&&(!n.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(n.type))},parser:Tr.parser}],wd=[{name:"style",parser:Tr.parser.configure({top:"Styles"})}].concat(Sd.map(n=>({name:n,parser:lt.parser}))),kd=pi.define({name:"html",parser:Vb.configure({props:[qr.add({Element(n){let e=/^(\s*)(<\/)?/.exec(n.textAfter);return n.node.to<=n.pos+e[0].length?n.continue():n.lineIndent(n.node.from)+(e[2]?0:n.unit)},"OpenTag CloseTag SelfClosingTag"(n){return n.column(n.node.from)+n.unit},Document(n){if(n.pos+/\s*/.exec(n.textAfter)[0].lengthn.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Un=kd.configure({wrap:td(xd,wd)});function dy(n={}){let e="",t;n.matchClosingTags===!1&&(e="noMatch"),n.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(n.nestedLanguages&&n.nestedLanguages.length||n.nestedAttributes&&n.nestedAttributes.length)&&(t=td((n.nestedLanguages||[]).concat(xd),(n.nestedAttributes||[]).concat(wd)));let i=t?kd.configure({wrap:t,dialect:e}):e?Un.configure({dialect:e}):Un;return new tl(i,[Un.data.of({autocomplete:fy(n)}),n.autoCloseTags!==!1?Oy:[],iy().support,S1().support])}const Wh=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),Oy=v.inputHandler.of((n,e,t,i,r)=>{if(n.composing||n.state.readOnly||e!=t||i!=">"&&i!="/"||!Un.isActiveAt(n.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h,c,f;let u=o.doc.sliceString(a.from-1,a.to)==i,{head:d}=a,O=J(o).resolveInner(d,-1),m;if(u&&i==">"&&O.name=="EndTag"){let g=O.parent;if(((c=(h=g.parent)===null||h===void 0?void 0:h.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(m=Si(o.doc,g.parent,d))&&!Wh.has(m)){let Q=d+(o.doc.sliceString(d,d+1)===">"?1:0),b=``;return{range:a,changes:{from:d,to:Q,insert:b}}}}else if(u&&i=="/"&&O.name=="IncompleteCloseTag"){let g=O.parent;if(O.from==d-2&&((f=g.lastChild)===null||f===void 0?void 0:f.name)!="CloseTag"&&(m=Si(o.doc,g,d))&&!Wh.has(m)){let Q=d+(o.doc.sliceString(d,d+1)===">"?1:0),b=`${m}>`;return{range:S.cursor(d+b.length,-1),changes:{from:d,to:Q,insert:b}}}}return{range:a}});return l.changes.empty?!1:(n.dispatch([s,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),py="#e5c07b",Lh="#e06c75",my="#56b6c2",gy="#ffffff",Fn="#abb2bf",Zo="#7d8799",Qy="#61afef",Sy="#98c379",Bh="#d19a66",by="#c678dd",yy="#21252b",Ih="#2c313a",jh="#282c34",Ms="#353a42",xy="#3E4451",Gh="#528bff",wy=v.theme({"&":{color:Fn,backgroundColor:jh},".cm-content":{caretColor:Gh},".cm-cursor, .cm-dropCursor":{borderLeftColor:Gh},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:xy},".cm-panels":{backgroundColor:yy,color:Fn},".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:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:jh,color:Zo,border:"none"},".cm-activeLineGutter":{backgroundColor:Ih},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Ms},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Ms,borderBottomColor:Ms},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Ih,color:Fn}}},{dark:!0}),ky=cn.define([{tag:p.keyword,color:by},{tag:[p.name,p.deleted,p.character,p.propertyName,p.macroName],color:Lh},{tag:[p.function(p.variableName),p.labelName],color:Qy},{tag:[p.color,p.constant(p.name),p.standard(p.name)],color:Bh},{tag:[p.definition(p.name),p.separator],color:Fn},{tag:[p.typeName,p.className,p.number,p.changed,p.annotation,p.modifier,p.self,p.namespace],color:py},{tag:[p.operator,p.operatorKeyword,p.url,p.escape,p.regexp,p.link,p.special(p.string)],color:my},{tag:[p.meta,p.comment],color:Zo},{tag:p.strong,fontWeight:"bold"},{tag:p.emphasis,fontStyle:"italic"},{tag:p.strikethrough,textDecoration:"line-through"},{tag:p.link,color:Zo,textDecoration:"underline"},{tag:p.heading,fontWeight:"bold",color:Lh},{tag:[p.atom,p.bool,p.special(p.variableName)],color:Bh},{tag:[p.processingInstruction,p.string,p.inserted],color:Sy},{tag:p.invalid,color:gy}]),$y=[wy,Df(ky)];function vy(){return document.querySelector('meta[name="theme"]').getAttribute("content")==="dark"}function Py(){return typeof callbackInterface>"u"?(console.log("'callbackInterface' is undefined"),null):callbackInterface}function Ty(n){return Py()?callbackInterface.readText(n):"Error"}class Cy{constructor(e){const t=this,i=vy(),r=v.theme({"&":{height:"100%",fontSize:"16px"},".cm-scroller":{overflow:"auto"}},{dark:i}),s=v.domEventHandlers({blur(l,a){return a.contentDOM.focus({preventScroll:!0}),!1}});this.exts=[IS,r,dy(),s],i&&this.exts.push($y);const o=_.create({doc:"",extensions:t.exts});this.view=new v({state:o,parent:e})}focus(){this.view.focus()}resetText(e){const t=this,i=_.create({doc:e,extensions:t.exts});this.view.setState(i)}async loadText(e){this.resetText(Ty(e))}insert(e,t,i){this.view.dispatch({changes:{from:t,to:i,insert:e}})}setText(e){this.insert(e,0,this.length())}getText(){return this.view.state.doc.toString()}length(){return this.view.state.doc.length}undo(){ll(this.view)}redo(){pr(this.view)}getUndoDepth(){return n0(this.view.state)}}document.querySelector("#app").innerHTML="
";window.editorBridge=new Cy(document.querySelector("#editor")); diff --git a/app/thirdparty/assets/cm-editor/assets/index-ByStn47a.css b/app/thirdparty/assets/cm-editor/assets/index-ByStn47a.css new file mode 100644 index 0000000000..58b9687d9d --- /dev/null +++ b/app/thirdparty/assets/cm-editor/assets/index-ByStn47a.css @@ -0,0 +1 @@ +body{margin:0}#editor{width:100%;height:100vh}#dashboard{display:none;top:40px;right:20px;padding:6px 8px;position:fixed;border:1px solid gray;border-radius:6px;background-color:#add8e6}.cm-gutters{-webkit-user-select:none;user-select:none} diff --git a/app/thirdparty/assets/cm-editor/index.html b/app/thirdparty/assets/cm-editor/index.html new file mode 100644 index 0000000000..4391edd6c0 --- /dev/null +++ b/app/thirdparty/assets/cm-editor/index.html @@ -0,0 +1,15 @@ + + + + + + + + CodeMirror Editor + + + + +
+ + diff --git a/app/thirdparty/assets/cm-editor/vite.svg b/app/thirdparty/assets/cm-editor/vite.svg new file mode 100644 index 0000000000..e7b8dfb1b2 --- /dev/null +++ b/app/thirdparty/assets/cm-editor/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/thirdparty/assets/fonts/JetBrainsMono-Regular.ttf b/app/thirdparty/assets/fonts/JetBrainsMono-Regular.ttf new file mode 100644 index 0000000000..8da8aa4051 Binary files /dev/null and b/app/thirdparty/assets/fonts/JetBrainsMono-Regular.ttf differ diff --git a/app/thirdparty/java/other/writeily/ui/WrRenameDialog.java b/app/thirdparty/java/other/writeily/ui/WrRenameDialog.java index b8bab4625b..17e552fda0 100644 --- a/app/thirdparty/java/other/writeily/ui/WrRenameDialog.java +++ b/app/thirdparty/java/other/writeily/ui/WrRenameDialog.java @@ -14,6 +14,7 @@ import android.text.Editable; import android.text.InputFilter; import android.text.TextWatcher; +import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; @@ -24,6 +25,7 @@ import androidx.appcompat.app.AlertDialog; import androidx.documentfile.provider.DocumentFile; import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.FragmentActivity; import net.gsantner.markor.R; import net.gsantner.markor.util.MarkorContextUtils; @@ -108,16 +110,25 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { private AlertDialog.Builder setUpDialog(final File file, LayoutInflater inflater) { View root; AlertDialog.Builder dialogBuilder; - dialogBuilder = new AlertDialog.Builder(getActivity(), R.style.Theme_AppCompat_DayNight_Dialog_Rounded); + FragmentActivity activity = getActivity(); + dialogBuilder = new AlertDialog.Builder(activity, R.style.Theme_AppCompat_DayNight_Dialog_Rounded); root = inflater.inflate(R.layout.rename__dialog, null); + DisplayMetrics displayMetrics = GsContextUtils.getDisplayMetrics(activity); + root.setMinimumWidth(GsContextUtils.calculateWidth(displayMetrics, 0.8f, 1000)); dialogBuilder.setTitle(getResources().getString(R.string.rename)); dialogBuilder.setView(root); EditText editText = root.findViewById(R.id.new_name); editText.setFilters(new InputFilter[]{GsContextUtils.instance.makeFilenameInputFilter()}); + String name = file.getName(); + editText.setText(name); + int start = name.lastIndexOf('.'); + if (start < 0) { + start = name.length(); + } + editText.setSelection(start); editText.requestFocus(); - editText.setText(file.getName()); dialogBuilder.setPositiveButton(getString(android.R.string.ok), null); dialogBuilder.setNegativeButton(getString(R.string.cancel), null); diff --git a/app/thirdparty/java/other/writeily/widget/WrFilesWidgetFactory.java b/app/thirdparty/java/other/writeily/widget/WrFilesWidgetFactory.java index 1fdf4ff690..73b6ce1e70 100644 --- a/app/thirdparty/java/other/writeily/widget/WrFilesWidgetFactory.java +++ b/app/thirdparty/java/other/writeily/widget/WrFilesWidgetFactory.java @@ -46,7 +46,6 @@ public void onCreate() { @Override public void onDataSetChanged() { - _widgetFilesList.clear(); final File dir = WrWidgetConfigure.getWidgetDirectory(_context, _appWidgetId); final AppSettings as = AppSettings.get(_context); @@ -63,7 +62,7 @@ public void onDataSetChanged() { _widgetFilesList.addAll(all != null ? Arrays.asList(all) : Collections.emptyList()); } - GsFileUtils.sortFiles(_widgetFilesList, order); + GsFileUtils.sortFiles(_widgetFilesList, order, order.favoriteFirst ? AppSettings.get(_context).getFavouriteFiles() : null); } @Override diff --git a/cm-editor/.gitignore b/cm-editor/.gitignore new file mode 100644 index 0000000000..0775f0acd9 --- /dev/null +++ b/cm-editor/.gitignore @@ -0,0 +1,12 @@ +# Logs +*.log +npm-debug.log* + +# Editors +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store + +# Others +*.local diff --git a/cm-editor/README.md b/cm-editor/README.md new file mode 100644 index 0000000000..c842a945a3 --- /dev/null +++ b/cm-editor/README.md @@ -0,0 +1,53 @@ +# CodeMirror Editor Support for Markor + +## 1. Development + +### Install Node.js Module Dependencies + +```shell +npm install +``` + +### Start Development Server + +```shell +npm run dev +``` + +### Project Structure + +`./src`: source code directory; + +`./src/js/editor-bridge.js`: the main code file for implementing CodeMirror feature support. + +### Build + +```shell +npm run build +``` + +Build output directory: `/app/thirdparty/assets/cm-editor`. + +Based on these build files, Java class `net.gsantner.markor.frontend.textview.CodeMirrorEditor` can create the CodeMirror view for Android. + +## 2. About CodeMirror + +### Features + +[Features](https://codemirror.net/) + +### Examples + +[CodeMirror Examples](https://codemirror.net/examples/) + +### Language Support + +[Language Support](https://codemirror.net/#languages) + +### Huge Document Support + +[CodeMirror Huge Document Demo](https://codemirror.net/examples/million/) + +### Who is using CodeMirror? + +[Sponsors](https://codemirror.net/#sponsors) diff --git a/cm-editor/index.html b/cm-editor/index.html new file mode 100644 index 0000000000..3bf1db1c34 --- /dev/null +++ b/cm-editor/index.html @@ -0,0 +1,14 @@ + + + + + + + + CodeMirror Editor + + +
+ + + diff --git a/cm-editor/package-lock.json b/cm-editor/package-lock.json new file mode 100644 index 0000000000..8b9a6f3358 --- /dev/null +++ b/cm-editor/package-lock.json @@ -0,0 +1,1343 @@ +{ + "name": "cm-editor", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "cm-editor", + "version": "0.0.0", + "dependencies": { + "@codemirror/lang-html": "^6.4.11", + "@codemirror/theme-one-dark": "^6.1.3", + "codemirror": "^6.0.2" + }, + "devDependencies": { + "vite": "^7.3.1" + } + }, + "node_modules/@codemirror/autocomplete": { + "version": "6.20.1", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.20.1.tgz", + "integrity": "sha512-1cvg3Vz1dSSToCNlJfRA2WSI4ht3K+WplO0UMOgmUYPivCyy2oueZY6Lx7M9wThm7SDUBViRmuT+OG/i8+ON9A==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@codemirror/commands": { + "version": "6.10.2", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.10.2.tgz", + "integrity": "sha512-vvX1fsih9HledO1c9zdotZYUZnE4xV0m6i3m25s5DIfXofuprk6cRcLUZvSk3CASUbwjQX21tOGbkY2BH8TpnQ==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.4.0", + "@codemirror/view": "^6.27.0", + "@lezer/common": "^1.1.0" + } + }, + "node_modules/@codemirror/lang-css": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/@codemirror/lang-css/-/lang-css-6.3.1.tgz", + "integrity": "sha512-kr5fwBGiGtmz6l0LSJIbno9QrifNMUusivHbnA1H6Dmqy4HZFte3UAICix1VuKo0lMPKQr2rqB+0BkKi/S3Ejg==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@lezer/common": "^1.0.2", + "@lezer/css": "^1.1.7" + } + }, + "node_modules/@codemirror/lang-html": { + "version": "6.4.11", + "resolved": "https://registry.npmjs.org/@codemirror/lang-html/-/lang-html-6.4.11.tgz", + "integrity": "sha512-9NsXp7Nwp891pQchI7gPdTwBuSuT3K65NGTHWHNJ55HjYcHLllr0rbIZNdOzas9ztc1EUVBlHou85FFZS4BNnw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/lang-css": "^6.0.0", + "@codemirror/lang-javascript": "^6.0.0", + "@codemirror/language": "^6.4.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/css": "^1.1.0", + "@lezer/html": "^1.3.12" + } + }, + "node_modules/@codemirror/lang-javascript": { + "version": "6.2.5", + "resolved": "https://registry.npmjs.org/@codemirror/lang-javascript/-/lang-javascript-6.2.5.tgz", + "integrity": "sha512-zD4e5mS+50htS7F+TYjBPsiIFGanfVqg4HyUz6WNFikgOPf2BgKlx+TQedI1w6n/IqRBVBbBWmGFdLB/7uxO4A==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/language": "^6.6.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.17.0", + "@lezer/common": "^1.0.0", + "@lezer/javascript": "^1.0.0" + } + }, + "node_modules/@codemirror/language": { + "version": "6.12.2", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-6.12.2.tgz", + "integrity": "sha512-jEPmz2nGGDxhRTg3lTpzmIyGKxz3Gp3SJES4b0nAuE5SWQoKdT5GoQ69cwMmFd+wvFUhYirtDTr0/DRHpQAyWg==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.23.0", + "@lezer/common": "^1.5.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0", + "style-mod": "^4.0.0" + } + }, + "node_modules/@codemirror/lint": { + "version": "6.9.5", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.9.5.tgz", + "integrity": "sha512-GElsbU9G7QT9xXhpUg1zWGmftA/7jamh+7+ydKRuT0ORpWS3wOSP0yT1FOlIZa7mIJjpVPipErsyvVqB9cfTFA==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.35.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/search": { + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.6.0.tgz", + "integrity": "sha512-koFuNXcDvyyotWcgOnZGmY7LZqEOXZaaxD/j6n18TCLx2/9HieZJ5H6hs1g8FiRxBD0DNfs0nXn17g872RmYdw==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.37.0", + "crelt": "^1.0.5" + } + }, + "node_modules/@codemirror/state": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.5.4.tgz", + "integrity": "sha512-8y7xqG/hpB53l25CIoit9/ngxdfoG+fx+V3SHBrinnhOtLvKHRyAJJuHzkWrR4YXXLX8eXBsejgAAxHUOdW1yw==", + "license": "MIT", + "dependencies": { + "@marijn/find-cluster-break": "^1.0.0" + } + }, + "node_modules/@codemirror/theme-one-dark": { + "version": "6.1.3", + "resolved": "https://registry.npmjs.org/@codemirror/theme-one-dark/-/theme-one-dark-6.1.3.tgz", + "integrity": "sha512-NzBdIvEJmx6fjeremiGp3t/okrLPYT0d9orIc7AFun8oZcRk58aejkqhv6spnz4MLAevrKNPMQYXEWMg4s+sKA==", + "license": "MIT", + "dependencies": { + "@codemirror/language": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0", + "@lezer/highlight": "^1.0.0" + } + }, + "node_modules/@codemirror/view": { + "version": "6.39.17", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.39.17.tgz", + "integrity": "sha512-Aim4lFqhbijnchl83RLfABWueSGs1oUCSv0mru91QdhpXQeNKprIdRO9LWA4cYkJvuYTKGJN7++9MXx8XW43ag==", + "license": "MIT", + "dependencies": { + "@codemirror/state": "^6.5.0", + "crelt": "^1.0.6", + "style-mod": "^4.1.0", + "w3c-keyname": "^2.2.4" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.3.tgz", + "integrity": "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.3.tgz", + "integrity": "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.3.tgz", + "integrity": "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.3.tgz", + "integrity": "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.3.tgz", + "integrity": "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.3.tgz", + "integrity": "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.3.tgz", + "integrity": "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.3.tgz", + "integrity": "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.3.tgz", + "integrity": "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.3.tgz", + "integrity": "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.3.tgz", + "integrity": "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.3.tgz", + "integrity": "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.3.tgz", + "integrity": "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.3.tgz", + "integrity": "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.3.tgz", + "integrity": "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.3.tgz", + "integrity": "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.3.tgz", + "integrity": "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.3.tgz", + "integrity": "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.3.tgz", + "integrity": "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.3.tgz", + "integrity": "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.3.tgz", + "integrity": "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.3.tgz", + "integrity": "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.3.tgz", + "integrity": "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.3.tgz", + "integrity": "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.3.tgz", + "integrity": "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.3.tgz", + "integrity": "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@lezer/common": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.5.1.tgz", + "integrity": "sha512-6YRVG9vBkaY7p1IVxL4s44n5nUnaNnGM2/AckNgYOnxTG2kWh1vR8BMxPseWPjRNpb5VtXnMpeYAEAADoRV1Iw==", + "license": "MIT" + }, + "node_modules/@lezer/css": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@lezer/css/-/css-1.3.1.tgz", + "integrity": "sha512-PYAKeUVBo3HFThruRyp/iK91SwiZJnzXh8QzkQlwijB5y+N5iB28+iLk78o2zmKqqV0uolNhCwFqB8LA7b0Svg==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.3.0" + } + }, + "node_modules/@lezer/highlight": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/highlight/-/highlight-1.2.3.tgz", + "integrity": "sha512-qXdH7UqTvGfdVBINrgKhDsVTJTxactNNxLk7+UMwZhU13lMHaOBlJe9Vqp907ya56Y3+ed2tlqzys7jDkTmW0g==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.3.0" + } + }, + "node_modules/@lezer/html": { + "version": "1.3.13", + "resolved": "https://registry.npmjs.org/@lezer/html/-/html-1.3.13.tgz", + "integrity": "sha512-oI7n6NJml729m7pjm9lvLvmXbdoMoi2f+1pwSDJkl9d68zGr7a9Btz8NdHTGQZtW2DA25ybeuv/SyDb9D5tseg==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.0.0", + "@lezer/lr": "^1.0.0" + } + }, + "node_modules/@lezer/javascript": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/@lezer/javascript/-/javascript-1.5.4.tgz", + "integrity": "sha512-vvYx3MhWqeZtGPwDStM2dwgljd5smolYD2lR2UyFcHfxbBQebqx8yjmFmxtJ/E6nN6u1D9srOiVWm3Rb4tmcUA==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.2.0", + "@lezer/highlight": "^1.1.3", + "@lezer/lr": "^1.3.0" + } + }, + "node_modules/@lezer/lr": { + "version": "1.4.8", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-1.4.8.tgz", + "integrity": "sha512-bPWa0Pgx69ylNlMlPvBPryqeLYQjyJjqPx+Aupm5zydLIF3NE+6MMLT8Yi23Bd9cif9VS00aUebn+6fDIGBcDA==", + "license": "MIT", + "dependencies": { + "@lezer/common": "^1.0.0" + } + }, + "node_modules/@marijn/find-cluster-break": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@marijn/find-cluster-break/-/find-cluster-break-1.0.2.tgz", + "integrity": "sha512-l0h88YhZFyKdXIFNfSWpyjStDjGHwZ/U7iobcK1cQQD8sejsONdQtTVU+1wVN1PBw40PiiHB1vA5S7VTfQiP9g==", + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.59.0.tgz", + "integrity": "sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.59.0.tgz", + "integrity": "sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.59.0.tgz", + "integrity": "sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.59.0.tgz", + "integrity": "sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.59.0.tgz", + "integrity": "sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.59.0.tgz", + "integrity": "sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.59.0.tgz", + "integrity": "sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.59.0.tgz", + "integrity": "sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.59.0.tgz", + "integrity": "sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.59.0.tgz", + "integrity": "sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.59.0.tgz", + "integrity": "sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.59.0.tgz", + "integrity": "sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.59.0.tgz", + "integrity": "sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.59.0.tgz", + "integrity": "sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.59.0.tgz", + "integrity": "sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.59.0.tgz", + "integrity": "sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.59.0.tgz", + "integrity": "sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.59.0.tgz", + "integrity": "sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.59.0.tgz", + "integrity": "sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.59.0.tgz", + "integrity": "sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.59.0.tgz", + "integrity": "sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.59.0.tgz", + "integrity": "sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.59.0.tgz", + "integrity": "sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.59.0.tgz", + "integrity": "sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.59.0.tgz", + "integrity": "sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/codemirror": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/codemirror/-/codemirror-6.0.2.tgz", + "integrity": "sha512-VhydHotNW5w1UGK0Qj96BwSk/Zqbp9WbnyK2W/eVMv4QyF41INRGpjUhFJY7/uDNuudSc33a/PKr4iDqRduvHw==", + "license": "MIT", + "dependencies": { + "@codemirror/autocomplete": "^6.0.0", + "@codemirror/commands": "^6.0.0", + "@codemirror/language": "^6.0.0", + "@codemirror/lint": "^6.0.0", + "@codemirror/search": "^6.0.0", + "@codemirror/state": "^6.0.0", + "@codemirror/view": "^6.0.0" + } + }, + "node_modules/crelt": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/crelt/-/crelt-1.0.6.tgz", + "integrity": "sha512-VQ2MBenTq1fWZUH9DJNGti7kKv6EeAuYr3cLwxUWhIu1baTaXh4Ib5W2CqHVqib4/MqbYGJqiL3Zb8GJZr3l4g==", + "license": "MIT" + }, + "node_modules/esbuild": { + "version": "0.27.3", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.3.tgz", + "integrity": "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.3", + "@esbuild/android-arm": "0.27.3", + "@esbuild/android-arm64": "0.27.3", + "@esbuild/android-x64": "0.27.3", + "@esbuild/darwin-arm64": "0.27.3", + "@esbuild/darwin-x64": "0.27.3", + "@esbuild/freebsd-arm64": "0.27.3", + "@esbuild/freebsd-x64": "0.27.3", + "@esbuild/linux-arm": "0.27.3", + "@esbuild/linux-arm64": "0.27.3", + "@esbuild/linux-ia32": "0.27.3", + "@esbuild/linux-loong64": "0.27.3", + "@esbuild/linux-mips64el": "0.27.3", + "@esbuild/linux-ppc64": "0.27.3", + "@esbuild/linux-riscv64": "0.27.3", + "@esbuild/linux-s390x": "0.27.3", + "@esbuild/linux-x64": "0.27.3", + "@esbuild/netbsd-arm64": "0.27.3", + "@esbuild/netbsd-x64": "0.27.3", + "@esbuild/openbsd-arm64": "0.27.3", + "@esbuild/openbsd-x64": "0.27.3", + "@esbuild/openharmony-arm64": "0.27.3", + "@esbuild/sunos-x64": "0.27.3", + "@esbuild/win32-arm64": "0.27.3", + "@esbuild/win32-ia32": "0.27.3", + "@esbuild/win32-x64": "0.27.3" + } + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.8", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", + "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/rollup": { + "version": "4.59.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.59.0.tgz", + "integrity": "sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.59.0", + "@rollup/rollup-android-arm64": "4.59.0", + "@rollup/rollup-darwin-arm64": "4.59.0", + "@rollup/rollup-darwin-x64": "4.59.0", + "@rollup/rollup-freebsd-arm64": "4.59.0", + "@rollup/rollup-freebsd-x64": "4.59.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.59.0", + "@rollup/rollup-linux-arm-musleabihf": "4.59.0", + "@rollup/rollup-linux-arm64-gnu": "4.59.0", + "@rollup/rollup-linux-arm64-musl": "4.59.0", + "@rollup/rollup-linux-loong64-gnu": "4.59.0", + "@rollup/rollup-linux-loong64-musl": "4.59.0", + "@rollup/rollup-linux-ppc64-gnu": "4.59.0", + "@rollup/rollup-linux-ppc64-musl": "4.59.0", + "@rollup/rollup-linux-riscv64-gnu": "4.59.0", + "@rollup/rollup-linux-riscv64-musl": "4.59.0", + "@rollup/rollup-linux-s390x-gnu": "4.59.0", + "@rollup/rollup-linux-x64-gnu": "4.59.0", + "@rollup/rollup-linux-x64-musl": "4.59.0", + "@rollup/rollup-openbsd-x64": "4.59.0", + "@rollup/rollup-openharmony-arm64": "4.59.0", + "@rollup/rollup-win32-arm64-msvc": "4.59.0", + "@rollup/rollup-win32-ia32-msvc": "4.59.0", + "@rollup/rollup-win32-x64-gnu": "4.59.0", + "@rollup/rollup-win32-x64-msvc": "4.59.0", + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/style-mod": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/style-mod/-/style-mod-4.1.3.tgz", + "integrity": "sha512-i/n8VsZydrugj3Iuzll8+x/00GH2vnYsk1eomD8QiRrSAeW6ItbCQDtfXCeJHd0iwiNagqjQkvpvREEPtW3IoQ==", + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/vite": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz", + "integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.27.0", + "fdir": "^6.5.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.43.0", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/w3c-keyname": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", + "integrity": "sha512-dpojBhNsCNN7T82Tm7k26A6G9ML3NkhDsnw9n/eoxSRlVBB4CEtIQ/KTCLI2Fwf3ataSXRhYFkQi3SlnFwPvPQ==", + "license": "MIT" + } + } +} diff --git a/cm-editor/package.json b/cm-editor/package.json new file mode 100644 index 0000000000..87b700173e --- /dev/null +++ b/cm-editor/package.json @@ -0,0 +1,19 @@ +{ + "name": "cm-editor", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview" + }, + "devDependencies": { + "vite": "^7.3.1" + }, + "dependencies": { + "@codemirror/lang-html": "^6.4.11", + "@codemirror/theme-one-dark": "^6.1.3", + "codemirror": "^6.0.2" + } +} diff --git a/cm-editor/public/vite.svg b/cm-editor/public/vite.svg new file mode 100644 index 0000000000..e7b8dfb1b2 --- /dev/null +++ b/cm-editor/public/vite.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/cm-editor/src/css/style.css b/cm-editor/src/css/style.css new file mode 100644 index 0000000000..71806dad46 --- /dev/null +++ b/cm-editor/src/css/style.css @@ -0,0 +1,23 @@ +body { + margin: 0; +} + +#editor { + width: 100%; + height: 100vh; +} + +#dashboard { + display: none; + top: 40px; + right: 20px; + padding: 6px 8px; + position: fixed; + border: 1px solid gray; + border-radius: 6px; + background-color: lightblue; +} + +.cm-gutters { + user-select: none; +} diff --git a/cm-editor/src/js/callback-interface.js b/cm-editor/src/js/callback-interface.js new file mode 100644 index 0000000000..7b0d29e685 --- /dev/null +++ b/cm-editor/src/js/callback-interface.js @@ -0,0 +1,24 @@ +function getCallbackInterface() { + if (typeof callbackInterface === 'undefined') { + console.log("'callbackInterface' is undefined"); + return null; + } else { + return callbackInterface; + } +} + +export function focus() { + const callback = getCallbackInterface(); + if (callback) { + callbackInterface.focus(); + } +} + +export function readText(path) { + const callback = getCallbackInterface(); + if (callback) { + return callbackInterface.readText(path); + } else { + return "Error"; + } +} diff --git a/cm-editor/src/js/dashboard.js b/cm-editor/src/js/dashboard.js new file mode 100644 index 0000000000..e1946adb9f --- /dev/null +++ b/cm-editor/src/js/dashboard.js @@ -0,0 +1,111 @@ +/** + * Dashboard is used for development, not production. + */ +class Dashboard { + #viewList; + + constructor() { + this.#viewList = document.createElement('ol'); + this.#viewList.style.listStyleType = 'none'; + this.#viewList.style.padding = 0; + this.#viewList.style.margin = 0; + this.#getDashboard().appendChild(this.#viewList); + } + + #getDashboard() { + return document.getElementById('dashboard'); + } + + addView(name, id, text) { + let element = document.createElement(name); + if (id) { + element.id = id; + } + if (text) { + element.innerText = text; + } + + let li = document.createElement('li'); + li.appendChild(element); + this.#viewList.appendChild(li); + + return element; + } + + addButton(text, onclick) { + this.addView('button', null, text).onclick = onclick; + } + + isHide() { + return this.#getDashboard().style.display === 'none'; + } + + show() { + let dashboard = this.#getDashboard(); + if (dashboard.children.length > 0) { + dashboard.style.display = 'block'; + } + } + + hide() { + let dashboard = this.#getDashboard(); + dashboard.style.display = 'none'; + } +} + +////// + +let dashboard; + +export function toggleDashboard(show) { + if (show) { + if (dashboard == null) { + dashboard = setupDashboard(); + } + dashboard.show(); + } else if (dashboard) { + dashboard.hide(); + } +} + +let logElement; + +export function getLog() { + if (dashboard == null) { + dashboard = setupDashboard(); + } + return { + set: (text) => { + if (dashboard.isHide()) { + return; + } + if (logElement) { + logElement.value = text; + } + }, + append: (text) => { + if (logElement) { + logElement.value += text + '\n'; + } + } + }; +} + +// For development, test buttons can be added here +function setupDashboard() { + const dashboard = new Dashboard(); + + dashboard.addButton('setText', () => editorBridge.setText('// Hello')); + dashboard.addButton('getText', () => console.log(editorBridge.getText())); + dashboard.addButton('undo', () => editorBridge.undo()); + dashboard.addButton('redo', () => editorBridge.redo()); + + logElement = dashboard.addView('textarea', 'log'); + logElement.readOnly = true; + logElement.style.width = '100px'; + logElement.style.height = '100px'; + logElement.style.marginTop = '12px'; + dashboard.addButton('clear', () => getLog().set('')); + + return dashboard; +} diff --git a/cm-editor/src/js/editor-bridge.js b/cm-editor/src/js/editor-bridge.js new file mode 100644 index 0000000000..90a36217ee --- /dev/null +++ b/cm-editor/src/js/editor-bridge.js @@ -0,0 +1,112 @@ +import { EditorView, basicSetup } from "codemirror"; +import { EditorState } from "@codemirror/state"; +import { undo, redo, undoDepth } from "@codemirror/commands"; +import { html } from "@codemirror/lang-html"; +import { oneDark } from "@codemirror/theme-one-dark"; +import { isDarkMode } from "./theme.js"; +// import { getLog } from "./dashboard.js"; +import { readText } from "./callback-interface.js" + +class EditorBridge { + constructor(element) { + const that = this; + const isDarkTheme = isDarkMode(); + + const theme = EditorView.theme({ + "&": { height: "100%", fontSize: "16px" }, + ".cm-scroller": { overflow: "auto" } + }, { dark: isDarkTheme }); + + const blurHandler = EditorView.domEventHandlers({ + blur(event, view) { + view.contentDOM.focus({ preventScroll: true }); + return false; + } + }); + + this.exts = [ + basicSetup, + theme, + html(), + blurHandler + ]; + + // this.exts.push(EditorView.lineWrapping); + + if (isDarkTheme) { + this.exts.push(oneDark); + } + + const state = EditorState.create({ + doc: "", + extensions: that.exts + }); + + this.view = new EditorView({ state, parent: element }); + + // this.setText(`\n`); + } + + focus() { + this.view.focus(); + } + + /** + * Set text and reset state. + * @param {*} text the text + */ + resetText(text) { + const that = this; + const newState = EditorState.create({ + doc: text, + extensions: that.exts + }); + this.view.setState(newState); + } + + /** + * Load text and reset state. + * This method can load large text with file size less than 2 MB. + * + * @param {*} path the text file path + */ + async loadText(path) { + this.resetText(readText(path)); + } + + insert(text, start, end) { + // https://stackoverflow.com/questions/72716094/how-to-programmatically-change-the-editors-value-in-codemirror-6/ + this.view.dispatch({ + changes: { + from: start, to: end, insert: text + } + }); + } + + setText(text) { + this.insert(text, 0, this.length()); + } + + getText() { + // https://stackoverflow.com/questions/72982051/how-to-get-the-text-value-of-a-codemirror-6-editor/ + return this.view.state.doc.toString(); + } + + length() { + return this.view.state.doc.length; + } + + undo() { + undo(this.view); + } + + redo() { + redo(this.view); + } + + getUndoDepth() { + return undoDepth(this.view.state); + } +} + +export default EditorBridge; diff --git a/cm-editor/src/js/theme.js b/cm-editor/src/js/theme.js new file mode 100644 index 0000000000..18e6f9cd67 --- /dev/null +++ b/cm-editor/src/js/theme.js @@ -0,0 +1,4 @@ +export function isDarkMode() { + let content = document.querySelector('meta[name="theme"]').getAttribute('content'); + return content === "dark"; +} diff --git a/cm-editor/src/main.js b/cm-editor/src/main.js new file mode 100644 index 0000000000..fd007eb50b --- /dev/null +++ b/cm-editor/src/main.js @@ -0,0 +1,10 @@ +import './css/style.css'; +import EditorBridge from './js/editor-bridge.js'; +import { toggleDashboard } from './js/dashboard.js'; + +document.querySelector('#app').innerHTML = "
"; + +// Just expose editor bridge +window.editorBridge = new EditorBridge(document.querySelector('#editor')); + +toggleDashboard(false); diff --git a/cm-editor/vite.config.js b/cm-editor/vite.config.js new file mode 100644 index 0000000000..f8e439b584 --- /dev/null +++ b/cm-editor/vite.config.js @@ -0,0 +1,8 @@ +// Vite build configuration +export default { + base: './', + build: { + outDir: '../app/thirdparty/assets/cm-editor', + emptyOutDir: '../app/thirdparty/assets/cm-editor' + } +}; diff --git a/doc/keyboard-shortcuts.md b/doc/keyboard-shortcuts.md index 4f94abc6ad..36a7bacdb8 100644 --- a/doc/keyboard-shortcuts.md +++ b/doc/keyboard-shortcuts.md @@ -6,7 +6,7 @@ ### Edit -| Shortcut Keys | Action | +| Shortcut Key | Action | | ---------------- | --------------------------------------- | | Ctrl + A | Select all | | Ctrl + C | Copy | @@ -45,17 +45,17 @@ ### Edit & View -| Shortcut Keys | Action | -| ------------- | ------------------------------------------------ | -| Ctrl + F | Search | -| Ctrl + P | Print | -| Ctrl + / | Toggle to preview/edit | -| Ctrl + ; | Show more menu options | -| Ctrl + ' | Run title click (to show table of contents, ...) | +| Shortcut Key | Action | +| ------------ | ------------------------------------------------ | +| Ctrl + F | Search | +| Ctrl + P | Print | +| Ctrl + / | Toggle to preview/edit | +| Ctrl + ; | Show more menu options | +| Ctrl + ' | Run title click (to show table of contents, ...) | ## Markdown -| Shortcut Keys | Action | +| Shortcut Key | Action | | ---------------- | ----------------- | | Ctrl + 1 ~ 3 | Heading 1 ~ 3 | | Ctrl + B | Bold | @@ -71,18 +71,18 @@ ## AsciiDoc -| Shortcut Keys | Action | -| ------------- | ------ | -| Ctrl + I | Italic | +| Shortcut Key | Action | +| ------------ | ------ | +| Ctrl + I | Italic | ## Org Mode -| Shortcut Keys | Action | -| ------------- | ------ | -| Ctrl + I | Italic | +| Shortcut Key | Action | +| ------------ | ------ | +| Ctrl + I | Italic | ## Zim Wiki -| Shortcut Keys | Action | -| ------------- | ------ | -| Ctrl + I | Italic | +| Shortcut Key | Action | +| ------------ | ------ | +| Ctrl + I | Italic |